mirror of
https://github.com/KeymonSoft/Lanterna.git
synced 2026-04-20 22:29:17 +00:00
- Se corrigio el orden de las mesas (antes las ordenaba como string).
- Se corrigió que cuando se reabria una mesa el tab se quedaba en el 3. - Se corrigió que cuando se cambiaba la cantidad de un producto de varios, el nombre se regresaba al default. - Se agregó que al ticket de NO PAGADO se le pueda agregar que muestre el descuento por efectivo.
This commit is contained in:
@@ -131,6 +131,16 @@ Sub Class_Globals
|
||||
Private b_reabrirMesaMulti As Button
|
||||
Private b_imp2 As Button
|
||||
Private p_wobble As Panel
|
||||
Private p_botonesCerrar As Panel
|
||||
Private b_imprimirCerrar As Button
|
||||
Private p_leyendaDescuento As Panel
|
||||
Private b_leyendaDescuento As Button
|
||||
Private cb_leyendaDescuento As CheckBox
|
||||
Dim n As Int
|
||||
Private et_buscar As EditText
|
||||
Private p_buscar As Panel
|
||||
Private p_transparenteDescuento As Panel
|
||||
Private cb_mostrarDescuento As CheckBox
|
||||
End Sub
|
||||
|
||||
'You can add more parameters here.
|
||||
@@ -159,7 +169,7 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
|
||||
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 - 20, Root.Height * 0.55) 'Cambiamos el tamaño y posición de la lista de productos.
|
||||
clv_prods_ll.GetBase.SetLayoutAnimated(0, 5dip, (p_buscar.Top + p_buscar.Height + 5), Root.Width - 20, 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_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.
|
||||
@@ -180,10 +190,13 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
Subs.panelWH(p_transparenteResumen, Root.Width, Root.Height)
|
||||
Subs.panelWH(p_transparentePago, Root.Width, Root.Height)
|
||||
p_transparentePago.Top = 0 : p_transparentePago.left = 0
|
||||
Subs.panelWH(p_transparenteDescuento, Root.Width, Root.Height)
|
||||
p_transparenteDescuento.Top = 0 : p_transparenteDescuento.left = 0
|
||||
sv_resumen.Panel.LoadLayout("resumenCont")
|
||||
Subs.centraEtiqueta(l_pago, p_pago.Width)
|
||||
Subs.centraPanel(p_propina, p_pago.Width)
|
||||
Subs.centraBoton(b_pagoCerrar, p_pago.Width)
|
||||
' Subs.centraBoton(b_pagoCerrar, p_pago.Width)
|
||||
Subs.centraPanel(p_botonesCerrar, p_pago.Width)
|
||||
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
|
||||
@@ -211,7 +224,7 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
Starter.nivelActual = "Cats"
|
||||
lv_categorias.Color = Colors.White
|
||||
lv_categorias.Top = l_meseroAbierta2.Top + l_meseroAbierta2.Height + 5
|
||||
lv_categorias.Height = Root.Height * 0.55
|
||||
lv_categorias.Height = Root.Height * 0.60
|
||||
Private Label1 As Label = lv_categorias.SingleLineLayout.Label
|
||||
Label1.TextSize = 9dip
|
||||
Label1.TextColor = Colors.Black
|
||||
@@ -232,7 +245,7 @@ Sub B4XPage_Appear
|
||||
' p_wobble.Top = Root.Height - p_wobble.Height - 50
|
||||
' p_wobble.Elevation = 10
|
||||
' p_wobble.BringToFront
|
||||
Starter.imprimirTicket = False
|
||||
Starter.imprimirTicket = True
|
||||
reqManager.Initialize(Me, Starter.DBReqServer)
|
||||
B4XPages.MainPage.atrasPresionado = False
|
||||
' Log(Starter.DBReqServer)
|
||||
@@ -293,37 +306,61 @@ Sub B4XPage_Appear
|
||||
' Log(NumberFormat2(x&".52", 1,2,2,True) & " -> " & n2t.NumberToWords(x&".52"))
|
||||
' Next
|
||||
WobbleMenu1.mBase.As(Panel).Elevation = 10dip 'Ponemos la elevacion en 10 para que quede enfrente de los paneles semitransparentes.
|
||||
|
||||
Private z As ResultSet = Starter.skmt.ExecQuery2("select * from CAT_VARIABLES where CAT_VA_DESCRIPCION = ?", Array As String ("IMPRESION_ACTIVA"))
|
||||
Do While z.NextRow
|
||||
Private ia As Boolean = False
|
||||
If z.GetString("CAT_VA_VALOR") = 1 Then ia = True
|
||||
Loop
|
||||
Starter.imprimirTicket = ia
|
||||
Log(Starter.imprimirTicket)
|
||||
End Sub
|
||||
|
||||
Sub B4XPage_CloseRequest As ResumableSub
|
||||
' BACK key pressed
|
||||
'Return True to close, False to cancel
|
||||
Log($"${lv_categorias.Visible} And ${Starter.nivelActual}, ${Starter.catActual}"$)
|
||||
If (lv_categorias.Visible Or Starter.catActual = "VARIOS") And Starter.nivelActual = "SubCats" Then
|
||||
Log(1)
|
||||
' Log($"${lv_categorias.Visible} And ${Starter.nivelActual}, ${Starter.catActual}"$)
|
||||
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
|
||||
p_buscar.Visible = False
|
||||
lv_categorias.Visible = True
|
||||
' Starter.nivelActual = "Cats"
|
||||
muestraCats
|
||||
else If p_reabrirMesaMulti.Visible Then
|
||||
n = 1
|
||||
Log(Starter.nivelActual & ", " & n)
|
||||
' Log(0)
|
||||
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
|
||||
Else If p_transparenteCambioMesa.Visible Then
|
||||
' Log(4)
|
||||
p_transparenteCambioMesa.Visible = False
|
||||
Else If p_transparentePago.visible Then 'Si se esta mostrando el popup de pago, lo cerramos.
|
||||
' Log(5)
|
||||
' p_pago.Visible = False
|
||||
p_transparentePago.Visible = False
|
||||
Else If clv_prods_ll.AsView.Visible Then 'SI se muestran los
|
||||
' Log(6)
|
||||
clv_prods_ll.AsView.Visible = False
|
||||
p_buscar.Visible = False
|
||||
lv_categorias.Visible = True
|
||||
n = 0
|
||||
' Log(Starter.nivelActual & ", " & n)
|
||||
else If p_mesa.Visible Then
|
||||
' Log(7)
|
||||
If Subs.revisaCierreAdmin Then
|
||||
p_transparenteCierreAdmin.BringToFront
|
||||
p_transparenteCierreAdmin.Visible = True
|
||||
Log(8)
|
||||
' Log(8)
|
||||
Else
|
||||
' Log(9)
|
||||
p_transparenteCierreAdmin.Visible = False
|
||||
End If
|
||||
p_mesa.Visible = False
|
||||
@@ -379,12 +416,13 @@ Sub b_prodMenos_Click
|
||||
Private tmpMap As Map = clv.GetValue(index).As(Map)
|
||||
Private precio As String = clv.GetValue(index).As(Map).Get("precio")
|
||||
Private id As String=clv.GetValue(index).As(Map).Get("id")
|
||||
Private prodNombre As String = clv.GetValue(index).As(Map).Get("prod")
|
||||
Private tmpMap As Map = CreateMap("precio":precio, "cant":laCant.Text, "almacen":Subs.traeAlmacen)
|
||||
' Log(tmpMap)
|
||||
prodsMap.Put(id, tmpMap)
|
||||
If laCant.Text = 0 Then prodsMap.Remove(id)
|
||||
Private nombreX As String = Subs.traeProdNombre(id)
|
||||
Subs.actualizaProducto(precio, laCant.text, nombreX, id, Starter.ticketActual, Subs.traeFecha, Starter.meseroActual, Starter.mesaActual, 0, Starter.tipov, Starter.comensalesActuales)
|
||||
' Private nombreX As String = Subs.traeProdNombre(id)
|
||||
Subs.actualizaProducto(precio, laCant.text, prodNombre, id, Starter.ticketActual, Subs.traeFecha, Starter.meseroActual, Starter.mesaActual, 0, Starter.tipov, Starter.comensalesActuales)
|
||||
cuentaProds
|
||||
Dim cs As CSBuilder
|
||||
cs.Initialize
|
||||
@@ -411,6 +449,7 @@ Sub b_prodMas_Click
|
||||
' 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")
|
||||
Private prodNombre As String = clv.GetValue(index).As(Map).Get("prod")
|
||||
Private inv As Int = clv.GetValue(index).As(Map).Get("almacen")
|
||||
' Log($"|${laCant.Text}, ${inv}"$)
|
||||
If buttonTag = "vendido" Then
|
||||
@@ -426,9 +465,9 @@ Sub b_prodMas_Click
|
||||
Log(Subs.totalPedido)
|
||||
End If
|
||||
Private id As String=clv.GetValue(index).As(Map).Get("id")
|
||||
Private nombreX As String = Subs.traeProdNombre(id)
|
||||
' 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)
|
||||
Subs.actualizaProducto(precioX, laCant.text, prodNombre, id, Starter.ticketActual, Subs.traeFecha, Starter.meseroActual, Starter.mesaActual, 0, Starter.tipov, Starter.comensalesActuales)
|
||||
cuentaProds
|
||||
Dim cs As CSBuilder
|
||||
cs.Initialize
|
||||
@@ -702,6 +741,7 @@ End Sub
|
||||
Private Sub WobbleMenu1_Tab1Click
|
||||
' Log("TAB 1")
|
||||
If Subs.revisaCierreAdmin Then
|
||||
p_transparenteCierreAdmin.BringToFront
|
||||
p_transparenteCierreAdmin.Visible = True
|
||||
Else
|
||||
p_transparenteCierreAdmin.Visible = False
|
||||
@@ -902,7 +942,7 @@ 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 from cat_mesas order by cast(M_ID as INTEGER)"$)
|
||||
' Log(p.RowCount)
|
||||
PCLVM.Commit
|
||||
clv_mesas.Clear
|
||||
@@ -948,6 +988,7 @@ Private Sub p_mesasItem_Click
|
||||
tipoPago = "VENTA"
|
||||
muestraCats
|
||||
clv_prods_ll.AsView.Visible = False
|
||||
p_buscar.Visible = False
|
||||
lv_categorias.Visible = True
|
||||
' Log(Sender.As(Panel).tag)
|
||||
b_abrirMesa.Text = "Abrir Mesa"
|
||||
@@ -1028,6 +1069,7 @@ Private Sub b_cambioMesa_Click
|
||||
End If
|
||||
p_transparenteCambioMesa.Visible = False
|
||||
WobbleMenu1_Tab1Click
|
||||
WobbleMenu1.SetCurrentTab(1)
|
||||
End Sub
|
||||
|
||||
Private Sub b_abrirMesa_Click
|
||||
@@ -1079,7 +1121,7 @@ Private Sub b_mesaCerrar_Click
|
||||
cb_opcionEfectivo.Checked = False
|
||||
p_formasDePago.Height = 40dip
|
||||
p_propina.Top = 133dip
|
||||
b_pagoCerrar.Top = 263dip
|
||||
p_botonesCerrar.Top = 257dip
|
||||
p_pago.Height = 320dip
|
||||
p_formasDePago.RemoveAllViews
|
||||
Private c As Cursor = Starter.skmt.ExecQuery($"select PE_MESA from PEDIDO where PE_MESA = '${Starter.mesaActual}' and PE_TIPO = 'VENTA'"$)
|
||||
@@ -1115,14 +1157,20 @@ End Sub
|
||||
|
||||
Private Sub lv_categorias_ItemClick (Position As Int, Value As Object)
|
||||
' Log("ITEM CLICKED")
|
||||
Starter.catActual = value
|
||||
Log(Starter.nivelActual)
|
||||
If Starter.nivelActual = "Cats" And Value = "VARIOS" Then
|
||||
Log(6)
|
||||
Starter.nivelActual = "SubCats"
|
||||
lv_categorias_ItemClick (1, "VARIOS")
|
||||
Starter.nivelActual = "SubCats"
|
||||
' Starter.catActual = Value
|
||||
If Starter.nivelActual = "Cats" Then
|
||||
Starter.catActual = Value
|
||||
Else if Starter.nivelActual = "SubCats" Then
|
||||
Starter.subcatActual = Value
|
||||
End If
|
||||
' Log(Starter.nivelActual)
|
||||
' Log($"${Starter.catActual}, ${Starter.subcatActual}"$)
|
||||
' If Starter.nivelActual = "Cats" And Value = "VARIOS" Then
|
||||
' Log(6)
|
||||
' Starter.nivelActual = "SubCats"
|
||||
' lv_categorias_ItemClick (1, "VARIOS")
|
||||
' Starter.nivelActual = "SubCats"
|
||||
' End If
|
||||
|
||||
If Starter.nivelActual = "Cats" Then
|
||||
Private lasCats As List = Subs.traeSubCategorias(Value)
|
||||
@@ -1134,7 +1182,8 @@ Private Sub lv_categorias_ItemClick (Position As Int, Value As Object)
|
||||
Else
|
||||
lv_categorias.Visible = False
|
||||
clv_prods_ll.AsView.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}' order by CAT_GP_NOMBRE"$)
|
||||
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
|
||||
End Sub
|
||||
@@ -1196,9 +1245,10 @@ Private Sub b_pagoCerrar_Click
|
||||
Private tm As Map = CreateMap("ticket":sigTicket, "pago":tipoPago)
|
||||
listaTickets.Add(tm) 'Agregamos el ticket y pago a la lista para imprimir el ticket con estos datos al llamar b_imprimirTicket_Click
|
||||
End If
|
||||
b_imprimirTicket_Click
|
||||
b_leyendaDescuento_Click
|
||||
Sleep(1000)
|
||||
WobbleMenu1_Tab1Click
|
||||
WobbleMenu1.SetCurrentTab(1)
|
||||
End Sub
|
||||
|
||||
Private Sub cb_pago_SelectedIndexChanged (Index As Int)
|
||||
@@ -2055,6 +2105,7 @@ End Sub
|
||||
|
||||
Private Sub b_regresarProds_Click
|
||||
WobbleMenu1_Tab1Click
|
||||
WobbleMenu1.SetCurrentTab(1)
|
||||
End Sub
|
||||
|
||||
Sub imprimeTicket (ticket As String, pago As String) As ResumableSub
|
||||
@@ -2064,6 +2115,277 @@ Sub imprimeTicket (ticket As String, pago As String) As ResumableSub
|
||||
End Sub
|
||||
|
||||
Private Sub b_imprimirTicket_Click
|
||||
p_transparenteDescuento.Visible = True
|
||||
' p_leyendaDescuento.Visible = True
|
||||
' p_leyendaDescuento.BringToFront
|
||||
cb_leyendaDescuento.Checked = True
|
||||
End Sub
|
||||
|
||||
Private Sub cb_pagoPropina_SelectedIndexChanged (Index As Int)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub p_transparenteCambioMesa_Click
|
||||
'Para evitar que el clic en pantalla no se siga hacia atras
|
||||
End Sub
|
||||
|
||||
Private Sub p_transparenteDescuento_Click
|
||||
'Para evitar que el clic en pantalla no se siga hacia atras
|
||||
End Sub
|
||||
|
||||
Private Sub l_prodX_LongClick
|
||||
Log(Sender.As(Label).tag)
|
||||
Private m As Map = Sender.As(Label).tag.As(Map)
|
||||
Log(Sender.As(View).Parent.As(Panel).GetView(2).As(Panel).GetView(4).As(EditText).text)
|
||||
'Sender.As(View).Parent.As(Panel) = p_prods
|
||||
'Sender.As(View).Parent.As(Panel).GetView(2) = p_botMasMen
|
||||
'Sender.As(View).Parent.As(Panel).GetView(2).As(Panel).GetView(4)
|
||||
'Sender.As(View).Parent.As(Panel).GetView(2).As(Panel).GetView(4).As(EditText) = et_pCant
|
||||
Private laCant As Int = Sender.As(View).Parent.As(Panel).GetView(2).As(Panel).GetView(4).As(EditText).text '
|
||||
If m.Get("prod").As(String).Contains("Alimentos Varios") Or m.Get("prod").As(String).Contains("Bebidas Varias") Then
|
||||
p_renombraVarios.BringToFront
|
||||
et_nombreVariable.Text = m.Get("prod")
|
||||
et_nombreVariable.tag = m
|
||||
et_precioVariable.Text = m.Get("precio")
|
||||
p_renombraVarios.Visible = True
|
||||
Else
|
||||
ToastMessageShow("Este artículo no es editable", False)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub b_renombraVarios_Click
|
||||
p_renombraVarios.Visible = False
|
||||
Private m As Map = et_nombreVariable.tag.As(Map)
|
||||
' Private c As Cursor=Starter.skmt.ExecQuery($"select * from pedido where PE_PROID = '${m.Get("id")}' and PE_TICKET = '${Starter.ticketActual}' and PE_MESA = '${Starter.mesaActual}' and PE_TIPO = 'VENTA'"$)
|
||||
' Log($"select * from pedido where PE_PROID = '${m.Get("id")}' and PE_TICKET = '${Starter.ticketActual}' and PE_MESA = '${Starter.mesaActual}' and PE_TIPO = 'VENTA'"$)
|
||||
' If c.RowCount > 0 Then
|
||||
' Starter.skmt.ExecNonQuery($"update PEDIDO set PE_PRONOMBRE = '${et_nombreVariable.text}', PE_COSTOU = '${et_precioVariable.text}' where PE_PROID = '${m.Get("id")}' and PE_TIPO = 'VENTA' and PE_MESA = '${Starter.mesaActual}' and PE_TICKET = '${Starter.ticketActual}'"$)
|
||||
' Log($"update PEDIDO set PE_PRONOMBRE = '${et_nombreVariable.text}', PE_COSTOU = '${et_precioVariable.text}' where PE_PROID = '${et_nombreVariable.tag}' and PE_TIPO = 'VENTA' and PE_MESA = '${Starter.mesaActual}' and PE_TICKET = '${Starter.ticketActual}'"$)
|
||||
' Else
|
||||
Private cant As Int = m.Get("cant")
|
||||
If cant = 0 Then cant = 1
|
||||
Subs.actualizaProducto(et_precioVariable.text, cant, et_nombreVariable.Text, m.Get("id"), Starter.ticketActual, DateTime.Now, Starter.meseroActual, Starter.mesaActual, et_precioVariable.Text, "VENTA", Starter.comensalesActuales)
|
||||
' End If
|
||||
|
||||
LlenaProdsLL(Null, Null)
|
||||
End Sub
|
||||
|
||||
Private Sub p_transparentePago_Click
|
||||
'Para evitar que el clic en pantalla no se siga hacia atras
|
||||
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)
|
||||
End Sub
|
||||
|
||||
Sub agregaFormaDePago(left0 As Int, top0 As Int, tag0 As Int)
|
||||
Log("agregaFormaDePago |" & top0 & "|" & tag0)
|
||||
p_opcionEfectivo.Visible = False
|
||||
Private p_num As Panel
|
||||
p_num.Initialize("")
|
||||
p_num.LoadLayout("formaPago")
|
||||
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
|
||||
End If
|
||||
l_tipoPago2.Text = $"${Starter.formasDePago}:"$
|
||||
cb_pago2.Tag = tag0
|
||||
et_montoPago2.Tag = tag0
|
||||
cb_pago2.SetItems(Array As String("American Express", "Visa/Mastercard", "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)
|
||||
b_pagoCerrar.Enabled = False
|
||||
If listaFormaDePago.Size > 1 Then l_faltaMonto.Visible = True
|
||||
End Sub
|
||||
|
||||
Private Sub cb_pago2_SelectedIndexChanged (Index As Int)
|
||||
Log(Sender.As(B4XComboBox).tag)
|
||||
Log(Sender.As(B4XComboBox).SelectedItem)
|
||||
listaFormaDePago.Set(Sender.As(B4XComboBox).tag - 1, Sender.As(B4XComboBox).SelectedItem)
|
||||
If Sender.As(B4XComboBox).SelectedItem = "Efectivo" And listaFormaDePago.Size = 1 Then
|
||||
Private c As Cursor = Starter.skmt.ExecQuery("select * from CAT_VARIABLES where CAT_VA_DESCRIPCION = 'DESCUENTO X EFECTIVO'")
|
||||
c.Position = 0
|
||||
l_opcionEfectivo.Text = $"${c.GetString("CAT_VA_VALOR")}% desc."$
|
||||
p_opcionEfectivo.Visible = True
|
||||
cb_opcionEfectivo.Checked = True
|
||||
|
||||
Else
|
||||
Log(listaFormaDePago.Size)
|
||||
p_opcionEfectivo.Visible = False
|
||||
cb_opcionEfectivo.Checked = False
|
||||
End If
|
||||
Log(listaFormaDePago)
|
||||
End Sub
|
||||
|
||||
Private Sub et_montoPago2_TextChanged (Old As String, New As String)
|
||||
Log("TEXT CHANGED")
|
||||
' Log(Starter.totalActual)
|
||||
Private subtotal As String = 0
|
||||
Private enBlanco As Boolean = False
|
||||
For i = 0 To listaMontoDePago.Size - 1
|
||||
Log(listaMontoDePago.Get(i).As(EditText).text)
|
||||
If listaMontoDePago.Get(i).As(EditText).text <> "" Then
|
||||
subtotal = subtotal + listaMontoDePago.Get(i).As(EditText).text
|
||||
Else
|
||||
enBlanco = True
|
||||
End If
|
||||
Next
|
||||
Log($"${Starter.totalActual} - ${subtotal} = ${Starter.totalActual - subtotal}"$)
|
||||
LogColor($"FALTAN ${Starter.totalActual - subtotal}"$, Colors.blue)
|
||||
If listaMontoDePago.Size > 1 Then
|
||||
l_faltaMonto.Visible = True
|
||||
If subtotal < Starter.totalActual Then
|
||||
LogColor($"FALTAN ${Starter.totalActual - subtotal}"$, Colors.red)
|
||||
l_faltaMonto.Text = $"FALTAN ${NumberFormat2((Starter.totalActual - subtotal), 1, 0, 0, False)}"$
|
||||
else if subtotal > Starter.totalActual Then
|
||||
LogColor($"SOBRAN ${subtotal - Starter.totalActual}"$, Colors.red)
|
||||
l_faltaMonto.Text = $"SOBRAN ${NumberFormat2((subtotal - Starter.totalActual), 1, 0, 0, False)}"$
|
||||
Else
|
||||
l_faltaMonto.Text = ""
|
||||
End If
|
||||
End If
|
||||
If listaMontoDePago.Size > 1 And (l_faltaMonto.Text <> "" Or enBlanco) Then
|
||||
b_pagoCerrar.Enabled = False
|
||||
Else
|
||||
b_pagoCerrar.Enabled = True
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub et_montoPago2_FocusChanged (HasFocus As Boolean)
|
||||
Log("FOCUS CHANGED")
|
||||
Log(Starter.totalActual)
|
||||
Private subtotal As String = 0
|
||||
Private enBlanco As Boolean = False
|
||||
For i = 0 To listaMontoDePago.Size - 1
|
||||
Log(listaMontoDePago.Get(i).As(EditText).text)
|
||||
If listaMontoDePago.Get(i).As(EditText).text <> "" Then
|
||||
subtotal = subtotal + listaMontoDePago.Get(i).As(EditText).text
|
||||
Else
|
||||
enBlanco = True
|
||||
End If
|
||||
Next
|
||||
LogColor($"FALTAN ${Starter.totalActual - subtotal}"$, Colors.blue)
|
||||
If subtotal < Starter.totalActual Then
|
||||
LogColor($"FALTAN ${Starter.totalActual - subtotal}"$, Colors.red)
|
||||
l_faltaMonto.Text = $"FALTAN ${NumberFormat2((Starter.totalActual - subtotal), 1, 0, 0, False)}"$
|
||||
else if subtotal > Starter.totalActual Then
|
||||
LogColor($"SOBRAN ${subtotal - Starter.totalActual}"$, Colors.red)
|
||||
l_faltaMonto.Text = $"SOBRAN ${NumberFormat2((subtotal - Starter.totalActual), 1, 0, 0, False)}"$
|
||||
Else
|
||||
l_faltaMonto.Text = ""
|
||||
End If
|
||||
If listaMontoDePago.Size > 1 And (l_faltaMonto.Text <> "" Or enBlanco) Then
|
||||
b_pagoCerrar.Enabled = False
|
||||
Else
|
||||
b_pagoCerrar.Enabled = True
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub cb_opcionEfectivo_CheckedChange(Checked As Boolean)
|
||||
Log(">> OPCION EFECTIVO CAMBIO - ACTUALIZAMOS PEDIDO")
|
||||
Private desc As String = 1 / Subs.traeDescXefectivo
|
||||
Private tot As String = Subs.traeTotalTicketActual_P("VENTA")
|
||||
If Checked Then
|
||||
Starter.skmt.ExecNonQuery($"update PEDIDO set PE_DESC = '${Subs.traeDescXefectivo}' where PE_TIPO = 'VENTA' and PE_MESA = '${Starter.mesaActual}' and PE_TICKET = '${Starter.ticketActual}'"$)
|
||||
' et_montoPago2.Text = NumberFormat2(tot - (tot * desc), 1, 0, 0, False)
|
||||
' et_montoPago2.Text = Subs.traeTotalTicketActual_P
|
||||
Else
|
||||
Starter.skmt.ExecNonQuery($"update PEDIDO set PE_DESC = '0' where PE_TIPO = 'VENTA' and PE_MESA = '${Starter.mesaActual}' and PE_TICKET = '${Starter.ticketActual}'"$)
|
||||
' et_montoPago2.Text = tot
|
||||
End If
|
||||
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 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
|
||||
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
|
||||
End Sub
|
||||
|
||||
Private Sub b_reabrirMesa_Click
|
||||
Private t As String = Sender.As(Button).tag
|
||||
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
|
||||
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
|
||||
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)
|
||||
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'"$)
|
||||
Starter.skmt.ExecNonQuery($"delete from PEDIDO_TICKET where PT_ORIGEN = '${d(6)}|${d(7)}' and PT_ALMACEN = 'MULTI-TICKET'"$)
|
||||
' Log($"delete from PEDIDO_TICKET where PT_ORIGEN = '${d(6)}|${d(7)}' and PT_ALMACEN = 'MULTI-TICKET'"$)
|
||||
Starter.skmt.ExecNonQuery($"update CAT_MESAS set M_ESTATUS = 'ABIERTA', M_TICKET = '${d(7)}', M_MESERO = '${d(3)}', M_COMENSALES = '${d(4)}' where M_ID = '${d(6)}'"$)
|
||||
Starter.skmt.ExecNonQuery($"update PEDIDO set PE_TIPO = 'VENTA', PE_TIPO2 = Null where PE_TIPO = 'MULTI-TICKET' and PE_MESA = '${d(6)}' and PE_TICKET = '${d(7)}'"$)
|
||||
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 = 'MULTI-TICKET' and PT_MESA = '${d(6)}' and PT_TICKET = '${d(7)}'"$)
|
||||
Starter.skmt.TransactionSuccessful
|
||||
Starter.skmt.EndTransaction
|
||||
p_reabrirMesaMulti.Visible = False
|
||||
p_transparenteVerOrden.Visible = False
|
||||
WobbleMenu1_Tab1Click
|
||||
WobbleMenu1.SetCurrentTab(1)
|
||||
End Sub
|
||||
|
||||
Private Sub b_imprimirCerrar_Click
|
||||
' b_imprimirTicket_Click
|
||||
End Sub
|
||||
|
||||
Private Sub b_leyendaDescuento_Click
|
||||
Private imprimirEste As Boolean = Starter.imprimirTicket
|
||||
Private logger As Boolean = True
|
||||
Private TAMANO As Int
|
||||
@@ -2163,7 +2485,7 @@ Private Sub b_imprimirTicket_Click
|
||||
' If imprimirEste Then Printer1.WriteString("ID.Cliente: " & la_cuenta.Text & CRLF)
|
||||
' If logger Then Log("ID.Cliente: " & la_cuenta.Text & CRLF)
|
||||
If imprimirEste Then Printer1.WriteString(" " & CRLF)
|
||||
c = Starter.skmt.ExecQuery($"select *, ifnull(PE_DESC, 0) as DESC from PEDIDO where PE_MESA = '${Starter.mesaActual}' and PE_TIPO = '${tipoPago}' and PE_TICKET = '${Starter.ticketActual}'"$)
|
||||
c = Starter.skmt.ExecQuery($"select *, ifnull(PE_DESC, 0) as DESC from PEDIDO join cat_gunaprod on PE_PROID = CAT_GP_ID where PE_MESA = '${Starter.mesaActual}' and PE_TIPO = '${tipoPago}' and PE_TICKET = '${Starter.ticketActual}'"$)
|
||||
' Log($"select * from PEDIDO where PE_MESA = '${Starter.mesaActual}' and PE_TIPO = '${tipoPago}' and PE_TICKET = '${Starter.ticketActual}'"$)
|
||||
' Log(c.RowCount)
|
||||
If c.RowCount > 0 Then
|
||||
@@ -2173,8 +2495,14 @@ Private Sub b_imprimirTicket_Click
|
||||
c.Position = i
|
||||
Private elNombre As String = c.GetString("PE_PRONOMBRE")
|
||||
If elNombre.Length > 30 Then elNombre.SubString2(0, 30)
|
||||
elSubTotal = c.GetString("PE_COSTO_TOT") - (c.GetString("PE_COSTO_TOT") * (c.GetString("DESC") / 100))
|
||||
Private cantXpu As String = $"${c.GetString("PE_CANT")} x ${c.GetString("PE_COSTOU")}"$
|
||||
If c.GetString("CAT_GP_TIPO") = "ALIMENTOS" Then
|
||||
' Log($">> APLICAMOS DESC POR ALIMENTOS"$)
|
||||
elSubTotal = c.GetString("PE_COSTO_TOT") - (c.GetString("PE_COSTO_TOT") * (c.GetString("DESC") / 100))
|
||||
Else
|
||||
elSubTotal = c.GetString("PE_COSTO_TOT")
|
||||
End If
|
||||
' Log($"${c.GetString("PE_PRONOMBRE")}, ${c.GetString("DESC")}${elSubTotal}"$)
|
||||
Private cantXpu As String = $"${c.GetString("PE_CANT")} x ${elSubTotal}"$
|
||||
If imprimirEste Then Printer1.WriteString($"${c.GetString("PE_CANT")} ${elNombre}${CRLF}${cantXpu}${Subs.alineaDerecha("$"&NumberFormat2(elSubTotal, 1, 2, 2, True), (30 - cantXpu.Length), ".")}${CRLF}"$)
|
||||
Log($"${c.GetString("PE_CANT")} ${elNombre}${CRLF}${cantXpu}${Subs.alineaDerecha("$"&NumberFormat2(elSubTotal, 1, 2, 2, True), (30 - cantXpu.Length), ".")}${CRLF}"$)
|
||||
Next
|
||||
@@ -2200,6 +2528,11 @@ Private Sub b_imprimirTicket_Click
|
||||
' If logger Then Log($"${CRLF}Propina: $${NumberFormat2(c.GetString("PT_PROPINA"), 1, 2, 2, True)}"$)
|
||||
' elTotal = elTotal + c.GetString("PT_PROPINA")
|
||||
' End If
|
||||
If tipoPago <> "VENTA" Then
|
||||
If imprimirEste Then Printer1.WriteString($"${CRLF}IVA: $${NumberFormat2(((elTotal * 0.16)), 1, 2, 2, True)}"$)
|
||||
If logger Then Log($"${CRLF}IVA: $${NumberFormat2(((elTotal * 0.16)), 1, 2, 2, True)}"$)
|
||||
End If
|
||||
|
||||
If imprimirEste Then Printer1.WriteString($"${CRLF}Total: $${NumberFormat2(elTotal, 1, 2, 2, True)}"$)
|
||||
If logger Then Log($"${CRLF}Total: $${NumberFormat2(elTotal, 1, 2, 2, True)}"$)
|
||||
If imprimirEste Then Printer1.WriteString($"${CRLF}${n2t.NumberToWords(NumberFormat2(elTotal, 1, 2, 2, False))}"$)
|
||||
@@ -2234,10 +2567,12 @@ Private Sub b_imprimirTicket_Click
|
||||
If imprimirEste Then Printer1.WriteString("------------------------------" & CRLF)
|
||||
If logger Then Log("------------------------------" & CRLF)
|
||||
If imprimirEste Then Printer1.WriteString(CRLF)
|
||||
If tipoPago = "VENTA" Then
|
||||
If tipoPago = "VENTA" And cb_leyendaDescuento.Checked Then
|
||||
If imprimirEste Then Printer1.WriteString(Printer1.REVERSE)
|
||||
If imprimirEste Then Printer1.WriteString("------ 10% DE DESCUENTO ------" & CRLF)
|
||||
If imprimirEste Then Printer1.WriteString("----- PAGANDO EN EFECTIVO ----" & CRLF)
|
||||
If imprimirEste Then Printer1.WriteString("-- >> SOLO EN ALIMENTOS << ---" & CRLF)
|
||||
If imprimirEste Then Printer1.WriteString(Printer1.UNREVERSE)
|
||||
If imprimirEste Then Printer1.WriteString(CRLF)
|
||||
If logger Then Log("------ 10% DE DESCUENTO ------" & CRLF)
|
||||
If logger Then Log("----- PAGANDO EN EFECTIVO ----" & CRLF)
|
||||
@@ -2255,251 +2590,19 @@ Private Sub b_imprimirTicket_Click
|
||||
Sleep(1000)
|
||||
b_imprimirTicket.Enabled = True
|
||||
ProgressDialogHide
|
||||
' p_leyendaDescuento.Visible = False
|
||||
p_transparenteDescuento.Visible = False
|
||||
' B4XPage_CloseRequest
|
||||
cb_mostrarDescuento.Checked = False
|
||||
' cb_opcionEfectivo_CheckedChange(False)
|
||||
End Sub
|
||||
|
||||
Private Sub cb_pagoPropina_SelectedIndexChanged (Index As Int)
|
||||
|
||||
Private Sub et_buscar_TextChanged (Old As String, New As String)
|
||||
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_TIPO = '${Starter.catActual}' and CAT_GP_NOMBRE like '%${New}%' order by CAT_GP_NOMBRE"$)
|
||||
LlenaProdsLL(c, Null)
|
||||
Log(c.RowCount)
|
||||
End Sub
|
||||
|
||||
Private Sub p_transparenteCambioMesa_Click
|
||||
'Para evitar que el clic en pantalla no se siga hacia atras
|
||||
End Sub
|
||||
|
||||
Private Sub l_prodX_LongClick
|
||||
Log(Sender.As(Label).tag)
|
||||
Private m As Map = Sender.As(Label).tag.As(Map)
|
||||
If m.Get("prod").As(String).Contains("Alimentos Varios") Then
|
||||
p_renombraVarios.BringToFront
|
||||
et_nombreVariable.Text = m.Get("prod")
|
||||
et_nombreVariable.tag = m
|
||||
et_precioVariable.Text = m.Get("precio")
|
||||
p_renombraVarios.Visible = True
|
||||
Else
|
||||
ToastMessageShow("Este artículo no es editable", False)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub b_renombraVarios_Click
|
||||
p_renombraVarios.Visible = False
|
||||
Private m As Map = et_nombreVariable.tag.As(Map)
|
||||
' Private c As Cursor=Starter.skmt.ExecQuery($"select * from pedido where PE_PROID = '${m.Get("id")}' and PE_TICKET = '${Starter.ticketActual}' and PE_MESA = '${Starter.mesaActual}' and PE_TIPO = 'VENTA'"$)
|
||||
' Log($"select * from pedido where PE_PROID = '${m.Get("id")}' and PE_TICKET = '${Starter.ticketActual}' and PE_MESA = '${Starter.mesaActual}' and PE_TIPO = 'VENTA'"$)
|
||||
' If c.RowCount > 0 Then
|
||||
' Starter.skmt.ExecNonQuery($"update PEDIDO set PE_PRONOMBRE = '${et_nombreVariable.text}', PE_COSTOU = '${et_precioVariable.text}' where PE_PROID = '${m.Get("id")}' and PE_TIPO = 'VENTA' and PE_MESA = '${Starter.mesaActual}' and PE_TICKET = '${Starter.ticketActual}'"$)
|
||||
' Log($"update PEDIDO set PE_PRONOMBRE = '${et_nombreVariable.text}', PE_COSTOU = '${et_precioVariable.text}' where PE_PROID = '${et_nombreVariable.tag}' and PE_TIPO = 'VENTA' and PE_MESA = '${Starter.mesaActual}' and PE_TICKET = '${Starter.ticketActual}'"$)
|
||||
' Else
|
||||
Private cant As Int = m.Get("cant")
|
||||
If cant = 0 Then cant = 1
|
||||
Subs.actualizaProducto(et_precioVariable.text, cant, et_nombreVariable.Text, m.Get("id"), Starter.ticketActual, DateTime.Now, Starter.meseroActual, Starter.mesaActual, et_precioVariable.Text, "VENTA", Starter.comensalesActuales)
|
||||
' End If
|
||||
|
||||
LlenaProdsLL(Null, Null)
|
||||
End Sub
|
||||
|
||||
Private Sub p_transparentePago_Click
|
||||
'Para evitar que el clic en pantalla no se siga hacia atras
|
||||
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)
|
||||
End Sub
|
||||
|
||||
Sub agregaFormaDePago(left0 As Int, top0 As Int, tag0 As Int)
|
||||
Log("agregaFormaDePago |" & top0 & "|" & tag0)
|
||||
p_opcionEfectivo.Visible = False
|
||||
Private p_num As Panel
|
||||
p_num.Initialize("")
|
||||
p_num.LoadLayout("formaPago")
|
||||
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
|
||||
b_pagoCerrar.Top = b_pagoCerrar.Top + 70
|
||||
End If
|
||||
l_tipoPago2.Text = $"${Starter.formasDePago}:"$
|
||||
cb_pago2.Tag = tag0
|
||||
et_montoPago2.Tag = tag0
|
||||
cb_pago2.SetItems(Array As String("American Express", "Visa/Mastercard", "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)
|
||||
b_pagoCerrar.Enabled = False
|
||||
If listaFormaDePago.Size > 1 Then l_faltaMonto.Visible = True
|
||||
End Sub
|
||||
|
||||
Private Sub cb_pago2_SelectedIndexChanged (Index As Int)
|
||||
Log(Sender.As(B4XComboBox).tag)
|
||||
Log(Sender.As(B4XComboBox).SelectedItem)
|
||||
listaFormaDePago.Set(Sender.As(B4XComboBox).tag - 1, Sender.As(B4XComboBox).SelectedItem)
|
||||
If Sender.As(B4XComboBox).SelectedItem = "Efectivo" And listaFormaDePago.Size = 1 Then
|
||||
Private c As Cursor = Starter.skmt.ExecQuery("select * from CAT_VARIABLES where CAT_VA_DESCRIPCION = 'DESCUENTO X EFECTIVO'")
|
||||
c.Position = 0
|
||||
l_opcionEfectivo.Text = $"${c.GetString("CAT_VA_VALOR")}% desc."$
|
||||
p_opcionEfectivo.Visible = True
|
||||
cb_opcionEfectivo.Checked = True
|
||||
|
||||
Else
|
||||
Log(listaFormaDePago.Size)
|
||||
p_opcionEfectivo.Visible = False
|
||||
cb_opcionEfectivo.Checked = False
|
||||
End If
|
||||
Log(listaFormaDePago)
|
||||
End Sub
|
||||
|
||||
Private Sub et_montoPago2_TextChanged (Old As String, New As String)
|
||||
Log("TEXT CHANGED")
|
||||
' Log(Starter.totalActual)
|
||||
Private subtotal As String = 0
|
||||
Private enBlanco As Boolean = False
|
||||
For i = 0 To listaMontoDePago.Size - 1
|
||||
Log(listaMontoDePago.Get(i).As(EditText).text)
|
||||
If listaMontoDePago.Get(i).As(EditText).text <> "" Then
|
||||
subtotal = subtotal + listaMontoDePago.Get(i).As(EditText).text
|
||||
Else
|
||||
enBlanco = True
|
||||
End If
|
||||
Next
|
||||
Log($"${Starter.totalActual} - ${subtotal} = ${Starter.totalActual - subtotal}"$)
|
||||
LogColor($"FALTAN ${Starter.totalActual - subtotal}"$, Colors.blue)
|
||||
If listaMontoDePago.Size > 1 Then
|
||||
l_faltaMonto.Visible = True
|
||||
If subtotal < Starter.totalActual Then
|
||||
LogColor($"FALTAN ${Starter.totalActual - subtotal}"$, Colors.red)
|
||||
l_faltaMonto.Text = $"FALTAN ${NumberFormat2((Starter.totalActual - subtotal), 1, 0, 0, False)}"$
|
||||
else if subtotal > Starter.totalActual Then
|
||||
LogColor($"SOBRAN ${subtotal - Starter.totalActual}"$, Colors.red)
|
||||
l_faltaMonto.Text = $"SOBRAN ${NumberFormat2((subtotal - Starter.totalActual), 1, 0, 0, False)}"$
|
||||
Else
|
||||
l_faltaMonto.Text = ""
|
||||
End If
|
||||
End If
|
||||
If listaMontoDePago.Size > 1 And (l_faltaMonto.Text <> "" Or enBlanco) Then
|
||||
b_pagoCerrar.Enabled = False
|
||||
Else
|
||||
b_pagoCerrar.Enabled = True
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub et_montoPago2_FocusChanged (HasFocus As Boolean)
|
||||
Log("FOCUS CHANGED")
|
||||
Log(Starter.totalActual)
|
||||
Private subtotal As String = 0
|
||||
Private enBlanco As Boolean = False
|
||||
For i = 0 To listaMontoDePago.Size - 1
|
||||
Log(listaMontoDePago.Get(i).As(EditText).text)
|
||||
If listaMontoDePago.Get(i).As(EditText).text <> "" Then
|
||||
subtotal = subtotal + listaMontoDePago.Get(i).As(EditText).text
|
||||
Else
|
||||
enBlanco = True
|
||||
End If
|
||||
Next
|
||||
LogColor($"FALTAN ${Starter.totalActual - subtotal}"$, Colors.blue)
|
||||
If subtotal < Starter.totalActual Then
|
||||
LogColor($"FALTAN ${Starter.totalActual - subtotal}"$, Colors.red)
|
||||
l_faltaMonto.Text = $"FALTAN ${NumberFormat2((Starter.totalActual - subtotal), 1, 0, 0, False)}"$
|
||||
else if subtotal > Starter.totalActual Then
|
||||
LogColor($"SOBRAN ${subtotal - Starter.totalActual}"$, Colors.red)
|
||||
l_faltaMonto.Text = $"SOBRAN ${NumberFormat2((subtotal - Starter.totalActual), 1, 0, 0, False)}"$
|
||||
Else
|
||||
l_faltaMonto.Text = ""
|
||||
End If
|
||||
If listaMontoDePago.Size > 1 And (l_faltaMonto.Text <> "" Or enBlanco) Then
|
||||
b_pagoCerrar.Enabled = False
|
||||
Else
|
||||
b_pagoCerrar.Enabled = True
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub cb_opcionEfectivo_CheckedChange(Checked As Boolean)
|
||||
Private desc As String = 1 / Subs.traeDescXefectivo
|
||||
Private tot As String = Subs.traeTotalTicketActual_P("VENTA")
|
||||
If Checked Then
|
||||
Starter.skmt.ExecNonQuery($"update PEDIDO set PE_DESC = '${Subs.traeDescXefectivo}' where PE_TIPO = 'VENTA' and PE_MESA = '${Starter.mesaActual}' and PE_TICKET = '${Starter.ticketActual}'"$)
|
||||
' et_montoPago2.Text = NumberFormat2(tot - (tot * desc), 1, 0, 0, False)
|
||||
' et_montoPago2.Text = Subs.traeTotalTicketActual_P
|
||||
Else
|
||||
Starter.skmt.ExecNonQuery($"update PEDIDO set PE_DESC = '0' where PE_TIPO = 'VENTA' and PE_MESA = '${Starter.mesaActual}' and PE_TICKET = '${Starter.ticketActual}'"$)
|
||||
' et_montoPago2.Text = tot
|
||||
End If
|
||||
et_montoPago2.Text = Subs.traeTotalTicketActual_P("VENTA")
|
||||
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
|
||||
If c.RowCount > 0 Then
|
||||
For i = 0 To c.RowCount - 1
|
||||
c.Position = i
|
||||
Private n As String = c.GetString("PE_PRONOMBRE")
|
||||
' Log(n.Length & " - " & n)
|
||||
If n.Length > 25 Then n = n.SubString2(0, 25)
|
||||
lv_verOrden.AddTwoLines($"${c.GetString("PE_CANT")} - ${n}"$, $"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
|
||||
End Sub
|
||||
|
||||
Private Sub b_reabrirMesa_Click
|
||||
Private t As String = Sender.As(Button).tag
|
||||
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
|
||||
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
|
||||
WobbleMenu1_Tab1Click
|
||||
End If
|
||||
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)
|
||||
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'"$)
|
||||
Starter.skmt.ExecNonQuery($"delete from PEDIDO_TICKET where PT_ORIGEN = '${d(6)}|${d(7)}' and PT_ALMACEN = 'MULTI-TICKET'"$)
|
||||
' Log($"delete from PEDIDO_TICKET where PT_ORIGEN = '${d(6)}|${d(7)}' and PT_ALMACEN = 'MULTI-TICKET'"$)
|
||||
Starter.skmt.ExecNonQuery($"update CAT_MESAS set M_ESTATUS = 'ABIERTA', M_TICKET = '${d(7)}', M_MESERO = '${d(3)}', M_COMENSALES = '${d(4)}' where M_ID = '${d(6)}'"$)
|
||||
Starter.skmt.ExecNonQuery($"update PEDIDO set PE_TIPO = 'VENTA', PE_TIPO2 = Null where PE_TIPO = 'MULTI-TICKET' and PE_MESA = '${d(6)}' and PE_TICKET = '${d(7)}'"$)
|
||||
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 = 'MULTI-TICKET' and PT_MESA = '${d(6)}' and PT_TICKET = '${d(7)}'"$)
|
||||
Starter.skmt.TransactionSuccessful
|
||||
Starter.skmt.EndTransaction
|
||||
p_reabrirMesaMulti.Visible = False
|
||||
p_transparenteVerOrden.Visible = False
|
||||
WobbleMenu1_Tab1Click
|
||||
End Sub
|
||||
Private Sub cb_mostrarDescuento_CheckedChange(Checked As Boolean)
|
||||
cb_opcionEfectivo_CheckedChange(Checked)
|
||||
End Sub
|
||||
Reference in New Issue
Block a user