mirror of
https://github.com/KeymonSoft/Mariana.git
synced 2026-04-17 21:06:16 +00:00
- VERSION 5.06.24
- Se Agregó un switch para activar/descativar la geocerca, solo se puede modficar dentro del almacen y requiere contraseña de supervisor de un solo uso. - Se agregaron recordatorios de "Envío de venta", a las 10:30, 13:00 y 15:30 y por cada uno de esos horarios, 10, 5, 1 minutos antes.
This commit is contained in:
52
B4A/Subs.bas
52
B4A/Subs.bas
@@ -848,7 +848,7 @@ Sub traePromo(promo As String, cliente As String) As Map
|
||||
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
|
||||
End If
|
||||
If thisLog Then Log(promoMap)
|
||||
If thisLog Then Log("MAX PROMOS: " & 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
|
||||
@@ -963,7 +963,7 @@ End Sub
|
||||
'Revisa si tenemos los productos variables requeridos para la promoción (mapa).
|
||||
'Hay que darle como parametro un mapa (traePromo(promo)) con toda la informacion de la promocion.
|
||||
Sub alcanzanLosVariablesParaPromo(promoMap As Map, inventarioSinFijos As Map) As Boolean 'ignore
|
||||
Private thisLog As Boolean = False 'Si es verdadero, muestra los logs de este sub.
|
||||
Private thisLog As Boolean = True 'Si es verdadero, muestra los logs de este sub.
|
||||
If thisLog Then LogColor("Inventario inicial: "&inventarioSinFijos, Colors.Gray) 'Inventario inicial.
|
||||
Private totalProdsVariables As Int = 0
|
||||
' Private prodsmap As Map = promoMap.Get("productos") 'Obtenemos un mapa con todos los productos de la promoción.
|
||||
@@ -989,7 +989,7 @@ 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 thisLog Then Log(pm)
|
||||
|
||||
Private maxXruta As String = traeMaxPromosXruta(pm.Get("id"))
|
||||
|
||||
@@ -1000,7 +1000,7 @@ Sub traeMaxPromos(pm As Map) As Int
|
||||
maxPromos.Add(pm.Get("maxXcliente").As(Int)) 'Agregamos maxXcliente
|
||||
If maxXruta <> "" Then maxPromos.Add(maxXruta.As(Int)) 'Agregamos maxXruta
|
||||
maxPromos.Sort(True)
|
||||
Log(maxPromos)
|
||||
' Log("MaxPromos: " & maxPromos)
|
||||
|
||||
' Log($"|${pm.Get("id").As(String).trim}|${traeCliente.Trim}|"$)
|
||||
Private c As Cursor = Starter.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))
|
||||
@@ -1028,11 +1028,11 @@ Sub traeMaxPromosXruta(idPromo As String) As String
|
||||
End If
|
||||
'Revisamos las promos que ya se hayan vendido y las restamos del máximo.
|
||||
Private cp As Cursor = Starter.skmt.ExecQuery($"select count(PE_CANT) as cuantos from PEDIDO where PE_PROID = '${idPromo}'"$)
|
||||
Log(cp.RowCount)
|
||||
' Log(cp.RowCount)
|
||||
If cp.RowCount > 0 Then
|
||||
Private pa As Int = 0
|
||||
cp.Position = 0
|
||||
Log(cp.GetInt("cuantos"))
|
||||
' Log(cp.GetInt("cuantos"))
|
||||
If IsNumber(cp.GetInt("cuantos")) Then pa = cp.GetInt("cuantos")
|
||||
If maxXruta <> "" Then maxXruta = maxXruta - pa
|
||||
End If
|
||||
@@ -1054,7 +1054,7 @@ End Sub
|
||||
Sub procesaPromocion(idPromo As String, cliente As String) As Map 'ignore
|
||||
Private thisLog As Boolean = True 'Si es verdadero, muestra los logs de este sub.
|
||||
Private inicioContador As String = DateTime.Now
|
||||
If thisLog Then LogColor($"********* Iniciamos revision de Promo ${idPromo} *********"$, Colors.Magenta)
|
||||
If thisLog Then LogColor($"********* Procesamos Promo ${idPromo} *********"$, Colors.Magenta)
|
||||
'Obtenemos el mapa con toda la info de la promoción.
|
||||
Private pm As Map = traePromo(idPromo, cliente)
|
||||
If thisLog Then LogColor(pm, Colors.Blue)
|
||||
@@ -1068,6 +1068,7 @@ Sub procesaPromocion(idPromo As String, cliente As String) As Map 'ignore
|
||||
End If
|
||||
'Restamos del inventario (mapa) las piezas necesarias para los productos fijos.
|
||||
Private inventarioSinFijos As Map = restaFijosPromo(pm)
|
||||
Log(idPromo)
|
||||
If thisLog Then LogColor("inventariosfijos="&inventarioSinFijos, Colors.Green)
|
||||
|
||||
If inventarioSinFijos.Get("resultado") = "ok" Then
|
||||
@@ -1394,4 +1395,41 @@ Sub CreateBitmapWithNumber(OriginalBitmap As Bitmap, Number As Int) As Bitmap 'i
|
||||
' Dibujar el número en el centro del Bitmap y configurar el estilo del texto
|
||||
Canvas.DrawText(Number, (OriginalBitmap.Width / 2), (OriginalBitmap.Height / 2.4), Typeface.DEFAULT, 15, Colors.White, "CENTER")
|
||||
Return NewBitmap
|
||||
End Sub
|
||||
|
||||
'Regresa verdadero si la geocerca esta activa en CAT_VARIABLES, default true.
|
||||
Sub geocercaHabilitada As Boolean
|
||||
Dim activa As Boolean = True
|
||||
Dim c As Cursor = Starter.skmt.ExecQuery("select cat_va_valor from cat_variables where cat_va_descripcion = 'GEOCERCA_ACTIVA'")
|
||||
If c.RowCount > 0 Then
|
||||
c.Position = 0
|
||||
If c.Getstring("CAT_VA_VALOR") = 0 Then activa = False
|
||||
End If
|
||||
' Log("Geocerca habilitada: " & activa)
|
||||
Return activa
|
||||
End Sub
|
||||
|
||||
Sub estamosEnAlmacen(rango As Int) As Boolean
|
||||
Dim l1, l2 As Location
|
||||
Dim res As Boolean = False
|
||||
Dim latAlmacen As String
|
||||
Dim lonAlmacen As String
|
||||
Try
|
||||
l1.Initialize2(B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps)
|
||||
Private x As Cursor = Starter.skmt.ExecQuery($"select CAT_VA_VALOR from CAT_VARIABLES where CAT_VA_DESCRIPCION = 'COORDS_ALMACEN'"$)
|
||||
If x.RowCount > 0 Then
|
||||
x.Position = 0
|
||||
Dim coords() As String = Regex.Split(",", x.GetString("CAT_VA_VALOR"))
|
||||
latAlmacen = coords(0)
|
||||
lonAlmacen = coords(1)
|
||||
End If
|
||||
' Log($"Coordenadas del almacen - lat:${latAlmacen}, lon:${lonAlmacen}"$)
|
||||
l2.Initialize2(latAlmacen, lonAlmacen)
|
||||
Dim distance As Long = l1.DistanceTo(l2) 'the result is in meters
|
||||
If distance <= rango Then res = True
|
||||
' Log("Dentro del almacen: " & res)
|
||||
Catch
|
||||
Log(LastException)
|
||||
End Try
|
||||
Return res
|
||||
End Sub
|
||||
Reference in New Issue
Block a user