- VERSION 5.12.12

- Se agrego el codigo para las promociones por rango y se aplico en los tickets impresoso y pdfs
This commit is contained in:
2025-12-18 16:54:23 -06:00
parent 5f6f3ac545
commit 7fff665461
13 changed files with 272 additions and 149 deletions

View File

@@ -826,9 +826,12 @@ Sub traeCliente As String 'ignore
Private c As Cursor
Private cl As String
c=B4XPages.MainPage.skmt.ExecQuery("Select CUENTA from cuentaa")
c.Position=0
cl = c.GetString("CUENTA")
If c.RowCount > 0 Then
c.Position=0
cl = c.GetString("CUENTA")
End If
c.Close
Log($"Cliente=${cl}"$)
Return cl
End Sub
@@ -1312,6 +1315,7 @@ Sub guardaAppInfo 'ignore
B4XPages.MainPage.skmt.ExecNonQuery($"insert into CAT_VARIABLES (CAT_VA_DESCRIPCION, CAT_VA_VALOR) values ('APP_VERSION', '${Application.VersionName}')"$)
End Sub
' Promo $150
Sub TraeMontoProd As Boolean
Private x As Boolean = False
Private c As Cursor = B4XPages.MainPage.skmt.ExecQuery("SELECT ifnull( SUM (PE_COSTO_TOT),0) As suma FROM PEDIDO JOIN CAT_PROMO_ESP ON CAT_PE_ID = PE_PROID WHERE PE_CLIENTE IN (Select CUENTA FROM CUENTAA)")
@@ -1320,7 +1324,6 @@ Sub TraeMontoProd As Boolean
Private c2 As Cursor = B4XPages.MainPage.skmt.ExecQuery("SELECT DISTINCT CAT_PE_MONTO FROM CAT_PROMO_ESP")
If c2.RowCount > 0 Then
c2.Position = 0
If c.GetString("suma") >= c2.GetString("CAT_PE_MONTO") Then
x = True
' Log("verdadero")
@@ -1328,7 +1331,6 @@ Sub TraeMontoProd As Boolean
x = False
' Log("Falso")
End If
End If
End If
Return x
@@ -2225,20 +2227,20 @@ Sub alcanzanLosVariablesParaPromo(promoMap As Map, inventarioSinFijos As Map) As
End Sub
'Calcula el total de pedido tomando en cuenta si hay productos con promos por rango.
Sub calculaTotalConPromoXRango As String
Sub calculaTotalConPromoXRango(idCliente As String) As String
' caso 1 pe_recant = Null
' monto del pedido = pe_costo_tot
' caso 2 pe_recant = pe_cant (solo prods dentro de rango)
' monto del pedido = pe_recalculotot
' caso 3 pe_recant <> pe_cant (hay prod dentro de rango y producto extra
' monto del pedido = ((pe_cant - pe_reccant) * pe_costou) + pe_recalculotot
Log("888888888888")
' Log("888888888888")
Private totalParcial As String = 0
Private total As String = 0
Private cx As Cursor = Starter.skmt.ExecQuery($"select *, ifnull(pe_reccant, 'N') as RECANT from pedido where pe_cliente = '${traeCliente}'"$)
Private cx As Cursor = Starter.skmt.ExecQuery($"select *, ifnull(pe_reccant, 'N') as RECANT from pedido where pe_cliente = '${idCliente}'"$)
If cx.RowCount > 0 Then
For i = 0 To cx.RowCount - 1
Log("999999999999999999999999999999999999")
' Log("999999999999999999999999999999999999")
cx.Position = i
Log("***************************************")
If cx.getstring("RECANT") = "N" Then ' Sin productos dentro de rango.