- Se hicieron cambios en el codigo de boton mas y menos y textChanged de las cantidades de productos

This commit is contained in:
2024-05-15 20:11:32 -06:00
parent 21dc3d24da
commit 6dd34e58d4
5 changed files with 103 additions and 58 deletions

View File

@@ -467,35 +467,36 @@ Sub B4XPage_Appear
S1=Starter.skmt.ExecQuery("select count(*) as CUANTOS FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")
S1.Position=0
c.Position=0
la_cuenta.Text = c.GetString("CAT_CL_CODIGO")
La_nombre.Text = c.GetString("CAT_CL_NOMBRE")
la_Calle.Text = "N/A"
If c.RowCount > 0 Then
la_cuenta.Text = c.GetString("CAT_CL_CODIGO")
La_nombre.Text = c.GetString("CAT_CL_NOMBRE")
la_Calle.Text = "N/A"
' Log("|"&c.GetString("CAT_CL_CALLE")&"|")
If c.GetString("CAT_CL_CALLE") <> Null And c.GetString("CAT_CL_CALLE") <> "null" Then la_Calle.Text = c.GetString("CAT_CL_CALLE") & c.GetString("CAT_CL_NOEXT")
la_col.Text = "N/A"
If c.GetString("CAT_CL_COLONIA") <> Null And c.GetString("CAT_CL_COLONIA") <> "null" Then la_col.Text = c.GetString("CAT_CL_COLONIA")
la_edo.Text = "N/A"
If c.GetString("CAT_CL_EDO") <> Null And c.GetString("CAT_CL_EDO") <>"null" Then la_edo.Text = c.GetString("CAT_CL_EDO")
la_cp.Text = c.GetString("CAT_CL_CP")
l_entre1.Text = "N/A"
If c.GetString("CAT_CL_CALLE1") <> Null And c.GetString("CAT_CL_CALLE1") <>"null" Then l_entre1.Text = c.GetString("CAT_CL_CALLE1")
l_entre2.Text = "N/A"
If c.GetString("CAT_CL_CALLE2") <> Null And c.GetString("CAT_CL_CALLE2") <> "null" Then l_entre2.Text = c.GetString("CAT_CL_CALLE2")
l_atiende.Text = "N/A"
If c.GetString("CAT_CL_ATIENDE1") <> Null And c.GetString("CAT_CL_ATIENDE1") <> "null" Then l_atiende.Text = c.GetString("CAT_CL_ATIENDE1")
l_atiende2.Text = c.GetString("CAT_CL_ATIENTE2")
If c.GetString("CAT_CL_CALLE") <> Null And c.GetString("CAT_CL_CALLE") <> "null" Then la_Calle.Text = c.GetString("CAT_CL_CALLE") & c.GetString("CAT_CL_NOEXT")
la_col.Text = "N/A"
If c.GetString("CAT_CL_COLONIA") <> Null And c.GetString("CAT_CL_COLONIA") <> "null" Then la_col.Text = c.GetString("CAT_CL_COLONIA")
la_edo.Text = "N/A"
If c.GetString("CAT_CL_EDO") <> Null And c.GetString("CAT_CL_EDO") <>"null" Then la_edo.Text = c.GetString("CAT_CL_EDO")
la_cp.Text = c.GetString("CAT_CL_CP")
l_entre1.Text = "N/A"
If c.GetString("CAT_CL_CALLE1") <> Null And c.GetString("CAT_CL_CALLE1") <>"null" Then l_entre1.Text = c.GetString("CAT_CL_CALLE1")
l_entre2.Text = "N/A"
If c.GetString("CAT_CL_CALLE2") <> Null And c.GetString("CAT_CL_CALLE2") <> "null" Then l_entre2.Text = c.GetString("CAT_CL_CALLE2")
l_atiende.Text = "N/A"
If c.GetString("CAT_CL_ATIENDE1") <> Null And c.GetString("CAT_CL_ATIENDE1") <> "null" Then l_atiende.Text = c.GetString("CAT_CL_ATIENDE1")
l_atiende2.Text = c.GetString("CAT_CL_ATIENTE2")
b_inicioFinVenta.Text = "INICIAR VENTA"
b_inicioFinVenta.BringToFront
' LogColor(">>>>>> EN VENTA: " & Starter.enVenta, Colors.red)
If Not(Starter.enVenta) And la_cuenta.Text <> "0" Then
b_inicioFinVenta.Visible = True
b_inicioFinVenta.Text = "INICIAR VENTA"
b_inicioFinVenta.BringToFront
' LogColor(">>>>>> EN VENTA: " & Starter.enVenta, Colors.red)
If Not(Starter.enVenta) And la_cuenta.Text <> "0" Then
b_inicioFinVenta.Visible = True
' Log("EnVenta Visible")
Else
Else
' Log("EnVenta NO Visible")
b_inicioFinVenta.Visible = False
End If
' LogColor(">>>>>> EN VENTA: " & Starter.enVenta, Colors.red)
b_inicioFinVenta.Visible = False
End If
' LogColor(">>>>>> EN VENTA: " & Starter.enVenta, Colors.red)
' LONGITUD = 0
' If c.GetString("CAT_CL_LONG") <> Null And c.GetString("CAT_CL_LONG") <> "null" And IsNumber(c.GetString("CAT_CL_LONG")) Then LONGITUD = c.GetString("CAT_CL_LONG")
@@ -506,33 +507,37 @@ Sub B4XPage_Appear
' l_segmento2.text = "N/A"
' If c.GetString("CAT_CL_SEGMENTO") <> Null Then l_segmento2.text = c.GetString("CAT_CL_SEGMENTO")
l_total.Text = kh.traeTotalCliente
total_cliente = s.GetString("TOTAL_CLIE")
l_total.Text = kh.traeTotalCliente
total_cliente = s.GetString("TOTAL_CLIE")
' Log(Subs.sumaPedido(Subs.traeCliente) & " - " & total_cliente)
m_lat =c.GetString("CAT_CL_LAT")
m_lon =c.GetString("CAT_CL_LONG")
CREDITO_DISPONIBLE = c.GetString("CAT_CL_BFACTURA")
CREDITO = c.GetString("CAT_CL_BCREDITO")
ruta_tienda = c.GetString("CAT_CL_RUTA")
YA_IMPRIMIO2 = c.GetString("IMPRESION")
m_lat =c.GetString("CAT_CL_LAT")
m_lon =c.GetString("CAT_CL_LONG")
CREDITO_DISPONIBLE = c.GetString("CAT_CL_BFACTURA")
CREDITO = c.GetString("CAT_CL_BCREDITO")
ruta_tienda = c.GetString("CAT_CL_RUTA")
YA_IMPRIMIO2 = c.GetString("IMPRESION")
' If c.GetString("CAT_CL_EMAIL") = "1" Then
' l_doe.Visible = True
' Else
' l_doe.Visible = False
' End If
If kh.clienteConDOE And l_doe.IsInitialized Then
l_doe.Visible = True
Else
If l_doe.IsInitialized Then l_doe.Visible = False
End If
LONGITUD = 0
If c.GetString("CAT_CL_LONG") <> Null And c.GetString("CAT_CL_LONG") <> "null" And IsNumber(c.GetString("CAT_CL_LONG")) Then LONGITUD = c.GetString("CAT_CL_LONG")
LATITUD = 0
If c.GetString("CAT_CL_LAT") <> Null And c.GetString("CAT_CL_LAT") <> "null" And IsNumber(c.GetString("CAT_CL_LAT")) Then LATITUD = c.GetString("CAT_CL_LAT")
If kh.clienteConDOE And l_doe.IsInitialized Then
l_doe.Visible = True
Else
If l_doe.IsInitialized Then l_doe.Visible = False
End If
LONGITUD = 0
If c.GetString("CAT_CL_LONG") <> Null And c.GetString("CAT_CL_LONG") <> "null" And IsNumber(c.GetString("CAT_CL_LONG")) Then LONGITUD = c.GetString("CAT_CL_LONG")
LATITUD = 0
If c.GetString("CAT_CL_LAT") <> Null And c.GetString("CAT_CL_LAT") <> "null" And IsNumber(c.GetString("CAT_CL_LAT")) Then LATITUD = c.GetString("CAT_CL_LAT")
' LogColor($"${c.GetString("CAT_CL_LAT")}, ${c.GetString("CAT_CL_LONG")}"$, Colors.red)
If logger Then Log($"Lat: ${LATITUD}, Lon: ${LONGITUD}"$)
NOMBRE = c.GetString("CAT_CL_NOMBRE")
If logger Then Log($"Lat: ${LATITUD}, Lon: ${LONGITUD}"$)
NOMBRE = c.GetString("CAT_CL_NOMBRE")
' Log($"TOTAL DE LA VENTA: ${kh.traeTotalCliente}"$)
End If
If kh.traeTotalCliente < 0.01 And kh.traeTotalClienteDOE < 0.01 Then
If Not(clienteId.StartsWith("N")) And la_cuenta.Text <> "0" Then b_noVenta.Visible = True 'Ni cliente nuevo, ni abordo.
Else

