mirror of
https://github.com/KeymonSoft/Guna_Preventa.git
synced 2026-04-17 21:06:32 +00:00
- VERSION 4.11.22
- Se modifico el código de cargar día para que guarde tambien en cat_gunaprod2 la informacion de las promos
This commit is contained in:
@@ -26,7 +26,7 @@ Sub Class_Globals
|
|||||||
Dim ESPACIO As Int
|
Dim ESPACIO As Int
|
||||||
Dim BLANCO As String
|
Dim BLANCO As String
|
||||||
Dim cuenta As String
|
Dim cuenta As String
|
||||||
Dim tipo_venta As String = Subs.traeTipoVentaDeBD
|
Dim tipo_venta As String
|
||||||
Dim MAC_IMPRESORA As String
|
Dim MAC_IMPRESORA As String
|
||||||
Dim btAdmin As BluetoothAdmin
|
Dim btAdmin As BluetoothAdmin
|
||||||
Dim Printer1 As EscPosPrinter
|
Dim Printer1 As EscPosPrinter
|
||||||
@@ -497,7 +497,19 @@ Sub B4XPage_Appear
|
|||||||
dentroDeGeocerca = False
|
dentroDeGeocerca = False
|
||||||
indicePregunta = 0
|
indicePregunta = 0
|
||||||
If TOMAR_FOTO <> 0 Then Cuestionario
|
If TOMAR_FOTO <> 0 Then Cuestionario
|
||||||
|
Starter.idCliente = Subs.traeCliente
|
||||||
|
Log(Subs.traeCliente)
|
||||||
|
If Subs.traeCliente = "0" Then
|
||||||
|
tipo_venta = "ABORDO"
|
||||||
|
Log(1)
|
||||||
|
Log("ABORDO")
|
||||||
|
Else
|
||||||
|
tipo_venta = Subs.traeTipoVentaDeBD
|
||||||
|
Log(2)
|
||||||
|
Log(Subs.traeTipoVentaDeBD)
|
||||||
|
End If
|
||||||
B4XPages.MainPage.tipo_venta = tipo_venta
|
B4XPages.MainPage.tipo_venta = tipo_venta
|
||||||
|
Log($"TIPO_VENTA: ${tipo_venta}"$)
|
||||||
encuentasmapa.Initialize
|
encuentasmapa.Initialize
|
||||||
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_CAMERA)
|
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_CAMERA)
|
||||||
Wait For B4XPage_PermissionResult (Permission As String, resultC As Boolean)
|
Wait For B4XPage_PermissionResult (Permission As String, resultC As Boolean)
|
||||||
@@ -716,8 +728,8 @@ Sub B4XPage_Appear
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
If ALMACEN = 87 Or ALMACEN = 6 Then
|
If ALMACEN = 87 Or ALMACEN = 6 Then
|
||||||
If Subs.traemontoprod Then
|
If Subs.traemontoprod And Subs.traeCliente <> "0" Then
|
||||||
Msgbox2Async("El cliente tiene derecho a un descuento de 150 pesos por la compra de mas de $500 en productos Productos participantes" , "Descuento disponible", "Aceptar", "", "", LoadBitmap(File.DirAssets,"alert2.png"), False)
|
Msgbox2Async("El cliente tiene derecho a un descuento de 150 pesos por la compra de mas de $500 en productos participantes" , "Descuento disponible", "Aceptar", "", "", LoadBitmap(File.DirAssets,"alert2.png"), False)
|
||||||
Wait For Msgbox_Result (resultado As Int)
|
Wait For Msgbox_Result (resultado As Int)
|
||||||
If resultado = DialogResponse.POSITIVE Then
|
If resultado = DialogResponse.POSITIVE Then
|
||||||
Private c As Cursor = B4XPages.MainPage.skmt.ExecQuery("SELECT SUM(PE_CANT) AS PIEZAS FROM PEDIDO JOIN CAT_PROMO_ESP ON CAT_PE_ID = PE_PROID WHERE PE_CLIENTE IN (Select CUENTA FROM CUENTAA)")
|
Private c As Cursor = B4XPages.MainPage.skmt.ExecQuery("SELECT SUM(PE_CANT) AS PIEZAS FROM PEDIDO JOIN CAT_PROMO_ESP ON CAT_PE_ID = PE_PROID WHERE PE_CLIENTE IN (Select CUENTA FROM CUENTAA)")
|
||||||
|
|||||||
@@ -542,6 +542,8 @@ Sub Subir_Click
|
|||||||
PB1.Visible = False
|
PB1.Visible = False
|
||||||
Resumen.Visible= False
|
Resumen.Visible= False
|
||||||
|
|
||||||
|
B4XPages.MainPage.reqManager.trackInit
|
||||||
|
|
||||||
L_P_2.Text = "Envio de Pedidos"
|
L_P_2.Text = "Envio de Pedidos"
|
||||||
L_P_3.Text = "Envio de Pedidos"
|
L_P_3.Text = "Envio de Pedidos"
|
||||||
S_CH.Text = "EN PROCESO"
|
S_CH.Text = "EN PROCESO"
|
||||||
@@ -629,7 +631,7 @@ Sub Subir_Click
|
|||||||
cmd.Initialize
|
cmd.Initialize
|
||||||
Private eventob As String = h.GetString("eventob")
|
Private eventob As String = h.GetString("eventob")
|
||||||
cmd.Name = "mandaBitacora3_GUNA"
|
cmd.Name = "mandaBitacora3_GUNA"
|
||||||
Log("BITACORA3")
|
' Log("BITACORA3")
|
||||||
Private clienteb As String = h.GetString("clienteb")
|
Private clienteb As String = h.GetString("clienteb")
|
||||||
Private finb As String = h.GetString("finb")
|
Private finb As String = h.GetString("finb")
|
||||||
Private nombreCliente As String =Subs. traeNombreCliente(h.GetString("clienteb"))
|
Private nombreCliente As String =Subs. traeNombreCliente(h.GetString("clienteb"))
|
||||||
@@ -1172,6 +1174,7 @@ Sub cargar_Click
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub JobDone(Job As HttpJob)
|
Sub JobDone(Job As HttpJob)
|
||||||
|
B4XPages.MainPage.reqManager.trackNext(Job)
|
||||||
Log("JOBDONE PRINCIPAL")
|
Log("JOBDONE PRINCIPAL")
|
||||||
' If Job.JobName = "DBRequest" Then
|
' If Job.JobName = "DBRequest" Then
|
||||||
' Dim RESULT As DBResult = B4XPages.MainPage.reqManager.HandleJob(Job)
|
' Dim RESULT As DBResult = B4XPages.MainPage.reqManager.HandleJob(Job)
|
||||||
@@ -1688,6 +1691,11 @@ Sub JobDone(Job As HttpJob)
|
|||||||
CAT_GP_ALMACEN = 60
|
CAT_GP_ALMACEN = 60
|
||||||
End If
|
End If
|
||||||
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO CAT_GUNAPROD(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))
|
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO CAT_GUNAPROD(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))
|
||||||
|
' If CAT_GP_ID.StartsWith("PRO") Then LogColor($"Metemos promo a gunaprod - ${CAT_GP_ID}, |${CAT_GP_TIPO}|"$, Colors.red)
|
||||||
|
' If CAT_GP_TIPO = "PROMOS" Then
|
||||||
|
' LogColor($"Agregamos Promo a gunaprod2 - ${CAT_GP_ID}, ${CAT_GP_NOMBRE}"$, Colors.Red)
|
||||||
|
B4XPages.MainPage.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))
|
||||||
|
' End If
|
||||||
Next
|
Next
|
||||||
If PB2.Progress = 0 Then
|
If PB2.Progress = 0 Then
|
||||||
PB2.Progress = 30
|
PB2.Progress = 30
|
||||||
@@ -1922,7 +1930,7 @@ Sub JobDone(Job As HttpJob)
|
|||||||
S_CP.Text = "SUBIENDO"
|
S_CP.Text = "SUBIENDO"
|
||||||
Next
|
Next
|
||||||
PB2.Progress = 100
|
PB2.Progress = 100
|
||||||
S_CP.Text = "LISTO"
|
S_CP.Text = "ENVIANDO"
|
||||||
'Log("5")
|
'Log("5")
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@@ -2044,7 +2052,17 @@ Sub JobDone(Job As HttpJob)
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
If B4XPages.MainPage.reqManager.reqsList.IsInitialized Then
|
||||||
|
LogColor($"REQUESTS: ${B4XPages.MainPage.reqManager.reqsList.Size}"$, Colors.red)
|
||||||
|
Log($"CARGA=${CARGA}"$)
|
||||||
|
If B4XPages.MainPage.reqManager.reqsList.Size = 0 And CARGA = "SUBIR" Then
|
||||||
|
t1.Enabled = False
|
||||||
|
t1.Initialize("T1", 3000) ' 1000 = 1 second
|
||||||
|
Log(999)
|
||||||
|
Log("TIMER ENABLED")
|
||||||
|
t1.Enabled = True
|
||||||
|
End If
|
||||||
|
End If
|
||||||
Job.Release
|
Job.Release
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -2164,6 +2182,7 @@ End Sub
|
|||||||
|
|
||||||
Sub t2_tick
|
Sub t2_tick
|
||||||
e_ruta.Text = ""
|
e_ruta.Text = ""
|
||||||
|
If B4XPages.MainPage.productos.lv_catalogos.IsInitialized Then B4XPages.MainPage.productos.lv_catalogos.Clear
|
||||||
B4XPages.MainPage.skmt.ExecNonQuery("delete from pedido_cliente")
|
B4XPages.MainPage.skmt.ExecNonQuery("delete from pedido_cliente")
|
||||||
B4XPages.MainPage.skmt.ExecNonQuery("delete from pedido")
|
B4XPages.MainPage.skmt.ExecNonQuery("delete from pedido")
|
||||||
B4XPages.MainPage.skmt.ExecNonQuery("delete from noventa")
|
B4XPages.MainPage.skmt.ExecNonQuery("delete from noventa")
|
||||||
@@ -2278,26 +2297,30 @@ Sub inv_Click
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub t1_tick
|
Sub t1_tick
|
||||||
cmd.Initialize
|
' If CARGA = "SUBIR" Then
|
||||||
cmd.Name = "select_cuantos_pedido_GV2"
|
cmd.Initialize
|
||||||
cmd.Parameters = Array As Object(ALMACEN,l_ruta.text)
|
cmd.Name = "select_cuantos_pedido_GV2"
|
||||||
B4XPages.MainPage.reqManager.ExecuteQuery(cmd , 0, "valida_pedido")
|
cmd.Parameters = Array As Object(ALMACEN,l_ruta.text)
|
||||||
|
B4XPages.MainPage.reqManager.ExecuteQuery(cmd , 0, "valida_pedido")
|
||||||
|
|
||||||
cmd.Initialize
|
cmd.Initialize
|
||||||
cmd.Name = "select_cuantos_noventa_GV2"
|
cmd.Name = "select_cuantos_noventa_GV2"
|
||||||
cmd.Parameters = Array As Object(ALMACEN,l_ruta.text)
|
cmd.Parameters = Array As Object(ALMACEN,l_ruta.text)
|
||||||
B4XPages.MainPage.reqManager.ExecuteQuery(cmd , 0, "valida_noventa")
|
B4XPages.MainPage.reqManager.ExecuteQuery(cmd , 0, "valida_noventa")
|
||||||
|
|
||||||
cmd.Initialize
|
cmd.Initialize
|
||||||
cmd.Name = "select_cuantos_pedidoc_GV2"
|
cmd.Name = "select_cuantos_pedidoc_GV2"
|
||||||
cmd.Parameters = Array As Object(ALMACEN,l_ruta.text)
|
cmd.Parameters = Array As Object(ALMACEN,l_ruta.text)
|
||||||
B4XPages.MainPage.reqManager.ExecuteQuery(cmd , 0, "valida_pedidoc")
|
B4XPages.MainPage.reqManager.ExecuteQuery(cmd , 0, "valida_pedidoc")
|
||||||
|
|
||||||
If PB2.Progress = 0 Then
|
If PB2.Progress = 0 Then
|
||||||
S_CP.Text = "ENVIAR DATOS (K-1)"
|
S_CP.Text = "ENVIAR DATOS (K-1)"
|
||||||
End If
|
End If
|
||||||
img2.Visible=False
|
Log("TIMER DISABLED")
|
||||||
t1.Enabled = False
|
img2.Visible=False
|
||||||
|
t1.Enabled = False
|
||||||
|
' CARGA = ""
|
||||||
|
' End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub B_OK_PAS_Click
|
Sub B_OK_PAS_Click
|
||||||
@@ -2310,6 +2333,7 @@ Sub B_OK_PAS_Click
|
|||||||
connecta.Visible=True
|
connecta.Visible=True
|
||||||
Resumen.Visible= True
|
Resumen.Visible= True
|
||||||
img2.Visible=False
|
img2.Visible=False
|
||||||
|
CARGA = ""
|
||||||
Subs.panelVisible(p_principal, 0, 0)
|
Subs.panelVisible(p_principal, 0, 0)
|
||||||
Else If CARGA = "SUBIR" And S_CP.Text = "ERROR" Then
|
Else If CARGA = "SUBIR" And S_CP.Text = "ERROR" Then
|
||||||
Msgbox("Tiene que subir de nuevo la información","Atención") 'ignore
|
Msgbox("Tiene que subir de nuevo la información","Atención") 'ignore
|
||||||
|
|||||||
@@ -83,7 +83,9 @@ End Sub
|
|||||||
|
|
||||||
Sub B4XPage_Appear
|
Sub B4XPage_Appear
|
||||||
tipo_venta = Subs.traeTipoVentaDeBD
|
tipo_venta = Subs.traeTipoVentaDeBD
|
||||||
|
clv_productos.Clear
|
||||||
LogColor(tipo_venta, Colors.red)
|
LogColor(tipo_venta, Colors.red)
|
||||||
|
LogColor(Subs.traeTablaProds(tipo_venta), Colors.red)
|
||||||
prodsMap.Initialize
|
prodsMap.Initialize
|
||||||
B4XPages.MainPage.skmt.ExecNonQuery2($"UPDATE ${Subs.traeTablaProds(tipo_venta)} SET CAT_GP_TIPOPROD = (?) WHERE CAT_GP_TIPOPROD = (?)"$,Array As Object("PRIORITARIO","1"))
|
B4XPages.MainPage.skmt.ExecNonQuery2($"UPDATE ${Subs.traeTablaProds(tipo_venta)} SET CAT_GP_TIPOPROD = (?) WHERE CAT_GP_TIPOPROD = (?)"$,Array As Object("PRIORITARIO","1"))
|
||||||
B4XPages.MainPage.skmt.ExecNonQuery2($"UPDATE ${Subs.traeTablaProds(tipo_venta)} SET CAT_GP_TIPOPROD = (?) WHERE CAT_GP_TIPOPROD = (?)"$,Array As Object("ESTRATEGICO","2"))
|
B4XPages.MainPage.skmt.ExecNonQuery2($"UPDATE ${Subs.traeTablaProds(tipo_venta)} SET CAT_GP_TIPOPROD = (?) WHERE CAT_GP_TIPOPROD = (?)"$,Array As Object("ESTRATEGICO","2"))
|
||||||
@@ -116,17 +118,20 @@ Sub B4XPage_Appear
|
|||||||
p_botonesVenta.Top = clv_productos.AsView.top + clv_productos.AsView.Height
|
p_botonesVenta.Top = clv_productos.AsView.top + clv_productos.AsView.Height
|
||||||
lv_promos.Visible = False
|
lv_promos.Visible = False
|
||||||
End If
|
End If
|
||||||
Dim label1 As Label
|
Dim label1 As Label
|
||||||
label1 = lv_catalogos.SingleLineLayout.Label
|
label1 = lv_catalogos.SingleLineLayout.Label
|
||||||
label1.TextSize = 13
|
label1.TextSize = 13
|
||||||
label1.TextColor = Colors.Black
|
label1.TextColor = Colors.Black
|
||||||
lv_catalogos.Clear
|
lv_catalogos.Clear
|
||||||
lv_catalogos.AddSingleLine("CATALOGO")
|
lv_catalogos.AddSingleLine("CATALOGO")
|
||||||
c = B4XPages.MainPage.skmt.ExecQuery($"select count(*) as hayPromos from ${Subs.traeTablaProds(tipo_venta)} where CAT_GP_TIPOPROD = 'PROMOS'"$)
|
c = B4XPages.MainPage.skmt.ExecQuery($"select count(*) as hayPromos from ${Subs.traeTablaProds(tipo_venta)} where CAT_GP_TIPOPROD = 'PROMOS'"$)
|
||||||
c.Position = 0
|
c.Position = 0
|
||||||
If c.GetInt("hayPromos") > 0 Then
|
If c.GetInt("hayPromos") > 0 Then
|
||||||
If Not(Subs.traeCliente.StartsWith("N")) Then lv_catalogos.AddSingleLine("PROMOS") 'No se venden promos a clientes nuevos.
|
Log(">>>>>>>>>> " & Subs.traeCliente)
|
||||||
|
If Not(Subs.traeCliente.StartsWith("N")) And Subs.traeCliente <> "0" Then
|
||||||
|
lv_catalogos.AddSingleLine("PROMOS") 'No se venden promos a clientes nuevos.
|
||||||
End If
|
End If
|
||||||
|
End If
|
||||||
Sleep(100)
|
Sleep(100)
|
||||||
l_total.Visible = False
|
l_total.Visible = False
|
||||||
l_totProds.Visible = False
|
l_totProds.Visible = False
|
||||||
|
|||||||
@@ -4,9 +4,7 @@ ModulesStructureVersion=1
|
|||||||
Type=Class
|
Type=Class
|
||||||
Version=6.8
|
Version=6.8
|
||||||
@EndOfDesignText@
|
@EndOfDesignText@
|
||||||
'Necesita la libreria RandomAccessFile
|
''Class module
|
||||||
|
|
||||||
'Class module
|
|
||||||
Sub Class_Globals
|
Sub Class_Globals
|
||||||
Private mTarget As Object
|
Private mTarget As Object
|
||||||
Type DBResult (Tag As Object, Columns As Map, Rows As List)
|
Type DBResult (Tag As Object, Columns As Map, Rows As List)
|
||||||
@@ -17,7 +15,11 @@ Sub Class_Globals
|
|||||||
,T_DOUBLE = 6, T_BOOLEAN = 7, T_BLOB = 8 As Byte
|
,T_DOUBLE = 6, T_BOOLEAN = 7, T_BLOB = 8 As Byte
|
||||||
Private VERSION As Float = 0.9
|
Private VERSION As Float = 0.9
|
||||||
Private tempArray(1) As Object
|
Private tempArray(1) As Object
|
||||||
Dim jobTagAnterior As String = "" 'Mod por CHV - 211027
|
Dim jobTagAnterior As String = "" 'Mod por CHV - 211109
|
||||||
|
Dim reqsList, timesList As List
|
||||||
|
Dim inicioRequest As Long 'ignore
|
||||||
|
Dim inicioJobDone As Long 'ignore
|
||||||
|
Dim inicioRequestMap, inicioJobDoneMap As Map
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
'Target - The module that handles JobDone (usually Me).
|
'Target - The module that handles JobDone (usually Me).
|
||||||
@@ -34,8 +36,10 @@ End Sub
|
|||||||
Public Sub ExecuteQuery(Command As DBCommand, Limit As Int, Tag As Object)
|
Public Sub ExecuteQuery(Command As DBCommand, Limit As Int, Tag As Object)
|
||||||
Dim j As HttpJob
|
Dim j As HttpJob
|
||||||
Dim ms As OutputStream
|
Dim ms As OutputStream
|
||||||
Dim out2 As OutputStream = StartJob(j,ms, Tag)
|
Dim out2 As OutputStream = StartJob(j, ms, Tag)
|
||||||
|
' If reqsList.IsInitialized Then reqsList.Add(Tag)
|
||||||
|
' If timesList.IsInitialized Then timesList.Add(DateTime.now)
|
||||||
|
|
||||||
WriteObject(Command.Name, out2)
|
WriteObject(Command.Name, out2)
|
||||||
WriteInt(Limit, out2)
|
WriteInt(Limit, out2)
|
||||||
WriteList(Command.Parameters, out2)
|
WriteList(Command.Parameters, out2)
|
||||||
@@ -43,13 +47,30 @@ Public Sub ExecuteQuery(Command As DBCommand, Limit As Int, Tag As Object)
|
|||||||
j.PostBytes(link & "?method=query", ms.ToBytesArray)
|
j.PostBytes(link & "?method=query", ms.ToBytesArray)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
'Sends a query request.
|
||||||
|
'Command - Query name and parameters.
|
||||||
|
'Limit - Maximum rows to return or 0 for no limit.
|
||||||
|
'Tag - An object that will be returned in the result.
|
||||||
|
'Timeout - The http request timeout in ms, or 0 if default (30 secs)
|
||||||
|
Public Sub ExecuteQuery3(Command As DBCommand, Limit As Int, Tag As Object, Timeout As Int) 'Mod por CHV, agregué el parametro Timeout - 211229
|
||||||
|
Dim j As HttpJob
|
||||||
|
Dim ms As OutputStream
|
||||||
|
Dim out2 As OutputStream = StartJob(j,ms, Tag)
|
||||||
|
WriteObject(Command.Name, out2)
|
||||||
|
WriteInt(Limit, out2)
|
||||||
|
WriteList(Command.Parameters, out2)
|
||||||
|
out2.Close
|
||||||
|
j.PostBytes(link & "?method=query", ms.ToBytesArray)
|
||||||
|
If Timeout <> 0 Then j.GetRequest.Timeout = Timeout
|
||||||
|
End Sub
|
||||||
|
|
||||||
'Executes a batch of (non-select) commands.
|
'Executes a batch of (non-select) commands.
|
||||||
'ListOfCommands - List of the commands that will be executes.
|
'ListOfCommands - List of the commands that will be executes.
|
||||||
'Tag - An object that will be returned in the result.
|
'Tag - An object that will be returned in the result.
|
||||||
Public Sub ExecuteBatch(ListOfCommands As List, Tag As Object)
|
Public Sub ExecuteBatch(ListOfCommands As List, Tag As Object)
|
||||||
Dim j As HttpJob
|
Dim j As HttpJob
|
||||||
Dim ms As OutputStream
|
Dim ms As OutputStream
|
||||||
Dim out2 As OutputStream = StartJob(j,ms, Tag)
|
Dim out2 As OutputStream = StartJob(j, ms, Tag)
|
||||||
WriteInt(ListOfCommands.Size, out2)
|
WriteInt(ListOfCommands.Size, out2)
|
||||||
For Each Command As DBCommand In ListOfCommands
|
For Each Command As DBCommand In ListOfCommands
|
||||||
WriteObject(Command.Name, out2)
|
WriteObject(Command.Name, out2)
|
||||||
@@ -61,10 +82,15 @@ End Sub
|
|||||||
|
|
||||||
'Similar to ExecuteBatch. Sends a single command.
|
'Similar to ExecuteBatch. Sends a single command.
|
||||||
Public Sub ExecuteCommand(Command As DBCommand, Tag As Object)
|
Public Sub ExecuteCommand(Command As DBCommand, Tag As Object)
|
||||||
|
' If reqsList.IsInitialized Then reqsList.Add(Tag)
|
||||||
|
' If timesList.IsInitialized Then timesList.Add(DateTime.now)
|
||||||
ExecuteBatch(Array As DBCommand(Command), Tag)
|
ExecuteBatch(Array As DBCommand(Command), Tag)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub StartJob(j As HttpJob, MemoryStream As OutputStream, Tag As Object) As OutputStream
|
Private Sub StartJob(j As HttpJob, MemoryStream As OutputStream, Tag As Object) As OutputStream
|
||||||
|
' inicioRequest = DateTime.now
|
||||||
|
If reqsList.IsInitialized Then reqsList.Add(Tag)
|
||||||
|
If timesList.IsInitialized Then timesList.Add(DateTime.now)
|
||||||
j.Initialize("DBRequest", mTarget)
|
j.Initialize("DBRequest", mTarget)
|
||||||
j.Tag = Tag
|
j.Tag = Tag
|
||||||
MemoryStream.InitializeToBytesArray(0)
|
MemoryStream.InitializeToBytesArray(0)
|
||||||
@@ -115,7 +141,7 @@ Private Sub WriteObject(o As Object, out As OutputStream)
|
|||||||
Else If GetType(tempArray(0)) = "[B" Then
|
Else If GetType(tempArray(0)) = "[B" Then
|
||||||
data = o
|
data = o
|
||||||
out.WriteBytes(Array As Byte(T_BLOB), 0, 1)
|
out.WriteBytes(Array As Byte(T_BLOB), 0, 1)
|
||||||
WriteInt(data.Length, out)
|
WriteInt(data.Length, out)
|
||||||
Else 'If o Is String Then (treat all other values as string)
|
Else 'If o Is String Then (treat all other values as string)
|
||||||
out.WriteBytes(Array As Byte(T_STRING), 0, 1)
|
out.WriteBytes(Array As Byte(T_STRING), 0, 1)
|
||||||
data = bc.StringToBytes(o, "UTF8")
|
data = bc.StringToBytes(o, "UTF8")
|
||||||
@@ -188,7 +214,13 @@ End Sub
|
|||||||
|
|
||||||
'Handles the Job result and returns a DBResult.
|
'Handles the Job result and returns a DBResult.
|
||||||
Public Sub HandleJob(Job As HttpJob) As DBResult
|
Public Sub HandleJob(Job As HttpJob) As DBResult
|
||||||
Dim start As Long = DateTime.Now
|
If jobTagAnterior <> Job.Tag Then
|
||||||
|
' inicioJobDone = DateTime.Now 'ignore
|
||||||
|
If inicioJobDoneMap.IsInitialized Then inicioJobDoneMap.Put(Job.Tag, DateTime.Now)
|
||||||
|
' tiempos.Put(Job.taskId, CreateMap("inicioJobDone":inicioJobDone))
|
||||||
|
' Log(tiempos)
|
||||||
|
' Log("############# " & Job.taskId)
|
||||||
|
End If
|
||||||
Dim In As InputStream = Job.GetInputStream
|
Dim In As InputStream = Job.GetInputStream
|
||||||
Dim cs As CompressedStreams
|
Dim cs As CompressedStreams
|
||||||
In = cs.WrapInputStream(In, "gzip")
|
In = cs.WrapInputStream(In, "gzip")
|
||||||
@@ -199,8 +231,6 @@ Public Sub HandleJob(Job As HttpJob) As DBResult
|
|||||||
table.Columns.Initialize
|
table.Columns.Initialize
|
||||||
table.rows.Initialize
|
table.rows.Initialize
|
||||||
table.Tag = Job.Tag
|
table.Tag = Job.Tag
|
||||||
If jobTagAnterior <> Job.Tag Then LogColor("HandleJob: '"&Job.Tag&"'", Colors.Blue) 'Mod por CHV - 211023
|
|
||||||
jobTagAnterior = Job.Tag 'Mod por CHV - 211023
|
|
||||||
If method = "query" Then
|
If method = "query" Then
|
||||||
Dim numberOfColumns As Int = ReadInt(In)
|
Dim numberOfColumns As Int = ReadInt(In)
|
||||||
For i = 0 To numberOfColumns - 1
|
For i = 0 To numberOfColumns - 1
|
||||||
@@ -222,9 +252,14 @@ Public Sub HandleJob(Job As HttpJob) As DBResult
|
|||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
In.Close
|
In.Close
|
||||||
' Log("HandleJob: " & (DateTime.Now - start))
|
' Log("HandleJob: " & (DateTime.Now - start))'Comentado por CHV - 211112
|
||||||
|
If jobTagAnterior <> table.Tag Then
|
||||||
|
LogColor("HandleJob: '"&table.Tag&"'" & " - Registros: " & table.Rows.Size, Colors.RGB(115, 0, 140)) 'Mod por CHV - 211109
|
||||||
|
End If
|
||||||
|
jobTagAnterior = table.Tag 'Mod por CHV - 211109
|
||||||
Return table
|
Return table
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
'Reads a file and returns the file as a bytes array.
|
'Reads a file and returns the file as a bytes array.
|
||||||
Public Sub FileToBytes(Dir As String, FileName As String) As Byte()
|
Public Sub FileToBytes(Dir As String, FileName As String) As Byte()
|
||||||
Dim out As OutputStream
|
Dim out As OutputStream
|
||||||
@@ -234,6 +269,7 @@ Public Sub FileToBytes(Dir As String, FileName As String) As Byte()
|
|||||||
out.Close
|
out.Close
|
||||||
Return out.ToBytesArray
|
Return out.ToBytesArray
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
'Converts an image to a bytes array (for BLOB fields).
|
'Converts an image to a bytes array (for BLOB fields).
|
||||||
Public Sub ImageToBytes(Image As Bitmap) As Byte()
|
Public Sub ImageToBytes(Image As Bitmap) As Byte()
|
||||||
Dim out As OutputStream
|
Dim out As OutputStream
|
||||||
@@ -242,6 +278,7 @@ Public Sub ImageToBytes(Image As Bitmap) As Byte()
|
|||||||
out.Close
|
out.Close
|
||||||
Return out.ToBytesArray
|
Return out.ToBytesArray
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
'Converts a bytes array to an image (for BLOB fields).
|
'Converts a bytes array to an image (for BLOB fields).
|
||||||
Public Sub BytesToImage(bytes() As Byte) As Bitmap
|
Public Sub BytesToImage(bytes() As Byte) As Bitmap
|
||||||
Dim In As InputStream
|
Dim In As InputStream
|
||||||
@@ -250,6 +287,7 @@ Public Sub BytesToImage(bytes() As Byte) As Bitmap
|
|||||||
bmp.Initialize2(In)
|
bmp.Initialize2(In)
|
||||||
Return bmp
|
Return bmp
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
'Prints the table to the logs.
|
'Prints the table to the logs.
|
||||||
Public Sub PrintTable(Table As DBResult)
|
Public Sub PrintTable(Table As DBResult)
|
||||||
Log("Tag: " & Table.Tag & ", Columns: " & Table.Columns.Size & ", Rows: " & Table.Rows.Size)
|
Log("Tag: " & Table.Tag & ", Columns: " & Table.Columns.Size & ", Rows: " & Table.Rows.Size)
|
||||||
@@ -265,8 +303,58 @@ Public Sub PrintTable(Table As DBResult)
|
|||||||
For Each record As Object In row
|
For Each record As Object In row
|
||||||
sb.Append(record).Append(TAB)
|
sb.Append(record).Append(TAB)
|
||||||
Next
|
Next
|
||||||
ToastMessageShow(sb.ToString, True)
|
Log(sb.ToString)
|
||||||
Next
|
Next
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Sub requestTimes(tag As String) As Map 'ignore
|
||||||
|
Private times As Map
|
||||||
|
times.Initialize
|
||||||
|
' Log("###### " & tag)
|
||||||
|
' Log(reqsList.IsInitialized)
|
||||||
|
If reqsList.IsInitialized Then
|
||||||
|
' Log(reqsList)
|
||||||
|
' Private pos As Int = reqsList.IndexOf(tag)
|
||||||
|
If inicioRequestMap.ContainsKey(tag) Then
|
||||||
|
inicioRequest = inicioRequestMap.Get(tag)
|
||||||
|
' Log(">>>>>>> From inicioRequestMap")
|
||||||
|
End If
|
||||||
|
If inicioJobDoneMap.ContainsKey(tag) Then
|
||||||
|
inicioJobDone = inicioJobDoneMap.Get(tag)
|
||||||
|
' Log(">>>>>>> From inicioJobDoneMap")
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
' Log($"${inicioJobDone} - ${inicioRequest}"$)
|
||||||
|
Private requestTime As String = NumberFormat2(((inicioJobDone - inicioRequest) / 1000),1,5,0,False)
|
||||||
|
Private JobDoneTime As String = NumberFormat2(((DateTime.Now - inicioJobDone) / 1000),1,5,0,False)
|
||||||
|
times.Put("requestTime", requestTime)
|
||||||
|
times.Put("jobDoneTime", JobDoneTime)
|
||||||
|
times.Put("totalTime", NumberFormat2((JobDoneTime + requestTime),1,5,0,False))
|
||||||
|
Return times
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
'Initializes request tracking
|
||||||
|
Sub trackInit 'ignore
|
||||||
|
Log(">>>>>>>>> TRACKINIT ")
|
||||||
|
reqsList.Initialize
|
||||||
|
timesList.Initialize
|
||||||
|
inicioRequestMap.Initialize
|
||||||
|
inicioJobDoneMap.Initialize
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Sub trackNext(job As HttpJob)
|
||||||
|
If reqsList.IsInitialized Then 'Si tenemos lista de requests, la procesamos.
|
||||||
|
Private quitamos As String = ""
|
||||||
|
If reqsList.IndexOf(job.tag) <> -1 Then
|
||||||
|
Private pos As Int = reqsList.IndexOf(job.tag)
|
||||||
|
If pos <> -1 Then
|
||||||
|
inicioRequestMap.Put(job.Tag, timesList.Get(pos))
|
||||||
|
reqsList.RemoveAt(pos)
|
||||||
|
timesList.RemoveAt(pos)
|
||||||
|
End If
|
||||||
|
quitamos = $"Quitamos ${job.tag} - "$
|
||||||
|
End If
|
||||||
|
LogColor(">>>>>> Requests: " & reqsList.Size & " - " & quitamos & reqsList, Colors.Blue)
|
||||||
|
LogColor(">>>>>> inicioRequestMap:" & inicioRequestMap.Size & " - " & inicioRequestMap, Colors.Magenta)
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
@@ -256,7 +256,7 @@ Version=12.8
|
|||||||
#Region Project Attributes
|
#Region Project Attributes
|
||||||
#ApplicationLabel: Guna Preventa
|
#ApplicationLabel: Guna Preventa
|
||||||
#VersionCode: 1
|
#VersionCode: 1
|
||||||
#VersionName: 4.11.14
|
#VersionName: 4.11.22
|
||||||
'SupportedOrientations possible values: unspecified, landscape or portrait.
|
'SupportedOrientations possible values: unspecified, landscape or portrait.
|
||||||
#SupportedOrientations: portrait
|
#SupportedOrientations: portrait
|
||||||
#CanInstallToExternalStorage: False
|
#CanInstallToExternalStorage: False
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ ModuleClosedNodes10=
|
|||||||
ModuleClosedNodes11=
|
ModuleClosedNodes11=
|
||||||
ModuleClosedNodes12=
|
ModuleClosedNodes12=
|
||||||
ModuleClosedNodes13=6
|
ModuleClosedNodes13=6
|
||||||
ModuleClosedNodes14=
|
ModuleClosedNodes14=16
|
||||||
ModuleClosedNodes15=3,17
|
ModuleClosedNodes15=3,17
|
||||||
ModuleClosedNodes16=
|
ModuleClosedNodes16=
|
||||||
ModuleClosedNodes17=
|
ModuleClosedNodes17=
|
||||||
@@ -79,6 +79,6 @@ ModuleClosedNodes6=
|
|||||||
ModuleClosedNodes7=5,6,8,9,10,11
|
ModuleClosedNodes7=5,6,8,9,10,11
|
||||||
ModuleClosedNodes8=
|
ModuleClosedNodes8=
|
||||||
ModuleClosedNodes9=
|
ModuleClosedNodes9=
|
||||||
NavigationStack=C_Bitacora,p_transparenteInicioFin2_click,188,0,C_Bitacora,Class_Globals,7,0,C_Bitacora,Initialize,25,6,C_Bitacora,B4XPage_Created,33,0,C_Cuestionario,Class_Globals,5,0,Visual Designer,inicioFinVenta.bal,-100,1,Visual Designer,proditem.bal,-100,6,Visual Designer,clientes.bal,-100,1,C_Cuestionario,agregaPreguntaAbierta,217,0,B4XMainPage,B4XPage_Created,179,0,Starter,JobDone,137,0
|
NavigationStack=Visual Designer,principal.bal,-100,1,C_Principal,t1_tick,2288,6,C_Principal,t2_tick,2205,0,Subs,traeTablaProds,1679,0,C_Clientes,ListView1_ItemClick,138,0,C_Cliente,B4XPage_Appear,493,6,C_Principal,B_OK_PAS_Click,2314,3,C_Principal,B_OK_RES_Click,2420,0,Main,Process_Globals,21,0,C_Principal,JobDone,1732,6
|
||||||
SelectedBuild=0
|
SelectedBuild=0
|
||||||
VisibleModules=24,2,14,25,4,5,7,6,15,11
|
VisibleModules=24,2,14,25,4,5,7,6,15,11
|
||||||
|
|||||||
@@ -1385,7 +1385,6 @@ Sub iniciaActividad(ia As String)
|
|||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
'Revisa si en el pedido hay $150 o mas de los 2 productos especificados, y si si, entonces agrega el producto de regalo a la tabla pedido.
|
'Revisa si en el pedido hay $150 o mas de los 2 productos especificados, y si si, entonces agrega el producto de regalo a la tabla pedido.
|
||||||
Sub revisaPromoProcterPRO3009(prodsMap1 As Map)
|
Sub revisaPromoProcterPRO3009(prodsMap1 As Map)
|
||||||
Log("entramos a promo Procter")
|
Log("entramos a promo Procter")
|
||||||
|
|||||||
Reference in New Issue
Block a user