mirror of
https://github.com/KeymonSoft/Lanterna.git
synced 2026-04-20 22:29:17 +00:00
Cierre administativo, cierre de mesa sin venta y envio de errores a push_info
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user