- Se corrigio el codigo de mas y menos en productos qu ea v eces no dejaba sumar y a veces dejaba poner de mas!

This commit is contained in:
2024-05-15 18:46:40 -06:00
parent 6679e33d4a
commit 43256a930b
4 changed files with 36 additions and 26 deletions

View File

@@ -84,7 +84,7 @@ Sub Class_Globals
Dim r As Cursor
Dim vamoaver As List
Dim j3 As Cursor
Dim invtotal As Int
Dim invTotal As Int
End Sub
'You can add more parameters here.
@@ -557,6 +557,8 @@ Sub b_prodMenos_Click
' Log(lProdX.Text)
End If
If Subs.totalPedido < 1 Then laCant.Text = "0"
invTotal = laCant.Text + Subs.traeinventario(id)
' LogColor("InvTotal PRODMAS: " & invTotal, Colors.Red)
End Sub
Sub b_prodMas_Click
@@ -587,15 +589,16 @@ Sub b_prodMas_Click
'' prodsMap.Put(id, tmpMap)
'' LogColor(prodsMap, Colors.blue)
' End If
Log("Cantidad + exis " & (laCant.Text + existencias))
Log( (laCant.Text + 1 <= (laCant.Text + existencias)))
Log("inventario "&Subs.traeinventario(id))
Log((Subs.totalPedido - precio > 1))
Log((Subs.totalPedido))
Log(precio)
' Log("Cantidad + exis " & (laCant.Text + existencias))
' Log( (laCant.Text + 1 <= (laCant.Text + existencias)))
' Log("inventario "&Subs.traeinventario(id))
' Log((Subs.totalPedido - precio > 1))
' Log((Subs.totalPedido))
' Log(precio)
If Subs.traeinventario(id) > 0 And (laCant.Text <= (laCant.Text + Subs.traeinventario(id))) Then 'And (Subs.totalPedido - precio > 1)
Log(clv_prods_ll.GetValue(index).As(Map))
' Log(clv_prods_ll.GetValue(index).As(Map))
clv_prods_ll.GetValue(index).As(Map).Put("almacen", (inv - 1))
inv = inv - 1
' laCant.Text = $"$1.0{laCant.Text+1}"$
@@ -622,11 +625,28 @@ Sub b_prodMas_Click
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
invTotal = laCant.Text + Subs.traeinventario(id)
' LogColor("InvTotal PRODMAS: " & invTotal, Colors.Red)
End Sub
Private Sub et_pCant_FocusChanged (HasFocus As Boolean)
LogColor($"focus changed=${HasFocus}"$, Colors.Magenta)
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")
etCantHasFocus = HasFocus
invTotal = laCant.Text + Subs.traeinventario(id)
' LogColor("InvTotal PRODMAS: " & invTotal, Colors.Red)
cuentaProds
End Sub
Private Sub et_pCant_TextChanged (Old As String, New As String)
Log(etCantHasFocus)
' Log("InvTotal: " & invTotal)
If etCantHasFocus = True Then
LogColor($"txt changed: ${Old}|${New}, hasfocus=${etCantHasFocus}"$,Colors.Magenta)
Dim index As Int = clv_prods_ll.GetItemFromView(Sender)
@@ -641,8 +661,8 @@ Private Sub et_pCant_TextChanged (Old As String, New As String)
' 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
Sender.As(EditText).text = invtotal
If(New > invTotal) Then
Sender.As(EditText).text = invTotal
End If
' Log($"inventario=${inv}"$)
@@ -659,7 +679,7 @@ Private Sub et_pCant_TextChanged (Old As String, New As String)
'' Log(lProdX.Text)
' End If
If Not(Old = "0" And New = "") And laCant.Text <> Null And laCant.Text <> 0 And laCant.Text <> "" And etCantHasFocus Then
If Not(Old = "0" And New = "") And laCant.Text <> Null And laCant.Text <> "" And etCantHasFocus Then
Log("actualizamos producto")
Subs.actualizaProducto(Subs.traeAlmacen, precio, laCant.text, Subs.traeProdNombre(id), id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, B4XPages.MainPage.tipo_venta)
cuentaProds
@@ -681,16 +701,6 @@ Sub cuentaProds
' Log($"HAY PEDIDO: ${hayPedido}"$)
End Sub
Private Sub et_pCant_FocusChanged (HasFocus As Boolean)
LogColor($"focus changed=${HasFocus}"$, Colors.Magenta)
Dim index As Int = clv_prods_ll.GetItemFromView(Sender)
Private id As String=clv_prods_ll.GetValue(index).As(Map).Get("id")
invtotal = et_pCant.Text + Subs.traeinventario(id)
etCantHasFocus = HasFocus
cuentaProds
End Sub
Sub b_terminar1_Click
' Log("b_terminar1_Click")
' ya_entro = "0" : Log("ya_entro=1")

View File

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

View File

@@ -85,6 +85,6 @@ ModuleClosedNodes6=
ModuleClosedNodes7=
ModuleClosedNodes8=
ModuleClosedNodes9=
NavigationStack=Subs,traeinventario,1401,6,C_Productos,cuentaProds,640,0,C_Cliente,MODS,0,0,Subs,actualizaProducto,782,2,Subs,guardaProductoSinGestion,764,3,C_Productos,b_prodMenos_Click,512,1,C_Productos,b_prodMas_Click,617,6,C_Productos,Class_Globals,80,5,C_Productos,et_pCant_FocusChanged,677,6,C_Productos,et_pCant_TextChanged,637,6
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
SelectedBuild=0
VisibleModules=2,26,13,16,14,4,27,15,9,6

View File

@@ -789,7 +789,7 @@ Sub actualizaProducto(cedis As String, costoU As String, cant As String, nombre
Private difCant As Int = cant - antCant
B4XPages.MainPage.skmt.ExecNonQuery($"update pedido set pe_cant = ${cant}, pe_costo_tot = ${(cant*c.GetString("PE_COSTOU"))} where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' AND PE_FOLIO = '${B4XPages.MainPage.tipo_venta}'"$)
B4XPages.MainPage.skmt.ExecNonQuery($"update ${Starter.tabla} set cat_gp_almacen = cat_gp_almacen - (${difCant}) where cat_gp_id = '${prodId}' "$)
Log($"CANT=${cant}"$)
' Log($"CANT=${cant}"$)
If cant = 0 Then
Log("BORRAMOS PROD")
B4XPages.MainPage.skmt.ExecNonQuery($"delete from pedido where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' AND PE_FOLIO = '${B4XPages.MainPage.tipo_venta}'"$)