- Se corrigio que la pantalla de reasignar mesa se muestre bien.

- Se agregó que cuando se descargue informacion de web, si había mesas abiertas, se regrese la informacion a CAT_MESAS.
- Se corrigio el como se ven los campos cuando se cierra la mesa.
This commit is contained in:
2024-04-28 17:06:56 -06:00
parent 4aa7b60f6a
commit a78af8bb87
8 changed files with 320 additions and 156 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,20 +1,29 @@
Build1=Default,lanterna2.keymon.lat,HU2_PUBLIC
Build1=Default,lanterna_h.keymon.lat,HU2_PUBLIC
File1=candado.png
File10=logoLanter2.bmp
File11=logoLanterNegro.bmp
File12=logoLanterNegro.png
File13=logoLanterNegro2.bmp
File14=principal.bal
File15=proditem.bal
File16=usuario.png
File10=logo.png
File11=logolanter.bmp
File12=logoLanter.png
File13=logoLanter_192x192.png
File14=logoLanter2.bmp
File15=logoLanterNegro.bmp
File16=logoLanterNegro.png
File17=logoLanterNegro2.bmp
File18=mainpage.bal
File19=mesasitem.bal
File2=durakelo.png
File20=principal.bal
File21=proditem.bal
File22=proditemcarrito.bal
File23=resumencont.bal
File24=usuario.png
File25=vecteezy_white-diagonal-stripes-with-red-line-isolated-on-white.png
File3=engrane.png
File4=engranes.png
File5=Layout.bal
File6=login.bal
File7=logo.png
File8=logoLanter.png
File9=logoLanter_192x192.png
File5=errormanager.bal
File6=formapago.bal
File7=kmt.db
File8=Layout.bal
File9=login.bal
FileGroup1=Default Group
FileGroup10=Default Group
FileGroup11=Default Group
@@ -23,7 +32,16 @@ FileGroup13=Default Group
FileGroup14=Default Group
FileGroup15=Default Group
FileGroup16=Default Group
FileGroup17=Default Group
FileGroup18=Default Group
FileGroup19=Default Group
FileGroup2=Default Group
FileGroup20=Default Group
FileGroup21=Default Group
FileGroup22=Default Group
FileGroup23=Default Group
FileGroup24=Default Group
FileGroup25=Default Group
FileGroup3=Default Group
FileGroup4=Default Group
FileGroup5=Default Group
@@ -58,7 +76,7 @@ Module4=numeroATexto
Module5=Principal
Module6=Starter
Module7=Subs
NumberOfFiles=16
NumberOfFiles=25
NumberOfLibraries=18
NumberOfModules=7
Version=12.8
@@ -66,7 +84,7 @@ Version=12.8
#Region Project Attributes
#ApplicationLabel: Lanterna
#VersionCode: 1
#VersionName: 4.04.18
#VersionName: 4.04.28
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: landscape
#CanInstallToExternalStorage: False
@@ -151,6 +169,11 @@ Sub Activity_Create(FirstTime As Boolean)
' Starter.skmt.ExecNonQuery2("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = ?", Array As Object ("DESCUENTO X EFECTIVO"))
Starter.skmt.ExecNonQuery2("INSERT INTO CAT_VARIABLES(CAT_VA_DESCRIPCION, CAT_VA_VALOR) VALUES (?,?)", Array As Object ("DESCUENTO X EFECTIVO","10"))
End If
Private z As ResultSet = Starter.skmt.ExecQuery2("select * from CAT_VARIABLES where CAT_VA_DESCRIPCION = ?", Array As String ("IMPRESION_ACTIVA"))
If z.RowCount = 0 Then
Log("Guardamos impresion como true")
Starter.skmt.ExecNonQuery2("INSERT INTO CAT_VARIABLES(CAT_VA_DESCRIPCION, CAT_VA_VALOR) VALUES (?,?)", Array As Object ("IMPRESION_ACTIVA", True))
End If
End Sub
Sub Activity_Resume
@@ -163,11 +186,21 @@ Sub Activity_Resume
Starter.imprimirTicket = ia
End Sub
Sub Activity_KeyPress (key As Int) As Boolean
' BACK key pressed
If key=KeyCodes.KEYCODE_BACK Then
p_configuracion.Visible = False
Subs.panelVisible(p_login, 0, 0)
End If
Return True
' Returning False signals the system to handle the key
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Private Sub i_logo_Click
End Sub
@@ -234,6 +267,10 @@ Private Sub i_conf_Click
p_configuracion.Height = Activity.Height
p_configuracion.BringToFront
Subs.panelVisible(p_configuracion, 0, 0)
Private z As ResultSet = Starter.skmt.ExecQuery2("select * from CAT_VARIABLES where CAT_VA_DESCRIPCION = ?", Array As String ("IMPRESION_ACTIVA"))
Do While z.NextRow
If z.GetString("CAT_VA_VALOR") = 1 Then cb_impresionActiva.Checked = True
Loop
End Sub
Private Sub b_cargaProductos_Click
@@ -311,6 +348,14 @@ Sub JobDone(Job As HttpJob)
Next
Starter.skmt.TransactionSuccessful 'Si no se pone TransactionSuccessful no se escribe NADA!!
Starter.skmt.EndTransaction
'Revisamos si con la carga de la información no se borró la info de alguna mesa abierta.
Private m As ResultSet = Starter.skmt.ExecQuery($"select distinct M_ID, PT_PAGO, PT_TICKET, PT_MESERO, PT_COMENSALES from PEDIDO_TICKET join CAT_MESAS on PT_MESA = M_ID where PT_PAGO = 'VENTA' and M_ESTATUS is null "$)
Log(m.RowCount)
Do While m.NextRow ' Si hay registros en pedido_ticket, entonces atualizamos CAT_MESAS con la info faltante.
Log($"${m.GetString("M_ID")}, ${m.GetString("PT_PAGO")}, ${m.GetString("PT_TICKET")}, ${m.GetString("PT_MESERO")}, ${m.GetString("PT_COMENSALES")}"$)
Starter.skmt.ExecNonQuery($"update CAT_MESAS set M_ESTATUS = 'ABIERTA', M_TICKET = '${m.GetString("PT_TICKET")}', M_MESERO = '${m.GetString("PT_MESERO")}', M_COMENSALES = '${m.GetString("PT_COMENSALES")}' where M_ID = '${m.GetString("M_ID")}' "$)
Loop
End If
If result.Tag = "selectMeseros" Then 'query tag
@@ -327,7 +372,7 @@ Sub JobDone(Job As HttpJob)
Starter.skmt.TransactionSuccessful 'Si no se pone TransactionSuccessful no se escribe NADA!!
Starter.skmt.EndTransaction
' If Principal.cb_mesero.IsInitialized Then Principal.cb_mesero.SetItems(Subs.traeMeserosLista)
Starter.cargaMeseros = true
Starter.cargaMeseros = True
End If
End If
End If

View File

