2 Commits

Author SHA1 Message Date
b65e1b285f - VERSION 5.07.24
- Cambios en el código de la geoceca, que no se activaba/desactivaba cuando estaba cerca del almacen.
2025-09-17 20:46:14 -06:00
0ddb35fb07 - VERSION 5.07.07
- Se hicieron cambios en el codigo de la geocerca en cliente.
2025-07-11 14:47:52 -06:00
8 changed files with 63 additions and 35 deletions

View File

@@ -380,6 +380,11 @@ Sub B4XPage_Appear
' ks.Initialize(Me, "ks") ' ks.Initialize(Me, "ks")
' ks.vacuum ' ks.vacuum
' ks.centraEtiqueta(l_version, Root.Width) ' ks.centraEtiqueta(l_version, Root.Width)
Private cu As Cursor = Starter.skmt.ExecQuery("select USUARIO from USUARIOA")
If cu.RowCount > 0 Then
cu.Position = 0
If cu.GetString("USUARIO") <> "" Then user.Text = cu.GetString("USUARIO")
End If
End Sub End Sub
Sub ks_etiquetaCentrada(success As Boolean) Sub ks_etiquetaCentrada(success As Boolean)
@@ -923,7 +928,7 @@ End Sub
Private Sub p_geocerca_Click Private Sub p_geocerca_Click
Log("CLICKED") Log("CLICKED")
Dim activa As Int = 1 Dim activa As Int = 1
If Subs.estamosEnAlmacen(500) Then If Subs.estamosEnAlmacen(100) Then
If l_geocerca.Text <> "Buscando ubicación ..." Then If l_geocerca.Text <> "Buscando ubicación ..." Then
If passSupervisor = "" Then If passSupervisor = "" Then
p_transparente.Visible = True p_transparente.Visible = True

View File

