mirror of
https://github.com/KeymonSoft/Guna_Preventa.git
synced 2026-04-17 12:56:17 +00:00
- VERSION 5.12.14
- Correcciones del codigo del GPS en Cliente.
This commit is contained in:
@@ -541,14 +541,12 @@ End Sub
|
||||
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
||||
|
||||
Sub B4XPage_Appear
|
||||
Starter.enCliente = true
|
||||
Starter.enCliente = True
|
||||
Tels.Visible = False
|
||||
gest.Visible = False
|
||||
' Tels.Enabled = True
|
||||
' gest.Enabled = True
|
||||
|
||||
MejorarPrecisionGPS
|
||||
'
|
||||
' MejorarPrecisionGPS
|
||||
' ' Al aparecer la página del cliente
|
||||
' InicializarLocalizacionMejorada
|
||||
|
||||
@@ -609,25 +607,20 @@ Sub B4XPage_Appear
|
||||
' b_Inicio_Fin_venta.Visible = False
|
||||
' End If
|
||||
|
||||
|
||||
|
||||
|
||||
If Subs.hayPedido Then 'Si hay pedido, deshabilitamos el boton de "No Venta"
|
||||
Log(">>>>> HAY PEDIDO")
|
||||
Tels.Enabled = False
|
||||
Else
|
||||
Tels.Enabled = True
|
||||
End If
|
||||
|
||||
|
||||
If Not(Starter.gps.GPSEnabled) Then
|
||||
ToastMessageShow("Es necesario tener el GPS encendido", True)
|
||||
StartActivity(Starter.gps.LocationSettingsIntent)
|
||||
End If
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
reqManager.Initialize(Me, Starter.server)
|
||||
|
||||
|
||||
|
||||
|
||||
Dim fotomostrar1 As Cursor = Starter.skmt.ExecQuery("SELECT foto FROM kmt_info3 where CAT_CL_CODIGO IN (SELECT CUENTA FROM CUENTAA) AND foto IS NULL")
|
||||
If fotomostrar1.RowCount > 0 Then
|
||||
ImageView4.Bitmap = LoadBitmap(File.DirAssets,"images.png")
|
||||
@@ -674,9 +667,7 @@ Sub B4XPage_Appear
|
||||
ALMACEN = C.GetString("ID_ALMACEN")
|
||||
End If
|
||||
c.Close
|
||||
|
||||
|
||||
|
||||
|
||||
If ALMACEN = "1" Then
|
||||
Tels.Visible = False
|
||||
gest.Visible = True
|
||||
@@ -776,7 +767,7 @@ Sub B4XPage_Appear
|
||||
If Starter.MAC_IMPRESORA = "" Then Starter.MAC_IMPRESORA = "0"
|
||||
' Log("|" & Starter.MAC_IMPRESORA & "|")
|
||||
Printer1.Initialize(Me, "Printer1")
|
||||
|
||||
|
||||
If Printer1.IsConnected = False Then
|
||||
' Printer1.Connect
|
||||
' Log("1")
|
||||
@@ -827,7 +818,7 @@ Sub B4XPage_Appear
|
||||
Else
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If ALMACEN = 87 Or ALMACEN = 6 Then
|
||||
If Subs.traemontoprod And Subs.traeCliente <> "0" Then
|
||||
Msgbox2Async("El cliente tiene derecho a un descuento de 150 pesos por la compra de mas de $500 en productos participantes" , "Descuento disponible", "Aceptar", "", "", LoadBitmap(File.DirAssets,"alert2.png"), False)
|
||||
@@ -967,7 +958,6 @@ Sub B4XPage_Appear
|
||||
c.Close
|
||||
c2.Close
|
||||
c3.Close
|
||||
|
||||
End If
|
||||
If Not(Subs.traemontoprod) Then
|
||||
If Not(Subs.traemontoprod2) Then
|
||||
@@ -982,15 +972,11 @@ Sub B4XPage_Appear
|
||||
Next
|
||||
End If
|
||||
Else
|
||||
|
||||
End If
|
||||
Else
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
'AQUI CAMBIAR
|
||||
Private s3 As Cursor=B4XPages.MainPage.skmt.ExecQuery2("select * FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) and PE_RECALCULO <> ? OR PE_RECALCULO <> ? OR PE_RECALCULO IS NOT NULL",Array As String("","null"))
|
||||
@@ -1018,7 +1004,7 @@ Sub B4XPage_Appear
|
||||
telefono = c.GetString("CAT_CL_TELEFONO")
|
||||
Label19.Text = c.GetString("CAT_CL_TELEFONO")
|
||||
BCREDITO = c.GetString("CAT_CL_BCREDITO") '########################## CODIGO PARA CREDITOS ####################
|
||||
|
||||
|
||||
If s.GetString("TOTAL_CLIE") = Null Then
|
||||
l_total.Text = 0
|
||||
Else
|
||||
@@ -1066,7 +1052,7 @@ Sub B4XPage_Appear
|
||||
telefono = c.GetString("CAT_CL_TELEFONO")
|
||||
Label19.Text = c.GetString("CAT_CL_TELEFONO")
|
||||
BCREDITO = c.GetString("CAT_CL_BCREDITO") '########################## CODIGO PARA CREDITOS ####################
|
||||
|
||||
|
||||
' Log(s.GetString("TOTAL_CLIE"))
|
||||
If s.GetString("TOTAL_CLIE") = Null Then
|
||||
l_total.Text = 0
|
||||
@@ -1151,7 +1137,7 @@ Sub B4XPage_Appear
|
||||
Else
|
||||
btnPlanLealtad.Visible = False
|
||||
End If
|
||||
|
||||
|
||||
' fotomostrar.Position = 0
|
||||
' Private imagencompara() As Byte
|
||||
' imagencompara = fotomostrar.GetBlob("foto")
|
||||
@@ -1165,7 +1151,7 @@ Sub B4XPage_Appear
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2("delete from pedido where pe_cedis = 'MYKONOS_01' and pe_cliente in (Select CUENTA from cuentaa) AND PE_FOLIO = ?", Array As Object(tipo_venta))
|
||||
' B4XPage_Appear
|
||||
Private s3 As Cursor=B4XPages.MainPage.skmt.ExecQuery2("select * FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) and PE_RECALCULO <> ? OR PE_RECALCULO <> ? OR PE_RECALCULO IS NOT NULL",Array As String("","null"))
|
||||
' LogColor(s3.RowCount,Colors.Yellow)
|
||||
' LogColor(s3.RowCount,Colors.Yellow)
|
||||
If s3.RowCount > 0 Then
|
||||
c=B4XPages.MainPage.skmt.ExecQuery("select CAT_CL_CODIGO,CAT_CL_RUTA,CAT_CL_NOMBRE,CAT_CL_ATIENDE1,CAT_CL_ATIENTE2,CAT_CL_TELEFONO,CAT_CL_EMAIL,CAT_CL_CALLE,CAT_CL_NOEXT,CAT_CL_NOINT,CAT_CL_CALLE1,CAT_CL_CALLE2,CAT_CL_COLONIA,CAT_CL_MUNI,CAT_CL_EDO,CAT_CL_CP,CAT_CL_LONG,CAT_CL_LAT,CAT_CL_MTOCOMPRA,CAT_CL_NUM_SERIEFISICO,IFNULL(CAT_CL_BCREDITO,0) AS CAT_CL_BCREDITO from kmt_info3 where CAT_CL_CODIGO In (Select cuenta from cuentaa)")
|
||||
s=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 = ? or PE_RECALCULO = ? or PE_RECALCULO IS NULL)",Array As String("","null"))
|
||||
@@ -1222,22 +1208,19 @@ Sub B4XPage_Appear
|
||||
Private factura As String = 0
|
||||
If fac.GetString("PC_FACTURA") <> Null And IsNumber(fac.GetString("PC_FACTURA")) Then factura = fac.GetString("PC_FACTURA")
|
||||
If factura = "1" Then CH_FACTURA.Checked = True
|
||||
|
||||
|
||||
' If l_credito.IsInitialized Then
|
||||
c=B4XPages.MainPage.skmt.ExecQuery("select IFNULL(CAT_CL_BCREDITO,0) AS CAT_CL_BCREDITO, CAT_CL_LIMITECREDITO from kmt_info3 where CAT_CL_CODIGO In (Select cuenta from cuentaa)")
|
||||
c.Position = 0
|
||||
If c.GetInt("CAT_CL_BCREDITO") = 1 Then
|
||||
|
||||
|
||||
Dim pagarepen As Cursor = B4XPages.MainPage.skmt.ExecQuery("select FECHA, SALDO_PENDIENTE FROM ABONOSP WHERE CLIENTE IN (SELECT CUENTA FROM CUENTAA)")
|
||||
If pagarepen.RowCount > 0 Then
|
||||
|
||||
|
||||
pagarepen.Position = 0
|
||||
DateTime.DateFormat="dd/MM/yyyy"
|
||||
Dim FechaInicio As String = pagarepen.GetString("FECHA") ' Formato: dd/MM/yyyy
|
||||
' Dim FechaHoy As String = DateTime.Date(DateTime.Now) ' Fecha actual en formato dd/MM/yyyy
|
||||
Log(pagarepen.GetString("FECHA"))
|
||||
|
||||
' Convertir las fechas a milisegundos (desde 01/01/1970)
|
||||
Dim TicksInicio As Long = DateTime.DateParse(FechaInicio)
|
||||
Dim TicksHoy As Long = DateTime.DateParse(DateTime.Date(DateTime.Now))
|
||||
@@ -1247,7 +1230,7 @@ Sub B4XPage_Appear
|
||||
|
||||
' Mostrar resultado
|
||||
Log($"Días transcurridos: ${DiferenciaDias}"$)
|
||||
|
||||
|
||||
Dim c4 As Cursor=B4XPages.MainPage.skmt.ExecQuery("select IFNULL(CAT_CL_DIASCREDITO,0) AS CAT_CL_DIASCREDITO from kmt_info3 where CAT_CL_CODIGO In (Select cuenta from cuentaa)")
|
||||
c4.Position = 0
|
||||
|
||||
@@ -1257,13 +1240,11 @@ Sub B4XPage_Appear
|
||||
Else If DiferenciaDias > c4.GetInt("CAT_CL_DIASCREDITO") + 1 Then
|
||||
l_credito.Color = Colors.Red
|
||||
l_limite.Color = Colors.Red
|
||||
|
||||
End If
|
||||
Else
|
||||
l_credito.Color = Colors.Transparent
|
||||
l_limite.Color = Colors.Transparent
|
||||
End If
|
||||
|
||||
l_credito.Visible = True
|
||||
l_limite.Visible = True
|
||||
l_limite.Text = c.GetInt("CAT_CL_LIMITECREDITO")
|
||||
@@ -1275,14 +1256,11 @@ Sub B4XPage_Appear
|
||||
|
||||
Tels.Visible = False
|
||||
gest.Visible = False
|
||||
|
||||
|
||||
Dim coloressaldo As Cursor=B4XPages.MainPage.skmt.ExecQuery("select IFNULL(CAT_CL_CLASIFICADOR3,0) AS CAT_CL_CLASIFICADOR3, IFNULL(CAT_CL_CLASIFICADOR2,'') AS CAT_CL_CLASIFICADOR2 from kmt_info3 where CAT_CL_CODIGO In (Select cuenta from cuentaa)")
|
||||
coloressaldo.Position = 0
|
||||
|
||||
la_saldooper.Text = coloressaldo.GetDouble("CAT_CL_CLASIFICADOR3")
|
||||
|
||||
l_animal.Text = coloressaldo.GetString("CAT_CL_CLASIFICADOR2")
|
||||
|
||||
If coloressaldo.GetString("CAT_CL_CLASIFICADOR2") = "Chimpancé KIN" Then
|
||||
l_animal.Color = Colors.RGB(84,255,172)
|
||||
Label22.Color = Colors.RGB(84,255,172)
|
||||
@@ -1299,7 +1277,6 @@ Sub B4XPage_Appear
|
||||
l_animal.Color = Colors.Transparent
|
||||
Label22.Color = Colors.Transparent
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Sub MejorarPrecisionGPS As ResumableSub
|
||||
@@ -1307,10 +1284,10 @@ Sub MejorarPrecisionGPS As ResumableSub
|
||||
g.Stop
|
||||
Sleep(500)
|
||||
End If
|
||||
|
||||
|
||||
g.Initialize("GPS")
|
||||
g.Start(0, 0) ' Máxima frecuencia
|
||||
|
||||
|
||||
' Esperar hasta 10 segundos por mejor precisión
|
||||
For i = 1 To 10
|
||||
Sleep(1000)
|
||||
@@ -1321,7 +1298,6 @@ Sub MejorarPrecisionGPS As ResumableSub
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
Return False ' No se logró buena precisión
|
||||
End Sub
|
||||
|
||||
@@ -1329,16 +1305,11 @@ End Sub
|
||||
Sub recalculoXcant
|
||||
' Private c As Cursor = B4XPages.MainPage.skmt.ExecQuery2("SELECT* FROM PEDIDO JOIN CAT_PROMOS_DESCUENTOS ON CAT_PD_PRODUCTO = PE_PROID WHERE PE_CLIENTE IN (Select CUENTA FROM CUENTAA) AND PE_CEDIS = ? AND PE_CANT >= CAT_PD_RANGO AND CAT_PD_RANGO2 <= PE_CANT", Array As String(Subs.traeAlmacen))
|
||||
Private c As Cursor = B4XPages.MainPage.skmt.ExecQuery2("SELECT * FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA FROM CUENTAA) AND PE_CEDIS = ? ", Array As String(Subs.traeAlmacen))
|
||||
|
||||
|
||||
If c.RowCount > 0 Then
|
||||
For promespdes = 0 To c.RowCount -1
|
||||
c.Position = promespdes
|
||||
Dim rangosel As Cursor= B4XPages.MainPage.skmt.ExecQuery2("SELECT * FROM CAT_PROMOS_DESCUENTOS WHERE CAT_PD_PRODUCTO = ? AND CAT_PD_RANGO <= ? AND CAT_PD_RANGO2 >= ?",Array As String(c.GetString("PE_PROID"),c.GetInt("PE_CANT"),c.GetInt("PE_CANT")))
|
||||
If rangosel.RowCount > 0 Then
|
||||
|
||||
' delete fromo pedido where cliete = estecliente!!! y prodId = esteID
|
||||
|
||||
For hjh = 0 To rangosel.RowCount-1
|
||||
rangosel.Position = hjh
|
||||
If rangosel.GetString("CAT_PD_TIER").Contains(Subs.traeTipoCliente) Then
|
||||
@@ -1355,12 +1326,9 @@ Sub recalculoXcant
|
||||
Next
|
||||
Else ' No cumple el rango ...
|
||||
Dim rangosel2 As Cursor= B4XPages.MainPage.skmt.ExecQuery2("SELECT * FROM CAT_PROMOS_DESCUENTOS WHERE CAT_PD_PRODUCTO = ? and ? > cat_pd_rango2",Array As String(c.GetString("PE_PROID"),c.GetInt("PE_CANT")))
|
||||
|
||||
' definir rango sup y cantidad
|
||||
|
||||
If rangosel2.RowCount > 0 Then
|
||||
' rangosel2.Position = 0
|
||||
|
||||
For hjh = 0 To rangosel2.RowCount-1
|
||||
rangosel2.Position = hjh
|
||||
If rangosel2.GetString("CAT_PD_TIER").Contains(Subs.traeTipoCliente) Then
|
||||
@@ -1372,20 +1340,17 @@ Sub recalculoXcant
|
||||
Log(NumberFormat2(((c.GetString("PE_COSTOU") * rangosel2.GetString("CAT_PD_DESCUENTO"))/100),0,2,2,False))
|
||||
Log(rangosel2.GetString("CAT_PD_DESCUENTO"))
|
||||
Private recalculototal As Float = rangosel2.GetString("CAT_PD_RANGO2") * recalculo
|
||||
|
||||
' Restar total cantidad menos rango mayor para obtener la diferencia y saber cuanto hay de mas
|
||||
|
||||
' INSERT de producto (diferencia entre el rango sup y cantidad de pedido
|
||||
|
||||
skmt.ExecNonQuery2("UPDATE PEDIDO set PE_RECALCULO = ?, PE_RECALCULOTOT = ?, PE_RECCEDIS = ?, PE_RECCANT = ? WHERE PE_PROID = ? AND PE_CLIENTE IN (SELECT CUENTA FROM CUENTAA) ",Array As String(NumberFormat2(recalculo,0,2,2,False),NumberFormat2(recalculototal,0,2,2,False),rangosel2.GetString("CAT_PD_COD_PROMO"), rangosel2.GetString("CAT_PD_RANGO2"),c.GetString("PE_PROID")))
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
Else
|
||||
skmt.ExecNonQuery2("UPDATE PEDIDO set PE_RECALCULO = NULL, PE_RECALCULOTOT = NULL, PE_RECCEDIS = NULL, PE_RECCANT = NULL WHERE PE_PROID = ? AND PE_CLIENTE IN (SELECT CUENTA FROM CUENTAA) ",Array As String(c.GetString("PE_PROID")))
|
||||
End If
|
||||
rangosel2.Close
|
||||
End If
|
||||
rangosel.Close
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
@@ -1396,31 +1361,25 @@ Private Sub LA_GPS_Click
|
||||
ToastMessageShow("Mejorando precisión GPS...", False)
|
||||
End Sub
|
||||
|
||||
|
||||
' En lugar de 100m y 50m, usar valores más amplios temporalmente
|
||||
Private Sub RevisarGeocerca
|
||||
' Dim distanciaAlmacen As Int = distancealm ' Tu cálculo actual
|
||||
' Dim distanciaCliente As Int = distance ' Tu cálculo al cliente
|
||||
Log(distancealm)
|
||||
Log(distance)
|
||||
Log(distancealm)
|
||||
Log(distance)
|
||||
' Usar umbrales más amplios (ej: 150m y 80m)
|
||||
|
||||
|
||||
If distancealm > 0 Or distance > 50 Then
|
||||
|
||||
If distancealm < 100 Or distance < 50 Then
|
||||
HabilitarBotones(True)
|
||||
Else
|
||||
HabilitarBotones(True)
|
||||
HabilitarBotones(True)
|
||||
Else
|
||||
HabilitarBotones(True)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Sub HabilitarBotones(dentroDeRango As Boolean)
|
||||
If dentroDeRango Then
|
||||
If Tels.IsInitialized Then
|
||||
|
||||
Tels.Visible = True
|
||||
gest.Visible = True
|
||||
Tels.Enabled = True
|
||||
@@ -1429,7 +1388,6 @@ Sub HabilitarBotones(dentroDeRango As Boolean)
|
||||
End If
|
||||
Else
|
||||
If Tels.IsInitialized Then
|
||||
|
||||
Tels.Visible = False
|
||||
gest.Visible = False
|
||||
' ToastMessageShow("FUERA de rango GPS - Botones deshabilitados", False)
|
||||
@@ -1441,16 +1399,11 @@ Sub InicializarLocalizacionMejorada
|
||||
' Usar tanto GPS como red para mejor precisión
|
||||
Dim LocationManager As JavaObject
|
||||
LocationManager.InitializeStatic("android.location.LocationManager")
|
||||
|
||||
' Solicitar ubicaciones de GPS y red
|
||||
g.Start(0, 0) ' GPS
|
||||
' También podrías usar la ubicación por red para casos interiores
|
||||
End Sub
|
||||
|
||||
'Sub GPS_LocationChanged (Location1 As Location)
|
||||
'
|
||||
'End Sub
|
||||
'
|
||||
Sub GPS_LocationChanged (Location1 As Location)
|
||||
LogColor($"Entrando a Cliente.GPS_LocationChanged"$, Colors.red)
|
||||
' Log($"${Location1.Latitude}, ${Location1.Longitude}"$)
|
||||
@@ -1478,29 +1431,29 @@ Sub GPS_LocationChanged (Location1 As Location)
|
||||
'' Log("Coords set to: " & B4XPages.MainPage.lat_gps & " and " & B4XPages.MainPage.lon_gps)
|
||||
' End If
|
||||
' Log(m_lat &" " & m_lon)
|
||||
|
||||
|
||||
' Si la precisión es mala, intentar mejorarla
|
||||
If Location1.Accuracy > 50 Then ' Mayor a 50 metros de error
|
||||
MejorarPrecisionGPS
|
||||
Return ' Esperar siguiente lectura
|
||||
End If
|
||||
|
||||
|
||||
' Filtrar ubicaciones con baja precisión
|
||||
If Location1.Accuracy > 50 Then ' Si la precisión es mayor a 50 metros, descartar
|
||||
Return
|
||||
End If
|
||||
|
||||
|
||||
' Usar promedio de varias lecturas
|
||||
Dim ultimasUbicaciones As List
|
||||
If ultimasUbicaciones.IsInitialized = False Then
|
||||
ultimasUbicaciones.Initialize
|
||||
End If
|
||||
|
||||
|
||||
ultimasUbicaciones.Add(Location1)
|
||||
If ultimasUbicaciones.Size > 5 Then
|
||||
ultimasUbicaciones.RemoveAt(0)
|
||||
End If
|
||||
|
||||
|
||||
' Calcular promedio
|
||||
Dim latPromedio, lonPromedio As Double
|
||||
For Each loc As Location In ultimasUbicaciones
|
||||
@@ -1510,7 +1463,7 @@ Sub GPS_LocationChanged (Location1 As Location)
|
||||
Next
|
||||
latPromedio = latPromedio / ultimasUbicaciones.Size
|
||||
lonPromedio = lonPromedio / ultimasUbicaciones.Size
|
||||
|
||||
|
||||
' Usar ubicación promediada
|
||||
B4XPages.MainPage.lat_gps = latPromedio
|
||||
B4XPages.MainPage.lon_gps = lonPromedio
|
||||
@@ -1533,7 +1486,6 @@ Sub GPS_LocationChanged (Location1 As Location)
|
||||
Dim ubi1, ubi2 As Location
|
||||
ubi1.Initialize2(B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps)
|
||||
ubi2.Initialize2(al_latitud, al_longitud)
|
||||
|
||||
distancealm = ubi1.DistanceTo(ubi2)
|
||||
End If
|
||||
' Mostrar la precisión actual
|
||||
@@ -1545,7 +1497,7 @@ Sub GPS_LocationChanged (Location1 As Location)
|
||||
' Tu lógica actual aquí
|
||||
B4XPages.MainPage.lat_gps = Location1.Latitude
|
||||
B4XPages.MainPage.lon_gps = Location1.Longitude
|
||||
|
||||
|
||||
If m_lat.Length > 0 And B4XPages.MainPage.lat_gps <> "0" Then
|
||||
Dim l1, l2 As Location
|
||||
l1.Initialize2(B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps)
|
||||
@@ -1718,13 +1670,11 @@ Sub GPS_LocationChanged (Location1 As Location)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
' RevisarGeocerca
|
||||
Else
|
||||
If LA_GPS.IsInitialized Then
|
||||
' LA_GPS.Text = $"UBICACIÓN - Precisión: ${NumberFormat2(Location1.Accuracy, 0, 1, 1, False)}m"$
|
||||
LA_GPS.Text = $"BAJA PRECISIÓN (${NumberFormat2(Location1.Accuracy, 0, 1, 1, False)}m)"$
|
||||
|
||||
LA_GPS.TextColor = Colors.Red
|
||||
End If
|
||||
End If
|
||||
@@ -1742,7 +1692,7 @@ Sub GPS_LocationChanged (Location1 As Location)
|
||||
' 19.4846431, -99.1458691 -> Keymon
|
||||
|
||||
If LA_GEO.IsInitialized Then LA_GEO.Text= $"$1.2{distance/1000} kms"$
|
||||
|
||||
|
||||
' If distance > 100 Then ToastMessageShow("Fuera de rango GPS", False)
|
||||
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))
|
||||
@@ -1837,7 +1787,7 @@ Sub JobDone(Job As HttpJob)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
|
||||
If result1.Tag = "codigoAutorizacion" Then
|
||||
If result1.Rows.Size > 0 Then
|
||||
Log("Si hay codigo de autorizaion")
|
||||
@@ -1876,9 +1826,7 @@ Sub JobDone(Job As HttpJob)
|
||||
Log("Información de ticket enviada a web!!")
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
' If Job.JobName = "DBRequest" Then
|
||||
' Dim result1 As DBResult = reqManager.HandleJob(Job)
|
||||
' If result1.Tag = "CHECAENCUESTA" Then 'query tag
|
||||
@@ -1896,13 +1844,9 @@ Sub JobDone(Job As HttpJob)
|
||||
' Next
|
||||
' End If
|
||||
' End If
|
||||
|
||||
|
||||
|
||||
If result1.Tag = "kmt_datos_foto" Then 'query tag
|
||||
|
||||
For Each records() As Object In result1.Rows
|
||||
|
||||
Dim CAT_CL_FOTO() As Byte = records(result1.Columns.Get("CAT_CL_FOTO"))
|
||||
Next
|
||||
Log("si paso")
|
||||
@@ -1923,17 +1867,10 @@ Sub JobDone(Job As HttpJob)
|
||||
Bitmap1.Initialize2(InputStream1)
|
||||
InputStream1.Close
|
||||
ImageView4.Bitmap = Bitmap1
|
||||
|
||||
Log("aqui si hay foto")
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
End If
|
||||
Job.Release
|
||||
End Sub
|
||||
@@ -1943,11 +1880,10 @@ Sub ListView1_ItemLongClick (Position As Int, Value As Object)
|
||||
End Sub
|
||||
|
||||
Sub gest_Click
|
||||
|
||||
' Mejorar precisión antes de procesar la venta
|
||||
MejorarPrecisionGPS
|
||||
Sleep(500) ' Esperar un poco para que el GPS se estabilice
|
||||
|
||||
' Mejorar precisión antes de procesar la venta
|
||||
' MejorarPrecisionGPS
|
||||
' Sleep(500) ' Esperar un poco para que el GPS se estabilice
|
||||
|
||||
Dim pagarepen As Cursor = B4XPages.MainPage.skmt.ExecQuery("select FECHA, SALDO_PENDIENTE FROM ABONOSP WHERE CLIENTE IN (SELECT CUENTA FROM CUENTAA)")
|
||||
If pagarepen.RowCount > 0 Then
|
||||
pagarepen.Position = 0
|
||||
@@ -1955,7 +1891,7 @@ Sub gest_Click
|
||||
Dim FechaInicio As String = pagarepen.GetString("FECHA") ' Formato: dd/MM/yyyy
|
||||
' Dim FechaHoy As String = DateTime.Date(DateTime.Now) ' Fecha actual en formato dd/MM/yyyy
|
||||
Log(pagarepen.GetString("FECHA"))
|
||||
|
||||
|
||||
' Convertir las fechas a milisegundos (desde 01/01/1970)
|
||||
Dim TicksInicio As Long = DateTime.DateParse(FechaInicio)
|
||||
Dim TicksHoy As Long = DateTime.DateParse(DateTime.Date(DateTime.Now))
|
||||
@@ -1965,15 +1901,12 @@ Sub gest_Click
|
||||
|
||||
' Mostrar resultado
|
||||
Log($"Días transcurridos: ${DiferenciaDias}"$)
|
||||
|
||||
|
||||
c=B4XPages.MainPage.skmt.ExecQuery("select IFNULL(CAT_CL_DIASCREDITO,0) AS CAT_CL_DIASCREDITO from kmt_info3 where CAT_CL_CODIGO In (Select cuenta from cuentaa)")
|
||||
c.Position = 0
|
||||
|
||||
|
||||
|
||||
If DiferenciaDias <= c.GetInt("CAT_CL_DIASCREDITO") + 1 Then
|
||||
|
||||
' MsgboxAsync($"Favor de pagar su credito el día de mañana por un monto de $${pagarepen.GetString("SALDO_PENDIENTE")}"$, "Recordatorio")
|
||||
|
||||
Msgbox2Async($"Favor de pagar su credito el día de mañana por un monto de $${pagarepen.GetString("SALDO_PENDIENTE")}"$, "Recordatorio", "Ok", "", "", LoadBitmap(File.DirAssets,"alert2.png"), False)
|
||||
Wait For Msgbox_Result (resultado As Int)
|
||||
If resultado = DialogResponse.POSITIVE Then
|
||||
@@ -1982,11 +1915,8 @@ Sub gest_Click
|
||||
Else If DiferenciaDias > c.GetInt("CAT_CL_DIASCREDITO") + 1 Then
|
||||
MsgboxAsync($"No se puede realizar venta por que presenta ${(DiferenciaDias-(c.GetInt("CAT_CL_DIASCREDITO") +1))} días de atraso en el credito, por un monto de $${pagarepen.GetString("SALDO_PENDIENTE")}"$, "Atención")
|
||||
End If
|
||||
|
||||
Else
|
||||
|
||||
gestionar
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ Version=12.8
|
||||
#Region Project Attributes
|
||||
#ApplicationLabel: Guna Preventa
|
||||
#VersionCode: 1
|
||||
#VersionName: 5.12.13
|
||||
#VersionName: 5.12.14
|
||||
'SupportedOrientations possible values: unspecified, landscape or portrait.
|
||||
#SupportedOrientations: portrait
|
||||
#CanInstallToExternalStorage: False
|
||||
|
||||
@@ -88,6 +88,6 @@ ModuleClosedNodes6=
|
||||
ModuleClosedNodes7=6,8,9,10,11
|
||||
ModuleClosedNodes8=
|
||||
ModuleClosedNodes9=
|
||||
NavigationStack=C_Cliente,EnviarPDFWhatsAppNumero,6469,4,C_Cliente,GPS_LocationChanged,1453,6,C_Cliente,Impresion3,3210,0,C_Cliente,PDFGENERAR2,6361,0,B4XMainPage,Entrar_LongClick,506,0,C_Principal,resdia_Click,2867,0,C_Principal,B4XPage_Appear,495,0,C_Cliente,B4XPage_Appear,863,0,C_Principal,Subir_Click,743,6,B4XMainPage,Class_Globals,25,0
|
||||
NavigationStack=C_Cliente,b_geopass_Click,1763,0,C_Cliente,iniciofin,1738,0,C_Cliente,p_pideGeoPass_Click,1723,0,C_Cliente,GPS_LocationChanged,1449,0,C_Cliente,InicializarLocalizacionMejorada,1411,0,C_Cliente,HabilitarBotones,1390,0,C_Cliente,RevisarGeocerca,1375,0,C_Cliente,LA_GPS_Click,1366,0,C_Cliente,MejorarPrecisionGPS,1296,0,C_Cliente,recalculoXcant,1301,0,C_Cliente,B4XPage_Appear,1252,0
|
||||
SelectedBuild=0
|
||||
VisibleModules=27,2,16,28,5,13,17,29,19,4,12,22
|
||||
|
||||
@@ -458,6 +458,20 @@ Private Sub CreateLocationRequestSmallD As LocationRequest
|
||||
Return lr
|
||||
End Sub
|
||||
|
||||
Private Sub CreateLocationRequest2 As LocationRequest
|
||||
Private logger As Boolean = True
|
||||
If logger Then Log("Iniciamos CreateLocationRequest2")
|
||||
Dim lr As LocationRequest
|
||||
lr.Initialize
|
||||
lr.SetInterval(1000) '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))
|
||||
@@ -476,20 +490,6 @@ Public Sub StopFLP
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CreateLocationRequest2 As LocationRequest
|
||||
Private logger As Boolean = True
|
||||
If logger Then Log("Iniciamos CreateLocationRequest2")
|
||||
Dim lr As LocationRequest
|
||||
lr.Initialize
|
||||
lr.SetInterval(1000) '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 flp_LocationChanged (Location1 As Location)
|
||||
Log($"Loc changed:${Location1.Longitude},${Location1.Latitude}"$)
|
||||
' ToastMessageShow("Loc changed", False)
|
||||
|
||||
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