mirror of
https://github.com/KeymonSoft/Salma_Viejo.git
synced 2026-04-17 12:56:26 +00:00
158 lines
4.1 KiB
QBasic
158 lines
4.1 KiB
QBasic
B4A=true
|
|
Group=Default Group
|
|
ModulesStructureVersion=1
|
|
Type=Activity
|
|
Version=6.8
|
|
@EndOfDesignText@
|
|
#Region Activity Attributes
|
|
#FullScreen: False
|
|
#IncludeTitle: True
|
|
#End Region
|
|
|
|
Sub Process_Globals
|
|
'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
|
|
|
|
End Sub
|
|
|
|
Sub Globals
|
|
'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
|
|
End Sub
|
|
|
|
Sub Activity_Create(FirstTime As Boolean)
|
|
If(FirstTime) Then
|
|
g.Initialize("GPS")
|
|
End If
|
|
ruta = File.DirInternal
|
|
Activity.LoadLayout("tarjeta")
|
|
borra.Visible = False
|
|
Titulo.Text = "Acumulado"
|
|
b_desc.Visible = False
|
|
|
|
' 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)
|
|
'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 Activity_Resume
|
|
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 from HIST_VENTAS WHERE HVD_CLIENTE IN (Select CUENTA from cuentaa) order by HVD_PRONOMBRE 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"))
|
|
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 Activity_Pause (UserClosed As Boolean)
|
|
|
|
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
|
|
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 |