- VERSION 5.06.25

- Se agregó la forma de pago en el ticket (credito o efectivo)
This commit is contained in:
2025-06-27 13:48:23 -06:00
parent 73877991ba
commit e639848418
14 changed files with 1357 additions and 826 deletions

View File

@@ -1184,7 +1184,7 @@ End Sub
'Regresa el numero máximo de promociones permitidas, tomando en cuenta recurrentes, clientes y maxPromos.
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 mp0, mp As String = "0"
maxPromos.Initialize
@@ -1197,7 +1197,11 @@ Sub traeMaxPromos(pm As Map) As Int
' LogColor("SIN HCCP CANT", Colors.Magenta)
' End If
If thisLog Then LogColor("==== HISTORICO:"&pm.Get("historico"), Colors.Red)
' Log("### PRODS VARIABLES: " & pm.Get("prodsVariables"))
Private maxPromosXDescPV As String = B4XPages.MainPage.promos.ts.maxPromosPorProdsVariables(pm.Get("prodsVariables"), pm.Get("id"))
Log("########### " & maxPromosXDescPV)
If thisLog Then Log(pm)
maxPromos.Add(maxPromosXDescPV.As(Int))
If pm.Get("historico") = "1" Then maxPromos.Add(pm.Get("maxRecurrente")) 'Si hay historico, agregamos maxRecurrente
If pm.Get("maxPromos") <> "null" Then maxPromos.Add(pm.Get("maxPromos").As(Int)) 'Agregamos maxPromos
If pm.Get("maxXcliente") <> "null" Then maxPromos.Add(pm.Get("maxXcliente").As(Int)) 'Agregamos maxXcliente
@@ -1232,15 +1236,13 @@ End Sub
'3799, 7226, 7228, 7230
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 mp As Int = 0
If thisLog Then LogColor($"********* Iniciamos revision de Promo ${idPromo} *********"$, Colors.red)
'Obtenemos el mapa con toda la info de la promoción.
Private pm As Map = traePromo(idPromo, cliente)
' B4XPages.MainPage.productos.promosC.traePromo(idPromo, cliente)
If thisLog Then LogColor(pm, Colors.Blue)
' If thisLog Then LogColor("|" & pm.Get("maxPromos") & "|", Colors.Blue)
' Log("|"&revisaMaxPromosProdsFijosPorInventario(pm)&"|")
@@ -1336,17 +1338,20 @@ Sub revisaMaxPromosProdsFijosPorInventario(pm As Map) As Int
Private thisInvDisp As Int = 0
If invDispParaPromo.Get(idProdsFijos.Get(p)) <> Null Then thisInvDisp = invDispParaPromo.Get(idProdsFijos.Get(p))
If thisLog Then Log($"id=${idProdsFijos.Get(p)}, inv=${thisInvDisp}, pzas=${prodsFijosPiezas.Get(p)}"$)
' Log(">>>>> Monto Bonificacion: " & B4XPages.MainPage.promos.ts.traeMontoBonificacion(idProdsFijos.Get(p), pm.Get("id")))
' If thisLog Then LogColor(">> Max prods fijos x Bonificaciones: " & B4XPages.MainPage.promos.ts.traeBonificacionesMaximas("bonificaciones", clienteActual, idProdsFijos.Get(p), prodsFijosPiezas.Get(p), pm.Get("id")), Colors.blue)
t.Add(B4XPages.MainPage.promos.ts.traeBonificacionesMaximas("bonificaciones", clienteActual, idProdsFijos.Get(p), prodsFijosPiezas.Get(p), pm.Get("id")))
' If thisLog Then Log($"${(thisInvDisp / prodsFijosPiezas.Get(p))}"$)
Private x() As String = Regex.Split("\.", $"${(thisInvDisp / prodsFijosPiezas.Get(p))}"$) 'Separamos el resultado de la division por el punto decimal.
' If thisLog Then Log(x(0))
If thisLog Then Log(x(0))
t.Add(x(0).As(Int)) 'Solo guardamos la parte del entero de la division.
Next
t.Sort(True) 'Ordenamos la lista para que en el lugar 0 este el resultao mas pequeño.
If thisLog Then LogColor($"prodsFijos=${idProdsFijos}"$, Colors.Blue)
If thisLog Then LogColor($"prodsFijosPiezasReq=${prodsFijosPiezas}"$, Colors.Blue)
If thisLog Then LogColor($"invFijoXpromo=${invFijoXpromo}"$, Colors.Blue)
' If thisLog Then LogColor($"invFijoXpromo=${invFijoXpromo}"$, Colors.Blue)
LogColor(">>>>>> T: " & t, Colors.red)
If thisLog Then LogColor("Max promos de prodsFijos POR inventario = " & t.Get(0), Colors.red)
' LogColor(">>>>>> " & t.Get(0), Colors.red)
Return t.Get(0) 'Regresamos el resultado mas pequeño.
End Sub
@@ -1357,7 +1362,7 @@ End Sub
'fijos es 5, entonces regresamos 5.
Sub revisaMaxPromosProdsVariablesPorInventario(pm As Map) As Int 'ignore
Private thisLog As Boolean = True
If thisLog Then Log("======================================================")
If thisLog Then LogColor("==================revisaMaxPromosProdsVariablesPorInventario====================", Colors.red)
If thisLog Then Log("======================================================")
Private invFijoXpromo As Map
invFijoXpromo.Initialize
@@ -1371,36 +1376,58 @@ Sub revisaMaxPromosProdsVariablesPorInventario(pm As Map) As Int 'ignore
Private prodsVariablesRequeridos As Int = pm.Get("prodsVariablesRequeridos")
Private prodsFijosPiezas As List = pm.Get("prodsFijosPiezas")
Private idProdsFijos As List = pm.Get("prodsFijos")
For p = 0 To idProdsFijos.Size -1 'Generamos mapa con los productos fijos y piezas requeridas por promo.
invFijoXpromo.Put(idProdsFijos.Get(p), prodsFijosPiezas.Get(p))
Private idEsteProd As String = idProdsFijos.Get(p)
Private invEsteProd As Int = invDispParaPromo.Get(idEsteProd)
Private pzasReqEsteProd As Int = prodsFijosPiezas.Get(p)
If thisLog Then Log($"id=${idEsteProd}, inv=${invEsteProd}, pzas=${pzasReqEsteProd}"$)
' For p = 0 To idProdsFijos.Size -1 'Generamos mapa con los productos fijos y piezas requeridas por promo.
' invFijoXpromo.Put(idProdsFijos.Get(p), prodsFijosPiezas.Get(p))
' Private idEsteProd As String = idProdsFijos.Get(p)
' Private invEsteProd As Int = invDispParaPromo.Get(idEsteProd)
' Private pzasReqEsteProd As Int = prodsFijosPiezas.Get(p)
' If thisLog Then Log($"id=${idEsteProd}, inv=${invEsteProd}, pzas=${pzasReqEsteProd}"$)
' invDispParaPromo.Put( idEsteProd, (invEsteProd - (1)) )
Next
' Next
If thisLog Then LogColor($"MaxPromos=${maxPromos}, promosXFijos=${maxPromosXFijos}"$, Colors.Blue)
If thisLog Then LogColor($"prodsFijos=${idProdsFijos}"$, Colors.Blue)
If thisLog Then LogColor($"prodsFijosPiezasReq=${prodsFijosPiezas}"$, Colors.Blue)
If thisLog Then LogColor($"prodsVariables=${idProdsVariables}${CRLF}Variables Req=${prodsVariablesRequeridos} "$, Colors.Blue)
If thisLog Then LogColor($"invFijoXpromo=${invFijoXpromo}"$, Colors.Blue)
' If thisLog Then LogColor($"invFijoXpromo=${invFijoXpromo}"$, Colors.Blue)
If thisLog Then Log($"Prods variables disponibles = ${totalProdsVariablesDisponibles}"$)
Private maxPromosXVariables As Int = 0
'Si prodsFijosCant = 0 entonces no debemos de hacemos el loop, solo sumamos las existencias de los variables / cant de variables requeridos y ese seria el maximo.
Private revisiones As Int = maxPromosXFijos
If pm.Get("prodsFijos").As(List).Size = 0 Then
revisiones = 1
Log(pm.Get("prodsVariables"))
End If
Log(pm.Get("prodsFijos").As(List).Size)
Log(maxPromosXFijos)
For x = 1 To maxPromosXFijos
If thisLog Then Log("==================== maxPromosXFijos "& x &" ========================")
If thisLog Then Log("=====================================================")
If thisLog Then Log("=====================================================")
Log("FIJOS: " & idProdsFijos.Size)
For i = 0 To idProdsFijos.Size - 1
If thisLog Then Log($"FIJO - ${idProdsFijos.Get(i)}, ${invDispParaPromo.Get(idProdsFijos.Get(i))} - ${prodsFijosPiezas.Get(i).As(Int)*(i+1)}"$)
invDispParaPromo.Put(idProdsFijos.Get(i), invDispParaPromo.Get(idProdsFijos.Get(i)).As(Int) - prodsFijosPiezas.Get(i).As(Int)*(i+1)) 'Restamos las piezas de los productos fijos del inventario disponible.
Next
If thisLog Then LogColor("Inv disponible despues de restar fijos = " & invDispParaPromo, Colors.Blue)
totalProdsVariablesDisponibles = 0
Private prodsVariablesXPresupuestoBonificaciones As List
prodsVariablesXPresupuestoBonificaciones.Initialize
For i = 0 To idProdsVariables.Size - 1 'Obtenemos total de productos variables disponibes.
If invDispParaPromo.ContainsKey(idProdsVariables.Get(i)) Then
Log($"Este prodVariable: ${idProdsVariables.Get(i)}"$)
Log($"Este invDisponible: ${invDispParaPromo.Get(idProdsVariables.Get(i))}"$)
' Log(">> Monto Bonificacion: " & B4XPages.MainPage.promos.ts.traeMontoBonificacion(idProdsVariables.Get(i), pm.Get("id")))
prodsVariablesXPresupuestoBonificaciones.Add(B4XPages.MainPage.promos.ts.traeBonificacionesMaximas("bonificaciones", clienteActual, idProdsVariables.Get(i), prodsVariablesRequeridos, pm.Get("id")))
' If thisLog Then LogColor(">> Max prods fijos x Bonificaciones: " & B4XPages.MainPage.promos.ts.traeBonificacionesMaximas("bonificaciones", clienteActual, idProdsVariables.Get(i), prodsVariablesRequeridos, pm.Get("id")), Colors.blue)
totalProdsVariablesDisponibles = totalProdsVariablesDisponibles + invDispParaPromo.Get(idProdsVariables.Get(i))
End If
Next
If thisLog Then Log($"prodsVariablesXPresupuestoBonificaciones: ${prodsVariablesXPresupuestoBonificaciones}"$)
'Revisamos variables.
If thisLog Then Log($"Var disponibles - var requeridos : ${totalProdsVariablesDisponibles} - ${prodsVariablesRequeridos*x}"$)
totalProdsVariablesDisponibles = totalProdsVariablesDisponibles - (prodsVariablesRequeridos*x)
@@ -1409,7 +1436,9 @@ Sub revisaMaxPromosProdsVariablesPorInventario(pm As Map) As Int 'ignore
maxPromosXVariables = x
Next
'Restamos fijos.
' LogColor("Max promos de prodsVariables POR inventario = " & maxPromosXVariables, Colors.red)
LogColor("Max promos de prodsVariables POR inventario = " & maxPromosXVariables, Colors.red)
If thisLog Then Log("=====================================================")
If thisLog Then LogColor("=================TERMINA MAXPROMOSPRODSVARIABLES===================", Colors.red)
Return maxPromosXVariables
End Sub
@@ -1945,7 +1974,12 @@ Sub revisaPromoPorMonto As Map
Private rangoMin As String = "0"
Private promoId As String = ""
m.Initialize
Private pm As Cursor = Starter.skmt.ExecQuery("select CAT_PA_ID, ifNull(CAT_PA_PORCENTAJE_PAQUETE, 0) as CAT_PA_PORCENTAJE_PAQUETE, ifNull(CAT_PA_PRECIO1, 0) as CAT_PA_PRECIO1, ifNull(CAT_PA_PRECIO2, 0) as CAT_PA_PRECIO2 from promos_comp where CAT_PA_TIPO_PROMONTO = '1' and CAT_PA_ID not in (select PE_CEDIS from PEDIDO where PE_CEDIS = PE_PROID)") 'Traemos las "promos por monto" que no existen en el "PEDIDO" del cliente.
Private pm As Cursor = Starter.skmt.ExecQuery($"select CAT_PA_ID,
ifNull(CAT_PA_PORCENTAJE_PAQUETE, 0) As CAT_PA_PORCENTAJE_PAQUETE,
ifNull(CAT_PA_PRECIO1, 0) As CAT_PA_PRECIO1,
ifNull(CAT_PA_PRECIO2, 0) As CAT_PA_PRECIO2 from promos_comp
where CAT_PA_TIPO_PROMONTO = '1' and
CAT_PA_ID Not in (Select PE_CEDIS from PEDIDO where PE_CEDIS = PE_PROID And PE_CLIENTE = '${traeCliente}')"$) 'Traemos las "promos por monto" que no existen en el "PEDIDO" del cliente.
If pm.RowCount > 0 Then
Private clienteId As String = traeCliente
For i = 0 To pm.RowCount - 1
@@ -2051,46 +2085,45 @@ Sub comparaVersiones(versionMinima As String, versionActual As String) As Int
End If
' Si son iguales, sigue comparando
Next
' Si todas las partes comparadas son iguales:
Return 0
End Sub
' Regresa un mapa con el tipo, monto permitido semanal y el acumulado hasta el día anterior:
' ej:
' - RMI=1500,0
' - DESCUENTOS=1500,0
' - BONIFICACIONES=1500,480
Sub traeInfoTrendSpending As Map
Private semana As Int = 0
Private HIST_TSS_SEMANA As String
Private HIST_TSS_SEMANA_ACUM As String
Private m As Map
m.Initialize
Private c As Cursor = Starter.skmt.ExecQuery($"select cat_va_valor from cat_variables where cat_va_descripcion = 'SEM_CAL_LABORAL'"$)
If c.RowCount > 0 Then
c.Position = 0
semana = c.GetInt("CAT_VA_VALOR")
End If
If semana > 0 Then
c = Starter.skmt.ExecQuery($"select HIST_TSS_TIPO, HIST_TSS_SEMANA${semana}, HIST_TSS_SEMANA${semana}_ACUM from HIST_TREND_SPENDING_SEMANAL"$)
If c.RowCount > 0 Then
For i = 0 To c.RowCount - 1
c.Position = i
HIST_TSS_SEMANA = c.GetString($"HIST_TSS_SEMANA${semana}"$)
HIST_TSS_SEMANA_ACUM = c.GetString($"HIST_TSS_SEMANA${semana}_ACUM"$)
If c.GetString("HIST_TSS_TIPO") = "RMI" Then
m.Put("RMI", HIST_TSS_SEMANA & "," & HIST_TSS_SEMANA_ACUM)
else if c.GetString("HIST_TSS_TIPO") = "DESCUENTOS" Then
m.Put("DESCUENTOS", HIST_TSS_SEMANA & "," & HIST_TSS_SEMANA_ACUM)
else if c.GetString("HIST_TSS_TIPO") = "BONIFICACIONES" Then
m.Put("BONIFICACIONES", HIST_TSS_SEMANA & "," & HIST_TSS_SEMANA_ACUM)
End If
Next
End If
End If
Return m
End Sub
'' Regresa un mapa con el tipo, monto permitido semanal y el acumulado hasta el día anterior:
'' ej:
'' - RMI=1500,0
'' - DESCUENTOS=1500,0
'' - BONIFICACIONES=1500,480
'Sub traeInfoTrendSpending As Map
' Private semana As Int = 0
' Private HIST_TSS_SEMANA As String
' Private HIST_TSS_SEMANA_ACUM As String
' Private m As Map
' m.Initialize
' Private c As Cursor = Starter.skmt.ExecQuery($"select cat_va_valor from cat_variables where cat_va_descripcion = 'SEM_CAL_LABORAL'"$)
' If c.RowCount > 0 Then
' c.Position = 0
' semana = c.GetInt("CAT_VA_VALOR")
' End If
' If semana > 0 Then
' c = Starter.skmt.ExecQuery($"select HIST_TSS_TIPO, HIST_TSS_SEMANA${semana}, HIST_TSS_SEMANA${semana}_ACUM from HIST_TREND_SPENDING_SEMANAL"$)
' If c.RowCount > 0 Then
' For i = 0 To c.RowCount - 1
' c.Position = i
' HIST_TSS_SEMANA = c.GetString($"HIST_TSS_SEMANA${semana}"$)
' HIST_TSS_SEMANA_ACUM = c.GetString($"HIST_TSS_SEMANA${semana}_ACUM"$)
' If c.GetString("HIST_TSS_TIPO") = "RMI" Then
' m.Put("RMI", HIST_TSS_SEMANA & "," & HIST_TSS_SEMANA_ACUM)
' else if c.GetString("HIST_TSS_TIPO") = "DESCUENTOS" Then
' m.Put("DESCUENTOS", HIST_TSS_SEMANA & "," & HIST_TSS_SEMANA_ACUM)
' else if c.GetString("HIST_TSS_TIPO") = "BONIFICACIONES" Then
' m.Put("BONIFICACIONES", HIST_TSS_SEMANA & "," & HIST_TSS_SEMANA_ACUM)
' End If
' Next
' End If
' End If
' Return m
'End Sub
' Modifica el acumulado del Trend Speding, le "suma" o "resta" al presupuesto especificado (RMI, BONIFICACIONES o DESCUENTOS)
Sub modTrendSpending(accion As String, tipo As String, monto As String)
@@ -2113,20 +2146,21 @@ Sub modTrendSpending(accion As String, tipo As String, monto As String)
End If
Log("acumulado:" & acumulado & " | monto: " & monto)
Private c As Cursor = Starter.skmt.ExecQuery($"select HIST_TSS_TIPO, ${HIST_TSS_SEMANA} as disponible, ${HIST_TSS_SEMANA_ACUM} as acumulado from HIST_TREND_SPENDING_SEMANAL where HIST_TSS_TIPO = '${tipo.ToUpperCase}'"$)
If accion = "resta" Then
If accion.ToUpperCase = "RESTA" Then
If c.RowCount > 0 Then
c.Position = 0
If tipo.ToUpperCase = "BONIFICACIONES" Then
If tipo.ToUpperCase = "BONIFICACIONES" Or tipo.ToUpperCase = "RMI" Then
Private nuevaBonificacion As String = NumberFormat2((acumulado + monto), 1, 2, 2, False)
LogColor($"Nueva bonificacion = ${nuevaBonificacion}"$, Colors.Magenta)
LogColor($"Nuevo acumulado ${tipo} = ${nuevaBonificacion}"$, Colors.Magenta)
Starter.skmt.ExecNonQuery($"delete from TREND_SPENDING where tipo = '${tipo.ToUpperCase}' "$)
Starter.skmt.ExecNonQuery($"insert into TREND_SPENDING (tipo, acumulado) values ('${tipo.ToUpperCase}', '${nuevaBonificacion}')"$)
' else if tipo.ToUpperCase = "RMI" Then
End If
End If
else if accion = "suma" Then
else if accion.ToUpperCase = "SUMA" Then
If c.RowCount > 0 Then
c.Position = 0
If tipo.ToUpperCase = "BONIFICACIONES" Then
If tipo.ToUpperCase = "BONIFICACIONES" Or tipo.ToUpperCase = "RMI" Then
Private nuevaBonificacion As String = NumberFormat2((acumulado - monto), 1, 2, 2, False)
LogColor($"Nueva bonificacion = ${nuevaBonificacion}"$, Colors.Magenta)
Starter.skmt.ExecNonQuery($"delete from TREND_SPENDING where tipo = '${tipo.ToUpperCase}' "$)
@@ -2136,27 +2170,27 @@ Sub modTrendSpending(accion As String, tipo As String, monto As String)
End If
End Sub
Sub traeAcumuladoHoyTS(tipo As String) As String
Private HIST_TSS_SEMANA As String
Private HIST_TSS_SEMANA_ACUM As String
Private acumulado As String = "0"
If Starter.semana = 0 Then
Private c As Cursor = Starter.skmt.ExecQuery($"select cat_va_valor from cat_variables where cat_va_descripcion = 'SEM_CAL_LABORAL'"$)
If c.RowCount > 0 Then
c.Position = 0
Starter.semana = c.GetInt("CAT_VA_VALOR")
End If
End If
HIST_TSS_SEMANA = $"HIST_TSS_SEMANA${Starter.semana}"$
HIST_TSS_SEMANA_ACUM = $"HIST_TSS_SEMANA${Starter.semana}_ACUM"$
Private d As Cursor = Starter.skmt.ExecQuery($"select acumulado from TREND_SPENDING where tipo = '${tipo.ToUpperCase}'"$)
If d.RowCount > 0 Then
d.Position = 0
acumulado = d.GetString("ACUMULADO")
End If
Logcolor("Acumulado hoy: " & acumulado, Colors.Blue)
Return NumberFormat2(acumulado, 1, 2, 2, False)
End Sub
'Sub traeAcumuladoHoyTS(tipo As String) As String
' Private HIST_TSS_SEMANA As String
' Private HIST_TSS_SEMANA_ACUM As String
' Private acumulado As String = "0"
' If Starter.semana = 0 Then
' Private c As Cursor = Starter.skmt.ExecQuery($"select cat_va_valor from cat_variables where cat_va_descripcion = 'SEM_CAL_LABORAL'"$)
' If c.RowCount > 0 Then
' c.Position = 0
' Starter.semana = c.GetInt("CAT_VA_VALOR")
' End If
' End If
' HIST_TSS_SEMANA = $"HIST_TSS_SEMANA${Starter.semana}"$
' HIST_TSS_SEMANA_ACUM = $"HIST_TSS_SEMANA${Starter.semana}_ACUM"$
' Private d As Cursor = Starter.skmt.ExecQuery($"select acumulado from TREND_SPENDING where tipo = '${tipo.ToUpperCase}'"$)
' If d.RowCount > 0 Then
' d.Position = 0
' acumulado = d.GetString("ACUMULADO")
' End If
' LogColor($"Acumulado hoy de ${tipo}: "$ & acumulado, Colors.Blue)
' Return NumberFormat2(acumulado, 1, 2, 2, False)
'End Sub
Sub traePrecio(id As String) As String
Private precio As String = "0"
@@ -2166,4 +2200,132 @@ Sub traePrecio(id As String) As String
precio = c.GetString("CAT_GP_PRECIO")
End If
Return precio
End Sub
End Sub
'
'Sub trendSpendingFuncs(accion As String, tipo As String, clienteId As String, id As String, laCant As String, inv As Int) As String
' Private logger As Boolean = True
' Dim kh As kms_helperSubs
' kh.Initialize("kh", "kh", Starter.skmt)
' Dim TS_RMI() As String
' Dim TS_DESCUENTOS() As String
' Dim TS_BONIFICACIONES() As String
' Private mx As Map = traeInfoTrendSpending
' TS_RMI = Regex.Split(",", mx.Get("RMI"))
' TS_DESCUENTOS = Regex.Split(",", mx.Get("DESCUENTOS"))
' TS_BONIFICACIONES = Regex.Split(",", mx.Get("BONIFICACIONES"))
'
' If tipo.ToUpperCase = "RMI" Then
' Private lasMaximas As Int = 0
' Log($"Acumulado de RMIs: ${traeAcumuladoHoyTS("rmi")}"$)
' Private elMonto As String = NumberFormat2(traePrecioRMI(id), 1, 2, 2, False)
' Log($"elMonto: ${elMonto}"$)
' Log($"TS_RMI(0): ${TS_RMI(0)}"$)
' Log($"TS_RMI(1): ${TS_RMI(1)}"$)
' Log($"LaCant: ${laCant}"$)
' Private rmisRestantes As String = (TS_RMI(0) - TS_RMI(1) - traeAcumuladoHoyTS("rmi"))
' Log($"rmisRestantes: ${rmisRestantes}"$)
'
' If accion.ToUpperCase = "PRODMAS" Then 'Regresa lasMaximas y elMonto separadas por un "|"
' If elMonto > 0 Then
' lasMaximas = ((laCant * elMonto) + rmisRestantes) / elMonto
' If logger Then Log("lasMaximas: " & lasMaximas)
' If logger Then Log(traeAcumuladoHoyTS("rmi"))
' End If
'' If laCant + 1 = lasMaximas Then
'' ToastMessageShow("El presupuesto de RMI no permite agregar mas productos!!", False)
'' End If
' If logger Then Log("EL RMI: " & elMonto)
' Log($"lacant=${laCant} < lasMaximas=${lasMaximas} = ${laCant<lasMaximas}"$)
' If laCant < lasMaximas Then
' modTrendSpending("resta", "rmi", elMonto) ' Restamos al presupuesto de hoy (agregamos al acumulado).
' End If
' If logger Then Log("RMI RESTANTES: " & (TS_RMI(0) - TS_RMI(1) - traeAcumuladoHoyTS("rmi")))
' Return lasMaximas & "|" & elMonto
' else if accion.ToUpperCase = "PRODMENOS" Then
' If logger Then Log("LaCANT= " & laCant & ", elMonto= " & elMonto)
' If laCant >= 0 Then
' modTrendSpending("suma", "rmi", elMonto) ' Agregamos al presupuesto de hoy (restamos del acumulado).
' End If
' Return lasMaximas & "|" & elMonto
' End If
' else If tipo.ToUpperCase = "BONIFICACIONES" Then
' Dim lasMaximas As Int = 0
' Dim elMonto As String = 0
' Private elMonto As String = NumberFormat2(kh.traePrecio(id)*(kh.traeDescXSku(clienteId, id)/100), 1, 2, 2, False)
' Private BonsRestantes As String = (TS_BONIFICACIONES(0) - TS_BONIFICACIONES(1) - traeAcumuladoHoyTS("bonificaciones"))
' If logger Then Log("EL MONTO: " & elMonto)
' Log("Monto del presupuesto disponible: " & BonsRestantes)
' If accion.ToUpperCase = "PRODMAS" Then 'Regresa lasMaximas y elMonto separadas por un "|"
' Log("PMAS")
' If elMonto > 0 Then
' lasMaximas = ((laCant * elMonto) + BonsRestantes) / elMonto
' If logger Then Log("lasMaximas: " & lasMaximas)
' If logger Then Log(traeAcumuladoHoyTS("bonificaciones"))
' End If
' If laCant = lasMaximas Then
' ToastMessageShow("El presupuesto de BONIFICACIONES no permite agregar mas productos!!", False)
' End If
' If logger Then Log("EL MONTO: " & elMonto)
' If inv > 0 And laCant < lasMaximas Then
' modTrendSpending("resta", "bonificaciones", elMonto) ' Restamos al presupuesto de hoy (agregamos al acumulado).
' End If
' If logger Then Log(">>>> MONTO RESTANTE PRESUPUESTO: " & (TS_BONIFICACIONES(0) - TS_BONIFICACIONES(1) - traeAcumuladoHoyTS("bonificaciones")))
' Return lasMaximas & "|" & elMonto
' else if accion.ToUpperCase = "PRODMENOS" Then 'Regresa bonificacionesMaximas y elMonto separadas por un "|"
' If logger Then Log("LaCANT= " & laCant & ", elMonto= " & elMonto)
' If laCant >= 0 Then
' modTrendSpending("suma", "bonificaciones", elMonto) ' Agregamos al presupuesto de hoy (restamos del acumulado).
' End If
' Return lasMaximas & "|" & elMonto
' else if accion.ToUpperCase = "TEXTCHANGED" Then
' Log("TC")
'' Private laBonificacion As String = NumberFormat2(kh.traePrecio(id)*(kh.traeDescXSku(clienteId, id)/100), 1, 2, 2, False)
'' Log("LA BONIFICACION: " & laBonificacion)
'' Private BonsRestantes As String = (TS_BONIFICACIONES(0) - TS_BONIFICACIONES(1) - traeAcumuladoHoyTS("bonificaciones"))
'' Log("Monto de BONIFICACIONES disponible: " & BonsRestantes)
'' Private maxDispPorBonificaciones As Int = (BonsRestantes/laBonificacion).As(Int)
'' Log($"Max disponibles por bonificaciones: ${maxDispPorBonificaciones}"$)
'' If laBonificacion > 0 Then
'' If New > bonificacionesMaximas Then
'' If inv > bonificacionesMaximas Then
'' laCant = bonificacionesMaximas
'' Else
'' laCant = inv
'' End If
'' End If
'' Else if laBonificacion = 0 Then
'' If laCant > inv Or New > inv Then
''' Log("Se pasa!!")
''' Log($"Ponemos laCant en: ${inv}"$)
'' laCant = inv
'' End If
'' End If
'' modTrendSpending("resta", "bonificaciones", ((New * laBonificacion) - (Old * laBonificacion)))
'' Log(traeAcumuladoHoyTS("bonificaciones"))
'' Return bonificacionesMaximas & "|" & laBonificacion
' else if accion.ToUpperCase = "FOCUSCHANGED" Then 'Regresa bonificaciones maximas, SOLO correr esta parte si HASFOCUS es VERDADERO.
' Log("FC")
' Private elMonto As String = kh.traePrecio(id)*(kh.traeDescXSku(clienteId, id)/100)
' If elMonto > 0 Then 'And HasFocus
' If logger Then Log("LA BONIFICACION: " & elMonto)
' Private BonsRestantes As String = (TS_BONIFICACIONES(0) - TS_BONIFICACIONES(1) - traeAcumuladoHoyTS("bonificaciones"))
' If logger Then Log("Monto del PRESUPUESTO disponible: " & BonsRestantes)
' lasMaximas = ((laCant * elMonto) + BonsRestantes) / elMonto
' If logger Then Log("bonificacionesMaximas: " & lasMaximas)
' End If
' Return lasMaximas
' End If
' End If
'End Sub
'
'' Trae el precio del RMI desde CAT_RMI.
'Sub traePrecioRMI(id As String) As String
' Private precio As String = "0"
' Private c As Cursor = Starter.skmt.ExecQuery($"select cat_monto from cat_rmi where cat_id = '${id}'"$)
' If c.RowCount > 0 Then
' c.Position = 0
' precio = c.GetString("CAT_MONTO")
' End If
' Return precio
'End Sub