mirror of
https://github.com/KeymonSoft/Guna_Preventa.git
synced 2026-04-19 21:59:15 +00:00
25/10/23 - Código para promos x ruta
- Se agregó código para procesar las promos por ruta.
This commit is contained in:
42
B4A/Subs.bas
42
B4A/Subs.bas
@@ -848,13 +848,23 @@ Sub traeMaxPromos(pm As Map) As Int
|
||||
Private vendidas As Int = 0
|
||||
maxPromos.Initialize
|
||||
' If Starter.promosLog Then Log("==== HISTORICO:"&pm.Get("historico"))
|
||||
If thisLog Then Log(pm)
|
||||
If pm.Get("historico") = "1" Then maxPromos.Add(pm.Get("maxRecurrente")) 'Si hay historico, agregamos maxRecurrente
|
||||
maxPromos.Add(pm.Get("maxPromos")) 'Agregamos maxPromos
|
||||
maxPromos.Add(pm.Get("maxXcliente")) 'Agregamos maxXcliente
|
||||
If thisLog Then Log(maxPromos)
|
||||
If thisLog Then Log("TRAEMAXPROMOS PM: " & pm)
|
||||
If pm.Get("historico") = "1" Then maxPromos.Add(pm.Get("maxRecurrente").As(Int)) 'Si hay historico, agregamos maxRecurrente
|
||||
maxPromos.Add(pm.Get("maxPromos").As(Int)) 'Agregamos maxPromos
|
||||
maxPromos.Add(pm.Get("maxXcliente").As(Int)) 'Agregamos maxXcliente
|
||||
|
||||
|
||||
Private pr As Cursor = B4XPages.MainPage.skmt.ExecQuery($"select PR_CANT from PROMOXRUTA where PR_PROMOID = '${pm.Get("id")}'"$)
|
||||
If pr.RowCount > 0 Then
|
||||
pr.Position = 0
|
||||
maxPromos.Add(pr.GetString("PR_CANT").As(Int)) 'Agregamos maxXruta
|
||||
End If
|
||||
|
||||
' maxPromos.Add(2)
|
||||
If thisLog Then Log("maxpromos -> " & maxPromos)
|
||||
maxPromos.Sort(True)
|
||||
|
||||
Log("MAXP -> " & maxPromos)
|
||||
Log("=========== " & maxPromos.Get(0))
|
||||
' Log($"|${pm.Get("id").As(String).trim}|${traeCliente.Trim}|"$)
|
||||
Private c As Cursor = B4XPages.MainPage.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
|
||||
@@ -862,7 +872,7 @@ Sub traeMaxPromos(pm As Map) As Int
|
||||
vendidas = c.GetInt("vendidas")
|
||||
' Log(vendidas)
|
||||
End If
|
||||
|
||||
|
||||
' If Starter.promosLog Then Log(maxPromos)
|
||||
' If Starter.promosLog Then Log("Max Promos="&maxPromos.Get(0))
|
||||
' LogColor($"maxPromos=${maxPromos.Get(0)} - vendidas=${vendidas}"$, Colors.red)
|
||||
@@ -1102,4 +1112,22 @@ Sub guardaAppInfo(skmt As SQL) 'ignore
|
||||
skmt.ExecNonQuery("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = 'EMPRESA' or CAT_VA_DESCRIPCION = 'APP_NAME' or CAT_VA_DESCRIPCION = 'APP_VERSION'")
|
||||
skmt.ExecNonQuery($"insert into CAT_VARIABLES (CAT_VA_DESCRIPCION, CAT_VA_VALOR) values ('APP_NAME', '${Application.LabelName}')"$)
|
||||
skmt.ExecNonQuery($"insert into CAT_VARIABLES (CAT_VA_DESCRIPCION, CAT_VA_VALOR) values ('APP_VERSION', '${Application.VersionName}')"$)
|
||||
End Sub
|
||||
|
||||
'Actualiza la tabla PROMOXRUTA con la cantidad especificada.
|
||||
Sub guardaPromoXruta(laPromo As String, laCant As Int) 'ignore
|
||||
|
||||
B4XPages.MainPage.skmt.ExecNonQuery($"update PROMOXRUTA set PR_CANT = PR_CANT - ${laCant} where PR_PROMOID = '${laPromo}'"$)
|
||||
Log($"${laPromo} - ${laCant}"$)
|
||||
|
||||
End Sub
|
||||
|
||||
'Muestra en el Log los campos y valores que regresan en el JobDone.
|
||||
Sub logJobDoneResultados(resultado As DBResult) 'ignore
|
||||
For Each records() As Object In resultado.Rows
|
||||
LogColor($"====== ${resultado.Tag} - REGISTROS = ${resultado.Rows.Size}"$, Colors.RGB(215,37,0))
|
||||
For Each k As String In resultado.Columns.Keys
|
||||
LogColor(k & " = " & records(resultado.Columns.Get(k)), Colors.RGB(215,37,0))
|
||||
Next
|
||||
Next
|
||||
End Sub
|
||||
Reference in New Issue
Block a user