Files
Durakelo/B4A/C_TicketsDia.bas
Jose Alberto Guerra Ugalde 59c37d1621 20/10/23 - RMIs
- Se agregó código para meter RMIs con el clic largo sobre un producto.
2023-10-20 01:23:13 -06:00

155 lines
4.7 KiB
QBasic

B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=Class
Version=11.5
@EndOfDesignText@
Sub Class_Globals
Private Root As B4XView 'ignore
Private xui As XUI 'ignore
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim skmt As SQL
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim c As Cursor
Dim ruta As String
Dim ListView1 As ListView
Dim b_noventa As Button
Dim nombre_boton As String
End Sub
'You can add more parameters here.
Public Sub Initialize As Object
Return Me
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("ticketsDia")
ruta = File.DirInternal
' se crea o no el archivo de la base de ddatos de kmt
'NOTAS SI SE MODIFICA LA ESTRUCTURA SE QUITA EL IF Y SE VA DIRECTO A LA SENTENCIA FILE.COPY PARA QUE
'TOME LA NUEVA ESTRUCTURA ES MUY IMPORTANTE TENER EL IF DE LO CONTRARIO SOLO LO ESCRIBE UNA VEZ Y LO BORRA
'SI SE REGRESA A ESTE ACTIVIDAD.
If File.Exists(ruta, "kmt.db") = False Then
File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
End If
skmt.Initialize(ruta,"kmt.db", True)
c=skmt.ExecQuery("select PC_CLIENTE,PC_MONTO,PC_NOART FROM PEDIDO_CLIENTE ORDER BY PC_FECHA asc")
ListView1.Clear
If c.RowCount>0 Then
For i=0 To c.RowCount -1
c.Position=i
Dim label1 As Label
label1 = ListView1.TwoLinesLayout.Label
label1.TextSize = 10
label1.TextColor = Colors.Black
Dim label2 As Label
label2 = ListView1.TwoLinesLayout.SecondLabel
label2.TextSize = 15
label2.TextColor = Colors.Blue
ListView1.AddTwoLines(c.GetString("PC_CLIENTE"),"Cantidad #"& c.GetString("PC_NOART")& " SubTotal $"& c.GetString("PC_MONTO"))
Next
End If
'la_no_ird.Text = c.GetString("PR_CF_SALDO_ACORT")
'ListView1.AddTwoLines(c.GetString("pr_cd_nombre"),c.GetString("pr_cd_colonia"))
' Next
'End If
End Sub
Sub B4XPage_Appear
nombre_boton = "NOVENTA"
c=skmt.ExecQuery("select PC_CLIENTE,PC_MONTO,PC_NOART,(select CAT_CL_NOMBRE from kmt_info where cat_cl_codigo = pc_cliente ) as NOMBRE FROM PEDIDO_CLIENTE ORDER BY PC_FECHA asc")
ListView1.Clear
If c.RowCount>0 Then
For i=0 To c.RowCount -1
c.Position=i
Dim label1 As Label
label1 = ListView1.TwoLinesLayout.Label
label1.TextSize = 15
label1.TextColor = Colors.Black
Dim label2 As Label
label2 = ListView1.TwoLinesLayout.SecondLabel
label2.TextSize = 10
label2.TextColor = Colors.Blue
ListView1.AddTwoLines(c.GetString("PC_CLIENTE"),c.GetString("NOMBRE") &" Cantidad #"& c.GetString("PC_NOART")& " SubTotal $"& c.GetString("PC_MONTO"))
Next
End If
c.Close
End Sub
Sub Regresar_Click
' StartActivity(fila)
End Sub
Sub Activity_KeyPress (key As Int) As Boolean
' BACK key pressed
If key=KeyCodes.KEYCODE_BACK Then
' I want to capture the key here so I return True
' StartActivity(seleccion)
'Return True
End If
' Returning False signals the system to handle the key
Return False
End Sub
Sub ListView1_ItemLongClick (Position As Int, Value As Object)
skmt.ExecNonQuery("delete from CUENTAA")
skmt.ExecNonQuery2("INSERT INTO CUENTAA VALUES (?)", Array As Object(Value))
' StartActivity(fila)
B4XPages.ShowPage("Cliente")
End Sub
Sub b_noventa_Click
If nombre_boton = "NOVENTA" Then
nombre_boton = "VENTA"
b_noventa.Text ="VENTA"
c=skmt.ExecQuery("select NV_CLIENTE,NV_MOTIVO,NV_COMM FROM NOVENTA ORDER BY NV_CLIENTE asc")
ListView1.Clear
If c.RowCount>0 Then
For i=0 To c.RowCount -1
c.Position=i
Dim label1 As Label
label1 = ListView1.TwoLinesLayout.Label
label1.TextSize = 15
label1.TextColor = Colors.Black
Dim label2 As Label
label2 = ListView1.TwoLinesLayout.SecondLabel
label2.TextSize = 10
label2.TextColor = Colors.Blue
ListView1.AddTwoLines(c.GetString("NV_CLIENTE"),"Motivo #"& c.GetString("NV_MOTIVO")& " Comentario $"& c.GetString("NV_COMM"))
Next
End If
Else
nombre_boton = "NOVENTA"
b_noventa.Text ="NO VENTA"
c=skmt.ExecQuery("select PC_CLIENTE,PC_MONTO,PC_NOART,(select CAT_CL_NOMBRE from kmt_info where cat_cl_codigo = pc_cliente ) as NOMBRE FROM PEDIDO_CLIENTE ORDER BY PC_FECHA asc")
ListView1.Clear
If c.RowCount>0 Then
For i=0 To c.RowCount -1
c.Position=i
Dim label1 As Label
label1 = ListView1.TwoLinesLayout.Label
label1.TextSize = 15
label1.TextColor = Colors.Black
Dim label2 As Label
label2 = ListView1.TwoLinesLayout.SecondLabel
label2.TextSize = 10
label2.TextColor = Colors.Blue
ListView1.AddTwoLines(c.GetString("PC_CLIENTE"),c.GetString("NOMBRE") &" Cantidad #"& c.GetString("PC_NOART")& " SubTotal $"& c.GetString("PC_MONTO"))
Next
End If
c.Close
End If
End Sub