mirror of
https://github.com/KeymonSoft/Salma_Viejo.git
synced 2026-04-21 14:49:25 +00:00
- Commit inicial
This commit is contained in:
237
colonia.bas
Normal file
237
colonia.bas
Normal file
@@ -0,0 +1,237 @@
|
||||
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 ruta As String
|
||||
Dim q_buscar 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 skmt As SQL
|
||||
Dim c As Cursor
|
||||
Dim c2 As Cursor
|
||||
Dim s As Cursor
|
||||
Dim ListView1 As ListView
|
||||
Dim entro As String
|
||||
Dim gest As Button
|
||||
Dim lfila As Label
|
||||
Dim busca As EditText
|
||||
Dim colonia As String
|
||||
Private b_qr As Button
|
||||
Private qr As QRCode
|
||||
' Dim sc As Zxing_scanner
|
||||
Dim sc As JhsIceZxing1
|
||||
Dim CODIGO As String
|
||||
End Sub
|
||||
|
||||
Sub Activity_Create(FirstTime As Boolean)
|
||||
'Do not forget to load the layout file created with the visual designer. For example:
|
||||
'Activity.LoadLayout("Layout1")
|
||||
Activity.LoadLayout("fila")
|
||||
'Dim ruta As String
|
||||
entro ="2"
|
||||
' valido donde escribo el archivo de la base de datos de kmt
|
||||
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
|
||||
qr.initialize
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Resume
|
||||
' b_qr.Visible = True
|
||||
b_qr.Text = "Código QR"
|
||||
busca.Text = ""
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
entro ="2"
|
||||
colonia = 0
|
||||
' esto es para rutas se quito por colonia c=skmt.ExecQuery("select CAT_CL_RUTA, count(*) as cuantos from kmt_info where gestion = 0 group by CAT_CL_RUTA order by CAT_CL_RUTA asc")
|
||||
'SE COMENTA EL SIGUIENTE CODIGO PARA QUE TODAS LAS TIENDAS APARESCAN.
|
||||
|
||||
' c=skmt.ExecQuery("select CAT_CL_COLONIA, count(*) as cuantos from kmt_info where gestion = 0 group by CAT_CL_COLONIA order by CAT_CL_COLONIA asc")
|
||||
c=skmt.ExecQuery("select CAT_CL_NOMBRE, CAT_CL_CALLE, CAT_CL_CODIGO from kmt_info where gestion = 0 ORDER BY CAT_CL_CODIGO")
|
||||
ListView1.Clear
|
||||
lfila.Text = "NOMBRE"
|
||||
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 = 13
|
||||
label1.TextColor = Colors.Black
|
||||
Dim label2 As Label
|
||||
label2 = ListView1.TwoLinesLayout.SecondLabel
|
||||
label2.TextSize = 13
|
||||
label2.TextColor = Colors.Black
|
||||
ListView1.AddTwoLines(c.GetString("CAT_CL_CODIGO"), c.GetString("CAT_CL_NOMBRE"))
|
||||
Next
|
||||
End If
|
||||
entro = "4"
|
||||
' ESTE FUE EL FIN DEL CODIGO COMENTADO
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Pause (UserClosed As Boolean)
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Sub ListView1_ItemClick (Position As Int, Value As Object)
|
||||
|
||||
If colonia = 0 Then
|
||||
colonia = Value
|
||||
End If
|
||||
|
||||
|
||||
If entro = "2" Then
|
||||
c2=skmt.ExecQuery2("select CAT_CL_CALLE, CAT_CL_COLONIA, count(*) as cuantos from kmt_info where gestion = 0 and CAT_CL_COLONIA = ? GROUP BY CAT_CL_CALLE, CAT_CL_COLONIA order by CAT_CL_CALLE ", Array As String(Value))
|
||||
ListView1.Clear
|
||||
lfila.text = "Calle"
|
||||
|
||||
If c2.RowCount>0 Then
|
||||
For i=0 To c2.RowCount -1
|
||||
c2.Position=i
|
||||
ListView1.AddTwoLines(c2.GetString("CAT_CL_CALLE"),c2.GetString("cuantos") )
|
||||
Next
|
||||
End If
|
||||
entro = "3"
|
||||
Else If entro = "3" Then
|
||||
c2=skmt.ExecQuery2("select CAT_CL_NOMBRE, CAT_CL_CALLE, CAT_CL_CODIGO from kmt_info where gestion = 0 and CAT_CL_CALLE = ? AND CAT_CL_COLONIA = ? order by CAT_CL_NOMBRE ", Array As String(Value, colonia))
|
||||
ListView1.Clear
|
||||
lfila.text = "Nombre"
|
||||
If c2.RowCount>0 Then
|
||||
For i=0 To c2.RowCount -1
|
||||
c2.Position=i
|
||||
ListView1.AddTwoLines(c2.GetString("CAT_CL_CODIGO"), c2.GetString("CAT_CL_NOMBRE"))
|
||||
Next
|
||||
End If
|
||||
entro = "4"
|
||||
Else If entro = "4" Then
|
||||
skmt.ExecNonQuery("delete from CUENTAA")
|
||||
skmt.ExecNonQuery2("INSERT INTO CUENTAA VALUES (?)", Array As Object(Value))
|
||||
StartActivity(fila)
|
||||
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_KeyPress (key As Int) As Boolean
|
||||
' BACK key pressed
|
||||
If key=KeyCodes.KEYCODE_BACK Then
|
||||
' If entro = "3" Then
|
||||
'entro = "2"
|
||||
'Activity_Resume
|
||||
'Return True
|
||||
'Else If entro = "2" Then
|
||||
'entro = "1"
|
||||
'Activity_Resume
|
||||
'Return True
|
||||
'Else If entro = "1" Then
|
||||
|
||||
' I want to capture the key here so I return True
|
||||
|
||||
StartActivity(seleccion)
|
||||
Return False
|
||||
'End If
|
||||
End If
|
||||
' Returning False signals the system to handle the key
|
||||
|
||||
End Sub
|
||||
|
||||
Sub BUSCA_TextChanged (Old As String, New As String)
|
||||
q_buscar = "%" & busca.Text & "%"
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
|
||||
c2=skmt.ExecQuery2("select CAT_CL_NOMBRE, CAT_CL_CALLE, CAT_CL_CODIGO from kmt_info where (CAT_CL_NOMBRE like ? OR CAT_CL_CODIGO LIKE ?)and gestion = 0 order by CAT_CL_NOMBRE ", Array As String(q_buscar,q_buscar))
|
||||
ListView1.Clear
|
||||
lfila.text = "Nombre y Calle"
|
||||
|
||||
If c2.RowCount>0 Then
|
||||
For i=0 To c2.RowCount -1
|
||||
c2.Position=i
|
||||
Dim label1 As Label
|
||||
label1 = ListView1.TwoLinesLayout.Label
|
||||
label1.TextSize = 9
|
||||
label1.TextColor = Colors.White
|
||||
Dim label2 As Label
|
||||
label2 = ListView1.TwoLinesLayout.SecondLabel
|
||||
label2.TextSize = 17
|
||||
label2.TextColor = Colors.White
|
||||
ListView1.AddTwoLines(c2.GetString("CAT_CL_CODIGO"), c2.GetString("CAT_CL_NOMBRE") &" CALLE: "& c2.GetString("CAT_CL_CALLE"))
|
||||
Next
|
||||
End If
|
||||
entro = "4"
|
||||
|
||||
c2.Close
|
||||
End Sub
|
||||
|
||||
Sub b_qr_Click
|
||||
'StartActivity(QR_MODULE)
|
||||
sc.isportrait = True
|
||||
' sc.displayOrientation = 90
|
||||
' sc.useFrontCam = False
|
||||
sc.timeoutDuration = 45
|
||||
sc.theViewFinderXfactor = 0.7
|
||||
sc.theViewFinderYfactor = 0.5
|
||||
' sc.theFrameColor = Colors.White
|
||||
' sc.theLaserColor = Colors.red
|
||||
' sc.moveLaser = True
|
||||
' sc.theMaskColor = Colors.argb(100, 0, 0, 100)
|
||||
sc.theResultColor = Colors.Green
|
||||
' sc.theResultPointColor = Colors.Red
|
||||
' sc.mustBeep = True
|
||||
sc.mustVibrate = True
|
||||
sc.BeginScan("sc")
|
||||
End Sub
|
||||
|
||||
Sub sc_result(atype As String, Value As String, image As Bitmap)
|
||||
'Log("Type : " & atype)
|
||||
'Log("Value : " & Values)
|
||||
CODIGO = Value
|
||||
If CODIGO.SubString2(0,3) = "GTM" Then
|
||||
c2=skmt.ExecQuery2("select COUNT(*) AS ENCONTRADO from kmt_info where CAT_CL_NUM_SERIEFISICO = ? order by CAT_CL_NOMBRE ", Array As String(CODIGO))
|
||||
c2.Position =0
|
||||
If c2.GetString("ENCONTRADO") > 0 Then
|
||||
s=skmt.ExecQuery2("select CAT_CL_CODIGO from kmt_info where CAT_CL_NUM_SERIEFISICO = ? order by CAT_CL_NOMBRE ", Array As String(CODIGO))
|
||||
s.Position =0
|
||||
skmt.ExecNonQuery("delete from CUENTAA")
|
||||
skmt.ExecNonQuery2("INSERT INTO CUENTAA VALUES (?)", Array As Object(s.GetString("CAT_CL_CODIGO")))
|
||||
s.Close
|
||||
b_qr.Visible = False
|
||||
StartActivity(fila)
|
||||
Else
|
||||
Msgbox("CODIGO " & CODIGO & " NO ENCONTRADO","AVISO")
|
||||
End If
|
||||
Else
|
||||
Msgbox("CODIGO NO ENCONTRADO","AVISO")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub sc_timedout(timedOut As Boolean)
|
||||
Log("timedOut " & timedOut)
|
||||
End Sub
|
||||
|
||||
Sub sc_usercancelled(userCancelled As Boolean)
|
||||
Log("userCancelled " & userCancelled)
|
||||
End Sub
|
||||
Reference in New Issue
Block a user