mirror of
https://github.com/KeymonSoft/ADM2.git
synced 2026-04-20 12:49:16 +00:00
VERSION 6.01.10
- Se corrige en resumen dia la venta por marcas
This commit is contained in:
@@ -257,12 +257,14 @@ Sub PCLV_AddProds
|
||||
End Sub
|
||||
|
||||
Sub lv_catalogos_ItemClick (Position As Int, Value As Object)
|
||||
Log("Clic lv_catalogos")
|
||||
If Value = "CATALOGO" Then
|
||||
' lfila.text = "TIPO"
|
||||
lfila.text = "PRODUCTOS"
|
||||
lv_catalogos.Visible = False
|
||||
' lv_tipo.Visible = True
|
||||
If clv_prods_ll.Size = 0 Then LlenaProdsLL(Null)
|
||||
' If clv_prods_ll.Size = 0 Then LlenaProdsLL(Null)
|
||||
LlenaProdsLL(Null)
|
||||
clv_prods_ll.AsView.Visible = True
|
||||
If hayPedido Then p_botonesVenta.Visible = True 'Si ya hay pedido, entonces mostramos los botones.
|
||||
Else
|
||||
@@ -288,9 +290,7 @@ Sub lv_catalogos_ItemClick (Position As Int, Value As Object)
|
||||
label14.TextSize = 12
|
||||
label14.TextColor = Colors.Black
|
||||
lfila.text = "PROMOS"
|
||||
|
||||
|
||||
|
||||
|
||||
' c2=B4XPages.MainPage.skmt.ExecQuery2($"select CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_PRECIO, CAT_GP_ALMACEN, CAT_GP_IMG from ${Starter.tabla} where CAT_GP_PRECIO > 0 AND CAT_GP_ALMACEN > 0 and CAT_GP_TIPOPROD = ? AND CAT_GP_TIPO = ? AND CAT_GP_SUBTIPO = ? AND CAT_GP_ID NOT IN (SELECT PE_PROID FROM PEDIDO WHERE PE_CLIENTE IN (Select cuenta from cuentaa) )"$, Array As String(Value, Value, Value))
|
||||
c2=B4XPages.MainPage.skmt.ExecQuery2($"select CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_PRECIO, CAT_GP_ALMACEN, CAT_GP_IMG from ${Starter.tabla} where CAT_GP_PRECIO > 0 AND CAT_GP_ALMACEN > 0 AND CAT_GP_TIPO = ? AND CAT_GP_SUBTIPO = ? AND CAT_GP_ID NOT IN (SELECT PE_PROID FROM PEDIDO WHERE PE_CLIENTE IN (Select cuenta from cuentaa) )"$, Array As String(Value, Value))
|
||||
' Log($"res:${c2.RowCount}, ${Value}, ${marca}, ${tipo}"$)
|
||||
@@ -393,7 +393,6 @@ Sub lv_promos_ItemClick (Position As Int, Value As Object)
|
||||
B4XPages.ShowPage("Cliente")
|
||||
End If
|
||||
If entro = "3" Then
|
||||
'xxxxxxxxxxxxxxxxxxxxx
|
||||
Else If entro = "4" Then
|
||||
' Log("Entro = 4")
|
||||
B4XPages.MainPage.skmt.ExecNonQuery("delete from PROID")
|
||||
@@ -479,8 +478,6 @@ Private Sub B4XPage_CloseRequest As ResumableSub
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Sub b_QR_Click
|
||||
If ciclo = 1 Then
|
||||
ciclo = 2
|
||||
@@ -603,10 +600,8 @@ Sub b_prodMenos_Click
|
||||
If clv_prods_ll.GetValue(index).As(Map).Get("cant").As(Int) = 0 Then
|
||||
Log("Aqui debemos ponerlo invisible")
|
||||
panelcajas.Visible = False
|
||||
Else
|
||||
|
||||
End If
|
||||
' p_botMasMenc.Visible = False
|
||||
' p_botMasMenc.Visible = False
|
||||
End If
|
||||
'fin aparecer parte de cajas
|
||||
' LogColor("InvTotal PRODMAS: " & invTotal, Colors.Red)
|
||||
@@ -720,7 +715,6 @@ Private Sub et_pCant_FocusChanged (HasFocus As Boolean)
|
||||
End If
|
||||
invTotal = totalcajasmaspiezas + Subs.traeinventario(id)
|
||||
' LogColor("InvTotal PRODMAS: " & invTotal, Colors.Red)
|
||||
|
||||
cuentaProds
|
||||
End Sub
|
||||
|
||||
@@ -742,25 +736,20 @@ Private Sub et_pCant_TextChanged (Old As String, New As String)
|
||||
Private nombreX As String = Subs.traeProdNombre(id)
|
||||
Dim panelcajas As B4XView = pnl.GetView(3)
|
||||
Dim panelpiezas As B4XView = pnl.GetView(2)
|
||||
|
||||
|
||||
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
|
||||
End If
|
||||
' Log($"inventario=${inv}"$)
|
||||
|
||||
If New = "" Then New = 0
|
||||
If laCant.Text = "" Then laCant.Text = 0
|
||||
LogColor(laCant.Text,Colors.Red)
|
||||
|
||||
If New > 0 Then
|
||||
panelcajas.Visible = False
|
||||
Else If New = 0 Then
|
||||
panelcajas.Visible = True
|
||||
End If
|
||||
|
||||
' If laCant2.IsInitialized Then
|
||||
' totalcajasmaspiezas = laCant.Text + laCant2.Text
|
||||
' Else
|
||||
@@ -771,7 +760,6 @@ Private Sub et_pCant_TextChanged (Old As String, New As String)
|
||||
Subs.actualizaProducto(Subs.traeAlmacen, precio, laCant.Text, Subs.traeProdNombre(id), id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, B4XPages.MainPage.tipo_venta,0,0)
|
||||
cuentaProds
|
||||
End If
|
||||
|
||||
' If New <> "" And New.SubString2(0,0) = "0" Then
|
||||
' New.SubString(1)
|
||||
' End If
|
||||
@@ -781,7 +769,6 @@ Private Sub et_pCant_TextChanged (Old As String, New As String)
|
||||
' laCant.Text = New.SubString(1)
|
||||
' Log(laCant.Text)
|
||||
' End If
|
||||
|
||||
If 1 = 1 Then
|
||||
Private cs As CSBuilder
|
||||
cs.Initialize
|
||||
@@ -792,7 +779,6 @@ Private Sub et_pCant_TextChanged (Old As String, New As String)
|
||||
invActualizado = Subs.traeinventario(id)
|
||||
Log(Subs.traeinventario(id))
|
||||
' End If
|
||||
|
||||
If New = "" Then New = 0
|
||||
If clv_prods_ll.GetValue(index).As(Map).Get("precio_caja").As(Float) = 0 Or clv_prods_ll.GetValue(index).As(Map).Get("conversion").As(Int) = 1 Then
|
||||
Private maxcajas As Int = 0
|
||||
@@ -824,7 +810,6 @@ Sub b_terminar1_Click
|
||||
' Log("b_terminar1_Click")
|
||||
' ya_entro = "0" : Log("ya_entro=1")
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2("delete from PEDIDO WHERE PE_PRONOMBRE = ? ", Array As Object("N/A") )
|
||||
|
||||
lv_promos.Visible = False
|
||||
clv_prods_ll.AsView.Visible = False
|
||||
lv_catalogos.Visible = True
|
||||
@@ -834,7 +819,6 @@ Sub b_terminar1_Click
|
||||
Private c_prods As Cursor=B4XPages.MainPage.skmt.ExecQuery("select PE_PRONOMBRE,PE_COSTO_TOT, PE_CANT, PE_FOLIO, PE_CEDIS FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) order by PE_CEDIS, PE_PRONOMBRE")
|
||||
If c_prods.RowCount > 0 Then
|
||||
Private cs As CSBuilder
|
||||
|
||||
vamoaver.Initialize
|
||||
For i=0 To c_prods.RowCount -1
|
||||
cs.Initialize
|
||||
@@ -845,7 +829,6 @@ Sub b_terminar1_Click
|
||||
label1.TextColor = Colors.Black
|
||||
label1.color = Colors.White
|
||||
Private textColor As Int = Colors.black
|
||||
|
||||
If c_prods.GetString("PE_FOLIO") = "VENTA" Then
|
||||
textColor = Colors.RGB(48,3,195)
|
||||
Else If c_prods.GetString("PE_FOLIO") = "PREVENTA" Or c_prods.GetString("PE_FOLIO") = "ABORDO" Or c_prods.GetString("PE_FOLIO") = "RECARGA" Then
|
||||
@@ -860,7 +843,6 @@ Sub b_terminar1_Click
|
||||
label2 = lv_prodsPedido.TwoLinesLayout.SecondLabel
|
||||
label2.TextSize = 10
|
||||
label2.TextColor = Colors.Blue
|
||||
|
||||
lv_prodsPedido.AddTwoLines(cs.Color(textColor).append(c_prods.GetString("PE_PRONOMBRE")).pop,"Cantidad #"& c_prods.GetString("PE_CANT")& " SubTotal $"& c_prods.GetString("PE_COSTO_TOT")& " Folio "& c_prods.GetString("PE_FOLIO"))
|
||||
vamoaver.Add(c_prods.GetString("PE_FOLIO"))
|
||||
folio = c_prods.GetString("PE_FOLIO")
|
||||
@@ -1135,12 +1117,9 @@ Private Sub clv_prods_ll_VisibleRangeChanged (FirstIndex As Int, LastIndex As In
|
||||
' b_prodMas.Enabled = False
|
||||
b_prodMenos.Enabled = False
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Private precio As String=NumberFormat2(clv_prods_ll.GetValue(i).As(Map).Get("precio").As(Double),1,2,2,False)
|
||||
' Log(clv_prods_ll.GetValue(i).As(Map))
|
||||
|
||||
c = Starter.skmt.ExecQuery2("SELECT PE_BCAJAS FROM PEDIDO WHERE PE_PROID = ? AND PE_CLIENTE IN (SELECT CUENTA FROM CUENTAA)",Array As String(clv_prods_ll.GetValue(i).As(Map).Get("id")))
|
||||
' Log(clv_prods_ll.GetValue(i).As(Map).Get("id"))
|
||||
If c.RowCount = 0 Then
|
||||
@@ -1158,7 +1137,6 @@ Private Sub clv_prods_ll_VisibleRangeChanged (FirstIndex As Int, LastIndex As In
|
||||
p_botMasMenc.Visible = True
|
||||
End If
|
||||
End If
|
||||
|
||||
' If clv_prods_ll.GetValue(i).As(Map).Get("b_caja").As(String) = "0" Then
|
||||
' If clv_prods_ll.GetValue(i).As(Map).Get("cant") <> Null Then et_pCant.Text = clv_prods_ll.GetValue(i).As(Map).Get("cant")
|
||||
' p_botMasMen.Visible = True
|
||||
@@ -1193,8 +1171,6 @@ Private Sub clv_prods_ll_VisibleRangeChanged (FirstIndex As Int, LastIndex As In
|
||||
If clv_prods_ll.GetValue(i).As(Map).Get("cant").As(Int) = 0 Then
|
||||
Log("Aqui debemos ponerlo invisible")
|
||||
p_botMasMenc.Visible = False
|
||||
Else
|
||||
|
||||
End If
|
||||
' p_botMasMenc.Visible = False
|
||||
End If
|
||||
@@ -1247,11 +1223,12 @@ End Sub
|
||||
Sub LlenaProdsLL(p As ResultSet)
|
||||
Log("Iniciamos LlenaProdsLL")
|
||||
listaProds.Initialize
|
||||
If hayPedido Then 'Si hay pedido obtenemos las cantidades de los productos para agregarlos al CLV.
|
||||
If Subs.hayPedido Then 'Si hay pedido obtenemos las cantidades de los productos para agregarlos al CLV.
|
||||
Log("Hay pedido")
|
||||
Dim cantsMap As Map
|
||||
cantsMap.Initialize
|
||||
Dim pe As ResultSet = B4XPages.MainPage.skmt.ExecQuery($"select PE_PROID, PE_CANT, PE_CANTC, PE_BCAJAS from PEDIDO where PE_CLIENTE = '${clienteId}' and PE_CEDIS = '${Subs.traeAlmacen}' and PE_FOLIO = '${B4XPages.MainPage.tipo_venta}'"$)
|
||||
' LogColor("Ponemos productos de pedido anterior: "&pe.RowCount, Colors.red)
|
||||
LogColor("Ponemos productos de pedido anterior: "&pe.RowCount, Colors.red)
|
||||
Do While pe.NextRow
|
||||
Private cant As Int = 0
|
||||
If pe.GetString("PE_BCAJAS") = 0 Then
|
||||
@@ -1265,19 +1242,17 @@ Sub LlenaProdsLL(p As ResultSet)
|
||||
End If
|
||||
' Log(p.IsInitialized)
|
||||
If p.IsInitialized Then
|
||||
' Log("YA HAY RESULSET")
|
||||
Log("YA HAY RESULSET")
|
||||
Else
|
||||
' Log("NO HAY RESULSET")
|
||||
LogColor(Starter.tabla,Colors.blue)
|
||||
Log("NO HAY RESULSET")
|
||||
LogColor(Starter.tabla,Colors.blue)
|
||||
' Dim p As ResultSet = B4XPages.MainPage.skmt.ExecQuery($"select CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_ALMACEN, CAT_GP_PRECIO, CAT_GP_TIPOPROD from ${Starter.tabla} where CAT_GP_PRECIO > 0 And CAT_GP_ALMACEN > 0 And CAT_GP_CLASIF <> 'PROMOS' order by CAT_GP_NOMBRE"$)
|
||||
|
||||
Dim p As ResultSet = B4XPages.MainPage.skmt.ExecQuery($"select distinct CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_ALMACEN, CAT_GP_PRECIO, CAT_GP_TIPOPROD, CAT_DP_CONVERSION1, CAT_DP_PRECIO4, PE_BCAJAS from ${Starter.tabla} LEFT JOIN PEDIDO ON CAT_GP_ID = PE_PROID where CAT_GP_PRECIO > 0 And CAT_GP_ALMACEN > 0 And CAT_GP_CLASIF <> 'PROMOS' union all select CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_ALMACEN, CAT_GP_PRECIO, CAT_GP_TIPOPROD, CAT_DP_CONVERSION1, CAT_DP_PRECIO4 , PE_BCAJAS from ${Starter.tabla} LEFT JOIN PEDIDO ON CAT_GP_ID = PE_PROID where CAT_GP_PRECIO > 0 And CAT_GP_ALMACEN = 0 And CAT_GP_CLASIF <> 'PROMOS' and cat_gp_id in (select pe_proid from pedido where pe_cliente in (select cuenta from cuentaa)) order by 2"$)
|
||||
|
||||
End If
|
||||
|
||||
Do While p.NextRow
|
||||
Private cant As Int = 0
|
||||
If hayPedido And cantsMap.ContainsKey(p.GetString("CAT_GP_ID")) Then
|
||||
If Subs.hayPedido And cantsMap.ContainsKey(p.GetString("CAT_GP_ID")) Then
|
||||
clv_prods_ll.Clear
|
||||
Log(p.GetString("CAT_GP_ID"))
|
||||
cant = cantsMap.Get(p.GetString("CAT_GP_ID"))
|
||||
End If
|
||||
@@ -1340,9 +1315,6 @@ Sub PCLV_HintRequested(Index As Int) As Object
|
||||
Return word
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
Sub b_prodMenosc_Click
|
||||
totalcajasmaspiezas = 0
|
||||
etCantHasFocus = False
|
||||
@@ -1368,7 +1340,6 @@ Sub b_prodMenosc_Click
|
||||
Private nombreX As String = Subs.traeProdNombre(id)
|
||||
Private conversion As String = clv_prods_ll.GetValue(index).As(Map).Get("conversion")
|
||||
Private preciocaja As String = clv_prods_ll.GetValue(index).As(Map).Get("precio_caja")
|
||||
|
||||
Log(tmpMap)
|
||||
' prodsMap.Put(id, tmpMap)
|
||||
If laCant2.Text = 0 Then prodsMap.Remove(id)
|
||||
@@ -1412,14 +1383,12 @@ Sub b_prodMenosc_Click
|
||||
If Subs.totalPedido < 1 Then laCant2.Text = "0"
|
||||
invTotal = totalcajasmaspiezas + Subs.traeinventario(id)
|
||||
' LogColor("InvTotal PRODMAS: " & invTotal, Colors.Red)
|
||||
|
||||
End Sub
|
||||
|
||||
Sub b_prodMasc_Click
|
||||
etCantHasFocus = False
|
||||
Root.RequestFocus
|
||||
' LogColor("b_prodMas_Click", 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)
|
||||
@@ -1474,14 +1443,12 @@ Sub b_prodMasc_Click
|
||||
Else If laCant2.Text = 0 Then
|
||||
panelpiezas.Visible = True
|
||||
End If
|
||||
|
||||
' LogColor(laCant.Text,Colors.Red)
|
||||
' If laCant.IsInitialized Then
|
||||
' totalcajasmaspiezas = laCant.Text + laCant2.Text
|
||||
' Else
|
||||
' totalcajasmaspiezas = laCant2.Text
|
||||
' End If
|
||||
|
||||
' Subs.actualizaProducto(Subs.traeAlmacen,preciocaja,(laCant2.Text * conversion), Subs.traeProdNombre(id), id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, B4XPages.MainPage.tipo_venta,laCant2.Text,1)
|
||||
Subs.actualizaProducto2(Subs.traeAlmacen,preciocaja,(laCant2.Text * conversion), Subs.traeProdNombre(id), id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, B4XPages.MainPage.tipo_venta,laCant2.Text,1)
|
||||
cuentaProds
|
||||
@@ -1529,7 +1496,6 @@ Private Sub et_pCantc_FocusChanged (HasFocus As Boolean)
|
||||
' End If
|
||||
invTotal = totalcajasmaspiezas + Subs.traeinventario(id)
|
||||
' LogColor("InvTotal PRODMAS: " & invTotal, Colors.Red)
|
||||
|
||||
cuentaProds
|
||||
End Sub
|
||||
|
||||
@@ -1554,7 +1520,6 @@ Private Sub et_pCantc_TextChanged (Old As String, New As String)
|
||||
Dim panelpiezas As B4XView = pnl.GetView(2)
|
||||
Private conversion As String = clv_prods_ll.GetValue(index).As(Map).Get("conversion")
|
||||
Private preciocaja As String = clv_prods_ll.GetValue(index).As(Map).Get("precio_caja")
|
||||
|
||||
invTotal = Subs.traeinventario(id)
|
||||
Log("inventario total "& invTotal)
|
||||
If(New = "" Or New = Null Or New = "-") Then New = 0
|
||||
@@ -1568,28 +1533,23 @@ Private Sub et_pCantc_TextChanged (Old As String, New As String)
|
||||
pnl.GetView(2).Visible = True
|
||||
Log("ponemos en 0")
|
||||
End If
|
||||
|
||||
' Log($"inventario=${inv}"$)
|
||||
Log("inventario total despues de max "& invTotal)
|
||||
|
||||
If New = "" Then New = 0
|
||||
If laCant2.Text = "" Then laCant2.Text = 0
|
||||
' LogColor("la cant2 " &laCant2.Text,Colors.Red)
|
||||
|
||||
If New > 0 Then
|
||||
Log("lo ocultamos")
|
||||
panelpiezas.Visible = False
|
||||
Else If New = 0 Then
|
||||
panelpiezas.Visible = True
|
||||
End If
|
||||
|
||||
' If laCant.IsInitialized Then
|
||||
' totalcajasmaspiezas = laCant.Text + laCant2.Text
|
||||
' Else
|
||||
' totalcajasmaspiezas = laCant2.Text
|
||||
' End If
|
||||
Log("InvTotal: " & invTotal)
|
||||
|
||||
If Not(Old = "0" And New = "") And laCant2.Text <> Null And laCant2.Text <> "" And etCantHasFocus Then
|
||||
If invTotal - (laCant2.Text * conversion) >= 0 Then
|
||||
LogColor("validacion inventariio " & (invTotal - (laCant2.Text * conversion)), Colors.Blue)
|
||||
@@ -1603,8 +1563,6 @@ Private Sub et_pCantc_TextChanged (Old As String, New As String)
|
||||
End If
|
||||
End If
|
||||
LogColor("la cant2 " & laCant2.Text,Colors.Green)
|
||||
|
||||
|
||||
' If New <> "" And New.SubString2(0,0) = "0" Then
|
||||
' New.SubString(1)
|
||||
' End If
|
||||
@@ -1614,7 +1572,6 @@ Private Sub et_pCantc_TextChanged (Old As String, New As String)
|
||||
' laCant.Text = New.SubString(1)
|
||||
' Log(laCant.Text)
|
||||
' End If
|
||||
|
||||
If 1 = 1 Then
|
||||
Private cs As CSBuilder
|
||||
cs.Initialize
|
||||
@@ -1625,7 +1582,6 @@ Private Sub et_pCantc_TextChanged (Old As String, New As String)
|
||||
invActualizado = Subs.traeinventario(id)
|
||||
Log(Subs.traeinventario(id))
|
||||
' End If
|
||||
|
||||
If New = "" Then New = 0
|
||||
If clv_prods_ll.GetValue(index).As(Map).Get("precio_caja").As(Float) = 0 Or clv_prods_ll.GetValue(index).As(Map).Get("conversion").As(Int) = 1 Then
|
||||
Private maxcajas2 As Int = 0
|
||||
|
||||
Reference in New Issue
Block a user