mirror of
https://github.com/KeymonSoft/Lanterna.git
synced 2026-04-18 13:19:17 +00:00
Cierre administativo, cierre de mesa sin venta y envio de errores a push_info
This commit is contained in:
@@ -38,6 +38,13 @@ Sub Class_Globals
|
||||
Private Label1 As Label
|
||||
Private i_conf As ImageView
|
||||
Private b_cargaProductos As Button
|
||||
Private ListView1 As ListView
|
||||
Private E_SERVER As EditText
|
||||
Dim reqManager As DBRequestManager
|
||||
Private l_version As Label
|
||||
Private p_botones As Panel
|
||||
Private Label3 As Label
|
||||
Private p_server As Panel
|
||||
End Sub
|
||||
|
||||
Public Sub Initialize
|
||||
@@ -46,6 +53,7 @@ End Sub
|
||||
|
||||
'This event will be called once, before the page becomes visible.
|
||||
Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
Subs.revisaBD
|
||||
Root = Root1
|
||||
Root.LoadLayout("login")
|
||||
login.Initialize
|
||||
@@ -63,17 +71,39 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
Starter.skmt.ExecNonQuery("insert into cuentaa (cuenta) values ('123456')")
|
||||
Starter.skmt.ExecNonQuery("delete from cat_almacen")
|
||||
Starter.skmt.ExecNonQuery("insert into cat_almacen (id_almacen) values ('1')")
|
||||
l_version.Text = Application.VersionName
|
||||
p_configuracion.Height = Root.Height : p_configuracion.width = Root.width
|
||||
reqManager.Initialize(Me, Starter.DBReqServer)
|
||||
Subs.centraEtiqueta(Label3, p_configuracion.Width)
|
||||
Subs.centraPanel(p_server, p_configuracion.Width)
|
||||
Subs.centraPanel(p_botones, p_configuracion.Width)
|
||||
' subs.panelVisible(p_configuracion, 0, 0)
|
||||
End Sub
|
||||
|
||||
Private Sub B4XPage_CloseRequest As ResumableSub
|
||||
' BACK key pressed
|
||||
'Return True to close, False to cancel
|
||||
Log("BACK")
|
||||
If p_configuracion.Visible Then
|
||||
p_configuracion.Visible = False
|
||||
Return False
|
||||
Else
|
||||
' If logger Then Log("Saliendo")
|
||||
' B4XPages.ClosePage(Me)
|
||||
' Subs.cierraActividades
|
||||
' Return True
|
||||
End If
|
||||
Return False
|
||||
End Sub
|
||||
|
||||
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
||||
|
||||
Private Sub i_logo_Click
|
||||
p_configuracion.Width = Root.Width
|
||||
p_configuracion.Height = Root.Height
|
||||
Subs.panelVisible(p_configuracion, 0, 0)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub b_regresar_Click
|
||||
p_configuracion.Visible = False
|
||||
Subs.panelVisible(p_login, 0, 0)
|
||||
End Sub
|
||||
|
||||
@@ -82,7 +112,8 @@ Private Sub b_entrar_Click
|
||||
End Sub
|
||||
|
||||
Private Sub B_SERVER_Click
|
||||
|
||||
Starter.DBReqServer = E_SERVER.text
|
||||
p_configuracion.Visible = False
|
||||
End Sub
|
||||
|
||||
Private Sub b_envioBD_Click
|
||||
@@ -90,9 +121,111 @@ Private Sub b_envioBD_Click
|
||||
End Sub
|
||||
|
||||
Private Sub i_conf_Click
|
||||
|
||||
ListView1.Clear
|
||||
Dim Label1 As Label
|
||||
Label1 = ListView1.SingleLineLayout.Label
|
||||
Label1.TextSize = 20
|
||||
Label1.TextColor = Colors.Black
|
||||
' If user.Text = "KMTS1" Then ListView1.AddSingleLine("http://10.0.0.205:1781")
|
||||
ListView1.AddSingleLine("http://keymon.lat:1782")
|
||||
p_configuracion.Width = Root.Width
|
||||
p_configuracion.Height = Root.Height
|
||||
p_configuracion.BringToFront
|
||||
Subs.panelVisible(p_configuracion, 0, 0)
|
||||
End Sub
|
||||
|
||||
Private Sub b_cargaProductos_Click
|
||||
Log(Starter.DBReqServer)
|
||||
' Dim cmd As DBCommand
|
||||
' cmd.Initialize
|
||||
' cmd.Name = "select_cat_gunaprod_GV2"
|
||||
' cmd.Parameters = Array As Object(1)
|
||||
' B4XPages.MainPage.reqManager.ExecuteQuery(cmd , 0, "gunaprod")
|
||||
Dim cmd As DBCommand
|
||||
cmd.Initialize
|
||||
cmd.Name = "selectProds_Lanter"
|
||||
reqManager.ExecuteQuery(cmd , 0, "selectProds")
|
||||
cmd.Initialize
|
||||
|
||||
cmd.Name = "selectMesas_Lanter"
|
||||
reqManager.ExecuteQuery(cmd , 0, "selectMesas")
|
||||
|
||||
cmd.Initialize
|
||||
cmd.Name = "selectMeseros_Lanter"
|
||||
reqManager.ExecuteQuery(cmd , 0, "selectMeseros")
|
||||
End Sub
|
||||
|
||||
Private Sub ListView1_ItemClick (Position As Int, Value As Object)
|
||||
Starter.DBReqServer = Value
|
||||
E_SERVER.Text = Value
|
||||
Log(Starter.DBReqServer)
|
||||
End Sub
|
||||
|
||||
Sub JobDone(Job As HttpJob)
|
||||
Log("JOBDONE MAINPAGE")
|
||||
If Job.Tag.As(String).StartsWith("_KMS_") Then Job.tag = Job.Tag.As(String).SubString(16)
|
||||
If Job.Success = False Then
|
||||
ToastMessageShow("Error: " & Job.ErrorMessage, True)
|
||||
Else
|
||||
If Starter.Logger Then LogColor("JobDone: '" & Starter.reqManager.HandleJob(Job).tag & "' - Registros: " & Starter.reqManager.HandleJob(Job).Rows.Size, Colors.Green) 'Mod por CHV - 211110
|
||||
If Job.JobName = "DBRequest" Then
|
||||
Dim result As DBResult = Starter.reqManager.HandleJob(Job)
|
||||
If result.Tag = "selectProds" Then 'query tag
|
||||
' If Starter.Logger Then Subs.logJobDoneResultados(result)
|
||||
Starter.skmt.ExecNonQuery("delete from cat_gunaprod")
|
||||
Starter.skmt.BeginTransaction
|
||||
For Each records() As Object In result.Rows
|
||||
Log($"ID: ${records(result.Columns.Get("CAT_GP_ID"))}, NOM: ${records(result.Columns.Get("CAT_GP_NOMBRE"))}"$)
|
||||
Dim CAT_GP_ID As String = records(result.Columns.Get("CAT_GP_ID"))
|
||||
Dim CAT_GP_NOMBRE As String = records(result.Columns.Get("CAT_GP_NOMBRE"))
|
||||
Dim CAT_GP_PRECIO As String = records(result.Columns.Get("CAT_GP_PRECIO"))
|
||||
Dim CAT_GP_ALMACEN As String = 10000 'records(result.Columns.Get("CAT_GP_ALMACEN"))
|
||||
Dim CAT_GP_IMG() As Byte = records(result.Columns.Get("CAT_GP_IMG"))
|
||||
Dim CAT_GP_FECHA As String = records(result.Columns.Get("CAT_GP_FECHA"))
|
||||
Dim CAT_GP_FECHA_MOD As String = records(result.Columns.Get("CAT_GP_FECHA_MOD"))
|
||||
Dim CAT_GP_CLASIF As String = records(result.Columns.Get("CAT_GP_CLASIF"))
|
||||
Starter.skmt.ExecNonQuery2("INSERT INTO CAT_GUNAPROD(CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_PRECIO,CAT_GP_ALMACEN,CAT_GP_IMG,CAT_GP_FECHA,CAT_GP_FECHA_MOD, CAT_GP_CLASIF) VALUES (?,?,?,?,?,?,?,?)", Array As Object (CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_PRECIO,CAT_GP_ALMACEN,CAT_GP_IMG,CAT_GP_FECHA,CAT_GP_FECHA_MOD,CAT_GP_CLASIF))
|
||||
Next
|
||||
Starter.skmt.TransactionSuccessful 'Si no se pone TransactionSuccessful no se escribe NADA!!
|
||||
Starter.skmt.EndTransaction
|
||||
End If
|
||||
|
||||
If result.Tag = "selectMesas" Then 'query tag
|
||||
' If Starter.Logger Then Subs.logJobDoneResultados(result)
|
||||
Starter.skmt.ExecNonQuery("delete from CAT_MESAS")
|
||||
Starter.skmt.BeginTransaction
|
||||
For Each records() As Object In result.Rows
|
||||
Log($"ID: ${records(result.Columns.Get("M_ID"))}, NOM: ${records(result.Columns.Get("M_NOMBRE"))}"$)
|
||||
Dim M_ID As String = records(result.Columns.Get("M_ID"))
|
||||
Dim M_NOMBRE As String = records(result.Columns.Get("M_NOMBRE"))
|
||||
Dim M_NUMERO As String = records(result.Columns.Get("M_NUMERO"))
|
||||
Dim M_ZONA As String = records(result.Columns.Get("M_ZONA"))
|
||||
Starter.skmt.ExecNonQuery2("INSERT INTO CAT_MESAS(M_ID, M_NUMERO, M_NOMBRE, M_ZONA) VALUES (?,?,?,?)", Array As Object (M_ID, M_NUMERO, M_NOMBRE, M_ZONA))
|
||||
Next
|
||||
Starter.skmt.TransactionSuccessful 'Si no se pone TransactionSuccessful no se escribe NADA!!
|
||||
Starter.skmt.EndTransaction
|
||||
End If
|
||||
|
||||
If result.Tag = "selectMeseros" Then 'query tag
|
||||
' If Starter.Logger Then Subs.logJobDoneResultados(result)
|
||||
Starter.skmt.ExecNonQuery("delete from CAT_MESEROS")
|
||||
Starter.skmt.BeginTransaction
|
||||
For Each records() As Object In result.Rows
|
||||
Log($"ID: ${records(result.Columns.Get("MS_ID"))}, NOM: ${records(result.Columns.Get("MS_NOMBRE"))}"$)
|
||||
Dim MS_ID As String = records(result.Columns.Get("MS_ID"))
|
||||
Dim MS_NOMBRE As String = records(result.Columns.Get("MS_NOMBRE"))
|
||||
Dim MS_MESAS_ASIGNADAS As String = records(result.Columns.Get("MS_MESAS_ASIGNADAS"))
|
||||
Starter.skmt.ExecNonQuery2("INSERT INTO CAT_MESEROS(MS_ID, MS_NOMBRE, MS_MESAS_ASIGNADAS) VALUES (?,?,?)", Array As Object (MS_ID, MS_NOMBRE, MS_MESAS_ASIGNADAS))
|
||||
Next
|
||||
Starter.skmt.TransactionSuccessful 'Si no se pone TransactionSuccessful no se escribe NADA!!
|
||||
Starter.skmt.EndTransaction
|
||||
B4XPages.MainPage.principal.cb_mesero.SetItems(Subs.traeMeserosLista)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Job.Release
|
||||
End Sub
|
||||
|
||||
Private Sub b_entrar_LongClick
|
||||
Dim a As Int = "a"
|
||||
End Sub
|
||||
@@ -10,14 +10,14 @@ Sub Class_Globals
|
||||
Private p_principal As Panel
|
||||
Private WobbleMenu1 As WobbleMenu
|
||||
Dim PCLV, PCLVM As PreoptimizedCLV
|
||||
Private p_productos As Panel
|
||||
Private clv_prods_ll, clv_carrito, clv As CustomListView
|
||||
Private p_meseros As Panel
|
||||
Private clv_prods_ll, clv As CustomListView
|
||||
Dim prodsMap As Map
|
||||
Private p_botonesVenta As Panel
|
||||
' Private p_botonesVenta As Panel
|
||||
Private b_continuar As Button
|
||||
Private lfila As Label
|
||||
Private et_busca As EditText
|
||||
Private b_buscar As Button
|
||||
' Private et_busca As EditText
|
||||
' Private b_buscar As Button
|
||||
Dim etCantHasFocus, hayPedido As Boolean 'ignore
|
||||
Dim ticketId As String
|
||||
Dim rutaUsuario, folio As String 'ignore
|
||||
@@ -35,26 +35,21 @@ Sub Class_Globals
|
||||
Private i_prod As ImageView
|
||||
Private p_prods As Panel
|
||||
Private p_mesas As Panel
|
||||
' Private lv_carrito As ListView
|
||||
Private p_carrito As Panel
|
||||
Private p_botonesCarrito As Panel
|
||||
Private b_terminar As Button
|
||||
Private p_historial As Panel
|
||||
' Private p_botonesHist As Panel
|
||||
Private l_compraTerminada As Label
|
||||
Private l_carritoVacio As Label
|
||||
Private b_borrar As Button
|
||||
Private l_totalCarrito As Label
|
||||
Private l_historialVacio As Label
|
||||
Private lv_historial As ListView
|
||||
Private clv_mesas As CustomListView
|
||||
Dim clv_mesas As CustomListView
|
||||
Private l_mesaX As Label
|
||||
Private l_estatus As Label
|
||||
Private l_mesa As Label
|
||||
Private p_mesa As Panel
|
||||
Private b_abrirMesa As Button
|
||||
Private cb_comensales As B4XComboBox
|
||||
Private cb_mesero As B4XComboBox
|
||||
Dim cb_mesero As B4XComboBox
|
||||
Private l_mesero As Label
|
||||
Private l_comensales As Label
|
||||
Private l_pago As Label
|
||||
@@ -70,8 +65,18 @@ Sub Class_Globals
|
||||
Private p_pago As Panel
|
||||
Private Label1 As Label
|
||||
Private b_pagoCerrar As Button
|
||||
Dim reqManager As DBRequestManager
|
||||
Private b_cierraAdmin As Button
|
||||
Private b_cierreTotal As Button
|
||||
Private p_cierreAdmin As Panel
|
||||
Private et_inicioDia As EditText
|
||||
Private l_inicioDia As Label
|
||||
Private l_cierreAdmin As Label
|
||||
Dim p_transparenteCierreAdmin As Panel
|
||||
Private cd1 As ColorDrawable
|
||||
Private p_botonesCierre As Panel
|
||||
End Sub
|
||||
|
||||
|
||||
'You can add more parameters here.
|
||||
Public Sub Initialize As Object
|
||||
Return Me
|
||||
@@ -91,30 +96,26 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
End If
|
||||
PCLV.Initialize(Me, "PCLV", clv_prods_ll)
|
||||
PCLVM.Initialize(Me, "PCLVM", clv_mesas)
|
||||
WobbleMenu1.SetTabTextIcon(1,"Mesas", Chr(0xF0C0), Typeface.FONTAWESOME)
|
||||
WobbleMenu1.SetTabTextIcon(2,"Productos", Chr(0xF007), Typeface.FONTAWESOME)
|
||||
WobbleMenu1.SetTabTextIcon(3,"Carrito", Chr(0xF2BE), Typeface.FONTAWESOME)
|
||||
WobbleMenu1.SetTabTextIcon(4,"Historial", Chr(0xF21B), Typeface.FONTAWESOME)
|
||||
WobbleMenu1.SetTabTextIcon(1,"Mesas", Chr(0xF00A), Typeface.FONTAWESOME)
|
||||
WobbleMenu1.SetTabTextIcon(2,"Meseros", Chr(0xF0C0), Typeface.FONTAWESOME)
|
||||
WobbleMenu1.SetTabTextIcon(3,"Ordenes", Chr(0xF155), Typeface.FONTAWESOME)
|
||||
' WobbleMenu1.SetTabTextIcon(5,"Cinco", Chr(0xF29D), Typeface.FONTAWESOME)
|
||||
p_principal.Width = Root.Width
|
||||
p_principal.Height = Root.Height
|
||||
clv_prods_ll.GetBase.SetLayoutAnimated(0, 5dip, (l_meseroAbierta2.Top + l_meseroAbierta2.Height + 5), Root.Width + 10, Root.Height * 0.55) 'Cambiamos el tamaño y posición de la lista de productos.
|
||||
clv_prods_ll.Base_Resize(clv_prods_ll.GetBase.Width, clv_prods_ll.GetBase.Height) 'Cambiamos el tamaño del panel interno de la lista para que se ajuste al nuevo tamaño.
|
||||
clv_carrito.GetBase.SetLayoutAnimated(0, 5dip, 80dip, Root.Width - 20, Root.Height * 0.65) 'Cambiamos el tamaño y posición de la lista del carrito.
|
||||
clv_carrito.Base_Resize(clv_carrito.GetBase.Width, clv_carrito.GetBase.Height) 'Cambiamos el tamaño del panel interno del carrito para que se ajuste al nuevo tamaño.
|
||||
clv_mesas.GetBase.SetLayoutAnimated(0, 5dip, 80dip, Root.Width - 20, Root.Height * 0.80) 'Cambiamos el tamaño y posición de la lista de mesas.
|
||||
clv_mesas.Base_Resize(clv_mesas.GetBase.Width, clv_mesas.GetBase.Height) 'Cambiamos el tamaño del panel interno de las mesas para que se ajuste al nuevo tamaño.
|
||||
p_productos.Width = Root.Width
|
||||
p_productos.Height = Root.Height - WobbleMenu1.Height
|
||||
p_carrito.Width = Root.Width
|
||||
p_carrito.Height = Root.Height - WobbleMenu1.Height
|
||||
p_meseros.Width = Root.Width
|
||||
p_meseros.Height = Root.Height - WobbleMenu1.Height
|
||||
p_mesas.Width = Root.Width
|
||||
p_mesaAbierta.Height = Root.Height
|
||||
p_mesas.Height = Root.Height - WobbleMenu1.Height
|
||||
p_historial.Width = Root.Width
|
||||
p_historial.Height = Root.Height - WobbleMenu1.Height
|
||||
p_botonesVenta.Top = Root.Height - p_botonesVenta.Height - WobbleMenu1.Height + 10
|
||||
p_botonesCarrito.Top = Root.Height - p_botonesCarrito.Height - WobbleMenu1.Height + 10
|
||||
p_transparenteCierreAdmin.Height = Root.Height : p_transparenteCierreAdmin.Width = Root.Width
|
||||
p_transparenteCierreAdmin.Top = 0 : p_transparenteCierreAdmin.left = 0
|
||||
' p_botonesVenta.Top = Root.Height - p_botonesVenta.Height - WobbleMenu1.Height + 10
|
||||
Subs.centraPanel(p_pago, p_mesaAbierta.Width)
|
||||
Subs.centraBoton(b_abrirMesa, Root.Width)
|
||||
b_mesaCerrar.Top = clv_prods_ll.AsView.top + clv_prods_ll.AsView.Height + 15 ' - b_mesaCerrar.Height
|
||||
@@ -123,31 +124,37 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
' Subs.centraEtiqueta(l_mesero, Root.Width)
|
||||
Subs.centraPanel(p_mesaCampos, Root.Width)
|
||||
Subs.centraPanel(p_mesaAbierta, Root.Width)
|
||||
Dim ri As Cursor = Starter.skmt.ExecQuery($"select count(*) as cuantos from cat_gunaprod"$)
|
||||
ri.Position = 0
|
||||
If ri.GetString("cuantos") = "0" Then 'Si no hay productos, los descargamos
|
||||
Starter.reqManager.Initialize(Me, Starter.server)
|
||||
Dim cmd As DBCommand
|
||||
cmd.Initialize
|
||||
cmd.Name = "selectPedigree"
|
||||
cmd.Parameters = Array As Object(DateTime.Date(DateTime.Now))
|
||||
Log($"Traemos productos, ${DateTime.Date(DateTime.Now)}"$)
|
||||
Starter.reqManager.ExecuteQuery(cmd , 0, "descargaProds")
|
||||
End If
|
||||
query = "cat_gunaprod"
|
||||
lv_historial.Height = Root.Height * 0.7
|
||||
p_botonesCierre.Top = lv_historial.Top + lv_historial.Height + 20dip
|
||||
Subs.centraPanel(p_botonesCierre, p_historial.Width)
|
||||
' Dim ri As Cursor = Starter.skmt.ExecQuery($"select count(*) as cuantos from cat_gunaprod"$)
|
||||
' ri.Position = 0
|
||||
' If ri.GetString("cuantos") = "0" Then 'Si no hay productos, los descargamos
|
||||
' Starter.reqManager.Initialize(Me, Starter.server)
|
||||
' Dim cmd As DBCommand
|
||||
' cmd.Initialize
|
||||
' cmd.Name = "selectPedigree"
|
||||
' cmd.Parameters = Array As Object(DateTime.Date(DateTime.Now))
|
||||
' Log($"Traemos productos, ${DateTime.Date(DateTime.Now)}"$)
|
||||
' Starter.reqManager.ExecuteQuery(cmd , 0, "descargaProds")
|
||||
' End If
|
||||
' query = "cat_gunaprod"
|
||||
prodsMap.Initialize
|
||||
listaProds.Initialize
|
||||
listaHints.Initialize
|
||||
listaHintsM.Initialize
|
||||
p_mesas.Width = Root.Width
|
||||
' Log(p_productos.Width)
|
||||
' Log(p_meseros.Width)
|
||||
Subs.panelVisible(p_mesas, 0, 0)
|
||||
cb_comensales.SetItems(Array As String(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20))
|
||||
cb_pago.SetItems(Array As String("Efectivo", "Tarjeta"))
|
||||
cb_pago.SetItems(Array As String("Tarjeta","Efectivo"))
|
||||
cb_mesero.SetItems(Subs.traeMeserosLista)
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub B4XPage_Appear
|
||||
reqManager.Initialize(Me, Starter.DBReqServer)
|
||||
' ticketId = Subs.traeTicket
|
||||
' rutaUsuario = Subs.traeMesa
|
||||
' Log($"${clv_carrito.AsView.Width}, ${Root.Width}"$)
|
||||
@@ -184,69 +191,36 @@ Sub B4XPage_Appear
|
||||
PCLVM.pnlOverlay.Height = clv_mesas.AsView.Height
|
||||
PCLVM.pnlOverlay.Width = clv_mesas.AsView.Width
|
||||
PCLVM.B4XSeekBar1.Update
|
||||
p_productos.Height = Root.Height - WobbleMenu1.Height
|
||||
If et_busca.Text <> "" Then et_busca.Text =""
|
||||
p_meseros.Height = Root.Height - WobbleMenu1.Height
|
||||
' If et_busca.Text <> "" Then et_busca.Text =""
|
||||
If p_mesas.Visible And Subs.revisaCierreAdmin Then p_transparenteCierreAdmin.Visible = True Else p_transparenteCierreAdmin.Visible = False
|
||||
End Sub
|
||||
|
||||
Sub B4XPage_CloseRequest As ResumableSub
|
||||
' BACK key pressed
|
||||
'Return True to close, False to cancel
|
||||
Log(1)
|
||||
If p_pago.visible Then
|
||||
p_pago.Visible = False
|
||||
else If p_mesa.Visible Then
|
||||
If Subs.revisaCierreAdmin Then p_transparenteCierreAdmin.Visible = True Else p_transparenteCierreAdmin.Visible = False
|
||||
p_mesa.Visible = False
|
||||
p_mesas.Visible = True
|
||||
LlenaMesas(Null, Null)
|
||||
Else if p_carrito.Visible Then
|
||||
' p_carrito.Visible = False
|
||||
' p_mesas.Visible = True
|
||||
WobbleMenu1_Tab1Click
|
||||
WobbleMenu1.SetCurrentTab(1)
|
||||
' Else if p_carrito.Visible Then
|
||||
'' p_carrito.Visible = False
|
||||
'' p_mesas.Visible = True
|
||||
' WobbleMenu1_Tab1Click
|
||||
' WobbleMenu1.SetCurrentTab(1)
|
||||
Else
|
||||
B4XPages.ShowPage("Login")
|
||||
End If
|
||||
Return False
|
||||
End Sub
|
||||
|
||||
Sub JobDone(Job As HttpJob)
|
||||
If Starter.Logger Then LogColor("Principal - JobDone", Colors.Magenta)
|
||||
If Job.Success = False Then
|
||||
' ToastMessageShow("Error: " & Job.ErrorMessage, True)
|
||||
Else
|
||||
If Starter.Logger Then LogColor("JobDone: '" & Starter.reqManager.HandleJob(Job).tag & "' - Registros: " & Starter.reqManager.HandleJob(Job).Rows.Size, Colors.Green) 'Mod por CHV - 211110
|
||||
If Job.JobName = "DBRequest" Then
|
||||
Dim result As DBResult = Starter.reqManager.HandleJob(Job)
|
||||
If result.Tag = "descargaProds" Then 'query tag
|
||||
' If Starter.Logger Then Subs.logJobDoneResultados(result)
|
||||
Starter.skmt.BeginTransaction
|
||||
For Each records() As Object In result.Rows
|
||||
Log($"ID: ${records(result.Columns.Get("CAT_GP_ID"))}, NOM: ${records(result.Columns.Get("CAT_GP_NOMBRE"))}"$)
|
||||
Dim CAT_GP_ID As String = records(result.Columns.Get("CAT_GP_ID"))
|
||||
Dim CAT_GP_NOMBRE As String = records(result.Columns.Get("CAT_GP_NOMBRE"))
|
||||
Dim CAT_GP_PRECIO As String = records(result.Columns.Get("CAT_GP_PRECIO"))
|
||||
Dim CAT_GP_ALMACEN As String = records(result.Columns.Get("CAT_GP_ALMACEN"))
|
||||
Dim CAT_PT_DESC As String = records(result.Columns.Get("CAT_PT_DESC"))
|
||||
Dim CAT_PS_DESC As String = records(result.Columns.Get("CAT_PS_DESC"))
|
||||
Dim CAT_GP_IMG() As Byte = records(result.Columns.Get("CAT_GP_IMG"))
|
||||
Dim CAT_GP_FECHA As String = records(result.Columns.Get("CAT_GP_FECHA"))
|
||||
Dim CAT_GP_FECHA_MOD As String = records(result.Columns.Get("CAT_GP_FECHA_MOD"))
|
||||
Dim CAT_GP_CLASIF As String = records(result.Columns.Get("CAT_GP_CLASIF"))
|
||||
Starter.skmt.ExecNonQuery2("INSERT INTO CAT_GUNAPROD(CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_PRECIO,CAT_GP_ALMACEN,CAT_PT_DESC,CAT_PS_DESC,CAT_GP_IMG,CAT_GP_FECHA,CAT_GP_FECHA_MOD, CAT_GP_CLASIF) VALUES (?,?,?,?,?,?,?,?,?,?)", Array As Object (CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_PRECIO,CAT_GP_ALMACEN,CAT_PT_DESC,CAT_PS_DESC,CAT_GP_IMG,CAT_GP_FECHA,CAT_GP_FECHA_MOD,CAT_GP_CLASIF))
|
||||
Next
|
||||
' Starter.skmt.ExecNonQuery2("INSERT INTO kmt_info(CAT_CL_CODIGO,CAT_CL_RUTA,CAT_CL_NOMBRE,CAT_CL_ATIENDE1,CAT_CL_ATIENTE2,CAT_CL_TELEFONO,CAT_CL_EMAIL,CAT_CL_CALLE,CAT_CL_NOEXT,CAT_CL_NOINT,CAT_CL_CALLE1,CAT_CL_CALLE2,CAT_CL_COLONIA,CAT_CL_MUNI,CAT_CL_EDO,CAT_CL_CP,CAT_CL_LONG,CAT_CL_LAT,CAT_CL_BFACTURA,CAT_CL_BCREDITO,CAT_CL_MTOCOMPRA,CAT_CL_NUM_SERIEFISICO,CAT_CL_DIAS_VISITA, gestion, IMPRESION) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,0,0,0,?,0,0) ",Array As Object ("0",e_ruta.TEXT, "VENTA ABORDO","null","null","null","null","null","null","null","null","null","null","null","null","NULL","null","null","NULL","NULL"))
|
||||
Starter.skmt.TransactionSuccessful 'Si no se pone TransactionSuccessful no se escribe NADA!!
|
||||
Starter.skmt.EndTransaction
|
||||
' LlenaProdsLL(Null, Null)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Job.Release
|
||||
End Sub
|
||||
|
||||
Sub b_prodMenos_Click
|
||||
etCantHasFocus = False
|
||||
If WobbleMenu1.GetCurrentTab = 3 Then clv = clv_carrito Else clv = clv_prods_ll
|
||||
' If WobbleMenu1.GetCurrentTab = 3 Then clv = clv_carrito Else clv = clv_prods_ll
|
||||
clv = clv_prods_ll
|
||||
' Log(Sender.As(Button).text & "|" & Sender.As(Button).tag)
|
||||
Private buttonTag As String = Sender.As(Button).tag
|
||||
LogColor("b_prodMenos_Click", Colors.Magenta)
|
||||
@@ -256,7 +230,7 @@ Sub b_prodMenos_Click
|
||||
Dim pnl0 As B4XView = clv.GetPanel(index)
|
||||
Log(pnl0.As(Panel))
|
||||
Dim pnl As B4XView = pnl0.GetView(0)
|
||||
Dim laCant As B4XView = pnl.GetView(2).GetView(2)
|
||||
Dim laCant As B4XView = pnl.GetView(2).GetView(4) 'et_pCant
|
||||
' Log(pnl.GetView(0).NumberOfViews)
|
||||
Dim elNombre As B4XView = pnl.GetView(1)
|
||||
If WobbleMenu1.GetCurrentTab = 3 Then laCant = pnl.GetView(2).GetView(4)
|
||||
@@ -299,13 +273,14 @@ End Sub
|
||||
|
||||
Sub b_prodMas_Click
|
||||
etCantHasFocus = False
|
||||
If WobbleMenu1.GetCurrentTab = 3 Then clv = clv_carrito Else clv = clv_prods_ll
|
||||
' If WobbleMenu1.GetCurrentTab = 3 Then clv = clv_carrito Else clv = clv_prods_ll
|
||||
clv = clv_prods_ll
|
||||
Private buttonTag As String = Sender.As(Button).tag
|
||||
Dim index As Int = clv.GetItemFromView(Sender)
|
||||
LogColor("b_prodMas_Click", Colors.Magenta)
|
||||
Dim pnl0 As B4XView = clv.GetPanel(index)
|
||||
Dim pnl As B4XView = pnl0.GetView(0)
|
||||
Dim laCant As B4XView = pnl.GetView(2).GetView(2)
|
||||
Dim laCant As B4XView = pnl.GetView(2).GetView(4) 'et_pCant
|
||||
Dim elNombre As B4XView = pnl.GetView(1)
|
||||
If WobbleMenu1.GetCurrentTab = 3 Then laCant = pnl.GetView(2).GetView(4)
|
||||
Log($"${pnl.GetView(2).GetView(1)}${CRLF}${pnl.GetView(2).GetView(2)}${CRLF}${pnl.GetView(2).GetView(3)}${CRLF}${pnl.GetView(2).GetView(4)}"$)
|
||||
@@ -322,7 +297,7 @@ Sub b_prodMas_Click
|
||||
laCant.Text = $"$1.0{laCant.Text+1}"$
|
||||
' Log(clv.GetValue(index).As(Map))
|
||||
End If
|
||||
else If laCant.Text + 1 <= inv And lfila.Text = "PRODUCTOS" Then
|
||||
else If laCant.Text + 1 <= inv Then
|
||||
' LogColor(inv, Colors.blue)
|
||||
laCant.Text = $"$1.0{laCant.Text + 1}"$
|
||||
Log(Subs.totalPedido)
|
||||
@@ -350,8 +325,8 @@ Sub cuentaProds
|
||||
Private c As Cursor = Starter.skmt.ExecQuery($"select sum(PE_COSTO_TOT) as total, sum(PE_CANT) as cant from PEDIDO where PE_TICKET IN (Select cuenta from cuentaa)"$)
|
||||
' LogColor("TIEMPO cuentaProds =" & ((DateTime.Now-inicioContador)/1000), Colors.Red)
|
||||
' LogColor(prodsMap, Colors.Magenta)
|
||||
p_botonesVenta.Visible = True
|
||||
p_botonesVenta.BringToFront
|
||||
' p_botonesVenta.Visible = True
|
||||
' p_botonesVenta.BringToFront
|
||||
c.Position=0
|
||||
' Log(Subs.totalPedido)
|
||||
Private cant0 As String = "0"
|
||||
@@ -360,11 +335,13 @@ Sub cuentaProds
|
||||
If c.GetString("cant") <> Null And c.GetString("cant") <> "null" Then cant0 = c.GetString("cant")
|
||||
If c.GetString("total") <> Null And c.GetString("total") <> "null" Then total0 = c.GetString("total")
|
||||
|
||||
Private p As Cursor = Starter.skmt.ExecQuery("select count(PT_TICKET) as ordenes from PEDIDO_TICKET where PT_PAGO <> 'VENTA'")
|
||||
p.Position = 0
|
||||
' Log($"Total Prods: ${cant0}, Total Compra: $$1.2{total0}"$)
|
||||
l_totalCarrito.text = $"Total: $${NumberFormat2(total0,1,2,2,True)}"$
|
||||
' l_totalCarrito.text = $"Total: $${NumberFormat2(total0,1,2,2,True)}"$
|
||||
c.Close
|
||||
If WobbleMenu1.GetCurrentTab = 3 Then LlenaProdsLL(Null, Null)
|
||||
If Subs.hayPedido Then WobbleMenu1.SetBadge(3, 1, Colors.white, Colors.red) Else WobbleMenu1.RemoveBadge(3)
|
||||
If Subs.hayPedido Then WobbleMenu1.SetBadge(3, p.GetString("ordenes"), Colors.white, Colors.red) Else WobbleMenu1.RemoveBadge(3)
|
||||
End Sub
|
||||
|
||||
Sub LlenaProdsLL(p As ResultSet, extra As String)
|
||||
@@ -516,99 +493,99 @@ Private Sub clv_prods_ll_VisibleRangeChanged (FirstIndex As Int, LastIndex As In
|
||||
End Sub
|
||||
|
||||
Sub et_busca_TextChanged (Old As String, New As String)
|
||||
' Private inicioContador As String = DateTime.Now
|
||||
If New.Length = 1 And Not(forzarBusqueda) Then Return
|
||||
forzarBusqueda = False
|
||||
If lfila.text = "PROMOCIONES" Then
|
||||
' If Not(lv_promos.Visible) Then lv_promos.Visible = True
|
||||
' Private cPromo As Cursor=Starter.skmt.ExecQuery($"select CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_PRECIO, CAT_GP_ALMACEN, CAT_GP_IMG from ${query} where CAT_GP_NOMBRE like '%${New}%' and CAT_GP_ALMACEN > 0 AND CAT_GP_TIPO = 'PROMOS' AND CAT_GP_SUBTIPO = 'PROMOS' AND CAT_GP_TIPOPROD <> 1 and (length(CAT_GP_CODPROMO) = 1 OR CAT_GP_CODPROMO = CAT_GP_ID)"$)
|
||||
' Log($"res:${cPromo.RowCount}"$)
|
||||
' If cPromo.RowCount > 0 Then
|
||||
' lv_promos.Clear
|
||||
' For i=0 To cPromo.RowCount -1
|
||||
' cPromo.Position=i
|
||||
' Private tm As Map = Subs.procesaPromocion(cPromo.GetString("CAT_GP_ID"), ticketId)
|
||||
' If tm.Get("status") = "ok" Then 'Solo muestrala si hay producto.
|
||||
' lv_promos.AddTwoLines(cPromo.GetString("CAT_GP_NOMBRE"),"# " & cPromo.GetString("CAT_GP_ALMACEN") & " $ " & cPromo.GetString("CAT_GP_PRECIO") & " F:" & tm.Get("mp").As(Map).Get("prodsFijosCant") & " V:" & tm.Get("mp").As(Map).Get("prodsVariablesCant"))
|
||||
' End If
|
||||
' Next
|
||||
' Else
|
||||
' ToastMessageShow("No hay promociones disponibles.", False)
|
||||
' End If
|
||||
' cPromo.Close
|
||||
Else
|
||||
If Not(clv_prods_ll.AsView.Visible) Then clv_prods_ll.AsView.Visible = True
|
||||
clv_prods_ll.Clear
|
||||
listaProds.Initialize
|
||||
listaHints.Initialize
|
||||
Sleep(0)
|
||||
Dim p As ResultSet = Starter.skmt.ExecQuery($"Select CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_ALMACEN, CAT_GP_PRECIO, CAT_GP_TIPOPROD, CAT_GP_IMG from cat_gunaprod where CAT_GP_NOMBRE like '%${New}%' and CAT_GP_PRECIO > 0 And CAT_GP_CLASIF <> 'PROMOS' order by CAT_GP_NOMBRE"$)
|
||||
Log($"Llamamos LlenaProdsLL con ${p.RowCount} registros"$)
|
||||
LlenaProdsLL(p, Null)
|
||||
p.Close
|
||||
End If
|
||||
'' Private inicioContador As String = DateTime.Now
|
||||
' If New.Length = 1 And Not(forzarBusqueda) Then Return
|
||||
' forzarBusqueda = False
|
||||
' If lfila.text = "PROMOCIONES" Then
|
||||
'' If Not(lv_promos.Visible) Then lv_promos.Visible = True
|
||||
'' Private cPromo As Cursor=Starter.skmt.ExecQuery($"select CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_PRECIO, CAT_GP_ALMACEN, CAT_GP_IMG from ${query} where CAT_GP_NOMBRE like '%${New}%' and CAT_GP_ALMACEN > 0 AND CAT_GP_TIPO = 'PROMOS' AND CAT_GP_SUBTIPO = 'PROMOS' AND CAT_GP_TIPOPROD <> 1 and (length(CAT_GP_CODPROMO) = 1 OR CAT_GP_CODPROMO = CAT_GP_ID)"$)
|
||||
'' Log($"res:${cPromo.RowCount}"$)
|
||||
'' If cPromo.RowCount > 0 Then
|
||||
'' lv_promos.Clear
|
||||
'' For i=0 To cPromo.RowCount -1
|
||||
'' cPromo.Position=i
|
||||
'' Private tm As Map = Subs.procesaPromocion(cPromo.GetString("CAT_GP_ID"), ticketId)
|
||||
'' If tm.Get("status") = "ok" Then 'Solo muestrala si hay producto.
|
||||
'' lv_promos.AddTwoLines(cPromo.GetString("CAT_GP_NOMBRE"),"# " & cPromo.GetString("CAT_GP_ALMACEN") & " $ " & cPromo.GetString("CAT_GP_PRECIO") & " F:" & tm.Get("mp").As(Map).Get("prodsFijosCant") & " V:" & tm.Get("mp").As(Map).Get("prodsVariablesCant"))
|
||||
'' End If
|
||||
'' Next
|
||||
'' Else
|
||||
'' ToastMessageShow("No hay promociones disponibles.", False)
|
||||
'' End If
|
||||
'' cPromo.Close
|
||||
' Else
|
||||
' If Not(clv_prods_ll.AsView.Visible) Then clv_prods_ll.AsView.Visible = True
|
||||
' clv_prods_ll.Clear
|
||||
' listaProds.Initialize
|
||||
' listaHints.Initialize
|
||||
' Sleep(0)
|
||||
' Dim p As ResultSet = Starter.skmt.ExecQuery($"Select CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_ALMACEN, CAT_GP_PRECIO, CAT_GP_TIPOPROD, CAT_GP_IMG from cat_gunaprod where CAT_GP_NOMBRE like '%${New}%' and CAT_GP_PRECIO > 0 And CAT_GP_CLASIF <> 'PROMOS' order by CAT_GP_NOMBRE"$)
|
||||
' Log($"Llamamos LlenaProdsLL con ${p.RowCount} registros"$)
|
||||
' LlenaProdsLL(p, Null)
|
||||
' p.Close
|
||||
' End If
|
||||
End Sub
|
||||
|
||||
Sub llenaCarrito 'ignore
|
||||
Private totalPedido As String = 0
|
||||
Private cantPedido As String = 0
|
||||
p_mesas.Visible = False
|
||||
' Subs.agrupador
|
||||
' lv_carrito.Clear
|
||||
clv_carrito.Clear
|
||||
list_prodsPedido.Initialize
|
||||
Private c_prods As Cursor=Starter.skmt.ExecQuery("select PE_PRONOMBRE,PE_COSTO_TOT, PE_COSTOU, PE_CANT, PE_FOLIO, PE_CEDIS, PE_PROID FROM PEDIDO WHERE PE_TICKET IN (Select CUENTA from cuentaa) order by PE_CEDIS, PE_PRONOMBRE")
|
||||
' Log(c_prods.RowCount)
|
||||
If c_prods.RowCount > 0 Then
|
||||
c_prods.Position = 0
|
||||
' lv_carrito.BringToFront
|
||||
clv_carrito.AsView.BringToFront
|
||||
Private cs As CSBuilder
|
||||
For i = 0 To c_prods.RowCount -1
|
||||
cs.Initialize
|
||||
c_prods.Position = i
|
||||
' Dim label1 As Label
|
||||
' lv_carrito.TwoLinesLayout.ItemHeight = 50dip
|
||||
' label1 = lv_carrito.TwoLinesLayout.Label
|
||||
' label1.TextSize = 15
|
||||
' label1.TextColor = Colors.Black
|
||||
' label1.color = Colors.White
|
||||
' label1.Height = 30dip
|
||||
Private textColor As Int = Colors.black 'ignore
|
||||
' Log(c_prods.GetString("PE_CEDIS"))
|
||||
If Not(IsNumber(c_prods.GetString("PE_CEDIS"))) Then textColor = Colors.RGB(210,105,30) 'Si es promo, cambiamos el color del texto.
|
||||
If c_prods.GetString("PE_CEDIS") = "DUR" Then textColor = Colors.red 'Si es promo, cambiamos el color del texto.
|
||||
' Dim label2 As Label
|
||||
' label2 = lv_carrito.TwoLinesLayout.SecondLabel
|
||||
' label2.TextSize = 10
|
||||
' label2.TextColor = Colors.Blue
|
||||
' label2.Tag = i
|
||||
' Log(c_prods.GetString("PE_PRONOMBRE"))
|
||||
' lv_carrito.AddTwoLines(cs.Color(textColor).append(c_prods.GetString("PE_PRONOMBRE")).pop,"Cantidad #"& c_prods.GetString("PE_CANT")& " SubTotal $"& c_prods.GetString("PE_COSTO_TOT")& " Folio "& c_prods.GetString("PE_FOLIO"))
|
||||
Private tempMap As Map = CreateMap("prod":c_prods.GetString("PE_PRONOMBRE"), "almacen":1000, "id": c_prods.GetString("PE_PROID"), "cant": c_prods.GetString("PE_CANT"), "precio": c_prods.GetString("PE_COSTOU"), "precioT": c_prods.GetString("PE_COSTO_TOT"))
|
||||
list_prodsPedido.Add(tempMap)
|
||||
' Private bmp As Bitmap = Subs.traeImgDeDB(c_prods.GetString("PE_PROID"))
|
||||
' Private elTexto As String = cs.Color(Colors.red).append(c_prods.GetString("PE_PRONOMBRE")).pop.append(CRLF).Color(0xFF017F01).Append($"Precio $${NumberFormat2(c_prods.GetString("PE_COSTO_TOT"), 1, 2, 2, True)}"$).Popall
|
||||
clv_carrito.Add(CreateListItem(c_prods.GetString("PE_PRONOMBRE"), c_prods.GetString("PE_CANT"), c_prods.GetString("PE_COSTO_TOT"), 1000, clv_carrito.AsView.Width, 150dip, Null, c_prods.GetString("PE_PROID")), tempMap)
|
||||
folio = 0
|
||||
totalPedido = totalPedido + (c_prods.GetString("PE_COSTOU") * c_prods.GetString("PE_CANT"))
|
||||
cantPedido = cantPedido + c_prods.GetString("PE_CANT")
|
||||
If c_prods.GetString("PE_FOLIO") <> Null Then folio = c_prods.GetString("PE_FOLIO")
|
||||
Next
|
||||
Else
|
||||
l_carritoVacio.Visible = True
|
||||
l_carritoVacio.Text = "No hay productos en tu carrito."
|
||||
End If
|
||||
' Log(list_prodsPedido)
|
||||
c_prods.Close
|
||||
' l_total2.Text = $"$1.2{totalPedido}"$
|
||||
' l_cant.Text = cantPedido
|
||||
' If Subs.revisaImpresa Then b_rechazar.Visible = False Else b_rechazar.Visible = True
|
||||
' p_vistaPreviaTrans.Width = Root.Width
|
||||
' p_vistaPreviaTrans.Height = Root.Height
|
||||
' Subs.centraPanel(p_vistaPrevia, Root.Width)
|
||||
' p_vistaPrevia.Visible=True
|
||||
' p_vistaPreviaTrans.Visible=True
|
||||
' Private totalPedido As String = 0
|
||||
' Private cantPedido As String = 0
|
||||
' p_mesas.Visible = False
|
||||
'' Subs.agrupador
|
||||
'' lv_carrito.Clear
|
||||
' clv_carrito.Clear
|
||||
' list_prodsPedido.Initialize
|
||||
' Private c_prods As Cursor=Starter.skmt.ExecQuery("select PE_PRONOMBRE,PE_COSTO_TOT, PE_COSTOU, PE_CANT, PE_FOLIO, PE_CEDIS, PE_PROID FROM PEDIDO WHERE PE_TICKET IN (Select CUENTA from cuentaa) order by PE_CEDIS, PE_PRONOMBRE")
|
||||
'' Log(c_prods.RowCount)
|
||||
' If c_prods.RowCount > 0 Then
|
||||
' c_prods.Position = 0
|
||||
'' lv_carrito.BringToFront
|
||||
' clv_carrito.AsView.BringToFront
|
||||
' Private cs As CSBuilder
|
||||
' For i = 0 To c_prods.RowCount -1
|
||||
' cs.Initialize
|
||||
' c_prods.Position = i
|
||||
'' Dim label1 As Label
|
||||
'' lv_carrito.TwoLinesLayout.ItemHeight = 50dip
|
||||
'' label1 = lv_carrito.TwoLinesLayout.Label
|
||||
'' label1.TextSize = 15
|
||||
'' label1.TextColor = Colors.Black
|
||||
'' label1.color = Colors.White
|
||||
'' label1.Height = 30dip
|
||||
' Private textColor As Int = Colors.black 'ignore
|
||||
'' Log(c_prods.GetString("PE_CEDIS"))
|
||||
' If Not(IsNumber(c_prods.GetString("PE_CEDIS"))) Then textColor = Colors.RGB(210,105,30) 'Si es promo, cambiamos el color del texto.
|
||||
' If c_prods.GetString("PE_CEDIS") = "DUR" Then textColor = Colors.red 'Si es promo, cambiamos el color del texto.
|
||||
'' Dim label2 As Label
|
||||
'' label2 = lv_carrito.TwoLinesLayout.SecondLabel
|
||||
'' label2.TextSize = 10
|
||||
'' label2.TextColor = Colors.Blue
|
||||
'' label2.Tag = i
|
||||
'' Log(c_prods.GetString("PE_PRONOMBRE"))
|
||||
'' lv_carrito.AddTwoLines(cs.Color(textColor).append(c_prods.GetString("PE_PRONOMBRE")).pop,"Cantidad #"& c_prods.GetString("PE_CANT")& " SubTotal $"& c_prods.GetString("PE_COSTO_TOT")& " Folio "& c_prods.GetString("PE_FOLIO"))
|
||||
' Private tempMap As Map = CreateMap("prod":c_prods.GetString("PE_PRONOMBRE"), "almacen":1000, "id": c_prods.GetString("PE_PROID"), "cant": c_prods.GetString("PE_CANT"), "precio": c_prods.GetString("PE_COSTOU"), "precioT": c_prods.GetString("PE_COSTO_TOT"))
|
||||
' list_prodsPedido.Add(tempMap)
|
||||
'' Private bmp As Bitmap = Subs.traeImgDeDB(c_prods.GetString("PE_PROID"))
|
||||
'' Private elTexto As String = cs.Color(Colors.red).append(c_prods.GetString("PE_PRONOMBRE")).pop.append(CRLF).Color(0xFF017F01).Append($"Precio $${NumberFormat2(c_prods.GetString("PE_COSTO_TOT"), 1, 2, 2, True)}"$).Popall
|
||||
' clv_carrito.Add(CreateListItem(c_prods.GetString("PE_PRONOMBRE"), c_prods.GetString("PE_CANT"), c_prods.GetString("PE_COSTO_TOT"), 1000, clv_carrito.AsView.Width, 150dip, Null, c_prods.GetString("PE_PROID")), tempMap)
|
||||
' folio = 0
|
||||
' totalPedido = totalPedido + (c_prods.GetString("PE_COSTOU") * c_prods.GetString("PE_CANT"))
|
||||
' cantPedido = cantPedido + c_prods.GetString("PE_CANT")
|
||||
' If c_prods.GetString("PE_FOLIO") <> Null Then folio = c_prods.GetString("PE_FOLIO")
|
||||
' Next
|
||||
' Else
|
||||
' l_carritoVacio.Visible = True
|
||||
' l_carritoVacio.Text = "No hay productos en tu carrito."
|
||||
' End If
|
||||
'' Log(list_prodsPedido)
|
||||
' c_prods.Close
|
||||
'' l_total2.Text = $"$1.2{totalPedido}"$
|
||||
'' l_cant.Text = cantPedido
|
||||
'' If Subs.revisaImpresa Then b_rechazar.Visible = False Else b_rechazar.Visible = True
|
||||
'' p_vistaPreviaTrans.Width = Root.Width
|
||||
'' p_vistaPreviaTrans.Height = Root.Height
|
||||
'' Subs.centraPanel(p_vistaPrevia, Root.Width)
|
||||
'' p_vistaPrevia.Visible=True
|
||||
'' p_vistaPreviaTrans.Visible=True
|
||||
End Sub
|
||||
|
||||
'Return the hint that will be displayed when the user fast scrolls the list. It can be a string or CSBuilder.
|
||||
@@ -625,13 +602,14 @@ End Sub
|
||||
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
||||
|
||||
Private Sub WobbleMenu1_Tab1Click
|
||||
If Subs.revisaCierreAdmin Then p_transparenteCierreAdmin.Visible = True Else p_transparenteCierreAdmin.Visible = False
|
||||
LlenaMesas(Null, Null)
|
||||
' LlenaProdsLL(Null, Null)
|
||||
Subs.panelVisible(p_mesas, 0, 0)
|
||||
PCLVM.B4XSeekBar1.mBase.Visible = True
|
||||
PCLV.B4XSeekBar1.mBase.Visible = False
|
||||
p_productos.Visible = False
|
||||
p_carrito.Visible = False
|
||||
p_meseros.Visible = False
|
||||
' p_carrito.Visible = False
|
||||
p_historial.Visible = False
|
||||
p_mesa.Visible = False
|
||||
End Sub
|
||||
@@ -641,45 +619,54 @@ Private Sub WobbleMenu1_Tab2Click
|
||||
PCLVM.B4XSeekBar1.mBase.Visible = False
|
||||
PCLV.B4XSeekBar1.mBase.BringToFront
|
||||
PCLV.B4XSeekBar1.mBase.Visible = True
|
||||
Subs.panelVisible(p_productos, 0, 0)
|
||||
Subs.panelVisible(p_meseros, 0, 0)
|
||||
p_mesas.Visible = False
|
||||
p_carrito.Visible = False
|
||||
' p_carrito.Visible = False
|
||||
p_transparenteCierreAdmin.Visible = False
|
||||
p_historial.Visible = False
|
||||
p_mesa.Visible = False
|
||||
End Sub
|
||||
|
||||
Private Sub WobbleMenu1_Tab3Click
|
||||
PCLVM.B4XSeekBar1.mBase.Visible = False
|
||||
PCLV.B4XSeekBar1.mBase.Visible = False
|
||||
Subs.panelVisible(p_carrito, 0, 0)
|
||||
p_carrito.BringToFront
|
||||
' p_carrito.BringToFront
|
||||
p_productos.Visible = False
|
||||
p_mesas.Visible = False
|
||||
p_historial.Visible = False
|
||||
l_carritoVacio.Visible = False
|
||||
l_compraTerminada.Visible = False
|
||||
p_mesa.Visible = False
|
||||
llenaCarrito
|
||||
If clv_carrito.Size > 0 Then p_botonesCarrito.Visible = True Else p_botonesCarrito.Visible = False
|
||||
End Sub
|
||||
|
||||
Private Sub WobbleMenu1_Tab4Click
|
||||
Subs.panelVisible(p_historial, 0, 0)
|
||||
p_productos.Visible = False
|
||||
p_carrito.Visible = False
|
||||
p_meseros.Visible = False
|
||||
' p_carrito.Visible = False
|
||||
p_mesas.Visible = False
|
||||
p_mesa.Visible = False
|
||||
p_transparenteCierreAdmin.Visible = False
|
||||
If Subs.revisaCierreAdmin Then
|
||||
cd1.Initialize(Colors.gray, 10dip)
|
||||
b_cierraAdmin.Background = cd1
|
||||
Else
|
||||
cd1.Initialize(Colors.red, 10dip)
|
||||
b_cierraAdmin.Background = cd1
|
||||
End If
|
||||
llenaHistorial
|
||||
End Sub
|
||||
|
||||
'Private Sub WobbleMenu1_Tab4Click
|
||||
' PCLVM.B4XSeekBar1.mBase.Visible = False
|
||||
' PCLV.B4XSeekBar1.mBase.Visible = False
|
||||
' Subs.panelVisible(p_carrito, 0, 0)
|
||||
' p_carrito.BringToFront
|
||||
'' p_carrito.BringToFront
|
||||
' p_meseros.Visible = False
|
||||
' p_mesas.Visible = False
|
||||
' p_historial.Visible = False
|
||||
' l_carritoVacio.Visible = False
|
||||
' l_compraTerminada.Visible = False
|
||||
' p_mesa.Visible = False
|
||||
' llenaCarrito
|
||||
' If clv_carrito.Size > 0 Then p_botonesCarrito.Visible = True Else p_botonesCarrito.Visible = False
|
||||
'End Sub
|
||||
|
||||
Private Sub b_continuar_Click
|
||||
WobbleMenu1.SetCurrentTab(2)
|
||||
End Sub
|
||||
|
||||
Private Sub p_botonesVenta_Click
|
||||
|
||||
End Sub
|
||||
'Private Sub p_botonesVenta_Click
|
||||
'
|
||||
'End Sub
|
||||
|
||||
Private Sub lv_promos_ItemClick (Position As Int, Value As Object)
|
||||
|
||||
@@ -697,10 +684,10 @@ Private Sub p_carrito_Click
|
||||
'Para evitar que el clic en pantalla no se siga hacia atras
|
||||
End Sub
|
||||
|
||||
Private Sub b_buscar_Click
|
||||
forzarBusqueda = True
|
||||
et_busca_TextChanged("",et_busca.Text)
|
||||
End Sub
|
||||
'Private Sub b_buscar_Click
|
||||
' forzarBusqueda = True
|
||||
' et_busca_TextChanged("",et_busca.Text)
|
||||
'End Sub
|
||||
|
||||
Private Sub b_terminar_Click
|
||||
DateTime.DateFormat= $"yyMMdd-HHmmss-${Starter.ticketActual}"$
|
||||
@@ -708,22 +695,25 @@ Private Sub b_terminar_Click
|
||||
Starter.skmt.ExecNonQuery($"insert into cat_hist_compras (H_IDCOMPRA, H_FOLIO, H_MESA, H_CEDIS, H_COSTO_TOT, H_COSTOU, H_CANT, H_PRONOMBRE, H_PROID, H_TICKET, H_FECHA) select '${id}', PE_FOLIO, PE_MESA, PE_CEDIS, PE_COSTO_TOT, PE_COSTOU, PE_CANT, PE_PRONOMBRE, PE_PROID, PE_TICKET, PE_FECHA from pedido where PE_TICKET = '${Starter.ticketActual}'"$)
|
||||
Starter.skmt.ExecNonQuery($"delete from pedido where PE_TICKET = '${Starter.ticketActual}'"$)
|
||||
' lv_carrito.Clear
|
||||
clv_carrito.Clear
|
||||
' clv_carrito.Clear
|
||||
' et_busca_TextChanged("", et_busca.Text)
|
||||
LlenaProdsLL(Null, Null)
|
||||
l_compraTerminada.Text = $"¡Felicidades!${CRLF}${CRLF}Tu compra con número de orden ${id} ha sido registrada.${CRLF}${CRLF}Llegará en tu siguiente día de entrega."$
|
||||
l_compraTerminada.Visible = True
|
||||
l_compraTerminada.BringToFront
|
||||
l_totalCarrito.Text = ""
|
||||
' l_totalCarrito.Text = ""
|
||||
End Sub
|
||||
|
||||
Sub llenaHistorial
|
||||
Dim rs_hist As ResultSet = Starter.skmt.ExecQuery($"Select h_idcompra, sum(h_costo_tot) as total, sum(h_cant) as cantidad, h_fecha from cat_hist_compras group by h_idcompra"$)
|
||||
Dim rs_hist As ResultSet = Starter.skmt.ExecQuery($"Select * from pedido_ticket where PT_PAGO <> 'VENTA' order by PT_PAGO, PT_TICKET"$)
|
||||
If rs_hist.RowCount > 0 Then
|
||||
' c_prods.Position = 0
|
||||
' l_total2.Text = c_prods.GetString("PE_COSTO_TOT")
|
||||
' lv_historial.BringToFront
|
||||
' c_prods.Position = 0
|
||||
' l_total2.Text = c_prods.GetString("PE_COSTO_TOT")
|
||||
' lv_historial.BringToFront
|
||||
l_historialVacio.Visible = False
|
||||
Private cs As CSBuilder
|
||||
lv_historial.Clear
|
||||
lv_historial.Visible = True
|
||||
Do While rs_hist.NextRow
|
||||
' Private rs_do As ResultSet = Starter.skmt.ExecQuery($"select * from CAT_HIST_COMPRAS where H_IDCOMPRA = '${rs_hist.GetString("H_IDCOMPRA")}'"$)
|
||||
cs.Initialize
|
||||
@@ -731,7 +721,9 @@ Sub llenaHistorial
|
||||
' lv_historial.TwoLinesLayout.ItemHeight = 50dip
|
||||
Label1 = lv_historial.TwoLinesLayout.Label
|
||||
Label1.TextSize = 16
|
||||
Label1.TextColor = Colors.red
|
||||
' Label1.TextColor = Colors.red
|
||||
Private elColor As Int = Colors.Red
|
||||
If rs_hist.GetString("PT_PAGO") = "TARJETA" Then elColor = Colors.RGB(0,0,122)
|
||||
Label1.color = Colors.White
|
||||
Label1.Height = 30dip
|
||||
' Private textColor As Int = Colors.black
|
||||
@@ -742,9 +734,9 @@ Sub llenaHistorial
|
||||
' Do While rs_do.NextRow
|
||||
' Log($"${rs_do.GetString("H_IDCOMPRA")}, ${rs_do.GetString("H_PRONOMBRE")}, ${rs_do.GetString("H_CANT")}"$)
|
||||
' Loop
|
||||
Private fecha As String = rs_hist.GetString("H_FECHA")
|
||||
Private fecha As String = rs_hist.GetString("PT_FECHA")
|
||||
fecha = fecha.SubString2(1,10)
|
||||
lv_historial.AddTwoLines("Orden: " & rs_hist.GetString("H_IDCOMPRA"), $"Fecha: ${fecha}, Productos: ${rs_hist.GetString("cantidad")}, Total: $${NumberFormat2(rs_hist.GetString("total"), 1, 2, 2, True)}"$)
|
||||
lv_historial.AddTwoLines(cs.Color(elColor).Append("Orden: " & rs_hist.GetString("PT_TICKET") & " - Mesa: " & rs_hist.GetString("PT_MESA")).PopAll, $"Fecha: ${fecha}, Productos: ${rs_hist.GetString("PT_NOART")}, Total: $${NumberFormat2(rs_hist.GetString("PT_MONTO"), 1, 2, 2, True)}"$)
|
||||
' totalPedido = totalPedido + (rs_hist.GetString("PE_COSTOU") * rs_hist.GetString("PE_CANT"))
|
||||
' cantPedido = cantPedido + rs_hist.GetString("PE_CANT")
|
||||
Loop
|
||||
@@ -753,60 +745,103 @@ Sub llenaHistorial
|
||||
'' l_cant.Text = c.GetString("PC_NOART")
|
||||
' c.Close
|
||||
Else
|
||||
lv_historial.Visible = False
|
||||
l_historialVacio.Visible = True
|
||||
l_historialVacio.Text = "No hay ordenes en tu historial."
|
||||
End If
|
||||
rs_hist.Close
|
||||
End Sub
|
||||
|
||||
Sub llenaHistorial_old
|
||||
' Dim rs_hist As ResultSet = Starter.skmt.ExecQuery($"Select h_idcompra, sum(h_costo_tot) as total, sum(h_cant) as cantidad, h_fecha from cat_hist_compras group by h_idcompra"$)
|
||||
' If rs_hist.RowCount > 0 Then
|
||||
'' c_prods.Position = 0
|
||||
'' l_total2.Text = c_prods.GetString("PE_COSTO_TOT")
|
||||
'' lv_historial.BringToFront
|
||||
' Private cs As CSBuilder
|
||||
' Do While rs_hist.NextRow
|
||||
'' Private rs_do As ResultSet = Starter.skmt.ExecQuery($"select * from CAT_HIST_COMPRAS where H_IDCOMPRA = '${rs_hist.GetString("H_IDCOMPRA")}'"$)
|
||||
' cs.Initialize
|
||||
' Dim Label1 As Label
|
||||
'' lv_historial.TwoLinesLayout.ItemHeight = 50dip
|
||||
' Label1 = lv_historial.TwoLinesLayout.Label
|
||||
' Label1.TextSize = 16
|
||||
' Label1.TextColor = Colors.red
|
||||
' Label1.color = Colors.White
|
||||
' Label1.Height = 30dip
|
||||
'' Private textColor As Int = Colors.black
|
||||
' Dim label2 As Label
|
||||
' label2 = lv_historial.TwoLinesLayout.SecondLabel
|
||||
' label2.TextSize = 14
|
||||
' label2.TextColor = Colors.RGB(1,127,1)
|
||||
'' Do While rs_do.NextRow
|
||||
'' Log($"${rs_do.GetString("H_IDCOMPRA")}, ${rs_do.GetString("H_PRONOMBRE")}, ${rs_do.GetString("H_CANT")}"$)
|
||||
'' Loop
|
||||
' Private fecha As String = rs_hist.GetString("H_FECHA")
|
||||
' fecha = fecha.SubString2(1,10)
|
||||
' lv_historial.AddTwoLines("Orden: " & rs_hist.GetString("H_IDCOMPRA"), $"Fecha: ${fecha}, Productos: ${rs_hist.GetString("cantidad")}, Total: $${NumberFormat2(rs_hist.GetString("total"), 1, 2, 2, True)}"$)
|
||||
'' totalPedido = totalPedido + (rs_hist.GetString("PE_COSTOU") * rs_hist.GetString("PE_CANT"))
|
||||
'' cantPedido = cantPedido + rs_hist.GetString("PE_CANT")
|
||||
' Loop
|
||||
'' Private c As Cursor = Starter.skmt.ExecQuery("select pc_noart, pc_monto from PEDIDO_TICKET where pc_cliente in (Select CUENTA from cuentaa)")
|
||||
'' c.Position=0
|
||||
' '' l_cant.Text = c.GetString("PC_NOART")
|
||||
'' c.Close
|
||||
' Else
|
||||
' l_historialVacio.Visible = True
|
||||
' l_historialVacio.Text = "No hay ordenes en tu historial."
|
||||
' End If
|
||||
' rs_hist.Close
|
||||
End Sub
|
||||
|
||||
Sub CreateListItem(Text As String, cant As Int, precioU As String, inv As Int, Width As Int, Height As Int, img As Bitmap, prodId As String) As Panel 'ignore
|
||||
Dim p As B4XView = xui.CreatePanel("")
|
||||
Dim cs As CSBuilder
|
||||
cs.Initialize
|
||||
p.SetLayoutAnimated(0, 0, 0, Width, Height)
|
||||
p.LoadLayout("prodItemCarrito")
|
||||
' i_prod.Bitmap = img
|
||||
l_prodX.TextSize = 15
|
||||
p_prods.Height = Height
|
||||
p_prods.Width = Width - 10
|
||||
' Log($"${clv_carrito.AsView.Width}, ${Root.Width}, ${p_prods.Width}"$)
|
||||
p_botMasMen.Left = p_prods.Width - (p_botMasMen.Width - 75)
|
||||
l_prodX.Height = Height
|
||||
l_prodX.Text = Text&CRLF&"# " & inv & " $ " & precioU
|
||||
l_prodX.Text = cs.Color(Colors.red).append(Text).pop.append(CRLF).Color(0xFF017F01).Append($"Precio $${NumberFormat2(precioU, 1, 2, 2, True)}"$).Popall
|
||||
l_prodX.Tag = $"ID: ${prodId}${CRLF}${Text}${CRLF}Precio: $$1.2{precioU}${CRLF}Inv: ${inv} pzs"$
|
||||
l_pCant.Tag = precioU&"|"&inv&"|"&prodId
|
||||
et_pCant.Tag = precioU&"|"&inv&"|"&prodId
|
||||
et_pCant.Text = cant
|
||||
et_pCant.BringToFront
|
||||
Return p
|
||||
' Dim p As B4XView = xui.CreatePanel("")
|
||||
' Dim cs As CSBuilder
|
||||
' cs.Initialize
|
||||
' p.SetLayoutAnimated(0, 0, 0, Width, Height)
|
||||
' p.LoadLayout("prodItemCarrito")
|
||||
'' i_prod.Bitmap = img
|
||||
' l_prodX.TextSize = 15
|
||||
' p_prods.Height = Height
|
||||
' p_prods.Width = Width - 10
|
||||
'' Log($"${clv_carrito.AsView.Width}, ${Root.Width}, ${p_prods.Width}"$)
|
||||
' p_botMasMen.Left = p_prods.Width - (p_botMasMen.Width - 75)
|
||||
' l_prodX.Height = Height
|
||||
' l_prodX.Text = Text&CRLF&"# " & inv & " $ " & precioU
|
||||
' l_prodX.Text = cs.Color(Colors.red).append(Text).pop.append(CRLF).Color(0xFF017F01).Append($"Precio $${NumberFormat2(precioU, 1, 2, 2, True)}"$).Popall
|
||||
' l_prodX.Tag = $"ID: ${prodId}${CRLF}${Text}${CRLF}Precio: $$1.2{precioU}${CRLF}Inv: ${inv} pzs"$
|
||||
' l_pCant.Tag = precioU&"|"&inv&"|"&prodId
|
||||
' et_pCant.Tag = precioU&"|"&inv&"|"&prodId
|
||||
' et_pCant.Text = cant
|
||||
' et_pCant.BringToFront
|
||||
' Return p
|
||||
End Sub
|
||||
|
||||
Private Sub b_borrar_Click
|
||||
clv = clv_carrito
|
||||
' Private buttonTag As String = Sender.As(Button).tag
|
||||
Dim index As Int = clv.GetItemFromView(Sender)
|
||||
Msgbox2Async("¿Seguro que deseas borrar este producto?", "Borrar Producto", "Si", "", "No", Null, False)
|
||||
Wait For Msgbox_Result (Result As Int)
|
||||
If Result = DialogResponse.POSITIVE Then
|
||||
LogColor("b_borrar_Click", Colors.Magenta)
|
||||
Private precio As String=clv.GetValue(index).As(Map).Get("precio")
|
||||
' Private inv As Int = clv.GetValue(index).As(Map).Get("almacen")
|
||||
Dim pnl0 As B4XView = clv.GetPanel(index)
|
||||
Dim pnl As B4XView = pnl0.GetView(0)
|
||||
Dim laCant As B4XView = pnl.GetView(2).GetView(2)
|
||||
If WobbleMenu1.GetCurrentTab = 3 Then laCant = pnl.GetView(2).GetView(4)
|
||||
Log(laCant.text)
|
||||
laCant.Text = "0"
|
||||
Private id As String=clv.GetValue(index).As(Map).Get("id")
|
||||
' Private almacenX As String = Subs.traeAlmacen
|
||||
Private nombreX As String = Subs.traeProdNombre(id)
|
||||
Private precioX As String = precio
|
||||
Subs.actualizaProducto(precioX, laCant.text, nombreX, id, Starter.ticketActual, Subs.traeFecha, Starter.meseroActual, Starter.mesaActual, 0, Starter.tipov, Starter.comensalesActuales)
|
||||
' Log($"${almacenX}, ${precioX}, ${laCant.text}, ${nombreX}, ${id}, ${Starter.ticketActual}, ${Subs.traeFecha}, ${Subs.traeUsuarioDeBD}, ${rutaUsuario}, 0, ${Starter.tipov}"$)
|
||||
cuentaProds
|
||||
llenaCarrito
|
||||
End If
|
||||
' clv = clv_carrito
|
||||
'' Private buttonTag As String = Sender.As(Button).tag
|
||||
' Dim index As Int = clv.GetItemFromView(Sender)
|
||||
' Msgbox2Async("¿Seguro que deseas borrar este producto?", "Borrar Producto", "Si", "", "No", Null, False)
|
||||
' Wait For Msgbox_Result (Result As Int)
|
||||
' If Result = DialogResponse.POSITIVE Then
|
||||
' LogColor("b_borrar_Click", Colors.Magenta)
|
||||
' Private precio As String=clv.GetValue(index).As(Map).Get("precio")
|
||||
'' Private inv As Int = clv.GetValue(index).As(Map).Get("almacen")
|
||||
' Dim pnl0 As B4XView = clv.GetPanel(index)
|
||||
' Dim pnl As B4XView = pnl0.GetView(0)
|
||||
' Dim laCant As B4XView = pnl.GetView(2).GetView(2)
|
||||
' If WobbleMenu1.GetCurrentTab = 3 Then laCant = pnl.GetView(2).GetView(4)
|
||||
' Log(laCant.text)
|
||||
' laCant.Text = "0"
|
||||
' Private id As String=clv.GetValue(index).As(Map).Get("id")
|
||||
'' Private almacenX As String = Subs.traeAlmacen
|
||||
' Private nombreX As String = Subs.traeProdNombre(id)
|
||||
' Private precioX As String = precio
|
||||
' Subs.actualizaProducto(precioX, laCant.text, nombreX, id, Starter.ticketActual, Subs.traeFecha, Starter.meseroActual, Starter.mesaActual, 0, Starter.tipov, Starter.comensalesActuales)
|
||||
'' Log($"${almacenX}, ${precioX}, ${laCant.text}, ${nombreX}, ${id}, ${Starter.ticketActual}, ${Subs.traeFecha}, ${Subs.traeUsuarioDeBD}, ${rutaUsuario}, 0, ${Starter.tipov}"$)
|
||||
' cuentaProds
|
||||
' llenaCarrito
|
||||
' End If
|
||||
End Sub
|
||||
|
||||
Private Sub lv_historial_ItemClick (Position As Int, Value As Object)
|
||||
@@ -848,6 +883,10 @@ Private Sub clv_mesas_VisibleRangeChanged (FirstIndex As Int, LastIndex As Int)
|
||||
End Sub
|
||||
|
||||
Sub LlenaMesas(p As ResultSet, extra As String) 'ignore
|
||||
Private o As Cursor = Starter.skmt.ExecQuery("select count(PT_TICKET) as ordenes from PEDIDO_TICKET where PT_PAGO <> 'VENTA'")
|
||||
o.Position = 0
|
||||
If o.GetInt("ordenes") > 0 Then WobbleMenu1.SetBadge(3, o.GetInt("ordenes"), Colors.white, Colors.red) Else WobbleMenu1.RemoveBadge(3)
|
||||
|
||||
Dim p As ResultSet = Starter.skmt.ExecQuery($"select *, IFNULL(M_ESTATUS, 'CERRADA') as ESTATUS2, IFNULL(M_MESERO, 'NINGUNO') as MESERO, IFNULL(M_COMENSALES, 0) as COMENSALES from cat_mesas"$)
|
||||
' Dim p As ResultSet = Starter.skmt.ExecQuery($"Select *, IFNULL(M_ESTATUS, 'CERRADA') as ESTATUS2, IFNULL(M_MESERO, 'NINGUNO') as MESERO, IFNULL(M_COMENSALES, 0) as COMENSALES, M_TICKET, IFNULL(PT_MONTO, 0) as SUBTOTAL, IFNULL(PT_NOART, 0) as NO_ARTS from CAT_MESAS left join pedido_ticket on M_TICKET = pt_ticket and M_ID = PT_MESA"$)
|
||||
|
||||
@@ -862,7 +901,7 @@ Sub LlenaMesas(p As ResultSet, extra As String) 'ignore
|
||||
' Log(p.GetString("ESTATUS2"))
|
||||
If p.GetString("ESTATUS2") = "ABIERTA" Then
|
||||
' Log($"PT_TICKET = '${p.GetString("M_TICKET")}' and PT_MESA = '${p.GetString("M_ID")}"$)
|
||||
Private pt As Cursor = Starter.skmt.ExecQuery($"select ifnull(sum(PT_MONTO),0) as SUBTOTAL, ifnull(sum(PT_NOART), 0) as NO_ARTS from PEDIDO_TICKET where PT_TICKET = '${p.GetString("M_TICKET")}' and PT_MESA = '${p.GetString("M_ID")}'"$)
|
||||
Private pt As Cursor = Starter.skmt.ExecQuery($"select ifnull(sum(PT_MONTO),0) as SUBTOTAL, ifnull(sum(PT_NOART), 0) as NO_ARTS from PEDIDO_TICKET where PT_TICKET = '${p.GetString("M_TICKET")}' and PT_MESA = '${p.GetString("M_ID")}' and PT_PAGO = 'VENTA'"$)
|
||||
If pt.RowCount > 0 Then
|
||||
pt.Position = 0
|
||||
SUBTOTAL2 = pt.GetString("SUBTOTAL")
|
||||
@@ -886,9 +925,11 @@ Sub LlenaMesas(p As ResultSet, extra As String) 'ignore
|
||||
reiniciarlistaProds = False
|
||||
End Sub
|
||||
|
||||
|
||||
'Entramos a la mesa seleccionada.
|
||||
Private Sub p_mesasItem_Click
|
||||
Log(Sender.As(Panel).tag)
|
||||
b_abrirMesa.Text = "Abrir Mesa"
|
||||
Subs.panelVisible(p_mesa, 0, 0)
|
||||
Private m As Map = Sender.As(Panel).tag
|
||||
Starter.mesaActual = m.Get("id")
|
||||
@@ -961,13 +1002,20 @@ Private Sub cb_mesero_SelectedIndexChanged (Index As Int)
|
||||
End Sub
|
||||
|
||||
Private Sub b_mesaCerrar_Click
|
||||
Log("Cerrar")
|
||||
Log(Sender.As(Button).tag)
|
||||
p_pago.BringToFront
|
||||
p_pago.Visible = True
|
||||
' Log("Cerrar")
|
||||
Private c As Cursor = Starter.skmt.ExecQuery($"select PE_MESA from PEDIDO where PE_MESA = '${Starter.mesaActual}' and PE_TIPO = 'VENTA'"$)
|
||||
If c.RowCount > 0 Then
|
||||
Log(Sender.As(Button).tag)
|
||||
p_pago.BringToFront
|
||||
p_pago.Visible = True
|
||||
Else
|
||||
Starter.skmt.ExecNonQuery($"update CAT_MESAS set M_PAGO = null, M_TICKET = null, M_ESTATUS = null, M_MESERO = null, M_COMENSALES = null where M_ID = '${Starter.mesaActual}'"$)
|
||||
B4XPage_CloseRequest
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub b_mesaEditar_Click
|
||||
b_abrirMesa.Text = "Guardar"
|
||||
p_mesaCampos.Visible = True
|
||||
b_abrirMesa.Visible = True
|
||||
p_mesaAbierta.Visible = False
|
||||
@@ -988,19 +1036,60 @@ End Sub
|
||||
Private Sub b_pagoCerrar_Click
|
||||
p_pago.Visible = False
|
||||
If cb_pago.SelectedItem = "Efectivo" Then
|
||||
Private sigTicket As String = Subs.traeConsecutivoTicket("CERRADA", "EFECTIVO")
|
||||
Starter.skmt.ExecNonQuery($"update CAT_MESAS set M_PAGO = null, M_TICKET = null, M_ESTATUS = null, M_MESERO = null, M_COMENSALES = null where M_ID = '${Starter.mesaActual}'"$)
|
||||
Log($"update CAT_MESAS set M_PAGO = null, M_TICKET = null, M_ESTATUS = null, M_MESERO = null, M_COMENSALES = null where M_ID = '${Starter.mesaActual}'"$)
|
||||
Starter.skmt.ExecNonQuery($"update PEDIDO set PE_TIPO = 'EFECTIVO', PE_TICKET = '${sigTicket}' where PE_MESA = '${Starter.mesaActual}' and PE_TIPO = 'VENTA' and PE_TICKET = '${Starter.ticketActual}'"$)
|
||||
Log($"update PEDIDO set PE_TIPO = 'EFECTIVO', PE_TICKET = '${sigTicket}' where PE_MESA = '${Starter.mesaActual}' and PE_TIPO = 'VENTA' and PE_TICKET = '${Starter.ticketActual}'"$)
|
||||
Starter.skmt.ExecNonQuery($"update PEDIDO_TICKET set PT_PAGO = 'EFECTIVO', PT_TICKET = '${sigTicket}' where PT_MESA = '${Starter.mesaActual}' and PT_TICKET = '${Starter.ticketActual}' and PT_PAGO = 'VENTA'"$)
|
||||
Log($"update PEDIDO_TICKET set PT_PAGO = 'EFECTIVO', PT_TICKET = '${sigTicket}' where PT_MESA = '${Starter.mesaActual}' and PT_TICKET = '${Starter.ticketActual}' and PT_PAGO = 'VENTA"$)
|
||||
Private tipoPago As String = "EFECTIVO"
|
||||
Else
|
||||
|
||||
'Pago con tarjeta
|
||||
Private tipoPago As String = "TARJETA"
|
||||
End If
|
||||
Private sigTicket As String = Subs.traeConsecutivoTicket("CERRADA", tipoPago)
|
||||
Starter.skmt.ExecNonQuery($"update CAT_MESAS set M_PAGO = null, M_TICKET = null, M_ESTATUS = null, M_MESERO = null, M_COMENSALES = null where M_ID = '${Starter.mesaActual}'"$)
|
||||
' Log($"update CAT_MESAS set M_PAGO = null, M_TICKET = null, M_ESTATUS = null, M_MESERO = null, M_COMENSALES = null where M_ID = '${Starter.mesaActual}'"$)
|
||||
Starter.skmt.ExecNonQuery($"update PEDIDO set PE_TIPO = '${tipoPago}', PE_TICKET = '${sigTicket}' where PE_MESA = '${Starter.mesaActual}' and PE_TIPO = 'VENTA' and PE_TICKET = '${Starter.ticketActual}'"$)
|
||||
' Log($"update PEDIDO set PE_TIPO = '${tipoPago}', PE_TICKET = '${sigTicket}' where PE_MESA = '${Starter.mesaActual}' and PE_TIPO = 'VENTA' and PE_TICKET = '${Starter.ticketActual}'"$)
|
||||
Starter.skmt.ExecNonQuery($"update PEDIDO_TICKET set PT_PAGO = '${tipoPago}', PT_TICKET = '${sigTicket}' where PT_MESA = '${Starter.mesaActual}' and PT_TICKET = '${Starter.ticketActual}' and PT_PAGO = 'VENTA'"$)
|
||||
' Log($"update PEDIDO_TICKET set PT_PAGO = '${tipoPago}', PT_TICKET = '${sigTicket}' where PT_MESA = '${Starter.mesaActual}' and PT_TICKET = '${Starter.ticketActual}' and PT_PAGO = 'VENTA"$)
|
||||
B4XPage_CloseRequest
|
||||
End Sub
|
||||
|
||||
Private Sub cb_pago_SelectedIndexChanged (Index As Int)
|
||||
Log(cb_pago.SelectedItem)
|
||||
End Sub
|
||||
|
||||
Private Sub b_cierraAdmin_Click
|
||||
Private c As Cursor = Starter.skmt.ExecQuery($"select M_ESTATUS from CAT_MESAS where M_ESTATUS = 'ABIERTA'"$)
|
||||
Log(c.RowCount)
|
||||
If c.RowCount = 0 Then
|
||||
cd1.Initialize(Colors.gray, 10dip)
|
||||
b_cierraAdmin.Background = cd1
|
||||
ToastMessageShow("¡Cierre administrativo habilitado!", False)
|
||||
Starter.skmt.ExecNonQuery2("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = ?", Array As Object ("CIERRE ADMIN"))
|
||||
Starter.skmt.ExecNonQuery2("INSERT INTO CAT_VARIABLES(CAT_VA_DESCRIPCION, CAT_VA_VALOR) VALUES (?,?)", Array As Object ("CIERRE ADMIN","1"))
|
||||
Else
|
||||
ToastMessageShow("¡Es necesario que NO haya mesas abiertas para realizar el cierre!", True)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub b_cierraAdmin_LongClick
|
||||
Starter.skmt.ExecNonQuery2("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = ?", Array As Object ("CIERRE ADMIN"))
|
||||
Starter.skmt.ExecNonQuery2("INSERT INTO CAT_VARIABLES(CAT_VA_DESCRIPCION, CAT_VA_VALOR) VALUES (?,?)", Array As Object ("CIERRE ADMIN","0"))
|
||||
cd1.Initialize(Colors.red, 10dip)
|
||||
b_cierraAdmin.Background = cd1
|
||||
ToastMessageShow("¡Cierre administrativo cancelado!", False)
|
||||
End Sub
|
||||
|
||||
Private Sub b_cierreTotal_Click
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub et_inicioDia_EnterPressed
|
||||
If et_inicioDia.Text.trim = "INICIO DIA" Then
|
||||
p_transparenteCierreAdmin.Visible = False
|
||||
et_inicioDia.Text = ""
|
||||
Starter.skmt.ExecNonQuery2("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = ?", Array As Object ("CIERRE ADMIN"))
|
||||
Starter.skmt.ExecNonQuery2("INSERT INTO CAT_VARIABLES(CAT_VA_DESCRIPCION, CAT_VA_VALOR) VALUES (?,?)", Array As Object ("CIERRE ADMIN","0"))
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub p_transparenteCierreAdmin_Click
|
||||
'Para evitar que el clic en pantalla no se siga hacia atras
|
||||
End Sub
|
||||
@@ -4,9 +4,7 @@ ModulesStructureVersion=1
|
||||
Type=Class
|
||||
Version=6.8
|
||||
@EndOfDesignText@
|
||||
'Necesita la libreria RandomAccessFile
|
||||
|
||||
'Class module
|
||||
''Class module
|
||||
Sub Class_Globals
|
||||
Private mTarget As Object
|
||||
Type DBResult (Tag As Object, Columns As Map, Rows As List)
|
||||
@@ -17,8 +15,11 @@ Sub Class_Globals
|
||||
,T_DOUBLE = 6, T_BOOLEAN = 7, T_BLOB = 8 As Byte
|
||||
Private VERSION As Float = 0.9
|
||||
Private tempArray(1) As Object
|
||||
Dim jobTagAnterior As String = "" 'Mod por CHV - 211027
|
||||
Dim logger As Boolean = False
|
||||
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
|
||||
|
||||
'Target - The module that handles JobDone (usually Me).
|
||||
@@ -35,8 +36,10 @@ End Sub
|
||||
Public Sub ExecuteQuery(Command As DBCommand, Limit As Int, Tag As Object)
|
||||
Dim j As HttpJob
|
||||
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)
|
||||
WriteInt(Limit, out2)
|
||||
WriteList(Command.Parameters, out2)
|
||||
@@ -50,7 +53,7 @@ End Sub
|
||||
Public Sub ExecuteBatch(ListOfCommands As List, Tag As Object)
|
||||
Dim j As HttpJob
|
||||
Dim ms As OutputStream
|
||||
Dim out2 As OutputStream = StartJob(j,ms, Tag)
|
||||
Dim out2 As OutputStream = StartJob(j, ms, Tag)
|
||||
WriteInt(ListOfCommands.Size, out2)
|
||||
For Each Command As DBCommand In ListOfCommands
|
||||
WriteObject(Command.Name, out2)
|
||||
@@ -62,10 +65,15 @@ End Sub
|
||||
|
||||
'Similar to ExecuteBatch. Sends a single command.
|
||||
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)
|
||||
End Sub
|
||||
|
||||
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.Tag = Tag
|
||||
MemoryStream.InitializeToBytesArray(0)
|
||||
@@ -116,7 +124,7 @@ Private Sub WriteObject(o As Object, out As OutputStream)
|
||||
Else If GetType(tempArray(0)) = "[B" Then
|
||||
data = o
|
||||
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)
|
||||
out.WriteBytes(Array As Byte(T_STRING), 0, 1)
|
||||
data = bc.StringToBytes(o, "UTF8")
|
||||
@@ -189,10 +197,15 @@ End Sub
|
||||
|
||||
'Handles the Job result and returns a 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 cs As CompressedStreams
|
||||
If Starter.Logger Then logger = Starter.Logger
|
||||
In = cs.WrapInputStream(In, "gzip")
|
||||
Dim serverVersion As Float = ReadObject(In) 'ignore
|
||||
Dim method As String = ReadObject(In)
|
||||
@@ -201,8 +214,6 @@ Public Sub HandleJob(Job As HttpJob) As DBResult
|
||||
table.Columns.Initialize
|
||||
table.rows.Initialize
|
||||
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
|
||||
Dim numberOfColumns As Int = ReadInt(In)
|
||||
For i = 0 To numberOfColumns - 1
|
||||
@@ -224,9 +235,14 @@ Public Sub HandleJob(Job As HttpJob) As DBResult
|
||||
Next
|
||||
End If
|
||||
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
|
||||
End Sub
|
||||
|
||||
'Reads a file and returns the file as a bytes array.
|
||||
Public Sub FileToBytes(Dir As String, FileName As String) As Byte()
|
||||
Dim out As OutputStream
|
||||
@@ -270,8 +286,58 @@ Public Sub PrintTable(Table As DBResult)
|
||||
For Each record As Object In row
|
||||
sb.Append(record).Append(TAB)
|
||||
Next
|
||||
ToastMessageShow(sb.ToString, True)
|
||||
Log(sb.ToString)
|
||||
Next
|
||||
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
|
||||
BIN
B4A/Files/errormanager.bal
Normal file
BIN
B4A/Files/errormanager.bal
Normal file
Binary file not shown.
BIN
B4A/Files/kmt.db
BIN
B4A/Files/kmt.db
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,24 +1,28 @@
|
||||
Build1=Default,mp.keymon.lat,HU2_PUBLIC
|
||||
File1=candado.png
|
||||
File10=principal.bal
|
||||
File11=proditem.bal
|
||||
File12=proditemCarrito.bal
|
||||
File13=usuario.png
|
||||
File14=vecteezy_white-diagonal-stripes-with-red-line-isolated-on-white_12833309-[Convertido].png
|
||||
File10=MainPage.bal
|
||||
File11=mesasItem.bal
|
||||
File12=principal.bal
|
||||
File13=proditem.bal
|
||||
File14=proditemCarrito.bal
|
||||
File15=usuario.png
|
||||
File16=vecteezy_white-diagonal-stripes-with-red-line-isolated-on-white_12833309-[Convertido].png
|
||||
File2=durakelo.png
|
||||
File3=engrane.png
|
||||
File4=engranes.png
|
||||
File5=kmt.db
|
||||
File6=login.bal
|
||||
File7=logo.png
|
||||
File8=MainPage.bal
|
||||
File9=mesasItem.bal
|
||||
File5=errormanager.bal
|
||||
File6=fondoblanco.png
|
||||
File7=kmt.db
|
||||
File8=login.bal
|
||||
File9=logo.png
|
||||
FileGroup1=Default Group
|
||||
FileGroup10=Default Group
|
||||
FileGroup11=Default Group
|
||||
FileGroup12=Default Group
|
||||
FileGroup13=Default Group
|
||||
FileGroup14=Default Group
|
||||
FileGroup15=Default Group
|
||||
FileGroup16=Default Group
|
||||
FileGroup2=Default Group
|
||||
FileGroup3=Default Group
|
||||
FileGroup4=Default Group
|
||||
@@ -29,32 +33,38 @@ FileGroup8=Default Group
|
||||
FileGroup9=Default Group
|
||||
Group=Default Group
|
||||
Library1=appupdating
|
||||
Library10=wobblemenu
|
||||
Library11=preoptimizedclv
|
||||
Library10=randomaccessfile
|
||||
Library11=runtimepermissions
|
||||
Library12=serial
|
||||
Library13=sql
|
||||
Library14=stringutils
|
||||
Library15=wobblemenu
|
||||
Library16=xui
|
||||
Library17=javaobject
|
||||
Library2=b4xpages
|
||||
Library3=byteconverter
|
||||
Library4=compressstrings
|
||||
Library5=core
|
||||
Library6=json
|
||||
Library7=okhttputils2
|
||||
Library8=randomaccessfile
|
||||
Library9=sql
|
||||
ManifestCode='This code will be applied to the manifest file during compilation.~\n~'You do not need to modify it in most cases.~\n~'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136~\n~AddManifestText(~\n~<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="31"/>~\n~<supports-screens android:largeScreens="true" ~\n~ android:normalScreens="true" ~\n~ android:smallScreens="true" ~\n~ android:anyDensity="true"/>)~\n~SetApplicationAttribute(android:icon, "@drawable/icon")~\n~SetApplicationAttribute(android:label, "$LABEL$")~\n~CreateResourceFromFile(Macro, Themes.LightTheme)~\n~'End of default text.~\n~~\n~SetApplicationAttribute(android:usesCleartextTraffic, "true")
|
||||
Library8=phone
|
||||
Library9=preoptimizedclv
|
||||
ManifestCode='This code will be applied to the manifest file during compilation.~\n~'You do not need to modify it in most cases.~\n~'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136~\n~AddManifestText(~\n~<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="31"/>~\n~<supports-screens android:largeScreens="true" ~\n~ android:normalScreens="true" ~\n~ android:smallScreens="true" ~\n~ android:anyDensity="true"/>)~\n~SetApplicationAttribute(android:icon, "@drawable/icon")~\n~SetApplicationAttribute(android:label, "$LABEL$")~\n~CreateResourceFromFile(Macro, Themes.LightTheme)~\n~'End of default text.~\n~~\n~SetApplicationAttribute(android:usesCleartextTraffic, "true")~\n~AddPermission(android.permission.BLUETOOTH_ADVERTISE)~\n~AddPermission(android.permission.BLUETOOTH_CONNECT)~\n~AddPermission(android.permission.BLUETOOTH_SCAN)~\n~SetApplicationAttribute(android:largeHeap, "true")~\n~SetApplicationAttribute(android:allowBackup, "false")~\n~SetApplicationAttribute(android:exported, "true")
|
||||
Module1=B4XMainPage
|
||||
Module2=C_Principal
|
||||
Module3=DBRequestManager
|
||||
Module4=errorManager
|
||||
Module5=Starter
|
||||
Module6=Subs
|
||||
NumberOfFiles=14
|
||||
NumberOfLibraries=11
|
||||
NumberOfFiles=16
|
||||
NumberOfLibraries=17
|
||||
NumberOfModules=6
|
||||
Version=12.5
|
||||
Version=12.8
|
||||
@EndOfDesignText@
|
||||
#Region Project Attributes
|
||||
#ApplicationLabel: MarketPlace
|
||||
#VersionCode: 1
|
||||
#VersionName: 3.07.20
|
||||
#VersionName: 4.07.20
|
||||
'SupportedOrientations possible values: unspecified, landscape or portrait.
|
||||
#SupportedOrientations: portrait
|
||||
#CanInstallToExternalStorage: False
|
||||
@@ -72,7 +82,7 @@ Sub Process_Globals
|
||||
End Sub
|
||||
|
||||
Sub Globals
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Create(FirstTime As Boolean)
|
||||
|
||||
@@ -14,11 +14,11 @@ ModuleBreakpoints5=
|
||||
ModuleBreakpoints6=
|
||||
ModuleClosedNodes0=
|
||||
ModuleClosedNodes1=
|
||||
ModuleClosedNodes2=1
|
||||
ModuleClosedNodes3=14
|
||||
ModuleClosedNodes2=
|
||||
ModuleClosedNodes3=
|
||||
ModuleClosedNodes4=
|
||||
ModuleClosedNodes5=6
|
||||
ModuleClosedNodes5=
|
||||
ModuleClosedNodes6=68
|
||||
NavigationStack=B4XMainPage,b_cargaProductos_Click,91,0,C_Principal,b_prodMenos_Click,282,0,B4XMainPage,Class_Globals,20,0,C_Principal,B4XPage_CloseRequest,200,6,C_Principal,Initialize,72,0,C_Principal,b_pagoCerrar_Click,991,0,Starter,Process_Globals,5,0,B4XMainPage,Initialize,39,0,C_Principal,Class_Globals,67,0,Subs,Process_Globals,17,0
|
||||
NavigationStack=C_Principal,b_mesaCerrar_Click,999,6,Main,Globals,21,0,Visual Designer,principal.bal,-100,6,B4XMainPage,Initialize,44,0,Visual Designer,login.bal,-100,6,B4XMainPage,Class_Globals,40,0,B4XMainPage,B4XPage_Created,63,6,Subs,traeTotalesTicketActual,1131,0,C_Principal,p_mesasItem_Click,936,0,Starter,Process_Globals,18,0,errorManager,Activity_Resume,117,0
|
||||
SelectedBuild=0
|
||||
VisibleModules=1,5,6,2,4
|
||||
VisibleModules=1,5,6,2,4,3
|
||||
|
||||
@@ -14,7 +14,9 @@ Sub Process_Globals
|
||||
'These variables can be accessed from all modules.
|
||||
Public rp As RuntimePermissions
|
||||
Dim reqManager As DBRequestManager
|
||||
Dim skmt, errorLog As SQL
|
||||
Dim skmt As SQL
|
||||
Dim Logger As Boolean = False
|
||||
Dim DBReqServer As String = "http://keymon.lat:1782"
|
||||
Dim server, ruta As String
|
||||
'Para los Logs
|
||||
Dim logs As StringBuilder
|
||||
@@ -41,7 +43,7 @@ Sub Service_Create
|
||||
logcat.LogCatStart(Array As String("-v","raw","*:F","B4A:v"), "logcat")
|
||||
#end if
|
||||
logs.Initialize
|
||||
server = "http://keymon.lat:1782"
|
||||
server = "http://keymon.lat:1781"
|
||||
If Logger Then Log($"Starter reqManager server: ${server}"$)
|
||||
Logger = False
|
||||
End Sub
|
||||
@@ -64,12 +66,12 @@ End Sub
|
||||
'Return true to allow the OS default exceptions handler to handle the uncaught exception. 'Para los Logs
|
||||
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
|
||||
'wait for 500ms to allow the logs to be updated.
|
||||
Log(">>>>>>>>> ERROR")
|
||||
Dim jo As JavaObject
|
||||
Dim l As Long = 500: jo.InitializeStatic("java.lang.Thread").RunMethod("sleep", Array(l)) 'Sleep 500ms
|
||||
logcat.LogCatStop
|
||||
logs.Initialize
|
||||
logs.Append("Ver " & Application.VersionName & CRLF)
|
||||
logs.Append("R:" & rutav & CRLF)
|
||||
logs.Append(Application.LabelName & " Ver " & Application.VersionName & CRLF)
|
||||
logs.Append(StackTrace)
|
||||
Subs.revisaBD
|
||||
Subs.errorLog.ExecNonQuery2("INSERT INTO errores(fecha, error) VALUES (?,?)", Array As Object (Subs.fechaKMT(DateTime.now), logs))
|
||||
@@ -82,7 +84,7 @@ Sub Service_Destroy
|
||||
If Logger Then LogColor("starter destroyed", Colors.red)
|
||||
End Sub
|
||||
|
||||
Sub reinicializaReqManager
|
||||
Sub reinicializaReqManager 'ignore
|
||||
reqManager.Initialize(Me, server)
|
||||
If Logger Then Log(server)
|
||||
End Sub
|
||||
@@ -116,4 +118,4 @@ Sub revisaBD 'ignore
|
||||
If Logger Then Log("revisaBD")
|
||||
If Not(File.Exists(ruta, "kmt.db")) Then File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
|
||||
If Not(skmt.IsInitialized) Then skmt.Initialize(ruta, "kmt.db", True)
|
||||
End Sub
|
||||
End Sub
|
||||
127
B4A/Subs.bas
127
B4A/Subs.bas
@@ -188,32 +188,23 @@ End Sub
|
||||
|
||||
'Revisa que exista la BD y si es necesario crea algunans tablas dentro de ella
|
||||
Sub revisaBD 'ignore
|
||||
' Main.ruta = File.DirInternal
|
||||
' Log(Starter.ruta)
|
||||
' Log(File.Exists(Starter.ruta, "kmt.db"))
|
||||
Log("REVISA BD")
|
||||
If Not(File.Exists(Starter.ruta, "kmt.db")) Then
|
||||
File.Copy(File.DirAssets, "kmt.db", Starter.ruta, "kmt.db")
|
||||
LogColor("copiamos kmt.db de "&File.DirAssets & " a " & Starter.ruta,Colors.Green)
|
||||
End If
|
||||
If Not(kmt.IsInitialized) Then kmt.Initialize(Starter.ruta, "kmt.db", True)
|
||||
kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS RUTA_GPS(FECHA INTEGER, LAT TEXT, LON TEXT)")
|
||||
' kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS UUC(fecha INTEGER, lat TEXT, lon TEXT)") 'LastKnownLocation
|
||||
kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS bitacora(fecha INTEGER, texto TEXT)") 'Bitacora
|
||||
kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS HIST_AVANCE(HA_MARCA TEXT, HA_AVANCE TEXT, HA_OBJETIVO TEXT, HA_PORCENTAJE TEXT)") 'Historico avance mes actual
|
||||
kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS ABONOSP(NOTA TEXT, CLIENTE TEXT, SALDO_PENDIENTE TEXT)")
|
||||
kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS CLIENTE_NUEVO(CN_ID_CLIENTE TEXT, CN_NOMBRE TEXT, CN_enviado text)")
|
||||
kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS RUTA_SUPLENCIA(RS_RUTA TEXT)")
|
||||
kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS CAT_MESAS(M_ID TEXT, M_NUMERO TEXT, M_NOMBRE TEXT, M_ZONA TEXT, M_ESTATUS TEXT, M_TICKET TEXT, M_MESERO TEXT, M_PAGO TEXT, M_COMENSALES INTEGER)")
|
||||
kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS CAT_MESEROS(MS_ID TEXT, MS_NOMBRE TEXT, MS_MESAS_ASIGNADAS TEXT)")
|
||||
kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS bitacora(fecha INTEGER, texto TEXT)") 'Bitacora
|
||||
' kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS MESAA(MESA STRING)")
|
||||
' kmt.ExecNonQuery("drop table PEDIDO_INICIO_FINAL") 'Bitacora
|
||||
kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS PEDIDO_INICIO_FINAL(PIF_CLIENTE TEXT, PIF_HORA_INICIO LONG, PIF_HORA_FINAL LONG)") 'Bitacora
|
||||
kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS PEDIDO3 (PE_PRECIO2 TEXT,PE_TIPO TEXT,PE_FOLIO NUMERIC,PE_DESC NUMERIC,PE_COSTO_SIN TEXT,PE_MESA TEXT,PE_CEDIS TEXT,PE_COSTO_TOT NUMERIC,PE_COSTOU NUMERIC,PE_CANT NUMERIC,PE_PRONOMBRE TEXT,PE_PROID TEXT,PE_TICKET TEXT,PE_FECHA TEXT,PE_MESERO TEXT)")
|
||||
kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS PEDIDO (PE_PRECIO2 TEXT,PE_TIPO TEXT,PE_FOLIO NUMERIC,PE_DESC NUMERIC,PE_COSTO_SIN TEXT,PE_MESA TEXT,PE_CEDIS TEXT,PE_COSTO_TOT NUMERIC,PE_COSTOU NUMERIC,PE_CANT NUMERIC,PE_PRONOMBRE TEXT,PE_PROID TEXT,PE_TICKET TEXT,PE_FECHA TEXT,PE_MESERO TEXT)")
|
||||
kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS PEDIDO_TICKET (PT_FACT TEXT, PT_COSTO_SIN TEXT, PT_MESA TEXT, PT_PAGO TEXT, PT_ALMACEN TEXT, PT_LON TEXT, PT_LAT TEXT, PT_TICKET TEXT, PT_FECHA TEXT, PT_MESERO TEXT, PT_COMENSALES INTEGER, PT_NOART NUMERIC, PT_MONTO TEXT, PT_ENVIO_OK INTEGER, PT_TIEMPO_TIENDA FLOAT, PT_FACTURA INTEGER)")
|
||||
kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS CAT_HIST_COMPRAS (H_IDCOMPRA TEXT, H_FOLIO NUMERIC, H_MESA TEXT, H_CEDIS TEXT, H_COSTO_TOT NUMERIC, H_COSTOU NUMERIC, H_CANT NUMERIC, H_PRONOMBRE TEXT, H_PROID TEXT, H_TICKET TEXT, H_FECHA TEXT)")
|
||||
|
||||
agregaColumna("PEDIDO_TICKET", "PT_TICKET", "TEXT")
|
||||
agregaColumna("PEDIDO", "PE_TICKET", "TEXT")
|
||||
agregaColumna("PEDIDO", "PE_MESA", "TEXT")
|
||||
agregaColumna("PEDIDO", "PE_MESERO", "TEXT")
|
||||
kmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS CAT_VARIABLES (CAT_VA_DESCRIPCION TEXT, CAT_VA_VALOR TEXT)")
|
||||
'Tabla para la bitacora de errores
|
||||
If Not(errorLog.IsInitialized) Then errorLog.Initialize(Starter.ruta, "errorLog.db", True)
|
||||
errorLog.ExecNonQuery("CREATE TABLE IF NOT EXISTS errores(fecha INTEGER, error TEXT)")
|
||||
@@ -650,6 +641,8 @@ Sub traeAlmacen As String 'ignore
|
||||
Return a
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
'Regresa el nombre del producto desde CAT_GUNAPROD
|
||||
Sub traeProdNombre(id As String) As String
|
||||
Private h As Cursor
|
||||
@@ -680,10 +673,10 @@ Sub traeMesa As String 'ignore
|
||||
Return m
|
||||
End Sub
|
||||
|
||||
Sub traeTicket(mesaId As String) As String 'ignore
|
||||
Sub traeTicket(mesaId As String, tipoPago As String) As String 'ignore
|
||||
Private c As Cursor
|
||||
Private cl As String = "PENDIENTE"
|
||||
c=Starter.skmt.ExecQuery("Select M_TICKET from CAT_MESAS where M_ID = '${mesaId}'")
|
||||
c=Starter.skmt.ExecQuery($"Select M_TICKET from CAT_MESAS where M_ID = '${mesaId}' and PE_TIPO = '${tipoPago}'"$)
|
||||
If c.RowCount > 0 Then
|
||||
c.Position=0
|
||||
cl = c.GetString("M_TICKET")
|
||||
@@ -911,6 +904,7 @@ Sub traeMaxPromos(pm As Map) As Int
|
||||
End Sub
|
||||
|
||||
'Regresa la cantidad de promos que se le han vendido al cliente.
|
||||
'HAY QUE REVISAR QUE TRAIGA BIEN LOS DATOS, HAY QUE PONER MAS DATOS EN EL "WHERE" DEL QUERY.
|
||||
Sub traePromosVendidas(promo As String, cliente As String) As Int
|
||||
Private c As Cursor
|
||||
Private pv As Int = 0
|
||||
@@ -1137,6 +1131,7 @@ Sub traeProdIdDeBD As Map 'ignore
|
||||
End Sub
|
||||
|
||||
'Regresa el total de productos y monto del pedido del ticket actual.
|
||||
'HAY QUE REVISAR QYUE EL WHERE TENGA LOS PARAMETRSO NECESARIOS
|
||||
Sub traeTotalesTicketActual As Map
|
||||
Private m As Map
|
||||
m.Initialize
|
||||
@@ -1180,9 +1175,10 @@ Sub pedidoGuardado As Boolean
|
||||
End Sub
|
||||
|
||||
'Regresa verdadero si hay pedido en la tabla "PEDIDO" del cliente actual.
|
||||
'HAY QUE REVSAR QUE REGERSE BIEN LOS DATOS; SEGURO HAY QUE PONER MAS DATOS EN EL WHERE DEL QUERY.
|
||||
Sub hayPedido As Boolean
|
||||
' Log($"TraeTicket: ${traeTicket}"$)
|
||||
Private thisC As Cursor=Starter.skmt.ExecQuery($"select count(PE_TICKET) as hayPedido from PEDIDO where PE_TICKET = '${Starter.ticketActual}'"$)
|
||||
Private thisC As Cursor=Starter.skmt.ExecQuery($"select count(PE_TICKET) as hayPedido from PEDIDO where PE_TICKET = '${Starter.ticketActual}' and PE_MESA = '${Starter.mesaActual}' and PE_TIPO = 'VENTA'"$)
|
||||
' Log($"select count(PE_TICKET) as hayPedido from PEDIDO where PE_TICKET = '${Starter.ticketActual}'"$)
|
||||
thisC.Position = 0
|
||||
Private hay As Boolean = False
|
||||
@@ -1224,20 +1220,20 @@ End Sub
|
||||
|
||||
'Regresa el total del pedido en la tabla "PEDIDO" del cliente actual.
|
||||
Sub totalPedido As String
|
||||
Private cT As Cursor = Starter.skmt.ExecQuery($"select sum(PE_COSTO_TOT) as total from PEDIDO where PE_TICKET = '${traeTicket(Starter.mesaActual)}'"$)
|
||||
Private pTotal As String = "0"
|
||||
If cT.RowCount > 0 Then
|
||||
cT.Position = 0
|
||||
' Log("|"&cT.GetLong("total")&"|"&pTotal)
|
||||
Private tempT As String = cT.GetLong("total")
|
||||
If tempT <> "null" And tempT <> Null Then
|
||||
' Log("|"&cT.GetLong("total")&"|")
|
||||
pTotal = tempT
|
||||
End If
|
||||
' Log($"Cliente actual=${traeTicket}, hayPedido=${hay}"$)
|
||||
End If
|
||||
cT.Close
|
||||
Return pTotal
|
||||
' Private cT As Cursor = Starter.skmt.ExecQuery($"select sum(PE_COSTO_TOT) as total from PEDIDO where PE_TICKET = '${traeTicket(Starter.mesaActual)}'"$)
|
||||
' Private pTotal As String = "0"
|
||||
' If cT.RowCount > 0 Then
|
||||
' cT.Position = 0
|
||||
'' Log("|"&cT.GetLong("total")&"|"&pTotal)
|
||||
' Private tempT As String = cT.GetLong("total")
|
||||
' If tempT <> "null" And tempT <> Null Then
|
||||
'' Log("|"&cT.GetLong("total")&"|")
|
||||
' pTotal = tempT
|
||||
' End If
|
||||
'' Log($"Cliente actual=${traeTicket}, hayPedido=${hay}"$)
|
||||
' End If
|
||||
' cT.Close
|
||||
' Return pTotal
|
||||
End Sub
|
||||
|
||||
Sub actualizaProducto(costoU As String, cant As String, nombre As String, prodId As String, ticketId As String, fecha As String, mesero As String, mesa As String, precioSin As String, tipoVenta As String, comensales As Int)
|
||||
@@ -1254,22 +1250,23 @@ Sub actualizaProducto(costoU As String, cant As String, nombre As String, prodId
|
||||
Private difCant As Int = cant - antCant
|
||||
Starter.skmt.ExecNonQuery($"update pedido set pe_cant = ${cant}, pe_costo_tot = ${(cant*c.GetString("PE_COSTOU"))} where pe_proid = '${prodId}' and PE_TICKET = '${ticketId}' and PE_MESA = '${mesa}' and PE_TIPO = '${tipoVenta}'"$)
|
||||
Starter.skmt.ExecNonQuery($"update cat_gunaprod set cat_gp_almacen = cat_gp_almacen - (${difCant}) where cat_gp_id = '${prodId}' "$)
|
||||
c=Starter.skmt.ExecQuery($"select sum(pe_costo_tot) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE, SUM(PE_COSTO_SIN) AS TOTAL_CLIE_SIN FROM PEDIDO WHERE PE_TICKET = '${ticketId}'"$)
|
||||
Log($"select sum(pe_costo_tot) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE, SUM(PE_COSTO_SIN) AS TOTAL_CLIE_SIN FROM PEDIDO WHERE PE_TICKET = '${ticketId}'"$)
|
||||
c=Starter.skmt.ExecQuery($"select sum(pe_costo_tot) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE, SUM(PE_COSTO_SIN) AS TOTAL_CLIE_SIN FROM PEDIDO WHERE PE_TICKET = '${ticketId}' and PE_MESA = '${mesa}' and PE_TIPO = '${tipoVenta}'"$)
|
||||
' Log($"select sum(pe_costo_tot) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE, SUM(PE_COSTO_SIN) AS TOTAL_CLIE_SIN FROM PEDIDO WHERE PE_TICKET = '${ticketId}' and PE_MESA = '${mesa}' and PE_TIPO = '${tipoVenta}'"$)
|
||||
c.Position=0
|
||||
Starter.skmt.ExecNonQuery($"delete from PEDIDO_TICKET where PT_TICKET = '${ticketId}' and PT_MESA = '${mesa}' and PT_PAGO = '${tipoVenta}'"$)
|
||||
Log($"delete from PEDIDO_TICKET where PT_TICKET = '${ticketId}' and PT_MESA = '${mesa}' and PT_PAGO = '${tipoVenta}'"$)
|
||||
' Log($"delete from PEDIDO_TICKET where PT_TICKET = '${ticketId}' and PT_MESA = '${mesa}' and PT_PAGO = '${tipoVenta}'"$)
|
||||
Starter.skmt.ExecNonQuery2("insert into PEDIDO_TICKET(PT_TICKET, PT_PAGO, PT_FECHA, PT_MESERO, PT_NOART, PT_MONTO, PT_MESA, PT_COSTO_SIN, PT_COMENSALES) VALUES (?,?,?,?,?,?,?,?,?)", Array As Object(ticketId, tipoVenta, fecha, mesero, c.GetString("CANT_CLIE"), c.GetString("TOTAL_CLIE"), mesa, c.GetString("TOTAL_CLIE_SIN"), comensales))
|
||||
' Log($"insert into PEDIDO_TICKET(PT_TICKET, PT_PAGO, PT_FECHA, PT_MESERO, PT_NOART, PT_MONTO, PT_MESA, PT_COSTO_SIN, PT_COMENSALES) VALUES (${ticketId}, ${tipoVenta}, fecha, mesero, ${c.GetString("CANT_CLIE")}, ${c.GetString("TOTAL_CLIE")}, ${mesa}, c.GetString("TOTAL_CLIE_SIN"), comensales)"$)
|
||||
If cant = 0 Then
|
||||
LogColor($"BORRAMOS PRODUCTO - ${prodId}"$, Colors.Red)
|
||||
Starter.skmt.ExecNonQuery($"delete from pedido where pe_proid = '${prodId}' and PE_TICKET = '${ticketId}' "$)
|
||||
Starter.skmt.ExecNonQuery($"delete from pedido where pe_proid = '${prodId}' and PE_TICKET = '${ticketId}' and PE_MESA = '${mesa}' and PE_TIPO = '${tipoVenta}'"$)
|
||||
Log($"Borramos pe_proid='${prodId}' and PE_TICKET='${ticketId}'"$)
|
||||
Private pe As Cursor = Starter.skmt.ExecQuery($"select count(PE_TICKET) as cuantosPedidos from pedido where PE_TICKET = '${ticketId}' and PE_MESA = '${mesa}' and PE_TIPO = '${tipoVenta}'"$)
|
||||
pe.Position = 0
|
||||
If pe.GetString("cuantosPedidos") = 0 Then
|
||||
Log("Borramos PEDIDO_TICKET")
|
||||
Starter.skmt.ExecNonQuery($"delete from PEDIDO_TICKET where PT_TICKET = '${ticketId}' and PT_MESA = '${mesa}' and PT_PAGO = '${tipoVenta}'"$)
|
||||
Log($"delete from PEDIDO_TICKET where PT_TICKET = '${ticketId}' and PT_MESA = '${mesa}' and PT_PAGO = '${tipoVenta}'"$)
|
||||
' Log($"delete from PEDIDO_TICKET where PT_TICKET = '${ticketId}' and PT_MESA = '${mesa}' and PT_PAGO = '${tipoVenta}'"$)
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
@@ -1292,12 +1289,13 @@ Sub guardaProductoSinGestion(costoU As String, cant As String, nombre As String,
|
||||
Starter.skmt.ExecNonQuery2("INSERT INTO PEDIDO (PE_COSTO_TOT, PE_COSTOU, PE_CANT, PE_PRONOMBRE, PE_PROID, PE_TICKET, PE_FECHA, PE_MESERO, PE_MESA, PE_COSTO_SIN, PE_TIPO) VALUES(?,?,?,?,?,?,?,?,?,?,?) ", Array As Object ((cant * costoU), costoU, cant, nombre, prodId, ticketId, fecha, mesero, mesa, precioSin, tipoVenta))
|
||||
'Actualizamos el inventario en cat_gunaprod solo si no es RMI
|
||||
Starter.skmt.ExecNonQuery2($"update cat_gunaprod set cat_gp_almacen = cat_gp_almacen - ? where cat_gp_id = ? "$, Array As Object(cant, prodId))
|
||||
c=Starter.skmt.ExecQuery($"select sum(pe_costo_tot) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE, SUM(PE_COSTO_SIN) AS TOTAL_CLIE_SIN FROM PEDIDO WHERE PE_TICKET = '${ticketId}'"$)
|
||||
c = Starter.skmt.ExecQuery($"select sum(pe_costo_tot) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE, SUM(PE_COSTO_SIN) AS TOTAL_CLIE_SIN FROM PEDIDO WHERE PE_TICKET = '${ticketId}' and PE_TIPO = 'VENTA' and PE_MESA = '${mesa}'"$)
|
||||
Log($"select sum(pe_costo_tot) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE, SUM(PE_COSTO_SIN) AS TOTAL_CLIE_SIN FROM PEDIDO WHERE PE_TICKET = '${ticketId}'"$)
|
||||
c.Position=0
|
||||
c.Position = 0
|
||||
Starter.skmt.ExecNonQuery($"delete from PEDIDO_TICKET where PT_TICKET = '${ticketId}' and PT_MESA = '${mesa}' and PT_PAGO = '${tipoVenta}'"$)
|
||||
Log($"delete from PEDIDO_TICKET where PT_TICKET = '${ticketId}' and PT_MESA = '${mesa}' and PT_PAGO = '${tipoVenta}'"$)
|
||||
' Log($"delete from PEDIDO_TICKET where PT_TICKET = '${ticketId}' and PT_MESA = '${mesa}' and PT_PAGO = '${tipoVenta}'"$)
|
||||
Starter.skmt.ExecNonQuery2("insert into PEDIDO_TICKET(PT_TICKET, PT_PAGO, PT_FECHA, PT_MESERO, PT_NOART, PT_MONTO, PT_MESA, PT_COSTO_SIN, PT_COMENSALES) VALUES (?,?,?,?,?,?,?,?,?)", Array As Object(ticketId, tipoVenta, fecha, mesero, c.GetString("CANT_CLIE"), c.GetString("TOTAL_CLIE"), mesa, c.GetString("TOTAL_CLIE_SIN"), comensales))
|
||||
Log($"insert into PEDIDO_TICKET(PT_TICKET, PT_PAGO, PT_MESERO, PT_NOART, PT_MONTO, PT_MESA, PT_COSTO_SIN, PT_COMENSALES) VALUES (${ticketId}, ${tipoVenta}, ${mesero}, ${c.GetString("CANT_CLIE")}, ${c.GetString("TOTAL_CLIE")}, ${mesa}, ${c.GetString("TOTAL_CLIE_SIN")}, ${comensales})"$)
|
||||
End Sub
|
||||
|
||||
Sub agrupador()
|
||||
@@ -1391,19 +1389,18 @@ Sub traeConsecutivoTicket(estatus As String, pago As String) As String
|
||||
Private m As String = "00000"
|
||||
Private sqlPago As String = $"M_PAGO = '${pago}'"$
|
||||
If pago = "PENDIENTE" Then sqlPago = $"M_PAGO is NULL"$
|
||||
If pago = "EFECTIVO" Then
|
||||
Private c As Cursor = Starter.skmt.ExecQuery($"select max(PE_TICKET) as ultimo from PEDIDO where PE_TIPO = 'EFECTIVO'"$)
|
||||
If pago = "EFECTIVO" Or pago = "TARJETA" Then
|
||||
Private c As Cursor = Starter.skmt.ExecQuery($"select max(PE_TICKET) as ultimo from PEDIDO where PE_TIPO = '${pago}'"$)
|
||||
Else
|
||||
Private c As Cursor = Starter.skmt.ExecQuery($"select max(M_TICKET) as ultimo from CAT_MESAS where ifnull(M_ESTATUS, 'CERRADA') = '${estatus}' and ${sqlPago}"$)
|
||||
End If
|
||||
|
||||
Log($"select max(M_TICKET) as ultimo from CAT_MESAS where ifnull(M_ESTATUS, 'CERRADA') = '${estatus}' and ${sqlPago}"$)
|
||||
' Log($"select max(M_TICKET) as ultimo from CAT_MESAS where ifnull(M_ESTATUS, 'CERRADA') = '${estatus}' and ${sqlPago}"$)
|
||||
If c.RowCount > 0 Then
|
||||
c.Position = 0
|
||||
Log("|" & c.GetString("ultimo") & "|")
|
||||
' Log("|" & c.GetString("ultimo") & "|")
|
||||
If c.GetString("ultimo") <> Null And c.GetString("ultimo") <> "null" Then m = NumberFormat2(c.GetString("ultimo"), 5, 0,0, False)
|
||||
End If
|
||||
Log(m + 1)
|
||||
' Log(m + 1)
|
||||
Return NumberFormat2(m+1, 5, 0, 0, False)
|
||||
End Sub
|
||||
|
||||
@@ -1418,6 +1415,37 @@ Sub traeMesaEstatus(id As String) As String
|
||||
Return e
|
||||
End Sub
|
||||
|
||||
'Regresa verdadero si el cierre adminstrativo esta en 1
|
||||
Sub revisaCierreAdmin As Boolean
|
||||
Private c As Cursor = Starter.skmt.ExecQuery2("select CAT_VA_VALOR from CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = ?", Array As String ("CIERRE ADMIN"))
|
||||
Private cierre As Boolean = False
|
||||
If c.RowCount > 0 Then
|
||||
c.Position = 0
|
||||
If c.GetString("CAT_VA_VALOR") = 1 Then
|
||||
' B4XPages.MainPage.principal.p_transparenteCierreAdmin.BringToFront
|
||||
' B4XPages.MainPage.principal.p_transparenteCierreAdmin.Visible = True
|
||||
cierre = True
|
||||
Else
|
||||
' B4XPages.MainPage.principal.p_transparenteCierreAdmin.Visible = False
|
||||
End If
|
||||
End If
|
||||
Return cierre
|
||||
End Sub
|
||||
|
||||
'Change CheckBox colors
|
||||
Sub SetButtonTintList(View As View, Disabled As Int, Enabled As Int)
|
||||
Dim States(2,1) As Int
|
||||
Dim sd As StateListDrawable 'ignore
|
||||
States(0, 0) = sd.State_Enabled
|
||||
States(1, 0) = sd.State_Disabled
|
||||
Dim Color(2) As Int = Array As Int(Enabled, Disabled)
|
||||
Dim CSL As JavaObject
|
||||
CSL.InitializeNewInstance("android.content.res.ColorStateList",Array(States,Color))
|
||||
Dim jo As JavaObject
|
||||
jo.InitializeStatic("android.support.v4.widget.CompoundButtonCompat")
|
||||
jo.RunMethod("setButtonTintList", Array(View, CSL))
|
||||
End Sub
|
||||
|
||||
|
||||
'CAT_GUNAPRODS, CAT_MESAS y CAT_MESEROS
|
||||
'1782
|
||||
@@ -1425,3 +1453,10 @@ End Sub
|
||||
'DBKMT
|
||||
'LANTER
|
||||
'LANTERD2023M
|
||||
'sql.selectProds_Lanter = Select * from cat_gunaprod
|
||||
'sql.selectMesas_Lanter = Select * from cat_mesas
|
||||
'sql.selectMeseros_Lanter = Select * from cat_meseros
|
||||
|
||||
'CREATE TABLE CAT_GUNAPROD (CAT_GP_CODPROMO TEXT, CAT_GP_INICIATIVA TEXT, CAT_GP_TIPOPROD TEXT, CAT_GP_DEV TEXT, CAT_GP_ALMACEN NUMERIC, CAT_GP_ID TEXT, CAT_GP_NOMBRE TEXT, CAT_GP_IMP1 TEXT, CAT_GP_IMP2 TEXT, CAT_GP_PRECIO TEXT, CAT_GP_CLASIF TEXT, CAT_GP_STS TEXT, CAT_GP_TIPO TEXT, CAT_GP_SUBTIPO TEXT, CAT_GP_IMG BLOB, CAT_PT_DESC TEXT, CAT_PS_DESC TEXT, CAT_GP_FECHA TEXT, CAT_GP_FECHA_MOD TEXT)
|
||||
'CREATE TABLE "CAT_MESAS"(M_ID TEXT, M_NUMERO TEXT, M_NOMBRE TEXT, M_ZONA TEXT, M_ESTATUS TEXT, M_MESERO TEXT, M_PAGO TEXT, M_TICKET TEXT, M_COMENSALES INTEGER)
|
||||
'CREATE TABLE CAT_MESEROS(MS_ID TEXT, MS_NOMBRE TEXT, MS_MESAS_ASIGNADAS TEXT)
|
||||
Reference in New Issue
Block a user