@@ -150,6 +150,8 @@ Sub Class_Globals
Private p_passGeocerca As Panel Private p_passGeocerca As Panel
Private b_passGeocerca As Button Private b_passGeocerca As Button
Private et_passGeocerca As EditText Private et_passGeocerca As EditText
Dim l_geoAlmacen As Label
Dim rangoAAlmacen As Int = 50
End Sub End Sub
'You can add more parameters here. 'You can add more parameters here.
@@ -212,11 +214,14 @@ End Sub
Sub B4XPage_Appear Sub B4XPage_Appear
distance = 500000000000 distance = 500000000000
B4XPages.MainPage.lon_gps = 0
B4XPages.MainPage.lat_gps = 0
B4XPages.mainpage.pantallaActual = Root B4XPages.mainpage.pantallaActual = Root
b_noVenta.Enabled = True b_noVenta.Enabled = True
b_venta.Enabled = True b_venta.Enabled = True
b_noVenta.Visible = False 'Boton deshabilitado por default. b_noVenta.Visible = False 'Boton deshabilitado por default.
b_venta.Visible = False 'Boton deshabilitado por default. b_venta.Visible = False 'Boton deshabilitado por default.
l_geoAlmacen.text = $"Almacen a: N/A"$
' c = Starter.skmt.ExecQuery("SELECT ID FROM VENDIDOS WHERE ID IN (Select cuenta from cuentaa)") ' c = Starter.skmt.ExecQuery("SELECT ID FROM VENDIDOS WHERE ID IN (Select cuenta from cuentaa)")
' If c.RowCount > 0 Then ' If c.RowCount > 0 Then
' b_noVenta.Enabled = False ' b_noVenta.Enabled = False
@@ -259,7 +264,6 @@ Sub B4XPage_Appear
l_total.Text = "0" l_total.Text = "0"
Else Else
l_total.Text = s.GetString("TOTAL_CLIE") l_total.Text = s.GetString("TOTAL_CLIE")
End If End If
total_cliente = s.GetString("TOTAL_CLIE") total_cliente = s.GetString("TOTAL_CLIE")
Private factura As String = 0 Private factura As String = 0
@@ -298,7 +302,6 @@ Sub B4XPage_Appear
Else Else
MONTO_COMPRA = "0" MONTO_COMPRA = "0"
End If End If
la_saldotot.Text = MONTO_COMPRA la_saldotot.Text = MONTO_COMPRA
If MONTO_COMPRA <> "0" Then If MONTO_COMPRA <> "0" Then
META2 = 1200 - MONTO_COMPRA META2 = 1200 - MONTO_COMPRA
@@ -344,7 +347,6 @@ Sub B4XPage_Appear
' b_noVenta.Visible = True ' b_noVenta.Visible = True
' b_venta.Visible = True ' b_venta.Visible = True
' End If ' End If
If Not(Starter.GPS.GPSEnabled) Then If Not(Starter.GPS.GPSEnabled) Then
ToastMessageShow("Debe Activar el GPS del Equipo.", True) ToastMessageShow("Debe Activar el GPS del Equipo.", True)
StartActivity(Starter.GPS.LocationSettingsIntent) StartActivity(Starter.GPS.LocationSettingsIntent)
@@ -352,7 +354,6 @@ Sub B4XPage_Appear
Starter.GPS.Start(0, 0) Starter.GPS.Start(0, 0)
' If Starter.ubicacionActual.Latitude <> 0 Then GPS_LocationChanged(Starter.ubicacionActual) ' If Starter.ubicacionActual.Latitude <> 0 Then GPS_LocationChanged(Starter.ubicacionActual)
End If End If
Log("Tracker LR Init: " & (Tracker.actualLR.IsInitialized)) Log("Tracker LR Init: " & (Tracker.actualLR.IsInitialized))
If Not(Tracker.actualLR.IsInitialized) Then If Not(Tracker.actualLR.IsInitialized) Then
Log("INICIAMOS TRACKER") Log("INICIAMOS TRACKER")
@@ -365,22 +366,20 @@ Sub B4XPage_Appear
'' Log($"Tenemos UUC: ${Tracker.FLP.GetLastKnownLocation.Latitude},${Tracker.FLP.GetLastKnownLocation.Longitude}"$) '' Log($"Tenemos UUC: ${Tracker.FLP.GetLastKnownLocation.Latitude},${Tracker.FLP.GetLastKnownLocation.Longitude}"$)
' GPS_LocationChanged(Tracker.FLP.GetLastKnownLocation) ' GPS_LocationChanged(Tracker.FLP.GetLastKnownLocation)
' End If ' End If
' Log("DISTANCIA: " & distance) ' Log("DISTANCIA: " & distance)
' Log("HAY PEDIDO: " & Subs.hayPedido) ' Log("HAY PEDIDO: " & Subs.hayPedido)
' Log("GEOCERCA ACTIVA: " & Subs.geocercaHabilitada) ' Log("GEOCERCA ACTIVA: " & Subs.geocercaHabilitada)
' Log("EN ALMACEN: " & Subs.estamosEnAlmacen(50)) ' Log("EN ALMACEN: " & Subs.estamosEnAlmacen(50))
If Subs.hayPedido Or distance <= 50 Or Not(Subs.geocercaHabilitada) Or Subs.estamosEnAlmacen(50) Then ' Si estamos dentro de la geocerca, habilitamos los botones de Venta y noVenta ' If Subs.hayPedido Or distance <= 50 Or Not(Subs.geocercaHabilitada) Or Subs.estamosEnAlmacen(50) Then ' Si estamos dentro de la geocerca, habilitamos los botones de Venta y noVenta
b_noVenta.Visible = True ' b_noVenta.Visible = True
b_venta.Visible = True ' b_venta.Visible = True
Log("Botones visibles") ' Log("Botones visibles")
End If ' End If
'Si el cliente es nuevo, no aparece el boton de venta 'Si el cliente es nuevo, no aparece el boton de venta
If la_cuenta.text.SubString2(0,1) = "N" Then ' If la_cuenta.text.SubString2(0,1) = "N" Then
b_venta.Visible = False b_venta.Visible = False
b_noVenta.Visible = False b_noVenta.Visible = False
End If ' End If
End Sub End Sub
Sub GPS_LocationChanged (Location1 As Location) Sub GPS_LocationChanged (Location1 As Location)
@@ -392,7 +391,7 @@ Sub GPS_LocationChanged (Location1 As Location)
' End If ' End If
Dim l1, l2 As Location Dim l1, l2 As Location
l1.Initialize2(B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps) l1.Initialize2(Location1.Latitude, Location1.Longitude)
' Log($"Coordenadas de la tienda - lat:${m_lat}, lon:${m_lon}"$) ' Log($"Coordenadas de la tienda - lat:${m_lat}, lon:${m_lon}"$)
l2.Initialize2(m_lat, m_lon) l2.Initialize2(m_lat, m_lon)
BT_QR.Enabled = True BT_QR.Enabled = True
@@ -410,16 +409,20 @@ Sub GPS_LocationChanged (Location1 As Location)
' b_venta.Visible = True ' b_venta.Visible = True
' Log("Botones visibles") ' Log("Botones visibles")
' End If ' End If
' Log("###########################################") Log("###########################################")
' Log("No geocerca: " & Not(Subs.geocercaHabilitada)) Log("No geocerca: " & Not(Subs.geocercaHabilitada))
' Log("estamosEnAlmacen: " & Subs.estamosEnAlmacen(50)) Log("estamosEnAlmacen: " & Subs.estamosEnAlmacen(rangoAAlmacen))
' Log("distance: " & distance) Log("distance: " & distance)
' Log("hayPedido: " & Subs.hayPedido) Log("hayPedido: " & Subs.hayPedido)
' Subs.estamosEnAlmacen(ramgoAAlmacen)
' Log("ENTRAMOS: " & (Subs.hayPedido Or distance <= 50 Or Not(Subs.geocercaHabilitada) Or Subs.estamosEnAlmacen(50))) ' Log("ENTRAMOS: " & (Subs.hayPedido Or distance <= 50 Or Not(Subs.geocercaHabilitada) Or Subs.estamosEnAlmacen(50)))
If Subs.hayPedido Or distance <= 50 Or Not(Subs.geocercaHabilitada) Or Subs.estamosEnAlmacen(50) Then ' Si estamos dentro de la geocerca, habilitamos los botones de Venta y noVenta If Subs.hayPedido Or distance <= 50 Or Not(Subs.geocercaHabilitada) Or Subs.estamosEnAlmacen(rangoAAlmacen) Then ' Si estamos dentro de la geocerca, habilitamos los botones de Venta y noVenta
b_noVenta.Visible = True b_noVenta.Visible = True
b_venta.Visible = True b_venta.Visible = True
' Log("Botones visibles") ' Log("Botones visibles")
Else
b_noVenta.Visible = False
b_venta.Visible = False
End If End If
LA_GEO.TextColor = Colors.Blue LA_GEO.TextColor = Colors.Blue
' b_noVenta.Visible = True ' b_noVenta.Visible = True
@@ -1080,7 +1083,7 @@ End Sub
Private Sub b_passGeocerca_Click Private Sub b_passGeocerca_Click
Log("b_passGeocerca clicked") Log("b_passGeocerca clicked")
ToastMessageShow("¡Un momento por favor!", false) ToastMessageShow("¡Un momento por favor!", False)
b_passGeocerca.Enabled = False b_passGeocerca.Enabled = False
If et_passGeocerca.Text.Trim = "KMTS1" Then If et_passGeocerca.Text.Trim = "KMTS1" Then
ToastMessageShow("¡¡Listo!!", False) ToastMessageShow("¡¡Listo!!", False)

