diff --git a/Files/principal.bal b/Files/principal.bal index 1b0c2dd..8d747e0 100644 Binary files a/Files/principal.bal and b/Files/principal.bal differ diff --git a/Files/resumenitem.bal b/Files/resumenitem.bal new file mode 100644 index 0000000..2b3632d Binary files /dev/null and b/Files/resumenitem.bal differ diff --git a/Lanterna2.b4a b/Lanterna2.b4a index 7c4fa58..7e23b22 100644 --- a/Lanterna2.b4a +++ b/Lanterna2.b4a @@ -15,8 +15,9 @@ 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 +File24=resumenItem.bal +File25=usuario.png +File26=vecteezy_white-diagonal-stripes-with-red-line-isolated-on-white.png File3=engrane.png File4=engranes.png File5=errormanager.bal @@ -42,6 +43,7 @@ FileGroup22=Default Group FileGroup23=Default Group FileGroup24=Default Group FileGroup25=Default Group +FileGroup26=Default Group FileGroup3=Default Group FileGroup4=Default Group FileGroup5=Default Group @@ -76,7 +78,7 @@ Module4=numeroATexto Module5=Principal Module6=Starter Module7=Subs -NumberOfFiles=25 +NumberOfFiles=26 NumberOfLibraries=18 NumberOfModules=7 Version=12.8 @@ -84,7 +86,7 @@ Version=12.8 #Region Project Attributes #ApplicationLabel: Lanterna #VersionCode: 1 - #VersionName: 4.05.15 + #VersionName: 4.05.24 'SupportedOrientations possible values: unspecified, landscape or portrait. #SupportedOrientations: landscape #CanInstallToExternalStorage: False @@ -109,7 +111,6 @@ Sub Process_Globals 'These global variables will be declared once when the application starts. 'These variables can be accessed from all modules. Private xui As XUI - Private xui As XUI Public Provider As FileProvider End Sub diff --git a/Lanterna2.b4a.meta b/Lanterna2.b4a.meta index b692b6f..1680fe2 100644 --- a/Lanterna2.b4a.meta +++ b/Lanterna2.b4a.meta @@ -19,9 +19,9 @@ ModuleClosedNodes1= ModuleClosedNodes2= ModuleClosedNodes3= ModuleClosedNodes4= -ModuleClosedNodes5=2,3,5 +ModuleClosedNodes5=2,93,94,96,99,100,101 ModuleClosedNodes6= ModuleClosedNodes7= -NavigationStack=Principal,b_abrirMesa_Click,1205,2,Principal,b_leyendaDescuento_Click,2760,6,Visual Designer,login.bal,-100,1,Subs,revisaBD,214,1,Main,b_cargaProductos_Click,203,0,Main,JobDone,246,1,Principal,b_renombraVarios_Click,2370,0,Visual Designer,principal.bal,-100,6,Principal,LlenaOrden,2980,1,Principal,actualizaProductos,3070,6 +NavigationStack=Principal,Globals,181,0,Principal,b_cierreTotal_LongClick,1607,0,Principal,b_imp_Click,1783,3,Principal,b_leyendaDescuento_Click,2963,6,Principal,b_cierraAdmin_Click,1472,0,Principal,b_imp2_Click,2016,6,Visual Designer,resumenItem.bal,-100,6,Principal,b_resumen_Click,3328,6,Visual Designer,principal.bal,-100,6,Principal,acomodaResItems,3343,6,Main,JobDone,282,0 SelectedBuild=0 VisibleModules=6,5,7 diff --git a/Principal.bas b/Principal.bas index 702b511..97bcf81 100644 --- a/Principal.bas +++ b/Principal.bas @@ -168,6 +168,28 @@ Sub Globals Private i_logo As ImageView Private l_tituloHistorial As Label Private p_prevBusqueda As Panel + Private l_total2 As Label + Private subtotal As String = 0 + Private subtotal2 As String = 0 + Private b_resumen As Button + Private cb_factura As CheckBox + Private p_resumenDia As Panel + Private clv_resumenDia As CustomListView + Private l_titResumenDia As Label + Private p_resItem As Panel + Private l_formaPago As Label + Private l_comprobante As Label + Private l_total As Label + Private l_propina As Label + Private l_consumo As Label + Private l_selMedios As Label + Private b_cierraParcial As Button + Private l_titResMesa As Label + Private l_titResConsumo As Label + Private l_titResPropina As Label + Private l_titResPagoTot As Label + Private l_titResComprobante As Label + Private l_titResFormaPago As Label End Sub Sub Activity_Create(FirstTime As Boolean) @@ -184,7 +206,9 @@ Sub Activity_Create(FirstTime As Boolean) 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_resumenDia.Top = 10dip : p_resumenDia.left = 10dip + p_resumenDia.Width = Activity.Width - 20dip :p_resumenDia.height = Activity.height - 90dip + Subs.centraEtiqueta(l_titResumenDia, p_resumenDia.Width) 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. @@ -286,14 +310,17 @@ Sub l_prods_Click ' Log("clicked") Private m As Map = tlbl.tag ' Log(listaProdsOrden.IndexOf(m.Get("id"))) -' Log(listaProdsOrden) + Log(listaProdsOrden) Private indice As String = listaProdsOrden.IndexOf(m.Get("id")) Try 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) + Log(clv_orden.Size) 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) +' listaProdsOrden.Add(m.Get("id")) + Log(clv_orden.Size) Sleep(200) clv_orden.ScrollToItem(clv_orden.Size - 1) Sleep(100) @@ -303,6 +330,8 @@ Sub l_prods_Click Wait For (resalta(clv_orden.GetPanel(clv_orden.Size - 1).GetView(0))) Complete (Completed As Object) Catch Log(LastException) + listaProdsOrden.Initialize + LlenaOrden End Try ' Sleep(400) ' clv_orden.GetPanel(clv_orden.Size - 1).GetView(0).Color = 0xFFE2EEFF 'Regresamos el color original. @@ -323,7 +352,7 @@ Sub l_prods_Click Catch Log(LastException) End Try -' Log(listaProdsOrden) + Log(listaProdsOrden) End Sub Sub resalta(p As Panel) As ResumableSub @@ -419,7 +448,9 @@ End Sub Sub Activity_KeyPress (key As Int) As Boolean ' BACK key pressed If key=KeyCodes.KEYCODE_BACK Then - If p_prevBusqueda.Visible Then + If p_resumenDia.Visible Then + p_resumenDia.Visible = False + else If p_prevBusqueda.Visible Then p_prevBusqueda.Visible = False ' et_selBuscar.h else If p_transparenteDescuento.Visible Then @@ -853,6 +884,7 @@ End Sub Private Sub WobbleMenu1_Tab1Click ' Log("TAB 1") + If p_resumenDia.Visible Then p_resumenDia.Visible = False If p_transparentePago.Visible Then Activity_KeyPress(KeyCodes.KEYCODE_BACK) If Subs.revisaCierreAdmin Then p_transparenteCierreAdmin.BringToFront @@ -877,6 +909,7 @@ End Sub Private Sub WobbleMenu1_Tab2Click ' Log("TAB 2") + If p_resumenDia.Visible Then p_resumenDia.Visible = False p_verOrden.Visible = False Subs.panelVisible(p_historial, 0, 0) p_about.Visible = False @@ -1073,7 +1106,7 @@ Sub LlenaMesas(p As ResultSet, extra As String) 'ignore Private m_mesas As Map m_mesas.Initialize Do While p.NextRow - Private SUBTOTAL2 As String = "0" + Private subtotal2 As String = "0" Private NO_ARTS2 As String = "0" ' Log(p.GetString("ESTATUS2")) If p.GetString("ESTATUS2") = "ABIERTA" Then @@ -1081,12 +1114,12 @@ Sub LlenaMesas(p As ResultSet, extra As String) 'ignore 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") + subtotal2 = pt.GetString("SUBTOTAL") NO_ARTS2 = pt.GetString("NO_ARTS") End If End If ' Log($"${SUBTOTAL2}, ${NO_ARTS2}"$) - Dim tempMap As Map = CreateMap("id":p.GetString("M_ID"), "numero":p.GetString("M_NUMERO"), "nombre":p.GetString("M_NOMBRE"), "zona":p.GetString("M_ZONA"), "ticket":p.GetString("M_TICKET"), "estatus":p.GetString("ESTATUS2"), "mesero":p.GetString("MESERO"), "comensales":p.GetString("COMENSALES"), "subtotal":SUBTOTAL2, "articulos":NO_ARTS2) + Dim tempMap As Map = CreateMap("id":p.GetString("M_ID"), "numero":p.GetString("M_NUMERO"), "nombre":p.GetString("M_NOMBRE"), "zona":p.GetString("M_ZONA"), "ticket":p.GetString("M_TICKET"), "estatus":p.GetString("ESTATUS2"), "mesero":p.GetString("MESERO"), "comensales":p.GetString("COMENSALES"), "subtotal":subtotal2, "articulos":NO_ARTS2) ' m_mesas.Put(p.GetString("M_ID"), tempMap) Private Pnl As B4XView = xui.CreatePanel("") Pnl.SetLayoutAnimated(0, 0, 0, clv_mesas.AsView.Width, 70dip) @@ -1160,6 +1193,13 @@ Private Sub p_mesasItem_Click selBuscar = "%" actualizaProductos("Alimentos") LlenaOrden + Starter.ticketFactura = False + Private f As Cursor = Starter.skmt.ExecQuery($"select ifnull(PT_FACTURAR, 'false') as PT_FACTURAR from PEDIDO_TICKET where PT_TICKET = '${Starter.ticketActual}' and PT_MESA = '${Starter.mesaActual}' and PT_PAGO = 'VENTA'"$) + If f.RowCount > 0 Then + f.Position = 0 + Starter.ticketFactura = f.GetString("PT_FACTURAR") + End If + cb_factura.Checked = Starter.ticketFactura End Sub Private Sub p_mesasItem_LongClick @@ -1255,8 +1295,8 @@ Private Sub b_mesaCerrar_Click cb_opcionEfectivo.Checked = False p_formasDePago.Height = 40dip p_propina.Top = 143dip - p_botonesCerrar.Top = 265dip - p_pago.Height = 360dip + p_botonesCerrar.Top = 295dip + p_pago.Height = 390dip 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 @@ -1456,6 +1496,7 @@ End Sub Private Sub b_cierreTotal_Click ' Log("click") + b_envioInfo.Enabled = True sv_resumen.Panel.Height = p_resumen.Height cs.Initialize Log(l_resumen.text) @@ -1506,6 +1547,52 @@ Private Sub b_cierreTotal_Click End If End Sub +Private Sub b_cierraParcial_Click + sv_resumen.Panel.Height = p_resumen.Height + b_envioInfo.Enabled = False + cs.Initialize + Log(l_resumen.text) + Private c As Cursor = Starter.skmt.ExecQuery("select PE_MESA, PE_TIPO, PE_TICKET, sum(PE_COSTO_TOT) as SUBTOT from PEDIDO group by PE_MESA, pe_tipo, PE_TICKET order by PE_MESA, PE_TIPO desc") + If c.RowCount > 0 Then + c.Position = 0 + Private mesaAnt As String = "" + Private tipoAnt As String = "" + Private tipo As String + Private ticket As String + DateTime.DateFormat = "dd/mm/yyyy HH:mm:ss" +' cs.Append($"Fecha: ${DateTime.Date(DateTime.now)}${CRLF}${CRLF}"$) + For i = 0 To c.RowCount - 1 + c.Position = i + ticket = c.GetString("PE_TICKET") + If c.GetString("PE_TIPO") = "TARJETA" Then + tipo = "Pago Tarjeta " + Else If c.GetString("PE_TIPO") = "EFECTIVO" Then + tipo = "Pago Efectivo " + End If + If mesaAnt <> c.GetString("PE_MESA") Then + Private tm As Cursor = Starter.skmt.ExecQuery($"select sum(PT_MONTO) as totalMesa from PEDIDO_TICKET where PT_MESA = '${c.GetString("PE_MESA")}' and PT_PAGO <> 'MULTI-TICKET'"$) + tm.Position = 0 + cs.Color(Colors.RGB(1,127,1)).Append($"Mesa ${c.GetString("PE_MESA")} - $${NumberFormat2(tm.GetString("totalMesa"), 1, 2, 2, True)} ${CRLF}"$).pop + Private tipoAnt As String = "" + End If + If tipoAnt <> c.GetString("PE_TIPO") And c.GetString("PE_TIPO") <> "MULTI-TICKET" Then + Private tpt As Cursor = Starter.skmt.ExecQuery($"select sum(PT_MONTO) as totalTipo from PEDIDO_TICKET where PT_MESA = '${c.GetString("PE_MESA")}' and PT_PAGO = '${c.GetString("PE_TIPO")}'"$) + tpt.Position = 0 + cs.Color(Colors.red).Append($" * ${tipo} - $${NumberFormat2(tpt.GetString("totalTipo"), 1, 2, 2, True)} ${CRLF}"$).pop + End If + If c.GetString("PE_TIPO") <> "MULTI-TICKET" Then + cs.Append($" Ticket ${ticket}: $${NumberFormat2(c.GetString("SUBTOT"), 0, 2, 2, True)}${CRLF}"$).Popall + End If + mesaAnt = c.GetString("PE_MESA") + tipoAnt = c.GetString("PE_TIPO") + Next + l_resumen.Text = cs + l_resumen.Height = su.MeasureMultilineTextHeight(l_resumen, l_resumen.Text) + sv_resumen.Panel.Height = l_resumen.Height + End If + Subs.panelVisible(p_transparenteResumen, 0, 0) +End Sub + Private Sub b_cierreTotal_LongClick Log("click") sv_resumen.Panel.Height = p_resumen.Height @@ -1642,8 +1729,8 @@ Sub b_imp_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 'Si no hay mesas abiertas entonces ... - Private c As Cursor = Starter.skmt.ExecQuery("select PE_MESA, PE_TIPO, PE_TICKET, sum(PE_COSTO_TOT) as SUBTOT from PEDIDO group by PE_MESA, pe_tipo, PE_TICKET order by PE_MESA, PE_TIPO desc") +' If c.RowCount = 0 Then 'Si no hay mesas abiertas entonces ... + Private c As Cursor = Starter.skmt.ExecQuery("select PE_MESA, PE_TIPO, PE_TICKET, sum(PE_COSTO_TOT) as SUBTOT from PEDIDO where PE_TIPO <> 'VENTA' group by PE_MESA, pe_tipo, PE_TICKET order by PE_MESA, PE_TIPO desc") If c.RowCount > 0 Then c.Position = 0 Private mesaAnt As String = "" @@ -1695,9 +1782,9 @@ Sub b_imp_Click sv_resumen.Panel.Height = l_resumen.Height End If Subs.panelVisible(p_transparenteResumen, 0, 0) - Else - ToastMessageShow("¡Es necesario que NO haya mesas abiertas para realizar el cierre!", True) - End If +' Else +' ToastMessageShow("¡Es necesario que NO haya mesas abiertas para realizar el cierre!", True) +' End If ' Printer1.WriteString("__________" & CRLF) ' Printer1.WriteString("------------------------------" & CRLF) ' Printer1.WriteString("----ESTE TICKET NO ES UN -----" & CRLF) @@ -1782,8 +1869,8 @@ Sub b_imp2_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 'Si no hay mesas abiertas entonces ... - Private c As Cursor = Starter.skmt.ExecQuery("select distinct CAT_GP_CLASIF, PE_PRONOMBRE, sum(pe_cant) as cuantos, sum(pe_costo_tot) as monto from pedido join CAT_GUNAPROD on cat_gp_id = PE_PROID group by PE_PRONOMBRE order by CAT_GP_CLASIF, PE_PRONOMBRE") 'Este query quita los "Consumo de alimentos", que son los tickets que se generan con el multi-ticket, porque en CAT_GUNAPROD no existe el ID CDA01. +' If c.RowCount = 0 Then 'Si no hay mesas abiertas entonces ... + Private c As Cursor = Starter.skmt.ExecQuery("select distinct CAT_GP_CLASIF, PE_PRONOMBRE, sum(pe_cant) as cuantos, sum(pe_costo_tot) as monto from pedido join CAT_GUNAPROD on cat_gp_id = PE_PROID where PE_TIPO <> 'VENTA' group by PE_PRONOMBRE order by CAT_GP_CLASIF, PE_PRONOMBRE") 'Este query quita los "Consumo de alimentos", que son los tickets que se generan con el multi-ticket, porque en CAT_GUNAPROD no existe el ID CDA01. ' Log(c.RowCount) If c.RowCount > 0 Then c.Position = 0 @@ -1890,7 +1977,7 @@ Sub b_imp2_Click Log($"Comensales ...........${totalComensales} ${CRLF}"$) 'PAGOS - Private pgs As Cursor = Starter.skmt.ExecQuery($"Select PT_PAGO2, sum(PT_NOART) As arts, sum(PT_MONTO) As monto from PEDIDO_TICKET where pt_pago <> 'MULTI-TICKET' group by PT_PAGO2"$) + Private pgs As Cursor = Starter.skmt.ExecQuery($"Select PT_PAGO2, sum(PT_NOART) As arts, sum(PT_MONTO) As monto from PEDIDO_TICKET where pt_pago <> 'MULTI-TICKET' and pt_pago <> 'VENTA' group by PT_PAGO2"$) Private totalComensales As Int = 0 If imprimirAqui Then Printer1.WriteString($"${CRLF}"$) Printer1.WriteString(Printer1.BOLD) @@ -1926,7 +2013,7 @@ 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}"$) + If imprimirAqui Then Printer1.WriteString(CRLF) Printer1.WriteString(Printer1.BOLD) If imprimirAqui Then Printer1.WriteString($"*** PROPINAS *** ${CRLF}"$) Printer1.WriteString(Printer1.NOBOLD) @@ -1936,23 +2023,25 @@ Sub b_imp2_Click 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")) +' 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) - +' LogColor($">>>>>>> ${Ceil(25.2)}"$, Colors.red) +' LogColor($">>>>>>> ${Ceil(25.5)}"$, Colors.red) ' Efectivo...............$300.00 ' Tarjeta................$910.00 + If imprimirAqui Then Printer1.WriteString(CRLF) + If imprimirAqui Then Printer1.WriteString(CRLF) + If imprimirAqui Then Printer1.WriteString(CRLF) 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) - End If +' Else +' ToastMessageShow("¡Es necesario que NO haya mesas abiertas para realizar el cierre!", True) +' End If Sleep(1000) Printer1.DisConnect Catch @@ -2324,7 +2413,7 @@ Private Sub b_imprimirTicket_Click p_transparenteDescuento.Visible = True ' p_leyendaDescuento.Visible = True ' p_leyendaDescuento.BringToFront - cb_leyendaDescuento.Checked = True + If Not(Starter.ticketFactura) Then cb_leyendaDescuento.Checked = True End Sub Private Sub cb_pagoPropina_SelectedIndexChanged (Index As Int) @@ -2401,13 +2490,13 @@ Sub agregaFormaDePago(left0 As Int, top0 As Int, tag0 As Int, brinco As Int) ' x.Width = 800dip ' p_num = x ' p_num.Width = 700dip - Log(p_formasDePago.Width & "|" & p_num.Width) +' 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}"$) +' Log($"${brinco}|${l_tipoPago2.Height}"$) If Starter.formasDePago > 1 Then p_propina.Top = p_propina.Top + brinco p_formasDePago.Height = p_formasDePago.Height + brinco @@ -2419,6 +2508,7 @@ Sub agregaFormaDePago(left0 As Int, top0 As Int, tag0 As Int, brinco As Int) ' 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")) + If Starter.ticketFactura Then cb_pago2.SetItems(Array As String("American Express", "Visa/Mastercard Credito","Visa/Mastercard Debito")) p_num.Tag = tag0 listaFormasDePagoCB.Add(cb_pago2) listaFormaDePago.Add(cb_pago2.SelectedItem) @@ -2450,7 +2540,7 @@ End Sub Private Sub et_montoPago2_TextChanged (Old As String, New As String) ' Log("TEXT CHANGED") ' Log(Starter.totalActual) - Private subtotal As String = 0 + subtotal = 0 Private enBlanco As Boolean = False For i = 0 To listaMontoDePago.Size - 1 ' Log(listaMontoDePago.Get(i).As(EditText).text) @@ -2473,6 +2563,11 @@ Private Sub et_montoPago2_TextChanged (Old As String, New As String) Else l_faltaMonto.Text = "" End If + subtotal2 = subtotal + If et_propina.Text <> "" And IsNumber(et_propina.Text) Then + subtotal2 = subtotal + et_propina.text + End If + l_total2.text = subtotal2 End If If listaMontoDePago.Size > 1 And (l_faltaMonto.Text <> "" Or enBlanco) Then b_pagoCerrar.Enabled = False @@ -2481,6 +2576,12 @@ Private Sub et_montoPago2_TextChanged (Old As String, New As String) End If End Sub +Private Sub et_propina_TextChanged (Old As String, New As String) + subtotal2 = subtotal + If New <> "" And IsNumber(New) Then subtotal2 = subtotal + New + l_total2.text = subtotal2 +End Sub + Private Sub et_montoPago2_FocusChanged (HasFocus As Boolean) ' Log("FOCUS CHANGED") ' Log(Starter.totalActual) @@ -2797,6 +2898,10 @@ Private Sub b_leyendaDescuento_Click If i = c.RowCount - 1 Then Private desc As ResultSet = Starter.skmt.ExecQuery($"select * from PEDIDO where PE_PRONOMBRE = 'DESCUENTO' and PE_MESA = '${Starter.mesaActual}' and PE_TIPO = '${tipoPago}' and PE_TICKET = '${Starter.ticketActual}'"$) Do While desc.NextRow + + If imprimirEste Then Printer1.WriteString($"Subtotal: ${Subs.alineaDerecha("$"&NumberFormat2( (Subs.traeTotalTicketActual_P(tipoPago)), 1, 2, 2, True), (30 - 12), ".")}${CRLF}"$) + Log($"Subtotal: ${Subs.alineaDerecha("$"&NumberFormat2((Subs.traeTotalTicketActual_P(tipoPago)), 1, 2, 2, True), (30 - 12), ".")}${CRLF}"$) + cantXpu = $"1 x ${desc.GetString("PE_COSTOU")}"$ If imprimirEste Then Printer1.WriteString($"1 DESCUENTO${CRLF}${cantXpu}${Subs.alineaDerecha("$"&NumberFormat2(desc.GetString("PE_COSTO_TOT"), 1, 2, 2, True), (30 - cantXpu.Length), ".")}${CRLF}"$) Log($"1 DESCUENTO${CRLF}${cantXpu}${Subs.alineaDerecha("$"&NumberFormat2(desc.GetString("PE_COSTO_TOT"), 1, 2, 2, True), (30 - cantXpu.Length), ".")}${CRLF}"$) @@ -2866,6 +2971,19 @@ Private Sub b_leyendaDescuento_Click If logger Then Log("----- PAGANDO EN EFECTIVO ----" & CRLF) If logger Then Log("-- >> SOLO EN ALIMENTOS << ---" & CRLF) End If + If cb_factura.Checked Then +' If imprimirEste Then Printer1.WriteString(Printer1.REVERSE) + If imprimirEste Then Printer1.WriteString("------- PARA FACTURAR -------" & CRLF) + If imprimirEste Then Printer1.WriteString("---- INGRESAR A ESTA LIGA ----" & CRLF) + If imprimirEste Then Printer1.WriteString("--- TIENE 3 DIAS DESDE EL ----" & CRLF) + If imprimirEste Then Printer1.WriteString("-- MOMENTO DE LA IMPRESION --" & CRLF) + If imprimirEste Then Printer1.WriteString("http://facturacionkmts.com.mx" & CRLF) + If imprimirEste Then Printer1.WriteString(Printer1.UNREVERSE) + If imprimirEste Then Printer1.WriteString(CRLF) + If logger Then Log("------ PARA FACTURAR ------" & CRLF) + If logger Then Log("----- INGRESAR A ESTA LIGA ----" & CRLF) + If logger Then Log("http://facturacionkmts.com.mx" & CRLF) + End If If imprimirEste Then Printer1.WriteString(CRLF) If imprimirEste Then Printer1.WriteString(CRLF) Sleep(1000) @@ -3036,8 +3154,11 @@ Sub actualizaProductos(categoria As String) ' l_prods.SetColorAndBorder(Colors.White, 1dip, Colors.Black, 0) l_prods.SetTextAlignment("CENTER", "CENTER") ' Log(nombre) - l_prods.Text = w & " " & nombre - If nombre.Length > 25 Then l_prods.Text = w & " " & nombre.SubString2(0, 25) + If nombre.Length > 20 Then nombre = nombre.SubString2(0, 20) + nombre = w & " " & nombre & " $" & c.getstring("CAT_GP_PRECIO") + + l_prods.Text = nombre + ' {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) @@ -3062,7 +3183,7 @@ Sub actualizaProductos(categoria As String) ' Log("NO CABEN - " & w & " USAMOS " & panelEnUso) End If If c.GetString("CAT_GP_CLASIF") <> clasifAnt Then - Log(">>> " & c.GetString("CAT_GP_CLASIF")) +' Log(">>> " & c.GetString("CAT_GP_CLASIF")) ' Dim labelHead As Label ' labelHead.Initialize("l_head") ' labelHead.Width = 119dip @@ -3074,7 +3195,7 @@ Sub actualizaProductos(categoria As String) l_prods.TextColor = Colors.black End If clasifAnt = c.GetString("CAT_GP_CLASIF") - Log(l_prods.text) +' Log(l_prods.text) ' Log($"L:${left0}, T:${top0}, PH:${p_productos.Height}"$) If panelEnUso = 1 Then p_productos1.AddView(l_prods, left0, top0, l_prods.Width, l_prods.Height) @@ -3105,6 +3226,13 @@ Private Sub l_selAlimentos_Click actualizaProductos("Alimentos") End Sub +Private Sub l_selMedios_Click + ' Log("Medios") + selBuscar = "%" + et_selBuscar.Text = "" + actualizaProductos("MEDIA") +End Sub + Private Sub et_selBuscar_TextChanged (Old As String, New As String) If New.Length > 1 Then p_prevBusqueda.Visible = False @@ -3175,4 +3303,77 @@ End Sub Private Sub p_mesas_Click 'Para evitar que el clic en pantalla no se siga hacia atras -End Sub \ No newline at end of file +End Sub + +Private Sub b_resumen_Click + clv_resumenDia.AsView.left = 10dip : clv_resumenDia.AsView.top = 70dip + clv_resumenDia.AsView.width = p_resumenDia.Width - 20dip : clv_resumenDia.AsView.height = p_resumenDia.height - 90dip + clv_resumenDia.Base_Resize(clv_resumenDia.GetBase.Width, clv_resumenDia.GetBase.Height) 'Cambiamos el tamaño del panel interno de la lista para que se ajuste al nuevo tamaño. + Private n As Int = 0 + p_resumenDia.Visible = True + clv_resumenDia.Clear + Private o As ResultSet = Starter.skmt.ExecQuery($"select *, ifnull(PT_PROPINA, 0) as PT_PROPINA, ifnull(PT_FACTURAR, 'false') as PT_FACTURAR from PEDIDO_TICKET order by PT_FECHA desc"$) + Do While o.NextRow + Private Pnl As B4XView = xui.CreatePanel("") + Pnl.SetLayoutAnimated(0, 0, 0, clv_resumenDia.AsView.Width, 52dip) + clv_resumenDia.Add(Pnl, 1) + Dim Pnl1 As B4XView = clv_resumenDia.GetPanel(n) + Pnl1.LoadLayout("resumenItem") + acomodaResItems + p_resItem.Width = clv_resumenDia.AsView.Width + p_resItem.Height = Pnl1.Height + l_mesa.Text = o.GetString("PT_MESA") + l_consumo.Text = "$" & NumberFormat2(o.GetString("PT_MONTO"), 1, 2, 2, True) + l_propina.Text = "$" & NumberFormat2(o.GetString("PT_PROPINA"), 1, 2, 2, True) + l_total.Text = "$" & NumberFormat2((o.GetString("PT_MONTO") + o.GetString("PT_PROPINA")), 1, 2, 2, True) + l_comprobante.Text = "NOTA" + If o.GetString("PT_FACTURAR") = "true" Then l_comprobante.Text = "FACTURA" + l_formaPago.Text = o.GetString("PT_PAGO2") + n = n + 1 + Loop +End Sub + +Sub acomodaResItems + l_mesa.Width = clv_resumenDia.AsView.Width * 0.1 + l_titResMesa.Left = l_mesa.left + 10dip : l_titResMesa.width = l_mesa.Width + l_consumo.Width = clv_resumenDia.AsView.Width * 0.15 + l_consumo.Left = l_mesa.Left + l_mesa.Width + 1 + l_titResConsumo.Left = l_consumo.left + 10dip : l_titResConsumo.width = l_consumo.Width + l_propina.Width = clv_resumenDia.AsView.Width * 0.15 + l_propina.Left = l_consumo.Left + l_consumo.Width + 1 + l_titResPropina.Left = l_propina.left + 10dip : l_titResPropina.width = l_propina.Width + l_total.Width = clv_resumenDia.AsView.Width * 0.15 + l_total.Left = l_propina.Left + l_propina.Width + 1 + l_titResPagoTot.Left = l_total.left + 10dip : l_titResPagoTot.width = l_total.Width + l_comprobante.Width = clv_resumenDia.AsView.Width * 0.15 + l_comprobante.Left = l_total.Left + l_total.Width + 1 + l_titResComprobante.Left = l_comprobante.left + 10dip : l_titResComprobante.width = l_comprobante.Width + l_formaPago.Width = clv_resumenDia.AsView.Width * 0.20 + l_formaPago.Left = l_comprobante.Left + l_comprobante.Width + 1 + l_titResFormaPago.Left = l_formaPago.left + 10dip : l_titResFormaPago.width = l_formaPago.Width +End Sub + +Private Sub cb_factura_CheckedChange(Checked As Boolean) + Starter.ticketFactura = Checked + If Checked Then + Log(222) + cb_leyendaDescuento.Checked = False + cb_mostrarDescuento.Checked = False + cb_leyendaDescuento.Enabled = False + cb_mostrarDescuento.Enabled = False + Else + Log(333) + cb_leyendaDescuento.Enabled = True + cb_mostrarDescuento.Enabled = True + End If + Starter.skmt.ExecNonQuery($"update PEDIDO_TICKET set PT_FACTURAR = '${Checked}' where PT_TICKET = '${Starter.ticketActual}' and PT_MESA = '${Starter.mesaActual}' and PT_PAGO = 'VENTA'"$) +End Sub + +Private Sub p_resumenDia_Click + +End Sub + +Private Sub p_resItem_Click + +End Sub + diff --git a/Starter.bas b/Starter.bas index 2c13daa..c20316d 100644 --- a/Starter.bas +++ b/Starter.bas @@ -30,7 +30,8 @@ Sub Process_Globals Dim nivelActual As String Dim catActual, subcatActual As String Dim atrasPresionado As Boolean = False - dim cargaMeseros as Boolean = False + Dim cargaMeseros As Boolean = False + dim ticketFactura as Boolean End Sub Sub Service_Create diff --git a/Subs.bas b/Subs.bas index 2ce2239..6ad31eb 100644 --- a/Subs.bas +++ b/Subs.bas @@ -206,6 +206,7 @@ Sub revisaBD 'ignore agregaColumna("PEDIDO_TICKET", "PT_TARJETA", "TEXT") agregaColumna("PEDIDO_TICKET", "PT_PROPINA", "TEXT") agregaColumna("PEDIDO_TICKET", "PT_PAGO_PROPINA", "TEXT") + agregaColumna("PEDIDO_TICKET", "PT_FACTURAR", "TEXT") agregaColumna("PEDIDO", "PE_TICKET", "TEXT") agregaColumna("PEDIDO", "PE_MESA", "TEXT") agregaColumna("PEDIDO", "PE_MESERO", "TEXT") @@ -1298,7 +1299,7 @@ Sub actualizaProducto(costoU As String, cant As String, nombre As String, prodId ' 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) +' LogColor("ACTUALIZAMOS PROD", Colors.Blue) c.Position = 0 Private antCant As Int = 0 If IsNumber(c.GetInt("PE_CANT")) Then antCant=c.GetInt("PE_CANT")