VERSION 6.01.20

- Se agrego un "mandaPendientes" en bitacora para cuando por problemas de red no se puede enviar el evento.
This commit is contained in:
2026-01-27 16:21:22 -06:00
parent 6875e0a244
commit eebc8a81c1
9 changed files with 104 additions and 42 deletions

View File

@@ -1121,7 +1121,7 @@ Version=12.8
#Region Project Attributes #Region Project Attributes
#ApplicationLabel: ADM #ApplicationLabel: ADM
#VersionCode: 1 #VersionCode: 1
#VersionName: 6.01.11 #VersionName: 6.01.20
'SupportedOrientations possible values: unspecified, landscape or portrait. 'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait #SupportedOrientations: portrait
#CanInstallToExternalStorage: False #CanInstallToExternalStorage: False

View File

@@ -67,10 +67,10 @@ ModuleBreakpoints9=
ModuleClosedNodes0= ModuleClosedNodes0=
ModuleClosedNodes1= ModuleClosedNodes1=
ModuleClosedNodes10= ModuleClosedNodes10=
ModuleClosedNodes11=4 ModuleClosedNodes11=
ModuleClosedNodes12=3 ModuleClosedNodes12=3
ModuleClosedNodes13= ModuleClosedNodes13=
ModuleClosedNodes14=4,5,16 ModuleClosedNodes14=3,4,5,6,16
ModuleClosedNodes15= ModuleClosedNodes15=
ModuleClosedNodes16= ModuleClosedNodes16=
ModuleClosedNodes17= ModuleClosedNodes17=
@@ -91,12 +91,12 @@ ModuleClosedNodes3=
ModuleClosedNodes30=2,3,4,5,6,7,8,9,11,12,14 ModuleClosedNodes30=2,3,4,5,6,7,8,9,11,12,14
ModuleClosedNodes31= ModuleClosedNodes31=
ModuleClosedNodes32=16,17,18,19 ModuleClosedNodes32=16,17,18,19
ModuleClosedNodes4= ModuleClosedNodes4=5,6,7,8,9,10,11,12,13
ModuleClosedNodes5=2 ModuleClosedNodes5=2
ModuleClosedNodes6= ModuleClosedNodes6=
ModuleClosedNodes7= ModuleClosedNodes7=
ModuleClosedNodes8= ModuleClosedNodes8=
ModuleClosedNodes9= ModuleClosedNodes9=
NavigationStack=C_Cliente,PDFGENERAR,1662,1,Main,Globals,23,0,Main,Activity_ActionBarHomeClick,35,0,Main,Process_Globals,19,0,C_NoVenta,Class_Globals,0,0,C_NoVenta,B4XPage_Created,52,0,Diseñador Visual,principal.bal,-100,2,Diseñador Visual,noventa.bal,-100,1,C_NoVenta,GUARDA_Click,115,1,C_BItacora,b_Inicio_Fin_venta2_Click,139,0,C_BItacora,mandaBitacora,48,0 NavigationStack=C_BItacora,JobDone,247,6,C_Principal,B4XPage_Created,298,0,C_Principal,getTableColumnList,367,0,C_Principal,JobDone,1250,0,C_Principal,B4XPage_Appear,560,3,C_BItacora,mandaPendientes,289,6,C_BItacora,B4XPage_Created,32,0,C_BItacora,Class_Globals,15,5,C_NoVenta,GUARDA_Click,116,0,C_BItacora,mandaBitacora,78,6,B4XMainPage,B4XPage_Created,209,0
SelectedBuild=0 SelectedBuild=0
VisibleModules=2,14,30,12,5,6,32,31,15,11,4 VisibleModules=2,14,30,12,5,6,32,31,15,11,4

View File

