mirror of
https://github.com/KeymonSoft/Guna_Preventa.git
synced 2026-04-19 13:49:20 +00:00
5.10.23
This commit is contained in:
@@ -465,6 +465,10 @@ Sub Class_Globals
|
||||
Private l_limite As Label
|
||||
Private l_credito As Label
|
||||
Private l_tipocliente As Label
|
||||
Private l_deuda As Label
|
||||
Private p_deuda As Panel
|
||||
Private Label22 As Label
|
||||
Private l_animal As Label
|
||||
End Sub
|
||||
|
||||
'You can add more parameters here.
|
||||
@@ -667,6 +671,9 @@ Sub B4XPage_Appear
|
||||
ALMACEN = C.GetString("ID_ALMACEN")
|
||||
End If
|
||||
c.Close
|
||||
|
||||
|
||||
|
||||
If ALMACEN = "1" Then
|
||||
Tels.Visible = False
|
||||
gest.Visible = True
|
||||
@@ -1210,7 +1217,44 @@ Sub B4XPage_Appear
|
||||
' 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
|
||||
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))
|
||||
|
||||
' Calcular diferencia en días
|
||||
Dim DiferenciaDias As Int = (TicksHoy - TicksInicio) / DateTime.TicksPerDay
|
||||
|
||||
' 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
|
||||
|
||||
If DiferenciaDias <= c4.GetInt("CAT_CL_DIASCREDITO") + 1 Then
|
||||
l_credito.Color = Colors.Green
|
||||
l_limite.Color = Colors.Green
|
||||
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")
|
||||
@@ -1223,6 +1267,30 @@ 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)
|
||||
Else If coloressaldo.GetString("CAT_CL_CLASIFICADOR2") = "Delfín Niky" Then
|
||||
l_animal.Color = Colors.RGB(84,255,245)
|
||||
Label22.Color = Colors.RGB(84,255,245)
|
||||
Else If coloressaldo.GetString("CAT_CL_CLASIFICADOR2") = "Tortuga KOPI" Then
|
||||
l_animal.Color = Colors.RGB(255,123,84)
|
||||
Label22.Color = Colors.RGB(255,123,84)
|
||||
Else If coloressaldo.GetString("CAT_CL_CLASIFICADOR2") = "Lechuza MON" Then
|
||||
l_animal.Color = Colors.RGB(255,250,140)
|
||||
Label22.Color = Colors.RGB(255,250,140)
|
||||
Else
|
||||
l_animal.Color = Colors.Transparent
|
||||
Label22.Color = Colors.Transparent
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Sub MejorarPrecisionGPS As ResumableSub
|
||||
@@ -1350,13 +1418,14 @@ End Sub
|
||||
Sub GPS_LocationChanged (Location1 As Location)
|
||||
|
||||
|
||||
LogColor($"Entrando a Cliente.GPS_LocationChanged"$, Colors.red)
|
||||
' LogColor($"Entrando a Cliente.GPS_LocationChanged"$, Colors.red)
|
||||
' Log(Location1.Latitude& " aqui guerra "& Location1.Longitude)
|
||||
If Tracker.FLP.GetLastKnownLocation.IsInitialized And Tracker.FLP.GetLastKnownLocation.Latitude <> 0 Then
|
||||
B4XPages.MainPage.lat_gps = Tracker.FLP.GetLastKnownLocation.Latitude
|
||||
B4XPages.MainPage.lon_gps = Tracker.FLP.GetLastKnownLocation.Longitude
|
||||
' Log("Coords set to: " & B4XPages.MainPage.lat_gps & " and " & B4XPages.MainPage.lon_gps)
|
||||
End If
|
||||
Log(m_lat &" " & m_lon)
|
||||
' Log(m_lat &" " & m_lon)
|
||||
|
||||
|
||||
|
||||
@@ -1398,6 +1467,8 @@ Sub GPS_LocationChanged (Location1 As Location)
|
||||
B4XPages.MainPage.lon_gps = lonPromedio
|
||||
|
||||
If Tels.IsInitialized Then
|
||||
Dim al_longitud As String = 0
|
||||
Dim al_latitud As String = 0
|
||||
c = skmt.ExecQuery2("SELECT CAT_VA_VALOR FROM CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = ?",Array As String("LATITUD"))
|
||||
If c.RowCount > 0 Then
|
||||
c.Position = 0
|
||||
@@ -1419,177 +1490,7 @@ Sub GPS_LocationChanged (Location1 As Location)
|
||||
|
||||
|
||||
|
||||
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)
|
||||
' Log($"Coordenadas de la tienda - lat:${m_lat}, lon:${m_lon}"$)
|
||||
l2.Initialize2(m_lat, m_lon)
|
||||
BT_QR.Enabled = True
|
||||
LA_GPS.TextColor = Colors.Blue
|
||||
LA_GPS.Text = "CON UBICACION GPS"
|
||||
B_GPS.Enabled = True
|
||||
'now we need the distance between our location and the target location
|
||||
Dim distance As Long
|
||||
distance = l1.DistanceTo(l2) 'the result is in meter
|
||||
c = skmt.ExecQuery("SELECT HABILITADO FROM GPS")
|
||||
If c.RowCount > 0 Then
|
||||
c.Position = 0
|
||||
Dim habi As String = c.GetString("HABILITADO")
|
||||
End If
|
||||
c.Close
|
||||
c = skmt.ExecQuery("SELECT CAT_VA_VALOR FROM CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = 'GEOCERCA'")
|
||||
If c.RowCount > 0 Then
|
||||
c.Position = 0
|
||||
Dim geo As String = c.GetString("CAT_VA_VALOR")
|
||||
End If
|
||||
c.Close
|
||||
If gest.IsInitialized And Tels.IsInitialized Then
|
||||
If geo = "0" Then
|
||||
gest.Visible = True
|
||||
Tels.Visible = True
|
||||
iniciofin
|
||||
' b_geo = "0"
|
||||
bitacora.banderaGeoCerca = "0"
|
||||
Else If geo = "1" Then
|
||||
gest.Visible = False
|
||||
Tels.Visible = False
|
||||
' p_transparenteInicioFin.Visible = False
|
||||
' Log(999)
|
||||
' b_Inicio_Fin_venta.Visible = False
|
||||
End If
|
||||
End If
|
||||
If geo = "1" Then
|
||||
If distance < 100 Then
|
||||
LA_GEO.TextColor = Colors.Blue
|
||||
Tels.Visible = True
|
||||
gest.Visible = True
|
||||
bitacora.inicioFin
|
||||
precision = "1"
|
||||
' b_geo = "0"
|
||||
bitacora.banderaGeoCerca = "0"
|
||||
' ToastMessageShow("DENTRO de rango GPS", False)
|
||||
Else If habi = "1" Then
|
||||
|
||||
|
||||
|
||||
If distancealm < 50 Then
|
||||
precision = "0"
|
||||
LA_GEO.TextColor = Colors.Blue
|
||||
Tels.Visible = True
|
||||
gest.Visible = True
|
||||
' b_geo = "1"
|
||||
bitacora.banderaGeoCerca = "1"
|
||||
iniciofin
|
||||
' ToastMessageShow("DENTRO de rango GPS", False)
|
||||
Else If distancealm > 50 Then
|
||||
Tels.Visible = False
|
||||
gest.Visible = False
|
||||
' p_transparenteInicioFin.Visible = False
|
||||
Log(998)
|
||||
' b_Inicio_Fin_venta.Visible = False
|
||||
c = skmt.ExecQuery("SELECT PC_CLIENTE FROM PEDIDO_CLIENTE WHERE PC_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
If c.RowCount > 0 Then
|
||||
precision = "0"
|
||||
Tels.Visible = True
|
||||
gest.Visible = True
|
||||
' b_geo = "0"
|
||||
bitacora.banderaGeoCerca = "0"
|
||||
iniciofin
|
||||
Else If c.RowCount = 0 Then
|
||||
c = skmt.ExecQuery("SELECT NV_CLIENTE FROM NOVENTA CLIENTE WHERE NV_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
If c.RowCount > 0 Then
|
||||
Tels.Visible = True
|
||||
gest.Visible = True
|
||||
precision = "0"
|
||||
' b_geo = "0"
|
||||
iniciofin
|
||||
Else If c.RowCount = 0 Then
|
||||
Tels.Visible = False
|
||||
gest.Visible = False
|
||||
' p_transparenteInicioFin.Visible = False
|
||||
Log(997)
|
||||
' b_Inicio_Fin_venta.Visible = False
|
||||
LA_GEO.TextColor = Colors.Red
|
||||
If ALMACEN = "1" Then
|
||||
Tels.Visible = False
|
||||
gest.Visible = True
|
||||
' b_geo = "0"
|
||||
bitacora.banderaGeoCerca = "0"
|
||||
iniciofin
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
LA_GEO.TextColor = Colors.Red
|
||||
If ALMACEN = "1" Then
|
||||
Tels.Visible = False
|
||||
gest.Visible = True
|
||||
' b_geo = "0"
|
||||
bitacora.banderaGeoCerca = "0"
|
||||
iniciofin
|
||||
End If
|
||||
End If
|
||||
Else If habi = 0 Then
|
||||
c = skmt.ExecQuery("SELECT PC_CLIENTE FROM PEDIDO_CLIENTE WHERE PC_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
If c.RowCount > 0 Then
|
||||
Tels.Visible = True
|
||||
gest.Visible = True
|
||||
' b_geo = "0"
|
||||
bitacora.banderaGeoCerca = "0"
|
||||
iniciofin
|
||||
Else If c.RowCount = 0 Then
|
||||
Tels.Visible = False
|
||||
gest.Visible = False
|
||||
' p_transparenteInicioFin.Visible = False
|
||||
Log(996)
|
||||
' b_Inicio_Fin_venta.Visible = False
|
||||
c = skmt.ExecQuery("SELECT NV_CLIENTE FROM NOVENTA CLIENTE WHERE NV_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
If c.RowCount > 0 Then
|
||||
Tels.Visible = True
|
||||
gest.Visible = True
|
||||
' b_geo = "0"
|
||||
bitacora.banderaGeoCerca = "0"
|
||||
iniciofin
|
||||
Else If c.RowCount = 0 Then
|
||||
Tels.Visible = False
|
||||
gest.Visible = False
|
||||
' p_transparenteInicioFin.Visible = False
|
||||
Log(995)
|
||||
' b_Inicio_Fin_venta.Visible = False
|
||||
LA_GEO.TextColor = Colors.Red
|
||||
If ALMACEN = "1" Then
|
||||
Tels.Visible = False
|
||||
gest.Visible = True
|
||||
' b_geo = "0"
|
||||
bitacora.banderaGeoCerca = "0"
|
||||
iniciofin
|
||||
End If
|
||||
End If
|
||||
LA_GEO.TextColor = Colors.Red
|
||||
If ALMACEN = "1" Then
|
||||
Tels.Visible = False
|
||||
gest.Visible = True
|
||||
' b_geo = "0"
|
||||
bitacora.banderaGeoCerca = "0"
|
||||
iniciofin
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
Tels.Visible = False
|
||||
gest.Visible = False
|
||||
' p_transparenteInicioFin.Visible = False
|
||||
Log(994)
|
||||
' b_Inicio_Fin_venta.Visible = False
|
||||
LA_GEO.TextColor = Colors.Red
|
||||
If ALMACEN = "1" Then
|
||||
Tels.Visible = False
|
||||
gest.Visible = True
|
||||
' b_geo = "0"
|
||||
bitacora.banderaGeoCerca = "0"
|
||||
iniciofin
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
' Mostrar la precisión actual
|
||||
If LA_GPS.IsInitialized Then
|
||||
@@ -1603,7 +1504,180 @@ Sub GPS_LocationChanged (Location1 As Location)
|
||||
' Tu lógica actual aquí
|
||||
B4XPages.MainPage.lat_gps = Location1.Latitude
|
||||
B4XPages.MainPage.lon_gps = Location1.Longitude
|
||||
RevisarGeocerca
|
||||
|
||||
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)
|
||||
' Log($"Coordenadas de la tienda - lat:${m_lat}, lon:${m_lon}"$)
|
||||
l2.Initialize2(m_lat, m_lon)
|
||||
BT_QR.Enabled = True
|
||||
' LA_GPS.TextColor = Colors.Blue
|
||||
' LA_GPS.Text = "CON UBICACION GPS"
|
||||
B_GPS.Enabled = True
|
||||
'now we need the distance between our location and the target location
|
||||
Dim distance As Long
|
||||
distance = l1.DistanceTo(l2) 'the result is in meter
|
||||
c = skmt.ExecQuery("SELECT HABILITADO FROM GPS")
|
||||
If c.RowCount > 0 Then
|
||||
c.Position = 0
|
||||
Dim habi As String = c.GetString("HABILITADO")
|
||||
End If
|
||||
c.Close
|
||||
c = skmt.ExecQuery("SELECT CAT_VA_VALOR FROM CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = 'GEOCERCA'")
|
||||
If c.RowCount > 0 Then
|
||||
c.Position = 0
|
||||
Dim geo As String = c.GetString("CAT_VA_VALOR")
|
||||
End If
|
||||
c.Close
|
||||
If gest.IsInitialized And Tels.IsInitialized Then
|
||||
If geo = "0" Then
|
||||
gest.Visible = True
|
||||
Tels.Visible = True
|
||||
iniciofin
|
||||
' b_geo = "0"
|
||||
bitacora.banderaGeoCerca = "0"
|
||||
Else If geo = "1" Then
|
||||
gest.Visible = False
|
||||
Tels.Visible = False
|
||||
' p_transparenteInicioFin.Visible = False
|
||||
' Log(999)
|
||||
' b_Inicio_Fin_venta.Visible = False
|
||||
End If
|
||||
End If
|
||||
If geo = "1" Then
|
||||
If distance < 100 Then
|
||||
LA_GEO.TextColor = Colors.Blue
|
||||
Tels.Visible = True
|
||||
gest.Visible = True
|
||||
bitacora.inicioFin
|
||||
precision = "1"
|
||||
' b_geo = "0"
|
||||
bitacora.banderaGeoCerca = "0"
|
||||
' ToastMessageShow("DENTRO de rango GPS", False)
|
||||
Else If habi = "1" Then
|
||||
|
||||
|
||||
|
||||
If distancealm < 50 Then
|
||||
precision = "0"
|
||||
LA_GEO.TextColor = Colors.Blue
|
||||
Tels.Visible = True
|
||||
gest.Visible = True
|
||||
' b_geo = "1"
|
||||
bitacora.banderaGeoCerca = "1"
|
||||
iniciofin
|
||||
' ToastMessageShow("DENTRO de rango GPS", False)
|
||||
Else If distancealm > 50 Then
|
||||
Tels.Visible = False
|
||||
gest.Visible = False
|
||||
' p_transparenteInicioFin.Visible = False
|
||||
Log(998)
|
||||
' b_Inicio_Fin_venta.Visible = False
|
||||
c = skmt.ExecQuery("SELECT PC_CLIENTE FROM PEDIDO_CLIENTE WHERE PC_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
If c.RowCount > 0 Then
|
||||
precision = "0"
|
||||
Tels.Visible = True
|
||||
gest.Visible = True
|
||||
' b_geo = "0"
|
||||
bitacora.banderaGeoCerca = "0"
|
||||
iniciofin
|
||||
Else If c.RowCount = 0 Then
|
||||
c = skmt.ExecQuery("SELECT NV_CLIENTE FROM NOVENTA CLIENTE WHERE NV_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
If c.RowCount > 0 Then
|
||||
Tels.Visible = True
|
||||
gest.Visible = True
|
||||
precision = "0"
|
||||
' b_geo = "0"
|
||||
iniciofin
|
||||
Else If c.RowCount = 0 Then
|
||||
Tels.Visible = False
|
||||
gest.Visible = False
|
||||
' p_transparenteInicioFin.Visible = False
|
||||
Log(997)
|
||||
' b_Inicio_Fin_venta.Visible = False
|
||||
LA_GEO.TextColor = Colors.Red
|
||||
If ALMACEN = "1" Then
|
||||
Tels.Visible = False
|
||||
gest.Visible = True
|
||||
' b_geo = "0"
|
||||
bitacora.banderaGeoCerca = "0"
|
||||
iniciofin
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
LA_GEO.TextColor = Colors.Red
|
||||
If ALMACEN = "1" Then
|
||||
Tels.Visible = False
|
||||
gest.Visible = True
|
||||
' b_geo = "0"
|
||||
bitacora.banderaGeoCerca = "0"
|
||||
iniciofin
|
||||
End If
|
||||
End If
|
||||
Else If habi = 0 Then
|
||||
c = skmt.ExecQuery("SELECT PC_CLIENTE FROM PEDIDO_CLIENTE WHERE PC_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
If c.RowCount > 0 Then
|
||||
Tels.Visible = True
|
||||
gest.Visible = True
|
||||
' b_geo = "0"
|
||||
bitacora.banderaGeoCerca = "0"
|
||||
iniciofin
|
||||
Else If c.RowCount = 0 Then
|
||||
Tels.Visible = False
|
||||
gest.Visible = False
|
||||
' p_transparenteInicioFin.Visible = False
|
||||
Log(996)
|
||||
' b_Inicio_Fin_venta.Visible = False
|
||||
c = skmt.ExecQuery("SELECT NV_CLIENTE FROM NOVENTA CLIENTE WHERE NV_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
If c.RowCount > 0 Then
|
||||
Tels.Visible = True
|
||||
gest.Visible = True
|
||||
' b_geo = "0"
|
||||
bitacora.banderaGeoCerca = "0"
|
||||
iniciofin
|
||||
Else If c.RowCount = 0 Then
|
||||
Tels.Visible = False
|
||||
gest.Visible = False
|
||||
' p_transparenteInicioFin.Visible = False
|
||||
Log(995)
|
||||
' b_Inicio_Fin_venta.Visible = False
|
||||
LA_GEO.TextColor = Colors.Red
|
||||
If ALMACEN = "1" Then
|
||||
Tels.Visible = False
|
||||
gest.Visible = True
|
||||
' b_geo = "0"
|
||||
bitacora.banderaGeoCerca = "0"
|
||||
iniciofin
|
||||
End If
|
||||
End If
|
||||
LA_GEO.TextColor = Colors.Red
|
||||
If ALMACEN = "1" Then
|
||||
Tels.Visible = False
|
||||
gest.Visible = True
|
||||
' b_geo = "0"
|
||||
bitacora.banderaGeoCerca = "0"
|
||||
iniciofin
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
Tels.Visible = False
|
||||
gest.Visible = False
|
||||
' p_transparenteInicioFin.Visible = False
|
||||
Log(994)
|
||||
' b_Inicio_Fin_venta.Visible = False
|
||||
LA_GEO.TextColor = Colors.Red
|
||||
If ALMACEN = "1" Then
|
||||
Tels.Visible = False
|
||||
gest.Visible = True
|
||||
' b_geo = "0"
|
||||
bitacora.banderaGeoCerca = "0"
|
||||
iniciofin
|
||||
End If
|
||||
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"$
|
||||
@@ -1632,7 +1706,7 @@ Sub GPS_LocationChanged (Location1 As Location)
|
||||
|
||||
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))
|
||||
CallSubDelayed(Tracker, "CreateLocationRequest")
|
||||
CallSubDelayed(Tracker, "CreateLocationRequestSmallD")
|
||||
|
||||
End Sub
|
||||
|
||||
@@ -1833,7 +1907,7 @@ Sub gest_Click
|
||||
|
||||
' Mejorar precisión antes de procesar la venta
|
||||
MejorarPrecisionGPS
|
||||
Sleep(1000) ' Esperar un poco para que el GPS se estabilice
|
||||
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
|
||||
@@ -1853,7 +1927,12 @@ Sub gest_Click
|
||||
' Mostrar resultado
|
||||
Log($"Días transcurridos: ${DiferenciaDias}"$)
|
||||
|
||||
If DiferenciaDias <= 7 Then
|
||||
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)
|
||||
@@ -1861,8 +1940,8 @@ Sub gest_Click
|
||||
If resultado = DialogResponse.POSITIVE Then
|
||||
gestionar
|
||||
End If
|
||||
Else If DiferenciaDias > 7 Then
|
||||
MsgboxAsync($"No se puede realizar venta por que presenta ${(DiferenciaDias-7)} días de atraso en el credito, por un monto de $${pagarepen.GetString("SALDO_PENDIENTE")}"$, "Atención")
|
||||
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
|
||||
@@ -1961,13 +2040,13 @@ Sub compra
|
||||
' Or (ALMACEN = 79 And rutasEncuesta.IndexOf(LA_RUTA.As(Int)) > -1)
|
||||
|
||||
' Encuesta Pedigree
|
||||
If (alamcenesEncuesta.IndexOf(ALMACEN.As(Int)) > -1 ) Or (ALMACEN = 6 And LA_RUTA = 3) Then
|
||||
Log($"${cuest.encuestaIniciada} - ${cuest.clienteConCuestionario(Subs.traeCliente)}"$)
|
||||
If Not(cuest.encuestaIniciada) And Not(cuest.clienteConCuestionario(Subs.traeCliente)) Then
|
||||
cuest.agregaPreguntaCheckbox("1", "¿Qué productos de Kileo Perro encuentras en esta tienda?", Array As String("Pedigree Adulto", "Pedigree Cachorro", "Pedigree Razas Pequeñas", "Champ", "PAL","DOG CHOW ADULTO","DOG CHOW CACHORRO","DOG CHOW RAZAS PEQUEÑAS","Campeon","Ganador","Poder canino","Perron","Silverkan","Woow","Chapetes","Dyno","Beriscan","Nogacan","Nutrescan","Fidus","Amigo Gourmet","Otros","Ninguno de los anteriores"))
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
' If (alamcenesEncuesta.IndexOf(ALMACEN.As(Int)) > -1 ) Or (ALMACEN = 6 And LA_RUTA = 3) Then
|
||||
' Log($"${cuest.encuestaIniciada} - ${cuest.clienteConCuestionario(Subs.traeCliente)}"$)
|
||||
' If Not(cuest.encuestaIniciada) And Not(cuest.clienteConCuestionario(Subs.traeCliente)) Then
|
||||
' cuest.agregaPreguntaCheckbox("1", "¿Qué productos de Kileo Perro encuentras en esta tienda?", Array As String("Pedigree Adulto", "Pedigree Cachorro", "Pedigree Razas Pequeñas", "Champ", "PAL","DOG CHOW ADULTO","DOG CHOW CACHORRO","DOG CHOW RAZAS PEQUEÑAS","Campeon","Ganador","Poder canino","Perron","Silverkan","Woow","Chapetes","Dyno","Beriscan","Nogacan","Nutrescan","Fidus","Amigo Gourmet","Otros","Ninguno de los anteriores"))
|
||||
' Return False
|
||||
' End If
|
||||
' End If
|
||||
|
||||
If TOMAR_FOTO = 0 Then
|
||||
Cuestionario
|
||||
@@ -2786,7 +2865,7 @@ Sub NUEVO_Click
|
||||
End Sub
|
||||
|
||||
Sub HIST_Click
|
||||
B4XPages.ShowPage("Historico")
|
||||
B4XPages.ShowPage("historicobat")
|
||||
End Sub
|
||||
|
||||
Sub BT_QR_Click
|
||||
@@ -2981,7 +3060,7 @@ Sub Impresion3
|
||||
For E=0 To ESPACIO -1
|
||||
BLANCO = " " & BLANCO
|
||||
Next
|
||||
Printer1.WriteString(BLANCO & s.GETSTRING("PE_CANT") & " X $" & s.GETSTRING("PE_COSTOU") & " $" & s.GETSTRING("PE_COSTO_TOT") & CRLF )
|
||||
Printer1.WriteString(BLANCO & s.GETSTRING("PE_CANT") & " X $" & s.GETSTRING("PE_COSTOU") & " $" & s.GETSTRING("PE_COSTO_TOT") & CRLF& CRLF )
|
||||
TAMANO = 0
|
||||
ESPACIO = 21
|
||||
BLANCO = " "
|
||||
@@ -2996,7 +3075,13 @@ Sub Impresion3
|
||||
For E=0 To ESPACIO -1
|
||||
BLANCO = " " & BLANCO
|
||||
Next
|
||||
Printer1.WriteString(BLANCO & s.GETSTRING("PE_CANT") & " X $" & s.GETSTRING("PE_RECALCULO") & " $" & s.GETSTRING("PE_COSTO_TOTREC") & CRLF )
|
||||
|
||||
Dim descpro As Cursor = Starter.skmt.ExecQuery($"SELECT CAT_PD_RANGO, CAT_PD_DESCUENTO, CAT_PD_RANGO2 FROM CAT_PROMOS_DESCUENTOS WHERE CAT_PD_PRODUCTO IN (SELECT CAT_GP_ID FROM CAT_GUNAPROD WHERE CAT_GP_NOMBRE = '${s.GetString("PE_PRONOMBRE")}') AND INSTR(',' || CAT_PD_TIER || ',' , ',${Subs.traeTipoCliente},') > 0 "$)
|
||||
descpro.Position = 0
|
||||
|
||||
Printer1.WriteString(BLANCO & s.GETSTRING("PE_CANT") & " X $" & s.GETSTRING("PE_RECALCULO") & " $" & s.GETSTRING("PE_COSTO_TOTREC") & CRLF & CRLF )
|
||||
|
||||
Printer1.WriteString(BLANCO & "PL $" & s.GETSTRING("PE_COSTOU") & " Desc.: " & descpro.GetDouble("CAT_PD_DESCUENTO")&"%" & CRLF & CRLF)
|
||||
TAMANO = 0
|
||||
ESPACIO = 21
|
||||
BLANCO = " "
|
||||
@@ -6750,4 +6835,62 @@ End Sub
|
||||
|
||||
Private Sub CH_FACTURA_CheckedChange(Checked As Boolean)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub l_limite_Click
|
||||
|
||||
|
||||
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
|
||||
Dim cs As CSBuilder
|
||||
cs.Initialize
|
||||
p_deuda.Visible = True
|
||||
p_deuda.Width = Root.Width
|
||||
p_deuda.Height = Root.Height
|
||||
|
||||
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))
|
||||
|
||||
' Calcular diferencia en días
|
||||
Dim DiferenciaDias As Int = (TicksHoy - TicksInicio) / DateTime.TicksPerDay
|
||||
|
||||
' 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
|
||||
' 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)
|
||||
|
||||
' l_deuda.Text = ($"Favor de pagar su credito el día de mañana por un monto de $${pagarepen.GetString("SALDO_PENDIENTE")}"$)
|
||||
l_deuda.Text = cs.Color(Colors.Black).Append("Monto de la deuda:" & CRLF&CRLF).Pop.Size(18).Color(Colors.RGB(48,109,0)).Append("$ "& pagarepen.GetString("SALDO_PENDIENTE")).PopAll
|
||||
Else If DiferenciaDias > c.GetInt("CAT_CL_DIASCREDITO") + 1 Then
|
||||
' l_deuda.Text = ($"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")}"$)
|
||||
l_deuda.Text = cs.Color(Colors.Black).Append("Monto de la deuda:" & CRLF&CRLF).Pop.Color(Colors.Red).Size(18).Append("$ " &pagarepen.GetString("SALDO_PENDIENTE")&CRLF&CRLF).Pop.Size(14).Color(Colors.Black).Append("Dias de atraso:" & CRLF&CRLF).Pop.Size(18).Color(Colors.Red).Append((DiferenciaDias-(c.GetInt("CAT_CL_DIASCREDITO") +1))).PopAll
|
||||
End If
|
||||
Else
|
||||
p_deuda.Visible = True
|
||||
|
||||
p_deuda.Width = Root.Width
|
||||
p_deuda.Height = Root.Height
|
||||
|
||||
l_deuda.Text = "No tiene adeudo"
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub b_okdeuda_Click
|
||||
p_deuda.Visible = False
|
||||
End Sub
|
||||
|
||||
Private Sub p_deuda_Click
|
||||
p_deuda.Visible = False
|
||||
End Sub
|
||||
Reference in New Issue
Block a user