20/12/23 - Correcciones en el abordo, carga local y boton de noVenta

- En los productos del pedido de abordo ahora aparece el inventario que traen en ese momento.
- Al hacer la restauracion de carga local mandaba un error.
- El boton de NoVenta aparecia momentaneamente al poner una contraseña equivocada en la geocerca.
This commit is contained in:
2023-12-20 15:12:53 -06:00
parent 7f867fac04
commit b5112ea8c4
8 changed files with 73 additions and 32 deletions

View File

@@ -720,7 +720,10 @@ Private Sub b_cargaLocalOk_Click
If et_cargaLocal.Text.StartsWith(pass1) Then
p_cargaLocal.Visible = False
' Log(et_cargaLocal.Text.Length > pass1.Length)
kh.RD_fechaRestauracion = ""
' kh.RD_fechaRestauracion = DateTime.now 'Se va a restaurar el respaldo de la fecha de HOY
If et_cargaLocal.Text.Length > pass1.Length Then
Private dias As String = et_cargaLocal.Text.SubString(pass1.Length).Trim
' Log("|" & dias & "|")
@@ -729,12 +732,12 @@ Private Sub b_cargaLocalOk_Click
p.Days = dias
Dim nextdate As Long = DateUtils.AddPeriod(DateTime.Now, p)
kh.RD_fechaRestauracion = nextdate
' Log($"Next date: $Date{nextdate}"$) ' Next date: 20231018
Log($"Next date: $Date{nextdate}"$) ' Next date: 20231018
Else
Log("NOT NUMBER")
End If
End If
kh.revisaRkmtAttached
kh.RD_restaura_cat_gunaprod
kh.RD_restaura_cat_gunaprod2

View File

@@ -811,6 +811,7 @@ Sub GPS_LocationChanged (Location1 As Location)
If gps_boton_doe = "1" And clienteConPromo = "0" And revisaExistenciasDOE Then b_whats.Visible = True
If Not(clienteDeudor) Then B_VENTA.Visible = True 'Si el cliente no tiene adeudo, habilitamos el boton de venta
If Not(clienteId.StartsWith("N")) And la_cuenta.Text <> "0" Then b_noVenta.Visible = True 'Ni cliente nuevo, ni abordo.
If Not(p_rechazoDOE.Visible) Then pedido_doe_muestra
Else
b_noVenta.Visible = False
@@ -3906,7 +3907,6 @@ Private Sub b_geopass_Click
Log($"${Starter.DBReqServer}, ${et_geopass.Text}, ${Subs.traeAlmacen}, ${Subs.traeRuta}"$)
et_geopass.Text = ""
End If
If Not(clienteId.StartsWith("N")) And la_cuenta.Text <> "0" Then b_noVenta.Visible = True 'Ni cliente nuevo, ni abordo.
p_pideGeoPass.Visible = False
ime.HideKeyboard
' Log("Guardamos coords")

View File

@@ -1540,7 +1540,7 @@ Sub JobDone(Job As HttpJob)
S_CP.Text = "VALIDANDO"
End If
End If
If Job.JobName = "DBRequest" Then
Dim RESULT As DBResult = reqManager.HandleJob(Job)
If RESULT.Tag = "version" Then 'query tag
@@ -1552,7 +1552,7 @@ Sub JobDone(Job As HttpJob)
Next
End If
End If
If Job.JobName = "DBRequest" Then
Dim RESULT As DBResult = reqManager.HandleJob(Job)
If RESULT.Tag = "count_cli" Then 'query tag

View File