View File

@@ -312,7 +312,6 @@ Private Sub B4XPage_Created (Root1 As B4XView)
ds.Position = 0 ds.Position = 0
Starter.dia_semana = ds.GetString("CAT_CL_DIASEMANA") Starter.dia_semana = ds.GetString("CAT_CL_DIASEMANA")
End If End If
' CallSubDelayed(FirebaseMessaging, "SubscribeToTopics")
End Sub End Sub
Sub B4XPage_Appear Sub B4XPage_Appear

Binary file not shown.

View File

@@ -199,7 +199,7 @@ Version=12.8
#Region Project Attributes #Region Project Attributes
#ApplicationLabel: Mariana #ApplicationLabel: Mariana
#VersionCode: 1 #VersionCode: 1
#VersionName: 5.07.05 #VersionName: 5.07.24
'SupportedOrientations possible values: unspecified, landscape or portrait. 'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait #SupportedOrientations: portrait
#CanInstallToExternalStorage: False #CanInstallToExternalStorage: False

View File

@@ -62,7 +62,7 @@ ModuleClosedNodes0=
ModuleClosedNodes1= ModuleClosedNodes1=
ModuleClosedNodes10= ModuleClosedNodes10=
ModuleClosedNodes11= ModuleClosedNodes11=
ModuleClosedNodes12= ModuleClosedNodes12=1
ModuleClosedNodes13=1 ModuleClosedNodes13=1
ModuleClosedNodes14=2 ModuleClosedNodes14=2
ModuleClosedNodes15= ModuleClosedNodes15=
@@ -70,7 +70,7 @@ ModuleClosedNodes16=
ModuleClosedNodes17= ModuleClosedNodes17=
ModuleClosedNodes18= ModuleClosedNodes18=
ModuleClosedNodes19= ModuleClosedNodes19=
ModuleClosedNodes2= ModuleClosedNodes2=2,4
ModuleClosedNodes20= ModuleClosedNodes20=
ModuleClosedNodes21= ModuleClosedNodes21=
ModuleClosedNodes22= ModuleClosedNodes22=
@@ -79,15 +79,15 @@ ModuleClosedNodes24=
ModuleClosedNodes25= ModuleClosedNodes25=
ModuleClosedNodes26= ModuleClosedNodes26=
ModuleClosedNodes27=2,3,4,5,6,7,8,10,11,12,13,14 ModuleClosedNodes27=2,3,4,5,6,7,8,10,11,12,13,14
ModuleClosedNodes28= ModuleClosedNodes28=2
ModuleClosedNodes29= ModuleClosedNodes29=
ModuleClosedNodes3= ModuleClosedNodes3=
ModuleClosedNodes4=2,4,10,23,24,25,26,27,28,29,30,31,32,33,34,35,37,38,39,40,41,42,44,45 ModuleClosedNodes4=4
ModuleClosedNodes5= ModuleClosedNodes5=
ModuleClosedNodes6= ModuleClosedNodes6=
ModuleClosedNodes7= ModuleClosedNodes7=
ModuleClosedNodes8= ModuleClosedNodes8=
ModuleClosedNodes9= ModuleClosedNodes9=
NavigationStack=C_Cliente,B4XPage_Appear,349,6,Tracker,CreateLocationRequest,121,0,Tracker,CreateLocationRequestSmallD,138,0,C_Cliente,GPS_LocationChanged,438,6,C_Cliente,ListView1_ItemLongClick,448,0,Starter,ENVIA_ULTIMA_GPS,100,0,Starter,timerRecordatorio_Tick,163,0,C_Cliente,p_transparenteGeocerca_Click,1072,1,C_Cliente,b_passGeocerca_Click,1076,6,C_Cliente,JobDone,994,1 NavigationStack=C_Cliente,B4XPage_Created,204,0,B4XMainPage,b_passGeocerca_Click,920,0,Starter,timerRecordatorio_Tick,183,4,B4XMainPage,p_geocerca_Click,923,0,Diseñador Visual,cliente.bal,-100,1,C_Cliente,Initialize,154,0,C_Cliente,Class_Globals,146,5,Subs,estamosEnAlmacen,1434,6,C_Cliente,B4XPage_Appear,276,0,C_Cliente,GPS_LocationChanged,414,3,C_Cliente,B_GUARDA_C_Click,779,0
SelectedBuild=0 SelectedBuild=0
VisibleModules=27,2,12,4,28,29 VisibleModules=27,2,12,4,28,29,17

