VERSION 6.03.15

- Se corrige un error en el calculo del trade spending para que en algunos casos no calculaba bien en presupuesto.
- Se hace un cambio en subs.actualizaProducto, porque no ponia en 0 la bandera de pc_enviado.
This commit is contained in:
2026-03-17 09:57:11 -06:00
parent 60aa115e24
commit f5fe4c4a52
7 changed files with 30 additions and 24 deletions

View File

@@ -347,7 +347,7 @@ Sub traeBonificacionesMaximas(tipo As String, clienteId As String, id As String,
If thisLog Then LogColor($" ============ INICIA BONIFICACIONES MAXIMAS (${id}) ========"$, Colors.RGB(0,197,110))
If thisLog Then LogColor($" Presupuesto: ${TS_BONIFICACIONES(0)} - Acumulado ayer: ${TS_BONIFICACIONES(1)} - Hoy: ${traeAcumuladoHoyTS("bonificaciones")}"$, Colors.Magenta)
If tipo.ToUpperCase = "BONIFICACIONES" Then
tsMonto = NumberFormat2(traeMontoBonificacion(id, elPrecioVenta, promoId), 1, 2, 2, False)
tsMonto = NumberFormat2(traeMontoBonificacion(id, elPrecioVenta, promoId, "traeBonificacionesMaximas"), 1, 2, 2, False)
tsRestantes = (TS_BONIFICACIONES(0) - TS_BONIFICACIONES(1) - traeAcumuladoHoyTS("bonificaciones")) ' Traemos monto restante de Trend Spending para bonificaciones.
Log($" PresupuestoBonifs: ${TS_BONIFICACIONES(0)}, AcumuladoBonifs: ${TS_BONIFICACIONES(1)}, traeAcumuladoHoyTS('bonificaciones'): ${traeAcumuladoHoyTS("bonificaciones")}"$)
' Log($" ${TS_BONIFICACIONES(0)} - ${TS_BONIFICACIONES(1)} - ${traeAcumuladoHoyTS("bonificaciones")}"$)
@@ -369,11 +369,11 @@ End Sub
' Trae el monto de la bonificacion, que es el precio original MENOS el precio de venta con descuento.
' - Si CAT_DP_PRECIOB es 1, la bonificacion es: Precio original - precio de venta.
' - Si CAT_DP_PRECIOB es 0, la bonificacion es: Precio original.
Sub traeMontoBonificacion(id As String, precio As String, promoId As String) As String
' - Si CAT_DP_PRECIOB es 0, la bonificacion es: .
Sub traeMontoBonificacion(id As String, precio As String, promoId As String, parent As String) As String
Private thisLog As Boolean = True
If thisLog Then LogColor($" ============ INICIA MONTO BONIFICACION (${id}) ========"$, Colors.RGB(151,0,171))
If thisLog Then LogColor($" ###### ${promoId}, ${precio}, ${id}"$, Colors.Magenta)
If thisLog Then LogColor($" ###### ${id}, ${precio}, ${promoId}, ${parent}"$, Colors.Magenta)
Private tsMonto As String = 0
Private re As Cursor = Starter.skmt.ExecQuery($"select cat_gp_id from cat_gunaprod2 where (cat_gp_tipo like 'REGALO%' or cat_gp_tipo like 'EXHIBIDOR%') and cat_gp_id = '${id}'"$) ' Revisamos si el producto es regalo o exhibidor.
If re.RowCount = 0 Then' No es regalo ni exhibidor.
@@ -382,6 +382,7 @@ Sub traeMontoBonificacion(id As String, precio As String, promoId As String) As
If thisLog Then Log($" Rowcount DP y CGP2: ${c.RowCount}"$)
If c.RowCount > 0 Then
c.Position = 0
LogColor($"Precio original:${c.GetString("CAT_GP_PRECIO")} - Precio Venta:${c.GetString("CAT_DP_PRECIO")}"$, Colors.Blue)
If c.GetInt("CAT_DP_PRECIOB") = 1 Or (c.GetInt("CAT_DP_PRECIOB") = 0 And c.GetString("CAT_GP_PRECIO") = c.GetString("CAT_DP_PRECIO")) Then
tsMonto = c.GetString("CAT_GP_PRECIO") - c.GetString("CAT_DP_PRECIO") ' Precio original - precio de venta.
Else
@@ -404,8 +405,9 @@ End Sub
' se agoto el presupuesto.
' Aunque si hay suficiente para mostrar algunas promos ... pues que si las muestre.
Sub maxPromosPorProdsVariables(idProdsVariables As List, promo As String)As Int
Private logger As Boolean = False
Private logger As Boolean = True
Private Maxs As Int = 10000000
Private elPrecio As String = 0
Private prodsVariablesXPresupuestoBonificaciones As List
Private prodsVariablesRequeridos As Int = traeProdsVariablesRequeridos(promo)
prodsVariablesXPresupuestoBonificaciones.Initialize
@@ -413,8 +415,14 @@ Sub maxPromosPorProdsVariables(idProdsVariables As List, promo As String)As Int
For i = 0 To idProdsVariables.Size - 1 'Obtenemos total de productos variables disponibes.
If logger Then LogColor($"=>> prodVariable ${i} : ${idProdsVariables.Get(i)}, ${Subs.traeProdNombre(idProdsVariables.Get(i))} <<=="$, Colors.blue)
' Log($"Este invDisponible: ${invDispParaPromo.Get(idProdsVariables.Get(i))}"$)
If logger Then Log(">> Monto Bonificacion: " & traeMontoBonificacion(idProdsVariables.Get(i), 1, promo))
Private maxProds As Int = traeBonificacionesMaximas("bonificaciones", traeCliente, idProdsVariables.Get(i), prodsVariablesRequeridos, 1, promo)
' If logger Then Log(">> Monto Bonificacion: " & traeMontoBonificacion(idProdsVariables.Get(i), 1, promo))
Private ep As Cursor = Starter.skmt.ExecQuery($"select cat_dp_precio from cat_detalles_paq where cat_dp_id = '${promo}' and cat_dp_idprod = '${idProdsVariables.Get(i)}'"$)
If ep.RowCount > 0 Then
ep.Position = 0
Log("=========>>>> " & ep.GetString("CAT_DP_PRECIO"))
elPrecio = ep.GetString("CAT_DP_PRECIO")
End If
Private maxProds As Int = traeBonificacionesMaximas("bonificaciones", traeCliente, idProdsVariables.Get(i), prodsVariablesRequeridos, elPrecio, promo)
prodsVariablesXPresupuestoBonificaciones.Add(maxProds)
Next
prodsVariablesXPresupuestoBonificaciones.Sort(True)