mirror of
https://github.com/KeymonSoft/Guna_Preventa.git
synced 2026-04-17 21:06:32 +00:00
5.10.23
This commit is contained in:
@@ -38,6 +38,8 @@ Sub Class_Globals
|
||||
Public pedidos As C_Pedidos
|
||||
Public promos As C_Promos
|
||||
Public historico As C_Historico
|
||||
|
||||
Public historicobat As C_historicobat
|
||||
Dim reqManager As DBRequestManager
|
||||
Dim v As String = Application.VersionName
|
||||
Dim ruta As String
|
||||
@@ -110,6 +112,8 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
Root = Root1
|
||||
Root.LoadLayout("login")
|
||||
' B4XPages.SetTitle(Me, "Guna Preventa")
|
||||
|
||||
|
||||
login.Initialize
|
||||
B4XPages.AddPage("Login", login)
|
||||
principal.Initialize
|
||||
@@ -138,6 +142,10 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
B4XPages.AddPage("Promos", promos)
|
||||
historico.Initialize
|
||||
B4XPages.AddPage("Historico", historico)
|
||||
historicobat.Initialize
|
||||
B4XPages.AddPage("historicobat", historicobat)
|
||||
|
||||
|
||||
p_Main.Height = Root.Height
|
||||
p_Main.Width = Root.Width
|
||||
ruta = Starter.ruta
|
||||
@@ -202,9 +210,13 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
Subs.agregaColumna("HIST_ENCUESTA", "HE_LON", "TEXT")
|
||||
Subs.agregaColumna("HIST_VENTAS", "HVD_FECHA", "TEXT")
|
||||
Subs.agregaColumna("kmt_info3", "encuesta", "TEXT")
|
||||
Subs.agregaColumna("kmt_info3", "CAT_CL_CLASIFICADOR3", "TEXT")
|
||||
Subs.agregaColumna("kmt_info3", "CAT_CL_CLASIFICADOR2", "TEXT")
|
||||
Subs.agregaColumna("kmt_info3", "CAT_CL_TIPOCLIENTE", "TEXT")
|
||||
Subs.agregaColumna("kmt_info3", "CAT_CL_LIMITECREDITO", "TEXT")
|
||||
Subs.agregaColumna("kmt_info3", "CAT_CL_DIASCREDITO", "TEXT")
|
||||
Subs.agregaColumna("kmt_info3", "CAT_CL_BCREDITO", "TEXT") '########################## CODIGO PARA CREDITOS ####################
|
||||
Subs.agregaColumna("CAT_GUNAPROD", "CAT_GP_DEV", "TEXT")
|
||||
Subs.agregaColumna("CAT_GUNAPROD", "CAT_PA_BSEGMENTA", "TEXT")
|
||||
Subs.agregaColumna("CAT_GUNAPROD", "CAT_LISTAPRECIO", "TEXT")
|
||||
Subs.agregaColumna("CAT_GUNAPROD", "CAT_PA_SEGMENTAV", "TEXT")
|
||||
|
||||
@@ -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
|
||||
@@ -92,6 +92,10 @@ Sub B4XPage_Appear
|
||||
L_CANT.Text = c.GetString("PC_NOART")
|
||||
L_TOTAL.Text = c.GetString("PC_MONTO")
|
||||
End If
|
||||
' ListView1.Visible = False
|
||||
' CustomListView1.AsView.Visible = True
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub GPS_LocationChanged (Location1 As Location)
|
||||
|
||||
167
B4A/C_Historico2.bas
Normal file
167
B4A/C_Historico2.bas
Normal file
@@ -0,0 +1,167 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Class
|
||||
Version=11.5
|
||||
@EndOfDesignText@
|
||||
Sub Class_Globals
|
||||
Private Root As B4XView 'ignore
|
||||
Private xui As XUI 'ignore
|
||||
|
||||
Dim g As GPS
|
||||
Dim clie_id As String
|
||||
Dim sDate,sTime As String
|
||||
Dim usuario As String
|
||||
|
||||
Dim c As Cursor
|
||||
Dim ruta As String
|
||||
Dim Regresar As Button
|
||||
|
||||
|
||||
Dim ListView1 As ListView
|
||||
Dim L_CANT As Label
|
||||
Dim L_TOTAL As Label
|
||||
Dim borra As Button
|
||||
Dim Existe As String
|
||||
Dim result As String
|
||||
' Dim lat_gps, lon_gps As String
|
||||
|
||||
Private Titulo As Label
|
||||
Private b_desc As Button
|
||||
Private ListView2 As ListView
|
||||
Dim tgl As Toggle
|
||||
Private p_nota As Panel
|
||||
Private Panel1 As Panel
|
||||
Private l_productohist As Label
|
||||
Private l_s1 As Label
|
||||
Private l_s2 As Label
|
||||
Private l_s3 As Label
|
||||
Private l_s4 As Label
|
||||
Private CustomListView1 As CustomListView
|
||||
|
||||
End Sub
|
||||
|
||||
'You can add more parameters here.
|
||||
'Public Sub Initialize As Object
|
||||
'' Return Me
|
||||
'End Sub
|
||||
|
||||
'This event will be called once, before the page becomes visible.
|
||||
Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
Root = Root1
|
||||
'load the layout to Root
|
||||
ruta = File.DirInternal
|
||||
Root.LoadLayout("nota2")
|
||||
borra.Visible = False
|
||||
Titulo.Text = "Acumulado"
|
||||
b_desc.Visible = False
|
||||
If File.Exists(ruta, "kmt.db") = False Then
|
||||
File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
|
||||
End If
|
||||
' skmt.Initialize(ruta,"kmt.db", True)
|
||||
End Sub
|
||||
|
||||
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
||||
|
||||
Sub B4XPage_Appear
|
||||
p_nota.Height = Root.Height * 0.9
|
||||
p_nota.Width = Root.Width * 0.9
|
||||
Panel1.Visible = False
|
||||
If Not(Starter.gps.GPSEnabled) Then
|
||||
ToastMessageShow("Es necesario tener el GPS encendido", True)
|
||||
StartActivity(Starter.gps.LocationSettingsIntent)
|
||||
End If
|
||||
L_CANT.Text =""
|
||||
L_TOTAL.Text=""
|
||||
c=B4XPages.MainPage.skmt.ExecQuery("select count(*) as EXISTE from HIST_VENTAS WHERE HVD_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
C.Position=0
|
||||
Existe = C.GetString("EXISTE")
|
||||
C.Close
|
||||
c=B4XPages.MainPage.skmt.ExecQuery("select HVD_CLIENTE,HVD_PRONOMBRE,HVD_CANT,HVD_COSTO_TOT, HVD_FECHA from HIST_VENTAS WHERE HVD_CLIENTE IN (Select CUENTA from cuentaa) order by HVD_FECHA asc")
|
||||
ListView1.Clear
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
c.Position=i
|
||||
Dim label1 As Label
|
||||
label1 = ListView1.TwoLinesLayout.Label
|
||||
label1.TextSize = 15
|
||||
label1.TextColor = Colors.White
|
||||
Dim label2 As Label
|
||||
label2 = ListView1.TwoLinesLayout.SecondLabel
|
||||
label2.TextSize = 15
|
||||
label2.TextColor = Colors.White
|
||||
ListView1.AddTwoLines(c.GetString("HVD_PRONOMBRE"),"Cantidad #"& c.GetString("HVD_CANT")& " SubTotal $"& c.GetString("HVD_COSTO_TOT")&" Fecha: "& c.GetString("HVD_FECHA"))
|
||||
Next
|
||||
End If
|
||||
If Existe <> 0 Then
|
||||
c=B4XPages.MainPage.skmt.ExecQuery("select SUM(HVD_CANT) AS PC_NOART, SUM(HVD_COSTO_TOT) AS PC_MONTO from HIST_VENTAS where HVD_CLIENTE in (Select CUENTA from cuentaa)")
|
||||
C.Position=0
|
||||
L_CANT.Text = c.GetString("PC_NOART")
|
||||
L_TOTAL.Text = c.GetString("PC_MONTO")
|
||||
End If
|
||||
' ListView1.Visible = False
|
||||
' CustomListView1.AsView.Visible = True
|
||||
' c=B4XPages.MainPage.skmt.ExecQuery("select HVD_CLIENTE,HVD_PRONOMBRE,HVD_CANT,HVD_COSTO_TOT, HVD_FECHA from HIST_VENTAS WHERE HVD_CLIENTE IN (Select CUENTA from cuentaa) order by HVD_FECHA asc")
|
||||
'
|
||||
For sfdf = 0 To 1
|
||||
CustomListView1.Add(CreateListItem("ejemplo","1","2","3","4", 284, 144),sfdf)
|
||||
|
||||
Next
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Sub CreateListItem(prodhis As String, s1 As Int, s2 As Int, s3 As Int,s4 As Int, Width As Int, Height As Int) As Panel 'ignore
|
||||
Dim p As B4XView = xui.CreatePanel("")
|
||||
p.SetLayoutAnimated(0, 0, 0, Width, Height)
|
||||
p.LoadLayout("historicobat")
|
||||
' l_prodX.TextSize = 15
|
||||
' l_prodX.Text = Text
|
||||
' l_prodX.TextSize = 15
|
||||
'' p_prods.Height = Height + 70
|
||||
'' l_prodX.Height = Height
|
||||
' p_prods.height = su.MeasureMultilineTextHeight(l_prodX, l_prodX.Text) + 20 'Calculamos la altura del panel de acuerdo al texto contenido.
|
||||
' If p_prods.Height < Height Then p_prods.Height = Height
|
||||
' l_prodX.Height = p_prods.Height
|
||||
' l_pCant.Tag = precioU&"|"&inv&"|"&prodId
|
||||
' et_pCant.Tag = precioU&"|"&inv&"|"&prodId
|
||||
' et_pCant.BringToFront
|
||||
'' i_prod.Bitmap = img
|
||||
' p.Height = p_prods.Height
|
||||
Return p
|
||||
End Sub
|
||||
|
||||
Sub GPS_LocationChanged (Location1 As Location)
|
||||
'lat_gps=Location1.ConvertToSeconds(Location1.Latitude)
|
||||
'lon_gps=Location1.ConvertToSeconds(Location1.Longitude)
|
||||
End Sub
|
||||
|
||||
Sub Regresar_Click
|
||||
B4XPages.ShowPage("Cliente")
|
||||
End Sub
|
||||
|
||||
Private Sub B4XPage_CloseRequest As ResumableSub
|
||||
' BACK key pressed
|
||||
' Return True To close, False To cancel
|
||||
B4XPages.ShowPage("Cliente")
|
||||
Return False
|
||||
End Sub
|
||||
|
||||
Sub ListView2_ItemClick (Position As Int, Value As Object)
|
||||
ListView2.Visible = False
|
||||
ListView1.Visible = True
|
||||
End Sub
|
||||
|
||||
Sub ListView1_ItemClick (Position As Int, Value As Object)
|
||||
ListView2.Visible = True
|
||||
ListView1.Visible = False
|
||||
Dim label1 As Label
|
||||
For i=0 To 20
|
||||
label1 = ListView2.SingleLineLayout.Label
|
||||
label1.TextSize = 15
|
||||
label1.TextColor = Colors.Black
|
||||
ListView2.AddSingleLine(i)
|
||||
Next
|
||||
End Sub
|
||||
@@ -183,7 +183,7 @@ Sub borra_Click
|
||||
If folio <> "" Then
|
||||
result = Msgbox2("Seguro que desa borrar el pedido?","Cancelar pedido", "Si", "", "No",LoadBitmap(File.DirAssets,"alert2.png")) 'ignore
|
||||
If result = DialogResponse.POSITIVE Then
|
||||
c=B4XPages.MainPage.skmt.ExecQuery("select PE_PROID,PE_CANT FROM PEDIDO where pe_cliente in (Select CUENTA from cuentaa) ")
|
||||
c=B4XPages.MainPage.skmt.ExecQuery("select PE_PROID,PE_CANT FROM PEDIDO where pe_cliente in (Select CUENTA from cuentaa) AND PE_CEDIS <> 'DUR'")
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
c.Position=i
|
||||
@@ -309,8 +309,13 @@ Sub ListView1_ItemLongClick (Position As Int, Value As Object)
|
||||
' For j = 0 To c.RowCount -1
|
||||
' Log("aqui tronare?")
|
||||
'' c.Position = j
|
||||
|
||||
If cedis <> "DUR" Then
|
||||
B4XPages.MainPage.skmt.ExecNonQuery($"update ${Subs.traeTablaProds(tipo_venta)} set cat_gp_almacen = cat_gp_almacen + ${c.GetString("PE_CANT")} where cat_gp_id = '${c.GetString("PE_PROID")}'"$)
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2("delete from pedido where pe_cedis= ? and pe_cliente in (Select CUENTA from cuentaa) AND PE_FOLIO = ?", Array As Object(cedis, c.GetString("PE_FOLIO")))
|
||||
Else
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2("delete from pedido where pe_cedis= ? and pe_cliente in (Select CUENTA from cuentaa) AND PE_FOLIO = ?", Array As Object(cedis, c.GetString("PE_FOLIO")))
|
||||
End If
|
||||
' Next
|
||||
' End If
|
||||
' j3.Close
|
||||
@@ -396,8 +401,13 @@ Sub ListView1_ItemLongClick (Position As Int, Value As Object)
|
||||
' For j = 0 To c.RowCount -1
|
||||
' Log("aqui tronare?")
|
||||
' ' c.Position = j
|
||||
|
||||
If cedis <> "DUR" Then
|
||||
B4XPages.MainPage.skmt.ExecNonQuery($"update ${Subs.traeTablaProds(tipo_venta)} set cat_gp_almacen = cat_gp_almacen + ${c.GetString("PE_CANT")} where cat_gp_id = '${c.GetString("PE_PROID")}'"$)
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2("delete from pedido where pe_cedis= ? and pe_cliente in (Select CUENTA from cuentaa) AND PE_FOLIO = ?", Array As Object(cedis, c.GetString("PE_FOLIO")))
|
||||
Else
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2("delete from pedido where pe_cedis= ? and pe_cliente in (Select CUENTA from cuentaa) AND PE_FOLIO = ?", Array As Object(cedis, c.GetString("PE_FOLIO")))
|
||||
End If
|
||||
' Next
|
||||
' End If
|
||||
' j3.Close
|
||||
|
||||
@@ -20,6 +20,9 @@ Sub Class_Globals
|
||||
Dim no_cliente As String
|
||||
Dim no_ruta As String
|
||||
|
||||
Dim lat As Double = 0
|
||||
Dim lon As Double = 0
|
||||
|
||||
Dim r_4 As RadioButton
|
||||
Dim E_NOMBRE As EditText
|
||||
Dim tgl As Toggle
|
||||
@@ -55,6 +58,17 @@ Sub B4XPage_Appear
|
||||
StartActivity(Starter.gps.LocationSettingsIntent)
|
||||
End If
|
||||
GUARDA.Visible = False
|
||||
|
||||
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
|
||||
|
||||
|
||||
' Subs.panelVisible(p_nuevoCliente,, 0)
|
||||
' p_nuevoCliente.Height = Root.Height
|
||||
' p_nuevoCliente.Width = Root.Width
|
||||
@@ -65,16 +79,31 @@ Sub B4XPage_Appear
|
||||
' E_NOMBRE.Left = Round(Root.Width/2)-(E_NOMBRE.Width/2)
|
||||
If B4XPages.MainPage.lat_gps <> "0.0" Then
|
||||
GUARDA.Visible = True 'Si hay ubicaccion, mostramos el boton de guardar.
|
||||
l_sinUbicacion.Visible = False
|
||||
l_sinUbicacion.Visible = True
|
||||
End If
|
||||
Starter.skmt.ExecNonQuery("delete from cuentaa")
|
||||
End Sub
|
||||
|
||||
Sub GPS_LocationChanged (Location1 As Location)
|
||||
If B4XPages.MainPage.lat_gps <> "0.0" Then
|
||||
If GUARDA.IsInitialized Then
|
||||
GUARDA.Visible = True 'Si hay ubicaccion, mostramos el boton de guardar.
|
||||
l_sinUbicacion.Visible = False
|
||||
l_sinUbicacion.Visible = True
|
||||
|
||||
End If
|
||||
End If
|
||||
Log("CAMBIE")
|
||||
If B4XPages.MainPage.lat_gps <> "0.0" Then
|
||||
If GUARDA.IsInitialized Then
|
||||
GUARDA.Visible = True 'Si hay ubicaccion, mostramos el boton de guardar.
|
||||
l_sinUbicacion.Visible = True
|
||||
lat = Location1.Latitude
|
||||
lon = Location1.Longitude
|
||||
l_sinUbicacion.Text = ("Latitud: " & lat & ", Longotud: "& lon)
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Sub CANCELA_Click
|
||||
@@ -102,7 +131,7 @@ Sub GUARDA_Click
|
||||
no_cliente= "N" & sTime & no_ruta
|
||||
Log("++ ++ no_cliente = "&no_cliente)
|
||||
' c.Close
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO kmt_info3(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, gestion) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,0,0,0) ",Array As Object (no_cliente,no_ruta, E_NOMBRE.Text,"null","null","null","null","null","null","null","null","null","null","null","null","null",B4XPages.MainPage.lon_gps,B4XPages.MainPage.lat_gps))
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO kmt_info3(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, gestion) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,0,0,0) ",Array As Object (no_cliente,no_ruta, E_NOMBRE.Text,"null","null","null","null","null","null","null","null","null","null","null","null","null",lon,lat))
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO HIST_STAY_STORE(HSS_CODIGO, HSS_IN , HSS_OUT , HSS_TOT) VALUES (?,0,0,0)", Array As Object (no_cliente))
|
||||
B4XPages.MainPage.skmt.ExecNonQuery("delete from CUENTAA")
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO CUENTAA VALUES (?)", Array As Object(no_cliente))
|
||||
|
||||
@@ -1152,8 +1152,8 @@ Sub cargar_Click
|
||||
|
||||
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_hist_datos_GV2_2"
|
||||
cmd.Parameters = Array As Object(e_ruta.text, ALMACEN,e_ruta.text, ALMACEN,e_ruta.text, ALMACEN)
|
||||
cmd.Name = "select_hist_datos_GV2_3"
|
||||
cmd.Parameters = Array As Object(e_ruta.text, ALMACEN,e_ruta.text, ALMACEN)
|
||||
B4XPages.MainPage.reqManager.ExecuteQuery(cmd , 0, "hist_datos")
|
||||
|
||||
cmd.Initialize
|
||||
@@ -1223,8 +1223,8 @@ Sub cargar_Click
|
||||
B4XPages.MainPage.reqManager.ExecuteQuery(cmd , 0, "kmt_datos2")
|
||||
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_hist_datos_GV2_2"
|
||||
cmd.Parameters = Array As Object(E_RUTA2.text, ALMACEN,E_RUTA2.text, ALMACEN,E_RUTA2.text, ALMACEN)
|
||||
cmd.Name = "select_hist_datos_GV2_3"
|
||||
cmd.Parameters = Array As Object(E_RUTA2.text, ALMACEN,E_RUTA2.text, ALMACEN)
|
||||
B4XPages.MainPage.reqManager.ExecuteQuery(cmd , 0, "hist_datos")
|
||||
|
||||
cmd.Initialize
|
||||
@@ -1418,10 +1418,13 @@ Sub JobDone(Job As HttpJob)
|
||||
Dim CAT_CL_NUM_SERIEFISICO As String = records(RESULT.Columns.Get("CAT_CL_NUM_SERIEFISICO"))
|
||||
Dim CAT_CL_TIPOCLIENTE As String = records(RESULT.Columns.Get("CAT_CL_TIPOCLIENTE"))
|
||||
Dim CAT_CL_LIMITECREDITO As String = records(RESULT.Columns.Get("CAT_CL_LIMITECREDITO"))
|
||||
Dim CAT_CL_DIASCREDITO As String = records(RESULT.Columns.Get("CAT_CL_DIASCREDITO"))
|
||||
Dim CAT_CL_CLASIFICADOR3 As String = records(RESULT.Columns.Get("CAT_CL_CLASIFICADOR3"))
|
||||
Dim CAT_CL_CLASIFICADOR2 As String = records(RESULT.Columns.Get("CAT_CL_CLASIFICADOR2"))
|
||||
|
||||
'########################## INICIA CODIGO PARA CREDITOS ####################
|
||||
Dim CAT_CL_BCREDITO As String = records(RESULT.Columns.Get("CAT_CL_BCREDITO"))
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO kmt_info3(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, gestion,CAT_CL_BCREDITO,CAT_CL_TIPOCLIENTE,FOTO,CAT_CL_LIMITECREDITO) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,0,?,?,?,?)", Array As Object (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,CAT_CL_BCREDITO,CAT_CL_TIPOCLIENTE,CAT_CL_FOTO,CAT_CL_LIMITECREDITO))
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO kmt_info3(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, gestion,CAT_CL_BCREDITO,CAT_CL_TIPOCLIENTE,FOTO,CAT_CL_LIMITECREDITO,CAT_CL_DIASCREDITO,CAT_CL_CLASIFICADOR3,CAT_CL_CLASIFICADOR2) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,0,?,?,?,?,?,?,?)", Array As Object (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,CAT_CL_BCREDITO,CAT_CL_TIPOCLIENTE,CAT_CL_FOTO,CAT_CL_LIMITECREDITO,CAT_CL_DIASCREDITO,CAT_CL_CLASIFICADOR3,CAT_CL_CLASIFICADOR2))
|
||||
'########################## TERMINA CODIGO PARA CREDITOS ####################
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO HIST_STAY_STORE(HSS_CODIGO, HSS_IN , HSS_OUT , HSS_TOT) VALUES (?,0,0,0)", Array As Object (CAT_CL_CODIGO))
|
||||
Next
|
||||
@@ -1464,6 +1467,7 @@ Sub JobDone(Job As HttpJob)
|
||||
Dim CAT_CL_NUM_SERIEFISICO As String = records(RESULT.Columns.Get("CAT_CL_NUM_SERIEFISICO"))
|
||||
Dim CAT_CL_TIPOCLIENTE As String = records(RESULT.Columns.Get("CAT_CL_TIPOCLIENTE"))
|
||||
Dim CAT_CL_FOTO() As Byte = records(RESULT.Columns.Get("CAT_CL_FOTO"))
|
||||
|
||||
'########################## INICIA CODIGO PARA CREDITOS ####################
|
||||
Dim CAT_CL_BCREDITO As String = records(RESULT.Columns.Get("CAT_CL_BCREDITO"))
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO kmt_info3(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, gestion,CAT_CL_BCREDITO,CAT_CL_TIPOCLIENTE,FOTO) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,0,?,?,?)", Array As Object (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,CAT_CL_BCREDITO,CAT_CL_TIPOCLIENTE,CAT_CL_FOTO))
|
||||
@@ -1800,14 +1804,14 @@ Sub JobDone(Job As HttpJob)
|
||||
Dim CAT_GP_SUBTIPO As String = records(RESULT.Columns.Get("CAT_GP_SUBTIPO"))
|
||||
Dim CAT_GP_IMG() As Byte = records(RESULT.Columns.Get("CAT_GP_IMG"))
|
||||
Dim CAT_GP_ALMACEN As Int = records(RESULT.Columns.Get("CAT_GP_ALMACEN"))
|
||||
' Dim CAT_GP_DEV As String = records(RESULT.Columns.Get("CAT_GP_DEV"))
|
||||
Dim CAT_GP_DEV As String = records(RESULT.Columns.Get("CAT_GP_DEV"))
|
||||
Dim CAT_GP_TIPOPROD As Int = records(RESULT.Columns.Get("CAT_GP_TIPOPROD"))
|
||||
Dim CAT_GP_INICIATIVA As Int = records(RESULT.Columns.Get("CAT_GP_INICIATIVA"))
|
||||
Dim CAT_LISTAPRECIO As String = records(RESULT.Columns.Get("CAT_LISTAPRECIO"))
|
||||
' Dim CAT_LISTAPRECIO As Int = 10
|
||||
' CAT_GP_INICIATIVA = 5
|
||||
' skmt.ExecNonQuery2("INSERT INTO CAT_GUNAPROD(CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG,CAT_GP_ALMACEN,CAT_GP_DEV) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)", Array As Object (CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG, CAT_GP_ALMACEN,CAT_GP_DEV))
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO CAT_GUNAPROD(CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG,CAT_GP_ALMACEN,CAT_GP_TIPOPROD,CAT_GP_INICIATIVA,CAT_LISTAPRECIO) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)", Array As Object (CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG, CAT_GP_ALMACEN,CAT_GP_TIPOPROD, CAT_GP_INICIATIVA,CAT_LISTAPRECIO))
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO CAT_GUNAPROD(CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG,CAT_GP_ALMACEN,CAT_GP_TIPOPROD,CAT_GP_INICIATIVA,CAT_LISTAPRECIO, CAT_GP_DEV) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", Array As Object (CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG, CAT_GP_ALMACEN,CAT_GP_TIPOPROD, CAT_GP_INICIATIVA,CAT_LISTAPRECIO,CAT_GP_DEV))
|
||||
Next
|
||||
Listo2=1
|
||||
If PB2.Progress = 0 Then
|
||||
@@ -2646,6 +2650,9 @@ Sub B_OK_PAS_Click
|
||||
Next
|
||||
End If
|
||||
c13.Close
|
||||
|
||||
|
||||
|
||||
checaPedido
|
||||
Else if CARGA = "CARGAR" And (S_CP.Text <> "LISTO" Or S_CC.Text <> "LISTO" Or S_CH.Text <> "LISTO") Then
|
||||
RES = Msgbox2("Seguro que desa abortar el proceso","Cierre", "Si", "", "No",LoadBitmap(File.DirAssets,"alert2.png")) 'ignore
|
||||
@@ -3193,4 +3200,7 @@ Sub checaPedido
|
||||
If c.RowCount > 0 Then
|
||||
Starter.skmt.ExecNonQuery("Update kmt_info3 set gestion = 3 WHERE CAT_CL_CODIGO IN (SELECT NV_CLIENTE FROM NOVENTA)")
|
||||
End If
|
||||
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2("UPDATE CAT_GUNAPROD SET CAT_GP_TIPOPROD = (?) WHERE CAT_GP_ID IN (SELECT CAT_PD_PRODUCTO FROM CAT_PROMOS_DESCUENTOS) ",Array As Object("PRIORITARIO"))
|
||||
|
||||
End Sub
|
||||
1146
B4A/C_Productos.bas
1146
B4A/C_Productos.bas
File diff suppressed because it is too large
Load Diff
@@ -596,6 +596,7 @@ Sub muestraPromo(promo As String, cliente As String)
|
||||
Private thisProd As Map = prodsPromo.Get(p)
|
||||
If thisLog Then Log(thisProd)
|
||||
clv_prodsVariabes.Add(CreateListItem(Subs.traeProdNombre(p)&CRLF&"Hay " & invDispPromo.Get(p) & " $" & estePrecio, estePrecio, invDispPromo.Get(p), clv_prodsVariabes.AsView.Width, 50dip, Null, p), p)
|
||||
|
||||
End If
|
||||
Next
|
||||
For Each p As String In pv2
|
||||
|
||||
202
B4A/C_historicobat.bas
Normal file
202
B4A/C_historicobat.bas
Normal file
@@ -0,0 +1,202 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Class
|
||||
Version=12.8
|
||||
@EndOfDesignText@
|
||||
Sub Class_Globals
|
||||
Private Root As B4XView 'ignore
|
||||
Private xui As XUI 'ignore
|
||||
|
||||
Dim g As GPS
|
||||
Dim clie_id As String
|
||||
Dim sDate,sTime As String
|
||||
Dim usuario As String
|
||||
|
||||
Dim c As Cursor
|
||||
Dim ruta As String
|
||||
Dim Regresar As Button
|
||||
|
||||
|
||||
Dim ListView1 As ListView
|
||||
Dim L_CANT As Label
|
||||
Dim L_TOTAL As Label
|
||||
Dim borra As Button
|
||||
Dim Existe As String
|
||||
Dim result As String
|
||||
' Dim lat_gps, lon_gps As String
|
||||
|
||||
Private Titulo As Label
|
||||
Private b_desc As Button
|
||||
Private ListView2 As ListView
|
||||
Dim tgl As Toggle
|
||||
Private p_nota As Panel
|
||||
Private Panel1 As Panel
|
||||
Private l_productohist As Label
|
||||
Private l_s1 As Label
|
||||
Private l_s2 As Label
|
||||
Private l_s3 As Label
|
||||
Private l_s4 As Label
|
||||
Private CustomListView1 As CustomListView
|
||||
Private L_PROMEDIOHIST As Label
|
||||
End Sub
|
||||
|
||||
'You can add more parameters here.
|
||||
Public Sub Initialize As Object
|
||||
Return Me
|
||||
End Sub
|
||||
|
||||
'This event will be called once, before the page becomes visible.
|
||||
Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
Root = Root1
|
||||
'load the layout to Root
|
||||
Root.LoadLayout("nota2")
|
||||
borra.Visible = False
|
||||
Titulo.Text = "Acumulado"
|
||||
b_desc.Visible = False
|
||||
End Sub
|
||||
|
||||
|
||||
Sub B4XPage_Appear
|
||||
' p_nota.Height = Root.Height
|
||||
' p_nota.Width = Root.Width
|
||||
Panel1.Visible = False
|
||||
If Not(Starter.gps.GPSEnabled) Then
|
||||
ToastMessageShow("Es necesario tener el GPS encendido", True)
|
||||
StartActivity(Starter.gps.LocationSettingsIntent)
|
||||
End If
|
||||
L_CANT.Text =""
|
||||
L_TOTAL.Text=""
|
||||
c=B4XPages.MainPage.skmt.ExecQuery("select count(*) as EXISTE from HIST_VENTAS WHERE HVD_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
C.Position=0
|
||||
Existe = C.GetString("EXISTE")
|
||||
C.Close
|
||||
c=B4XPages.MainPage.skmt.ExecQuery("select HVD_CLIENTE,HVD_PRONOMBRE,HVD_CANT,HVD_COSTO_TOT, HVD_FECHA from HIST_VENTAS WHERE HVD_CLIENTE IN (Select CUENTA from cuentaa) order by HVD_FECHA asc")
|
||||
ListView1.Clear
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
c.Position=i
|
||||
Dim label1 As Label
|
||||
label1 = ListView1.TwoLinesLayout.Label
|
||||
label1.TextSize = 15
|
||||
label1.TextColor = Colors.White
|
||||
Dim label2 As Label
|
||||
label2 = ListView1.TwoLinesLayout.SecondLabel
|
||||
label2.TextSize = 15
|
||||
label2.TextColor = Colors.White
|
||||
ListView1.AddTwoLines(c.GetString("HVD_PRONOMBRE"),"Cantidad #"& c.GetString("HVD_CANT")& " SubTotal $"& c.GetString("HVD_COSTO_TOT")&" Fecha: "& c.GetString("HVD_FECHA"))
|
||||
Next
|
||||
End If
|
||||
If Existe <> 0 Then
|
||||
c=B4XPages.MainPage.skmt.ExecQuery("select SUM(HVD_CANT) AS PC_NOART, SUM(HVD_COSTO_TOT) AS PC_MONTO from HIST_VENTAS where HVD_CLIENTE in (Select CUENTA from cuentaa)")
|
||||
C.Position=0
|
||||
L_CANT.Text = c.GetString("PC_NOART")
|
||||
L_TOTAL.Text = c.GetString("PC_MONTO")
|
||||
End If
|
||||
ListView1.Visible = False
|
||||
' CustomListView1.AsView.Visible = True
|
||||
CustomListView1.AsView.Height = Root.Height * 0.45
|
||||
CustomListView1.Clear
|
||||
Dim prohit As Cursor = B4XPages.MainPage.skmt.ExecQuery("select distinct HVD_PRONOMBRE from HIST_VENTAS WHERE HVD_CLIENTE IN (Select CUENTA from cuentaa) order by HVD_PRONOMBRE asc")
|
||||
|
||||
If prohit.RowCount > 0 Then
|
||||
|
||||
' --- Bucle 1: Recorrer cada producto ---
|
||||
For sfdf = 0 To prohit.RowCount - 1
|
||||
prohit.Position = sfdf
|
||||
Dim nombreProducto As String = prohit.GetString("HVD_PRONOMBRE")
|
||||
|
||||
' 1. Preparamos las variables para las 4 semanas
|
||||
' (Sem4 = hace 28 días, Sem1 = hace 7 días)
|
||||
Dim cant_sem4 As String = "0"
|
||||
Dim cant_sem3 As String = "0"
|
||||
Dim cant_sem2 As String = "0"
|
||||
Dim cant_sem1 As String = "0"
|
||||
|
||||
' --- 2. Query 2: (MODIFICADO) ---
|
||||
' Este es el query de SQLite que hicimos, adaptado
|
||||
' para usar la variable 'nombreProducto'
|
||||
Dim sql As String = $"
|
||||
WITH FechasObjetivo (Fecha) AS (
|
||||
SELECT strftime('%d/%m/%Y', date('now', 'localtime', '-28 days'))
|
||||
UNION ALL
|
||||
SELECT strftime('%d/%m/%Y', date('now', 'localtime', '-21 days'))
|
||||
UNION ALL
|
||||
SELECT strftime('%d/%m/%Y', date('now', 'localtime', '-14 days'))
|
||||
UNION ALL
|
||||
SELECT strftime('%d/%m/%Y', date('now', 'localtime', '-7 days'))
|
||||
)
|
||||
SELECT
|
||||
COALESCE(SUM(H.HVD_CANT), 0) AS HVD_CANT_TOTAL
|
||||
FROM
|
||||
FechasObjetivo AS F
|
||||
LEFT JOIN
|
||||
HIST_VENTAS AS H
|
||||
ON F.Fecha = H.HVD_FECHA
|
||||
AND H.HVD_CLIENTE IN (SELECT CUENTA FROM cuentaa)
|
||||
AND H.HVD_PRONOMBRE = '${nombreProducto}'
|
||||
GROUP BY
|
||||
F.Fecha
|
||||
ORDER BY
|
||||
SUBSTR(F.Fecha, 7, 4),
|
||||
SUBSTR(F.Fecha, 4, 2),
|
||||
SUBSTR(F.Fecha, 1, 2)
|
||||
"$
|
||||
|
||||
' Log($"Ejecutando para: ${nombreProducto}")
|
||||
' Log(sql) ' Descomenta esto si necesitas depurar el query
|
||||
|
||||
Dim prohit2 As Cursor = B4XPages.MainPage.skmt.ExecQuery(sql)
|
||||
|
||||
' --- 3. Leer los 4 resultados (YA NO NECESITAMOS BUCLE) ---
|
||||
' Sabemos que el query SIEMPRE devuelve 4 filas
|
||||
' en el orden correcto (hace 28, 21, 14, 7 días)
|
||||
Log(prohit2.RowCount)
|
||||
If prohit2.RowCount = 4 Then
|
||||
prohit2.Position = 0
|
||||
cant_sem4 = prohit2.GetString("HVD_CANT_TOTAL") ' Fila 1 (-28 días)
|
||||
|
||||
prohit2.Position = 1
|
||||
cant_sem3 = prohit2.GetString("HVD_CANT_TOTAL") ' Fila 2 (-21 días)
|
||||
|
||||
prohit2.Position = 2
|
||||
cant_sem2 = prohit2.GetString("HVD_CANT_TOTAL") ' Fila 3 (-14 días)
|
||||
|
||||
prohit2.Position = 3
|
||||
cant_sem1 = prohit2.GetString("HVD_CANT_TOTAL") ' Fila 4 (-7 días)
|
||||
Else
|
||||
Log($"Error: El query no devolvió 4 filas para '${nombreProducto}'"$)
|
||||
End If
|
||||
|
||||
prohit2.Close ' Cerramos el cursor interno
|
||||
|
||||
Dim promx As Double = (cant_sem4 + cant_sem3 + cant_sem2 + cant_sem1) / 4
|
||||
|
||||
|
||||
CustomListView1.Add(CreateListItem(nombreProducto, cant_sem4, cant_sem3, cant_sem2, cant_sem1, promx ), 1)
|
||||
|
||||
Next
|
||||
|
||||
prohit.Close ' Cerramos el cursor externo
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Sub CreateListItem(prodhis As String, s1 As Int, s2 As Int, s3 As Int,s4 As Int, prom As Double) As Panel 'ignore
|
||||
Dim p As B4XView = xui.CreatePanel("")
|
||||
p.SetLayoutAnimated(0, 0, 0, 288dip, 170dip)
|
||||
p.LoadLayout("historicobat")
|
||||
l_productohist.Text = prodhis
|
||||
l_s1.Text = s1
|
||||
l_s2.Text = s2
|
||||
l_s3.Text = s3
|
||||
l_s4.Text = s4
|
||||
L_PROMEDIOHIST.text = "Promedio " & prom
|
||||
|
||||
Return p
|
||||
End Sub
|
||||
Binary file not shown.
BIN
B4A/Files/historicobat.bal
Normal file
BIN
B4A/Files/historicobat.bal
Normal file
Binary file not shown.
BIN
B4A/Files/historicobat2.bal
Normal file
BIN
B4A/Files/historicobat2.bal
Normal file
Binary file not shown.
Binary file not shown.
BIN
B4A/Files/nota2.bal
Normal file
BIN
B4A/Files/nota2.bal
Normal file
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -19,6 +19,8 @@ ModuleBookmarks24=
|
||||
ModuleBookmarks25=
|
||||
ModuleBookmarks26=
|
||||
ModuleBookmarks27=
|
||||
ModuleBookmarks28=
|
||||
ModuleBookmarks29=
|
||||
ModuleBookmarks3=
|
||||
ModuleBookmarks4=
|
||||
ModuleBookmarks5=
|
||||
@@ -47,6 +49,8 @@ ModuleBreakpoints24=
|
||||
ModuleBreakpoints25=
|
||||
ModuleBreakpoints26=
|
||||
ModuleBreakpoints27=
|
||||
ModuleBreakpoints28=
|
||||
ModuleBreakpoints29=
|
||||
ModuleBreakpoints3=
|
||||
ModuleBreakpoints4=
|
||||
ModuleBreakpoints5=
|
||||
@@ -64,17 +68,19 @@ ModuleClosedNodes14=
|
||||
ModuleClosedNodes15=
|
||||
ModuleClosedNodes16=
|
||||
ModuleClosedNodes17=
|
||||
ModuleClosedNodes18=4
|
||||
ModuleClosedNodes18=
|
||||
ModuleClosedNodes19=
|
||||
ModuleClosedNodes2=
|
||||
ModuleClosedNodes20=
|
||||
ModuleClosedNodes20=4
|
||||
ModuleClosedNodes21=
|
||||
ModuleClosedNodes22=
|
||||
ModuleClosedNodes23=
|
||||
ModuleClosedNodes24=
|
||||
ModuleClosedNodes25=4,6,7,8,9
|
||||
ModuleClosedNodes25=
|
||||
ModuleClosedNodes26=
|
||||
ModuleClosedNodes27=
|
||||
ModuleClosedNodes27=4,6,7,8,9
|
||||
ModuleClosedNodes28=
|
||||
ModuleClosedNodes29=
|
||||
ModuleClosedNodes3=
|
||||
ModuleClosedNodes4=
|
||||
ModuleClosedNodes5=
|
||||
@@ -82,6 +88,6 @@ ModuleClosedNodes6=
|
||||
ModuleClosedNodes7=6,8,9,10,11
|
||||
ModuleClosedNodes8=
|
||||
ModuleClosedNodes9=
|
||||
NavigationStack=C_Cliente,HabilitarBotones,1319,0,C_Cliente,MejorarPrecisionGPS,1234,0,C_Cliente,B4XPage_Appear,1217,0,C_Cliente,GPS_LocationChanged,1617,0,C_Cliente,RevisarGeocerca,1303,4,C_Cliente,TraeCantProd,1276,0,C_Cliente,B_IMP_Click,2866,1,C_Cliente,Impresion,3252,0,C_Cliente,Impresion2,3076,0,C_Cliente,Impresion3,2881,0,C_Cliente,PDFGENERAR,5738,0
|
||||
NavigationStack=C_Principal,JobDone,1463,0,B4XMainPage,B4XPage_Created,206,0,C_Cliente,Class_Globals,464,0,C_Cliente,B4XPage_Created,483,0,C_Principal,cargar_Click,1142,0,C_Cliente,B4XPage_Appear,1263,6,C_Cliente,gest_Click,1899,0,C_Cliente,compra,2036,0,Diseñador Visual,cliente.bal,-100,6,C_Cliente,Cuestionario,5242,0
|
||||
SelectedBuild=0
|
||||
VisibleModules=25,2,14,26,5,10,11,20,19,16
|
||||
VisibleModules=27,2,16,28,5,12,13,22,21,18
|
||||
|
||||
83
B4A/Subs.bas
83
B4A/Subs.bas
@@ -741,7 +741,7 @@ Sub borraPedidoClienteActual As String
|
||||
' Return 1
|
||||
Private thisC As Cursor
|
||||
' Private tablaProds As String = "cat_gunaprod2"
|
||||
thisC=Starter.skmt.ExecQuery("select PE_PROID, PE_CANT, PE_FOLIO FROM PEDIDO where pe_cliente in (Select CUENTA from cuentaa) ")
|
||||
thisC=Starter.skmt.ExecQuery("select PE_PROID, PE_CANT, PE_FOLIO FROM PEDIDO where pe_cliente in (Select CUENTA from cuentaa) AND PE_CEDIS <> 'DUR'")
|
||||
If thisC.RowCount>0 Then
|
||||
For i=0 To thisC.RowCount -1
|
||||
thisC.Position = i
|
||||
@@ -759,7 +759,7 @@ End Sub
|
||||
|
||||
'Regresa el total del pedido en la tabla "PEDIDO" del cliente actual.
|
||||
Sub totalPedido As String
|
||||
Private cT As Cursor = Starter.skmt.ExecQuery($"select sum(PE_COSTO_TOT) as total from PEDIDO where PE_CLIENTE = '${traeCliente}'"$)
|
||||
Private cT As Cursor = Starter.skmt.ExecQuery($"select sum(PE_COSTO_TOT) as total from PEDIDO where PE_CLIENTE = '${traeCliente}' AND PE_CEDIS <> 'DUR'"$)
|
||||
Private pTotal As String = "0"
|
||||
If cT.RowCount > 0 Then
|
||||
cT.Position = 0
|
||||
@@ -1755,40 +1755,71 @@ Sub traeUsarIntentBDWA As Boolean 'ignore
|
||||
Return BDWA
|
||||
End Sub
|
||||
|
||||
Sub actualizaProducto(cedis As String, costoU As String, cant As String, nombre As String, prodId As String, clienteId As String, fecha As String, usuario As String, rutaV As String, precioSin As String, tipoVenta As String)
|
||||
Sub actualizaProducto(cedis As String, costoU As String, cant As String, nombre As String, prodId As String, clienteId As String, fecha As String, usuario As String, rutaV As String, precioSin As String, tipoVenta As String,dev As String)
|
||||
If nombre.Length < 6 Then ToastMessageShow("(actualizaProducto) El nombre del producto no es valido " & nombre, True)
|
||||
precioSin = NumberFormat2(precioSin, 1, 2, 2, False)
|
||||
costoU = NumberFormat2(costoU, 1, 2, 2, False)
|
||||
LogColor($"actualizaProducto, c=${clienteId}, p=${prodId}, nombre=${nombre}, cant=${cant}, cedis=${cedis}, tipo=${tipoVenta}"$, Colors.Magenta)
|
||||
' Private tablaProds As String = "cat_gunaprod2"
|
||||
' If tipoVenta = "ABORDO" Then tablaProds = "cat_gunaprod"
|
||||
Private c As Cursor=Starter.skmt.ExecQuery($"select * from pedido where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}'"$)
|
||||
If c.RowCount > 0 Then
|
||||
If dev = 0 Then
|
||||
Private c As Cursor=Starter.skmt.ExecQuery($"select * from pedido where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' and PE_CEDIS <> 'DUR'"$)
|
||||
If c.RowCount > 0 Then
|
||||
' LogColor("ACTUALIZAMOS PROD - " & traeTablaProds(tipoVenta), Colors.Blue)
|
||||
c.Position = 0
|
||||
Private antCant As Int = 0
|
||||
If IsNumber(c.GetInt("PE_CANT")) Then antCant=c.GetInt("PE_CANT")
|
||||
Private difCant As Int = cant - antCant
|
||||
Starter.skmt.ExecNonQuery($"update pedido set pe_cant = ${cant}, pe_costo_tot = ${NumberFormat2((cant*c.GetString("PE_COSTOU")), 1, 2, 2, False)}, pe_folio = '${tipoVenta}' where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' "$)
|
||||
If cedis <> "DUR" Then Starter.skmt.ExecNonQuery($"update ${traeTablaProds(tipoVenta)} set cat_gp_almacen = cat_gp_almacen - (${difCant}) where cat_gp_id = '${prodId}' "$)
|
||||
If cant = 0 Then
|
||||
LogColor($"BORRAMOS PRODUCTO - ${prodId}"$, Colors.Red)
|
||||
Starter.skmt.ExecNonQuery($"delete from pedido where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' "$)
|
||||
Log($"Borramos pe_cedis='${cedis}' and pe_proid='${prodId}' and pe_cliente='${clienteId}'"$)
|
||||
Private pe As Cursor = Starter.skmt.ExecQuery("select count(pe_cliente) as cuantosPedidos from pedido where pe_cliente In (select cuenta from cuentaa)")
|
||||
pe.Position=0
|
||||
If pe.GetString("cuantosPedidos") = 0 Then
|
||||
Log("###### delete from pedido_cliente - " & traeCliente & "|" & clienteId)
|
||||
Log($"delete from pedido_cliente where PC_CLIENTE = '${traeCliente}'"$)
|
||||
Starter.skmt.ExecNonQuery($"delete from pedido_cliente where PC_CLIENTE = '${traeCliente}'"$)
|
||||
c.Position = 0
|
||||
Private antCant As Int = 0
|
||||
If IsNumber(c.GetInt("PE_CANT")) Then antCant=c.GetInt("PE_CANT")
|
||||
Private difCant As Int = cant - antCant
|
||||
Starter.skmt.ExecNonQuery($"update pedido set pe_cant = ${cant}, pe_costo_tot = ${NumberFormat2((cant*c.GetString("PE_COSTOU")), 1, 2, 2, False)}, pe_folio = '${tipoVenta}' where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' "$)
|
||||
If cedis <> "DUR" Then Starter.skmt.ExecNonQuery($"update ${traeTablaProds(tipoVenta)} set cat_gp_almacen = cat_gp_almacen - (${difCant}) where cat_gp_id = '${prodId}' "$)
|
||||
If cant = 0 Then
|
||||
LogColor($"BORRAMOS PRODUCTO - ${prodId}"$, Colors.Red)
|
||||
Starter.skmt.ExecNonQuery($"delete from pedido where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' "$)
|
||||
Log($"Borramos pe_cedis='${cedis}' and pe_proid='${prodId}' and pe_cliente='${clienteId}'"$)
|
||||
Private pe As Cursor = Starter.skmt.ExecQuery("select count(pe_cliente) as cuantosPedidos from pedido where pe_cliente In (select cuenta from cuentaa)")
|
||||
pe.Position=0
|
||||
If pe.GetString("cuantosPedidos") = 0 Then
|
||||
Log("###### delete from pedido_cliente - " & traeCliente & "|" & clienteId)
|
||||
Log($"delete from pedido_cliente where PC_CLIENTE = '${traeCliente}'"$)
|
||||
Starter.skmt.ExecNonQuery($"delete from pedido_cliente where PC_CLIENTE = '${traeCliente}'"$)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
'INSERTAMOS
|
||||
Else
|
||||
'INSERTAMOS
|
||||
' LogColor("INSERTAMOS PROD", Colors.red)
|
||||
If cant > 0 Then guardaProductoSinGestion(cedis, costoU, cant, nombre, prodId, clienteId, fecha, usuario, rutaV, precioSin, tipoVenta)
|
||||
If cant > 0 Then guardaProductoSinGestion(cedis, costoU, cant, nombre, prodId, clienteId, fecha, usuario, rutaV, precioSin, tipoVenta)
|
||||
End If
|
||||
c.Close
|
||||
Else If dev = 1 Then
|
||||
Private c As Cursor=Starter.skmt.ExecQuery($"select * from pedido where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' and PE_CEDIS = 'DUR'"$)
|
||||
If c.RowCount > 0 Then
|
||||
' LogColor("ACTUALIZAMOS PROD - " & traeTablaProds(tipoVenta), Colors.Blue)
|
||||
c.Position = 0
|
||||
Private antCant As Int = 0
|
||||
If IsNumber(c.GetInt("PE_CANT")) Then antCant=c.GetInt("PE_CANT")
|
||||
Private difCant As Int = cant - antCant
|
||||
Starter.skmt.ExecNonQuery($"update pedido set pe_cant = ${cant}, pe_costo_tot = ${NumberFormat2((cant*c.GetString("PE_COSTOU")), 1, 2, 2, False)}, pe_folio = '${tipoVenta}' where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' "$)
|
||||
If cedis <> "DUR" Then Starter.skmt.ExecNonQuery($"update ${traeTablaProds(tipoVenta)} set cat_gp_almacen = cat_gp_almacen - (${difCant}) where cat_gp_id = '${prodId}' "$)
|
||||
If cant = 0 Then
|
||||
LogColor($"BORRAMOS PRODUCTO - ${prodId}"$, Colors.Red)
|
||||
Starter.skmt.ExecNonQuery($"delete from pedido where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' "$)
|
||||
Log($"Borramos pe_cedis='${cedis}' and pe_proid='${prodId}' and pe_cliente='${clienteId}'"$)
|
||||
Private pe As Cursor = Starter.skmt.ExecQuery("select count(pe_cliente) as cuantosPedidos from pedido where pe_cliente In (select cuenta from cuentaa)")
|
||||
pe.Position=0
|
||||
If pe.GetString("cuantosPedidos") = 0 Then
|
||||
Log("###### delete from pedido_cliente - " & traeCliente & "|" & clienteId)
|
||||
Log($"delete from pedido_cliente where PC_CLIENTE = '${traeCliente}'"$)
|
||||
Starter.skmt.ExecNonQuery($"delete from pedido_cliente where PC_CLIENTE = '${traeCliente}'"$)
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
'INSERTAMOS
|
||||
' LogColor("INSERTAMOS PROD", Colors.red)
|
||||
If cant > 0 Then guardaProductoSinGestion(cedis, costoU, cant, nombre, prodId, clienteId, fecha, usuario, rutaV, precioSin, tipoVenta)
|
||||
End If
|
||||
c.Close
|
||||
End If
|
||||
c.Close
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
@@ -425,7 +425,7 @@ Private Sub CreateLocationRequest As LocationRequest
|
||||
lr.Initialize
|
||||
lr.SetInterval(1) 'Intervalo deseado para actualizaciones de ubicacion
|
||||
lr.SetFastestInterval(lr.GetInterval / 2) 'Intervalo minimo para actualizaciones de ubicacion
|
||||
lr.SetSmallestDisplacement(0) 'Solo registra cambio de ubicacion si es mayor a XX mts
|
||||
lr.SetSmallestDisplacement(10) 'Solo registra cambio de ubicacion si es mayor a XX mts
|
||||
lr.SetPriority(lr.Priority.PRIORITY_HIGH_ACCURACY)
|
||||
actualLR=lr
|
||||
Return lr
|
||||
@@ -438,7 +438,7 @@ Private Sub CreateLocationRequestSmallD As LocationRequest
|
||||
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.SetSmallestDisplacement(0) 'Solo registra cambio de ubicacion si es mayor a XX mts
|
||||
lr.SetPriority(lr.Priority.PRIORITY_HIGH_ACCURACY)
|
||||
actualLR=lr
|
||||
Return lr
|
||||
@@ -529,6 +529,9 @@ Sub flp_LocationChanged (Location1 As Location)
|
||||
If B4XPages.MainPage.cliente.IsInitialized Then
|
||||
CallSub2(B4XPages.GetPage("Cliente"), "GPS_LocationChanged", Location1)
|
||||
End If
|
||||
If B4XPages.MainPage.nuevoCliente.IsInitialized Then
|
||||
CallSub2(B4XPages.GetPage("nuevocliente"), "GPS_LocationChanged", Location1)
|
||||
End If
|
||||
' CallSub2(nuevocliente, "GPS_LocationChanged", Location1)
|
||||
End Sub
|
||||
|
||||
|
||||
Reference in New Issue
Block a user