@@ -16,15 +16,19 @@ Sub Class_Globals
Dim motivoNoVenta, motivoNoVisita As String Dim motivoNoVenta, motivoNoVisita As String
Dim banderaGeoCerca As String Dim banderaGeoCerca As String
Private reqManager As DBRequestManager Private reqManager As DBRequestManager
Private mpCorriendo As Boolean = False
Dim enviandoInfo As Boolean = False
End Sub End Sub
'You can add more parameters here. 'You can add more parameters here.
Public Sub Initialize (vCallback As Object, vEventName As String, vRoot As B4XView, db1 As SQL, DBReq As DBRequestManager) As Object Public Sub Initialize (vCallback As Object, vEventName As String, vRoot As B4XView, db1 As SQL, DBReqServer As String) As Object
db = db1 db = db1
Root2 = vRoot Root2 = vRoot
reqManager = DBReq ' reqManager = DBReq
reqManager.Initialize(Me, DBReqServer)
db.ExecNonQuery("CREATE TABLE IF NOT EXISTS BITACORAGPS(fechab TEXT, usuariob TEXT, almacenb TEXT, rutab TEXT, eventob TEXT, clienteb TEXT, iniciob TEXT, finb TEXT, latitudb TEXT, longitudb TEXT, precision TEXT, motivonoventa TEXT, motivonovisita TEXT, BAN_GEOB TEXT)") db.ExecNonQuery("CREATE TABLE IF NOT EXISTS BITACORAGPS(fechab TEXT, usuariob TEXT, almacenb TEXT, rutab TEXT, eventob TEXT, clienteb TEXT, iniciob TEXT, finb TEXT, latitudb TEXT, longitudb TEXT, precision TEXT, motivonoventa TEXT, motivonovisita TEXT, BAN_GEOB TEXT)")
agregaColumna("BITACORAGPS", "BAN_GEOB", "TEXT") agregaColumna("BITACORAGPS", "BAN_GEOB", "TEXT")
agregaColumna("BITACORAGPS", "enviado", "TEXT")
contadorIniciarVenta = 0 contadorIniciarVenta = 0
cargamosPanel cargamosPanel
Return Me Return Me
@@ -58,8 +62,10 @@ Sub mandaBitacora(fechab As String, usuariob As String, almacenb As String, ruta
If eventob = "Carga día" Then nombreCliente = "CARGA DIA" If eventob = "Carga día" Then nombreCliente = "CARGA DIA"
If eventob = "Carga día suplencia" Then nombreCliente = traeRutasSup If eventob = "Carga día suplencia" Then nombreCliente = traeRutasSup
If eventob <> "Termina Venta" Then If eventob <> "Termina Venta" Then
Log(56)
db.ExecNonQuery($"INSERT INTO BITACORAGPS (fechab, usuariob , almacenb , rutab , eventob , clienteb , iniciob , finb , latitudb, longitudb , precision , motivonoventa , motivonovisita, BAN_GEOB) VALUES ('${fechab}' ,'${usuariob}' , '${almacenb}' , '${rutab}' , '${eventob}' , '${clienteb}' , '${iniciob}' , '${finb}' , '${latitudb}' , '${longitudb}' , '${precisionb}' , '${motivoNoVentab}' , '${motivoNoVisitab}', '${BAN_GEOB}')"$) db.ExecNonQuery($"INSERT INTO BITACORAGPS (fechab, usuariob , almacenb , rutab , eventob , clienteb , iniciob , finb , latitudb, longitudb , precision , motivonoventa , motivonovisita, BAN_GEOB) VALUES ('${fechab}' ,'${usuariob}' , '${almacenb}' , '${rutab}' , '${eventob}' , '${clienteb}' , '${iniciob}' , '${finb}' , '${latitudb}' , '${longitudb}' , '${precisionb}' , '${motivoNoVentab}' , '${motivoNoVisitab}', '${BAN_GEOB}')"$)
Else Else
Log(57)
Private e As Cursor = db.ExecQuery($"select fechab from BITACORAGPS where usuariob = '${usuariob}' and almacenb = '${almacenb}' and rutab = '${rutab}' and clienteb = '${clienteb}' and eventob = 'Inicia Venta' order by fechab desc"$) Private e As Cursor = db.ExecQuery($"select fechab from BITACORAGPS where usuariob = '${usuariob}' and almacenb = '${almacenb}' and rutab = '${rutab}' and clienteb = '${clienteb}' and eventob = 'Inicia Venta' order by fechab desc"$)
If e.RowCount > 0 Then If e.RowCount > 0 Then
e.Position = 0 e.Position = 0
@@ -70,16 +76,19 @@ Sub mandaBitacora(fechab As String, usuariob As String, almacenb As String, ruta
else if eventob = "No Venta" Then else if eventob = "No Venta" Then
Log("-- NV") Log("-- NV")
db.ExecNonQuery($"update BITACORAGPS set finb = '${finb}', iniciob = '${finb}', motivonoventa = '${motivoNoVentab}', motivonovisita = '${motivoNoVisitab}' where rutab = '${rutab}' and almacenb = '${almacenb}' and usuariob = '${usuariob}' and clienteb = '${clienteb}' and fechab = '${e.GetString("fechab")}' "$) db.ExecNonQuery($"update BITACORAGPS set finb = '${finb}', iniciob = '${finb}', motivonoventa = '${motivoNoVentab}', motivonovisita = '${motivoNoVisitab}' where rutab = '${rutab}' and almacenb = '${almacenb}' and usuariob = '${usuariob}' and clienteb = '${clienteb}' and fechab = '${e.GetString("fechab")}' "$)
Log($"update BITACORAGPS set finb = '${finb}', iniciob = '${finb}', motivonoventa = '${motivoNoVentab}', motivonovisita = '${motivoNoVisitab}' where rutab = '${rutab}' and almacenb = '${almacenb}' and usuariob = '${usuariob}' and clienteb = '${clienteb}' and fechab = '${e.GetString("fechab")}' "$)
cmd.Parameters = Array As Object(finb, motivoNoVentab, motivoNoVisitab, rutab, almacenb, usuariob, clienteb, "Inicia Venta", e.GetString("fechab")) cmd.Parameters = Array As Object(finb, motivoNoVentab, motivoNoVisitab, rutab, almacenb, usuariob, clienteb, "Inicia Venta", e.GetString("fechab"))
End If End If
End If End If
End If End If
If eventob <> "Inicia Venta" Then If eventob <> "Inicia Venta" Then
Log(58)
Private c As Cursor = db.ExecQuery($"select * from BITACORAGPS where usuariob = '${usuariob}' and almacenb = '${almacenb}' and rutab = '${rutab}' and clienteb = '${clienteb}' order by fechab desc"$) Private c As Cursor = db.ExecQuery($"select * from BITACORAGPS where usuariob = '${usuariob}' and almacenb = '${almacenb}' and rutab = '${rutab}' and clienteb = '${clienteb}' order by fechab desc"$)
If c.RowCount > 0 Then If c.RowCount > 0 Then
c.Position = 0 c.Position = 0
cmd.Parameters = Array As Object(c.GetString("almacenb"), c.GetString("usuariob"), c.GetString("rutab"), c.GetString("eventob"), c.GetString("clienteb"), nombreCliente, c.GetString("iniciob"), c.GetString("finb"), c.GetString("latitudb"), c.GetString("longitudb"), c.GetString("precision"), c.GetString("motivonoventa"), c.GetString("motivonovisita"), c.GetString("fechab"), c.GetString("BAN_GEOB")) cmd.Parameters = Array As Object(c.GetString("almacenb"), c.GetString("usuariob"), c.GetString("rutab"), c.GetString("eventob"), c.GetString("clienteb"), nombreCliente, c.GetString("iniciob"), c.GetString("finb"), c.GetString("latitudb"), c.GetString("longitudb"), c.GetString("precision"), c.GetString("motivonoventa"), c.GetString("motivonovisita"), c.GetString("fechab"), c.GetString("BAN_GEOB"))
reqManager.ExecuteCommand(cmd , "mandaBitacora") reqManager.ExecuteCommand(cmd , $"mandaBitacora_${clienteb}_${eventob}"$)
enviandoInfo = True
End If End If
End If End If
' Log("Mandamos bitacora") ' Log("Mandamos bitacora")
@@ -236,5 +245,58 @@ Sub JobDone(Job As HttpJob)
LogColor("Error: " & Job.ErrorMessage, Colors.red) LogColor("Error: " & Job.ErrorMessage, Colors.red)
Else 'If Job Success then ... Else 'If Job Success then ...
' Log("JOBDONE SUCCESS") ' Log("JOBDONE SUCCESS")
If Job.JobName = "DBRequest" Then
Dim RESULT As DBResult = reqManager.HandleJob(Job)
If RESULT.Tag.As(String).StartsWith("mandaBitacora") Then
For Each records() As Object In RESULT.Rows
Private temp() As String = Regex.Split("_", RESULT.Tag)
If temp.Length > 2 Then
Private cliente As String = temp(1)
Private evento As String = temp(2)
Log(cliente)
Log(evento)
db.ExecNonQuery($"update BITACORAGPS set enviado = 1 where clienteb = '${cliente}' and eventob = '${evento}'"$)
Log("==========================REGISTROS="&RESULT.Rows.size)
For Each k As String In RESULT.Columns.Keys
Log(RESULT.Tag & ": " & k & ": " & records(RESULT.Columns.Get(k)))
Next
End If
Next
enviandoInfo = False
End If
End If
' mandaBitacora
End If End If
End Sub End Sub
Sub mandaPendientes
LogColor("==> Entramos a mandaPendientes", Colors.red)
If Not(enviandoInfo) Then
Log("mpCorriendo=" & mpCorriendo)
mpCorriendo = True
Private ep As Cursor = db.ExecQuery("select * from BITACORAGPS where enviado is null")
Log("PENDIENTES: " & ep.RowCount)
Dim cmd As DBCommand
If ep.RowCount > 0 Then
For i = 0 To ep.RowCount - 1
ep.Position = i
Log($"Mandamos ${ep.GetString("clienteb")}, ${ep.GetString("eventob")}"$)
' mandaBitacora(ep.GetString("fechab"), ep.GetString("usuariob"), ep.GetString("almacenb"), ep.GetString("rutab"), ep.GetString("eventob"), ep.GetString("clienteb"), ep.GetString("iniciob"), ep.GetString("finb"), ep.GetString("latitudb"), ep.GetString("longitudb"), ep.GetString("precision"), ep.GetString("motivonoventa"), ep.GetString("motivonovisita"), ep.GetString("BAN_GEOB"))
Private nombreCliente As String = traeNombreCliente(ep.GetString("clienteb"))
Private eventob As String = ep.GetString("eventob")
If eventob = "Llega a almacen" Then
nombreCliente = "BOLETA"
End If
If eventob = "Salida almacen" Then nombreCliente = "CHECKLIST"
If eventob = "Fin Día" Then nombreCliente = "FIN DIA"
If eventob = "Carga día" Then nombreCliente = "CARGA DIA"
If eventob = "Carga día suplencia" Then nombreCliente = traeRutasSup
cmd.Initialize
cmd.Name = "mandaBitacora_ADM3"
cmd.Parameters = Array As Object(ep.GetString("almacenb"), ep.GetString("usuariob"), ep.GetString("rutab"), ep.GetString("eventob"), ep.GetString("clienteb"), nombreCliente, ep.GetString("iniciob"), ep.GetString("finb"), ep.GetString("latitudb"), ep.GetString("longitudb"), ep.GetString("precision"), ep.GetString("motivonoventa"), ep.GetString("motivonovisita"), ep.GetString("fechab"), ep.GetString("BAN_GEOB"))
reqManager.ExecuteCommand(cmd , $"mandaBitacora_${ep.GetString("clienteb")}_${ep.GetString("eventob")}"$)
Next
mpCorriendo = False
End If
End If
End Sub

View File

@@ -240,7 +240,7 @@ Private Sub B4XPage_Created (Root1 As B4XView)
End If End If
c.Close c.Close
s.Close s.Close
bitacora.Initialize("bitacora", "bitacora", Root, Starter.skmt, reqManager) bitacora.Initialize("bitacora", "bitacora", Root, Starter.skmt, Starter.DBReqServer)
btAdmin.Initialize("BlueTeeth") btAdmin.Initialize("BlueTeeth")
cmp20.Initialize("Printer") cmp20.Initialize("Printer")
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_CAMERA) Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_CAMERA)
@@ -1385,8 +1385,8 @@ Private Sub Label20_LongClick
multiplicador = multiplicador +1 multiplicador = multiplicador +1
PDF.outtext(1,pagina-multiplicador*6,"Tienda: " & La_nombre.Text) PDF.outtext(1,pagina-multiplicador*6,"Tienda: " & La_nombre.Text)
multiplicador = multiplicador +1 ' multiplicador = multiplicador +1
PDF.outtext(1,pagina-multiplicador*6,"ID.Cliente: " & la_cuenta.Text) ' PDF.outtext(1,pagina-multiplicador*6,"ID.Cliente: " & la_cuenta.Text)
multiplicador = multiplicador +1 multiplicador = multiplicador +1
PDF.outtext(1,pagina-multiplicador*6,"Calle: " & la_Calle.Text) PDF.outtext(1,pagina-multiplicador*6,"Calle: " & la_Calle.Text)
@@ -1425,21 +1425,21 @@ Private Sub Label20_LongClick
LogColor(s.GetLong("L_COSTOU"),Colors.Magenta) LogColor(s.GetLong("L_COSTOU"),Colors.Magenta)
LogColor(s.GetLong("L_COSTO_TOT"),Colors.Magenta) LogColor(s.GetLong("L_COSTO_TOT"),Colors.Magenta)
TAMANO = s.GetLong("L_CANT") + s.GetLong("L_COSTOU") + s.GetLong("L_COSTO_TOT") TAMANO = s.GetLong("L_CANT") + NumberFormat2(s.GetLong("L_COSTOU"), 1,2,2,True) + NumberFormat2(s.GetLong("L_COSTO_TOT"), 1,2,2,True)
ESPACIO = 92 ESPACIO = 92
BLANCO = " " BLANCO = " "
ESPACIO = ESPACIO - TAMANO ESPACIO = ESPACIO - (TAMANO + 6)
ESPACIO = ESPACIO / 2 ESPACIO = ESPACIO / 2
For E=0 To ESPACIO -1 For E = 0 To ESPACIO - 1
BLANCO = " " & BLANCO BLANCO = " " & BLANCO
Next Next
PDF.sFont(PDF.fontHelvetica,0,10,PDF.colorBlack) PDF.sFont(PDF.fontHelvetica,0,10,PDF.colorBlack)
multiplicador = multiplicador +1 multiplicador = multiplicador + 1
PDF.outtext(1,pagina-multiplicador*6, s.GETSTRING("PE_CANT") & BLANCO & s.GETSTRING("PE_COSTOU") & BLANCO & s.GETSTRING("PE_COSTO_TOT")) PDF.outtext(1,pagina-multiplicador*6, s.GETSTRING("PE_CANT") & BLANCO & NumberFormat2(s.GETSTRING("PE_COSTOU"),1,2,2,True) & BLANCO & NumberFormat2(s.GETSTRING("PE_COSTO_TOT"),1,2,2,True))
End If End If
Next Next
End If End If
s.Close s.Close
PDF.outtext(1,108-9*6," " ) PDF.outtext(1,108-9*6," " )
s=skmt.ExecQuery2("select PE_PRONOMBRE, PE_CANT, length(pe_cant) as L_CANT, PE_COSTOU, length(PE_COSTOU) as L_COSTOU,PE_CANT * PE_COSTOU AS PE_COSTO_TOT, length(PE_CANT * PE_COSTOU) as L_COSTO_TOT,PE_PROID, PE_CEDIS FROM PEDIDO WHERE PE_FOLIO = ? AND LENGTH(PE_CEDIS) > 3 AND PE_CLIENTE IN (Select CUENTA from cuentaa) order by PE_CEDIS, PE_COSTOU", Array As String("PREVENTA")) s=skmt.ExecQuery2("select PE_PRONOMBRE, PE_CANT, length(pe_cant) as L_CANT, PE_COSTOU, length(PE_COSTOU) as L_COSTOU,PE_CANT * PE_COSTOU AS PE_COSTO_TOT, length(PE_CANT * PE_COSTOU) as L_COSTO_TOT,PE_PROID, PE_CEDIS FROM PEDIDO WHERE PE_FOLIO = ? AND LENGTH(PE_CEDIS) > 3 AND PE_CLIENTE IN (Select CUENTA from cuentaa) order by PE_CEDIS, PE_COSTOU", Array As String("PREVENTA"))
@@ -1466,7 +1466,7 @@ Private Sub Label20_LongClick
LogColor(s.GetLong("L_COSTOU"),Colors.Magenta) LogColor(s.GetLong("L_COSTOU"),Colors.Magenta)
LogColor(s.GetLong("L_COSTO_TOT"),Colors.Magenta) LogColor(s.GetLong("L_COSTO_TOT"),Colors.Magenta)
TAMANO = s.GetLong("L_CANT") + s.GetLong("L_COSTOU") + s.GetLong("L_COSTO_TOT") TAMANO = s.GetLong("L_CANT") + NumberFormat2(s.GetLong("L_COSTOU"), 1,2,2,True) + NumberFormat2(s.GetLong("L_COSTO_TOT"), 1,2,2,True)
ESPACIO = 92 ESPACIO = 92
BLANCO = " " BLANCO = " "
ESPACIO = ESPACIO - TAMANO ESPACIO = ESPACIO - TAMANO
@@ -1526,8 +1526,6 @@ Private Sub Label20_LongClick
End Sub End Sub
Private Sub PDFGENERAR Private Sub PDFGENERAR
ESPACIO = 0 ESPACIO = 0
DateTime.DateFormat = "MM/dd/yyyy" DateTime.DateFormat = "MM/dd/yyyy"
DateTime.TimeFormat = "HH:mm:ss" DateTime.TimeFormat = "HH:mm:ss"
@@ -1568,8 +1566,8 @@ Private Sub PDFGENERAR
multiplicador = multiplicador +1 multiplicador = multiplicador +1
PDF.outtext(1,pagina-multiplicador*6,"Tienda: " & La_nombre.Text) PDF.outtext(1,pagina-multiplicador*6,"Tienda: " & La_nombre.Text)
multiplicador = multiplicador +1 ' multiplicador = multiplicador +1
PDF.outtext(1,pagina-multiplicador*6,"ID.Cliente: " & la_cuenta.Text) ' PDF.outtext(1,pagina-multiplicador*6,"ID.Cliente: " & la_cuenta.Text)
multiplicador = multiplicador +1 multiplicador = multiplicador +1
PDF.outtext(1,pagina-multiplicador*6,"Calle: " & la_Calle.Text) PDF.outtext(1,pagina-multiplicador*6,"Calle: " & la_Calle.Text)
@@ -1610,23 +1608,20 @@ Private Sub PDFGENERAR
LogColor(s.GetLong("L_COSTOU"),Colors.Magenta) LogColor(s.GetLong("L_COSTOU"),Colors.Magenta)
LogColor(s.GetLong("L_COSTO_TOT"),Colors.Magenta) LogColor(s.GetLong("L_COSTO_TOT"),Colors.Magenta)
TAMANO = s.GetLong("L_CANT") + s.GetLong("L_COSTOU") + s.GetLong("L_COSTO_TOT") TAMANO = s.GetLong("L_CANT") + NumberFormat2(s.GetLong("L_COSTOU"),1,2,2,True) + NumberFormat2(s.GetLong("L_COSTO_TOT"),1,2,2,True)
ESPACIO = 92 ESPACIO = 92
BLANCO = " " BLANCO = " "
ESPACIO = ESPACIO - TAMANO ESPACIO = ESPACIO - (TAMANO + 6)
ESPACIO = ESPACIO / 2 ESPACIO = ESPACIO / 2
For E=0 To ESPACIO -1 For E=0 To ESPACIO -1
BLANCO = " " & BLANCO BLANCO = " " & BLANCO
Next Next
PDF.sFont(PDF.fontHelvetica,0,10,PDF.colorBlack) PDF.sFont(PDF.fontHelvetica,0,10,PDF.colorBlack)
multiplicador = multiplicador +1 multiplicador = multiplicador +1
PDF.outtext(1,pagina-multiplicador*6, s.GETSTRING("PE_CANT") & BLANCO & s.GETSTRING("PE_COSTOU") & BLANCO & s.GETSTRING("PE_COSTO_TOT")) PDF.outtext(1,pagina-multiplicador*6, s.GETSTRING("PE_CANT") & BLANCO & NumberFormat2(s.GETSTRING("PE_COSTOU"),1,2,2,True) & BLANCO & NumberFormat2(s.GETSTRING("PE_COSTO_TOT"),1,2,2,True))
' pdf.outtext(1,108-9*6,s.GETSTRING("PE_COSTOU")) ' pdf.outtext(1,108-9*6,s.GETSTRING("PE_COSTOU"))
'
' pdf.outtext(1,108-9*6,s.GETSTRING("PE_COSTO_TOT") ) ' pdf.outtext(1,108-9*6,s.GETSTRING("PE_COSTO_TOT") )
End If End If
Next Next
End If End If
@@ -1656,7 +1651,7 @@ Private Sub PDFGENERAR
LogColor(s.GetLong("L_COSTOU"),Colors.Magenta) LogColor(s.GetLong("L_COSTOU"),Colors.Magenta)
LogColor(s.GetLong("L_COSTO_TOT"),Colors.Magenta) LogColor(s.GetLong("L_COSTO_TOT"),Colors.Magenta)
TAMANO = s.GetLong("L_CANT") + s.GetLong("L_COSTOU") + s.GetLong("L_COSTO_TOT") TAMANO = s.GetLong("L_CANT") + NumberFormat2(s.GetLong("L_COSTOU"),1,2,2,True) + NumberFormat2(s.GetLong("L_COSTO_TOT"),1,2,2,True)
ESPACIO = 92 ESPACIO = 92
BLANCO = " " BLANCO = " "
ESPACIO = ESPACIO - TAMANO ESPACIO = ESPACIO - TAMANO

