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 Dim g As GPS Dim clie_id As String Dim sDate,sTime As String Dim usuario As String '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 Regresar As Button Dim ListView1 As ListView Dim L_CANT As Label Dim L_TOTAL As Label Dim borra As Button Dim Existe As String Dim result As String ' Dim lat_gps, lon_gps As String Private Titulo As Label Private b_desc As Button Private ListView2 As ListView Private B_RMI As Button End Sub Private Sub B4XPage_Created (Root1 As B4XView) Root = Root1 ruta = File.DirInternal Root.LoadLayout("tarjeta") B_RMI.Visible = True borra.Visible = False Titulo.Text = "Acumulado" b_desc.Visible = False 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) End Sub Sub B4XPage_Appear If g.GPSEnabled=False Then ToastMessageShow("Habilitar el GPS", True) StartActivity(g.LocationSettingsIntent) Else g.Start(0,0) End If L_CANT.Text ="" L_TOTAL.Text="" c=skmt.ExecQuery("select count(*) as EXISTE from HIST_VENTAS WHERE HVD_CLIENTE IN (Select CUENTA from cuentaa)") C.Position=0 Existe = C.GetString("EXISTE") C.Close c=skmt.ExecQuery("select HVD_CLIENTE,HVD_PRONOMBRE,HVD_CANT,HVD_COSTO_TOT, HVD_FECHA from HIST_VENTAS WHERE HVD_CLIENTE IN (Select CUENTA from cuentaa) order by HVD_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("HVD_PRONOMBRE"),"Cantidad #"& c.GetString("HVD_CANT")& " SubTotal $"& c.GetString("HVD_COSTO_TOT")& " FECHA " &c.GetString("HVD_FECHA") ) Next End If If Existe <> 0 Then c=skmt.ExecQuery("select SUM(HVD_CANT) AS PC_NOART, SUM(HVD_COSTO_TOT) AS PC_MONTO from HIST_VENTAS where HVD_CLIENTE in (Select CUENTA from cuentaa)") C.Position=0 L_CANT.Text = c.GetString("PC_NOART") L_TOTAL.Text = c.GetString("PC_MONTO") End If 'la_no_ird.Text = c.GetString("PR_CF_SALDO_ACORT") End Sub Sub GPS_LocationChanged (Location1 As Location) 'lat_gps=Location1.ConvertToSeconds(Location1.Latitude) 'lon_gps=Location1.ConvertToSeconds(Location1.Longitude) End Sub Sub Regresar_Click B_RMI.Visible = False 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 ListView2_ItemClick (Position As Int, Value As Object) ListView2.Visible = False ListView1.Visible = True End Sub Sub ListView1_ItemClick (Position As Int, Value As Object) ListView2.Visible = True ListView1.Visible = False Dim label1 As Label For i=0 To 20 label1 = ListView2.SingleLineLayout.Label label1.TextSize = 15 label1.TextColor = Colors.Black ListView2.AddSingleLine(i) Next End Sub Sub B_RMI_Click c=skmt.ExecQuery("select HR_CLIENTE,HR_PRONOMBRE,HR_CANT from HIST_RMI WHERE HR_CLIENTE IN (Select CUENTA from cuentaa)") 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("HR_PRONOMBRE"),"Cantidad #"& c.GetString("HR_CANT") ) Next End If End Sub