This commit is contained in:
cvaldes1201
2024-05-16 10:40:42 -06:00
parent 047d927224
commit a2f036d7f7
7 changed files with 40 additions and 30 deletions

View File

@@ -968,9 +968,8 @@ End Sub
Sub traeMaxPromos(pm As Map) As Int
Private thisLog As Boolean = False 'Si es verdadero, muestra los logs de este sub.
Private maxPromos As List
Private mp0 As String = "0", mp As String = "0"
Private mp0, mp As String = "0"
maxPromos.Initialize
Log("mp:" & maxPromos)
Private hccp As Cursor = Starter.skmt.ExecQuery($"select HCCP_CANT from HIST_CLIENTE_CANT_PROMOS where HCCP_CLIENTE = '${traeCliente}' and HCCP_PROMO = '${pm.Get("id")}'"$)
' Log($"select HCCP_CANT from HIST_CLIENTE_CANT_PROMOS where HCCP_CLIENTE = '${traeCliente}' and HCCP_PROMO = '${pm.Get("id")}'"$)
' If hccp.RowCount > 0 Then
@@ -982,19 +981,15 @@ Sub traeMaxPromos(pm As Map) As Int
If thisLog Then LogColor("==== HISTORICO:"&pm.Get("historico"), Colors.Red)
If thisLog Then Log(pm)
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")) 'Agregamos maxPromos
If pm.Get("maxXcliente") <> Null Then maxPromos.Add(pm.Get("maxXcliente")) 'Agregamos maxXcliente
Log(hccp.RowCount)
maxPromos.Add(pm.Get("maxPromos")) 'Agregamos maxPromos
maxPromos.Add(pm.Get("maxXcliente")) 'Agregamos maxXcliente
If hccp.RowCount > 0 Then 'Agregamos promos HCCP
hccp.Position = 0
maxPromos.Add(hccp.GetString("HCCP_CANT"))
End If
Log(maxPromos)
If maxPromos.Size > 0 Then
maxPromos.Sort(True)
mp0 = maxPromos.Get(0)
End If
maxPromos.Sort(True)
If thisLog Then Log(maxPromos)
mp0 = maxPromos.Get(0)
mp = mp0 - traePromosVendidas(pm.Get("id"), traeCliente)
If thisLog Then Log($"Max Promos (${mp0}) - promos vendidas (${(traePromosVendidas(pm.Get("id"), traeCliente)).As(Int)}) = ${mp}"$)
Return mp 'Regresamos el numero mas pequeño de las opciones.