View File

@@ -101,6 +101,7 @@ Sub Class_Globals
Private l_avisoAbordo As Label
Private l_infoPedido As Label
Dim promosC As Promociones
Dim invTotal As Int
End Sub
'You can add more parameters here.
@@ -549,6 +550,7 @@ Sub CreateListItem(Text As String, precioU As String, inv As Int, Width As Int,
End Sub
Sub b_prodMenos_Click
Root.RequestFocus
etCantHasFocus = False
' Log(Sender.As(Button).text & "|" & Sender.As(Button).tag)
Private buttonTag As String = Sender.As(Button).tag
@@ -604,9 +606,13 @@ Sub b_prodMenos_Click
End If
If Subs.totalPedido < 1 Then laCant.Text = "0"
' Log($"Total Prods: ${totalProds}, Total Compra: $$1.2{totalCompra}"$)
Sleep(300)
invTotal = laCant.Text + Subs.traeinventario(id)
LogColor("InvTotal PRODMAS: " & invTotal, Colors.Red)
End Sub
Sub b_prodMas_Click
Root.RequestFocus
etCantHasFocus = False
Private buttonTag As String = Sender.As(Button).tag
Dim index As Int = clv_prods_ll.GetItemFromView(Sender)
@@ -666,7 +672,8 @@ Sub b_prodMas_Click
precioX = precioX * -1
End If
Subs.actualizaProducto(almacenX, precioX, laCant.text, nombreX, id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, Starter.tipov)
If Subs.totalPedido < 1 Then
Log($"TotalPedido: ${NumberFormat2(Subs.totalPedido,1,2,2,False)}"$)
If Subs.totalPedido < 0.01 Then
etCantHasFocus = False
Log("A CERO")
laCant.Text = "0"
@@ -706,6 +713,9 @@ Sub b_prodMas_Click
If Starter.tipov <> "ABORDO" Then lProdX.Text = cs.Color(Colors.red).append(nombreX).pop.append(CRLF).Append("Existencias: " & invActualizado).Color(0xFF017F01).Append($" $${NumberFormat2(precio, 1, 2, 2, False)}"$).Popall
End If
Log($"Total Prods: ${totalProds}, Total Compra: $$1.2{totalCompra}"$)
Sleep(300)
invTotal = laCant.Text + Subs.traeinventario(id)
LogColor("InvTotal PRODMAS: " & invTotal, Colors.Red)
End Sub
Private Sub et_pCant_TextChanged (Old As String, New As String)
@@ -718,7 +728,6 @@ Private Sub et_pCant_TextChanged (Old As String, New As String)
Dim pnl0 As B4XView = clv_prods_ll.GetPanel(index)
Dim pnl As B4XView = pnl0.GetView(0)
Private existencias As String = clv_prods_ll.GetValue(index).As(Map).Get("almacen")
' Log($"ExistenciasX: ${existencias}"$)
Dim laCant As B4XView = pnl.GetView(2).GetView(2)
Private id As String=clv_prods_ll.GetValue(index).As(Map).Get("id")
Private precio As String=clv_prods_ll.GetValue(index).As(Map).Get("precio")
@@ -729,13 +738,12 @@ Private Sub et_pCant_TextChanged (Old As String, New As String)
disp = NumberFormat2(disp, 1, 0, 0, False)
If existencias = "" Then existencias = 0
existencias = NumberFormat2(existencias, 1, 0, 0, False)
Log($"${laCant.text}, ${precio}, DISPONIBLES: ${disp}"$)
Private inv As String=clv_prods_ll.GetValue(index).As(Map).Get("almacen")
Private inv As String=clv_prods_ll.GetValue(index).As(Map).Get("almacen")
If(New = "" Or New = Null) Then New = 0
If(New > inv) Then
Sender.As(EditText).text = inv
If(New > invTotal) Then
Sender.As(EditText).text = invTotal
End If
Private almacenX As String = Subs.traeAlmacen
Private nombreX As String = Subs.traeProdNombre(id)
@@ -763,7 +771,9 @@ Private Sub et_pCant_TextChanged (Old As String, New As String)
' End If
Log("REVISAMOS ABORDO DISP")
dispAbordo = kh.traeDisponibleAbordo
LogColor($"traeCliente = ${Subs.traeCliente}, dispAbordo = ${dispAbordo}"$, Colors.red)
If Subs.traeCliente = 0 And dispAbordo < 1 Then
ToastMessageShow("Sobrepasa el limite disponible para el abordo!", False)
Log("######### "& NumberFormat2((kh.traeLimiteAbordoWeb - (kh.traeLimiteAbordoXInventario - kh.traeVenta) - kh.traeVentaAbordo), 0, 2, 2, False))
laCant.Text = NumberFormat2(Old, 1, 0, 0, False)
Subs.actualizaProducto(almacenX, precioX, laCant.text, nombreX, id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, Starter.tipov)
@@ -785,6 +795,13 @@ End Sub
Private Sub et_pCant_FocusChanged (HasFocus As Boolean)
' LogColor($"focus changed=${HasFocus}"$, Colors.Magenta)
etCantHasFocus = HasFocus
Dim index As Int = clv_prods_ll.GetItemFromView(Sender)
Dim pnl0 As B4XView = clv_prods_ll.GetPanel(index)
Dim pnl As B4XView = pnl0.GetView(0)
Dim laCant As B4XView = pnl.GetView(2).GetView(2)
Private id As String=clv_prods_ll.GetValue(index).As(Map).Get("id")
invTotal = laCant.Text + Subs.traeinventario(id)
LogColor("InvTotal PRODMAS: " & invTotal, Colors.Red)
cuentaProds
End Sub
@@ -1102,6 +1119,7 @@ Sub l_prodX_Click
'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"
Log("TAG: " & Sender.As(Label).tag)
If i.RowCount > 0 Then
i.Position = 0
abordo = i.GetString("CAT_GP_ALMACEN")

View File

@@ -888,7 +888,7 @@ Version=12.8
#Region Project Attributes
#ApplicationLabel: Kelloggs Venta
#VersionCode: 3000
#VersionName: 4.05.12
#VersionName: 4.05.14
#SupportedOrientations: portrait
#CanInstallToExternalStorage: False
#BridgeLogger:true

View File

@@ -91,6 +91,6 @@ ModuleClosedNodes6=
ModuleClosedNodes7=
ModuleClosedNodes8=
ModuleClosedNodes9=
NavigationStack=C_Promos,B4XPage_Appear,70,0,C_Promos,b_terminar1_Click,490,0,C_Promos,revisaInvProdsVariables,456,0,C_Promos,muestraPromo,111,6,C_Promos,Class_Globals,0,0,C_Promos,et_promoCant_TextChanged,518,0,Promociones,traeListaDePromo,457,0,C_Clientes,Class_Globals,0,0,C_Productos,b_rechazar_Click,1004,0,C_Productos,lv_catalogos_ItemClick,304,0,C_Productos,PCLV_AddProds,279,0
NavigationStack=Subs,traeinventario,1780,1,C_Productos,l_prodX_Click,1093,6,C_Productos,CreateListItem,543,0,Subs,hayPedido,1566,0,C_Productos,Class_Globals,97,0,Subs,totalPedido,1569,0,C_Productos,b_prodMas_Click,708,6,C_Productos,b_prodMenos_Click,606,0,C_Productos,et_pCant_FocusChanged,797,0,C_Productos,et_pCant_TextChanged,733,6
SelectedBuild=0
VisibleModules=1,28,11,3,26,29,12,4,13

View File

@@ -1573,6 +1573,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}'"$)
Log($"select sum(PE_COSTO_TOT) as total from PEDIDO where PE_CLIENTE = '${traeCliente}'"$)
Private pTotal As String = "0"
If cT.RowCount > 0 Then
cT.Position = 0
@@ -1697,7 +1698,7 @@ Sub bitacora(fechab As String, usuariob As String, almacenb As String, rutab As
Starter.skmt.ExecNonQuery($"INSERT INTO BITACORAGPS (fechab, usuariob , almacenb , rutab , eventob , clienteb , iniciob , finb , latitudb, longitudb , precision , motivonoventa , motivonovisita) VALUES ('${fechab}' ,'${usuariob}' , '${almacenb}' , '${rutab}' , '${eventob}' , '${clienteb}' , '${iniciob}' , '${finb}' , '${latitudb}' , '${longitudb}' , '${precision}' , '${motivonoventa}' , '${motivonovisita}')"$)
Private cmd As DBCommand
cmd.Initialize
If eventob <> "Termina Venta" Then
If eventob <> "Termina Venta" And eventob <> "No Venta" Then
cmd.Name = "mandaBitacora3"
Log("BITACORA3")
Private nombreCliente As String = traeNombreCliente(clienteb)
@@ -1713,12 +1714,20 @@ Sub bitacora(fechab As String, usuariob As String, almacenb As String, rutab As
Private e As Cursor = Starter.skmt.ExecQuery($"select fechab from BITACORAGPS where usuariob = '${usuariob}' and almacenb = '${almacenb}' and rutab = '${rutab}' and clienteb = '${clienteb}' and eventob = 'Inicia Venta' order by fechab desc"$)
If e.RowCount > 0 Then
e.Position = 0
Log("ACTUALIZA BITACORA")
cmd.Name = "actualizaSalidaBitacora"
' TMP_FINAL = to_date((?),'YYYY/MM/DD HH24:MI:ss') where TMP_RUTA = (?) and tmp_almacen = (?) and tmp_usuario = (?) and tmp_id_cliente = (?) and tmp_evento = (?) and tmp_fecha_movil = to_date((?),'YYYY/MM/DD HH24:MI:ss');
cmd.Parameters = Array As Object(finb, rutab, almacenb, usuariob, clienteb, "Inicia Venta", e.GetString("fechab"))
Log($"${finb}, ${rutab}, ${almacenb}, ${usuariob}, ${clienteb}, 'Inicia Venta', ${e.GetString("fechab")}, "$)
Starter.reqManager.ExecuteCommand(cmd , "mandaBitacora")
Log("ACTUALIZA BITACORA")
If eventob = "Termina Venta" Then
cmd.Name = "actualizaSalidaBitacora"
' TMP_FINAL = to_date((?),'YYYY/MM/DD HH24:MI:ss') where TMP_RUTA = (?) and tmp_almacen = (?) and tmp_usuario = (?) and tmp_id_cliente = (?) and tmp_evento = (?) and tmp_fecha_movil = to_date((?),'YYYY/MM/DD HH24:MI:ss');
cmd.Parameters = Array As Object(finb, rutab, almacenb, usuariob, clienteb, "Inicia Venta", e.GetString("fechab"))
Log($"${finb}, ${rutab}, ${almacenb}, ${usuariob}, ${clienteb}, 'Inicia Venta', ${e.GetString("fechab")}, "$)
Starter.reqManager.ExecuteCommand(cmd , "mandaBitacora")
else if eventob = "No Venta" Then
cmd.Name = "actualizaNoVentaBitacora"
' TMP_FINAL = to_date((?),'YYYY/MM/DD HH24:MI:ss') where TMP_RUTA = (?) and tmp_almacen = (?) and tmp_usuario = (?) and tmp_id_cliente = (?) and tmp_evento = (?) and tmp_fecha_movil = to_date((?),'YYYY/MM/DD HH24:MI:ss');
cmd.Parameters = Array As Object(finb, motivonoventa, motivonovisita, rutab, almacenb, usuariob, clienteb, "Inicia Venta", e.GetString("fechab"))
Log($"${finb}, ${rutab}, ${almacenb}, ${usuariob}, ${clienteb}, 'Inicia Venta', ${e.GetString("fechab")}, "$)
Starter.reqManager.ExecuteCommand(cmd , "mandaBitacora")
End If
End If
End If
Log("Mandamos bitacora")
@@ -1771,4 +1780,17 @@ Sub logJobDoneResultados(resultado As DBResult)
LogColor(k & " = " & records(resultado.Columns.Get(k)), Colors.RGB(215,37,0))
Next
Next
End Sub
Sub traeinventario(id As String) As String
Dim c As Cursor
Dim inventario As String = "0"
c=Starter.skmt.ExecQuery($"select CAT_GP_ALMACEN from ${traeTablaProds(Starter.tipov)} where CAT_GP_ID = '${id}'"$)
' Log($"select CAT_GP_ALMACEN from ${Starter.tabla} where CAT_GP_NOMBRE = '${id}'"$)
If c.RowCount > 0 Then
c.Position = 0
inventario = c.GetString("CAT_GP_ALMACEN")
End If
c.Close
Return inventario
End Sub