- VERSION 4.11.14

- Se puso el código de la bitacora en un clase para que sea mas fácil portarla a otras aplicaciones.
This commit is contained in:
Jose Alberto Guerra Ugalde
2024-11-16 19:56:47 -06:00
parent 35fb2b6401
commit 007f6ddca7
15 changed files with 609 additions and 325 deletions

View File

@@ -721,8 +721,6 @@ Sub traeRutasSup As String
Return rutas
End Sub
Sub traeCliente As String 'ignore
Private c As Cursor
Private cl As String
@@ -1277,46 +1275,46 @@ End Sub
'En geocerca si mete la contraseña poner 0 en precision gps y si esta dentro de los 50 mts poner 1 y 2 para eventos que no lo ocupen
'Mandar fecha de sync(sysdate)
Sub bitacora(fechab As String, usuariob As String, almacenb As String, rutab As String, eventob As String, clienteb As String, iniciob As String, finb As String, latitudb As String, longitudb As String, precision As String, motivonoventa As String, motivonovisita As String, BAN_GEOB As String)
Log(motivonovisita)
' Log("bitacora")
Private cmd As DBCommand
cmd.Initialize
cmd.Name = "mandaBitacora3_GUNA"
' Log("BITACORA3")
Private nombreCliente As String = traeNombreCliente(clienteb)
If eventob = "Llega a almacen" Then
nombreCliente = "BOLETA"
clienteb = ""
finb = iniciob
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
If eventob <> "Termina Venta" And eventob <> "No Venta" Then
B4XPages.MainPage.skmt.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}' , '${precision}' , '${motivonoventa}' , '${motivonovisita}', '${BAN_GEOB}')"$)
Else
Private e As Cursor = B4XPages.MainPage.skmt.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
e.Position = 0
Log("ACTUALIZA BITACORA")
If eventob = "Termina Venta" Then
B4XPages.MainPage.skmt.ExecNonQuery($"update BITACORAGPS set finb = '${finb}' where rutab = '${rutab}' and almacenb = '${almacenb}' and usuariob = '${usuariob}' and clienteb = '${clienteb}' and fechab = '${e.GetString("fechab")}' "$)
cmd.Parameters = Array As Object(finb, rutab, almacenb, usuariob, clienteb, "Inicia Venta", e.GetString("fechab"))
else if eventob = "No Venta" Then
B4XPages.MainPage.skmt.ExecNonQuery($"update BITACORAGPS set finb = '${finb}', motivonoventa = '${motivonoventa}', motivonovisita = '${motivonovisita}' where rutab = '${rutab}' and almacenb = '${almacenb}' and usuariob = '${usuariob}' and clienteb = '${clienteb}' and fechab = '${e.GetString("fechab")}' "$)
cmd.Parameters = Array As Object(finb, motivonoventa, motivonovisita, rutab, almacenb, usuariob, clienteb, "Inicia Venta", e.GetString("fechab"))
End If
End If
End If
If eventob <> "Inicia Venta" Then
Private c As Cursor = B4XPages.MainPage.skmt.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
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"))
Starter.reqManager.ExecuteCommand(cmd , "mandaBitacora")
End If
End If
' Log(motivonovisita)
'' Log("bitacora")
' Private cmd As DBCommand
' cmd.Initialize
' cmd.Name = "mandaBitacora3_GUNA"
'' Log("BITACORA3")
' Private nombreCliente As String = traeNombreCliente(clienteb)
' If eventob = "Llega a almacen" Then
' nombreCliente = "BOLETA"
' clienteb = ""
' finb = iniciob
' 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
' If eventob <> "Termina Venta" And eventob <> "No Venta" Then
' B4XPages.MainPage.skmt.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}' , '${precision}' , '${motivonoventa}' , '${motivonovisita}', '${BAN_GEOB}')"$)
' Else
' Private e As Cursor = B4XPages.MainPage.skmt.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
' e.Position = 0
' Log("ACTUALIZA BITACORA")
' If eventob = "Termina Venta" Then
' B4XPages.MainPage.skmt.ExecNonQuery($"update BITACORAGPS set finb = '${finb}' where rutab = '${rutab}' and almacenb = '${almacenb}' and usuariob = '${usuariob}' and clienteb = '${clienteb}' and fechab = '${e.GetString("fechab")}' "$)
' cmd.Parameters = Array As Object(finb, rutab, almacenb, usuariob, clienteb, "Inicia Venta", e.GetString("fechab"))
' else if eventob = "No Venta" Then
' B4XPages.MainPage.skmt.ExecNonQuery($"update BITACORAGPS set finb = '${finb}', motivonoventa = '${motivonoventa}', motivonovisita = '${motivonovisita}' where rutab = '${rutab}' and almacenb = '${almacenb}' and usuariob = '${usuariob}' and clienteb = '${clienteb}' and fechab = '${e.GetString("fechab")}' "$)
' cmd.Parameters = Array As Object(finb, motivonoventa, motivonovisita, rutab, almacenb, usuariob, clienteb, "Inicia Venta", e.GetString("fechab"))
' End If
' End If
' End If
' If eventob <> "Inicia Venta" Then
' Private c As Cursor = B4XPages.MainPage.skmt.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
' 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"))
' Starter.reqManager.ExecuteCommand(cmd , "mandaBitacora")
' End If
' End If
' Log("Mandamos bitacora")
End Sub
@@ -1620,7 +1618,7 @@ Sub traeUsarIntentBDWA As Boolean 'ignore
x.Position = 0
If x.GetString("CAT_VA_VALOR") = "true" Then BDWA = True
End If
Log($"cb_importarBDWA = ${BDWA}"$)
' Log($"cb_importarBDWA = ${BDWA}"$)
Return BDWA
End Sub
@@ -1704,17 +1702,17 @@ Sub revisaProdFueraDePromo(prodId As String) As Boolean
End If
Return fueraDePromo
End Sub
'Trae el tipo de venta (VENTA o PREVENTA) desde CAT_VARIABLES, o "PREVENTA" por default.
Sub traeTipoVentaDeBD As String
Private tipoVenta As String = "PREVENTA"
Private r As ResultSet = Starter.skmt.ExecQuery("select * from CAT_VARIABLES where CAT_VA_DESCRIPCION = 'TIPO_VENTA' ")
Do While r.NextRow
tipoVenta = r.GetString("CAT_VA_VALOR")
tipoVenta = r.GetString("CAT_VA_VALOR").As(String).ToUpperCase
Loop
If Starter.idCliente = "0" Then
tipoVenta = "ABORDO"
End If
Log(">>>>>>> " & tipoVenta)
' Log(">>>>>>> " & tipoVenta)
Return tipoVenta
End Sub