View File

@@ -18,6 +18,10 @@ Sub Class_Globals
Dim r_1 As RadioButton Dim r_1 As RadioButton
Dim r_2 As RadioButton Dim r_2 As RadioButton
Dim r_3 As RadioButton Dim r_3 As RadioButton
Dim r_4 As RadioButton
Dim r_5 As RadioButton
Dim r_6 As RadioButton
Dim r_7 As RadioButton
Dim e_comm As EditText Dim e_comm As EditText
Dim motivo As String Dim motivo As String
Dim cuenta As String Dim cuenta As String
@@ -25,15 +29,11 @@ Sub Class_Globals
Dim sDate,sTime As String Dim sDate,sTime As String
' Dim lat_gps, lon_gps As String ' Dim lat_gps, lon_gps As String
Dim tgl As Toggle Dim tgl As Toggle
Dim r_4 As RadioButton
Dim reqManager As DBRequestManager Dim reqManager As DBRequestManager
Private stay_hh As String Private stay_hh As String
Private stay_mi As String Private stay_mi As String
Private stay_ss As String Private stay_ss As String
Dim bitacora As C_BItacora Dim bitacora As C_BItacora
Private r_5 As RadioButton
Private r_6 As RadioButton
Private r_7 As RadioButton
End Sub End Sub
'You can add more parameters here. 'You can add more parameters here.
@@ -64,7 +64,7 @@ Sub B4XPage_Appear
ToastMessageShow("Es necesario tener el GPS encendido", True) ToastMessageShow("Es necesario tener el GPS encendido", True)
StartActivity(Starter.gps.LocationSettingsIntent) StartActivity(Starter.gps.LocationSettingsIntent)
End If End If
bitacora.Initialize("bitacora", "bitacora", Root, Starter.skmt, reqManager) bitacora.Initialize("bitacora", "bitacora", Root, Starter.skmt, Starter.DBReqServer)
r_1.Checked = False r_1.Checked = False
r_2.Checked = False r_2.Checked = False
r_3.Checked = False r_3.Checked = False
@@ -83,6 +83,7 @@ End Sub
Sub CANCELA_Click Sub CANCELA_Click
B4XPages.ShowPage("Cliente") B4XPages.ShowPage("Cliente")
End Sub End Sub
Sub GUARDA_Click Sub GUARDA_Click
If r_1.Checked Then If r_1.Checked Then
motivo = r_1.Text.ToUpperCase motivo = r_1.Text.ToUpperCase
@@ -145,7 +146,7 @@ Sub GUARDA_Click
B4XPages.MainPage.skmt.ExecNonQuery2("update PEDIDO_INICIO_FINAL set PIF_HORA_FINAL = ? where PIF_CLIENTE = ? and PIF_HORA_FINAL = 0", Array As Object (DateTime.Now, cuenta)) B4XPages.MainPage.skmt.ExecNonQuery2("update PEDIDO_INICIO_FINAL set PIF_HORA_FINAL = ? where PIF_CLIENTE = ? and PIF_HORA_FINAL = 0", Array As Object (DateTime.Now, cuenta))
LogColor($"actualizamos "${cuenta}, hora_final=${DateTime.now}"$,Colors.Red) LogColor($"actualizamos "${cuenta}, hora_final=${DateTime.now}"$,Colors.Red)
mandaPendientesnoventa mandaPendientesnoventa
B4XPages.ShowPage("Principal") B4XPages.ShowPage("Principal")
End Sub End Sub

