se corrije que puedan ingresar productos en 0 y es la version final

This commit is contained in:
cvaldes1201
2024-05-16 13:42:31 -06:00
parent 43256a930b
commit eeabd06043
6 changed files with 85 additions and 25 deletions

View File

@@ -505,9 +505,9 @@ Sub Tar_Click
B4XPages.ShowPage("Nota")
End Sub
Sub Tar_LongClick
p_abono.Visible = True
End Sub
'Sub Tar_LongClick
' p_abono.Visible = True
'End Sub
Sub DATOS_Click
B4XPages.ShowPage("telefonos")

View File

@@ -2244,7 +2244,8 @@ Sub resdia_Click
' c.Close
c=B4XPages.MainPage.skmt.ExecQuery("Select sum(PE_COSTO_TOT) As MONTO_DIA from pedido where PE_CLIENTE <> 0 ")
c.Position = 0
l_monto_ks.Text = c.GetString("MONTO_DIA")
l_monto_ks.Text = Subs.traeTotalCliente
If l_monto_ks.Text = "null" Then
l_monto_ks.Text = "0"
End If
@@ -2252,7 +2253,7 @@ Sub resdia_Click
c=B4XPages.MainPage.skmt.ExecQuery2("Select sum(PE_COSTO_TOT) As PREVENTA from pedido where PE_FOLIO = ? AND PE_CLIENTE <> 0", Array As String ("PREVENTA"))
If c.RowCount > 0 Then
c.Position = 0
L_PREVENTA.Text = c.GetString ("PREVENTA")
L_PREVENTA.Text = Subs.traeTotalClientepreventa
If L_PREVENTA.TEXT = "null" Then
L_PREVENTA.Text = "0"
End If
@@ -2261,7 +2262,7 @@ Sub resdia_Click
c=B4XPages.MainPage.skmt.ExecQuery2("Select sum(PE_COSTO_TOT) As VENTA from pedido where PE_FOLIO = ? AND PE_CLIENTE <> 0", Array As String ("VENTA"))
If c.RowCount > 0 Then
c.Position = 0
L_VENTA.Text = c.GetString ("VENTA")
L_VENTA.Text = Subs.traeTotalClienteventa
If L_VENTA.TEXT = "null" Then
L_VENTA.Text = "0"
End If
@@ -2270,7 +2271,7 @@ Sub resdia_Click
c=B4XPages.MainPage.skmt.ExecQuery2("Select sum(PE_COSTO_TOT) As ABORDO from pedido where PE_FOLIO = ? AND PE_CLIENTE = ?", Array As String ("ABORDO", "0"))
If c.RowCount > 0 Then
c.Position = 0
L_ABORDO.Text = c.GetString ("ABORDO")
L_ABORDO.Text = Subs.traeTotalClienteabordo
If L_ABORDO.TEXT = "null" Then
L_ABORDO.Text = "0"
End If

View File

