mirror of
https://github.com/KeymonSoft/Mariana.git
synced 2026-04-17 21:06:16 +00:00
- Se completó el codigo para las promos por ruta, si ya se vendio la promo, esta las vendidas del total disponible.
This commit is contained in:
@@ -1067,7 +1067,7 @@ Version=12.5
|
|||||||
#Region Project Attributes
|
#Region Project Attributes
|
||||||
#ApplicationLabel: Mariana
|
#ApplicationLabel: Mariana
|
||||||
#VersionCode: 1
|
#VersionCode: 1
|
||||||
#VersionName: 4.02.25
|
#VersionName: 4.02.26
|
||||||
'SupportedOrientations possible values: unspecified, landscape or portrait.
|
'SupportedOrientations possible values: unspecified, landscape or portrait.
|
||||||
#SupportedOrientations: portrait
|
#SupportedOrientations: portrait
|
||||||
#CanInstallToExternalStorage: False
|
#CanInstallToExternalStorage: False
|
||||||
|
|||||||
@@ -82,6 +82,6 @@ ModuleClosedNodes6=
|
|||||||
ModuleClosedNodes7=
|
ModuleClosedNodes7=
|
||||||
ModuleClosedNodes8=
|
ModuleClosedNodes8=
|
||||||
ModuleClosedNodes9=
|
ModuleClosedNodes9=
|
||||||
NavigationStack=C_Productos,b_terminar1_Click,581,1,B4XMainPage,B4XPage_Created,173,5,C_Principal,Subir_Click,513,6,Subs,revisaMaxPromosProdsFijosPorInventario2,1042,0,Subs,revisaMaxPromosProdsVariablesPorInventario,1129,0,Subs,alcanzanLosVariablesParaPromo,954,0,C_Principal,cargar_Click,950,1,C_Principal,JobDone,1731,2,Subs,traeMaxPromos,957,6,C_Productos,lv_catalogos_ItemClick,213,0
|
NavigationStack=Subs,revisaMaxPromosProdsFijosPorInventario2,1042,0,Subs,revisaMaxPromosProdsVariablesPorInventario,1129,0,C_Principal,cargar_Click,950,1,C_Principal,JobDone,1731,2,Subs,alcanzanLosVariablesParaPromo,954,0,C_Productos,lv_catalogos_ItemClick,242,0,Subs,procesaPromocion,1032,1,Subs,restaFijosPromo,920,0,Subs,traeMaxPromosXruta,1009,6,Subs,traeMaxPromos,989,6
|
||||||
SelectedBuild=0
|
SelectedBuild=0
|
||||||
VisibleModules=2,12,4,5,6,7,8,9,10,26,13
|
VisibleModules=2,12,4,5,6,7,8,9,10,26,13
|
||||||
|
|||||||
46
B4A/Subs.bas
46
B4A/Subs.bas
@@ -961,29 +961,24 @@ End Sub
|
|||||||
|
|
||||||
'Regresa el numero máximo de promociones permitidas, tomando en cuenta recurrentes, clientes y maxPromos.
|
'Regresa el numero máximo de promociones permitidas, tomando en cuenta recurrentes, clientes y maxPromos.
|
||||||
Sub traeMaxPromos(pm As Map) As Int
|
Sub traeMaxPromos(pm As Map) As Int
|
||||||
Private thisLog As Boolean = False 'Si es verdadero, muestra los logs de este sub.
|
Private thisLog As Boolean = True 'Si es verdadero, muestra los logs de este sub.
|
||||||
Private maxPromos As List
|
Private maxPromos As List
|
||||||
Private vendidas As Int = 0
|
Private vendidas As Int = 0
|
||||||
maxPromos.Initialize
|
maxPromos.Initialize
|
||||||
' If Starter.promosLog Then Log("==== HISTORICO:"&pm.Get("historico"))
|
' If Starter.promosLog Then Log("==== HISTORICO:"&pm.Get("historico"))
|
||||||
If thisLog Then Log(pm)
|
If thisLog Then Log(pm)
|
||||||
|
|
||||||
'Traemos las promos por ruta, y si existe, la agregamos a la lista.
|
Private maxXruta As String = traeMaxPromosXruta(pm.Get("id"))
|
||||||
Private pxr As Cursor = Starter.skmt.ExecQuery($"select * from CAT_PROMOS_RUTA where CPR_PROMO = '${pm.Get("id")}'"$)
|
|
||||||
Private maxXruta As String = ""
|
|
||||||
If pxr.RowCount > 0 Then
|
|
||||||
pxr.Position = 0
|
|
||||||
Log($"PROMOS POR RUTA PARA ${pm.Get("id")} = ${pxr.GetString("CPR_CANT")}"$)
|
|
||||||
maxXruta = pxr.GetString("CPR_CANT")
|
|
||||||
End If
|
|
||||||
|
|
||||||
If pm.Get("historico") = "1" Then maxPromos.Add(pm.Get("maxRecurrente")) 'Si hay historico, agregamos maxRecurrente
|
If pm.Get("historico") = "1" Then maxPromos.Add(pm.Get("maxRecurrente")) 'Si hay historico, agregamos maxRecurrente
|
||||||
maxPromos.Add(pm.Get("maxPromos").As(Int)) 'Agregamos maxPromos
|
maxPromos.Add(pm.Get("maxPromos").As(Int)) 'Agregamos maxPromos
|
||||||
maxPromos.Add(pm.Get("maxXcliente").As(Int)) 'Agregamos maxXcliente
|
maxPromos.Add(pm.Get("maxXcliente").As(Int)) 'Agregamos maxXcliente
|
||||||
If maxXruta <> "" Then maxPromos.Add(maxXruta.As(Int)) 'Agregamos maxXruta
|
If maxXruta <> "" Then maxPromos.Add(maxXruta.As(Int)) 'Agregamos maxXruta
|
||||||
maxPromos.Sort(True)
|
maxPromos.Sort(True)
|
||||||
Log(maxPromos)
|
Log(maxPromos)
|
||||||
|
|
||||||
' Log($"|${pm.Get("id").As(String).trim}|${traeCliente.Trim}|"$)
|
' Log($"|${pm.Get("id").As(String).trim}|${traeCliente.Trim}|"$)
|
||||||
Private c As Cursor = Starter.skmt.ExecQuery2("select sum(PE_CANT) as vendidas from PEDIDO where PE_PROID = ? and PE_CLIENTE = ? ", Array As String(pm.Get("id").As(String).trim, traeCliente.Trim))
|
Private c As Cursor = Starter.skmt.ExecQuery2("select sum(PE_CANT) as vendidas from PEDIDO where PE_PROID = ? and PE_CLIENTE = ? ", Array As String(pm.Get("id").As(String).trim, traeCliente.Trim))
|
||||||
If c.RowCount > 0 Then
|
If c.RowCount > 0 Then
|
||||||
@@ -998,6 +993,29 @@ Sub traeMaxPromos(pm As Map) As Int
|
|||||||
Return maxPromos.Get(0) - vendidas 'Regresamos el numero mas pequeño de las opciones.
|
Return maxPromos.Get(0) - vendidas 'Regresamos el numero mas pequeño de las opciones.
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
'Regresa las promos disponibles por ruta o "" si no hay.
|
||||||
|
Sub traeMaxPromosXruta(idPromo As String) As String
|
||||||
|
'Traemos las promos por ruta, y si existe, la agregamos a la lista.
|
||||||
|
Private pxr As Cursor = Starter.skmt.ExecQuery($"select * from CAT_PROMOS_RUTA where CPR_PROMO = '${idPromo}'"$)
|
||||||
|
Private maxXruta As String = ""
|
||||||
|
If pxr.RowCount > 0 Then
|
||||||
|
pxr.Position = 0
|
||||||
|
Log($"PROMOS POR RUTA PARA ${idPromo} = ${pxr.GetString("CPR_CANT")}"$)
|
||||||
|
maxXruta = pxr.GetString("CPR_CANT")
|
||||||
|
End If
|
||||||
|
'Revisamos las promos que ya se hayan vendido y las restamos del máximo.
|
||||||
|
Private cp As Cursor = Starter.skmt.ExecQuery($"select count(PE_CANT) as cuantos from PEDIDO where PE_PROID = '${idPromo}'"$)
|
||||||
|
Log(cp.RowCount)
|
||||||
|
If cp.RowCount > 0 Then
|
||||||
|
Private pa As Int = 0
|
||||||
|
cp.Position = 0
|
||||||
|
Log(cp.GetInt("cuantos"))
|
||||||
|
If IsNumber(cp.GetInt("cuantos")) Then pa = cp.GetInt("cuantos")
|
||||||
|
If maxXruta <> "" Then maxXruta = maxXruta - pa
|
||||||
|
End If
|
||||||
|
Return maxXruta
|
||||||
|
End Sub
|
||||||
|
|
||||||
'Regresa la cantidad de promos que se le han vendido al cliente.
|
'Regresa la cantidad de promos que se le han vendido al cliente.
|
||||||
Sub traePromosVendidas(promo As String, cliente As String) As Int
|
Sub traePromosVendidas(promo As String, cliente As String) As Int
|
||||||
Private c As Cursor
|
Private c As Cursor
|
||||||
@@ -1011,7 +1029,7 @@ Sub traePromosVendidas(promo As String, cliente As String) As Int
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub procesaPromocion(idPromo As String, cliente As String) As Map 'ignore
|
Sub procesaPromocion(idPromo As String, cliente As String) As Map 'ignore
|
||||||
Private thisLog As Boolean = False 'Si es verdadero, muestra los logs de este sub.
|
Private thisLog As Boolean = True 'Si es verdadero, muestra los logs de este sub.
|
||||||
Private inicioContador As String = DateTime.Now
|
Private inicioContador As String = DateTime.Now
|
||||||
If thisLog Then LogColor($"********* Iniciamos revision de Promo ${idPromo} *********"$, Colors.Magenta)
|
If thisLog Then LogColor($"********* Iniciamos revision de Promo ${idPromo} *********"$, Colors.Magenta)
|
||||||
'Obtenemos el mapa con toda la info de la promoción.
|
'Obtenemos el mapa con toda la info de la promoción.
|
||||||
@@ -1035,7 +1053,7 @@ Sub procesaPromocion(idPromo As String, cliente As String) As Map 'ignore
|
|||||||
If thisLog Then Log("Alcanzan los variables? --> " & pv)
|
If thisLog Then Log("Alcanzan los variables? --> " & pv)
|
||||||
If pv Then Return CreateMap("status":"ok", "mp":pm) Else Return CreateMap("status":"ko", "mp":pm)
|
If pv Then Return CreateMap("status":"ok", "mp":pm) Else Return CreateMap("status":"ko", "mp":pm)
|
||||||
Else
|
Else
|
||||||
If thisLog Then LogColor("NO HAY INVENTARIO SUFICIENTE " & idPromo, Colors.red)
|
LogColor("NO HAY INVENTARIO SUFICIENTE " & idPromo, Colors.red)
|
||||||
Return CreateMap("status":"ko", "mp":pm)
|
Return CreateMap("status":"ko", "mp":pm)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|||||||
Reference in New Issue
Block a user