View File

@@ -95,7 +95,7 @@ End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage. 'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
Sub B4XPage_Appear Sub B4XPage_Appear
bitacora.Initialize("bitacora", "bitacora", Root, Starter.skmt, reqManager) bitacora.Initialize("bitacora", "bitacora", Root, Starter.skmt, Starter.DBReqServer)
et_direccion.Text = "" et_direccion.Text = ""
E_NOMBRE.Text = "" E_NOMBRE.Text = ""
ET_Atiende.Text = "" ET_Atiende.Text = ""

View File

@@ -315,7 +315,7 @@ Private Sub B4XPage_Created (Root1 As B4XView)
l_rutasuplencia.Text = s.GetString("RS_RUTA") l_rutasuplencia.Text = s.GetString("RS_RUTA")
End If End If
Starter.Skmt.ExecNonQuery($"create table if not exists kmt_info2 (${getTableColumnList(Starter.skmt, "kmt_info")})"$) Starter.Skmt.ExecNonQuery($"create table if not exists kmt_info2 (${getTableColumnList(Starter.skmt, "kmt_info")})"$)
bitacora.Initialize("bitacora", "bitacora", Root, Starter.skmt, reqManager) bitacora.Initialize("bitacora", "bitacora", Root, Starter.skmt, Starter.DBReqServer)
p_mandaInfo.Top = 0 : p_mandaInfo.Left = 0 p_mandaInfo.Top = 0 : p_mandaInfo.Left = 0
End Sub End Sub
@@ -564,7 +564,8 @@ Sub B4XPage_Appear
' Log(d.GetString("CAT_GP_NOMBRE")) ' Log(d.GetString("CAT_GP_NOMBRE"))
' Next ' Next
' d.Close ' d.Close
Sleep(500)
bitacora.mandaPendientes
End Sub End Sub
Sub Subir_Click Sub Subir_Click
@@ -616,7 +617,7 @@ Sub Subir_Click
Dim cmd As DBCommand Dim cmd As DBCommand
cmd.Initialize cmd.Initialize
cmd.Name = "UPDATE_ADM3_ACTUAL2_GPS" cmd.Name = "UPDATE_ADM3_ACTUAL2_GPS"
cmd.Parameters = Array As Object(L_MONTOD.Text, L_CUANTOST.Text, l_cuantosc.Text,l_porvisitar.TEXT,c.GetString("hglat"),c.GetString("hglon"),batterystatus(0),LPT, STEYIN, STEYOUT,ALMACEN,l_ruta.Text ) cmd.Parameters = Array As Object(L_MONTOD.Text, L_CUANTOST.Text, l_cuantosc.Text,l_porvisitar.TEXT,c.GetString("hglat"),c.GetString("hglon"),batterystatus(0),NumberFormat2(LPT,1,5,2,False), STEYIN, STEYOUT,ALMACEN,l_ruta.Text )
reqManager.ExecuteCommand(cmd , "update_gps") reqManager.ExecuteCommand(cmd , "update_gps")
Next Next
End If End If
@@ -1253,7 +1254,7 @@ Sub JobDone(Job As HttpJob)
For Each records() As Object In RESULT.Rows For Each records() As Object In RESULT.Rows
Dim CAT_CL_CODIGO As String = records(RESULT.Columns.Get("CAT_CL_CODIGO")) Dim CAT_CL_CODIGO As String = records(RESULT.Columns.Get("CAT_CL_CODIGO"))
Dim CAT_CL_RUTA As String = records(RESULT.Columns.Get("CAT_CL_RUTA")) Dim CAT_CL_RUTA As String = records(RESULT.Columns.Get("CAT_CL_RUTA"))
Log("-" &CAT_CL_RUTA) ' Log("-" &CAT_CL_RUTA)
Dim CAT_CL_NOMBRE As String = records(RESULT.Columns.Get("CAT_CL_NOMBRE")) Dim CAT_CL_NOMBRE As String = records(RESULT.Columns.Get("CAT_CL_NOMBRE"))
Dim CAT_CL_ATIENDE1 As String = records(RESULT.Columns.Get("CAT_CL_ATIENDE1")) Dim CAT_CL_ATIENDE1 As String = records(RESULT.Columns.Get("CAT_CL_ATIENDE1"))
Dim CAT_CL_ATIENTE2 As String = records(RESULT.Columns.Get("CAT_CL_ATIENTE2")) Dim CAT_CL_ATIENTE2 As String = records(RESULT.Columns.Get("CAT_CL_ATIENTE2"))
@@ -2217,6 +2218,7 @@ Sub e_ruta_EnterPressed
B4XPages.MainPage.skmt.ExecNonQuery("DELETE FROM CLIENTES_NUEVOS") B4XPages.MainPage.skmt.ExecNonQuery("DELETE FROM CLIENTES_NUEVOS")
B4XPages.MainPage.skmt.ExecNonQuery("DELETE FROM ENV_MONTO_LIQ") B4XPages.MainPage.skmt.ExecNonQuery("DELETE FROM ENV_MONTO_LIQ")
B4XPages.MainPage.skmt.ExecNonQuery("DELETE FROM HIST_UBICACIONES") B4XPages.MainPage.skmt.ExecNonQuery("DELETE FROM HIST_UBICACIONES")
B4XPages.MainPage.skmt.ExecNonQuery("DELETE FROM BITACORAGPS")
Starter.skmt.ExecNonQuery("update CAT_VARIABLES set CAT_VA_VALOR = '' where CAT_VA_DESCRIPCION = 'FOTO_INICIAL'") Starter.skmt.ExecNonQuery("update CAT_VARIABLES set CAT_VA_VALOR = '' where CAT_VA_DESCRIPCION = 'FOTO_INICIAL'")
B4XPage_Appear B4XPage_Appear
l_rutasuplencia.Visible = False l_rutasuplencia.Visible = False
@@ -2224,6 +2226,7 @@ Sub e_ruta_EnterPressed
l_rutasuplencia.Text = "" l_rutasuplencia.Text = ""
End If End If
End If End If
If e_ruta.Text = "IWL" Then If e_ruta.Text = "IWL" Then
' trabajar.Visible = False ' trabajar.Visible = False
NUEVO.Visible =False NUEVO.Visible =False
@@ -2232,6 +2235,7 @@ Sub e_ruta_EnterPressed
' img3.Visible =True ' img3.Visible =True
Resumen.Visible= False Resumen.Visible= False
End If End If
If e_ruta.Text = "SUPLENCIA" Then If e_ruta.Text = "SUPLENCIA" Then
E_RUTA2.Visible = True E_RUTA2.Visible = True
Panel11.Visible = True Panel11.Visible = True

