mirror of
https://github.com/KeymonSoft/Intmex_Multiventa.git
synced 2026-04-17 21:06:08 +00:00
VERSION 5.12.11
- Se agrego coddigo para habilitar la geocerca, se descarga la bandera desde cat_rutas y se guarda en cat_variables (GEOCERCA)
This commit is contained in:
@@ -18,6 +18,9 @@ Version=9.85
|
|||||||
'###################### PUSH TORTOISE GIT #########################################################
|
'###################### PUSH TORTOISE GIT #########################################################
|
||||||
'Ctrl + click ide://run?file=%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe&Args=TortoiseGitProc&Args=/command:commit&Args=/path:"./../../"&Args=/closeonend:2
|
'Ctrl + click ide://run?file=%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe&Args=TortoiseGitProc&Args=/command:commit&Args=/path:"./../../"&Args=/closeonend:2
|
||||||
'###########################################################################################################
|
'###########################################################################################################
|
||||||
|
'###################### PUSH TORTOISE GIT CON TAG ##################################################
|
||||||
|
'Ctrl + clic para Git: ide://run?file=%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe&Args=-ExecutionPolicy&Args=Bypass&Args=-File&Args=..\_git_tag.ps1&Args=%22%PROJECT%%22&Args=%22%PROJECT_NAME%%22
|
||||||
|
'###########################################################################################################
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
'Ctrl + click ide://run?file=%WINDIR%\System32\cmd.exe&Args=/c&Args=github&Args=..\..\
|
'Ctrl + click ide://run?file=%WINDIR%\System32\cmd.exe&Args=/c&Args=github&Args=..\..\
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ Sub Class_Globals
|
|||||||
Dim reqManager As DBRequestManager
|
Dim reqManager As DBRequestManager
|
||||||
Dim cmd As DBCommand
|
Dim cmd As DBCommand
|
||||||
Dim ime As IME
|
Dim ime As IME
|
||||||
|
|
||||||
Dim g As GPS
|
Dim g As GPS
|
||||||
Dim ruta As String
|
Dim ruta As String
|
||||||
Dim skmt As SQL
|
Dim skmt As SQL
|
||||||
@@ -34,8 +33,6 @@ Sub Class_Globals
|
|||||||
Dim BLANCO As String
|
Dim BLANCO As String
|
||||||
Dim cuenta As String
|
Dim cuenta As String
|
||||||
Dim tipo_venta As String = "PREVENTA"
|
Dim tipo_venta As String = "PREVENTA"
|
||||||
|
|
||||||
|
|
||||||
Dim c As Cursor
|
Dim c As Cursor
|
||||||
Dim s As Cursor
|
Dim s As Cursor
|
||||||
Dim DD As Cursor
|
Dim DD As Cursor
|
||||||
@@ -54,13 +51,10 @@ Sub Class_Globals
|
|||||||
Dim gest As Button
|
Dim gest As Button
|
||||||
Dim la_saldotot As Label
|
Dim la_saldotot As Label
|
||||||
Dim la_saldooper As Label
|
Dim la_saldooper As Label
|
||||||
|
|
||||||
Dim Tels As Button
|
Dim Tels As Button
|
||||||
Dim Label10 As Label
|
Dim Label10 As Label
|
||||||
Dim Label11 As Label
|
Dim Label11 As Label
|
||||||
|
|
||||||
Dim Tar As Button
|
Dim Tar As Button
|
||||||
|
|
||||||
Dim la_comm As Label
|
Dim la_comm As Label
|
||||||
Dim la_actdte As Label
|
Dim la_actdte As Label
|
||||||
Dim la_usuario As Label
|
Dim la_usuario As Label
|
||||||
@@ -72,8 +66,7 @@ Sub Class_Globals
|
|||||||
Dim DATOS As Button
|
Dim DATOS As Button
|
||||||
Dim Guardar As Button
|
Dim Guardar As Button
|
||||||
Dim NUEVO As Button
|
Dim NUEVO As Button
|
||||||
' Dim lat_gps, lon_gps As String
|
' Dim lat_gps, lon_gps As String
|
||||||
|
|
||||||
Dim l_total As Label
|
Dim l_total As Label
|
||||||
Dim c2 As Cursor
|
Dim c2 As Cursor
|
||||||
Dim S2 As Cursor
|
Dim S2 As Cursor
|
||||||
@@ -88,7 +81,6 @@ Sub Class_Globals
|
|||||||
Private BT_QR As Button
|
Private BT_QR As Button
|
||||||
'Private qr As QRCode
|
'Private qr As QRCode
|
||||||
Dim CODIGO As String
|
Dim CODIGO As String
|
||||||
|
|
||||||
Private b_mapa As Button
|
Private b_mapa As Button
|
||||||
Dim CUANTOS As String
|
Dim CUANTOS As String
|
||||||
Private B_IMP As Button
|
Private B_IMP As Button
|
||||||
@@ -110,22 +102,18 @@ Sub Class_Globals
|
|||||||
Private HR_RES3 As String
|
Private HR_RES3 As String
|
||||||
Private EXISTE As String
|
Private EXISTE As String
|
||||||
Private TELEFONO As String
|
Private TELEFONO As String
|
||||||
|
|
||||||
Private RB1 As RadioButton
|
Private RB1 As RadioButton
|
||||||
Private RB2 As RadioButton
|
Private RB2 As RadioButton
|
||||||
Private RB3 As RadioButton
|
Private RB3 As RadioButton
|
||||||
Private RB4 As RadioButton
|
Private RB4 As RadioButton
|
||||||
Private RB5 As RadioButton
|
Private RB5 As RadioButton
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
Private LA_GEO As Label
|
Private LA_GEO As Label
|
||||||
Dim result As Int
|
Dim result As Int
|
||||||
Private cercavalor As String
|
Private cercavalor As String
|
||||||
Private LA_RUTA As String
|
Private LA_RUTA As String
|
||||||
|
|
||||||
Private b_like As Button
|
Private b_like As Button
|
||||||
Private B_GPS As Button
|
Private B_GPS As Button
|
||||||
' Dim sc As JhsIceZxing1
|
' Dim sc As JhsIceZxing1
|
||||||
@@ -152,7 +140,6 @@ Sub Class_Globals
|
|||||||
Dim cuest As C_Cuestionario
|
Dim cuest As C_Cuestionario
|
||||||
Private b_ventaabordo As Button
|
Private b_ventaabordo As Button
|
||||||
Private l_factura As Label
|
Private l_factura As Label
|
||||||
|
|
||||||
Dim Printer1 As EscPosPrinter
|
Dim Printer1 As EscPosPrinter
|
||||||
Dim impresoraConectada As Boolean = False
|
Dim impresoraConectada As Boolean = False
|
||||||
Dim MAC_IMPRESORA As String
|
Dim MAC_IMPRESORA As String
|
||||||
@@ -197,7 +184,7 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
|||||||
Else
|
Else
|
||||||
b_cxc.Visible = True
|
b_cxc.Visible = True
|
||||||
End If
|
End If
|
||||||
|
p_telefono.Top = 0 : p_telefono.Left = 0
|
||||||
s.Position=0
|
s.Position=0
|
||||||
If c.RowCount>0 Then
|
If c.RowCount>0 Then
|
||||||
c.Position=0
|
c.Position=0
|
||||||
@@ -252,6 +239,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
|
||||||
|
CallSubDelayed(Tracker, "StartFLPSmall")
|
||||||
p_pedidoExistente.Visible = False
|
p_pedidoExistente.Visible = False
|
||||||
reqManager.Initialize(Me, Starter.DBReqServer)
|
reqManager.Initialize(Me, Starter.DBReqServer)
|
||||||
b_pedidoExistente.Visible = False
|
b_pedidoExistente.Visible = False
|
||||||
@@ -304,16 +292,16 @@ Sub B4XPage_Appear
|
|||||||
If m_lon.Length < 5 Then m_lon = "0"
|
If m_lon.Length < 5 Then m_lon = "0"
|
||||||
LA_RUTA = c.GetString("CAT_CL_RUTA")
|
LA_RUTA = c.GetString("CAT_CL_RUTA")
|
||||||
' ESTO ES PARA FORZAR A PEDIR LA FOTO Y EL GPS
|
' ESTO ES PARA FORZAR A PEDIR LA FOTO Y EL GPS
|
||||||
If c.GetString("CAT_CL_NUM_SERIEFISICO") = "0" Then
|
' If c.GetString("CAT_CL_NUM_SERIEFISICO") = "0" Then
|
||||||
L_QR.TEXT = "SIN CODIGO"
|
' L_QR.TEXT = "SIN CODIGO"
|
||||||
L_QR.TextColor = Colors.Red
|
' L_QR.TextColor = Colors.Red
|
||||||
gest.VISIBLE = False
|
' gest.VISIBLE = False
|
||||||
BT_QR.Visible = True
|
' BT_QR.Visible = True
|
||||||
Else
|
' Else
|
||||||
L_QR.TEXT = c.GetString("CAT_CL_NUM_SERIEFISICO")
|
' L_QR.TEXT = c.GetString("CAT_CL_NUM_SERIEFISICO")
|
||||||
L_QR.TextColor = Colors.Blue
|
' L_QR.TextColor = Colors.Blue
|
||||||
BT_QR.Visible = False
|
' BT_QR.Visible = False
|
||||||
End If
|
' End If
|
||||||
End If
|
End If
|
||||||
c.Close
|
c.Close
|
||||||
s.Close
|
s.Close
|
||||||
@@ -374,14 +362,6 @@ Sub B4XPage_Appear
|
|||||||
Tels.Visible = True
|
Tels.Visible = True
|
||||||
gest.Visible = True
|
gest.Visible = True
|
||||||
End If
|
End If
|
||||||
CallSubDelayed(Tracker, "Track")
|
|
||||||
CallSubDelayed(Tracker, "StartFLPSmall")
|
|
||||||
If Tracker.FLP.IsInitialized And Tracker.FLP.GetLastKnownLocation.IsInitialized Then 'Si tenemos "UltimaUbicaccionConocida" la usamos.
|
|
||||||
B4XPages.MainPage.lat_gps = Tracker.FLP.GetLastKnownLocation.Latitude
|
|
||||||
B4XPages.MainPage.lon_gps = Tracker.FLP.GetLastKnownLocation.Longitude
|
|
||||||
' Log($"Tenemos UUC: ${Tracker.FLP.GetLastKnownLocation.Latitude},${Tracker.FLP.GetLastKnownLocation.Longitude}"$)
|
|
||||||
GPS_LocationChanged(Tracker.FLP.GetLastKnownLocation)
|
|
||||||
End If
|
|
||||||
Tels.Visible = True
|
Tels.Visible = True
|
||||||
gest.Visible = True
|
gest.Visible = True
|
||||||
|
|
||||||
@@ -399,33 +379,20 @@ Sub B4XPage_Appear
|
|||||||
' h.Close
|
' h.Close
|
||||||
' j.Close
|
' j.Close
|
||||||
|
|
||||||
If la_cuenta.Text = "0" Then
|
|
||||||
p_cbFactura.Visible = False
|
|
||||||
l_factura.Visible = False
|
|
||||||
b_ventaabordo.Visible = False
|
|
||||||
Else
|
|
||||||
p_cbFactura.Visible = True
|
|
||||||
l_factura.Visible = True
|
|
||||||
b_ventaabordo.Visible = True
|
|
||||||
End If
|
|
||||||
c = skmt.ExecQuery2("select CAT_VA_VALOR from CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = ?", Array As String ("MACIMP"))
|
c = skmt.ExecQuery2("select CAT_VA_VALOR from CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = ?", Array As String ("MACIMP"))
|
||||||
If c.RowCount > 0 Then
|
If c.RowCount > 0 Then
|
||||||
c.Position = 0
|
c.Position = 0
|
||||||
Starter.MAC_IMPRESORA = c.GetString("CAT_VA_VALOR")
|
Starter.MAC_IMPRESORA = c.GetString("CAT_VA_VALOR")
|
||||||
End If
|
End If
|
||||||
If Starter.MAC_IMPRESORA = "" Then Starter.MAC_IMPRESORA = "0"
|
If Starter.MAC_IMPRESORA = "" Then Starter.MAC_IMPRESORA = "0"
|
||||||
' Log("|" & Starter.MAC_IMPRESORA & "|")
|
|
||||||
Printer1.Initialize(Me, "Printer1")
|
Printer1.Initialize(Me, "Printer1")
|
||||||
If Printer1.IsConnected = False Then
|
If Printer1.IsConnected = False Then
|
||||||
' Printer1.Connect
|
' Printer1.Connect
|
||||||
' Log("1")
|
|
||||||
Else
|
Else
|
||||||
Printer1.DisConnect
|
Printer1.DisConnect
|
||||||
Printer1.Connect
|
Printer1.Connect
|
||||||
Log("2")
|
|
||||||
End If
|
End If
|
||||||
If Subs.hayPedido And Starter.utimaPagina <> "Productos" And Starter.utimaPagina <> "Cliente" Then
|
If Subs.hayPedido And Starter.utimaPagina <> "Productos" And Starter.utimaPagina <> "Cliente" Then
|
||||||
' Log()
|
|
||||||
Private p As ResultSet = Starter.skmt.ExecQuery($"select * from pedido where pe_cliente = '${Subs.traeCliente}'"$)
|
Private p As ResultSet = Starter.skmt.ExecQuery($"select * from pedido where pe_cliente = '${Subs.traeCliente}'"$)
|
||||||
lv_pedidoExistente.Clear
|
lv_pedidoExistente.Clear
|
||||||
Private label1 As Label = lv_pedidoExistente.TwoLinesLayout.Label
|
Private label1 As Label = lv_pedidoExistente.TwoLinesLayout.Label
|
||||||
@@ -448,6 +415,26 @@ Sub B4XPage_Appear
|
|||||||
p_pedidoExistente.BringToFront
|
p_pedidoExistente.BringToFront
|
||||||
b_pedidoExistente.Visible = True
|
b_pedidoExistente.Visible = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If la_cuenta.Text = "0" Then
|
||||||
|
p_cbFactura.Visible = False
|
||||||
|
l_factura.Visible = False
|
||||||
|
b_ventaabordo.Visible = False
|
||||||
|
Else
|
||||||
|
p_cbFactura.Visible = True
|
||||||
|
l_factura.Visible = True
|
||||||
|
b_ventaabordo.Visible = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
'Revisamos si la geocerca debe de activarse y de ser necesario, ocultamos los botones de venta y no venta.
|
||||||
|
If Subs.traeGeocerca Then ocultamosBotonesPorGeocerca
|
||||||
|
|
||||||
|
If Tracker.FLP.IsInitialized And Tracker.FLP.GetLastKnownLocation.IsInitialized Then 'Si tenemos "UltimaUbicaccionConocida" la usamos.
|
||||||
|
Log($"Tenemos UUC: ${Tracker.FLP.GetLastKnownLocation.Latitude},${Tracker.FLP.GetLastKnownLocation.Longitude}"$)
|
||||||
|
B4XPages.MainPage.lat_gps = Tracker.FLP.GetLastKnownLocation.Latitude
|
||||||
|
B4XPages.MainPage.lon_gps = Tracker.FLP.GetLastKnownLocation.Longitude
|
||||||
|
GPS_LocationChanged(Tracker.FLP.GetLastKnownLocation)
|
||||||
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub B4XPage_disappear
|
Sub B4XPage_disappear
|
||||||
@@ -457,35 +444,41 @@ End Sub
|
|||||||
|
|
||||||
Sub GPS_LocationChanged (Location1 As Location)
|
Sub GPS_LocationChanged (Location1 As Location)
|
||||||
' LogColor($"Entrando a Cliente.GPS_LocationChanged"$, Colors.red)
|
' LogColor($"Entrando a Cliente.GPS_LocationChanged"$, Colors.red)
|
||||||
If Tracker.FLP.GetLastKnownLocation.IsInitialized And Tracker.FLP.GetLastKnownLocation.Latitude <> 0 Then
|
' If Tracker.FLP.GetLastKnownLocation.IsInitialized And Tracker.FLP.GetLastKnownLocation.Latitude <> 0 Then
|
||||||
B4XPages.MainPage.lat_gps = Tracker.FLP.GetLastKnownLocation.Latitude
|
' B4XPages.MainPage.lat_gps = Tracker.FLP.GetLastKnownLocation.Latitude
|
||||||
B4XPages.MainPage.lon_gps = Tracker.FLP.GetLastKnownLocation.Longitude
|
' B4XPages.MainPage.lon_gps = Tracker.FLP.GetLastKnownLocation.Longitude
|
||||||
' Log("Coords set to: " & B4XPages.MainPage.lat_gps & " and " & B4XPages.MainPage.lon_gps)
|
'' Log("Coords set to: " & B4XPages.MainPage.lat_gps & " and " & B4XPages.MainPage.lon_gps)
|
||||||
End If
|
' End If
|
||||||
|
B4XPages.MainPage.lat_gps = Location1.Latitude
|
||||||
|
B4XPages.MainPage.lon_gps = Location1.Longitude
|
||||||
|
|
||||||
Dim l1, l2 As Location
|
Dim locTienda As Location
|
||||||
l1.Initialize2(B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps)
|
locTienda.Initialize2(m_lat, m_lon)
|
||||||
' 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)
|
|
||||||
|
|
||||||
BT_QR.Enabled = True
|
BT_QR.Enabled = True
|
||||||
LA_GPS.TextColor = Colors.Blue
|
LA_GPS.TextColor = Colors.Blue
|
||||||
LA_GPS.Text = "CON UBICACION GPS"
|
LA_GPS.Text = "CON UBICACION GPS"
|
||||||
' B_GPS.Enabled = True
|
distance = Location1.DistanceTo(locTienda) 'Distancia de la ubicacion actual a coords de la tienda.
|
||||||
'now we need the distance between our location and the target location
|
Log("Distancia a tienda: " & distance)
|
||||||
distance = l1.DistanceTo(l2) 'the result is in meter
|
If distance < 50 Then
|
||||||
gest.Visible = True
|
gest.Visible = True
|
||||||
' If distance < 100 Then
|
|
||||||
LA_GEO.TextColor = Colors.Blue
|
|
||||||
Tels.Visible = True
|
Tels.Visible = True
|
||||||
gest.Visible = True
|
If la_cuenta.Text = "0" Then
|
||||||
' Else
|
b_ventaabordo.Visible = False
|
||||||
' LA_GEO.TextColor = Colors.Red
|
Else
|
||||||
' End If
|
b_ventaabordo.Visible = True
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
LA_GEO.TextColor = Colors.Red
|
||||||
|
If Subs.traeGeocerca Then
|
||||||
|
ocultamosBotonesPorGeocerca
|
||||||
|
End If
|
||||||
|
End If
|
||||||
LA_GEO.Text= $"$1.2{distance/1000} kms"$
|
LA_GEO.Text= $"$1.2{distance/1000} kms"$
|
||||||
B4XPages.MainPage.skmt.ExecNonQuery("DELETE FROM HIST_GPS")
|
B4XPages.MainPage.skmt.ExecNonQuery("DELETE FROM HIST_GPS")
|
||||||
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO HIST_GPS (HGDATE, HGLAT, HGLON) VALUES(?,?,?) ", Array As Object (sDate & sTime, B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps))
|
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO HIST_GPS (HGDATE, HGLAT, HGLON) VALUES(?,?,?) ", Array As Object (sDate & sTime, B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps))
|
||||||
CallSubDelayed(Tracker, "CreateLocationRequest")
|
' CallSubDelayed(Tracker, "CreateLocationRequest")
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub ListView1_ItemLongClick (Position As Int, Value As Object)
|
Sub ListView1_ItemLongClick (Position As Int, Value As Object)
|
||||||
@@ -510,7 +503,6 @@ Sub gest_Click
|
|||||||
' Return False
|
' Return False
|
||||||
' End If
|
' End If
|
||||||
Private x As Cursor = B4XPages.MainPage.skmt.ExecQuery($"select tienda_id from COORDENADAS_GPS where tienda_id = '${la_cuenta.text}'"$)
|
Private x As Cursor = B4XPages.MainPage.skmt.ExecQuery($"select tienda_id from COORDENADAS_GPS where tienda_id = '${la_cuenta.text}'"$)
|
||||||
' Log("+++++++++++++ " & x.RowCount)
|
|
||||||
If la_cuenta.Text<> "0" And distance > 50 And x.RowCount = 0 Then
|
If la_cuenta.Text<> "0" And distance > 50 And x.RowCount = 0 Then
|
||||||
Private res As String = Msgbox2("¿Estas en la tienda, para guardar la nueva ubicación?", "AVISO", "Si","" ,"No", Null) 'ignore
|
Private res As String = Msgbox2("¿Estas en la tienda, para guardar la nueva ubicación?", "AVISO", "Si","" ,"No", Null) 'ignore
|
||||||
If res = DialogResponse.POSITIVE Then
|
If res = DialogResponse.POSITIVE Then
|
||||||
@@ -527,8 +519,6 @@ Sub gest_Click
|
|||||||
reqManager.ExecuteCommand(cmd , "ins_coords_nuevas")
|
reqManager.ExecuteCommand(cmd , "ins_coords_nuevas")
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
'Si hay mapa de productos es que hay venta en proceso, entonces borramos la actual para meter la nueva.
|
|
||||||
' If B4XPages.MainPage.productos.prodsMap.IsInitialized And B4XPages.MainPage.productos.prodsMap.Size > 0 Then Subs.borraPedidoClienteActual
|
|
||||||
B4XPages.ShowPage("productos")
|
B4XPages.ShowPage("productos")
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -539,7 +529,6 @@ End Sub
|
|||||||
Private Sub B4XPage_CloseRequest As ResumableSub
|
Private Sub B4XPage_CloseRequest As ResumableSub
|
||||||
' BACK key pressed
|
' BACK key pressed
|
||||||
' Return True To close, False To cancel
|
' Return True To close, False To cancel
|
||||||
' Log($"venimosDeTicketsDia=${venimosDeTicketsDia}"$)
|
|
||||||
If la_cuenta.Text <> "0" Then
|
If la_cuenta.Text <> "0" Then
|
||||||
cuest.encuestaIniciada = False
|
cuest.encuestaIniciada = False
|
||||||
cuest.ocultPanelPregunta
|
cuest.ocultPanelPregunta
|
||||||
@@ -570,10 +559,6 @@ Sub Tar_Click
|
|||||||
B4XPages.ShowPage("Nota")
|
B4XPages.ShowPage("Nota")
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
'Sub Tar_LongClick
|
|
||||||
' p_abono.Visible = True
|
|
||||||
'End Sub
|
|
||||||
|
|
||||||
Sub DATOS_Click
|
Sub DATOS_Click
|
||||||
B4XPages.ShowPage("telefonos")
|
B4XPages.ShowPage("telefonos")
|
||||||
End Sub
|
End Sub
|
||||||
@@ -592,7 +577,6 @@ Sub Guardar_Click
|
|||||||
c.Close
|
c.Close
|
||||||
c=B4XPages.MainPage.skmt.ExecQuery("select sum(pe_costo_tot) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE, COUNT(*) AS CUANTOS FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")
|
c=B4XPages.MainPage.skmt.ExecQuery("select sum(pe_costo_tot) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE, COUNT(*) AS CUANTOS FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||||
c.Position=0
|
c.Position=0
|
||||||
' Log("xxxxxxxxxxxxxxx " & c.GetString("CUANTOS"))
|
|
||||||
If c.GetString("CUANTOS") > 0 Then ' Si hay pedido, entonces ...
|
If c.GetString("CUANTOS") > 0 Then ' Si hay pedido, entonces ...
|
||||||
Log("HAY PEDIDO")
|
Log("HAY PEDIDO")
|
||||||
Private cbFactura As Int = 0
|
Private cbFactura As Int = 0
|
||||||
@@ -632,7 +616,7 @@ Sub Guardar_Click
|
|||||||
' LogColor($"actualizamos "${la_cuenta.text}, hora_final=${DateTime.now}"$,Colors.Red)
|
' LogColor($"actualizamos "${la_cuenta.text}, hora_final=${DateTime.now}"$,Colors.Red)
|
||||||
Subs.actualizaTET(la_cuenta.text)
|
Subs.actualizaTET(la_cuenta.text)
|
||||||
DateTime.TimeFormat = "HH:mm:ss"
|
DateTime.TimeFormat = "HH:mm:ss"
|
||||||
mandaPendientes 'LO COMENTAMOS PARA PRUEBAS, ACTIVAR AL FINAL!!! solo envia clientes nuenos, no comentar lo que yo descomente --- javier (por que Guerra lo comento)
|
mandaPendientes 'LO COMENTAMOS PARA PRUEBAS, ACTIVAR AL FINAL!!! - Solo envia clientes nuevos, no comentar lo que yo descomente --- javier (por que Guerra lo comento) ... ¿Que descomentaste?? --- Guerra
|
||||||
mandapiezas
|
mandapiezas
|
||||||
B4XPages.MainPage.productos.reiniciarlistaProds = True
|
B4XPages.MainPage.productos.reiniciarlistaProds = True
|
||||||
B4XPages.MainPage.productos.prodsMap.Initialize
|
B4XPages.MainPage.productos.prodsMap.Initialize
|
||||||
@@ -1744,3 +1728,10 @@ Private Sub Label16_LongClick
|
|||||||
p_telefono.Width = Root.Width
|
p_telefono.Width = Root.Width
|
||||||
p_telefono.Visible = True
|
p_telefono.Visible = True
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
' Ocultamos por geocerca (Venta, Preventa y No venta)
|
||||||
|
Sub ocultamosBotonesPorGeocerca
|
||||||
|
gest.Visible = False
|
||||||
|
b_ventaabordo.Visible = False
|
||||||
|
Tels.Visible = False
|
||||||
|
End Sub
|
||||||
@@ -1027,15 +1027,17 @@ Sub cargar_Click
|
|||||||
cmd.Parameters = Array As Object(e_ruta.text, ALMACEN)
|
cmd.Parameters = Array As Object(e_ruta.text, ALMACEN)
|
||||||
reqManager.ExecuteQuery(cmd , 0, "tipoRuta")
|
reqManager.ExecuteQuery(cmd , 0, "tipoRuta")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
' cmd.Initialize
|
' cmd.Initialize
|
||||||
' cmd.Name = "select_HIST_MARCAS_CUOTAS_INTMEX"
|
' cmd.Name = "select_HIST_MARCAS_CUOTAS_INTMEX"
|
||||||
' cmd.Parameters = Array As Object( ALMACEN, e_ruta.text)
|
' cmd.Parameters = Array As Object( ALMACEN, e_ruta.text)
|
||||||
' reqManager.ExecuteQuery(cmd , 0, "HIST_MARCAS_CUOTAS")
|
' reqManager.ExecuteQuery(cmd , 0, "HIST_MARCAS_CUOTAS")
|
||||||
|
|
||||||
If E_RUTA2.text <> "" Then
|
cmd.Name = "select_geocerca_intmex"
|
||||||
|
cmd.Parameters = Array As Object(ALMACEN, e_ruta.text)
|
||||||
|
Log($"traeGeocerca: almacen: ${ALMACEN}, ruta: ${e_ruta.text}"$)
|
||||||
|
reqManager.ExecuteQuery(cmd , 0, "traeGeocerca")
|
||||||
|
|
||||||
|
If E_RUTA2.text <> "" Then
|
||||||
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO RUTA_SUPLENCIA(RS_RUTA) VALUES(?)",Array As String(E_RUTA2.Text))
|
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO RUTA_SUPLENCIA(RS_RUTA) VALUES(?)",Array As String(E_RUTA2.Text))
|
||||||
|
|
||||||
E_RUTA2.Visible = False
|
E_RUTA2.Visible = False
|
||||||
@@ -1106,7 +1108,7 @@ Sub cargar_Click
|
|||||||
' cmd.Name = "select_CUEST_INTMEX"
|
' cmd.Name = "select_CUEST_INTMEX"
|
||||||
' cmd.Parameters = Array As Object(ALMACEN)
|
' cmd.Parameters = Array As Object(ALMACEN)
|
||||||
' reqManager.ExecuteQuery(cmd , 0, "CUESTIONARIO")
|
' reqManager.ExecuteQuery(cmd , 0, "CUESTIONARIO")
|
||||||
|
'
|
||||||
' cmd.Initialize
|
' cmd.Initialize
|
||||||
' cmd.Name = "select_HIST_CUOTAS_INTMEX"
|
' cmd.Name = "select_HIST_CUOTAS_INTMEX"
|
||||||
' cmd.Parameters = Array As Object( ALMACEN,e_ruta.text )
|
' cmd.Parameters = Array As Object( ALMACEN,e_ruta.text )
|
||||||
@@ -1114,7 +1116,7 @@ Sub cargar_Click
|
|||||||
|
|
||||||
cmd.Initialize
|
cmd.Initialize
|
||||||
cmd.Name = "select_comis_cedex_INTMEX"
|
cmd.Name = "select_comis_cedex_INTMEX"
|
||||||
cmd.Parameters = Array As Object( ALMACEN, e_ruta.text )
|
cmd.Parameters = Array As Object(ALMACEN, e_ruta.text)
|
||||||
reqManager.ExecuteQuery(cmd , 0, "COMISIONES")
|
reqManager.ExecuteQuery(cmd , 0, "COMISIONES")
|
||||||
|
|
||||||
cmd.Initialize
|
cmd.Initialize
|
||||||
@@ -2006,7 +2008,7 @@ Sub JobDone(Job As HttpJob)
|
|||||||
Dim avance As String = records(RESULT.Columns.Get("HIST_AM_AVANCE"))
|
Dim avance As String = records(RESULT.Columns.Get("HIST_AM_AVANCE"))
|
||||||
Dim objetivo As String = records(RESULT.Columns.Get("HIST_AM_OBJETIVO"))
|
Dim objetivo As String = records(RESULT.Columns.Get("HIST_AM_OBJETIVO"))
|
||||||
Dim porcentaje1 As String = records(RESULT.Columns.Get("HIST_AM_PORCENTAJE"))
|
Dim porcentaje1 As String = records(RESULT.Columns.Get("HIST_AM_PORCENTAJE"))
|
||||||
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO HIST_AVANCE(HA_MARCA, HA_AVANCE, HA_OBJETIVO, HA_PORCENTAJE) VALUES (?,?,?,?)", Array As Object (MARCA2, avance, objetivo, porcentaje1))
|
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO HIST_AVANCE(HA_MARCA, HA_AVANCE, HA_OBJETIVO, HA_PORCENTAJE) VALUES (?,?,?,?)", Array As Object (marca2, avance, objetivo, porcentaje1))
|
||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@@ -2069,6 +2071,16 @@ Sub JobDone(Job As HttpJob)
|
|||||||
Starter.skmt.ExecNonQuery2("INSERT INTO HIST_CUESTIONARIO(HC_CLIENTE) VALUES (?)", Array As Object (idCliente))
|
Starter.skmt.ExecNonQuery2("INSERT INTO HIST_CUESTIONARIO(HC_CLIENTE) VALUES (?)", Array As Object (idCliente))
|
||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If RESULT.Tag = "traeGeocerca" Then
|
||||||
|
For Each records() As Object In RESULT.Rows
|
||||||
|
Dim geocerca As String = records(RESULT.Columns.Get("CAT_RU_GEOCERCA"))
|
||||||
|
Log("-- geo: " & geocerca)
|
||||||
|
B4XPages.MainPage.skmt.ExecNonQuery2("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = ?", Array As Object ("GEOCERCA"))
|
||||||
|
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO CAT_VARIABLES(CAT_VA_DESCRIPCION, CAT_VA_VALOR) VALUES (?,?)", Array As Object ("GEOCERCA", geocerca))
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Job.Release
|
Job.Release
|
||||||
|
|||||||
Binary file not shown.
@@ -164,7 +164,7 @@ Version=12.8
|
|||||||
#Region Project Attributes
|
#Region Project Attributes
|
||||||
#ApplicationLabel: Intmex
|
#ApplicationLabel: Intmex
|
||||||
#VersionCode: 1
|
#VersionCode: 1
|
||||||
#VersionName: 5.12.10
|
#VersionName: 5.12.11
|
||||||
'SupportedOrientations possible values: unspecified, landscape or portrait.
|
'SupportedOrientations possible values: unspecified, landscape or portrait.
|
||||||
#SupportedOrientations: portrait
|
#SupportedOrientations: portrait
|
||||||
#CanInstallToExternalStorage: False
|
#CanInstallToExternalStorage: False
|
||||||
|
|||||||
@@ -85,12 +85,12 @@ ModuleClosedNodes28=
|
|||||||
ModuleClosedNodes29=
|
ModuleClosedNodes29=
|
||||||
ModuleClosedNodes3=
|
ModuleClosedNodes3=
|
||||||
ModuleClosedNodes30=
|
ModuleClosedNodes30=
|
||||||
ModuleClosedNodes4=
|
ModuleClosedNodes4=4
|
||||||
ModuleClosedNodes5=3
|
ModuleClosedNodes5=3
|
||||||
ModuleClosedNodes6=
|
ModuleClosedNodes6=
|
||||||
ModuleClosedNodes7=
|
ModuleClosedNodes7=
|
||||||
ModuleClosedNodes8=
|
ModuleClosedNodes8=
|
||||||
ModuleClosedNodes9=
|
ModuleClosedNodes9=
|
||||||
NavigationStack=DBRequestManager,HandleJob,197,0,C_Cliente,B4XPage_Appear,298,0,Diseñador Visual,principal.bal,-100,6,C_Principal,B_OK_PAS_Click,2327,0,C_Principal,checaPedido,2834,0,C_Principal,nvo_cliente_Click,2597,0,B4XMainPage,B4XPage_Created,195,3,C_Principal,cargar_Click,955,6,C_Principal,resdia_Click,2565,0,C_Principal,JobDone,1688,6,C_Principal,hacer_ped_Click,2592,6
|
NavigationStack=C_Principal,JobDone,2070,6,C_Principal,cargar_Click,1016,6,Tracker,StartFLPSmall,399,0,Tracker,CreateLocationRequestSmallD,134,0,C_Cliente,GPS_LocationChanged,475,6,C_Cliente,ListView1_ItemLongClick,478,0,C_Cliente,gest_Click,515,0,C_Cliente,B4XPage_CloseRequest,543,0,C_Cliente,Tar_Click,554,0,C_Cliente,Guardar_Click,619,6,C_Cliente,mandaPendientes,1291,0
|
||||||
SelectedBuild=0
|
SelectedBuild=0
|
||||||
VisibleModules=28,2,13,20,14,29,15,4,11,21
|
VisibleModules=28,2,13,20,14,29,15,4,11,21,30
|
||||||
|
|||||||
11
B4A/Subs.bas
11
B4A/Subs.bas
@@ -1546,3 +1546,14 @@ Sub traeTicketConsecutivo(idCliente As String) As Int
|
|||||||
Loop
|
Loop
|
||||||
Return sigTicket + 1
|
Return sigTicket + 1
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
' Regresa la geocerca desde CAT_VARIABLES, default = TRUE
|
||||||
|
Sub traeGeocerca As Boolean
|
||||||
|
Private usarGeo As Boolean = True
|
||||||
|
Private c As Cursor = Starter.skmt.ExecQuery("select * from cat_variables where cat_va_descripcion ='GEOCERCA'")
|
||||||
|
If c.RowCount> 0 Then
|
||||||
|
c.Position = 0
|
||||||
|
If c.GetInt("CAT_VA_VALOR") = 0 Then usarGeo = False
|
||||||
|
End If
|
||||||
|
Return usarGeo
|
||||||
|
End Sub
|
||||||
305
B4A/Tracker.bas
305
B4A/Tracker.bas
@@ -4,300 +4,6 @@ ModulesStructureVersion=1
|
|||||||
Type=Service
|
Type=Service
|
||||||
Version=10.2
|
Version=10.2
|
||||||
@EndOfDesignText@
|
@EndOfDesignText@
|
||||||
'#Region Service Attributes
|
|
||||||
' #StartAtBoot: True
|
|
||||||
'#End Region
|
|
||||||
''******************************************************************************
|
|
||||||
''No olvidar agregar esta linea al editor de manifiesto:
|
|
||||||
'' SetServiceAttribute(Tracker, android:foregroundServiceType, "location")
|
|
||||||
''
|
|
||||||
''En Starter agregar estas lineas en Process_Globals
|
|
||||||
'' Public rp As RuntimePermissions
|
|
||||||
'' Public FLP As FusedLocationProvider
|
|
||||||
'' Private flpStarted As Boolean
|
|
||||||
''
|
|
||||||
''En Main agregar estas lineas a Activity_Resume
|
|
||||||
'' Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION)
|
|
||||||
'' Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
|
|
||||||
'' If Result Then
|
|
||||||
'' StartService(Tracker)
|
|
||||||
'' Log("Start Tracker")
|
|
||||||
'' Else
|
|
||||||
'' ToastMessageShow("No permission", True)
|
|
||||||
'' End If
|
|
||||||
''
|
|
||||||
''Se necesitan las librerias FusedLocationProvider, GPS, Phone y RunTimePermissions
|
|
||||||
''
|
|
||||||
''Y en Main agregar estas dos lineas:
|
|
||||||
''#AdditionalJar: com.android.support:support-v4
|
|
||||||
''#AdditionalJar: com.google.android.gms:play-services-location
|
|
||||||
'
|
|
||||||
'
|
|
||||||
'Sub Process_Globals
|
|
||||||
' Private nid As Int = 51042
|
|
||||||
' Private Tracking As Boolean
|
|
||||||
' Private lock As PhoneWakeState
|
|
||||||
' 'Para FusedLocationProvider (2 lineas)
|
|
||||||
' Public FLP As FusedLocationProvider
|
|
||||||
' Dim actualLR As LocationRequest
|
|
||||||
' Private flpStarted As Boolean
|
|
||||||
'' Dim locRequest As String
|
|
||||||
' Dim UUGCoords As Location 'Ultima Ubicacion Guardada
|
|
||||||
'End Sub
|
|
||||||
'
|
|
||||||
'Sub Service_Create
|
|
||||||
' Service.AutomaticForegroundMode = Service.AUTOMATIC_FOREGROUND_NEVER 'we are handling it ourselves
|
|
||||||
' 'Para FusedLocationProvider (2 lineas)
|
|
||||||
' FLP.Initialize("flp")
|
|
||||||
' FLP.Connect
|
|
||||||
' lock.PartialLock
|
|
||||||
' StartFLP
|
|
||||||
'End Sub
|
|
||||||
'
|
|
||||||
'Sub flp_ConnectionSuccess
|
|
||||||
'' Log("Connected to location provider")
|
|
||||||
' 'FLP.GetLastKnownLocation
|
|
||||||
'End Sub
|
|
||||||
'
|
|
||||||
'Sub flp_ConnectionFailed(ConnectionResult1 As Int)
|
|
||||||
' Log("Failed to connect to location provider")
|
|
||||||
'End Sub
|
|
||||||
'
|
|
||||||
'Sub Service_Start (StartingIntent As Intent)
|
|
||||||
' 'Para FusedLocationProvider (1 linea)
|
|
||||||
' Service.StopAutomaticForeground
|
|
||||||
' Service.StartForeground(nid, CreateNotification("..."))
|
|
||||||
' Track
|
|
||||||
' StartServiceAt(Me, DateTime.Now + 5 * DateTime.TicksPerMinute, True)
|
|
||||||
' FLP.GetLastKnownLocation.Initialize
|
|
||||||
'End Sub
|
|
||||||
'
|
|
||||||
'Public Sub Track
|
|
||||||
'' Log("Inicia Track - Tracking : "&Tracking)
|
|
||||||
' If Not(FLP.IsInitialized) Then FLP.Initialize("flp")
|
|
||||||
' If Not(FLP.IsConnected) Then FLP.Connect
|
|
||||||
' If Tracking And actualLR.IsInitialized Then
|
|
||||||
'' Log(actualLR.GetSmallestDisplacement)
|
|
||||||
' Return 'Si ya estamos "rastreando" no hacemos nada (return)
|
|
||||||
' End If
|
|
||||||
' If Starter.rp.Check(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION) = False Then
|
|
||||||
' Log("No permission")
|
|
||||||
' Return
|
|
||||||
' End If
|
|
||||||
' StartFLP 'Iniciamos FusedLocationProvider
|
|
||||||
' Tracking = True
|
|
||||||
'End Sub
|
|
||||||
'
|
|
||||||
'Public Sub StartFLP
|
|
||||||
'' Log("StartFLP - flpStarted="&flpStarted)
|
|
||||||
' Do While FLP.IsConnected = False
|
|
||||||
' Sleep(500)
|
|
||||||
'' Log("sleeping")
|
|
||||||
' Loop
|
|
||||||
'' If flpStarted = False Then
|
|
||||||
'' Log("RequestLocationUpdates")
|
|
||||||
' FLP.RequestLocationUpdates(CreateLocationRequest) 'Buscamos ubicacion
|
|
||||||
'' Log("Buscamos ubicacion")
|
|
||||||
'' Log(actualLR.GetSmallestDisplacement)
|
|
||||||
' flpStarted = True
|
|
||||||
'' End If
|
|
||||||
'End Sub
|
|
||||||
'
|
|
||||||
'Public Sub StartFLPSmall
|
|
||||||
'' Log("StartFLPSmall - flpStarted="&flpStarted)
|
|
||||||
' Do While FLP.IsConnected = False
|
|
||||||
' Sleep(500)
|
|
||||||
' Log("sleeping")
|
|
||||||
' Loop
|
|
||||||
' dameUltimaUbicacionConocida 'Regresamos ultima ubicacion conocida
|
|
||||||
' FLP.RequestLocationUpdates(CreateLocationRequestSmallD) 'Buscamos ubicacion 2 peticiones
|
|
||||||
'' Log("Buscamos ubicacion Small displacement")
|
|
||||||
'' Log("GPSSmallestDisplacement = " & actualLR.GetSmallestDisplacement)
|
|
||||||
'End Sub
|
|
||||||
'
|
|
||||||
'Private Sub CreateLocationRequest As LocationRequest
|
|
||||||
'' Log("CreateLocationRequest")
|
|
||||||
' Dim lr As LocationRequest
|
|
||||||
' lr.Initialize
|
|
||||||
' lr.SetInterval(10000) 'Intervalo deseado para actualizaciones de ubicacion
|
|
||||||
' lr.SetFastestInterval(lr.GetInterval / 2) 'Intervalo minimo para actualizaciones de ubicacion
|
|
||||||
' lr.SetSmallestDisplacement(50) 'Solo registra cambio de ubicacion si es mayor a XX mts
|
|
||||||
' lr.SetPriority(lr.Priority.PRIORITY_HIGH_ACCURACY)
|
|
||||||
' actualLR=lr
|
|
||||||
' Return lr
|
|
||||||
'End Sub
|
|
||||||
'
|
|
||||||
'Private Sub CreateLocationRequestSmallD As LocationRequest
|
|
||||||
'' Log("Iniciamos CreateLocationRequestSmallD")
|
|
||||||
' Dim lr As LocationRequest
|
|
||||||
' lr.Initialize
|
|
||||||
' lr.SetInterval(2000) 'Intervalo deseado para actualizaciones de ubicacion
|
|
||||||
' lr.SetFastestInterval(lr.GetInterval / 2) 'Intervalo minimo para actualizaciones de ubicacion
|
|
||||||
' lr.setNumUpdates(2) 'Solicitamos solo 2 actualizaciones con estos parametros
|
|
||||||
' lr.SetSmallestDisplacement(1) 'Solo registra cambio de ubicacion si es mayor a XX mts
|
|
||||||
' lr.SetPriority(lr.Priority.PRIORITY_HIGH_ACCURACY)
|
|
||||||
' actualLR=lr
|
|
||||||
' Return lr
|
|
||||||
'End Sub
|
|
||||||
'
|
|
||||||
'Sub dameUltimaUbicacionConocida
|
|
||||||
' If FLP.GetLastKnownLocation.IsInitialized Then 'Mandamos ultima ubicacion guardada
|
|
||||||
'' If Main.logger Then Log("Mandamos UUC : "&formatoFecha(FLP.GetLastKnownLocation.Time))
|
|
||||||
' If Starter.Logger Then LogColor($"Mandamos UUC "${Subs.fechaKMT(FLP.GetLastKnownLocation.Time)}|Acc:$0.2{FLP.GetLastKnownLocation.Accuracy}|$0.8{FLP.GetLastKnownLocation.Latitude}|$0.8{FLP.GetLastKnownLocation.Longitude}|Spd:$0.2{FLP.GetLastKnownLocation.Speed}|"$, Colors.RGB(255,112,35))
|
|
||||||
' Dim coords As String = FLP.GetLastKnownLocation.Latitude&","&FLP.GetLastKnownLocation.Longitude&","&formatoFecha(FLP.GetLastKnownLocation.Time)
|
|
||||||
'' CallSubDelayed2(FirebaseMessaging,"mandamosLoc",coords)
|
|
||||||
'' Subs.mandamosLoc(coords)
|
|
||||||
' End If
|
|
||||||
'End Sub
|
|
||||||
'
|
|
||||||
'Public Sub StopFLP
|
|
||||||
' 'Log("StopFLP")
|
|
||||||
' If flpStarted Then
|
|
||||||
' FLP.RemoveLocationUpdates 'Eliminamos todas las solicitudes de ubicacion
|
|
||||||
' flpStarted = False
|
|
||||||
' End If
|
|
||||||
'End Sub
|
|
||||||
'
|
|
||||||
'Sub flp_LocationChanged (Location1 As Location)
|
|
||||||
'' ToastMessageShow("Loc changed", False)
|
|
||||||
'' Log($"Loc changed:${Location1.Longitude},${Location1.Latitude}"$)
|
|
||||||
' B4XPages.MainPage.lat_gps = Location1.Latitude
|
|
||||||
' B4XPages.MainPage.lon_gps = Location1.Longitude
|
|
||||||
' UUGCoords = Location1
|
|
||||||
'' Log("SmallestDisplacement="&actualLR.GetSmallestDisplacement)
|
|
||||||
'' If DateTime.Now > LastUpdateTime + 10 * DateTime.TicksPerSecond Then
|
|
||||||
'' Dim n As Notification = CreateNotification($"$2.5{Location1.Latitude} / $2.5{Location1.Longitude}"$)
|
|
||||||
'' n.Notify(nid)
|
|
||||||
'' LastUpdateTime = DateTime.Now
|
|
||||||
'' End If
|
|
||||||
' '/////// para la ultima localización FL
|
|
||||||
' Dim sDate,sTime As String
|
|
||||||
' DateTime.DateFormat = "MM/dd/yyyy"
|
|
||||||
' sDate=DateTime.Date(DateTime.Now)
|
|
||||||
' sTime=DateTime.Time(DateTime.Now)
|
|
||||||
' If Not(B4XPages.MainPage.skmt.IsInitialized) Then B4XPages.MainPage.skmt.Initialize(Starter.ruta,"kmt.db", True)
|
|
||||||
' Try
|
|
||||||
' B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO HIST_GPS (HGDATE, HGLAT, HGLON) VALUES(?,?,?) ", Array As Object (sDate & sTime, B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps))
|
|
||||||
' B4XPages.MainPage.skmt.ExecNonQuery("DELETE FROM HIST_GPS")
|
|
||||||
' Catch
|
|
||||||
' LogColor(LastException, Colors.Red)
|
|
||||||
' End Try
|
|
||||||
' '///////
|
|
||||||
' Dim coords As String = Location1.Latitude&","&Location1.Longitude&","&formatoFecha(Location1.Time)
|
|
||||||
'' Log("Loc changed : "&Location1.Latitude&","&Location1.Longitude&"|"&B4XPages.MainPage.usuario&"|")
|
|
||||||
'' Log("Mandamos Ubicacion")
|
|
||||||
'' Log(FirebaseMessaging.locRequest)
|
|
||||||
' ' Solo mandamos la ubicacion si la precision es menor a XX mts
|
|
||||||
' If Location1.Accuracy < 100 Then
|
|
||||||
'' CallSubDelayed2(FirebaseMessaging,"mandamosLoc",coords)
|
|
||||||
' End If
|
|
||||||
'
|
|
||||||
' CallSub2(Starter, "GPS_LocationChanged", Location1)
|
|
||||||
'' CallSub2(gestion, "GPS_LocationChanged", Location1)
|
|
||||||
'' CallSub2(B4XPages.GetPage("Cliente"), "GPS_LocationChanged", Location1)
|
|
||||||
'' CallSub2(nuevocliente, "GPS_LocationChanged", Location1)
|
|
||||||
'End Sub
|
|
||||||
'
|
|
||||||
'Sub CreateNotification (Body As String) As Notification
|
|
||||||
' Dim notification As Notification
|
|
||||||
' notification.Initialize2(notification.IMPORTANCE_LOW)
|
|
||||||
' notification.Icon = "icon"
|
|
||||||
' notification.SetInfo("INTMEX", Body, Main)
|
|
||||||
' Return notification
|
|
||||||
'End Sub
|
|
||||||
'
|
|
||||||
'Sub Service_Destroy
|
|
||||||
' If Tracking Then
|
|
||||||
' StopFLP
|
|
||||||
' End If
|
|
||||||
' Tracking = False
|
|
||||||
' lock.ReleasePartialLock
|
|
||||||
'End Sub
|
|
||||||
'
|
|
||||||
'Sub formatoFecha(fecha As String) As String 'Convierte una fecha al formato yyMMddHHmmss
|
|
||||||
'' Log(fecha)
|
|
||||||
' Dim OrigFormat As String = DateTime.DateFormat 'save orig date format
|
|
||||||
' DateTime.DateFormat="yyMMddHHmmss"
|
|
||||||
' Dim lastUpdate As String=DateTime.Date(fecha)
|
|
||||||
' DateTime.DateFormat=OrigFormat 'return to orig date format
|
|
||||||
'' Log(lastUpdate)
|
|
||||||
' Return lastUpdate
|
|
||||||
'End Sub
|
|
||||||
'
|
|
||||||
''Revisamos que el FLP (FusedLocationProvider) este inicializado y activo
|
|
||||||
'Sub revisaFLP 'ignore
|
|
||||||
' LogColor("**** **** Revisamos FLP **** ****", Colors.RGB(78,0,227))
|
|
||||||
' Private todoBienFLP As Boolean = True
|
|
||||||
' Try
|
|
||||||
' If Not(FLP.IsInitialized) Then
|
|
||||||
' Subs.log2DB("revisaFLP: No esta inicializado ... 'Reinicializando FLP'")
|
|
||||||
' FLP.Initialize("flp")
|
|
||||||
' todoBienFLP = False
|
|
||||||
' End If
|
|
||||||
' Catch
|
|
||||||
' LogColor("If Not(Tracker.FLP.IsInitialized) --> "&LastException, Colors.Red)
|
|
||||||
' End Try
|
|
||||||
' Try
|
|
||||||
' If FLP.IsInitialized Then
|
|
||||||
' Try
|
|
||||||
' If Not(FLP.IsConnected) Then
|
|
||||||
' Subs.log2DB("revisaFLP: No esta conectado ... 'Reconectando FLP'")
|
|
||||||
' ' Tracker.FLP.Connect
|
|
||||||
' StartFLP
|
|
||||||
' todoBienFLP = False
|
|
||||||
' End If
|
|
||||||
' Catch
|
|
||||||
' LogColor("If Not(Tracker.FLP.IsConnected) --> "&LastException, Colors.Red)
|
|
||||||
' End Try
|
|
||||||
' Try
|
|
||||||
' If FLP.IsConnected And _
|
|
||||||
' FLP.GetLastKnownLocation.IsInitialized And _
|
|
||||||
' FLP.GetLastKnownLocation.DistanceTo(UUGCoords) > 500 Then
|
|
||||||
' Subs.log2DB("revisaFLP: 'No se esta actualizando, lo reiniciamos ...'")
|
|
||||||
' StartService(Me)
|
|
||||||
' todoBienFLP = False
|
|
||||||
' End If
|
|
||||||
' Catch
|
|
||||||
' LogColor("If FLP.IsConnectctd and FLP.getLKL.IsInitialized --> "&LastException, Colors.Red)
|
|
||||||
' End Try
|
|
||||||
' End If
|
|
||||||
' If todoBienFLP Then LogColor(" +++ +++ Sin errores en FLP", Colors.Green)
|
|
||||||
' Catch
|
|
||||||
' LogColor("If Tracker.FLP.IsInitialized --> "&LastException, Colors.Red)
|
|
||||||
' End Try
|
|
||||||
' ' revisar hora de lastKnownlocation y si es mayor de 10 minutos llamar StartFLP
|
|
||||||
'End Sub
|
|
||||||
'
|
|
||||||
''Compara la UUG (Ultima Ubicacion Guardada) con FLP.LastKnowLocation y si
|
|
||||||
''cumple con los requisitos de distancia y precision la guardamos en la BD.
|
|
||||||
'Sub revisaUUG 'ignore
|
|
||||||
' Try
|
|
||||||
'' revisaFLP
|
|
||||||
' If FLP.IsInitialized And FLP.IsConnected Then
|
|
||||||
' Try
|
|
||||||
' If FLP.GetLastKnownLocation.IsInitialized Then
|
|
||||||
'' Dim x As Location = FLP.GetLastKnownLocation
|
|
||||||
' Dim daa As Int = UUGCoords.DistanceTo(FLP.GetLastKnownLocation) 'Distancia de la UUG a la actual de Tracker.FLP.GetLastKnownLocation
|
|
||||||
' If Starter.Logger Then LogColor($"**** UUC "${Subs.fechaKMT(FLP.GetLastKnownLocation.Time)}|$0.2{FLP.GetLastKnownLocation.Accuracy}|$0.8{FLP.GetLastKnownLocation.Latitude}|$0.8{FLP.GetLastKnownLocation.Longitude}|$0.2{FLP.GetLastKnownLocation.Speed}|"$, Colors.RGB(255,112,35))
|
|
||||||
' If daa > 40 And FLP.GetLastKnownLocation.Accuracy < 35 Then 'Si la distancia de la ubicacion anterior es mayor de XX y la precision es menor de XX, la guardamos ...
|
|
||||||
' B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO RUTA_GPS(fecha, lat, lon) VALUES (?,?,?)", Array As Object (Subs.fechaKMT(FLP.GetLastKnownLocation.Time),FLP.GetLastKnownLocation.Latitude,FLP.GetLastKnownLocation.Longitude))
|
|
||||||
' If Starter.Logger Then Log("++++ Distancia a anterior="&daa&"|"&"Precision="&FLP.GetLastKnownLocation.Accuracy)
|
|
||||||
' End If
|
|
||||||
' UUGCoords = FLP.GetLastKnownLocation
|
|
||||||
' End If
|
|
||||||
' Catch
|
|
||||||
' LogColor("FLP.GetLastKnownLocation.IsInitialized --> "&LastException, Colors.Red)
|
|
||||||
' End Try
|
|
||||||
' Else
|
|
||||||
' Log("StartFLP")
|
|
||||||
' StartFLP
|
|
||||||
' End If
|
|
||||||
' Catch
|
|
||||||
' LogColor("If FLP.IsInitialized --> "&LastException, Colors.Red)
|
|
||||||
' End Try
|
|
||||||
'End Sub
|
|
||||||
|
|
||||||
|
|
||||||
#Region Service Attributes
|
#Region Service Attributes
|
||||||
#StartAtBoot: True
|
#StartAtBoot: True
|
||||||
#End Region
|
#End Region
|
||||||
@@ -403,7 +109,6 @@ Public Sub StartFLPSmall
|
|||||||
Sleep(500)
|
Sleep(500)
|
||||||
Log("sleeping")
|
Log("sleeping")
|
||||||
Loop
|
Loop
|
||||||
dameUltimaUbicacionConocida 'Regresamos ultima ubicacion conocida
|
|
||||||
FLP.RequestLocationUpdates(CreateLocationRequestSmallD) 'Buscamos ubicacion 2 peticiones
|
FLP.RequestLocationUpdates(CreateLocationRequestSmallD) 'Buscamos ubicacion 2 peticiones
|
||||||
' Log("Buscamos ubicacion Small displacement")
|
' Log("Buscamos ubicacion Small displacement")
|
||||||
' Log("GPSSmallestDisplacement = " & actualLR.GetSmallestDisplacement)
|
' Log("GPSSmallestDisplacement = " & actualLR.GetSmallestDisplacement)
|
||||||
@@ -434,16 +139,6 @@ Private Sub CreateLocationRequestSmallD As LocationRequest
|
|||||||
Return lr
|
Return lr
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub dameUltimaUbicacionConocida
|
|
||||||
If FLP.GetLastKnownLocation.IsInitialized Then 'Mandamos ultima ubicacion guardada
|
|
||||||
' If Main.logger Then Log("Mandamos UUC : "&formatoFecha(FLP.GetLastKnownLocation.Time))
|
|
||||||
If Starter.Logger Then LogColor($"Mandamos UUC "${Subs.fechaKMT(FLP.GetLastKnownLocation.Time)}|Acc:$0.2{FLP.GetLastKnownLocation.Accuracy}|$0.8{FLP.GetLastKnownLocation.Latitude}|$0.8{FLP.GetLastKnownLocation.Longitude}|Spd:$0.2{FLP.GetLastKnownLocation.Speed}|"$, Colors.RGB(255,112,35))
|
|
||||||
Dim coords As String = FLP.GetLastKnownLocation.Latitude&","&FLP.GetLastKnownLocation.Longitude&","&formatoFecha(FLP.GetLastKnownLocation.Time)
|
|
||||||
' CallSubDelayed2(FirebaseMessaging,"mandamosLoc",coords)
|
|
||||||
' Subs.mandamosLoc(coords)
|
|
||||||
End If
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Public Sub StopFLP
|
Public Sub StopFLP
|
||||||
'Log("StopFLP")
|
'Log("StopFLP")
|
||||||
If flpStarted Then
|
If flpStarted Then
|
||||||
|
|||||||
110
B4A/_git_tag.ps1
Normal file
110
B4A/_git_tag.ps1
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
# --- SCRIPT DE AUTODESCUBRIMIENTO CON GUI MEJORADA ---
|
||||||
|
|
||||||
|
# Cargar librería visual
|
||||||
|
Add-Type -AssemblyName System.Windows.Forms
|
||||||
|
Add-Type -AssemblyName System.Drawing
|
||||||
|
|
||||||
|
# 1. AUTODESCUBRIMIENTO
|
||||||
|
$projectPath = $PSScriptRoot
|
||||||
|
Write-Host "Ruta: $projectPath"
|
||||||
|
|
||||||
|
$b4aFileItem = Get-ChildItem -Path $projectPath -Filter "*.b4a" | Select-Object -First 1
|
||||||
|
|
||||||
|
if (-Not $b4aFileItem) {
|
||||||
|
[System.Windows.Forms.MessageBox]::Show("No hay archivo .b4a en esta carpeta.", "Error", "OK", "Error")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
$b4aFile = $b4aFileItem.FullName
|
||||||
|
$projectName = $b4aFileItem.BaseName
|
||||||
|
Write-Host "Proyecto: $projectName"
|
||||||
|
|
||||||
|
# 2. LIMPIEZA
|
||||||
|
# $objectsPath = Join-Path $projectPath "Objects"
|
||||||
|
# if (Test-Path $objectsPath) {
|
||||||
|
# Write-Host "Limpiando Objects..."
|
||||||
|
# Remove-Item -Path "$objectsPath\*" -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
|
# }
|
||||||
|
|
||||||
|
# 3. LEER VERSIÓN
|
||||||
|
$versionLine = Get-Content $b4aFile | Select-String "#VersionName:"
|
||||||
|
if (-Not $versionLine) { Write-Error "Falta #VersionName"; return }
|
||||||
|
$version = ($versionLine -split ":")[1].Trim()
|
||||||
|
$tagName = "v$version"
|
||||||
|
|
||||||
|
Set-Location $projectPath
|
||||||
|
|
||||||
|
# 4. COMMIT
|
||||||
|
$oldCommit = git rev-parse HEAD
|
||||||
|
|
||||||
|
Write-Host "----------------------------------------"
|
||||||
|
Write-Host "Versión: $version"
|
||||||
|
Write-Host "Abriendo TortoiseGit..."
|
||||||
|
|
||||||
|
# Argumentos limpios
|
||||||
|
$pathArg = '/path:"{0}"' -f $projectPath
|
||||||
|
$msgArg = '/logmsg:"VERSION {0}"' -f $version
|
||||||
|
$cmdArg = "/command:commit"
|
||||||
|
|
||||||
|
$process = Start-Process "TortoiseGitProc.exe" -ArgumentList $cmdArg, $pathArg, $msgArg -Wait -PassThru
|
||||||
|
|
||||||
|
$newCommit = git rev-parse HEAD
|
||||||
|
|
||||||
|
# 5. VALIDACIÓN
|
||||||
|
if ($oldCommit -eq $newCommit) {
|
||||||
|
Write-Warning "Commit cancelado."
|
||||||
|
git tag -d $tagName 2>$null # Borra tag local previo si existe para actualizarlo al nuevo commit
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host ">> Commit detectado."
|
||||||
|
|
||||||
|
# 6. GESTIÓN DE TAGS (VISUAL TOPMOST)
|
||||||
|
Write-Host "git ls-remote --tags origin $tagName"
|
||||||
|
$remoteTagInfo = git ls-remote --tags origin $tagName
|
||||||
|
|
||||||
|
if ($remoteTagInfo) {
|
||||||
|
# --- TRUCO PARA QUE LA VENTANA SALGA AL FRENTE ---
|
||||||
|
# Creamos un formulario invisible que esté "Siempre Visible" (TopMost)
|
||||||
|
Write-Host "Recibimos remoteTagInfo"
|
||||||
|
$topForm = New-Object System.Windows.Forms.Form
|
||||||
|
$topForm.TopMost = $true
|
||||||
|
$topForm.Opacity = 0 # Invisible
|
||||||
|
$topForm.ShowInTaskbar = $false
|
||||||
|
$topForm.StartPosition = "CenterScreen"
|
||||||
|
$topForm.Show()
|
||||||
|
$topForm.Activate()
|
||||||
|
|
||||||
|
[System.Console]::Beep(1000, 200)
|
||||||
|
[System.Console]::Beep(1000, 200)
|
||||||
|
|
||||||
|
$msgBody = "El tag '$tagName' YA EXISTE en GitHub.`n`nDeseas SOBRESCRIBIRLO?`n`nSi = Borrar anterior y actualizar (Force Push).`nNo = Subir solo codigo (mantener tag viejo)."
|
||||||
|
$msgTitle = "⚠️ Conflicto de Versiones - $projectName"
|
||||||
|
|
||||||
|
# El mensaje ahora es "hijo" del formulario invisible, heredando su propiedad TopMost
|
||||||
|
Write-Host "Preguntamos que hacer con el tag"
|
||||||
|
$respuesta = [System.Windows.Forms.MessageBox]::Show($topForm, $msgBody, $msgTitle, "YesNo", "Warning")
|
||||||
|
|
||||||
|
$topForm.Dispose() # Limpiamos el formulario invisible
|
||||||
|
|
||||||
|
if ($respuesta -eq "Yes") {
|
||||||
|
Write-Host "Sobrescribiendo..."
|
||||||
|
git tag -d $tagName 2>$null
|
||||||
|
git tag -a $tagName -m "Release version $version (Updated)"
|
||||||
|
|
||||||
|
git push origin
|
||||||
|
git push origin $tagName --force
|
||||||
|
Write-Host ">> Tag actualizado (Force Push)."
|
||||||
|
} else {
|
||||||
|
Write-Host "Conservando tag anterior..."
|
||||||
|
git push origin
|
||||||
|
Write-Host ">> Código subido."
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
# Tag Nuevo
|
||||||
|
git tag -a $tagName -m "Release version $version"
|
||||||
|
git push origin --follow-tags
|
||||||
|
Write-Host ">> Versión publicada."
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "----------------------------------------"
|
||||||
28
B4A/_juntaBas.ps1
Normal file
28
B4A/_juntaBas.ps1
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# SCRIPT: _juntaBas.ps1 - Versión Saneada y Optimizada para LLM
|
||||||
|
$OutputFile="_CODIGO_COMPLETO_PARA_LLM.txt"
|
||||||
|
|
||||||
|
# Eliminar el archivo anterior si existe (IMPORTANTE)
|
||||||
|
Remove-Item -Path $OutputFile -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
Write-Host "Iniciando fusion para LLM..."
|
||||||
|
|
||||||
|
# Itera sobre los archivos .bas, .b4a, .b4j
|
||||||
|
Get-ChildItem -Path ".\*" -Include @("*.bas", "*.b4a", "*.b4j") | ForEach-Object {
|
||||||
|
$currentFile = $_.Name
|
||||||
|
Write-Host "Procesando: $currentFile"
|
||||||
|
|
||||||
|
# --- ENCABEZADO ESTRUCTURADO Y COMENTADO EN B4X (Agregado al archivo) ---
|
||||||
|
Add-Content -Path $OutputFile -Value "`n'======================================================================================"
|
||||||
|
Add-Content -Path $OutputFile -Value $"// ARCHIVO_INICIO: ${currentFile}"
|
||||||
|
Add-Content -Path $OutputFile -Value "'======================================================================================`n"
|
||||||
|
|
||||||
|
# Vuelca el contenido del archivo
|
||||||
|
Get-Content -Encoding UTF8 -Path $_.FullName -Raw | Add-Content -Path $OutputFile
|
||||||
|
|
||||||
|
# --- DELIMITADOR DE FIN DE ARCHIVO (Agregado al archivo) ---
|
||||||
|
Add-Content -Path $OutputFile -Value "`n'======================================================================================"
|
||||||
|
Add-Content -Path $OutputFile -Value $"// ARCHIVO_FIN: ${currentFile}"
|
||||||
|
Add-Content -Path $OutputFile -Value "'======================================================================================`n"
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "`nProceso terminado. Se ha creado el archivo: $OutputFile"
|
||||||
Reference in New Issue
Block a user