@@ -631,11 +631,13 @@ End Sub
Private Sub et_pCant_FocusChanged (HasFocus As Boolean)
LogColor($"focus changed=${HasFocus}"$, Colors.Magenta)
If et_pCant.Text = "" Then et_pCant.Text = "0"
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")
If laCant.Text = "" Then laCant.Text = "0"
etCantHasFocus = HasFocus
invTotal = laCant.Text + Subs.traeinventario(id)
@@ -653,12 +655,12 @@ 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)
Dim laCant As B4XView = pnl.GetView(2).GetView(2)
' Dim lProdX As B4XView = pnl.GetView(1)
Dim lProdX As B4XView = pnl.GetView(1)
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")
Private inv As String=clv_prods_ll.GetValue(index).As(Map).Get("almacen")
Private inv As String=Subs.traeinventario(id)
' Private nombreX As String = Subs.traeProdNombre(id)
Private nombreX As String = Subs.traeProdNombre(id)
If(New = "" Or New = Null Or New = "-") Then New = 0
' If New < 0 Then New = 0
If(New > invTotal) Then
@@ -666,18 +668,18 @@ Private Sub et_pCant_TextChanged (Old As String, New As String)
End If
' Log($"inventario=${inv}"$)
' If 1 = 1 Then
' Private cs As CSBuilder
' cs.Initialize
' Private o As Cursor = Starter.skmt.ExecQuery($"select CAT_GP_ALMACEN from ${Starter.tabla} where CAT_GP_ID = '${id}'"$)
' Private invActualizado As String = "0"
' If o.RowCount > 0 Then
' o.Position = 0
' invActualizado = o.GetString("CAT_GP_ALMACEN")
' End If
' If 2 = 2 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
'' Log(lProdX.Text)
' End If
If 1 = 1 Then
Private cs As CSBuilder
cs.Initialize
Private o As Cursor = Starter.skmt.ExecQuery($"select CAT_GP_ALMACEN from ${Starter.tabla} where CAT_GP_ID = '${id}'"$)
Private invActualizado As String = "0"
If o.RowCount > 0 Then
o.Position = 0
invActualizado = o.GetString("CAT_GP_ALMACEN")
End If
If 2 = 2 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
' Log(lProdX.Text)
End If
If Not(Old = "0" And New = "") And laCant.Text <> Null And laCant.Text <> "" And etCantHasFocus Then
Log("actualizamos producto")

View File

@@ -158,12 +158,12 @@ Module9=C_Nota
NumberOfFiles=46
NumberOfLibraries=34
NumberOfModules=28
Version=12.8
Version=12.5
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Intmex
#VersionCode: 1
#VersionName: 4.05.14
#VersionName: 4.05.15
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: False

View File

@@ -85,6 +85,6 @@ ModuleClosedNodes6=
ModuleClosedNodes7=
ModuleClosedNodes8=
ModuleClosedNodes9=
NavigationStack=C_Productos,Class_Globals,79,5,Subs,traeinventario,1401,6,C_Cliente,MODS,0,0,Subs,guardaProductoSinGestion,764,3,C_Productos,cuentaProds,676,0,Subs,actualizaProducto,785,2,C_Productos,et_pCant_FocusChanged,635,6,C_Productos,b_prodMenos_Click,554,1,C_Productos,b_prodMas_Click,558,6,C_Productos,et_pCant_TextChanged,642,6
NavigationStack=Subs,actualizaProducto,774,1,C_Cliente,MODS,0,0,Subs,guardaProductoSinGestion,770,0,Subs,traeTotalCliente,815,2,C_Principal,Class_Globals,0,0,C_Principal,P_RESUMEN_click,2165,0,Subs,traeTotalClientepreventa,831,1,Subs,traeTotalClienteabordo,817,2,Subs,traeTotalClienteventa,845,0,C_Principal,resdia_Click,2267,5
SelectedBuild=0
VisibleModules=2,26,13,16,14,4,27,15,9,6

View File

