- 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

@@ -417,7 +417,7 @@ Sub Class_Globals
Dim fototomada As String
Private b_foto As Button
Dim precision As String
Private b_Inicio_Fin_venta As Button
Dim b_Inicio_Fin_venta As Button
Dim dentroDeGeocerca As Boolean = False
Dim motivoNoVenta, motivoNoVisita As String
@@ -425,10 +425,12 @@ Sub Class_Globals
Dim IniVenNO As Boolean = False
Private geoCont As Int = 0
Private l_version As Label
Private p_transparenteInicioFin As Panel
Dim b_geo As String
' Dim p_transparenteInicioFin As Panel
' Dim b_geo As String
Private b_preventa As Button
Dim bitacora As C_Bitacora
End Sub
'You can add more parameters here.
@@ -482,12 +484,15 @@ Private Sub B4XPage_Created (Root1 As B4XView)
gest.Visible = False
l_version.Left = Root.Width - (l_version.Width + 10)
cuest.Initialize(Me, "cuest", Root, B4XPages.MainPage.skmt)
bitacora.Initialize("bitacora", "bitacora", Root, B4XPages.MainPage.skmt, reqManager)
' bitacora.cargamosPanel
End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
Sub B4XPage_Appear
iniciofin
bitacora.inicioFin
' iniciofin
que_modulo = 1
dentroDeGeocerca = False
indicePregunta = 0
@@ -502,12 +507,12 @@ Sub B4XPage_Appear
LA_GPS.Text = "SIN UBICACION GPS"
cercavalor = 0
l_version.Text = Application.VersionName
p_transparenteInicioFin.Width = Root.Width : p_transparenteInicioFin.Height = Root.Height
b_preventa.left = (Root.Width / 2) - (b_preventa.width / 2)
b_Inicio_Fin_venta.Left = 5
b_Inicio_Fin_venta.Width = Root.Width - 10
b_Inicio_Fin_venta.Text = "INICIAR VENTA"
b_Inicio_Fin_venta.BringToFront
' p_transparenteInicioFin.Width = Root.Width : p_transparenteInicioFin.Height = Root.Height
' b_Inicio_Fin_venta.Left = 5
' b_Inicio_Fin_venta.Width = Root.Width - 10
' b_Inicio_Fin_venta.Text = "INICIAR VENTA"
' b_Inicio_Fin_venta.BringToFront
' LogColor(">>>>>> EN VENTA: " & Starter.enVenta, Colors.red)
' If Not(Starter.enVenta) Then
' b_Inicio_Fin_venta.Visible = True
@@ -914,7 +919,7 @@ Sub B4XPage_Appear
End If
gest.Text = "PreVenta"
If Subs.traeTipoVentaDeBD = "VENTA" Then gest.Text = "Venta"
Log($">>>>>>>>>> |${la_cuenta.Text.trim}|"$)
' Log($">>>>>>>>>> |${la_cuenta.Text.trim}|"$)
If la_cuenta.Text.trim = "0" Then gest.Text = "Carga Abordo"
' Log($"ALMACEN: ${ALMACEN}${CRLF}RUTA:${LA_RUTA}"$)
End Sub
@@ -955,11 +960,12 @@ Sub GPS_LocationChanged (Location1 As Location)
gest.Visible = True
Tels.Visible = True
iniciofin
b_geo = "0"
' b_geo = "0"
bitacora.banderaGeoCerca = "0"
Else If geo = "1" Then
gest.Visible = False
Tels.Visible = False
p_transparenteInicioFin.Visible = False
' p_transparenteInicioFin.Visible = False
Log(999)
' b_Inicio_Fin_venta.Visible = False
End If
@@ -969,9 +975,10 @@ Sub GPS_LocationChanged (Location1 As Location)
LA_GEO.TextColor = Colors.Blue
Tels.Visible = True
gest.Visible = True
iniciofin
bitacora.inicioFin
precision = "1"
b_geo = "0"
' b_geo = "0"
bitacora.banderaGeoCerca = "0"
ToastMessageShow("DENTRO de rango GPS", False)
Else If habi = "1" Then
c = skmt.ExecQuery2("SELECT CAT_VA_VALOR FROM CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = ?",Array As String("LATITUD"))
@@ -996,13 +1003,14 @@ Sub GPS_LocationChanged (Location1 As Location)
LA_GEO.TextColor = Colors.Blue
Tels.Visible = True
gest.Visible = True
b_geo = "1"
' b_geo = "1"
bitacora.banderaGeoCerca = "1"
iniciofin
ToastMessageShow("DENTRO de rango GPS", False)
Else If distancealm > 50 Then
Tels.Visible = False
gest.Visible = False
p_transparenteInicioFin.Visible = False
' p_transparenteInicioFin.Visible = False
Log(998)
' b_Inicio_Fin_venta.Visible = False
c = skmt.ExecQuery("SELECT PC_CLIENTE FROM PEDIDO_CLIENTE WHERE PC_CLIENTE IN (Select CUENTA from cuentaa)")
@@ -1010,7 +1018,8 @@ Sub GPS_LocationChanged (Location1 As Location)
precision = "0"
Tels.Visible = True
gest.Visible = True
b_geo = "0"
' b_geo = "0"
bitacora.banderaGeoCerca = "0"
iniciofin
Else If c.RowCount = 0 Then
c = skmt.ExecQuery("SELECT NV_CLIENTE FROM NOVENTA CLIENTE WHERE NV_CLIENTE IN (Select CUENTA from cuentaa)")
@@ -1018,19 +1027,20 @@ Sub GPS_LocationChanged (Location1 As Location)
Tels.Visible = True
gest.Visible = True
precision = "0"
b_geo = "0"
' b_geo = "0"
iniciofin
Else If c.RowCount = 0 Then
Tels.Visible = False
gest.Visible = False
p_transparenteInicioFin.Visible = False
' p_transparenteInicioFin.Visible = False
Log(997)
' b_Inicio_Fin_venta.Visible = False
LA_GEO.TextColor = Colors.Red
If ALMACEN = "1" Then
Tels.Visible = False
gest.Visible = True
b_geo = "0"
' b_geo = "0"
bitacora.banderaGeoCerca = "0"
iniciofin
End If
End If
@@ -1039,7 +1049,8 @@ Sub GPS_LocationChanged (Location1 As Location)
If ALMACEN = "1" Then
Tels.Visible = False
gest.Visible = True
b_geo = "0"
' b_geo = "0"
bitacora.banderaGeoCerca = "0"
iniciofin
End If
End If
@@ -1048,31 +1059,34 @@ Sub GPS_LocationChanged (Location1 As Location)
If c.RowCount > 0 Then
Tels.Visible = True
gest.Visible = True
b_geo = "0"
' b_geo = "0"
bitacora.banderaGeoCerca = "0"
iniciofin
Else If c.RowCount = 0 Then
Tels.Visible = False
gest.Visible = False
p_transparenteInicioFin.Visible = False
' p_transparenteInicioFin.Visible = False
Log(996)
' b_Inicio_Fin_venta.Visible = False
c = skmt.ExecQuery("SELECT NV_CLIENTE FROM NOVENTA CLIENTE WHERE NV_CLIENTE IN (Select CUENTA from cuentaa)")
If c.RowCount > 0 Then
Tels.Visible = True
gest.Visible = True
b_geo = "0"
' b_geo = "0"
bitacora.banderaGeoCerca = "0"
iniciofin
Else If c.RowCount = 0 Then
Tels.Visible = False
gest.Visible = False
p_transparenteInicioFin.Visible = False
' p_transparenteInicioFin.Visible = False
Log(995)
' b_Inicio_Fin_venta.Visible = False
LA_GEO.TextColor = Colors.Red
If ALMACEN = "1" Then
Tels.Visible = False
gest.Visible = True
b_geo = "0"
' b_geo = "0"
bitacora.banderaGeoCerca = "0"
iniciofin
End If
End If
@@ -1080,21 +1094,23 @@ Sub GPS_LocationChanged (Location1 As Location)
If ALMACEN = "1" Then
Tels.Visible = False
gest.Visible = True
b_geo = "0"
' b_geo = "0"
bitacora.banderaGeoCerca = "0"
iniciofin
End If
End If
Else
Tels.Visible = False
gest.Visible = False
p_transparenteInicioFin.Visible = False
' p_transparenteInicioFin.Visible = False
Log(994)
' b_Inicio_Fin_venta.Visible = False
LA_GEO.TextColor = Colors.Red
If ALMACEN = "1" Then
Tels.Visible = False
gest.Visible = True
b_geo = "0"
' b_geo = "0"
bitacora.banderaGeoCerca = "0"
iniciofin
End If
End If
@@ -1119,17 +1135,17 @@ End Sub
'Muestra u oculta el boton de inicio y fin de venta
Private Sub iniciofin
If Starter.enVenta = False Then
p_transparenteInicioFin.BringToFront
p_transparenteInicioFin.Visible = True
b_Inicio_Fin_venta.Visible = True
' Log("Hacemos visible el boton de Inicio Venta")
Else
If b_Inicio_Fin_venta.Text <> "TERMINAR VENTA" Then
p_transparenteInicioFin.Visible = False
b_Inicio_Fin_venta.Visible = False
End If
End If
' If Starter.enVenta = False Then
' p_transparenteInicioFin.BringToFront
' p_transparenteInicioFin.Visible = True
' b_Inicio_Fin_venta.Visible = True
'' Log("Hacemos visible el boton de Inicio Venta")
' Else
' If b_Inicio_Fin_venta.Text <> "TERMINAR VENTA" Then
' p_transparenteInicioFin.Visible = False
' b_Inicio_Fin_venta.Visible = False
' End If
' End If
End Sub
Private Sub b_geopass_Click
@@ -1207,7 +1223,7 @@ Sub JobDone(Job As HttpJob)
End Sub
Sub ListView1_ItemLongClick (Position As Int, Value As Object)
End Sub
Sub gest_Click
@@ -1922,7 +1938,7 @@ Private Sub B4XPage_CloseRequest As ResumableSub
' Return True To close, False To cancel
cuest.encuestaIniciada = False
cuest.ocultPanelPregunta
If p_transparenteInicioFin.Visible And b_Inicio_Fin_venta.Text = "TERMINAR VENTA" Then
If bitacora.p_transparenteInicioFin2.Visible And bitacora.b_Inicio_Fin_venta2.Text = "TERMINAR VENTA" Then
ToastMessageShow("Por favor presione el botón de TERMINAR VENTA", True)
Return False
Else if Subs.hayPedido Then
@@ -1958,14 +1974,9 @@ End Sub
Sub Guardar_Click
Guardar.SendToBack
p_transparenteInicioFin.Visible = True
b_Inicio_Fin_venta.Visible = True
b_Inicio_Fin_venta.Text = "TERMINAR VENTA"
' Starter.idCliente = ""
Log("Hacemos visible el boton de Terminar Venta")
End Sub
Sub guardadoventa
bitacora.b_Inicio_Fin_venta2.Text = "TERMINAR VENTA"
bitacora.enVenta = False
bitacora.inicioFin
DateTime.DateFormat = "MM/dd/yyyy"
sDate=DateTime.Date(DateTime.Now)
sTime=DateTime.Time(DateTime.Now)
@@ -1984,26 +1995,19 @@ Sub guardadoventa
Private s3 As Cursor=B4XPages.MainPage.skmt.ExecQuery2("select * FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) and PE_RECALCULO <> ? AND PE_RECALCULO <> ? AND PE_RECALCULO <> ?",Array As String("","null",Null))
LogColor(s3.RowCount,Colors.Yellow)
If s3.RowCount > 0 Then
Private s As Cursor=B4XPages.MainPage.skmt.ExecQuery2("select iFNULL(sum(pe_costo_tot),0) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) and PE_RECALCULO = ? AND PE_RECALCULO = ? AND PE_RECALCULO = ?",Array As String("","null",Null))
s.Position = 0
Private s5 As Cursor = B4XPages.MainPage.skmt.ExecQuery2("select iFNULL(sum(PE_RECALCULOTOT),0) as TOTAL_CLIE FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) and PE_RECALCULO <> ? AND PE_RECALCULO <> ? AND PE_RECALCULO <> ?",Array As String("","null",Null))
s5.Position = 0
Private suma As Float = s.GetString("TOTAL_CLIE") + s5.GetString("TOTAL_CLIE")
s.Close
Else If s3.RowCount = 0 Then
Private s As Cursor=B4XPages.MainPage.skmt.ExecQuery("select iFNULL(sum(pe_costo_tot),0) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")
s.Position=0
Private suma As Float = s.GetString("TOTAL_CLIE")
s.Close
End If
'AQUI TERMINA
If c.GetString("CUANTOS") > 0 Then
B4XPages.MainPage.skmt.ExecNonQuery("delete from NOVENTA where NV_CLIENTE In (select cuenta from cuentaa)")
B4XPages.MainPage.skmt.ExecNonQuery("delete from pedido_cliente where PC_CLIENTE In (select cuenta from cuentaa)")
@@ -2033,7 +2037,16 @@ Sub guardadoventa
ToastMessageShow(".",True)
End Try
DateTime.TimeFormat = "HH:mm:ss"
B4XPages.ShowPage("Principal")
' B4XPages.ShowPage("Principal")
End Sub
Sub Guardar_LongClick
' bitacora.p_transparenteInicioFin2.Visible = True
' bitacora.b_Inicio_Fin_venta2.text = "TERMINAR VENTA"
End Sub
Sub guardadoventa
End Sub
Sub NUEVO_Click
@@ -4733,41 +4746,40 @@ Private Sub StopCamera2
End Sub
Private Sub b_Inicio_Fin_venta_Click
'' b_Inicio_Fin_venta.Visible = False
'' Subs.bitacora(Subs.fechanormal(DateTime.Now), usuario, Subs.traeAlmacen, Subs.traeRuta, "Pre-venta", "0", Subs.fechanormal(DateTime.Now), Subs.fechanormal(DateTime.Now), B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps, precision, "", "")
' contadorIniciarVenta = 0
' IniVenNO = False
' If dentroDeGeocerca Then precision = 1
'' LogColor("-------> "&contadorIniciarVenta & " <-------", Colors.Red)
' motivoNoVenta = ""
' motivoNoVisita = ""
' p_transparenteInicioFin.Visible = False
' If b_Inicio_Fin_venta.Text = "TERMINAR VENTA" Then
' Subs.bitacora(Subs.fechanormal(DateTime.Now), Subs.traeUsuarioDeBD, Subs.traeAlmacen, Subs.traeRutaBitacora, "Termina Venta", Subs.traeCliente, "", Subs.fechanormal(DateTime.Now), B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps, precision, motivoNoVenta, motivoNoVisita,b_geo)
' bitacora.enVenta = False
'' LogColor($">>>>>> TERMINA VENTA: ${Starter.enVenta} - ${Subs.traeCliente}"$, Colors.red)
' B4XPages.ShowPageAndRemovePreviousPages("Principal")
'' guardadoventa
' Else if b_Inicio_Fin_venta.Text = "INICIAR VENTA" Then
' contadorIniciarVenta = 0
' IniVenNO = False
' contadorIniciarVenta = contadorIniciarVenta + 1
' If contadorIniciarVenta = 1 And IniVenNO = False And motivoNoVenta <> "NO VENTA" Then
' IniVenNO = True
' Subs.bitacora(Subs.fechanormal(DateTime.Now), Subs.traeUsuarioDeBD, Subs.traeAlmacen, Subs.traeRutaBitacora, "Inicia Venta", Subs.traeCliente, Subs.fechanormal(DateTime.Now), "", B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps, precision, "", "",b_geo)
' bitacora.enVenta = True
'' LogColor($">>>>>> INICIA VENTA: ${Starter.enVenta} - ${Subs.traeCliente}"$, Colors.red)
' Else If contadorIniciarVenta = 1 And IniVenNO = False And motivoNoVenta = "NO VENTA" Then
' IniVenNO = True
' Subs.bitacora(Subs.fechanormal(DateTime.Now), Subs.traeUsuarioDeBD, Subs.traeAlmacen, Subs.traeRutaBitacora, "Inicia Venta", Subs.traeCliente, Subs.fechanormal(DateTime.Now), "", B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps, precision, motivoNoVenta, "",b_geo)
' bitacora.enVenta = True
' Else If contadorIniciarVenta > 1 Then
' b_Inicio_Fin_venta.Visible = False
' End If
' End If
'
' b_Inicio_Fin_venta.Visible = False
' Subs.bitacora(Subs.fechanormal(DateTime.Now), usuario, Subs.traeAlmacen, Subs.traeRuta, "Pre-venta", "0", Subs.fechanormal(DateTime.Now), Subs.fechanormal(DateTime.Now), B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps, precision, "", "")
contadorIniciarVenta = 0
IniVenNO = False
If dentroDeGeocerca Then precision = 1
' LogColor("-------> "&contadorIniciarVenta & " <-------", Colors.Red)
motivoNoVenta = ""
motivoNoVisita = ""
p_transparenteInicioFin.Visible = False
If b_Inicio_Fin_venta.Text = "TERMINAR VENTA" Then
Subs.bitacora(Subs.fechanormal(DateTime.Now), Subs.traeUsuarioDeBD, Subs.traeAlmacen, Subs.traeRutaBitacora, "Termina Venta", Subs.traeCliente, "", Subs.fechanormal(DateTime.Now), B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps, precision, motivoNoVenta, motivoNoVisita,b_geo)
Starter.enVenta = False
' LogColor($">>>>>> TERMINA VENTA: ${Starter.enVenta} - ${Subs.traeCliente}"$, Colors.red)
B4XPages.ShowPageAndRemovePreviousPages("Principal")
guardadoventa
Else if b_Inicio_Fin_venta.Text = "INICIAR VENTA" Then
contadorIniciarVenta = 0
IniVenNO = False
contadorIniciarVenta = contadorIniciarVenta + 1
If contadorIniciarVenta = 1 And IniVenNO = False And motivoNoVenta <> "NO VENTA" Then
IniVenNO = True
Subs.bitacora(Subs.fechanormal(DateTime.Now), Subs.traeUsuarioDeBD, Subs.traeAlmacen, Subs.traeRutaBitacora, "Inicia Venta", Subs.traeCliente, Subs.fechanormal(DateTime.Now), "", B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps, precision, "", "",b_geo)
Starter.enVenta = True
' LogColor($">>>>>> INICIA VENTA: ${Starter.enVenta} - ${Subs.traeCliente}"$, Colors.red)
Else If contadorIniciarVenta = 1 And IniVenNO = False And motivoNoVenta = "NO VENTA" Then
IniVenNO = True
Subs.bitacora(Subs.fechanormal(DateTime.Now), Subs.traeUsuarioDeBD, Subs.traeAlmacen, Subs.traeRutaBitacora, "Inicia Venta", Subs.traeCliente, Subs.fechanormal(DateTime.Now), "", B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps, precision, motivoNoVenta, "",b_geo)
Starter.enVenta = True
Else If contadorIniciarVenta > 1 Then
b_Inicio_Fin_venta.Visible = False
End If
End If
b_Inicio_Fin_venta.Visible = False
End Sub
Private Sub LA_GEO_Click