Binary file not shown.

View File

@@ -156,7 +156,7 @@ Sub MapFragment1_Ready
'''''''----------------------------MARKER AZUL - POR VISITAR '''''''----------------------------MARKER AZUL - POR VISITAR
If azul = 1 Or todos = 1 Then If azul = 1 Or todos = 1 Then
c.IsInitialized c.IsInitialized
c=skmt.ExecQuery("select CAT_CL_CODIGO,CAT_CL_NOMBRE,CAT_CL_LAT,CAT_CL_LONG from kmt_info where gestion = 0 and CAT_CL_LAT is not null and CAT_CL_LONG is not null and CAT_CL_LAT <> 0 and CAT_CL_LONG <> 0 and CAT_CL_LAT <> ' ' and CAT_CL_LONG <> ' ' and CAT_CL_CODIGO <> 0 and CAT_CL_CODIGO <> 1") c=skmt.ExecQuery("select CAT_CL_CODIGO, CAT_CL_NOMBRE, CAT_CL_LAT, CAT_CL_LONG from kmt_info where gestion = 0 and CAT_CL_LAT is not null and CAT_CL_LONG is not null and CAT_CL_LAT <> 0 and CAT_CL_LONG <> 0 and CAT_CL_LAT <> ' ' and CAT_CL_LONG <> ' ' and CAT_CL_CODIGO <> 0 and CAT_CL_CODIGO <> 1")
' skmt.Initialize(ruta,"kmt.db", True) ' skmt.Initialize(ruta,"kmt.db", True)
Log($"============== Resultados = ${c.RowCount}"$) Log($"============== Resultados = ${c.RowCount}"$)
If c.RowCount > 0 Then If c.RowCount > 0 Then
@@ -217,7 +217,7 @@ Sub MapFragment1_Ready
End If End If
End If End If
' '''''''----------------------------MARKER ROJO - NO VENTA ' '''''''----------------------------MARKER ROJO - NO VENTA
If rojo = 1 Or todos = 1 Then If rojo = 1 Or todos = 1 Then
c3.IsInitialized c3.IsInitialized
c3=skmt.ExecQuery("select CAT_CL_CODIGO, CAT_CL_NOMBRE,CAT_CL_LONG,CAT_CL_LAT from kmt_info where gestion = 3 and CAT_CL_LAT is not null and CAT_CL_LONG is not null and CAT_CL_LAT <> 0 and CAT_CL_LONG <> 0 and CAT_CL_CODIGO <> 0 and CAT_CL_CODIGO <> 1") c3=skmt.ExecQuery("select CAT_CL_CODIGO, CAT_CL_NOMBRE,CAT_CL_LONG,CAT_CL_LAT from kmt_info where gestion = 3 and CAT_CL_LAT is not null and CAT_CL_LONG is not null and CAT_CL_LAT <> 0 and CAT_CL_LONG <> 0 and CAT_CL_CODIGO <> 0 and CAT_CL_CODIGO <> 1")