@@ -162,6 +162,7 @@ Sub B4XPage_Appear
' clv_prods_ll.Initialize(Me, "clv_prods_ll")
' list_prodsPedido.Initialize
' Log("list_prodsPedido.Initialize")
l_avisoAbordo.Visible = False
clienteId = Subs.traeCliente
l_infoPedido.Text = ""
If clienteId = 0 Then
@@ -748,7 +749,8 @@ Sub cuentaProds
' Log(Subs.totalPedido)
If lfila.Text = "RMI" Then l_mDisponible.Visible = True Else l_mDisponible.Visible = False
l_mDisponible.Text = $"Disponible: $${Subs.totalPedido}"$
b_continuar.Visible = True
b_terminar1.Visible = True
' Log(clienteId)
If clienteId = "0" Then
' LogColor($" DispoAbordoWeb: ${kh.traeLimiteAbordoWeb}${CRLF}
@@ -757,16 +759,18 @@ Sub cuentaProds
' Venta Abordo: ${kh.traeVentaAbordo} "$, Colors.red)
l_infoPedido.Text = $"LimiteAbordo: ${NumberFormat2(kh.traeLimiteAbordoWeb,1,2,1,True)} TotalInv: ${NumberFormat2(kh.traeLimiteAbordoXInventario,1,2,1,True)}
Venta: ${NumberFormat2(kh.traeVenta,1,2,1,True)} VentaAbordo: ${NumberFormat2(kh.traeVentaAbordo,1,2,1,True)} "$
' Log($"${kh.traeLimiteAbordoXInventario} - ${kh.traeVenta} - ${kh.traeLimiteAbordoWeb}"$)
' Log($"LIMITE ABORDO DISPONIBLE: ${NumberFormat2((kh.traeLimiteAbordoWeb - (kh.traeLimiteAbordoXInventario - kh.traeVenta) - kh.traeVentaAbordo), 0, 2, 2, False)}"$)
Log($"${kh.traeLimiteAbordoXInventario} - ${kh.traeVenta} - ${kh.traeLimiteAbordoWeb}"$)
Log($"LIMITE ABORDO DISPONIBLE: ${NumberFormat2((kh.traeLimiteAbordoWeb - (kh.traeLimiteAbordoXInventario - kh.traeVenta) - kh.traeVentaAbordo), 0, 2, 2, False)}"$)
dispAbordo = kh.traeDisponibleAbordo
l_limiteAbordoDisp.Text = $"Disp Abordo: $${dispAbordo}"$
If dispAbordo < 1 And kh.traeCliente = 0 Then
' Log("SI ABORDO")
b_continuar.Visible = False
b_terminar1.Visible = False
l_avisoAbordo.BringToFront
l_avisoAbordo.Visible = True
Else
' Log("NO ABORDO")
l_avisoAbordo.Visible = False
b_continuar.Visible = True
b_terminar1.Visible = True
@@ -1033,12 +1037,19 @@ Private Sub lv_prodsPedido_ItemLongClick (Position As Int, Value As Object)
End Sub
Private Sub clv_prods_ll_ItemClick (Index As Int, Value As Object)
End Sub
Sub l_prodX_Click
Log("l_prodx clicked")
l_info.Text = Sender.as(Label).text
'Traemos el inventario de abordo de este producto.
Private i As Cursor = Starter.skmt.ExecQuery($"select CAT_GP_ALMACEN from cat_gunaprod2 where CAT_GP_ID = '${Sender.as(Label).tag}'"$)
Private abordo As String = "0"
If i.RowCount > 0 Then
i.Position = 0
abordo = i.GetString("CAT_GP_ALMACEN")
End If
l_info.Text = Sender.as(Label).text & CRLF & $"Inv. abordo: ${abordo}"$
Log(Sender.as(Label).tag)
l_info.BringToFront
l_info.Visible = True
@@ -1122,7 +1133,7 @@ Private Sub clv_prods_ll_VisibleRangeChanged (FirstIndex As Int, LastIndex As In
Private precio As String=NumberFormat2(clv_prods_ll.GetValue(i).As(Map).Get("precio").As(Double),1,2,2,False)
If clv_prods_ll.GetValue(i).As(Map).Get("cant") <> Null Then et_pCant.Text = clv_prods_ll.GetValue(i).As(Map).Get("cant")
l_prodX.Text = cs.Color(Colors.red).append(clv_prods_ll.GetValue(i).As(Map).Get("prod")).pop.append(CRLF).Append("Existencias: " & clv_prods_ll.GetValue(i).As(Map).Get("almacen")).Color(0xFF017F01).Append($" $${precio}"$).Popall
l_prodX.Tag = clv_prods_ll.GetValue(i).As(Map).Get("almacen")
l_prodX.Tag = clv_prods_ll.GetValue(i).As(Map).Get("id")
l_pCant.Tag = clv_prods_ll.GetValue(i).As(Map).Get("id")
End If
' Log($"${i}, ${FirstIndex}, ${LastIndex}, ${Pnl.NumberOfViews}. ${clv_prods_ll.Size}"$)

View File

@@ -870,7 +870,7 @@ Version=12.5
#Region Project Attributes
#ApplicationLabel: Kelloggs Venta
#VersionCode: 3000
#VersionName: 3.12.14 P-V4
#VersionName: 3.12.19 P-V4
#SupportedOrientations: portrait
#CanInstallToExternalStorage: False
#BridgeLogger:true

View File

@@ -91,6 +91,6 @@ ModuleClosedNodes6=
ModuleClosedNodes7=11,12
ModuleClosedNodes8=
ModuleClosedNodes9=
NavigationStack=Visual Designer,productos.bal,-100,2,DBRequestManager,HandleJob,233,0,Visual Designer,principal.bal,-100,6,C_Principal,t1_tick,2121,0,C_Principal,Subir_Click,508,0,DBRequestManager,trackNext,333,0,C_Principal,SUBIR_INFO_PEDIDO,2711,0,C_Principal,B_OK_PAS_Click,2188,6,C_Principal,SUBIR_INFO_BOLETA,2937,0,C_Principal,JobDone,1533,6
NavigationStack=C_Productos,lv_prodsPedido_ItemLongClick,1016,5,Visual Designer,cliente.bal,-100,5,C_Productos,B4XPage_Appear,157,2,C_Productos,et_pCant_FocusChanged,731,0,Visual Designer,productos.bal,-100,6,C_Productos,cuentaProds,766,6,C_Productos,b_prodMas_Click,600,0,C_Productos,clv_prods_ll_VisibleRangeChanged,1127,1,C_Productos,clv_prods_ll_ItemClick,1035,0,C_Productos,l_prodX_Click,1057,6,B4XMainPage,b_cargaLocalOk_Click,717,0
SelectedBuild=0
VisibleModules=1,28,11,24,3,12,7,4,29,2

View File

@@ -1156,8 +1156,10 @@ Sub traePromosVendidas(promo As String, cliente As String) As Int
Return pv
End Sub
'3799, 7226, 7228, 7230
Sub procesaPromocion(idPromo As String, cliente As String) As Map 'ignore
Private thisLog As Boolean = False 'Si es verdadero, muestra los logs de este sub.
Private thisLog As Boolean = True 'Si es verdadero, muestra los logs de este sub.
Private inicioContador As String = DateTime.Now
Private mp = 0
If thisLog Then LogColor($"********* Iniciamos revision de Promo ${idPromo} *********"$, Colors.red)

View File

@@ -186,7 +186,11 @@ Sub RD_restaura_cat_gunaprod
skmt.ExecNonQuery($"insert into CAT_GUNAPROD (${lasCols}) select ${lasCols} from rkmt1.CAT_GUNAPROD where fecha = '${c.GetString("FECHA")}'"$)
Log($"insert into CAT_GUNAPROD (${lasCols}) select ${lasCols} from rkmt1.CAT_GUNAPROD where fecha = '${c.GetString("FECHA")}'"$)
Else
ToastMessageShow($"No hay respaldo GP para la fecha ${fechaRestauracion.SubString(fechaRestauracion.Length - 10)}"$, True)
If fechaRestauracion.Length > 0 Then
ToastMessageShow($"No hay respaldo GP para la fecha ${fechaRestauracion.SubString(fechaRestauracion.Length - 10)}"$, True)
Else
ToastMessageShow($"No hay respaldo GP para la fecha"$, True)
End If
End If
Log("R-GP: " & ((DateTime.Now - inicio)/1000) & " segs")
End Sub
@@ -220,12 +224,16 @@ Sub RD_restaura_cat_gunaprod2
' Log(c.RowCount)
If c.RowCount > 0 Then
c.Position = 0
' Log(c.GetString("FECHA"))
Log(c.GetString("FECHA"))
skmt.ExecNonQuery("delete from CAT_GUNAPROD2")
skmt.ExecNonQuery($"insert into CAT_GUNAPROD2 (${lasCols}) select ${lasCols} from rkmt1.CAT_GUNAPROD2 where fecha = '${c.GetString("FECHA")}'"$)
Log($"insert into CAT_GUNAPROD2 (${lasCols}) select ${lasCols} from rkmt1.CAT_GUNAPROD2 where fecha = '${c.GetString("FECHA")}'"$)
Else
ToastMessageShow($"No hay respaldo GP2 para la fecha ${fechaRestauracion.SubString(fechaRestauracion.Length - 10)}"$, True)
If fechaRestauracion.Length > 0 Then
ToastMessageShow($"No hay respaldo GP2 para la fecha ${fechaRestauracion.SubString(fechaRestauracion.Length - 10)}"$, True)
Else
ToastMessageShow($"No hay respaldo GP2 para la fecha"$, True)
End If
End If
'Agregamos al inventario las cantidades del abordo
@@ -238,18 +246,19 @@ Sub RD_restaura_cat_gunaprod2
sqlAbordo = "and PE_TIPO = 'ABORDO'"
sqlfechaAbordo = ""
End If
Private a As Cursor = rkmt.ExecQuery($"select * from PEDIDO ${fechaRestauracion} ${sqlAbordo} ${sqlfechaAbordo} order by fecha desc"$) 'where fecha <> '${fechaHoy}' 'Traemos la ultima fecha antes de hoy.
Log($"select * from PEDIDO ${fechaRestauracion} ${sqlAbordo} ${sqlfechaAbordo} order by fecha desc"$)
' Private a As Cursor = rkmt.ExecQuery($"select * from PEDIDO ${fechaRestauracion} ${sqlAbordo} ${sqlfechaAbordo} order by fecha desc"$) 'where fecha <> '${fechaHoy}' 'Traemos la ultima fecha antes de hoy.
' Log($"select * from PEDIDO ${fechaRestauracion} ${sqlAbordo} ${sqlfechaAbordo} order by fecha desc"$)
' Log(">>>>>>>> PEDIDOS " & a.RowCount)
If a.RowCount > 0 Then
For i = 0 To a.RowCount - 1
a.Position = i
skmt.ExecNonQuery($"update CAT_GUNAPROD2 set CAT_GP_ALMACEN = CAT_GP_ALMACEN + ${a.GetString("PE_CANT")} where CAT_GP_ID = '${a.GetString("PE_PROID")}'"$)
Log($"update CAT_GUNAPROD2 set CAT_GP_ALMACEN = CAT_GP_ALMACEN + ${a.GetString("PE_CANT")}' where CAT_GP_ID = '${a.GetString("PE_PROID")}'"$)
Next
Else
ToastMessageShow($"No hay respaldo GP2 para la fecha ${fechaRestauracion.SubString(fechaRestauracion.Length - 10)}"$, True)
End If
' If a.RowCount > 0 Then
' For i = 0 To a.RowCount - 1
' a.Position = i
' skmt.ExecNonQuery($"update CAT_GUNAPROD2 set CAT_GP_ALMACEN = CAT_GP_ALMACEN + ${a.GetString("PE_CANT")} where CAT_GP_ID = '${a.GetString("PE_PROID")}'"$)
' Log($"update CAT_GUNAPROD2 set CAT_GP_ALMACEN = CAT_GP_ALMACEN + ${a.GetString("PE_CANT")}' where CAT_GP_ID = '${a.GetString("PE_PROID")}'"$)
' Next
' Else
' Log("|"&fechaRestauracion&"|")
' ToastMessageShow($"No hay respaldo PEDIDO para la fecha ${fechaRestauracion.SubString(fechaRestauracion.Length - 10)}"$, True)
' End If
Log("R-GP2: " & ((DateTime.Now - inicio)/1000) & " segs")
End Sub
@@ -286,7 +295,11 @@ Sub RD_restaura_cat_detalle_paq
skmt.ExecNonQuery($"insert into CAT_DETALLES_PAQ (${lasCols}) select ${lasCols} from rkmt1.CAT_DETALLES_PAQ where fecha = '${c.GetString("FECHA")}'"$)
Log($"insert into CAT_DETALLES_PAQ (${lasCols}) select ${lasCols} from rkmt1.CAT_DETALLES_PAQ where fecha = '${c.GetString("FECHA")}'"$)
Else
ToastMessageShow($"No hay respaldo DP para la fecha ${fechaRestauracion.SubString(fechaRestauracion.Length - 10)}"$, True)
If fechaRestauracion.Length > 0 Then
ToastMessageShow($"No hay respaldo DP para la fecha ${fechaRestauracion.SubString(fechaRestauracion.Length - 10)}"$, True)
Else
ToastMessageShow($"No hay respaldo DP para la fecha"$, True)
End If
End If
Log("R-DP: " & ((DateTime.Now - inicio)/1000) & " segs")
End Sub
@@ -324,7 +337,11 @@ Sub RD_restaura_kmt_info
skmt.ExecNonQuery($"insert into kmt_info (${lasCols}) select ${lasCols} from rkmt1.kmt_info where fecha = '${c.GetString("FECHA")}'"$)
Log($"insert into kmt_info (${lasCols}) select ${lasCols} from rkmt1.kmt_info where fecha = '${c.GetString("FECHA")}'"$)
Else
ToastMessageShow($"No hay respaldo KMTI para la fecha ${fechaRestauracion.SubString(fechaRestauracion.Length - 10)}"$, True)
If fechaRestauracion.Length > 0 Then
ToastMessageShow($"No hay respaldo KMTI para la fecha ${fechaRestauracion.SubString(fechaRestauracion.Length - 10)}"$, True)
Else
ToastMessageShow($"No hay respaldo KMTI para la fecha"$, True)
End If
End If
Log("R-KMT: " & ((DateTime.Now - inicio)/1000) & " segs")
End Sub
@@ -362,7 +379,11 @@ Sub RD_restaura_promos_comp
skmt.ExecNonQuery($"insert into PROMOS_COMP (${lasCols}) select ${lasCols} from rkmt1.PROMOS_COMP where fecha = '${c.GetString("FECHA")}'"$)
Log($"insert into PROMOS_COMP (${lasCols}) select ${lasCols} from rkmt1.PROMOS_COMP where fecha = '${c.GetString("FECHA")}'"$)
Else
ToastMessageShow($"No hay respaldo PC para la fecha ${fechaRestauracion.SubString(fechaRestauracion.Length - 10)}"$, True)
If fechaRestauracion.Length > 0 Then
ToastMessageShow($"No hay respaldo PC para la fecha ${fechaRestauracion.SubString(fechaRestauracion.Length - 10)}"$, True)
Else
ToastMessageShow($"No hay respaldo PC para la fecha"$, True)
End If
End If
Log("R-KMT: " & ((DateTime.Now - inicio)/1000) & " segs")
End Sub
@@ -400,7 +421,11 @@ Sub RD_restaura_cat_rmi
skmt.ExecNonQuery($"insert into CAT_RMI (${lasCols}) select ${lasCols} from rkmt1.CAT_RMI where fecha = '${c.GetString("FECHA")}'"$)
Log($"insert into CAT_RMI (${lasCols}) select ${lasCols} from rkmt1.CAT_RMI where fecha = '${c.GetString("FECHA")}'"$)
Else
ToastMessageShow($"No hay respaldo RMI para la fecha ${fechaRestauracion.SubString(fechaRestauracion.Length - 10)}"$, True)
If fechaRestauracion.Length > 0 Then
ToastMessageShow($"No hay respaldo RMI para la fecha ${fechaRestauracion.SubString(fechaRestauracion.Length - 10)}"$, True)
Else
ToastMessageShow($"No hay respaldo RMI para la fecha"$, True)
End If
End If
Log("R-RMI: " & ((DateTime.Now - inicio)/1000) & " segs")
End Sub