mirror of
https://github.com/KeymonSoft/Kelloggs_v4.git
synced 2026-04-17 18:26:11 +00:00
- VERSOIN 5.11.26
- Se agregó le descripcion del "flujo" de las promociones en C_Promos
This commit is contained in:
@@ -167,6 +167,12 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
Starter.skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS VERSIONES (VERSION TEXT, FECHA TEXT)")
|
||||
Starter.skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS CAT_INVENTARIO(CI_IDPROD TEXT, CI_INVENTARIO TEXT)")
|
||||
''' FIN DOE
|
||||
Starter.skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS CAT_NOTIFICACIONES(CN_CODIGO TEXT, CN_ID TEXT,CN_CLIENTE TEXT, CN_NOTIFICACION TEXT)")
|
||||
Starter.skmt.ExecNonQuery("CREATE TABLE If Not EXISTS HIST_NOTIFICACIONES (HN_CODIGO TEXT, HN_ID TEXT, HN_FECHA TEXT)")
|
||||
Starter.skmt.ExecNonQuery("CREATE TABLE If Not EXISTS CAT_GUNAPROD5 (CAT_GP_ID TEXT, CAT_GP_ALMACEN TEXT)")
|
||||
Starter.skmt.ExecNonQuery("CREATE INDEX IF NOT EXISTS idx_pedido_proid ON PEDIDO(PE_PROID)")
|
||||
Starter.skmt.ExecNonQuery("CREATE INDEX IF NOT EXISTS idx_pedido_cliente ON PEDIDO(PE_CLIENTE)")
|
||||
Starter.skmt.ExecNonQuery("CREATE INDEX IF NOT EXISTS idx_cat5_id ON CAT_GUNAPROD5(CAT_GP_ID)")
|
||||
kh.agregaColumna(Starter.skmt, "kmt_info", "IMPRESION", "INTEGER")
|
||||
kh.agregaColumna(Starter.skmt, "kmt_info", "CREDITO", "INTEGER")
|
||||
kh.agregaColumna(Starter.skmt, "PEDIDO", "PE_ENVIADO", "INTEGER DEFAULT 0")
|
||||
|
||||
@@ -11,6 +11,7 @@ Sub Class_Globals
|
||||
Dim g As GPS
|
||||
Dim kh As kms_helperSubs
|
||||
Dim reqManager As DBRequestManager
|
||||
Dim cmd As DBCommand
|
||||
Dim ruta As String
|
||||
Dim clie_id As String
|
||||
Dim sDate,sTime As String
|
||||
@@ -48,6 +49,8 @@ Sub Class_Globals
|
||||
Dim C1 As Cursor
|
||||
Dim C3 As Cursor
|
||||
Dim C4, C5, C6, C8 As Cursor
|
||||
Dim c2 As Cursor
|
||||
Dim S2 As Cursor
|
||||
Dim RMI As String
|
||||
Dim ListView1 As ListView
|
||||
Dim la_cuenta As Label
|
||||
@@ -79,9 +82,6 @@ Sub Class_Globals
|
||||
Dim Guardar As Button
|
||||
' Dim NUEVO As Button
|
||||
Dim l_total As Label
|
||||
Dim c2 As Cursor
|
||||
Dim S2 As Cursor
|
||||
Private s As Cursor
|
||||
Dim res As String
|
||||
Private HIST As Button
|
||||
Private MONTO_COMPRA As String
|
||||
@@ -295,6 +295,11 @@ Sub Class_Globals
|
||||
Private e_comm As EditText
|
||||
Private p_infoGral2 As Panel
|
||||
Dim indicePregunta As Int
|
||||
Private p_transparenciaNoti As Panel
|
||||
Private p_Notificacion As Panel
|
||||
Private l_notificacionTexto As Label
|
||||
Private l_notificacionTitulo As Label
|
||||
Private b_notificacion As Button
|
||||
End Sub
|
||||
|
||||
'You can add more parameters here.
|
||||
@@ -375,6 +380,7 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
Else
|
||||
RutaBoleta=Starter.rutaV
|
||||
End If
|
||||
If s.IsInitialized Then s.Close
|
||||
End If
|
||||
c=Starter.skmt.ExecQuery2("select CAT_VA_VALOR from CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = ?", Array As String ("MACIMP"))
|
||||
c.Position = 0
|
||||
@@ -390,7 +396,6 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
c.Close
|
||||
Panel_INV_A.Left = 0 : Panel_INV_A.top = 0
|
||||
Panel10.Left = 0 : Panel10.top = 0
|
||||
If s.IsInitialized Then s.Close
|
||||
' Log("################# PERMISOS BT: " & Starter.rp.Check("android.permission.BLUETOOTH_CONNECT"))
|
||||
' Log("Permisos BT: " & Starter.rp.Check("android.permission.BLUETOOTH_CONNECT"))
|
||||
' Log("REVISAMOS PERMISOS DE BT")
|
||||
@@ -799,6 +804,7 @@ Sub B4XPage_Appear
|
||||
MsgboxAsync($"Promo por monto "${Subs.traeProdNombre(mPromoXMonto.Get("id"))}" agregada."$,"AVISO")
|
||||
B4XPage_Appear
|
||||
End If
|
||||
dp.Close
|
||||
End If
|
||||
End If
|
||||
Private ppm As Cursor = Starter.skmt.ExecQuery($"select (select ifnull(sum(PE_COSTO_TOT),0) from pedido where CAT_PA_ID <> pe_cedis) as CT, ifnull((select pe_cedis from pedido where pe_cedis = CAT_PA_ID), 0) as existe, * from PROMOS_COMP where CAT_PA_TIPO_PROMONTO = '1' and CT < cast(cat_pa_precio1 as integer)"$) 'Traemos las promos por monto donde la venta es menor al precio1 para borrarlas.
|
||||
@@ -817,10 +823,28 @@ Sub B4XPage_Appear
|
||||
B4XPage_Appear
|
||||
End If
|
||||
End If
|
||||
ppm.Close
|
||||
If Not(Subs.revisaHora) Then
|
||||
Log("***************** HORA INCORRECTA")
|
||||
MsgboxAsync("La hora del equipo NO coincide con la hora del servidor, es necesario corregirla", "AVISO IMPORTANTE")
|
||||
End If
|
||||
c = Starter.skmt.ExecQuery($"select * from cat_notificaciones where CN_CLIENTE = '${Subs.traeCliente}'"$)
|
||||
Log("###############################################################")
|
||||
Log(c.RowCount)
|
||||
Log("###############################################################")
|
||||
If c.RowCount > 0 Then
|
||||
c.Position = 0
|
||||
l_notificacionTexto.Text = c.GetString("CN_NOTIFICACION")
|
||||
p_transparenciaNoti.Top = 0 : p_transparenciaNoti.Left = 0
|
||||
p_transparenciaNoti.Height = Root.Height
|
||||
p_transparenciaNoti.Width = Root.Width
|
||||
Subs.centraPanel(p_Notificacion, Root.Width)
|
||||
p_transparenciaNoti.Visible = True
|
||||
Log(c.GetString("CN_ID") & "|" & c.GetString("CN_CODIGO"))
|
||||
b_notificacion.Tag = c.GetString("CN_ID") & "|" & c.GetString("CN_CODIGO")
|
||||
p_transparenciaNoti.BringToFront
|
||||
End If
|
||||
c.Close
|
||||
End Sub
|
||||
|
||||
Sub Printer1_Connected (Success As Boolean)
|
||||
@@ -896,7 +920,7 @@ Sub GPS_LocationChanged (Location1 As Location)
|
||||
If c.RowCount > 0 Then
|
||||
gps_boton_doe = c.GetString("CAT_CL_EMAIL")
|
||||
End If
|
||||
|
||||
c.Close
|
||||
' gest.Visible = True
|
||||
' gps_boton_doe ="1"
|
||||
' LogColor($"Distancia actual: ${distance}"$, Colors.Blue)
|
||||
@@ -909,6 +933,7 @@ Sub GPS_LocationChanged (Location1 As Location)
|
||||
clienteConPromo = x.GetString("clienteConPromo")
|
||||
' Log($"${x.GetString("clienteConPromo")}"$)
|
||||
End If
|
||||
x.Close
|
||||
' If pgs_boton_noventa = "1" Then b_noVenta.Visible = True
|
||||
' If gps_boton_doe ="1" Then b_whats.Visible = True
|
||||
|
||||
@@ -1171,6 +1196,7 @@ Sub B_IMP_Click
|
||||
C3.Position=0
|
||||
a_venta = C3.GetString("CANTIDAD")
|
||||
a_VENTA_F = C3.GetString("TOTAL")
|
||||
C3.Close
|
||||
Else
|
||||
a_venta = 0
|
||||
a_VENTA_F = 0
|
||||
@@ -1193,6 +1219,10 @@ Sub B_IMP_Click
|
||||
Next
|
||||
End If
|
||||
s.Close
|
||||
If S1.IsInitialized Then S1.Close
|
||||
If S3.IsInitialized Then S3.Close
|
||||
If S2.IsInitialized Then S2.Close
|
||||
If C4.IsInitialized Then C4.Close
|
||||
End Sub
|
||||
|
||||
Sub B_IMP2_Click
|
||||
@@ -1317,6 +1347,7 @@ Sub Imprime_ticket
|
||||
cr.Position = 0
|
||||
If cr.GetInt("CREDITO") = 1 Then formaPago = "Crédito"
|
||||
End If
|
||||
cr.Close
|
||||
If la_cuenta.Text = "0" Then
|
||||
LogColor(123, Colors.red)
|
||||
Try
|
||||
@@ -3945,6 +3976,7 @@ Sub revisaPromoEspecial As Map
|
||||
y.Position = 0
|
||||
nombreProd = y.GetString("nombreProd")
|
||||
End If
|
||||
y.Close
|
||||
Log("El cliente tiene asignada la promo especial.")
|
||||
Private p As Cursor
|
||||
p=Starter.skmt.ExecQuery("select count(*) as hayInventario from CAT_GUNAPROD where CAT_GP_ALMACEN > 0 and CAT_GP_ID = " & x.GetString("CPM_PROID"))
|
||||
@@ -4419,4 +4451,25 @@ Sub revisaExistenciasDOE As Boolean 'ignore
|
||||
' 1, "LECHE ALL BRAN NUEZ 236ML", "1008027228"
|
||||
' 1, "LECHE CHOCO MELVIN 236ML", "1008013799"
|
||||
Return suficiente
|
||||
End Sub
|
||||
|
||||
Private Sub p_transparenciaNoti_Click
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub b_notificacion_Click
|
||||
Private tag As String = Sender.As(Button).Tag
|
||||
Log("-" & tag & "-")
|
||||
Private tag1() As String = Regex.Split("\|", tag)
|
||||
Log(tag1.Length & "-" & tag1(0) & "-" & tag1(1))
|
||||
Private CODIGO As String = tag1(0)
|
||||
Private ID As String = tag1(1)
|
||||
p_transparenciaNoti.Visible = False
|
||||
DateTime.DateFormat = "yyyy-MM-dd HH:mm:ss"
|
||||
Starter.skmt.ExecNonQuery($"insert into HIST_NOTIFICACIONES (HN_CODIGO, HN_ID, HN_FECHA) values ('${CODIGO}', '${ID}', '${DateTime.Date(DateTime.Now)}')"$)
|
||||
Log(123)
|
||||
cmd.Initialize
|
||||
cmd.Name = "updateHistNotificacionesMotivo"
|
||||
cmd.Parameters = Array As Object("", DateTime.Date(DateTime.Now), Subs.traeRuta, usuario, Subs.traeAlmacen, clienteId)
|
||||
reqManager.ExecuteCommand(cmd , "updateHistNotificacionesMotivo")
|
||||
End Sub
|
||||
@@ -595,6 +595,9 @@ Sub B4XPage_Appear
|
||||
If n.GetString("cuantos") >= kh.traeMaxClientesNuevos Then NUEVO.Enabled = False
|
||||
' LogColor(">>>>>>>> REVISAMOS GUID <<<<<<<<<", Colors.red)
|
||||
' Subs.generaGUID_EnExterno
|
||||
|
||||
|
||||
Subs.RecalcularInventario
|
||||
End Sub
|
||||
|
||||
Sub trabajar_Click
|
||||
@@ -623,7 +626,6 @@ Sub trabajar_Click
|
||||
End Sub
|
||||
|
||||
Sub Subir_Click
|
||||
|
||||
' Buscamos los clientes que tienen pedido y NO estan impresos.
|
||||
Private t As Cursor = Starter.skmt.ExecQuery("Select cat_cl_codigo from kmt_info where impresion = 0 and cat_cl_codigo not in (select ci_cuenta from cliente_impreso) and cat_cl_codigo in (select distinct pe_cliente from pedido)")
|
||||
If t.RowCount > 0 Then
|
||||
@@ -635,9 +637,8 @@ Sub Subir_Click
|
||||
' Msgbox2Async($"El pedido del cliente ${t.GetString("CAT_CL_CODIGO")} no está impreso, se va a borrar"$, "PEDIDO NO IMPRESO", "Aceptar", "", "", Null, True)
|
||||
Next
|
||||
End If
|
||||
|
||||
Sleep(1000)
|
||||
|
||||
|
||||
CARGA = "SUBIR"
|
||||
' P1.Visible = True
|
||||
trabajar.Visible = False
|
||||
@@ -692,6 +693,18 @@ Sub Subir_Click
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
Private hn As Cursor = Starter.skmt.ExecQuery($"select distinct HN_CODIGO, HN_ID from hist_notificaciones"$)
|
||||
If hn.RowCount > 0 Then
|
||||
For i = 0 To hn.RowCount - 1
|
||||
hn.Position = i
|
||||
cmd.Initialize
|
||||
cmd.Name = "borraHistNotificaciones"
|
||||
cmd.Parameters = Array As Object( hn.GetString("HN_CODIGO"), hn.GetString("HN_ID"))
|
||||
reqManager.ExecuteCommand(cmd , "borraHistNotificaciones_"&hn.GetString("HN_CODIGO")&"_"&hn.GetString("HN_ID"))
|
||||
Next
|
||||
End If
|
||||
hn.Close
|
||||
End Sub
|
||||
|
||||
Sub cargar_Click
|
||||
@@ -810,6 +823,7 @@ Sub cargar_Click
|
||||
Starter.skmt.ExecNonQuery("delete from DESC_CLIENTES")
|
||||
Starter.skmt.ExecNonQuery("delete from CAT_ENCUESTA_PREGUNTA")
|
||||
Starter.skmt.ExecNonQuery("delete from CAT_PROMO_MONTO")
|
||||
Starter.skmt.ExecNonQuery("delete from CAT_NOTIFICACIONES")
|
||||
''' PEDIDO DOE
|
||||
Starter.skmt.ExecNonQuery("delete from CAT_GUNAPROD_DOE")
|
||||
Starter.skmt.ExecNonQuery("delete from PEDIDO_DOE")
|
||||
@@ -1029,17 +1043,17 @@ Sub cargar_Click
|
||||
cmd.Name = "select_cat_clientes_guna_KELL2"
|
||||
cmd.Parameters = Array As Object(E_RUTA2.text, ALMACEN)
|
||||
' reqManager.ExecuteQuery(cmd , 0, "kmt_datos")
|
||||
|
||||
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_hist_datos_KELL"
|
||||
cmd.Parameters = Array As Object(E_RUTA2.text, ALMACEN,e_ruta.text, ALMACEN)
|
||||
reqManager.ExecuteQuery(cmd , 0, "hist_datos")
|
||||
|
||||
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_hist_promos_KELL"
|
||||
cmd.Parameters = Array As Object(E_RUTA2.text, ALMACEN)
|
||||
reqManager.ExecuteQuery(cmd , 0, "hist_promos")
|
||||
|
||||
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_hist_cliente_promos_KELL"
|
||||
cmd.Parameters = Array As Object(E_RUTA2.text, ALMACEN)
|
||||
@@ -1156,18 +1170,23 @@ Sub cargar_Click
|
||||
cmd.Name = "select_pedido_doe"
|
||||
cmd.Parameters = Array As Object( ALMACEN,e_ruta.text )
|
||||
reqManager.ExecuteQuery(cmd , 0, "pedido_doe")
|
||||
|
||||
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_cat_gunaprod_doe"
|
||||
cmd.Parameters = Array As Object( ALMACEN,e_ruta.text )
|
||||
reqManager.ExecuteQuery(cmd , 0, "cat_gunaprod_doe")
|
||||
''' FIN DOE
|
||||
|
||||
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_cat_devoluciones_KELL"
|
||||
cmd.Parameters = Array As Object(ALMACEN)
|
||||
reqManager.ExecuteQuery(cmd , 0, "prods_rmi")
|
||||
|
||||
|
||||
cmd.Initialize
|
||||
cmd.Name = "selectNotificaciones"
|
||||
cmd.Parameters = Array As Object(ALMACEN, e_ruta.Text)
|
||||
reqManager.ExecuteQuery(cmd , 0, "selectNotificaciones")
|
||||
|
||||
cargar.Visible = False
|
||||
Subir.Visible = False
|
||||
trabajar.Visible=False
|
||||
@@ -1525,6 +1544,7 @@ Sub JobDone(Job As HttpJob)
|
||||
Dim CAT_GP_TIPOPROD As Int = records(RESULT.Columns.Get("CAT_GP_TIPOPROD"))
|
||||
' Dim CAT_GP_DEV As String = records(RESULT.Columns.Get("CAT_GP_DEV"))
|
||||
Starter.skmt.ExecNonQuery2("INSERT INTO CAT_GUNAPROD2(CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG,CAT_GP_ALMACEN,CAT_GP_TIPOPROD,CAT_GP_DEV,CAT_GP_CODPROMO) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,0)", Array As Object (CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG, CAT_GP_ALMACEN,CAT_GP_TIPOPROD,"0"))
|
||||
Starter.skmt.ExecNonQuery2("INSERT INTO CAT_GUNAPROD5(CAT_GP_ID,CAT_GP_ALMACEN) VALUES (?,?)", Array As Object (CAT_GP_ID,CAT_GP_ALMACEN))
|
||||
' skmt.ExecNonQuery2("INSERT INTO CAT_GUNAPROD2(CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG,CAT_GP_ALMACEN,CAT_GP_TIPOPROD,CAT_GP_DEV,CAT_GP_CODPROMO) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,0)", Array As Object (CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG, CAT_GP_ALMACEN,CAT_GP_TIPOPROD,"0"))
|
||||
Next
|
||||
Starter.skmt.TransactionSuccessful
|
||||
@@ -1569,6 +1589,7 @@ Sub JobDone(Job As HttpJob)
|
||||
Dim CAT_GP_ALMACEN As Int = records(RESULT.Columns.Get("CAT_GP_ALMACEN"))
|
||||
Dim CAT_GP_TIPOPROD As Int = records(RESULT.Columns.Get("CAT_GP_TIPOPROD"))
|
||||
Starter.skmt.ExecNonQuery2("INSERT INTO CAT_GUNAPROD2(CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG,CAT_GP_ALMACEN,CAT_GP_TIPOPROD) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)", Array As Object (CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG, CAT_GP_ALMACEN,CAT_GP_TIPOPROD))
|
||||
Starter.skmt.ExecNonQuery2("INSERT INTO CAT_GUNAPROD5(CAT_GP_ID,CAT_GP_ALMACEN) VALUES (?,?)", Array As Object (CAT_GP_ID,CAT_GP_ALMACEN))
|
||||
' skmt.ExecNonQuery2("INSERT INTO CAT_GUNAPROD2(CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG,CAT_GP_ALMACEN,CAT_GP_TIPOPROD) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)", Array As Object (CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG, CAT_GP_ALMACEN,CAT_GP_TIPOPROD))
|
||||
Next
|
||||
Starter.skmt.TransactionSuccessful
|
||||
@@ -1885,9 +1906,12 @@ Sub JobDone(Job As HttpJob)
|
||||
End If
|
||||
|
||||
If RESULT.Tag = "ruta" Then 'query tag
|
||||
Log(654)
|
||||
Subs.logJobDoneResultados(RESULT)
|
||||
e_ruta.Enabled = True
|
||||
' Log(RESULT)
|
||||
' Log(RESULT.Columns.Get("VALIDO"))
|
||||
Log(RESULT)
|
||||
Log(RESULT.Columns.Get("VALIDO"))
|
||||
' Log(RESULT.Rows.Size)
|
||||
If RESULT.Columns.Get("VALIDO") = "0" Then ToastMessageShow("Ruta incorrecta", True)
|
||||
If RESULT.Rows.Size = 0 Then ToastMessageShow("No hay ruta para ese usuario", True)
|
||||
For Each records() As Object In RESULT.Rows
|
||||
@@ -2184,7 +2208,7 @@ Sub JobDone(Job As HttpJob)
|
||||
Starter.skmt.ExecNonQuery2("INSERT INTO CAT_RMI (CAT_ID, CAT_DESCRIPCION, CAT_MONTO) VALUES (?,?,?)", Array As Object (CAT_ID, CAT_DESCRIPCION, CAT_MONTO))
|
||||
Next
|
||||
End If
|
||||
|
||||
|
||||
If RESULT.Tag = "semanaCalLaboral" Then 'query tag
|
||||
' Subs.logJobDoneResultados(RESULT)
|
||||
For Each records() As Object In RESULT.Rows
|
||||
@@ -2194,6 +2218,17 @@ Sub JobDone(Job As HttpJob)
|
||||
Next
|
||||
End If
|
||||
|
||||
If RESULT.Tag = "selectNotificaciones" Then 'query tag
|
||||
Subs.logJobDoneResultados(RESULT)
|
||||
For Each records() As Object In RESULT.Rows
|
||||
Dim CN_CLIENTE As String = records(RESULT.COLUMNS.GET("HIST_NTC_IDCLIENTE"))
|
||||
Dim CN_NOTIFICACION As String = records(RESULT.COLUMNS.GET("HIST_NTC_NOTIFICACION"))
|
||||
Dim CN_CODIGO As String = records(RESULT.COLUMNS.GET("HIST_NTC_CODIGO"))
|
||||
Dim CN_ID As String = records(RESULT.COLUMNS.GET("HIST_NTC_ID"))
|
||||
Starter.skmt.ExecNonQuery2("INSERT INTO CAT_NOTIFICACIONES (CN_CODIGO, CN_ID, CN_CLIENTE, CN_NOTIFICACION) VALUES (?,?,?,?)", Array As Object (CN_CODIGO, CN_ID, CN_CLIENTE, CN_NOTIFICACION))
|
||||
Next
|
||||
End If
|
||||
|
||||
If RESULT.Tag = "trendSpending" Then 'query tag
|
||||
' Subs.logJobDoneResultados(RESULT)
|
||||
Starter.skmt.ExecNonQuery("delete from HIST_TREND_SPENDING_SEMANAL")
|
||||
@@ -2220,6 +2255,10 @@ Sub JobDone(Job As HttpJob)
|
||||
' Subs.logJobDoneResultados(RESULT)
|
||||
ts.Initialize(Me, "ts", Starter.skmt)
|
||||
End If
|
||||
|
||||
' If RESULT.Tag = "borraHistNotificaciones" Then enviaHistNotificaciones
|
||||
' If RESULT.Tag = "insertHistNotificaciones" Then revisaHistNotificaciones
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -2232,8 +2271,14 @@ Sub JobDone(Job As HttpJob)
|
||||
LogColor(reqManager.reqsList, Colors.blue)
|
||||
LogColor(reqManager.reqsList.Size, Colors.blue)
|
||||
If CARGA = "SUBIR" Then actualizaProgressBar
|
||||
|
||||
'Si ya se procesaron TODAS las peticiones, entonces realizamos validaciones.
|
||||
If reqManager.reqsList.Size = 0 Then
|
||||
If CARGA = "SUBIR" Then revisaHistNotificaciones
|
||||
End If
|
||||
End If
|
||||
' LogColor(reqTotales, Colors.blue)
|
||||
|
||||
|
||||
' If Starter.Logger Then Log($"tiempo Request "${Job.Tag}": ${((reqManager.inicioJobDone - reqManager.inicioRequest)/1000)}"$)
|
||||
' If Starter.Logger Then Log($"tiempo JobDone "${Job.Tag}": ${((DateTime.Now - reqManager.inicioJobDone)/1000)}"$)
|
||||
@@ -2250,6 +2295,48 @@ Sub JobDone(Job As HttpJob)
|
||||
' reqManager.PrintTable(RESULT)2
|
||||
End Sub
|
||||
|
||||
'Envia el historial de notificaciones despues de haberlas borrado para que no se dupliquen.
|
||||
Sub enviaHistNotificaciones
|
||||
Private hn As Cursor = Starter.skmt.ExecQuery($"select * from hist_notificaciones"$)
|
||||
If hn.RowCount > 0 Then
|
||||
For i = 0 To hn.RowCount - 1
|
||||
hn.Position = i
|
||||
cmd.Initialize
|
||||
cmd.Name = "insertHistNotificaciones"
|
||||
cmd.Parameters = Array As Object( hn.GetString("HN_CODIGO"), hn.GetString("HN_ID"), hn.GetString("HN_FECHA"))
|
||||
reqManager.ExecuteCommand(cmd , "insertHistNotificaciones")
|
||||
Next
|
||||
hn.Close
|
||||
End If
|
||||
End Sub
|
||||
|
||||
' Revisa que en web haya el numero correcto de notificaciones en el historial
|
||||
Sub revisaHistNotificaciones
|
||||
LogColor("####################### REVISA NOTIS ########", Colors.red)
|
||||
Private cn As Cursor = Starter.skmt.ExecQuery("select count(HN_CODIGO) as cuantos, HN_CODIGO, HN_ID from HIST_NOTIFICACIONES")
|
||||
If cn.RowCount > 0 Then
|
||||
cn.Position = 0
|
||||
Private CuantasN As Int = cn.GetInt("cuantos")
|
||||
cmd.Name = "selectCuantasNotificaciones"
|
||||
cmd.Parameters = Array As Object(cn.GetString("HN_ID"), cn.GetString("HN_CODIGO"))
|
||||
reqManagerW.ExecuteQuery(Starter.DBReqServer, cmd, Me, "selectCuantasNotificaciones")
|
||||
Wait For selectCuantasNotificaciones_Completed (r As TResultado)
|
||||
If r.Success Then
|
||||
LogColor("####################### selectCuantasNotificaciones ########", Colors.red)
|
||||
Subs.logJobDoneResultados(r.resultado)
|
||||
For Each records() As Object In r.resultado.Rows
|
||||
Dim CuantasN As Int = records(r.resultado.Columns.Get("CUANTOS"))
|
||||
If cn.GetInt("cuantos") > CuantasN Then
|
||||
enviaHistNotificaciones
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
Log(r.ErrorMessage)
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub actualizaProgressBar
|
||||
Log($"Porcentaje = ${(((reqTotales-reqManager.reqsList.Size)/reqTotales)*100).As(Int)}"$)
|
||||
Private porcentajePB2 As Int = (((reqTotales-reqManager.reqsList.Size)/reqTotales)*100).As(Int)
|
||||
@@ -2363,6 +2450,8 @@ Sub connecta_Click
|
||||
|
||||
reqManager.trackInit
|
||||
|
||||
' EL EVENTO DE CONECTAR AHORA SE DISPARA DESPUES DE REVISAR SI LA RUTA ESTA LIGADA O NO AL DISPOSITIVO (verifyDevice).
|
||||
' REVISAR EL SUB "Linker_Response"
|
||||
linker.verifyDevice(Subs.traeAlmacen, e_ruta.text)
|
||||
|
||||
' Else
|
||||
@@ -2379,22 +2468,25 @@ Sub connecta2
|
||||
If vv.GetString("CAT_VA_VALOR") = 0 Then revisaVersion = False
|
||||
End If
|
||||
If revisaVersion Then ' Si VALIDA_VERSION no está en CERO ... revisamos.
|
||||
Log(123)
|
||||
Dim cmd As DBCommand
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_version_KELL"
|
||||
cmd.Parameters = Array As Object(ALMACEN, e_ruta.text)
|
||||
reqManager.ExecuteQuery(cmd , 0, "version")
|
||||
Else ' Si está en CERO (Validacion deshabilitada), continuamos a connecta3.
|
||||
' Log(456)
|
||||
connecta3
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub connecta3
|
||||
' Log(789)
|
||||
Dim cmd As DBCommand
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_ruta5_KELL"
|
||||
cmd.Parameters = Array As Object(ALMACEN, e_ruta.text, usuario)
|
||||
' Log($"******* Almacen: ${ALMACEN}, ${e_ruta.text}, ${usuario}"$)
|
||||
Log($"******* Almacen: ${ALMACEN}, ${e_ruta.text}, ${usuario}"$)
|
||||
reqManager.ExecuteQuery(cmd , 0, "ruta")
|
||||
e_ruta.Enabled = False
|
||||
If e_ruta.Text = "KMTSKLL1" Then e_ruta.Enabled = True
|
||||
@@ -3188,6 +3280,8 @@ Sub SUBIR_INFO_PEDIDO
|
||||
cmd.Name ="insert_drop2_KELL"
|
||||
cmd.Parameters = Array As Object(usuario, l_ruta.Text, fecha, l_porvisitar.Text, l_drop.Text, l_efectiva.Text, l_cuantosc.Text, l_cuantosn.Text, monto1, "ENVIO", ALMACEN, abordo1)
|
||||
reqManager.ExecuteCommand(cmd , "inst_noventa_ins_drop_kell")
|
||||
Log($"${usuario}, ${l_ruta.Text}, ${fecha}, ${l_porvisitar.Text}, ${l_drop.Text}, ${l_efectiva.Text}, ${l_cuantosc.Text}, ${l_cuantosn.Text}, ${monto1}, "ENVIO", ${ALMACEN}, ${abordo1}"$)
|
||||
Log("################## inst_noventa_ins_drop_kell")
|
||||
img2.Visible =True
|
||||
contador_env = contador_env + 1
|
||||
S_CP.Text = "Envio Cabecera"
|
||||
@@ -3942,10 +4036,17 @@ Private Sub b_noVisita_Click
|
||||
Do While mnv.NextRow
|
||||
Subs.bitacora(Subs.fechanormal(DateTime.Now), usuario, alm, rut, "NO VISITADO", mnv.GetString("CAT_CL_CODIGO"), fech, fech, Starter.lat_gps, Starter.lon_gps, 2, "", r_razonNoVisita)
|
||||
Log($"NO VISITADO - ${mnv.GetString("CAT_CL_CODIGO")}"$)
|
||||
DateTime.DateFormat = "yyyy-MM-dd HH:mm:ss"
|
||||
' Actualizamos HIST_NOTIFICACIONES con la hora y el motivo.
|
||||
cmd.Initialize
|
||||
cmd.Name = "updateHistNotificacionesMotivo"
|
||||
|
||||
|
||||
' ("", DateTime.Date(DateTime.Now), Subs.traeRuta, usuario, Subs.traeAlmacen, clienteId)
|
||||
cmd.Parameters = Array As Object(r_razonNoVisita, DateTime.Date(DateTime.Now), Subs.traeRuta, usuario, ALMACEN, mnv.GetString("CAT_CL_CODIGO"))
|
||||
reqManager.ExecuteCommand(cmd , "insertHistNotificaciones")
|
||||
Loop
|
||||
|
||||
|
||||
|
||||
|
||||
' b_motivoNoVisita.Color = Colors.RGB(247, 94, 0)
|
||||
Private cd1 As ColorDrawable
|
||||
cd1.Initialize(Colors.RGB(247, 94, 0), 5dip)
|
||||
|
||||
@@ -13,10 +13,7 @@ Sub Class_Globals
|
||||
Dim q_buscar As String
|
||||
Dim forzarBusqueda As Boolean = False
|
||||
Dim skmt As SQL
|
||||
Dim c As Cursor
|
||||
Dim c2 As Cursor
|
||||
Dim C3 As Cursor
|
||||
Dim s As Cursor
|
||||
Dim ab, c, c2, c3, c_prods, pPromo, p1, prod, pPromos, s, s1 As Cursor
|
||||
Dim lv_catalogos As ListView
|
||||
Dim lv_promos As ListView
|
||||
Dim entro As String
|
||||
@@ -29,7 +26,6 @@ Sub Class_Globals
|
||||
Dim ya_entro As String
|
||||
Dim TIENE_PROMOS As String
|
||||
Dim RES As String
|
||||
Dim S1 As Cursor
|
||||
Dim bmp As Bitmap
|
||||
Dim ciclo As String
|
||||
Private b_qr As Button
|
||||
@@ -247,6 +243,7 @@ Sub B4XPage_Appear
|
||||
If c.GetInt("hayPromos") > 0 And Subs.traeCliente <> 0 And Subs.revisaImpresa = False Then
|
||||
lv_catalogos.AddSingleLine("PROMOS")
|
||||
End If
|
||||
c.Close
|
||||
Sleep(100)
|
||||
' l_total.Visible = False
|
||||
' l_totProds.Visible = False
|
||||
@@ -345,7 +342,7 @@ Sub lv_catalogos_ItemClick (Position As Int, Value As Object)
|
||||
|
||||
c2 = Starter.skmt.ExecQuery($"select CAT_PA_TIPO_PROMONTO, CAT_PA_PORCENTAJE_PAQUETE, CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_TIPOPROD2, CAT_GP_PRECIO, CAT_GP_ALMACEN, CAT_GP_IMG from ${Subs.traeTablaProds(Starter.tipov)} left join PROMOS_COMP on CAT_GP_ID = CAT_PA_ID where CAT_GP_ALMACEN > 0 AND CAT_GP_TIPO = '${Value}' AND CAT_GP_SUBTIPO = '${Value}' AND CAT_GP_TIPOPROD <> 1 and length(CAT_GP_CODPROMO) = 1 OR CAT_GP_CODPROMO = CAT_GP_ID ORDER BY CAT_GP_TIPOPROD2 DESC, CAT_GP_NOMBRE"$)
|
||||
|
||||
Log($"select CAT_PA_TIPO_PROMONTO, CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_TIPOPROD2, CAT_GP_PRECIO, CAT_GP_ALMACEN, CAT_GP_IMG from ${Subs.traeTablaProds(Starter.tipov)} left join PROMOS_COMP on CAT_GP_ID = CAT_PA_ID where CAT_GP_ALMACEN > 0 AND CAT_GP_TIPO = '${Value}' AND CAT_GP_SUBTIPO = '${Value}' AND CAT_GP_TIPOPROD <> 1 and length(CAT_GP_CODPROMO) = 1 OR CAT_GP_CODPROMO = CAT_GP_ID ORDER BY CAT_GP_TIPOPROD2 DESC, CAT_GP_NOMBRE"$)
|
||||
' Log($"select CAT_PA_TIPO_PROMONTO, CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_TIPOPROD2, CAT_GP_PRECIO, CAT_GP_ALMACEN, 1 as CAT_GP_IMG from ${Subs.traeTablaProds(Starter.tipov)} left join PROMOS_COMP on CAT_GP_ID = CAT_PA_ID where CAT_GP_ALMACEN > 0 AND CAT_GP_TIPO = '${Value}' AND CAT_GP_SUBTIPO = '${Value}' AND CAT_GP_TIPOPROD <> 1 and length(CAT_GP_CODPROMO) = 1 OR CAT_GP_CODPROMO = CAT_GP_ID ORDER BY CAT_GP_TIPOPROD2 DESC, CAT_GP_NOMBRE"$)
|
||||
|
||||
' Log($"Resultados : ${c2.RowCount}, ${Value}, ${marca}, ${tipo}"$)
|
||||
If c2.RowCount > 0 Then
|
||||
@@ -495,6 +492,11 @@ Sub llenaCatalogo(subtipo1 As String)
|
||||
End Sub
|
||||
|
||||
Private Sub B4XPage_CloseRequest As ResumableSub
|
||||
If c.IsInitialized Then c.Close
|
||||
If c2.IsInitialized Then c2.Close
|
||||
If c3.IsInitialized Then c3.Close
|
||||
If s.IsInitialized Then s.Close
|
||||
If s1.IsInitialized Then s1.Close
|
||||
' BACK key pressed
|
||||
' Return True To close, False To cancel
|
||||
If p_rmi.Visible Then p_rmi.Visible = False
|
||||
@@ -661,6 +663,7 @@ Sub b_prodMenos_Click
|
||||
invActualizado = i.GetString("CAT_GP_ALMACEN")
|
||||
End If
|
||||
If Starter.tipov <> "ABORDO" Then lProdX.Text = cs.Color(Colors.red).append(nombreX).pop.append(CRLF).Append("Existencias: " & invActualizado).Color(0xFF017F01).Append($" $${NumberFormat2(precio, 1, 2, 2, False)}"$).Popall
|
||||
i.Close
|
||||
End If
|
||||
If kh.totalPedido < 1 Then laCant.Text = "0"
|
||||
' Log($"Total Prods: ${totalProds}, Total Compra: $$1.2{totalCompra}"$)
|
||||
@@ -717,11 +720,12 @@ Sub b_prodMas_Click
|
||||
' Subs.modTrendSpending("resta", "bonificaciones", laBonificacion)
|
||||
' Log(Subs.traeAcumuladoHoyTS("bonificaciones"))
|
||||
' End If
|
||||
' Log("BONIFCACIONES RESTANTES: " & (TS_BONIFICACIONES(0) - TS_BONIFICACIONES(1) - Subs.traeAcumuladoHoyTS("bonificaciones")))
|
||||
Log("BONIFCACIONES RESTANTES: " & (TS_BONIFICACIONES(0) - TS_BONIFICACIONES(1) - ts.traeAcumuladoHoyTS("bonificaciones")))
|
||||
Private tsMonto As String = 0
|
||||
Private tsMaximas As Int = 0
|
||||
If lfila.Text = "PRODUCTOS" Then
|
||||
Log(">>>>>>>>>> PRODUCTOS <<<<<<<<<<<<<<")
|
||||
Log($"${TS_DESCUENTOS(0)} - ${TS_DESCUENTOS(1)} - ${ts.traeAcumuladoHoyTS("descuentos")}"$)
|
||||
Private tsRestantes As String = (TS_DESCUENTOS(0) - TS_DESCUENTOS(1) - ts.traeAcumuladoHoyTS("descuentos")) ' Traemos monto restante de Trend Spending para bonificaciones.
|
||||
tsMonto = NumberFormat2(ts.traePrecio(id)*(ts.traeDescXSku(clienteId, id)/100), 1, 2, 2, False) ' Traemos el monto (descuento total) del producto actual.
|
||||
tsMaximas = ((laCant.text * tsMonto) + tsRestantes) / tsMonto ' Traemos la cantidad maxima de descuentos por presupuesto de Trend Spending.
|
||||
@@ -844,6 +848,7 @@ Sub b_prodMas_Click
|
||||
invActualizado = i.GetString("CAT_GP_ALMACEN")
|
||||
End If
|
||||
If Starter.tipov <> "ABORDO" Then lProdX.Text = cs.Color(Colors.red).append(nombreX).pop.append(CRLF).Append("Existencias: " & invActualizado).Color(0xFF017F01).Append($" $${NumberFormat2(precio, 1, 2, 2, False)}"$).Popall
|
||||
i.Close
|
||||
End If
|
||||
Log($"Total Prods: ${totalProds}, Total Compra: $$1.2{totalCompra}"$)
|
||||
Sleep(300)
|
||||
@@ -1116,6 +1121,7 @@ Sub b_terminar1_Click
|
||||
If Subs.revisaImpresa Then b_rechazar.Visible = False Else b_rechazar.Visible = True
|
||||
p_vistaPrevia.Visible=True
|
||||
p_vistaPreviaTrans.Visible=True
|
||||
Subs.RecalcularInventario
|
||||
End Sub
|
||||
|
||||
Private Sub b_continuar_Click
|
||||
@@ -1144,6 +1150,7 @@ Private Sub b_continuar_Click
|
||||
montoPedidoActual = m.Get("monto")
|
||||
' LlenaProdsLL(Null)
|
||||
' BUSCA.Text = " "
|
||||
Subs.RecalcularInventario
|
||||
End Sub
|
||||
|
||||
Private Sub l_info_Click
|
||||
@@ -1160,6 +1167,7 @@ Private Sub lv_promos_ItemLongClick (Position As Int, Value As Object)
|
||||
End If
|
||||
l_info.Text = $"ID: ${id}${CRLF}${Value}"$
|
||||
l_info.Visible = True
|
||||
c.Close
|
||||
End Sub
|
||||
|
||||
Private Sub b_buscar_Click
|
||||
@@ -1240,6 +1248,7 @@ Private Sub b_aceptar_Click
|
||||
' LogColor(p.GetString("total"), Colors.red)
|
||||
If p.GetString("total") < 1 Then LlenaProdsLL(Null, Null)
|
||||
p_vistaPreviaTrans.Visible=False
|
||||
p.Close
|
||||
Subs.iniciaActividad("Cliente")
|
||||
' B4XPages.ShowPage("Cliente")
|
||||
End Sub
|
||||
@@ -1337,6 +1346,7 @@ Sub l_prodX_Click
|
||||
Log(Sender.as(Label).tag)
|
||||
l_info.BringToFront
|
||||
l_info.Visible = True
|
||||
i.Close
|
||||
' Dim index As Int = clv_prods_ll.GetItemFromView(Sender)
|
||||
' Private p0 As B4XView = clv_prods_ll.GetPanel(index)
|
||||
' Private p As B4XView = p0.GetView(0)
|
||||
@@ -1409,6 +1419,7 @@ Private Sub clv_prods_ll_VisibleRangeChanged (FirstIndex As Int, LastIndex As In
|
||||
prioridad = p1.GetInt("CAT_GP_TIPOPROD2")
|
||||
' Log(prioridad)
|
||||
End If
|
||||
p1.Close
|
||||
' Log("NIVEL: " & lfila.Text)
|
||||
If lfila.Text = "RMI" Then ' Si es RMI, la cantidad solo se puede cambiar con los botones.
|
||||
et_pCant.Enabled = False
|
||||
@@ -1441,8 +1452,8 @@ Private Sub clv_prods_ll_VisibleRangeChanged (FirstIndex As Int, LastIndex As In
|
||||
If clv_prods_ll.GetValue(i).As(Map).Get("almacen").As(Int) = Subs.traeExistenciasPorId(clv_prods_ll.GetValue(i).As(Map).Get("id")) Then
|
||||
' Log("|"&clv_prods_ll.GetValue(i).As(Map).Get("almacen") & "|" & Subs.traeExistenciasPorId(clv_prods_ll.GetValue(i).As(Map).Get("id"))&"|")
|
||||
Else
|
||||
LogColor("|"&clv_prods_ll.GetValue(i).As(Map).Get("almacen") & "|" & Subs.traeExistenciasPorId(clv_prods_ll.GetValue(i).As(Map).Get("id"))&"|"&clv_prods_ll.GetValue(i).As(Map).Get("prod")&"|", Colors.red)
|
||||
LogColor("#### ERROR DE INVENTARIO ####" , Colors.red)
|
||||
' LogColor("|"&clv_prods_ll.GetValue(i).As(Map).Get("almacen") & "|" & Subs.traeExistenciasPorId(clv_prods_ll.GetValue(i).As(Map).Get("id"))&"|"&clv_prods_ll.GetValue(i).As(Map).Get("prod")&"|", Colors.red)
|
||||
' LogColor("#### ERROR DE INVENTARIO ####" , Colors.red)
|
||||
End If
|
||||
'#######################################################
|
||||
|
||||
@@ -1557,6 +1568,7 @@ Sub LlenaProdsLL(p As ResultSet, extra As String)
|
||||
invAbordo = ab.GetString("CAT_GP_ALMACEN")
|
||||
' Log(invAbordo)
|
||||
End If
|
||||
ab.Close
|
||||
End If
|
||||
Private precio As String = NumberFormat2(p.GetDouble("CAT_GP_PRECIO"),1,2,2,False)
|
||||
'Descuentos de condiciones comerciales por TIPO
|
||||
|
||||
@@ -4,6 +4,74 @@ ModulesStructureVersion=1
|
||||
Type=Class
|
||||
Version=11.5
|
||||
@EndOfDesignText@
|
||||
Sub Descripcion
|
||||
' *** FLUJO DE LAS PROMOCIONES ***
|
||||
' Aquí está el desglose del flujo actual de decisión para mostrar una promoción, calculando los máximos y aplicando las restricciones de Segmentación, Inventario y Trade Spending (Bonificaciones).
|
||||
'
|
||||
' ### Flujo Maestro: ¿Se muestra la promo y cuántas alcanzan?
|
||||
'
|
||||
' El proceso se ejecuta secuencialmente. Si en algún punto el resultado es 0, la promoción no se muestra o se marca como agotada.
|
||||
'
|
||||
' #### 1. Cálculo de Límites Administrativos (La Base)
|
||||
'
|
||||
' Lo primero que hace el sistema es determinar el "Techo Teórico" de cuántas promociones se pueden vender Sin mirar inventario ni dinero aún.
|
||||
' * **Paso A: Datos Generales:** Se obtienen los límites configurados en `PROMOS_COMP`: Máximo por Cliente, Máximo Recurrente y Máximo Global.
|
||||
' * **Paso B: Lógica de Promociones Segmentadas:** Aquí entra el filtro crítico.
|
||||
' * El sistema consulta `HIST_CLIENTE_CANT_PROMOS`.
|
||||
' * **Si la promo es segmentada:**
|
||||
' * Si el cliente **NO** está en la lista: Se establecen todos los máximos a 0. La promo se oculta.
|
||||
' * Si el cliente **SÍ** está en la lista: Se ignoran los límites generales y se usan los específicos asignados al cliente.
|
||||
' * **Fórmula:** `MaxDisponible = Asignado - Vendido`.
|
||||
' * **Paso C: Cálculo del Mínimo:** Se comparan todos los límites (Global, Recurrente, Cliente/Segmentado) y se toma el **valor más pequeño** como el `MaxPromos` inicial.
|
||||
'
|
||||
' #### 2. Restricción por Inventario de Productos FIJOS
|
||||
'
|
||||
' Una vez que sabemos cuántas *podríamos* vender administrativamente, revisamos si tenemos los productos obligatorios (Fijos).
|
||||
' * El sistema itera sobre cada producto fijo de la promoción.
|
||||
' * **Cálculo:** `InventarioDisponible / PiezasRequeridasPorPromo`.
|
||||
' * **Resultado:** El `MaxPromos` se actualiza al **mínimo** entre el valor del Paso 1 y lo que permite el inventario de cada producto fijo.
|
||||
' * *Nota Crítica:* Si este valor es 0, la promo se marca como "KO" (No disponible).
|
||||
'
|
||||
' #### 3. El Cruce de Inventarios (La Resta)
|
||||
'
|
||||
' Este es el punto que mencionaste y es vital en el flujo actual. Antes de evaluar si alcanzan los productos variables, el código **simula la venta de los productos fijos**.
|
||||
' * Se toma el mapa de inventario actual.
|
||||
' * Se ejecuta `restaFijosDePromo`.
|
||||
' * **Acción:** Para cada producto fijo, se resta: `(MaxPromosCalculado * PiezasRequeridas)`.
|
||||
' * **Resultado:** Se genera un *Nuevo Mapa de Inventario Virtual* que contiene solo lo que sobró después de apartar lo necesario para la parte fija. Este mapa es el que se pasa a la siguiente etapa.
|
||||
'
|
||||
' #### 4. Cálculo de Variables y Restricción de Trade Spending (TS)
|
||||
'
|
||||
' Aquí es donde la lógica se vuelve compleja y utiliza los bucles iterativos para validar tanto existencia física como presupuesto financiero (Bonificaciones).
|
||||
' Se ejecuta `revisaMaxPromosProdsVariablesPorInventario`, que usa el *Inventario Virtual* del paso anterior.
|
||||
' **El Bucle de Validación (Paso a Paso):**
|
||||
' El código prueba vender 1 promo, luego 2, hasta llegar al `MaxPromos` calculado en el paso 2.
|
||||
' 1. **Iteración `x` (Número de promos a probar):**
|
||||
' 2. **Consumo de Fijos en Variables:** Si un producto variable *también* es fijo, el código descuenta (otra vez) el inventario necesario para la parte fija dentro de este bucle para asegurar integridad.
|
||||
' 3. **Suma de Inventario Variable:** Se suman las existencias de todos los productos que califican como variables para esta promo.
|
||||
' 4. **Validación de Trade Spending (El Presupuesto):**
|
||||
' * Dentro del bucle, para cada producto variable disponible, se llama a `ts.traeBonificacionesMaximas`.
|
||||
' * **La Lógica de ts:** El sistema verifica si el producto actual califica como bonificación (precio especial/cero).
|
||||
' * **Si califica:** Verifica si hay saldo en el presupuesto de "BONIFICACIONES". Si no hay saldo, este producto variable **no se cuenta** como disponible para armar la promo en esta iteración.
|
||||
' * **Si NO califica:** (Es un producto de precio normal dentro de la promo), no consume presupuesto y se cuenta libremente según su inventario físico.
|
||||
' 5. **Prueba de Fuego:**
|
||||
' * Se compara: `InventarioVariableValidado (Físico + Financiero)` vs `(PiezasVariablesRequeridas * x)`.
|
||||
' * Si alcanza, el ciclo continúa para probar `x + 1`.
|
||||
' * Si no alcanza, el ciclo se rompe y se define el máximo posible.
|
||||
'
|
||||
' ### Resumen del Factor TS en el Flujo
|
||||
'
|
||||
' El presupuesto de ts no bloquea la promo "per se", sino que **filtra qué productos variables están disponibles**.
|
||||
' * Si la promo pide 3 variables.
|
||||
' * Tienes 5 opciones en inventario físico.
|
||||
' * 2 opciones son "Bonificación" (consumen presupuesto) y 3 son venta normal.
|
||||
' * **Escenario Sin Presupuesto:** Al iterar, `ts.traeBonificacionesMaximas` devolverá 0 para los 2 productos de bonificación. El sistema solo verá 3 productos disponibles (los normales).
|
||||
' * **Resultado:** Como la promo pide 3 y el sistema "ve" 3 disponibles, la promo **SÍ SE MUESTRA**.
|
||||
' * **Bloqueo:** Solo se bloquearía si la promo pidiera 4 variables, ya que Sin presupuesto ts solo "vemos" 3 productos disponibles, insuficientes para armar el paquete.
|
||||
'
|
||||
' ### Este flujo garantiza que la promo se muestre siempre que sea *físicamente* posible armarla, restringiendo la parte financiera solo a los ítems que realmente cuestan dinero al presupuesto de bonificaciones.
|
||||
End Sub
|
||||
|
||||
Sub Class_Globals
|
||||
Private Root As B4XView 'ignore
|
||||
Private xui As XUI
|
||||
|
||||
@@ -149,6 +149,8 @@ Sub linkDevice(Almacen_ As String, Ruta_ As String)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'244500
|
||||
|
||||
' Obtiene el GUID único del dispositivo desde B4XKeyStore.
|
||||
' Si no existe, lo genera y lo guarda utilizando Subs.GUID.
|
||||
Private Sub GetDeviceGUID As String
|
||||
@@ -226,6 +228,7 @@ Public Sub JobDone(Job As HttpJob) ' El nombre del sub debe ser 'JobDone' o el q
|
||||
For Each records() As Object In result.Rows
|
||||
Dim Status As String = "" 'records(result.Columns.Get("ESTATUS"))
|
||||
Dim CAT_RU_IDTELEFONO As String = records(result.Columns.Get("CAT_RU_IDTELEFONO"))
|
||||
deviceId = GetDeviceGUID
|
||||
Log($"|${deviceId}|${CAT_RU_IDTELEFONO}|"$)
|
||||
' If deviceId <> CAT_RU_IDTELEFONO Then Status = "YA_REGISTRADO" ' Ya existe OTRO registro.
|
||||
If CAT_RU_IDTELEFONO = 0 Or CAT_RU_IDTELEFONO.Length < 5 Then
|
||||
|
||||
Binary file not shown.
@@ -917,7 +917,7 @@ Version=12.8
|
||||
#Region Project Attributes
|
||||
#ApplicationLabel: Kelloggs Venta
|
||||
#VersionCode: 3000
|
||||
#VersionName: 5.11.01
|
||||
#VersionName: 5.11.26
|
||||
#SupportedOrientations: portrait
|
||||
#CanInstallToExternalStorage: False
|
||||
#BridgeLogger:true
|
||||
@@ -933,6 +933,10 @@ Version=12.8
|
||||
#IncludeTitle: False
|
||||
#End Region
|
||||
|
||||
|
||||
'222543
|
||||
|
||||
|
||||
' Version que estaba en la tabla CAT_VERSION antes -> 2.95
|
||||
' 5.08.30 --> corrige que en la barra de busqeda en productos no hacia nada!
|
||||
|
||||
|
||||
@@ -67,12 +67,12 @@ ModuleBreakpoints7=
|
||||
ModuleBreakpoints8=
|
||||
ModuleBreakpoints9=
|
||||
ModuleClosedNodes0=
|
||||
ModuleClosedNodes1=6,10,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,31,33,34,35,37,38,39,40,41,42,43,45,46,47
|
||||
ModuleClosedNodes1=2,3,6,10,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,31,33,34,35,37,38,39,40,41,42,43,45,46,47
|
||||
ModuleClosedNodes10=
|
||||
ModuleClosedNodes11=
|
||||
ModuleClosedNodes12=
|
||||
ModuleClosedNodes13=1,7,8,9,10,11,12
|
||||
ModuleClosedNodes14=6,7,8,9,12,13
|
||||
ModuleClosedNodes13=8,9,11,12
|
||||
ModuleClosedNodes14=1,2
|
||||
ModuleClosedNodes15=
|
||||
ModuleClosedNodes16=3,8,17
|
||||
ModuleClosedNodes17=
|
||||
@@ -89,10 +89,10 @@ ModuleClosedNodes26=24,26,31,32,33,35
|
||||
ModuleClosedNodes27=
|
||||
ModuleClosedNodes28=4
|
||||
ModuleClosedNodes29=
|
||||
ModuleClosedNodes3=5,6
|
||||
ModuleClosedNodes3=3
|
||||
ModuleClosedNodes30=
|
||||
ModuleClosedNodes31=
|
||||
ModuleClosedNodes32=101,116
|
||||
ModuleClosedNodes32=116
|
||||
ModuleClosedNodes33=
|
||||
ModuleClosedNodes4=
|
||||
ModuleClosedNodes5=
|
||||
@@ -100,6 +100,6 @@ ModuleClosedNodes6=
|
||||
ModuleClosedNodes7=
|
||||
ModuleClosedNodes8=
|
||||
ModuleClosedNodes9=
|
||||
NavigationStack=B4XMainPage,ImageView1_LongClick,1052,0,B4XMainPage,B4XPage_Created,128,0,C_deviceLinker,deviceLinked,294,6,C_deviceLinker,generaGUID,279,0,C_deviceLinker,GetDeviceGUID,175,6,C_deviceLinker,Initialize,81,6,C_deviceLinker,Class_Globals,61,0,C_Principal,B4XPage_Appear,321,0,C_Principal,B4XPage_Created,318,0,C_Principal,Class_Globals,13,0
|
||||
NavigationStack=Subs,procesaPromocion,1284,6,Subs,alcanzanLosVariablesParaPromo,1191,0,Subs,restaFijosPromo,1175,0,Subs,traeMaxPromos,1237,0,DBRequestManager,HandleJob,251,0,C_TrendSpending,traeBonificacionesMaximas,350,0,C_Promos,Class_Globals,62,0,C_Productos,Class_Globals,93,0,Promociones,Class_Globals,13,0,C_Promos,Descripcion,0,0
|
||||
SelectedBuild=0
|
||||
VisibleModules=31,1,12,5,16,3,32,13,14,9
|
||||
VisibleModules=31,1,12,3,32,13,14,19,16
|
||||
|
||||
@@ -4,6 +4,11 @@ ModulesStructureVersion=1
|
||||
Type=Class
|
||||
Version=12.8
|
||||
@EndOfDesignText@
|
||||
'##############################################################################################
|
||||
' CODIGO DE PRUEBA, NO HABILITADO, NO TERMINADO
|
||||
' PRETENDE UTILIZAR MENOS MAPAS Y MAS QUERIES PARA EL CALCULO DE LAS PROMOCIONES
|
||||
'##############################################################################################
|
||||
|
||||
Sub Class_Globals
|
||||
Dim ruta As String
|
||||
Dim almacen As String
|
||||
|
||||
134
B4A/Subs.bas
134
B4A/Subs.bas
@@ -863,6 +863,7 @@ Sub traeNombreCliente(id As String) As String
|
||||
Do While c.NextRow
|
||||
n = c.GetString("CAT_CL_NOMBRE")
|
||||
Loop
|
||||
c.Close
|
||||
Return n
|
||||
End Sub
|
||||
|
||||
@@ -1008,7 +1009,7 @@ End Sub
|
||||
' resultado="OK" 'Ok si existe la promocion.
|
||||
' prodsVariablesRequeridos=5} 'Cantidad de productos variables requeridos para la promoción.
|
||||
Sub traePromo(promo As String, cliente As String) As Map
|
||||
Private thisLog As Boolean = True
|
||||
Private thisLog As Boolean = false
|
||||
If thisLog Then Log("traePromo:"&promo)
|
||||
Private inicioContador As String = DateTime.Now
|
||||
Private c As Cursor = Starter.skmt.ExecQuery("Select * from promos_comp where cat_pa_id = '"& promo&"'") 'Obtenemos el maximo de promociones a otorgar.
|
||||
@@ -1029,7 +1030,7 @@ Sub traePromo(promo As String, cliente As String) As Map
|
||||
'######### PROMOCIONES SEGMENTADAS ##########
|
||||
' Si la promo esta en la lista, SOLO los clientes que la tengan la pueden ver.
|
||||
Private ps As Cursor = Starter.skmt.ExecQuery($"select * from HIST_CLIENTE_CANT_PROMOS where HCCP_PROMO = '${promo}'"$) ' and HCCP_CLIENTE = '${cliente}'
|
||||
Log($"select * from HIST_CLIENTE_CANT_PROMOS where HCCP_PROMO = '${promo}'"$)
|
||||
' Log($"select * from HIST_CLIENTE_CANT_PROMOS where HCCP_PROMO = '${promo}'"$)
|
||||
If thisLog Then Log($"PROMOS SEGMENTADAS ENCONTRADAS: ${ps.RowCount}"$)
|
||||
If thisLog Then Log(promoMap)
|
||||
If ps.RowCount > 0 Then
|
||||
@@ -1045,13 +1046,16 @@ Sub traePromo(promo As String, cliente As String) As Map
|
||||
If thisLog Then Log($"registros:${ps2.RowCount}, cliente: ${ps2.GetString("HCCP_CLIENTE")} cant:${ps2.GetString("HCCP_CANT")}"$)
|
||||
promoMap = CreateMap("id":promo, "maxXcliente":(ps2.GetString("HCCP_CANT")-ps2.GetString("HCCP_CANT_VENDIDA")), "maxRecurrente":ps2.GetString("HCCP_CANT"), "maxPromos":ps2.GetString("HCCP_CANT")) 'Si es segmentada SOLO le aparece a ciertos clientes.
|
||||
End If
|
||||
ps2.Close
|
||||
End If
|
||||
ps.Close
|
||||
If thisLog Then Log(promoMap)
|
||||
' ########## TERMINA PROMOS SEGMENTADAS ##########
|
||||
c = Starter.skmt.ExecQuery("Select count(*) as hist from HIST_PROMOS where HP_CLIENTE = '"& cliente & "' and HP_CODIGO_PROMOCION = '" & promo & "'") 'Revisamos si hay historico de la promoción.
|
||||
c.Position = 0
|
||||
If c.GetString("hist") > 0 Then siHistorico = 1
|
||||
promoMap.Put("historico", siHistorico)
|
||||
c.Close
|
||||
c = Starter.skmt.ExecQuery("Select * from CAT_DETALLES_PAQ where CAT_DP_ID = '"& promo & "'") 'Obtenemos los detalles de la promoción.
|
||||
c.Position = 0
|
||||
If c.RowCount > 0 Then
|
||||
@@ -1090,6 +1094,7 @@ Sub traePromo(promo As String, cliente As String) As Map
|
||||
Else
|
||||
promoMap.Put("resultado", "No hay datos de la promoción.")
|
||||
End If
|
||||
c.Close
|
||||
c = Starter.skmt.ExecQuery("Select CAT_GP_STS, CAT_GP_NOMBRE from CAT_GUNAPROD2 where CAT_GP_ID = '"& promo & "'") 'Obtenemos las piezas requeridas de productos variables para la promoción.
|
||||
c.Position = 0
|
||||
Private pvr As String = 0
|
||||
@@ -1109,7 +1114,7 @@ End Sub
|
||||
|
||||
'Regresa un mapa con el inventario disponible por producto para la promoción (desde la base de datos).
|
||||
Sub traemosInventarioDisponibleParaPromo(promo As String) As Map 'ignore
|
||||
Private thisLog As Boolean = True
|
||||
Private thisLog As Boolean = False
|
||||
Private c As Cursor
|
||||
c = Starter.skmt.ExecQuery2("SELECT CAT_GP_ID, CAT_GP_ALMACEN FROM CAT_GUNAPROD2 WHERE CAT_GP_ID IN (select CAT_DP_IDPROD FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID = ?)", Array As String(promo))
|
||||
' Private prodInv As Map
|
||||
@@ -1129,6 +1134,7 @@ Sub traemosInventarioDisponibleParaPromo(promo As String) As Map 'ignore
|
||||
Next
|
||||
' prodInv.Put("inventarios", prods)
|
||||
End If
|
||||
c.Close
|
||||
Return prods
|
||||
End Sub
|
||||
|
||||
@@ -1147,7 +1153,7 @@ Sub restaFijosPromo(promoMap As Map) As Map 'ignore
|
||||
Private prodsFijos As List = promoMap.get("prodsFijos") 'Obtenemos un a lista con los productos fijos de la promoción.
|
||||
If thisLog Then LogColor("ProdsFijos -> " & prodsFijos, Colors.red)
|
||||
inventariosDisponiblesParaEstaPromo.Put("resultado", "No hay suficiente producto para la promocion.") 'Valor por default
|
||||
Log($"Prods fijos requeridos ${prodsFijos.Size}"$)
|
||||
If thisLog Then Log($"Prods fijos requeridos ${prodsFijos.Size}"$)
|
||||
If prodsFijos.Size = 0 Then inventariosDisponiblesParaEstaPromo.Put("resultado", "ok") 'Si no lleva prods fijos la promo, entonces ponemos FIJOS OK.
|
||||
For p = 0 To prodsFijos.Size - 1
|
||||
Private t As String = prodsFijos.Get(p) 'Obtenemos el Id de este producto desde la lista de productos fijos.
|
||||
@@ -1198,7 +1204,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 = true '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
|
||||
@@ -1224,14 +1230,15 @@ Sub traeMaxPromos(pm As Map) As Int
|
||||
maxPromos.Add(hccp.GetInt("HCCP_CANT"))
|
||||
End If
|
||||
maxPromos.Sort(True)
|
||||
If thisLog Then Log($">>>>> Max promos : ${maxPromos}"$)
|
||||
If thisLog Then Log($" >>>>> MAX PROMOS X CONF : ${maxPromos} <==> ${maxPromos.Get(0)}"$)
|
||||
mp = 0
|
||||
If maxPromos.Size > 0 Then
|
||||
mp0 = maxPromos.Get(0)
|
||||
' Log(mp0)
|
||||
mp = mp0 - traePromosVendidas(pm.Get("id"), traeCliente)
|
||||
If thisLog Then Log($"Max Promos (${mp0}) - promos vendidas (${(traePromosVendidas(pm.Get("id"), traeCliente)).As(Int)}) = ${mp}"$)
|
||||
If thisLog Then Log($" >>>>> MAX PROMOS - PROMOS VENDIDAS <==> ${mp0} - ${(traePromosVendidas(pm.Get("id"), traeCliente)).As(Int)} = ${mp}"$)
|
||||
End If
|
||||
hccp.Close
|
||||
Return mp 'Regresamos el numero mas pequeño de las opciones.
|
||||
End Sub
|
||||
|
||||
@@ -1244,6 +1251,7 @@ Sub traePromosVendidas(promo As String, cliente As String) As Int
|
||||
c.Position = 0
|
||||
If c.GetString("cuantas") <> Null Then pv = c.GetString("cuantas")
|
||||
End If
|
||||
c.Close
|
||||
Return pv
|
||||
End Sub
|
||||
|
||||
@@ -1263,7 +1271,9 @@ Sub procesaPromocion(idPromo As String, cliente As String) As Map 'ignore
|
||||
' Log("|"&revisaMaxPromosProdsFijosPorInventario(pm)&"|")
|
||||
Private maxPromosXprodsFijos As Int = revisaMaxPromosProdsFijosPorInventario(pm)
|
||||
If maxPromosXprodsFijos < 1 Then pm.Put("resultado", 0)
|
||||
LogColor($">>> Promos disponibles por productos fijos = ${maxPromosXprodsFijos}"$, Colors.Magenta)
|
||||
If thisLog Then LogColor($"***********************************************************************"$, Colors.Blue)
|
||||
LogColor($"*** PROMOS DISPONIBLES X PRODS FIJOS (${idPromo}) = ${maxPromosXprodsFijos} ***"$, Colors.Blue)
|
||||
If thisLog Then LogColor($"***********************************************************************"$, Colors.Blue)
|
||||
If pm.Get("resultado") = "ok" Then 'Si encontramos la promoción, entonces ...
|
||||
'Buscamos el máximo de promociones permitidas.
|
||||
mp = traeMaxPromos(pm)
|
||||
@@ -1279,7 +1289,9 @@ Sub procesaPromocion(idPromo As String, cliente As String) As Map 'ignore
|
||||
If inventarioSinFijos.Get("resultado") = "ok" Then
|
||||
'Revisamos que los productos variables requeridos sean menos que el inventario total (mapa).
|
||||
Private pv As Boolean = alcanzanLosVariablesParaPromo(pm, inventarioSinFijos)
|
||||
If thisLog Then Log("Alcanzan los variables? --> " & pv)
|
||||
If thisLog Then LogColor($"****************************************************"$, Colors.Blue)
|
||||
If thisLog Then LogColor($"***** ¿ALCANZAN LOS VARIABLES? ==> ${IIf(pv, "SI", "NO")} *****"$, Colors.Blue)
|
||||
If thisLog Then LogColor($"****************************************************"$, Colors.Blue)
|
||||
If pv Then Return CreateMap("status":"ok", "mp":pm) Else Return CreateMap("status":"ko", "mp":pm)
|
||||
Else
|
||||
If thisLog Then LogColor("NO HAY INVENTARIO SUFICIENTE " & idPromo, Colors.red)
|
||||
@@ -1296,6 +1308,8 @@ Sub procesaPromocion(idPromo As String, cliente As String) As Map 'ignore
|
||||
Log($"Promo ${idPromo} mal configurada"$)
|
||||
ToastMessageShow($"Promo ${idPromo} mal configurada"$, True)
|
||||
Log(LastException)
|
||||
' Agregamos esta línea para evitar el NullPointerException
|
||||
Return CreateMap("status":"ko", "mp":Null)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
@@ -1344,45 +1358,47 @@ End Sub
|
||||
|
||||
'Regresa cuantas promos alcanzan con los productos FIJOS que hay en inventario.
|
||||
Sub revisaMaxPromosProdsFijosPorInventario(pm As Map) As Int
|
||||
Private thisLog As Boolean = True
|
||||
Private thisLog As Boolean = False
|
||||
Private invFijoXpromo As Map
|
||||
Private t As List
|
||||
t.Initialize
|
||||
t.Add(traeMaxPromos(pm)) ' Agregamos a la lista las promos maximas permitidas (recurrente, cliente y promo).
|
||||
If thisLog Then LogColor($"### T: ${t}"$, Colors.Green)
|
||||
If thisLog Then LogColor($"============ INICIA MAX PROMOS X PRODS FIJOS X INV ========"$, Colors.RGB(176,0,0))
|
||||
If thisLog Then LogColor($" ### MAX PROMOS (recurrente, cliente y promo): ${t}"$, Colors.Green)
|
||||
invFijoXpromo.Initialize
|
||||
If thisLog Then LogColor($"pm=${pm}"$, Colors.Blue)
|
||||
If thisLog Then LogColor($" pm=${pm}"$, Colors.Blue)
|
||||
Private invDispParaPromo As Map = traemosInventarioDisponibleParaPromo(pm.Get("id"))
|
||||
If thisLog Then Log($"invDispParaPromo=${invDispParaPromo}"$)
|
||||
If thisLog Then Log($" invDispParaPromo=${invDispParaPromo}"$)
|
||||
Private prodsFijosPiezas As List = pm.Get("prodsFijosPiezas")
|
||||
Private idProdsFijos As List = pm.Get("prodsFijos")
|
||||
Private idProdsFijosPrecios As List = pm.Get("prodsFijosPrecios")
|
||||
For p = 0 To idProdsFijos.Size -1 'Generamos una lista con las promos disponibles por producto (dividimos el inventario total entre las piezas requeridas).
|
||||
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}, pzasReq=${prodsFijosPiezas.Get(p)}"$)
|
||||
|
||||
LogColor($"====== ${idProdsFijos.Get(p)} - Inv1:${thisInvDisp}, inv2: ${traeExistenciasPorId(idProdsFijos.Get(p))}"$, Colors.Magenta)
|
||||
If thisInvDisp <> traeExistenciasPorId(idProdsFijos.Get(p)) Then
|
||||
LogColor("#### ERROR DE INVENTARIO ####" , Colors.red)
|
||||
End If
|
||||
|
||||
If thisLog Then Log($" id=${idProdsFijos.Get(p)}, inv=${thisInvDisp}, pzasReq=${prodsFijosPiezas.Get(p)}"$)
|
||||
' LogColor($" ====== ${idProdsFijos.Get(p)} - Inv1:${thisInvDisp}, inv2: ${traeExistenciasPorId(idProdsFijos.Get(p))}"$, Colors.Magenta)
|
||||
' If thisInvDisp <> traeExistenciasPorId(idProdsFijos.Get(p)) Then
|
||||
' LogColor(" #### ERROR DE INVENTARIO ####" , Colors.red)
|
||||
' End If
|
||||
' 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.
|
||||
t.Add(x(0).As(Int)) 'Solo guardamos la parte del entero de la division. (promos por inventario)
|
||||
If thisLog Then LogColor($"### T: ${t}"$, Colors.Green) 'promos por inventario
|
||||
If thisLog Then Log(">> Promos x Prods Fijos: " & x(0))
|
||||
Log(">>>>> Monto Bonificacion: " & B4XPages.MainPage.promos.ts.traeMontoBonificacion(idProdsFijos.Get(p), idProdsFijosPrecios.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), idProdsFijosPrecios.Get(p), pm.Get("id")), Colors.blue)
|
||||
' If thisLog Then LogColor($" ### T: ${t}"$, Colors.Green) 'promos por inventario
|
||||
If thisLog Then LogColor($" >>>>> PROMOS X PRODS FIJOS (${idProdsFijos.Get(p)}): ${x(0)} <<<<<"$, Colors.red)
|
||||
Log($" >>>>> Monto Bonificacion FIJOS (${idProdsFijos.Get(p)}): "$ & B4XPages.MainPage.promos.ts.traeMontoBonificacion(idProdsFijos.Get(p), idProdsFijosPrecios.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), idProdsFijosPrecios.Get(p), pm.Get("id")), Colors.blue)
|
||||
t.Add(B4XPages.MainPage.promos.ts.traeBonificacionesMaximas("bonificaciones", clienteActual, idProdsFijos.Get(p), prodsFijosPiezas.Get(p), idProdsFijosPrecios.Get(p), pm.Get("id"))) 'Agregamos las promos disponibles por Trade Spending
|
||||
If thisLog Then LogColor($"### T: ${t}"$, Colors.Green)
|
||||
If thisLog Then LogColor($" ### PROMOS X INV: ${t}"$, Colors.Green) 'promos por inventario
|
||||
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(">>>>>> T: " & t, Colors.red)
|
||||
If thisLog Then LogColor("Max promos x inv de prodsFijos = " & t.Get(0), Colors.red)
|
||||
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(" >>>>>> T: " & t, Colors.Magenta)
|
||||
LogColor(" ***********************************************************************", Colors.red)
|
||||
LogColor($" ****** MAX PROMOS X INV DE PRODS FIJOS (${pm.get("id")}): "$ & t.Get(0) & " ******", Colors.red)
|
||||
LogColor(" ***********************************************************************", Colors.red)
|
||||
If thisLog Then LogColor($"============ TERMINA MAX PROMOS X PRODS FIJOS X INV ========"$, Colors.RGB(176,0,0))
|
||||
Return t.Get(0) 'Regresamos el resultado mas pequeño.
|
||||
End Sub
|
||||
|
||||
@@ -1436,7 +1452,7 @@ Sub revisaMaxPromosProdsVariablesPorInventario(pm As Map) As Int 'ignore
|
||||
|
||||
' Log(pm.Get("prodsFijos").As(List).Size)
|
||||
' Log(maxPromosXFijos)
|
||||
|
||||
|
||||
For x = 1 To maxPromosXFijos
|
||||
If thisLog Then Log("==================== maxPromosXFijos "& x &" ========================")
|
||||
If thisLog Then Log("=====================================================")
|
||||
@@ -1459,7 +1475,7 @@ Sub revisaMaxPromosProdsVariablesPorInventario(pm As Map) As Int 'ignore
|
||||
totalProdsVariablesDisponibles = totalProdsVariablesDisponibles + invDispParaPromo.Get(idProdsVariables.Get(i))
|
||||
End If
|
||||
Next
|
||||
If thisLog Then Log($"prodsVariablesXPresupuestoBonificaciones: ${prodsVariablesXPresupuestoBonificaciones}"$)
|
||||
If thisLog Then Log($"1924: ${prodsVariablesXPresupuestoBonificaciones}"$)
|
||||
'Revisamos variables.
|
||||
If thisLog Then Log($"Var disponibles - var requeridos : ${totalProdsVariablesDisponibles} - ${prodsVariablesRequeridos*x}"$)
|
||||
totalProdsVariablesDisponibles = totalProdsVariablesDisponibles - (prodsVariablesRequeridos*x)
|
||||
@@ -1501,6 +1517,7 @@ Sub cuantosVariablesDisponiblesDB(promo As String)
|
||||
If c.GetString("CAT_GP_ALMACEN") <> Null Then x = c.GetString("CAT_GP_ALMACEN")
|
||||
Next
|
||||
End If
|
||||
c.Close
|
||||
End If
|
||||
Return x
|
||||
End Sub
|
||||
@@ -2415,7 +2432,7 @@ Sub traeExistenciasPorId(id As String) As Int
|
||||
existencias = inv.GetString("CAT_GP_ALMACEN").As(Int)
|
||||
End If
|
||||
' Log("ex:" & existencias)
|
||||
Private inv As Cursor = Starter.skmt.ExecQuery($"Select ifnull(SUM(pe_cant),0) As total_vendido FROM pedido WHERE pe_tipo = 'VENTA' and pe_proid = '${id}'"$)
|
||||
inv = Starter.skmt.ExecQuery($"Select ifnull(SUM(pe_cant),0) As total_vendido FROM pedido WHERE pe_tipo = 'VENTA' and pe_proid = '${id}'"$)
|
||||
inv.Position = 0
|
||||
vendido = inv.GetInt("total_vendido")
|
||||
' Log("ven:" & vendido)
|
||||
@@ -2461,4 +2478,55 @@ Sub deshabilitaValidaciones
|
||||
' B4XPages.MainPage.principal.Resumen.Enabled = True
|
||||
' B4XPages.MainPage.principal.BUSCA.Enabled = True
|
||||
ToastMessageShow("REALIZADO", False)
|
||||
End Sub
|
||||
|
||||
' Recalcula en inventario actual, utiliza la tabla CAT_GUNAPROD5 que tiene el inventario INICIAL y le resta
|
||||
' lo que hay en PEDIDO, y actualiza CAT_GUNAPROD2 con el valor calculado.
|
||||
Public Sub RecalcularInventario
|
||||
Private inicial As Long = DateTime.Now
|
||||
' 1. Índices: ESTO ES CRUCIAL. Si no tienes estos índices, ningún query será rápido.
|
||||
' Ejecuta esto una sola vez al crear la BD o al iniciar la app, no en cada cálculo.
|
||||
' skmt.ExecNonQuery("CREATE INDEX IF NOT EXISTS idx_pedido_proid ON PEDIDO(PE_PROID)")
|
||||
' skmt.ExecNonQuery("CREATE INDEX IF NOT EXISTS idx_pedido_cliente ON PEDIDO(PE_CLIENTE)")
|
||||
' skmt.ExecNonQuery("CREATE INDEX IF NOT EXISTS idx_cat5_id ON CAT_GUNAPROD5(CAT_GP_ID)")
|
||||
|
||||
Starter.skmt.BeginTransaction
|
||||
Try
|
||||
' Lógica del Query:
|
||||
' 1. Toma el inventario inicial del día desde CAT_GUNAPROD5 (T5).
|
||||
' 2. Le resta SOLO las ventas reales de la tabla PEDIDO.
|
||||
' 3. FILTRA (Ignora) los RMIs usando PE_CEDIS <> 'DUR' y el nombre '%CAMBIO%'.
|
||||
' 4. Actualiza CAT_GUNAPROD2 masivamente.
|
||||
|
||||
Dim sql As String = _
|
||||
"UPDATE CAT_GUNAPROD2 " & _
|
||||
"SET CAT_GP_ALMACEN = ( " & _
|
||||
" SELECT (IFNULL(T5.CAT_GP_ALMACEN, 0) - IFNULL(Ventas.CantidadVendida, 0)) " & _
|
||||
" FROM CAT_GUNAPROD5 T5 " & _
|
||||
" LEFT JOIN ( " & _
|
||||
" SELECT PE_PROID, SUM(PE_CANT) AS CantidadVendida " & _
|
||||
" FROM PEDIDO " & _
|
||||
" WHERE PE_CLIENTE <> '0' " & _
|
||||
" AND PE_CEDIS <> 'DUR' " & _
|
||||
" AND PE_PRONOMBRE NOT LIKE '%CAMBIO%' " & _
|
||||
" GROUP BY PE_PROID " & _
|
||||
" ) Ventas ON T5.CAT_GP_ID = Ventas.PE_PROID " & _
|
||||
" WHERE T5.CAT_GP_ID = CAT_GUNAPROD2.CAT_GP_ID " & _
|
||||
") " & _
|
||||
"WHERE EXISTS ( " & _ '<-- ESTA ES LA CLAVE QUE EVITA LOS NULLS
|
||||
" SELECT 1 FROM CAT_GUNAPROD5 T5 " & _
|
||||
" WHERE T5.CAT_GP_ID = CAT_GUNAPROD2.CAT_GP_ID " & _
|
||||
")"
|
||||
|
||||
' Ejecutamos el cálculo masivo
|
||||
Starter.skmt.ExecNonQuery(sql)
|
||||
|
||||
Starter.skmt.TransactionSuccessful
|
||||
If Starter.Logger Then Log("Inventario Sincronizado (Excluyendo RMIs)")
|
||||
|
||||
Catch
|
||||
Log("Error al recalcular inventario: " & LastException)
|
||||
End Try
|
||||
Starter.skmt.EndTransaction
|
||||
LogColor(">>>>> Tiempo de RecalcularInventario: " & ((DateTime.Now - inicial)/1000), Colors.red)
|
||||
End Sub
|
||||
28
B4A/_juntaBas.ps1
Normal file
28
B4A/_juntaBas.ps1
Normal file
@@ -0,0 +1,28 @@
|
||||
# SCRIPT: _juntaBas.ps1 - Versión Saneada y Optimizada para LLM
|
||||
$OutputFile="_CODIGO_COMPLETO_PARA_LLM.txt"
|
||||
|
||||
# Eliminar el archivo anterior si existe (IMPORTANTE)
|
||||
Remove-Item -Path $OutputFile -ErrorAction SilentlyContinue
|
||||
|
||||
Write-Host "Iniciando fusion para LLM..."
|
||||
|
||||
# Itera sobre los archivos .bas, .b4a, .b4j
|
||||
Get-ChildItem -Path ".\*" -Include @("*.bas", "*.b4a", "*.b4j") | ForEach-Object {
|
||||
$currentFile = $_.Name
|
||||
Write-Host "Procesando: $currentFile"
|
||||
|
||||
# --- ENCABEZADO ESTRUCTURADO Y COMENTADO EN B4X (Agregado al archivo) ---
|
||||
Add-Content -Path $OutputFile -Value "`n'======================================================================================"
|
||||
Add-Content -Path $OutputFile -Value $"// ARCHIVO_INICIO: ${currentFile}"
|
||||
Add-Content -Path $OutputFile -Value "'======================================================================================`n"
|
||||
|
||||
# Vuelca el contenido del archivo
|
||||
Get-Content -Encoding UTF8 -Path $_.FullName -Raw | Add-Content -Path $OutputFile
|
||||
|
||||
# --- DELIMITADOR DE FIN DE ARCHIVO (Agregado al archivo) ---
|
||||
Add-Content -Path $OutputFile -Value "`n'======================================================================================"
|
||||
Add-Content -Path $OutputFile -Value $"// ARCHIVO_FIN: ${currentFile}"
|
||||
Add-Content -Path $OutputFile -Value "'======================================================================================`n"
|
||||
}
|
||||
|
||||
Write-Host "`nProceso terminado. Se ha creado el archivo: $OutputFile"
|
||||
@@ -82,7 +82,7 @@ Sub traeInfoTrendSpending As Map
|
||||
End If
|
||||
If semana > 0 Then
|
||||
c = tsdb.ExecQuery($"select HIST_TSS_TIPO, HIST_TSS_SEMANA${semana}, ifnull(HIST_TSS_SEMANA${semana}_ACUM,0) as HIST_TSS_SEMANA${semana}_ACUM from HIST_TREND_SPENDING_SEMANAL"$)
|
||||
Log($"select HIST_TSS_TIPO, HIST_TSS_SEMANA${semana}, ifnull(HIST_TSS_SEMANA${semana}_ACUM,0) as HIST_TSS_SEMANA${semana}_ACUM from HIST_TREND_SPENDING_SEMANAL"$)
|
||||
' Log($"select HIST_TSS_TIPO, HIST_TSS_SEMANA${semana}, ifnull(HIST_TSS_SEMANA${semana}_ACUM,0) as 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
|
||||
@@ -335,7 +335,7 @@ End Sub
|
||||
' Trae la cantidad máxima de productos con bonificacion por presupuesto.
|
||||
' Si el presupuesto es 10 y la bonificacion del producto es 2, el máximo es 5 productos.
|
||||
Sub traeBonificacionesMaximas(tipo As String, clienteId As String, id As String, laCant As String, elPrecioVenta As String, promoId As String) As Int
|
||||
Private thisLog As Boolean = False
|
||||
Private thisLog As Boolean = True
|
||||
Private tsMaximas As Int = 100000000
|
||||
Private tsRestantes As String = 0
|
||||
Private tsMonto As String
|
||||
@@ -345,22 +345,26 @@ Sub traeBonificacionesMaximas(tipo As String, clienteId As String, id As String,
|
||||
TS_DESCUENTOS = Regex.Split(",", mx.Get("DESCUENTOS"))
|
||||
TS_BONIFICACIONES = Regex.Split(",", mx.Get("BONIFICACIONES"))
|
||||
|
||||
If thisLog Then LogColor($"Presupuesto: ${TS_BONIFICACIONES(0)} - Acumulado ayer: ${TS_BONIFICACIONES(1)} - Hoy: ${traeAcumuladoHoyTS("bonificaciones")}"$, Colors.Red)
|
||||
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)
|
||||
tsRestantes = (TS_BONIFICACIONES(0) - TS_BONIFICACIONES(1) - traeAcumuladoHoyTS("bonificaciones")) ' Traemos monto restante de Trend Spending para bonificaciones.
|
||||
Log("TS_BONIFICACIONES(0) - TS_BONIFICACIONES(1) - traeAcumuladoHoyTS('bonificaciones')")
|
||||
Log($"${TS_BONIFICACIONES(0)} - ${TS_BONIFICACIONES(1)} - ${traeAcumuladoHoyTS("bonificaciones")}"$)
|
||||
Log($" PresupuestoBonifs: ${TS_BONIFICACIONES(0)}, AcumuladoBonifs: ${TS_BONIFICACIONES(1)}, traeAcumuladoHoyTS('bonificaciones'): ${traeAcumuladoHoyTS("bonificaciones")}"$)
|
||||
' Log($" ${TS_BONIFICACIONES(0)} - ${TS_BONIFICACIONES(1)} - ${traeAcumuladoHoyTS("bonificaciones")}"$)
|
||||
End If
|
||||
If thisLog Then Log($"Monto de bonificacion: ${tsMonto}"$)
|
||||
If thisLog Then Log($"Presupuesto disponible: ${tsRestantes}"$)
|
||||
If thisLog Then Log($"Cantidad: ${laCant}"$)
|
||||
If thisLog Then Log($"Floor(tsRestantes / (tsMonto * laCant))= ${Floor(tsRestantes / (tsMonto * laCant))}"$)
|
||||
If thisLog Then Log($"Floor(${tsRestantes} / (${tsMonto} * ${laCant}))= ${Floor(tsRestantes / (tsMonto * laCant))}"$)
|
||||
If thisLog Then Log($" Monto de bonificacion: ${tsMonto}"$)
|
||||
If thisLog Then Log($" Presupuesto disponible: ${tsRestantes}"$)
|
||||
' If thisLog Then Log($"Cantidad: ${laCant}"$)
|
||||
If thisLog Then Log($" Floor(tsRestantes / (tsMonto * laCant)) <==> Floor(${tsRestantes} / (${tsMonto} * ${laCant})) = ${Floor(tsRestantes / (tsMonto * laCant))}"$)
|
||||
' If thisLog Then Log($"Floor(${tsRestantes} / (${tsMonto} * ${laCant}))= ${Floor(tsRestantes / (tsMonto * laCant))}"$)
|
||||
If tsMonto > 0 Then
|
||||
tsMaximas = Floor(tsRestantes / (tsMonto * laCant))
|
||||
End If
|
||||
If thisLog Then Log(">>> tsMaximas: " & tsMaximas)
|
||||
If thisLog Then LogColor(" ************************************************", Colors.red)
|
||||
If thisLog Then LogColor(" ***** BONIFICACIONES MAXIMAS: " & tsMaximas & " *****", Colors.red)
|
||||
If thisLog Then LogColor(" ************************************************", Colors.red)
|
||||
If thisLog Then LogColor(" ============ TERMINA BONIFICACIONNES MAXIMAS ========", Colors.RGB(0,197,110))
|
||||
Return tsMaximas
|
||||
End Sub
|
||||
|
||||
@@ -368,14 +372,15 @@ End Sub
|
||||
' - 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
|
||||
Private thisLog As Boolean = True
|
||||
LogColor($">>>>>>> ${promoId}, ${precio}, ${id}"$, Colors.Magenta)
|
||||
Private thisLog As Boolean = False
|
||||
If thisLog Then LogColor($" ============ INICIA MONTO BONIFICACION (${id}) ========"$, Colors.RGB(151,0,171))
|
||||
If thisLog Then LogColor($" ###### ${promoId}, ${precio}, ${id}"$, 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.
|
||||
Private c As Cursor = tsdb.ExecQuery($"SELECT CAT_DP_ID, CAT_DP_IDPROD, CAT_DP_PRECIO, CAT_DP_TIPO, CAT_GP_PRECIO, CAT_DP_PRECIOB FROM CAT_DETALLES_PAQ join ${traeTablaProds(Starter.tipov)} on CAT_GP_ID = CAT_DP_IDPROD where CAT_GP_ID = '${id}' and CAT_DP_PRECIO = '${precio}' and CAT_DP_ID = '${promoId}'"$)
|
||||
Log($"SELECT CAT_DP_ID, CAT_DP_IDPROD, CAT_DP_PRECIO, CAT_DP_TIPO, CAT_GP_PRECIO, CAT_DP_PRECIOB FROM CAT_DETALLES_PAQ join ${traeTablaProds(Starter.tipov)} on CAT_GP_ID = CAT_DP_IDPROD where CAT_GP_ID = '${id}' and CAT_DP_PRECIO = '${precio}' and CAT_DP_ID = '${promoId}'"$)
|
||||
Log($"rowcount: ${c.RowCount}"$)
|
||||
' Log($"SELECT CAT_DP_ID, CAT_DP_IDPROD, CAT_DP_PRECIO, CAT_DP_TIPO, CAT_GP_PRECIO, CAT_DP_PRECIOB FROM CAT_DETALLES_PAQ join ${traeTablaProds(Starter.tipov)} on CAT_GP_ID = CAT_DP_IDPROD where CAT_GP_ID = '${id}' and CAT_DP_PRECIO = '${precio}' and CAT_DP_ID = '${promoId}'"$)
|
||||
If thisLog Then Log($" Rowcount DP y CGP2: ${c.RowCount}"$)
|
||||
If c.RowCount > 0 Then
|
||||
c.Position = 0
|
||||
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
|
||||
@@ -384,10 +389,11 @@ Sub traeMontoBonificacion(id As String, precio As String, promoId As String) As
|
||||
tsMonto = c.GetString("CAT_GP_PRECIO") ' Precio original.
|
||||
End If
|
||||
' Log("PRECIOB: " & c.GetInt("CAT_DP_PRECIOB"))
|
||||
If thisLog Then Log($"Precio normal: ${c.GetString("CAT_GP_PRECIO")}, Precio desc: ${c.GetString("CAT_DP_PRECIO")}, Monto bonificacion: ${tsMonto}"$)
|
||||
If thisLog Then Log($" Precio normal: ${c.GetString("CAT_GP_PRECIO")}, Precio desc: ${c.GetString("CAT_DP_PRECIO")}, Monto bonificacion: ${tsMonto}"$)
|
||||
End If
|
||||
' Log("ROWCOUNT: " & c.RowCount)
|
||||
End If
|
||||
If thisLog Then LogColor($" ============ TERMINA MONTO BONIFICACION ========"$, Colors.RGB(151,0,171))
|
||||
Return tsMonto
|
||||
End Sub
|
||||
|
||||
@@ -399,7 +405,7 @@ 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 = True
|
||||
Private logger As Boolean = False
|
||||
Private Maxs As Int = 10000000
|
||||
Private prodsVariablesXPresupuestoBonificaciones As List
|
||||
Private prodsVariablesRequeridos As Int = traeProdsVariablesRequeridos(promo)
|
||||
|
||||
Reference in New Issue
Block a user