View File

@@ -181,9 +181,12 @@ Private Sub timerRecordatorio_Tick
Or (DateTime.GetHour(DateTime.now) = 15 And DateTime.GetMinute(DateTime.now) = 30) _ 'Recordatorio de las 15:30 Or (DateTime.GetHour(DateTime.now) = 15 And DateTime.GetMinute(DateTime.now) = 30) _ 'Recordatorio de las 15:30
Or (DateTime.GetHour(DateTime.now) = 10 And DateTime.GetMinute(DateTime.now) = 70) Then ' HORARIO DE PRUEBA Or (DateTime.GetHour(DateTime.now) = 10 And DateTime.GetMinute(DateTime.now) = 70) Then ' HORARIO DE PRUEBA
Log("¡¡MANDAMOS RECORDATORIO!!") Log("¡¡MANDAMOS RECORDATORIO!!")
If Not(B4XPages.GetManager.IsForeground) Then Subs.notiHigh("¡¡ATENCION!!", "Recuerda enviar tu venta.", Main) If Not(B4XPages.GetManager.IsForeground) Then
If B4XPages.MainPage.IsInitialized And B4XPages.MainPage.pantallaActual.IsInitialized Then Subs.notiHigh("¡¡ATENCION!!", "Recuerda enviar tu venta.", Main)
B4XPages.MainPage.recordatorio.agregaPanelRecordatorio(B4XPages.MainPage.pantallaActual) Else
If B4XPages.MainPage.IsInitialized And B4XPages.MainPage.pantallaActual.IsInitialized Then
B4XPages.MainPage.recordatorio.agregaPanelRecordatorio(B4XPages.MainPage.pantallaActual)
End If
End If End If
ultimoRecordatorio = DateTime.GetHour(DateTime.now) & DateTime.GetMinute(DateTime.now) ultimoRecordatorio = DateTime.GetHour(DateTime.now) & DateTime.GetMinute(DateTime.now)
End If End If