@@ -14,14 +14,14 @@ ModuleBreakpoints4=
ModuleBreakpoints5=
ModuleBreakpoints6=
ModuleBreakpoints7=
ModuleClosedNodes0=
ModuleClosedNodes0=4,5,6
ModuleClosedNodes1=
ModuleClosedNodes2=
ModuleClosedNodes3=
ModuleClosedNodes4=
ModuleClosedNodes5=2
ModuleClosedNodes5=2,3,5
ModuleClosedNodes6=
ModuleClosedNodes7=
NavigationStack=Main,Globals,49,0,Principal,b_mesaCerrar_Click,1195,0,Principal,l_prodX_Click,2803,0,Principal,LlenaProdsLL,627,0,Principal,clv_prods_ll_VisibleRangeChanged,660,0,Principal,clv_orden_VisibleRangeChanged,2831,6,Principal,LlenaOrden,2871,0,Principal,l_selAlimentos_Click,2969,0,Principal,actualizaProductos,2912,6,Principal,l_prods_Click,281,1
NavigationStack=Principal,resalta,335,0,Main,b_cargaProductos_Click,210,6,Principal,Activity_Create,262,6,Principal,p_mesasItem_Click,1139,0,Principal,b_mesaEditar_Click,1274,0,Principal,b_abrirMesa_Click,1205,2,Principal,b_leyendaDescuento_Click,2675,4,Main,JobDone,271,5,Visual Designer,principal.bal,-100,6,Principal,et_selBuscar_FocusChanged,3090,0,Principal,l_selVinos_Click,3072,0
SelectedBuild=0
VisibleModules=6,7,5
VisibleModules=6,5,7

View File

