mirror of
https://github.com/KeymonSoft/Intmex_Preventa.git
synced 2026-04-17 21:06:12 +00:00
- Se corrigio cpdigo de promos.
This commit is contained in:
@@ -177,10 +177,25 @@ Sub B4XPage_Appear
|
||||
' c = B4XPages.MainPage.skmt.ExecQuery($"select count(*) as hayPromos from ${Starter.tabla} where CAT_GP_TIPOPROD = 'PROMOS'"$)
|
||||
c = B4XPages.MainPage.skmt.ExecQuery($"select count(*) as hayPromos from ${Starter.tabla} where CAT_GP_TIPO = 'PROMOS'"$)
|
||||
c.Position = 0
|
||||
If c.GetInt("hayPromos") > 0 Then
|
||||
Log("ENTRE AQUI EN PROMOS ")
|
||||
lv_catalogos.AddSingleLine("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_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("PROMOS", "PROMOS"))
|
||||
' Log($"res:${c2.RowCount}, ${Value}, ${marca}, ${tipo}"$)
|
||||
Private hayPromos As Boolean = False
|
||||
If c2.RowCount > 0 Then
|
||||
For i=0 To c2.RowCount -1
|
||||
c2.Position=i
|
||||
Private tm As Map = Subs.procesaPromocion(c2.GetString("CAT_GP_ID"), clienteId)
|
||||
If tm.Get("status") = "ok" Then 'Solo muestrala si hay producto.
|
||||
hayPromos = True
|
||||
End If
|
||||
Next
|
||||
If hayPromos Then lv_catalogos.AddSingleLine("PROMOS")
|
||||
Else
|
||||
Log("NO HAY PROMOS")
|
||||
End If
|
||||
c2.Close
|
||||
|
||||
Sleep(100)
|
||||
l_total.Visible = False
|
||||
l_totProds.Visible = False
|
||||
@@ -216,6 +231,9 @@ Sub B4XPage_Appear
|
||||
PCLV.B4XSeekBar1.mBase.Height=clv_prods_ll.AsView.Height
|
||||
PCLV.pnlOverlay.Height = clv_prods_ll.AsView.Height
|
||||
PCLV.B4XSeekBar1.Update
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub PCLV_AddProds
|
||||
@@ -255,6 +273,8 @@ Sub lv_catalogos_ItemClick (Position As Int, Value As Object)
|
||||
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}"$)
|
||||
|
||||
Binary file not shown.
@@ -157,7 +157,7 @@ Module9=C_Nota
|
||||
NumberOfFiles=46
|
||||
NumberOfLibraries=33
|
||||
NumberOfModules=28
|
||||
Version=12.5
|
||||
Version=12.8
|
||||
@EndOfDesignText@
|
||||
#Region Project Attributes
|
||||
#ApplicationLabel: Intmex
|
||||
|
||||
@@ -85,6 +85,6 @@ ModuleClosedNodes6=
|
||||
ModuleClosedNodes7=
|
||||
ModuleClosedNodes8=
|
||||
ModuleClosedNodes9=
|
||||
NavigationStack=C_Productos,lv_catalogos_ItemClick,251,0,C_Productos,Class_Globals,78,0,C_Productos,b_terminar1_Click,627,0,C_Nota,B4XPage_Appear,101,1,C_Productos,lv_prodsPedido_ItemLongClick,776,0,C_Productos,b_rechazar_Click,744,0,C_Nota,ListView1_ItemLongClick,178,0,C_Nota,borra_Click,161,0,C_Nota,Class_Globals,30,5,B4XMainPage,Class_Globals,20,0
|
||||
NavigationStack=Subs,procesaPromocion,1029,0,C_RespaldoDiario,respaldaPedido,83,0,Subs,restaFijosPromo,932,3,Subs,alcanzanLosVariablesParaPromo,934,6,C_Productos,Class_Globals,0,0,C_Productos,lv_catalogos_ItemClick,254,6,C_Productos,B4XPage_Created,127,0,C_Productos,B4XPage_Appear,168,6,Visual Designer,cliente.bal,-100,5,B4XMainPage,Class_Globals,20,0
|
||||
SelectedBuild=0
|
||||
VisibleModules=2,26,13,16,14,4,27,15,9,6,10,17
|
||||
VisibleModules=2,26,13,16,14,4,27,15,9,6
|
||||
|
||||
26
B4A/Subs.bas
26
B4A/Subs.bas
@@ -905,7 +905,7 @@ End Sub
|
||||
Sub restaFijosPromo(promoMap As Map) As Map 'ignore
|
||||
Private thisLog As Boolean = True 'Si es verdadero, muestra los logs de este sub.
|
||||
Private inventariosDisponiblesParaEstaPromo As Map = traemosInventarioDisponibleParaPromo(promoMap.Get("id")) 'Obtenemos un mapa con el inventario disponible para cada producto de la promocion desde la base de datos.
|
||||
If thisLog Then LogColor(inventariosDisponiblesParaEstaPromo, Colors.red)
|
||||
If thisLog Then LogColor("InvDisponible: " & inventariosDisponiblesParaEstaPromo, Colors.red)
|
||||
If thisLog Then LogColor("Inventario inicial antes de FIJOS: "&inventariosDisponiblesParaEstaPromo, Colors.Gray) 'Inventario inicial.
|
||||
inventariosDisponiblesParaEstaPromo.Put("resultado", "ko")
|
||||
Private i As Int
|
||||
@@ -944,13 +944,16 @@ Sub alcanzanLosVariablesParaPromo(promoMap As Map, inventarioSinFijos As Map) As
|
||||
Private totalProdsVariables As Int = 0
|
||||
Private totalProdsVariables2 As Int = 0
|
||||
' Private prodsmap As Map = promoMap.Get("productos") 'Obtenemos un mapa con todos los productos de la promoción.
|
||||
Private prodsVariables As List = promoMap.get("prodsVariables") 'Obtenemos un a lista con los productos variables de la promoción.
|
||||
Private prodsVariables As List = promoMap.get("prodsVariables") 'Obtenemos una lista con los productos variables de la promoción.
|
||||
Private prodsVariables2 As List = promoMap.get("prodsVariables2")
|
||||
For p = 0 To prodsVariables.Size - 1
|
||||
Private t As String = prodsVariables.Get(p) 'Obtenemos el Id de este producto desde la lista de productos fijos.
|
||||
' Log("inventarioSinFijos: " & inventarioSinFijos)
|
||||
If inventarioSinFijos.ContainsKey(t) Then 'Si existe el producto en la lista del inventario, entonces ...
|
||||
Private p2 As String = inventarioSinFijos.Get(t) 'Obtenemos el inventario disponible este producto.
|
||||
' Log(p2)
|
||||
totalProdsVariables = totalProdsVariables + p2
|
||||
' Log(totalProdsVariables)
|
||||
If thisLog Then Log($"prod ${t}, hay: ${p2}"$) 'Producto y piezas requeridas
|
||||
End If
|
||||
Next
|
||||
@@ -965,11 +968,26 @@ Sub alcanzanLosVariablesParaPromo(promoMap As Map, inventarioSinFijos As Map) As
|
||||
If thisLog Then Log("Total prods variables=" & totalProdsVariables & ", requeridos=" & promoMap.Get("prodsVariablesRequeridos"))
|
||||
If thisLog Then Log("Total prods variables2=" & totalProdsVariables2 & ", requeridos2=" & promoMap.Get("prodsVariables2Requeridos"))
|
||||
Private res As Boolean = False
|
||||
Private res1 As Boolean = False
|
||||
Private res2 As Boolean = False
|
||||
|
||||
' Log($"${totalProdsVariables} >= ${promoMap.Get("prodsVariablesRequeridos")}"$)
|
||||
' Log($"${totalProdsVariables2} >= ${promoMap.Get("prodsVariables2Requeridos")}"$)
|
||||
|
||||
If totalProdsVariables >= promoMap.Get("prodsVariablesRequeridos") Then res = True 'Si el total de inventario de productos variables (totalProdsVariables) es mayor o igual a los productos requeridos entonces regresamos TRUE
|
||||
If totalProdsVariables2 >= promoMap.Get("prodsVariables2Requeridos") Then res = True 'Si el total de inventario de productos variables (totalProdsVariables) es mayor o igual a los productos requeridos entonces regresamos TRUE
|
||||
If totalProdsVariables > 0 And totalProdsVariables >= promoMap.Get("prodsVariablesRequeridos") Then
|
||||
res1 = True 'Si el total de inventario de productos variables (totalProdsVariables) es mayor o igual a los productos requeridos entonces regresamos TRUE
|
||||
End If
|
||||
If promoMap.Get("prodsVariablesRequeridos").As (Int) = 0 Then res1 = True
|
||||
If totalProdsVariables2 > 0 And totalProdsVariables2 >= promoMap.Get("prodsVariables2Requeridos") Then
|
||||
res2 = True 'Si el total de inventario de productos variables (totalProdsVariables) es mayor o igual a los productos requeridos entonces regresamos TRUE
|
||||
End If
|
||||
If promoMap.Get("prodsVariables2Requeridos").As(Int) = 0 Then res2 = True
|
||||
If res1 And res2 Then 'Solo si son verdadero los dos el resultado es verdadero.
|
||||
res = True
|
||||
Else
|
||||
res = False
|
||||
End If
|
||||
' Log(res)
|
||||
Return res
|
||||
End Sub
|
||||
|
||||
|
||||
Reference in New Issue
Block a user