View File

@@ -90,6 +90,20 @@ Sub notiHigh(title As String, body As String, activity As Object) 'ignore
notif.Notify(777) notif.Notify(777)
End Sub End Sub
'Regresa el objeto de una notificacion con importancia baja
Sub notiLow(title As String, Body As String, activity As Object) ' As Notification 'ignore
Private notification As Notification
notification.Initialize2(notification.IMPORTANCE_LOW)
notification.Icon = "icon"
notification.Sound = False
notification.Vibrate = False
notification.SetInfo(title, Body, activity)
notification.Notify(777)
' Log("notiLowReturn: "&title)
' Log("notiLowReturn SetInfo")
' Return notification
End Sub
'Regresa el objeto de una notificacion con importancia baja 'Regresa el objeto de una notificacion con importancia baja
Sub notiLowReturn(title As String, Body As String, id As Int) As Notification 'ignore Sub notiLowReturn(title As String, Body As String, id As Int) As Notification 'ignore
Private notification As Notification Private notification As Notification
@@ -1426,9 +1440,13 @@ Sub estamosEnAlmacen(rango As Int) As Boolean
' Log($"Coordenadas del almacen - lat:${latAlmacen}, lon:${lonAlmacen}"$) ' Log($"Coordenadas del almacen - lat:${latAlmacen}, lon:${lonAlmacen}"$)
l2.Initialize2(latAlmacen, lonAlmacen) l2.Initialize2(latAlmacen, lonAlmacen)
Dim distance As Long = l1.DistanceTo(l2) 'the result is in meters Dim distance As Long = l1.DistanceTo(l2) 'the result is in meters
' Log(distance) ' If distance < 100 Then ToastMessageShow("Distancia a almacen: " & distance, False)
' notiHigh("Mariana", "Distancia a almacen: " & distance, Main)
' B4XPages.MainPage.cliente.l_geoAlmacen.text = $"Almacen a: ${distance}"$
If distance <= rango Then res = True If distance <= rango Then res = True
' Log("Dentro del almacen: " & res) Log("Dentro del almacen: " & res)
B4XPages.MainPage.cliente.l_geoAlmacen.Text = $"Almacen a: ${distance} - Rango: ${rango}"$
Log(distance)
Catch Catch
Log(LastException) Log(LastException)
End Try End Try