@@ -85,7 +85,7 @@ Sub Globals
Private l_opcionEfectivo As Label
Private CheckBox1 As CheckBox
Private cb_opcionEfectivo As CheckBox
Private p_transparenteVerOrden As Panel
' Private p_transparenteVerOrden As Panel
Private p_verOrden As Panel
Private l_verOrden As Label
Private lv_verOrden As ListView
@@ -99,11 +99,11 @@ Sub Globals
Private p_principal As Panel
Dim WobbleMenu1 As WobbleMenu
Dim PCLV, PCLVM As PreoptimizedCLV
Private p_meseros As Panel
Private p_about As Panel
Private clv_prods_ll, clv As CustomListView
' Private p_botonesVenta As Panel
Private b_continuar As Button
Private l_inventarios As Label
Private l_about As Label
' Private et_busca As EditText
' Private b_buscar As Button
' Private lv_promos As ListView
@@ -144,7 +144,7 @@ Sub Globals
Private p_mesaAbierta As Panel
Private lv_categorias As ListView
Private p_pago As Panel
Private Label1 As Label
' Private Label1 As Label
Private b_pagoCerrar As Button
Private b_cierraAdmin As Button
Private b_cierreTotal As Button
@@ -160,10 +160,14 @@ Sub Globals
Private p_contProductos As Panel
Private l_selAlimentos As Label
Private l_selVinos As Label
dim selBuscar as string = ""
Dim selBuscar As String = ""
Private et_selBuscar As EditText
Private Button1 As Button
Private l_panelEnUso As Label
Private l_about2 As Label
Private i_logo As ImageView
Private l_tituloHistorial As Label
Private p_prevBusqueda As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
@@ -177,31 +181,35 @@ Sub Activity_Create(FirstTime As Boolean)
PCLV.Initialize(Me, "PCLV", clv_prods_ll)
PCLVM.Initialize(Me, "PCLVM", clv_mesas)
WobbleMenu1.SetTabTextIcon(1,"Mesas", Chr(0xF00A), Typeface.FONTAWESOME)
WobbleMenu1.SetTabTextIcon(2,"Inventario", Chr(0xF16B), Typeface.FONTAWESOME)
WobbleMenu1.SetTabTextIcon(3,"Ordenes", Chr(0xF155), Typeface.FONTAWESOME)
WobbleMenu1.SetTabTextIcon(2,"Ordenes", Chr(0xF155), Typeface.FONTAWESOME)
WobbleMenu1.SetTabTextIcon(3,"Acerca de", Chr(0xF16B), Typeface.FONTAWESOME)
' WobbleMenu1.SetTabTextIcon(5,"Cinco", Chr(0xF29D), Typeface.FONTAWESOME)
p_principal.Width = Activity.Width
p_principal.Height = Activity.Height
clv_prods_ll.GetBase.SetLayoutAnimated(0, 400dip, 10dip, Activity.Width - 430, Activity.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_mesas.GetBase.SetLayoutAnimated(0, 5dip, 80dip, Activity.Width - 20, Activity.Height * 0.80) 'Cambiamos el tamaño y posición de la lista de mesas.
clv_mesas.GetBase.SetLayoutAnimated(0, 10dip, 80dip, clv_mesas.GetBase.Width, clv_mesas.GetBase.Height) '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.
' clv_orden.GetBase.SetLayoutAnimated(0, 10dip, 10dip, clv_orden.GetBase.Width, Activity.Height - 220dip) 'Cambiamos el tamaño y posición de la lista de ordenes.
' clv_orden.Base_Resize(clv_orden.GetBase.Width, clv_orden.GetBase.Height) 'Cambiamos el tamaño del panel interno de la lista para que se ajuste al nuevo tamaño.
' Log(Activity.Height - 220)
p_meseros.Width = Activity.Width
p_meseros.Height = Activity.Height - WobbleMenu1.Height
p_about.Width = Activity.Width
p_about.Height = Activity.Height - WobbleMenu1.Height
Subs.centraEtiqueta(l_about, p_about.Width)
Subs.centraEtiqueta(l_about2, p_about.Width)
i_logo.Left = Round(p_about.Width/2)-(i_logo.Width/2)
p_mesas.Width = Activity.Width
p_mesaAbierta.Height = Activity.Height : p_mesaAbierta.width = Activity.width
p_mesas.Height = Activity.Height - WobbleMenu1.Height
p_mesas.Height = Activity.Height ' - WobbleMenu1.Height
p_historial.Width = Activity.Width
p_historial.Height = Activity.Height - WobbleMenu1.Height
Subs.centraPanel(p_cierreAdmin, Activity.Width)
Subs.centraPanel(p_cambioMesa, p_transparenteCambioMesa.Width)
p_transparenteCambioMesa.Top = 0 : p_transparenteCambioMesa.Left = 0
p_transparenteCambioMesa.Height = Activity.Height : p_transparenteCambioMesa.width = Activity.width
p_transparenteVerOrden.Left = 0 : p_transparenteVerOrden.top = 0
p_transparenteVerOrden.Height = Activity.Height : p_transparenteVerOrden.width = Activity.width
' p_transparenteVerOrden.Left = 0 : p_transparenteVerOrden.top = 0
' p_transparenteVerOrden.Height = Activity.Height : p_transparenteVerOrden.width = Activity.width
Subs.panelWH(p_transparenteCierreAdmin, Activity.Width, Activity.Height)
p_transparenteCierreAdmin.Top = 0 : p_transparenteCierreAdmin.left = 0
Subs.panelWH(p_transparenteResumen, Activity.Width, Activity.Height)
@@ -211,9 +219,20 @@ Sub Activity_Create(FirstTime As Boolean)
p_transparenteDescuento.Top = 0 : p_transparenteDescuento.left = 0
sv_resumen.Panel.LoadLayout("resumenCont")
Subs.centraEtiqueta(l_pago, p_pago.Width)
Subs.centraEtiqueta(l_tituloHistorial, Activity.Width)
Subs.centraPanel(p_propina, p_pago.Width)
' Subs.centraBoton(b_pagoCerrar, p_pago.Width)
Subs.centraPanel(p_botonesCerrar, p_pago.Width)
p_contProductos.Width = Activity.Width - p_contProductos.Left - 10dip
p_contProductos.Height = Activity.Height - (p_mesaAbierta.Top + 1) - (WobbleMenu1.Height - 10dip) '165dip - 90dip
' Log($"${Activity.Height} - ${p_mesaAbierta.Top + 1} - ${(WobbleMenu1.Height - 10dip)}"$) ' - 90dip
' Log($"${Activity.Height - (p_mesaAbierta.Top + 1) - (WobbleMenu1.Height - 10dip)}"$) '- 90dip
p_productos1.Width = p_contProductos.Width - 30dip : p_productos1.height = p_contProductos.height - 60dip
p_productos2.Width = p_productos1.Width : p_productos2.Height = p_productos1.Height
p_productos3.Width = p_productos1.Width : p_productos3.Height = p_productos1.Height
p_productos4.Width = p_productos1.Width : p_productos4.Height = p_productos1.Height
Dim cs As CSBuilder
cs.Initialize
l_inicioDia.Text = cs.append("Para iniciar día, ingrese el texto ").bold.Append("INICIO DIA").Pop.Append(" y la tecla ").Bold.Append("Retorno").Pop.Append(" del teclado.").Color(Colors.red).Append(" Los datos del día anterior se borraran.").Popall
@@ -224,9 +243,9 @@ Sub Activity_Create(FirstTime As Boolean)
' Subs.centraPanel(p_botonesProds, p_mesaAbierta.Width)
Subs.centraPanel(p_mesaCampos, Activity.Width)
Subs.centraPanel(p_mesaAbierta, Activity.Width)
lv_historial.Height = Activity.Height * 0.7
lv_historial.Height = Activity.Height * 0.4
p_botonesCierre.Top = lv_historial.Top + lv_historial.Height + 20dip
Subs.centraPanel(p_botonesCierre, p_historial.Width)
' Subs.centraPanel(p_botonesCierre, p_historial.Width)
prodsMap.Initialize
listaProds.Initialize
listaHints.Initialize
@@ -259,33 +278,59 @@ End Sub
Sub l_prods_Click
Private tlbl As Label = Sender
Log(tlbl.text)
Log(tlbl.tag)
' Log(tlbl.text)
' Log(tlbl.tag)
tlbl.Color = Colors.LightGray
Sleep(200)
tlbl.Color = Colors.white
Log("clicked")
Log(tlbl.tag)
' Log("clicked")
Private m As Map = tlbl.tag
Log(listaProdsOrden.IndexOf(m.Get("id")))
' Log(listaProdsOrden.IndexOf(m.Get("id")))
' Log(listaProdsOrden)
Private indice As String = listaProdsOrden.IndexOf(m.Get("id"))
Try
If indice = -1 Then
If indice = -1 Then ' No esta en la orden y lo agregamos con cantidad 1.
Private Pnl As B4XView = xui.CreatePanel("")
Pnl.SetLayoutAnimated(0, 0, 0, clv_orden.AsView.Width, 40dip)
clv_orden.Add(Pnl, CreateMap("prod":m.Get("prod"), "precio":m.Get("precio"), "almacen":m.Get("almacen"), "id":m.Get("id"), "cant":1, "img":Null))
Subs.actualizaProducto(m.Get("precio"), 1, m.Get("prod"), m.Get("id"), Starter.ticketActual, Subs.traeFecha, Starter.meseroActual, Starter.mesaActual, 0, Starter.tipov, Starter.comensalesActuales)
Else
Sleep(200)
clv_orden.ScrollToItem(clv_orden.Size - 1)
Sleep(100)
' clv_orden.GetPanel(clv_orden.Size - 1).GetView(0).Color = Colors.RGB(0,230,0) 'Resaltamos el articulo.k
' resalta(clv_orden.GetPanel(clv_orden.Size - 1).GetView(0))
Try 'Si se presionan muy rapido los productos, a veces manda error de que no esta inicializada la vista.
Wait For (resalta(clv_orden.GetPanel(clv_orden.Size - 1).GetView(0))) Complete (Completed As Object)
Catch
Log(LastException)
End Try
' Sleep(400)
' clv_orden.GetPanel(clv_orden.Size - 1).GetView(0).Color = 0xFFE2EEFF 'Regresamos el color original.
Else 'Ya esta en la orden, le sumamos 1 a la cantidad.
Log(clv_orden.GetValue(indice).As(Map).Get("cant"))
Private newCant As Int = clv_orden.GetValue(indice).As(Map).Get("cant") + 1
clv_orden.GetValue(indice).As(Map).put("cant", newCant)
clv_orden.GetPanel(indice).GetView(0).GetView(2).GetView(4).As(EditText).text = newCant 'getview(0) = p_prods, getview(2) = p_botMasMen, getview(4) = et_pCant
Subs.actualizaProducto(m.Get("precio"), newCant, m.Get("prod"), m.Get("id"), Starter.ticketActual, Subs.traeFecha, Starter.meseroActual, Starter.mesaActual, 0, Starter.tipov, Starter.comensalesActuales)
End If
If indice > -1 Then
' Log($"Brincamos a ${indice}"$)
clv_orden.ScrollToItem(indice)
clv_orden.GetPanel(indice).GetView(0).Color = Colors.RGB(0,230,0) 'Resaltamos el articulo
Sleep(400)
clv_orden.GetPanel(indice).GetView(0).Color = 0xFFE2EEFF
End If
Catch
Log(LastException)
End Try
' Log(listaProdsOrden)
End Sub
Sub resalta(p As Panel) As ResumableSub
p.Color = Colors.RGB(0,230,0) 'Resaltamos el articulo.k
Sleep(400)
p.Color = 0xFFE2EEFF 'Regresamos el color original.
Return 1
End Sub
Sub Activity_Resume
@@ -333,7 +378,7 @@ Sub Activity_Resume
PCLVM.pnlOverlay.Height = clv_mesas.AsView.Height
PCLVM.pnlOverlay.Width = clv_mesas.AsView.Width
PCLVM.B4XSeekBar1.Update
p_meseros.Height = Activity.Height - WobbleMenu1.Height
p_about.Height = Activity.Height - WobbleMenu1.Height
If p_mesas.Visible And Subs.revisaCierreAdmin Then
p_transparenteCierreAdmin.BringToFront
p_transparenteCierreAdmin.Visible = True
@@ -374,7 +419,10 @@ End Sub
Sub Activity_KeyPress (key As Int) As Boolean
' BACK key pressed
If key=KeyCodes.KEYCODE_BACK Then
If p_transparenteDescuento.Visible Then
If p_prevBusqueda.Visible Then
p_prevBusqueda.Visible = False
' et_selBuscar.h
else If p_transparenteDescuento.Visible Then
p_transparenteDescuento.Visible = False
else If lv_categorias.Visible And n = 0 Then 'Or Starter.catActual = "VARIOS") And Starter.nivelActual = "SubCats"
clv_prods_ll.AsView.Visible = False
@@ -387,9 +435,6 @@ Sub Activity_KeyPress (key As Int) As Boolean
Else If p_reabrirMesaMulti.Visible Then
Log(1)
p_reabrirMesaMulti.Visible = False
Else If p_transparenteVerOrden.Visible Then
Log(2)
p_transparenteVerOrden.Visible = False
else If p_renombraVarios.Visible Then
Log(3)
p_renombraVarios.Visible = False
@@ -422,7 +467,7 @@ Sub Activity_KeyPress (key As Int) As Boolean
LlenaMesas(Null, Null)
Else if p_transparenteResumen.Visible Then
p_transparenteResumen.Visible = False
else if WobbleMenu1.GetCurrentTab = 3 Or WobbleMenu1.GetCurrentTab = 2 Then
else if WobbleMenu1.GetCurrentTab = 2 Or WobbleMenu1.GetCurrentTab = 3 Then
WobbleMenu1.SetCurrentTab(1)
WobbleMenu1_Tab1Click
else if WobbleMenu1.GetCurrentTab = 1 Then
@@ -435,7 +480,7 @@ Sub Activity_KeyPress (key As Int) As Boolean
End Sub
Sub muestraCats
Log("MUESTRA CATS")
' Log("MUESTRA CATS")
Private lasCats As List = Subs.traeCategorias
Starter.nivelActual = "Cats"
lv_categorias.Clear
@@ -459,7 +504,7 @@ Sub b_prodMenos_Click
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)
If WobbleMenu1.GetCurrentTab = 2 Then laCant = pnl.GetView(2).GetView(4)
' Log($"${pnl.GetView(1)}${CRLF}${pnl.GetView(2).GetView(2)}${CRLF}${pnl.GetView(2).GetView(3)}${CRLF}${pnl.GetView(2).GetView(4)}"$)
If buttonTag = "vendido" And laCant.Text > 0 Then
' Log(clv.GetValue(index).As(Map))
@@ -489,7 +534,7 @@ Sub b_prodMenos_Click
cuentaProds
Dim cs As CSBuilder
cs.Initialize
If WobbleMenu1.GetCurrentTab = 3 Then
If WobbleMenu1.GetCurrentTab = 2 Then
Private elTexto As String = clv.GetValue(index).As(Map).Get("prod")
Private elPrecioU As String = clv.GetValue(index).As(Map).Get("precio")
Private elTotal As String = elPrecioU * laCant.text
@@ -508,7 +553,7 @@ Sub b_prodMas_Click
Dim pnl As B4XView = pnl0.GetView(0)
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)
If WobbleMenu1.GetCurrentTab = 2 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)}"$)
If laCant.Text = "" Then laCant.Text = 0
Private precio As String=clv.GetValue(index).As(Map).Get("precio")
@@ -535,7 +580,7 @@ Sub b_prodMas_Click
cuentaProds
Dim cs As CSBuilder
cs.Initialize
If WobbleMenu1.GetCurrentTab = 3 Then
If WobbleMenu1.GetCurrentTab = 2 Then
Private elTexto As String = clv.GetValue(index).As(Map).Get("prod")
Private elPrecioU As String = clv.GetValue(index).As(Map).Get("precio")
Private elTotal As String = elPrecioU * laCant.text
@@ -556,13 +601,13 @@ Sub cuentaProds
Private total0 As String = "0"
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'")
Private p As Cursor = Starter.skmt.ExecQuery($"select count(PT_TICKET) as ordenes from pedido_TICKET where PT_PAGO <> 'MULTI-TICKET' and 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)}"$
c.Close
If WobbleMenu1.GetCurrentTab = 3 Then LlenaProdsLL(Null, Null)
If Subs.hayPedido Then WobbleMenu1.SetBadge(3, p.GetString("ordenes"), Colors.white, Colors.red) Else WobbleMenu1.RemoveBadge(3)
If WobbleMenu1.GetCurrentTab = 2 Then LlenaProdsLL(Null, Null)
If Subs.hayPedido Then WobbleMenu1.SetBadge(2, p.GetString("ordenes"), Colors.white, Colors.red) Else WobbleMenu1.RemoveBadge(2)
End Sub
Sub LlenaProdsLL(p As ResultSet, extra As String)
@@ -814,42 +859,27 @@ Private Sub WobbleMenu1_Tab1Click
p_transparenteCierreAdmin.Visible = True
Else
p_transparenteCierreAdmin.Visible = False
p_mesas.BringToFront
p_mesas.Visible = True
End If
cuentaProds
LlenaMesas(Null, Null)
' LlenaProdsLL(Null, Null)
Subs.panelVisible(p_mesas, 0, 0)
PCLVM.B4XSeekBar1.mBase.Visible = True
PCLVM.B4XSeekBar1.mBase.Visible = False
' PCLV.B4XSeekBar1.mBase.Visible = False
p_meseros.Visible = False
p_about.Visible = False
' p_carrito.Visible = False
p_historial.Visible = False
p_mesa.Visible = False
' p_mesa.Visible = False
p_transparenteResumen.Visible = False
End Sub
Private Sub WobbleMenu1_Tab2Click
' Log("TAB 2")
LlenaProdsLL(Null, Null)
' PCLVM.B4XSeekBar1.mBase.Visible = False
' PCLV.B4XSeekBar1.mBase.BringToFront
' PCLV.B4XSeekBar1.mBase.Visible = True
Subs.panelVisible(p_meseros, 0, 0)
p_mesas.Visible = False
' p_carrito.Visible = False
p_transparenteCierreAdmin.Visible = False
p_historial.Visible = False
p_mesa.Visible = False
p_transparenteResumen.Visible = False
actualizaProductos("Alimentos")
' For w = 0 To 150
'
' Next
End Sub
Private Sub WobbleMenu1_Tab3Click
' Log("TAB 3")
p_verOrden.Visible = False
Subs.panelVisible(p_historial, 0, 0)
p_meseros.Visible = False
p_about.Visible = False
' p_carrito.Visible = False
p_mesas.Visible = False
p_mesa.Visible = False
@@ -864,6 +894,25 @@ Private Sub WobbleMenu1_Tab3Click
llenaHistorial
End Sub
Private Sub WobbleMenu1_Tab3Click
' Log("TAB 3")
LlenaProdsLL(Null, Null)
' PCLVM.B4XSeekBar1.mBase.Visible = False
' PCLV.B4XSeekBar1.mBase.BringToFront
' PCLV.B4XSeekBar1.mBase.Visible = True
Subs.panelVisible(p_about, 0, 0)
p_mesas.Visible = False
' p_carrito.Visible = False
p_transparenteCierreAdmin.Visible = False
p_historial.Visible = False
p_mesa.Visible = False
p_transparenteResumen.Visible = False
actualizaProductos("Alimentos")
' For w = 0 To 150
'
' Next
End Sub
Private Sub b_continuar_Click
WobbleMenu1.SetCurrentTab(2)
End Sub
@@ -973,10 +1022,6 @@ Private Sub b_borrar_Click
' End If
End Sub
Private Sub lv_historial_ItemClick (Position As Int, Value As Object)
End Sub
Private Sub clv_mesas_VisibleRangeChanged (FirstIndex As Int, LastIndex As Int)
' Log($"clv_mesa_VisibleRangeChanged : ${FirstIndex}, ${LastIndex} "$)
Dim ExtraSize As Int = 30 'List size
@@ -987,10 +1032,16 @@ Private Sub clv_mesas_VisibleRangeChanged (FirstIndex As Int, LastIndex As Int)
If i > FirstIndex - ExtraSize And i < LastIndex + ExtraSize Then
If Pnl.NumberOfViews = 0 Then 'Add each item/layout to the list/main layout
Pnl.LoadLayout("mesasItem")
p_mesasItem.Width = Activity.Width * 0.99
Pnl.Width = Pnl.Parent.Width - 1
Pnl.Left = 1dip
p_mesasItem.Width = p_mesasItem.Parent.As(Panel).Width - 1
p_mesasItem.Height = p_mesasItem.Parent.As(Panel).Height - 1dip
l_mesaX.Width = p_mesasItem.Width * 0.7
l_estatus.Width = p_mesasItem.Width * 0.26
l_estatus.Left = l_mesaX.left + l_mesaX.Width
Private cs As CSBuilder
cs.Initialize
l_mesaX.SetTextSizeAnimated(0, 13)
l_mesaX.TextSize = 13
l_estatus.text = "DISPONIBLE"
' Log(m)
If m.Get("estatus") = "ABIERTA" Then l_estatus.Text = "ABIERTA"
@@ -1012,9 +1063,9 @@ 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'")
Private o As Cursor = Starter.skmt.ExecQuery("select count(PT_TICKET) as ordenes from pedido_TICKET where PT_PAGO <> 'MULTI-TICKET' and 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)
If o.GetInt("ordenes") > 0 Then WobbleMenu1.SetBadge(2, o.GetInt("ordenes"), Colors.white, Colors.red) Else WobbleMenu1.RemoveBadge(2)
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 order by ESTATUS2, cast(M_ID as INTEGER)"$)
' Log(p.RowCount)
PCLVM.Commit
@@ -1054,6 +1105,7 @@ End Sub
'Entramos a la mesa seleccionada.
Private Sub p_mesasItem_Click
Log("Entramos a la mesa")
listaProdsOrden.Initialize
listaFormasDePagoCB.Initialize
listaFormaDePago.Initialize
listaMontoDePago.Initialize
@@ -1062,7 +1114,7 @@ Private Sub p_mesasItem_Click
tipoPago = "VENTA"
muestraCats
clv_prods_ll.AsView.Visible = False
p_buscar.Visible = True
' p_buscar.Visible = True
lv_categorias.Visible = True
' Log(Sender.As(Panel).tag)
b_abrirMesa.Text = "Abrir Mesa"
@@ -1102,7 +1154,6 @@ Private Sub p_mesasItem_Click
l_meseroAbierta2.Text = m.Get("mesero")
l_comensalesAbierta2.Text = m.Get("comensales")
End If
Private tm As Map = CreateMap("ticket":m.Get("ticket"), "pago":tipoPago)
listaTickets.Initialize
listaTickets.Add(tm) 'Agregamos el ticket y pago a la lista para imprimir el ticket con estos datos al llamar b_imprimirTicket_Click
@@ -1114,7 +1165,7 @@ End Sub
Private Sub p_mesasItem_LongClick
Private m As Map = Sender.As(Panel).tag
If m.Get("estatus") <> "CERRADA" Then
' Log(m)
Log(m)
Private c As Cursor = Starter.skmt.ExecQuery($"select M_ID from CAT_MESAS where ifnull(M_ESTATUS, 0) <> 'ABIERTA' order by M_ID"$)
If c.RowCount > 0 Then
Private listaMesas As List
@@ -1129,6 +1180,8 @@ Private Sub p_mesasItem_LongClick
cb_cambioMesa.SetItems(listaMesas)
l_cambioMesa2.Text = $"Reasignar la mesa ${m.Get("id")} a la mesa:"$
b_cambioMesa.Tag = m.Get("id")
Subs.centraPanel(p_cambioMesa, Activity.Width)
p_transparenteCambioMesa.BringToFront
p_transparenteCambioMesa.Visible = True
End If
End Sub
@@ -1157,6 +1210,7 @@ Private Sub b_abrirMesa_Click
Private c As Cursor = Starter.skmt.ExecQuery($"select M_ESTATUS from CAT_MESAS where M_ID = '${Starter.mesaActual}' and M_ESTATUS = 'ABIERTA'"$)
If c.RowCount > 0 Then
Starter.skmt.ExecNonQuery($"update CAT_MESAS set M_MESERO = '${cb_mesero.SelectedItem}', M_COMENSALES = '${cb_comensales.SelectedItem}' where M_ID = '${Starter.mesaActual}'"$)
Starter.skmt.ExecNonQuery($"update PEDIDO_TICKET set PT_MESERO = '${cb_mesero.SelectedItem}', PT_COMENSALES = '${cb_comensales.SelectedItem}' where PT_MESA = '${Starter.mesaActual}'"$)
Log($"update CAT_MESAS set M_MESERO = '${cb_mesero.SelectedItem}', M_COMENSALES = '${cb_comensales.SelectedItem}' where M_ID = '${Starter.mesaActual}'"$)
Else
Starter.ticketActual = Subs.traeConsecutivoTicket("ABIERTA", "PENDIENTE")
@@ -1202,14 +1256,14 @@ Private Sub b_mesaCerrar_Click
p_formasDePago.Height = 40dip
p_propina.Top = 143dip
p_botonesCerrar.Top = 265dip
p_pago.Height = 330dip
p_pago.Height = 360dip
p_formasDePago.RemoveAllViews
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_transparentePago.Visible = True
p_transparentePago.BringToFront
agregaFormaDePago(l_tipoPago.Left, 0, Starter.formasDePago)
agregaFormaDePago(l_tipoPago.Left, 0, Starter.formasDePago, 60)
et_montoPago2.Text = Subs.traeTotalTicketActual_PT
Starter.totalActual = Subs.traeTotalTicketActual_PT
et_propina.Text = ""
@@ -1259,11 +1313,11 @@ Private Sub lv_categorias_ItemClick (Position As Int, Value As Object)
For cat = 0 To lasCats.Size - 1
lv_categorias.AddSingleLine(lasCats.get(cat))
Next
p_buscar.Visible = True
' p_buscar.Visible = True
Else
lv_categorias.Visible = False
clv_prods_ll.AsView.Visible = True
p_buscar.Visible = True
' p_buscar.Visible = True
Private c 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_PRECIO > 0 And CAT_GP_CLASIF <> 'PROMOS' and CAT_GP_CLASIF = '${Value}' and CAT_GP_TIPO = '${Starter.catActual}' order by CAT_GP_NOMBRE"$)
LlenaProdsLL(c, Null)
End If
@@ -1872,7 +1926,6 @@ Sub b_imp2_Click
'PROPINAS
Private prop As ResultSet = Starter.skmt.ExecQuery($"Select PT_PAGO_PROPINA, sum(PT_PROPINA) As PROPINA from PEDIDO_TICKET where pt_pago <> 'MULTI-TICKET' group by PT_PAGO_PROPINA"$)
If imprimirAqui Then Printer1.WriteString($"${CRLF}"$)
Printer1.WriteString(Printer1.BOLD)
If imprimirAqui Then Printer1.WriteString($"*** PROPINAS *** ${CRLF}"$)
@@ -1880,12 +1933,14 @@ Sub b_imp2_Click
cs.Color(Colors.red).Append($"** PROPINAS **${CRLF}"$).pop
Log("*** PROPINAS ***")
Do While prop.NextRow
Private laPropina As String = prop.GetString("PROPINA")
If imprimirAqui Then Printer1.WriteString($"${prop.GetString("PT_PAGO_PROPINA")}${Subs.alineaDerecha("$"&NumberFormat2(laPropina, 1, 2, 2, True), (30 - prop.GetString("PT_PAGO_PROPINA").Length), ".")} ${CRLF}"$)
cs.Color(Colors.DarkGray).Append($"${prop.GetString("PT_PAGO_PROPINA")}${Subs.alineaDerecha("$"&NumberFormat2(laPropina, 1, 2, 2, True), (30 - prop.GetString("PT_PAGO_PROPINA").Length), ".")} ${CRLF}"$).pop
Log($" ${prop.GetString("PT_PAGO_PROPINA")}${Subs.alineaDerecha("$"&NumberFormat2(laPropina, 1, 2, 2, True), (30 - prop.GetString("PT_PAGO_PROPINA").Length), ".")} "$)
If prop.GetString("PT_PAGO_PROPINA") <> Null Then
Private laPropina As String = prop.GetString("PROPINA")
If imprimirAqui Then Printer1.WriteString($"${prop.GetString("PT_PAGO_PROPINA")}${Subs.alineaDerecha("$"&NumberFormat2(laPropina, 1, 2, 2, True), (30 - prop.GetString("PT_PAGO_PROPINA").Length), ".")} ${CRLF}"$)
Log(prop.GetString("PT_PAGO_PROPINA"))
cs.Color(Colors.DarkGray).Append($"${prop.GetString("PT_PAGO_PROPINA")}${Subs.alineaDerecha("$"&NumberFormat2(laPropina, 1, 2, 2, True), (30 - prop.GetString("PT_PAGO_PROPINA").Length), ".")} ${CRLF}"$).pop
Log($" ${prop.GetString("PT_PAGO_PROPINA")}${Subs.alineaDerecha("$"&NumberFormat2(laPropina, 1, 2, 2, True), (30 - prop.GetString("PT_PAGO_PROPINA").Length), ".")} "$)
End If
Loop
LogColor($">>>>>>> ${Ceil(25.2)}"$, Colors.red)
LogColor($">>>>>>> ${Ceil(25.5)}"$, Colors.red)
@@ -1893,6 +1948,7 @@ Sub b_imp2_Click
' Tarjeta................$910.00
End If
l_resumen.Text = cs
Log(123)
Subs.panelVisible(p_transparenteResumen, 0, 0)
Else
ToastMessageShow("¡Es necesario que NO haya mesas abiertas para realizar el cierre!", True)
@@ -2330,30 +2386,44 @@ End Sub
Private Sub b_agregarPago_Click
Starter.formasDePago = Starter.formasDePago + 1
' Log(Starter.formasDePago)
agregaFormaDePago(l_tipoPago.Left, (70 * (Starter.formasDePago - 1)), Starter.formasDePago)
agregaFormaDePago(l_tipoPago.Left, (60 * (Starter.formasDePago - 1)), Starter.formasDePago, 60)
End Sub
Sub agregaFormaDePago(left0 As Int, top0 As Int, tag0 As Int)
'Agrega una froma de pago al cerrar una mesa
Sub agregaFormaDePago(left0 As Int, top0 As Int, tag0 As Int, brinco As Int)
' Log("agregaFormaDePago |" & top0 & "|" & tag0)
p_opcionEfectivo.Visible = False
Private p_num As Panel
p_num.Initialize("")
p_num.LoadLayout("formaPago")
' Private x As B4XView = p_num
' x.SetColorAndBorder(Colors.gray, 3dip, Colors.Magenta, 0)
' x.Width = 800dip
' p_num = x
' p_num.Width = 700dip
Log(p_formasDePago.Width & "|" & p_num.Width)
' If brinco < l_tipoPago2.Height Then
' Log($"${brinco}|${l_tipoPago2.Height}"$)
' top0 = (top0/brinco) * l_tipoPago2.Height
' brinco = l_tipoPago2.Height
' End If
Log($"${brinco}|${l_tipoPago2.Height}"$)
If Starter.formasDePago > 1 Then
p_propina.Top = p_propina.Top + 70
p_formasDePago.Height = p_formasDePago.Height + 70
p_pago.Height = p_pago.Height + 70
p_botonesCerrar.Top = p_botonesCerrar.Top + 70
p_propina.Top = p_propina.Top + brinco
p_formasDePago.Height = p_formasDePago.Height + brinco
p_pago.Height = p_pago.Height + brinco
p_botonesCerrar.Top = p_botonesCerrar.Top + brinco
End If
l_tipoPago2.Text = $"${Starter.formasDePago}:"$
cb_pago2.Tag = tag0
' cb_pago2.mBase.SetTextSizeAnimated(0, 14dip)
et_montoPago2.Tag = tag0
cb_pago2.SetItems(Array As String("American Express", "Visa/Mastercard Credito","Visa/Mastercard Debito", "Efectivo"))
p_num.Tag = tag0
listaFormasDePagoCB.Add(cb_pago2)
listaFormaDePago.Add(cb_pago2.SelectedItem)
listaMontoDePago.Add(et_montoPago2)
p_formasDePago.AddView(p_num, left0, top0, 340dip, 38dip)
p_formasDePago.AddView(p_num, left0, top0, p_formasDePago.Width, 40dip)
b_pagoCerrar.Enabled = False
If listaFormaDePago.Size > 1 Then l_faltaMonto.Visible = True
End Sub
@@ -2471,9 +2541,10 @@ Private Sub cb_opcionEfectivo_CheckedChange(Checked As Boolean)
If et_montoPago2.IsInitialized Then et_montoPago2.Text = Subs.traeTotalTicketActual_P("VENTA")
End Sub
Private Sub lv_historial_ItemLongClick (Position As Int, Value As Object)
Log(Value)
Private Sub lv_historial_ItemClick (Position As Int, Value As Object)
' Log(Value)
Private d() As String = Regex.Split("\|", Value)
l_verOrden.Text = $"Orden ${d(1)}"$
lv_verOrden.Clear
Private c As Cursor = Starter.skmt.ExecQuery($"select * from PEDIDO where PE_MESA = '${d(0)}' and PE_TICKET = '${d(1)}' and PE_TIPO = '${d(2)}'"$)
' Log($"select * from PEDIDO where PE_MESA = '${d(0)}' and PE_TICKET = '${d(1)}' and PE_TIPO = '${d(2)}'"$)
@@ -2481,8 +2552,9 @@ Private Sub lv_historial_ItemLongClick (Position As Int, Value As Object)
Private Label1 As Label = lv_verOrden.TwoLinesLayout.Label
Private Label2 As Label = lv_verOrden.TwoLinesLayout.SecondLabel
Label1.TextColor = Colors.RGB(1,127,1)
Label1.TextSize = 16
Label1.TextSize = 14
Label2.TextColor = Colors.Red
Label2.TextSize = 14
If c.RowCount > 0 Then
For i = 0 To c.RowCount - 1
c.Position = i
@@ -2492,48 +2564,81 @@ Private Sub lv_historial_ItemLongClick (Position As Int, Value As Object)
lv_verOrden.AddTwoLines($"${c.GetString("PE_CANT")} - ${n1}"$, $"Precio: $${c.GetString("PE_COSTOU")}"$)
Next
End If
p_transparenteVerOrden.Visible = True
p_verOrden.Visible = True
b_reabrirMesa.Tag = Value
End Sub
Private Sub lv_historial_ItemLongClick (Position As Int, Value As Object)
' Log(Value)
' Private d() As String = Regex.Split("\|", Value)
' lv_verOrden.Clear
' Private c As Cursor = Starter.skmt.ExecQuery($"select * from PEDIDO where PE_MESA = '${d(0)}' and PE_TICKET = '${d(1)}' and PE_TIPO = '${d(2)}'"$)
'' Log($"select * from PEDIDO where PE_MESA = '${d(0)}' and PE_TICKET = '${d(1)}' and PE_TIPO = '${d(2)}'"$)
'' Log(c.RowCount)
' Private Label1 As Label = lv_verOrden.TwoLinesLayout.Label
' Private Label2 As Label = lv_verOrden.TwoLinesLayout.SecondLabel
' Label1.TextColor = Colors.RGB(1,127,1)
' Label1.TextSize = 16
' Label2.TextColor = Colors.Red
' Label2.TextSize = 14
' If c.RowCount > 0 Then
' For i = 0 To c.RowCount - 1
' c.Position = i
' Private n1 As String = c.GetString("PE_PRONOMBRE")
'' Log(n.Length & " - " & n)
' If n1.Length > 25 Then n1 = n1.SubString2(0, 25)
' lv_verOrden.AddTwoLines($"${c.GetString("PE_CANT")} - ${n1}"$, $"Precio: $${c.GetString("PE_COSTOU")}"$)
' Next
' End If
' p_transparenteVerOrden.Visible = True
' b_reabrirMesa.Tag = Value
End Sub
Private Sub p_transparenteVerOrden_Click
'Para evitar que el clic en pantalla no se siga hacia atras
p_transparenteVerOrden.Visible = False
' p_transparenteVerOrden.Visible = False
End Sub
Private Sub b_reabrirMesa_Click
Private t As String = Sender.As(Button).tag
' Log(t)
Private d() As String = Regex.Split("\|", t)
Log(t)
If d(6) <> "null" Then
Log("MULTI-TICKET") 'multi-ticket
b_reabrirMesaMulti.Tag = t
p_reabrirMesaMulti.BringToFront
p_reabrirMesaMulti.Visible = True
Private hayMesaAbierta As Boolean = False
'Revisamos si la mesa a REABRIR no esta ACTUALMENTE abierta.
Private ma As ResultSet = Starter.skmt.ExecQuery($"select M_ID from CAT_MESAS where M_ID = '${d(0)}' and M_ESTATUS = 'ABIERTA'"$)
Do While ma.NextRow
hayMesaAbierta = True
' Log(ma.GetString("M_ID"))
Loop
If hayMesaAbierta Then
ToastMessageShow($"La mesa ${d(0)} esta ABIERTA, por favor cierrela antes intentar reabir este ticket"$, True)
Else
Log("UN TICKET") 'multi-ticket
Starter.skmt.BeginTransaction
Starter.skmt.ExecNonQuery($"update CAT_MESAS set M_ESTATUS = 'ABIERTA', M_TICKET = '${d(1)}', M_MESERO = '${d(3)}', M_COMENSALES = '${d(4)}' where M_ID = '${d(0)}'"$)
Starter.skmt.ExecNonQuery($"update PEDIDO set PE_TIPO = 'VENTA', PE_TIPO2 = Null where PE_TIPO = '${d(2)}' and PE_MESA = '${d(0)}' and PE_TICKET = '${d(1)}'"$)
Starter.skmt.ExecNonQuery($"update PEDIDO_TICKET set PT_PAGO = 'VENTA', PT_TARJETA = Null, PT_PAGO_PROPINA = Null, PT_PROPINA = Null, PT_PAGO2 = Null where PT_PAGO = '${d(2)}' and PT_MESA = '${d(0)}' and PT_TICKET = '${d(1)}'"$)
Starter.skmt.TransactionSuccessful
Starter.skmt.EndTransaction
p_reabrirMesaMulti.Visible = False
p_transparenteVerOrden.Visible = False
If d(6) <> "null" Then
Log("MULTI-TICKET") 'multi-ticket
b_reabrirMesaMulti.Tag = t
p_reabrirMesaMulti.BringToFront
p_reabrirMesaMulti.Visible = True
Else
Log("UN TICKET") 'multi-ticket
Starter.skmt.BeginTransaction
Starter.skmt.ExecNonQuery($"update CAT_MESAS set M_ESTATUS = 'ABIERTA', M_TICKET = '${d(1)}', M_MESERO = '${d(3)}', M_COMENSALES = '${d(4)}' where M_ID = '${d(0)}'"$)
Starter.skmt.ExecNonQuery($"update PEDIDO set PE_TIPO = 'VENTA', PE_TIPO2 = Null where PE_TIPO = '${d(2)}' and PE_MESA = '${d(0)}' and PE_TICKET = '${d(1)}'"$)
Starter.skmt.ExecNonQuery($"update PEDIDO_TICKET set PT_PAGO = 'VENTA', PT_TARJETA = Null, PT_PAGO_PROPINA = Null, PT_PROPINA = Null, PT_PAGO2 = Null where PT_PAGO = '${d(2)}' and PT_MESA = '${d(0)}' and PT_TICKET = '${d(1)}'"$)
Starter.skmt.TransactionSuccessful
Starter.skmt.EndTransaction
p_reabrirMesaMulti.Visible = False
' p_transparenteVerOrden.Visible = False
Log("Vamos a Tab1")
WobbleMenu1_Tab1Click
WobbleMenu1.SetCurrentTab(1)
End If
End If
Log("Vamos a Tab1")
WobbleMenu1_Tab1Click
WobbleMenu1.SetCurrentTab(1)
End Sub
Private Sub p_reabrirMesaMulti_Click
'Para evitar que el clic en pantalla no se siga hacia atras
End Sub
Private Sub b_reabrirMesaMulti_Click
Private t As String = Sender.As(Button).tag
Private d() As String = Regex.Split("\|", t)
Log(t)
Private d() As String = Regex.Split("\|", t)
Starter.skmt.BeginTransaction
Starter.skmt.ExecNonQuery($"delete from PEDIDO where PE_ORIGEN = '${d(6)}|${d(7)}' and PE_TIPO <> 'MULTI-TICKET'"$)
' Log($"delete from PEDIDO where PE_ORIGEN = '${d(6)}|${d(7)}' and PE_TIPO <> 'MULTI-TICKET'"$)
@@ -2545,11 +2650,15 @@ Private Sub b_reabrirMesaMulti_Click
Starter.skmt.TransactionSuccessful
Starter.skmt.EndTransaction
p_reabrirMesaMulti.Visible = False
p_transparenteVerOrden.Visible = False
' p_transparenteVerOrden.Visible = False
WobbleMenu1_Tab1Click
WobbleMenu1.SetCurrentTab(1)
End Sub
Private Sub p_reabrirMesaMulti_Click
'Para evitar que el clic en pantalla no se siga hacia atras
End Sub
Private Sub b_imprimirCerrar_Click
' b_imprimirTicket_Click
End Sub
@@ -2570,7 +2679,7 @@ Private Sub b_leyendaDescuento_Click
Private cont As Int = 0
For k = 0 To listaTickets.Size - 1 'Por cada ticket y pago de la lista imprimimos un ticket.
' LogColor($">>>> Forma de pago : ${listaTickets.Get(k).As(Map).Get("pago")}"$, Colors.Blue)
If listaTickets.Get(k).As(Map).Get("pago") = "EFECTIVO" Or cont > 0 Then 'Solo imprimimos si es el PRIMER ticket de TARJETA.
If listaTickets.Size>= k and listaTickets.Get(k).As(Map).Get("pago") = "EFECTIVO" Or cont > 0 Then 'Solo imprimimos si es el PRIMER ticket de TARJETA.
Continue
End If
cont = cont + 1
@@ -2802,9 +2911,9 @@ Private Sub l_prodX_Click
Private m As Map = Sender.As(Label).tag
Log(listaProdsOrden.IndexOf(m.Get("id")))
Private indice As String = listaProdsOrden.IndexOf(m.Get("id"))
' Log(clv_orden.GetPanel(indice).GetView(0).GetView(2).GetView(4).As(EditText).text) 'getview(0) = p_prods, getview(2) = p_botMasMen, getview(4) = et_pCant
If indice = -1 Then
Private Pnl As B4XView = xui.CreatePanel("")
Pnl.SetLayoutAnimated(0, 0, 0, clv_prods_ll.AsView.Width, 50dip)
@@ -2820,20 +2929,19 @@ Private Sub l_prodX_Click
End Sub
Private Sub clv_orden_VisibleRangeChanged (FirstIndex As Int, LastIndex As Int)
Log(87)
Dim ExtraSize As Int = 30 'List size
For i = Max(0, FirstIndex - ExtraSize) To Min(LastIndex + ExtraSize, clv_orden.Size - 1)
Dim Pnl As B4XView = clv_orden.GetPanel(i)
If i > FirstIndex - ExtraSize And i < LastIndex + ExtraSize Then
If Pnl.NumberOfViews = 0 Then 'Add each item/layout to the list/main layout
Log(i)
' Log(i)
' If listaProdsOrden.IndexOf(clv_orden.GetValue(i).As(Map).Get("id")) > -1 Then
' Log("Ya existe")
' Else
Pnl.LoadLayout("proditem")
listaProdsOrden.InsertAt(i, clv_orden.GetValue(i).As(Map).Get("id"))
Log(listaProdsOrden)
' Log($"insertamos ${clv_orden.GetValue(i).As(Map).Get("id")} en ${i}"$)
' Log(listaProdsOrden)
p_prods.Width = clv_orden.GetBase.Width ' Activity.Width * 0.99
p_prods.Height = 42dip
p_botMasMen.Left = (clv_orden.GetBase.Width - p_botMasMen.Width - 8)
@@ -2869,9 +2977,9 @@ End Sub
Sub LlenaOrden
' Log("LlenaOrden")
clv_orden.Clear
If hayPedido Then 'Si hay pedido obtenemos las cantidades de los productos para agregarlos al CLV.
Private c As Cursor = Starter.skmt.ExecQuery($"Select CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_ALMACEN, CAT_GP_PRECIO, CAT_GP_TIPOPROD, CAT_GP_IMG, PE_PROID, PE_CANT, PE_PRONOMBRE, PE_COSTOU from cat_gunaprod join pedido on cat_gp_id = Pe_proid where PE_TICKET = '${Starter.ticketActual}' and PE_MESA = '${Starter.mesaActual}' and PE_TIPO = 'VENTA' and CAT_GP_PRECIO > 0 And CAT_GP_CLASIF <> 'PROMOS' order by CAT_GP_NOMBRE"$)
clv_orden.Clear
If c.RowCount > 0 Then
For i = 0 To c.RowCount - 1
Private Pnl As B4XView = xui.CreatePanel("")
@@ -2905,7 +3013,7 @@ Sub actualizaProductos(categoria As String)
labelTmp.Initialize("l_prods")
Dim l_prods As B4XView = labelTmp ' We cast it to B4XView so we can set the border.
l_prods.Width = 119dip
l_prods.Height = 30dip
l_prods.Height = 36dip
l_prods.TextSize = 12
If w Mod 2 == 0 Then
@@ -2922,8 +3030,8 @@ Sub actualizaProductos(categoria As String)
' l_prods.SetColorAndBorder(Colors.White, 1dip, Colors.Black, 0)
l_prods.SetTextAlignment("CENTER", "CENTER")
' Log(nombre)
l_prods.Text = nombre
If nombre.Length > 25 Then l_prods.Text = nombre.SubString2(0, 25)
l_prods.Text = w & " " & nombre
If nombre.Length > 25 Then l_prods.Text = w & " " & nombre.SubString2(0, 25)
' {prod=ALCACHOFAS CRUDAS 250g , precio=190, almacen=9997, id=LA92, cant=7, img=Null}
l_prods.Tag = CreateMap("prod":nombre, "precio":c.GetString("CAT_GP_PRECIO"), "almacen":"9999", "id":c.GetString("CAT_GP_ID"), "cant":1, "img":Null)
' l_prods.TextColor = Colors.White
@@ -2933,9 +3041,9 @@ Sub actualizaProductos(categoria As String)
If top0 > p_productos1.Height - l_prods.Height Then
left0 = left0 + (l_prods.Width + 1)
top0 = 0
' Log("CAMBIO - L:" & left0 & "|LW:" & l_prods.Width & "|W:" & w)
Log("CAMBIO - L:" & left0 & "|LW:" & l_prods.Width & "|W:" & w)
End If
If left0 > p_productos1.Width Then
If (left0 + l_prods.Width) > p_productos1.Width Then
left0 = 0
If panelEnUso = 1 Then
panelEnUso = 2
@@ -2944,7 +3052,7 @@ Sub actualizaProductos(categoria As String)
else if panelEnUso = 3 Then
panelEnUso = 4
End If
' Log("NO CABEN - " & w & " USAMOS " & panelEnUso)
Log("NO CABEN - " & w & " USAMOS " & panelEnUso)
End If
' Log($"L:${left0}, T:${top0}, PH:${p_productos.Height}"$)
If panelEnUso = 1 Then
@@ -2978,11 +3086,18 @@ End Sub
Private Sub et_selBuscar_TextChanged (Old As String, New As String)
If New.Length > 1 Then
p_prevBusqueda.Visible = False
selBuscar = New
actualizaProductos("%")
End If
End Sub
Private Sub et_selBuscar_FocusChanged (HasFocus As Boolean)
Log("HAS FOCUS: " & HasFocus)
' p_prevBusqueda.BringToFront
' p_prevBusqueda.Visible = True
End Sub
Private Sub b_sigPagina_Click
If panelEnUso = 1 Then
p_productos2.BringToFront
@@ -3035,4 +3150,8 @@ End Sub
Sub p_productos4_Click
'Para evitar que el clic en pantalla no se siga hacia atras
End Sub
Private Sub p_mesas_Click
'Para evitar que el clic en pantalla no se siga hacia atras
End Sub

View File

@@ -1076,7 +1076,7 @@ Sub revisaMaxPromosProdsVariablesPorInventario(pm As Map) As Int 'ignore
If thisLog Then Log($"Prods variables disponibles = ${totalProdsVariablesDisponibles}"$)
If thisLog Then Log($"Prods variables2 disponibles = ${totalProdsVariables2Disponibles}"$)
Private maxPromosXVariables As Int = 0
Private maxPromosXVariables2 As Int = 0
' Private maxPromosXVariables2 As Int = 0
For x = 1 To maxPromosXFijos
If thisLog Then Log("=====================================================")
If thisLog Then Log("=====================================================")
@@ -1175,7 +1175,7 @@ Sub traeTotalTicketActual_P(tipoPago As String) As String
If p.RowCount > 0 Then
For j = 0 To p.RowCount - 1
p.Position = j
Log(p.GetString("CAT_GP_TIPO"))
' Log(p.GetString("CAT_GP_TIPO"))
If p.GetString("CAT_GP_TIPO") = "ALIMENTOS" Then
desc = p.GetString("DESC") / 100
' desc = Ceil(desc)
@@ -1294,8 +1294,8 @@ Sub actualizaProducto(costoU As String, cant As String, nombre As String, prodId
' Private tablaProds As String = "cat_gunaprod2"
' If tipoVenta = "ABORDO" Then tablaProds = "cat_gunaprod"
Private c As Cursor=Starter.skmt.ExecQuery($"select * from pedido where PE_PROID = '${prodId}' and PE_TICKET = '${ticketId}' and PE_MESA = '${mesa}' and PE_TIPO = '${tipoVenta}'"$)
Log($"select * from pedido where PE_PROID = '${prodId}' and PE_TICKET = '${ticketId}' and PE_MESA = '${mesa}' and PE_TIPO = '${tipoVenta}'"$)
Log(c.RowCount)
' Log($"select * from pedido where PE_PROID = '${prodId}' and PE_TICKET = '${ticketId}' and PE_MESA = '${mesa}' and PE_TIPO = '${tipoVenta}'"$)
' Log(c.RowCount)
If c.RowCount > 0 Then
LogColor("ACTUALIZAMOS PROD", Colors.Blue)
c.Position = 0