- VERSION 5.09.03

- Se corrigieron textos.
- Se corrigio que a veces mandaba coordenadas en blanco a la bitacora, ahora nos aseguramos de siempre tener las coordenadas disponibles
This commit is contained in:
2025-09-17 13:11:19 -06:00
parent a73c9d4290
commit 003e50a6b1
14 changed files with 94 additions and 41 deletions

View File

@@ -74,6 +74,8 @@ Sub Class_Globals
Private p_botonesCam As Panel
Dim reqManager As DBRequestManager
Private p_clientesLista As Panel
Private p_transparenciaEsperaGPS As Panel
Private p_esperaGPS As Panel
End Sub
'You can add more parameters here.
@@ -100,7 +102,9 @@ Private Sub B4XPage_Created (Root1 As B4XView)
Subs.centraPanel(p_inicioFinVenta, Root.Width)
p_guardarPeso.Top = p_inicioFinVenta.top : p_guardarPeso.left = p_inicioFinVenta.left
Subs.centraPanel(p_noVenta, Root.Width)
p_transparenciaEsperaGPS.Width = Root.Width : p_transparenciaEsperaGPS.Height = Root.Height
p_transparenciaEsperaGPS.Top = 0 : p_transparenciaEsperaGPS.Left = 0
Subs.centraPanel(p_esperaGPS, p_transparenciaEsperaGPS.Width)
' 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
@@ -114,6 +118,18 @@ Private Sub B4XPage_Created (Root1 As B4XView)
End Sub
Sub B4XPage_Appear
' p_transparenciaEsperaGPS.Visible = True
Log("################ Iniciando revision de ubicación #############")
Log($"${B4XPages.MainPage.lat_gps},${B4XPages.MainPage.lon_gps}"$)
If B4XPages.MainPage.lat_gps.Length < 4 Or B4XPages.MainPage.lon_gps.Length < 4 Then
ProgressDialogShow2("Buscando ubicación ...", False)
CallSubDelayed(Tracker, "Track")
CallSubDelayed(Tracker, "StartFLPSmall")
wait for GPS_LocationChanged (location1 As Location)
ProgressDialogHide
End If
Log("############### Terminando revision de ubicación #############")
l_baseodia.Text = "Clientes del día de visita"
p_clientes.Width = Root.Width : p_clientes.Height = Root.Height
p_clientes.Top = 0 : p_clientes.Left = 0
@@ -128,7 +144,7 @@ Sub B4XPage_Appear
c = B4XPages.MainPage.skmt.ExecQuery($"select CAT_CL_NOMBRE, CAT_CL_CALLE, CAT_CL_CODIGO from kmt_info where gestion = 0 AND CAT_CL_CODIGO <> ${"0"} AND CAT_CL_CODIGO <> ${"1"} ORDER BY CAST(CAT_CL_NUM_SERIEFISICO AS INTEGER) ASC"$)
ListView1.Clear
lfila.Text = "NOMBRE"
CustomListView1.Clear
For i = 0 To c.RowCount - 1
c.Position = i
@@ -188,12 +204,17 @@ Sub B4XPage_Appear
End If
End Sub
Sub GPS_LocationChanged (Location1 As Location)
' If p_transparenciaEsperaGPS.IsInitialized Then p_transparenciaEsperaGPS.Visible = False
ProgressDialogHide
End Sub
Sub CreateListItem(nombre As String, direccion0 As String, cliente As String) As Panel
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0, 0, 0, 1, 220)
' p.LoadLayout("datoscliente")
p.LoadLayout("datosclienteBotones")
p.Height = 90dip
p.Height = 95dip
b_inicioVenta.Tag = cliente
' p.Width = clv_orden.GetBase.Width
nombrecliente.Text = nombre
@@ -285,8 +306,7 @@ Sub BUSCA_TextChanged (Old As String, New As String)
Else
cxc.Visible = True
End If
d = B4XPages.MainPage.skmt.ExecQuery($"select IFNULL(CAT_CL_BCREDITO,0) AS CAT_CL_BCREDITO FROM kmt_info WHERE CAT_CL_CODIGO = '${c2.GetString("CAT_CL_CODIGO")}'"$)
' LogColor(d.RowCount,Colors.Blue)
If d.RowCount > 0 Then
@@ -302,8 +322,7 @@ Sub BUSCA_TextChanged (Old As String, New As String)
CREDITO.Visible = False
End If
Next
If c2.RowCount>0 Then
For i=0 To c2.RowCount -1
c2.Position=i
@@ -351,8 +370,7 @@ Sub BUSCA_TextChanged (Old As String, New As String)
CREDITO.Visible = False
End If
Next
If c2.RowCount>0 Then
For i=0 To c2.RowCount -1
c2.Position=i
@@ -495,7 +513,7 @@ Private Sub b_buscar_Click
End If
d = B4XPages.MainPage.skmt.ExecQuery($"select IFNULL(CAT_CL_BCREDITO,0) AS CAT_CL_BCREDITO FROM kmt_info WHERE CAT_CL_CODIGO = '${c.GetString("CAT_CL_CODIGO")}'"$)
' LogColor(d.RowCount,Colors.Blue)
' LogColor(d.RowCount,Colors.Blue)
If d.RowCount > 0 Then
d.Position = 0
LogColor(d.GetString("CAT_CL_BCREDITO"),Colors.Blue)
@@ -598,7 +616,7 @@ Private Sub b_inicioVenta_Click
Else
p_transparenciaIniciaInicioFinVenta.Visible = True
b_finVenta.Enabled = True
Subs.bitacora(Subs.fechanormal(DateTime.Now), Subs.traeUsuarioDeBD, Subs.traeAlmacen, Subs.traeRuta, "Inicia Venta", cliente, Subs.fechanormal(DateTime.Now), "", Starter.lat_gps, Starter.lon_gps, "2", "", "", "")
Subs.bitacora(Subs.fechanormal(DateTime.Now), Subs.traeUsuarioDeBD, Subs.traeAlmacen, Subs.traeRuta, "Inicia Venta", cliente, Subs.fechanormal(DateTime.Now), "", B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps, "2", "", "", "")
Starter.enVenta = True
Subs.enVenta(1, "CLIENTES")
LogColor($">>>>>> INICIA VENTA: ${Starter.enVenta} - ${cliente}"$, Colors.red)
@@ -623,7 +641,7 @@ Private Sub ventaIniciada
' Log($"insert into cuentaa (cuenta) values ('${cliente}')"$)
p_transparenciaIniciaInicioFinVenta.Visible = True
b_finVenta.Enabled = True
Subs.bitacora(Subs.fechanormal(DateTime.Now), Subs.traeUsuarioDeBD, Subs.traeAlmacen, Subs.traeRuta, "Inicia Venta", Subs.traeCliente, Subs.fechanormal(DateTime.Now), "", Starter.lat_gps, Starter.lon_gps, "2", "", "", "")
Subs.bitacora(Subs.fechanormal(DateTime.Now), Subs.traeUsuarioDeBD, Subs.traeAlmacen, Subs.traeRuta, "Inicia Venta", Subs.traeCliente, Subs.fechanormal(DateTime.Now), "", B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps, "2", "", "", "")
Starter.enVenta = True
Subs.enVenta(1, "CLIENTES")
LogColor($">>>>>> INICIA VENTA: ${Starter.enVenta} - ${Subs.traeCliente}"$, Colors.red)
@@ -652,7 +670,7 @@ Private Sub b_guardarPeso_Click
et_guardarPeso.Text = peso
Subs.guardaPeso("VENTA", Subs.traeAlmacen, Subs.traeRuta2(Subs.traeCliente), Subs.traeUsuarioDeBD, Subs.traeCliente, peso, "", "", "")
Subs.bitacora(Subs.fechanormal(DateTime.Now), Subs.traeUsuarioDeBD, Subs.traeAlmacen, Subs.traeRuta2(Subs.traeCliente), "Termina Venta", Subs.traeCliente, "", Subs.fechanormal(DateTime.Now), Starter.lat_gps, Starter.lon_gps, 2, "", "", $"Venta:${et_guardarPeso.text}"$)
Subs.bitacora(Subs.fechanormal(DateTime.Now), Subs.traeUsuarioDeBD, Subs.traeAlmacen, Subs.traeRuta2(Subs.traeCliente), "Termina Venta", Subs.traeCliente, "", Subs.fechanormal(DateTime.Now), B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps, 2, "", "", $"Venta:${et_guardarPeso.text}"$)
Starter.skmt.ExecNonQuery("UPDATE kmt_info set gestion = 2 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
Starter.enVenta = False
Subs.enVenta(0, "")
@@ -662,6 +680,7 @@ Private Sub b_guardarPeso_Click
b_finVenta.Enabled = False
B4XPages.MainPage.clientes.B4XPage_Appear
Subs.mandaPendientes
B4XPage_Appear
End If
End Sub
@@ -717,7 +736,7 @@ Private Sub b_guardaNoVenta_Click
DateTime.DateFormat="yy-MM-dd HH:mm:ss"
Dim fecha As String=DateTime.Date(DateTime.Now)
Subs.guardaPeso("NO VENTA", Subs.traeAlmacen, Subs.traeRuta2(Subs.traeCliente), Subs.traeUsuarioDeBD, Subs.traeCliente, "0", motivo, et_comentarioNoVenta.text, fotoCerrado)
Subs.bitacora(Subs.fechanormal(DateTime.Now), Subs.traeUsuarioDeBD, Subs.traeAlmacen, Subs.traeRuta, "No Venta", Subs.traeCliente, "", Subs.fechanormal(DateTime.Now), Starter.lat_gps, Starter.lon_gps, 2, motivo, et_comentarioNoVenta.text, $"Venta:${et_guardarPeso.text}"$)
Subs.bitacora(Subs.fechanormal(DateTime.Now), Subs.traeUsuarioDeBD, Subs.traeAlmacen, Subs.traeRuta, "No Venta", Subs.traeCliente, "", Subs.fechanormal(DateTime.Now), B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps, 2, motivo, et_comentarioNoVenta.text, $"Venta:${et_guardarPeso.text}"$)
Starter.enVenta = False
Subs.enVenta(0, "")
Starter.skmt.ExecNonQuery("UPDATE kmt_info set gestion = 3 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
@@ -726,7 +745,7 @@ Private Sub b_guardaNoVenta_Click
p_transparenciaIniciaInicioFinVenta.Visible = False
End If
Subs.mandaPendientes
B4XPage_Appear
' DateTime.DateFormat="yy-MM-dd HH:mm:ss"
' Dim fecha As String=DateTime.Date(DateTime.Now)
'
@@ -970,4 +989,8 @@ Sub JobDone(Job As HttpJob)
End If
LogColor(">>>>> Job.Release Clientes - " & Job.Tag, Colors.RGB(179, 146, 0))
Job.Release
End Sub
Private Sub p_transparenciaEsperaGPS_Click
End Sub