@@ -778,10 +778,11 @@ Sub guardaProductoSinGestion(cedis As String, costoU As String, cant As String,
B4XPages.MainPage.skmt.ExecNonQuery2("insert into pedido_cliente(PC_CLIENTE, PC_FECHA, PC_USER, PC_NOART, PC_MONTO,PC_LON, PC_LAT,PC_ALMACEN,PC_RUTA,PC_COSTO_SIN) VALUES (?,?,?,?,?,?,?,?,?,?)", Array As Object(clienteId, fecha, usuario, c.GetString("CANT_CLIE"), c.GetString("TOTAL_CLIE"), B4XPages.MainPage.lon_gps, B4XPages.MainPage.lat_gps, cedis, c.GetString("TOTAL_CLIE_SIN")))
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 Int, nombre As String, prodId As String, clienteId As String, fecha As String, usuario As String, rutaV As String, precioSin As String, tipoVenta As String)
Private c As Cursor=B4XPages.MainPage.skmt.ExecQuery($"select * from pedido where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' AND PE_FOLIO = '${B4XPages.MainPage.tipo_venta}'"$)
' Log($"ROWCOUNT: ${c.RowCount}, ${cant}"$)
LogColor($"actualizaProducto, c=${clienteId}, p=${prodId}, nombre=${nombre}, cant=${cant}, cedis=${cedis}, tipo=${tipoVenta}"$, Colors.Magenta)
If c.RowCount > 0 Then
c.Position=0
Private antCant As Int = 0
@@ -804,6 +805,62 @@ Sub actualizaProducto(cedis As String, costoU As String, cant As String, nombre
c.Close
End Sub
Sub traeTotalCliente As Double
Private sumaTotal As Double
Private cursorprueba As Cursor = B4XPages.MainPage.skmt.ExecQuery("Select PE_COSTO_TOT from pedido where PE_CLIENTE <> 0 ")
For i= 0 To cursorprueba.RowCount -1
cursorprueba.Position = i
' LogColor(cursorprueba.GetString("PE_COSTO_TOT"),Colors.Red)
sumaTotal = sumaTotal + cursorprueba.GetString("PE_COSTO_TOT")
sumaTotal = NumberFormat2(sumaTotal, 0, 2, 2, False)
' Log(NumberFormat2(sumaTotal, 0, 2, 2, False))
Next
cursorprueba.Close
Return sumaTotal
End Sub
Sub traeTotalClienteabordo As Double
Private sumaTotal As Double
Private cursorprueba As Cursor = B4XPages.MainPage.skmt.ExecQuery2("Select PE_COSTO_TOT from pedido where PE_FOLIO = ? AND PE_CLIENTE = 0", Array As String ("ABORDO"))
For i= 0 To cursorprueba.RowCount -1
cursorprueba.Position = i
' LogColor(cursorprueba.GetString("PE_COSTO_TOT"),Colors.Red)
sumaTotal = sumaTotal + cursorprueba.GetString("PE_COSTO_TOT")
sumaTotal = NumberFormat2(sumaTotal, 0, 2, 2, False)
' Log(NumberFormat2(sumaTotal, 0, 2, 2, False))
Next
cursorprueba.Close
Return sumaTotal
End Sub
Sub traeTotalClientepreventa As Double
Private sumaTotal As Double
Private cursorprueba As Cursor = B4XPages.MainPage.skmt.ExecQuery2("Select PE_COSTO_TOT from pedido where PE_FOLIO = ? AND PE_CLIENTE <> 0", Array As String ("PREVENTA"))
For i= 0 To cursorprueba.RowCount -1
cursorprueba.Position = i
' LogColor(cursorprueba.GetString("PE_COSTO_TOT"),Colors.Red)
sumaTotal = sumaTotal + cursorprueba.GetString("PE_COSTO_TOT")
sumaTotal = NumberFormat2(sumaTotal, 0, 2, 2, False)
' Log(NumberFormat2(sumaTotal, 0, 2, 2, False))
Next
cursorprueba.Close
Return sumaTotal
End Sub
Sub traeTotalClienteventa As Double
Private sumaTotal As Double
Private cursorprueba As Cursor = B4XPages.MainPage.skmt.ExecQuery2("Select PE_COSTO_TOT from pedido where PE_FOLIO = ? AND PE_CLIENTE <> 0", Array As String ("VENTA"))
For i= 0 To cursorprueba.RowCount -1
cursorprueba.Position = i
' LogColor(cursorprueba.GetString("PE_COSTO_TOT"),Colors.Red)
sumaTotal = sumaTotal + cursorprueba.GetString("PE_COSTO_TOT")
sumaTotal = NumberFormat2(sumaTotal, 0, 2, 2, False)
' Log(NumberFormat2(sumaTotal, 0, 2, 2, False))
Next
cursorprueba.Close
Return sumaTotal
End Sub
'Regresa un mapa con la información de la promo.
'Regresa: {id, maxXcliente, maxRecurrente, maxPromos, historico,
' productos={idProducto={idProducto, preciosimptos, precio, almacen, tipo, piezas, usuario, fecha, regalo, clasif}} 'Mapa con los productos de la promo y los datos de cada uno.