diff --git a/Files/login.bal b/Files/login.bal
index 2fbdf65..4df7e67 100644
Binary files a/Files/login.bal and b/Files/login.bal differ
diff --git a/Lanterna2.b4a b/Lanterna2.b4a
index fe2b071..90d0961 100644
--- a/Lanterna2.b4a
+++ b/Lanterna2.b4a
@@ -70,7 +70,7 @@ Library6=javaobject
Library7=json
Library8=okhttputils2
Library9=preoptimizedclv
-ManifestCode='This code will be applied to the manifest file during compilation.~\n~'You do not need to modify it in most cases.~\n~'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136~\n~AddManifestText(~\n~~\n~)~\n~SetApplicationAttribute(android:icon, "@drawable/icon")~\n~SetApplicationAttribute(android:label, "$LABEL$")~\n~CreateResourceFromFile(Macro, Themes.LightTheme)~\n~'End of default text.~\n~~\n~SetApplicationAttribute(android:usesCleartextTraffic, "true")~\n~AddPermission(android.permission.BLUETOOTH_ADVERTISE)~\n~AddPermission(android.permission.BLUETOOTH_CONNECT)~\n~AddPermission(android.permission.BLUETOOTH_SCAN)~\n~SetApplicationAttribute(android:largeHeap, "true")~\n~SetApplicationAttribute(android:allowBackup, "false")~\n~SetApplicationAttribute(android:exported, "true")~\n~~\n~AddApplicationText(~\n~ )~\n~CreateResource(xml, provider_paths,~\n~ ~\n~)
+ManifestCode='This code will be applied to the manifest file during compilation.~\n~'You do not need to modify it in most cases.~\n~'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136~\n~AddManifestText(~\n~~\n~)~\n~SetApplicationAttribute(android:icon, "@drawable/icon")~\n~SetApplicationAttribute(android:label, "$LABEL$")~\n~CreateResourceFromFile(Macro, Themes.LightTheme)~\n~'End of default text.~\n~~\n~SetApplicationAttribute(android:usesCleartextTraffic, "true")~\n~AddPermission(android.permission.BLUETOOTH_ADVERTISE)~\n~AddPermission(android.permission.BLUETOOTH_CONNECT)~\n~AddPermission(android.permission.BLUETOOTH_SCAN)~\n~SetApplicationAttribute(android:largeHeap, "true")~\n~SetApplicationAttribute(android:allowBackup, "false")~\n~SetApplicationAttribute(android:exported, "true")~\n~~\n~AddApplicationText(~\n~ )~\n~CreateResource(xml, provider_paths,~\n~ ~\n~)~\n~~\n~ 'Para que se registre para abrir bases de datos~\n~ AddActivityText(main,~\n~~\n~~\n~~\n~~\n~~\n~)~\n~~\n~'AddActivityText(main,~\n~'~\n~'~\n~'~\n~'~\n~'~\n~'~\n~'~\n~'~\n~')
Module1=DBRequestManager
Module2=errorManager
Module3=EscPosPrinter
@@ -86,7 +86,7 @@ Version=12.8
#Region Project Attributes
#ApplicationLabel: Lanterna
#VersionCode: 1
- #VersionName: 4.06.14
+ #VersionName: 4.06.21
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: landscape
#CanInstallToExternalStorage: False
@@ -102,6 +102,8 @@ Version=12.8
'###########################################################################################################
#End Region
+'4625 y 25
+
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
@@ -141,6 +143,11 @@ Sub Globals
Private b_leyendaDescuento As Button
Private p_leyendaDescuento As Panel
Private b_reimprimirTicket As Button
+ Private b_fix As Button
+ Dim in As Intent
+ Dim intentUsado As Boolean = False
+ Private cb_importarDesdeWA As CheckBox
+ Dim habilitarImportarDesdeWA As Boolean = False
End Sub
Sub Activity_Create(FirstTime As Boolean)
@@ -186,14 +193,22 @@ Sub Activity_Resume
Loop
cb_impresionActiva.Checked = ia
Starter.imprimirTicket = ia
+
+ importaBDDesdeWhatsApp
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)
+ If p_configuracion.Visible Then
+ p_configuracion.Visible = False
+ Else If p_login.Visible Then
+ ExitApplication
+ Else
+ p_configuracion.Visible = False
+ Subs.panelVisible(p_login, 0, 0)
+ End If
End If
Return True
' Returning False signals the system to handle the key
@@ -251,7 +266,7 @@ Private Sub b_envioBD_Click
File.Copy(File.DirInternal, FileName, Provider.SharedFolder, FileName)
Dim email As Email
email.To.Add("soporte@keymonsoft.com")
- email.Subject = "Envio Base de datos Mariana Censos"
+ email.Subject = "Envio Base de datos Lanterna"
email.Attachments.Add(Provider.GetFileUri(FileName))
' email.Attachments.Add(Provider.GetFileUri(FileName)) 'second attachment
Dim in As Intent = email.GetIntent
@@ -405,4 +420,45 @@ End Sub
Private Sub b_reimprimirTicket_Click
+End Sub
+
+Private Sub b_fix_Click
+ Starter.skmt.ExecNonQuery($"update pedido_ticket set PT_NOART = '25', PT_MONTO = '4625', PT_PAGO2 = 'Visa/Mastercard Credito', PT_TARJETA = 'Visa/Mastercard Credito' where PT_TICKET = '00014' and PT_MESA = '5'"$)
+ Starter.skmt.ExecNonQuery($"update pedido_ticket set PT_PAGO2 = 'Visa/Mastercard Credito' where PT_PAGO2 is null "$)
+ ToastMessageShow("LISTO", True)
+End Sub
+
+' Se revisa si hay una intención (intent) de abrir una base de datos y si es así, entonces se importa esa base de datos.
+Sub importaBDDesdeWhatsApp
+' Private tmpBDWA As Boolean = traeUsarIntentBDWA
+ habilitarImportarDesdeWA = True
+ If Not(in.IsInitialized) Then in = Activity.GetStartingIntent ' Si se usa esta funcion en Mainpage, se pone "Me" en lugar de B4XPages.MainPage.
+ If Not(intentUsado) And in <> Null Then
+' Log(in)
+ intentUsado = True
+' Log(in.As(String))
+ If in.GetData <> Null Then
+ If habilitarImportarDesdeWA Then
+
+ Dim XmlData As String
+ XmlData = in.GetData
+ Try
+ Dim OutStr As OutputStream = File.OpenOutput(File.DirInternal,"kmt.db",False)
+ Dim InStr As InputStream = File.OpenInput("ContentDir",XmlData)
+ File.Copy2(InStr,OutStr)
+ LogColor("BD copiada a interna.", Colors.Blue)
+ OutStr.Close
+ If in.As(String).Contains("whatsapp") Then ToastMessageShow("BD cargada desde Whatsapp", False)
+ Catch
+ Log(LastException)
+ End Try
+ Else
+ ToastMessageShow("NO se cargo la BD, por favor habilitar la opción en la configuración.", False)
+ End If
+ End If
+ End If
+End Sub
+
+Private Sub cb_importarDesdeWA_CheckedChange(Checked As Boolean)
+ If Checked Then habilitarImportarDesdeWA = True
End Sub
\ No newline at end of file
diff --git a/Lanterna2.b4a.meta b/Lanterna2.b4a.meta
index 3a9ebb4..9453a3d 100644
--- a/Lanterna2.b4a.meta
+++ b/Lanterna2.b4a.meta
@@ -14,7 +14,7 @@ ModuleBreakpoints4=
ModuleBreakpoints5=
ModuleBreakpoints6=
ModuleBreakpoints7=
-ModuleClosedNodes0=5,6
+ModuleClosedNodes0=5
ModuleClosedNodes1=
ModuleClosedNodes2=
ModuleClosedNodes3=
@@ -22,6 +22,6 @@ ModuleClosedNodes4=
ModuleClosedNodes5=
ModuleClosedNodes6=
ModuleClosedNodes7=
-NavigationStack=Main,cb_impresionActiva_CheckedChange,315,0,Principal,p_resItem_Click,3557,3,Principal,llenaHistorial,996,0,Principal,b_imprimirTicket_Click,2536,0,Principal,b_leyendaDescuento_Click,2908,0,Principal,b_pagoCerrar_Click,1473,0,Principal,p_mesasItem_Click,1189,0,Principal,lv_historial_ItemClick,2774,6,Visual Designer,principal.bal,-100,6,Principal,b_reimprimirTicket_Click,3562,6,Main,b_leyendaDescuento_Click,317,0
+NavigationStack=Subs,actualizaProducto,1286,0,Principal,l_prods_Click,319,0,Principal,Printer1_Error,1681,0,Principal,b_imp2_Click,1928,6,Principal,b_imp3_Click,2176,0,Principal,b_pagoCerrar_Click,1422,0,Subs,traeTicket,684,0,Subs,traeConsecutivoTicket,1471,0,Principal,b_abrirMesa_Click,1258,0,Principal,b_resumen_Click,3486,6
SelectedBuild=0
VisibleModules=6,5,7
diff --git a/Principal.bas b/Principal.bas
index 71b847a..f044e64 100644
--- a/Principal.bas
+++ b/Principal.bas
@@ -889,6 +889,7 @@ End Sub
Private Sub WobbleMenu1_Tab1Click
' Log("TAB 1")
+ Starter.tipov = "VENTA"
If p_resumenDia.Visible Then p_resumenDia.Visible = False
If p_transparentePago.Visible Then Activity_KeyPress(KeyCodes.KEYCODE_BACK)
If Subs.revisaCierreAdmin Then
@@ -1143,6 +1144,7 @@ End Sub
'Entramos a la mesa seleccionada.
Private Sub p_mesasItem_Click
Log("Entramos a la mesa")
+ Starter.tipov = "VENTA"
Log(Sender.As(Panel).tag)
listaProdsOrden.Initialize
listaFormasDePagoCB.Initialize
@@ -1420,14 +1422,18 @@ Private Sub b_pagoCerrar_Click
Loop
Log("INSERTAMOS TARJETA EN PT")
Log($"${laPropina}, ${cb_pagoPropina.SelectedItem} ${pa.RowCount}"$)
- Starter.skmt.ExecNonQuery2("insert into PEDIDO_TICKET(PT_TICKET, PT_PAGO, PT_FECHA, PT_MESERO, PT_NOART, PT_MONTO, PT_MESA, PT_COSTO_SIN, PT_COMENSALES, PT_ALMACEN, PT_PAGO2, PT_ORIGEN, PT_PROPINA, PT_PAGO_PROPINA) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)", Array As Object(sigTicket, tipoPago, Subs.traeFecha, Starter.meseroActual, pa.RowCount, listaMontoDePago.Get(fdp).As(EditText).text, Starter.mesaActual, listaMontoDePago.Get(fdp).As(EditText).text, Starter.comensalesActuales, "MULTI-TICKET", formaPago, $"${Starter.mesaActual}|${sigTicketMT}"$, laPropina, cb_pagoPropina.SelectedItem))
+ Starter.skmt.ExecNonQuery2("insert into PEDIDO_TICKET(PT_TICKET, PT_PAGO, PT_FECHA, PT_MESERO, PT_NOART, PT_MONTO, PT_MESA, PT_COSTO_SIN, PT_COMENSALES, PT_ALMACEN, PT_PAGO2, PT_ORIGEN, PT_PROPINA, PT_PAGO_PROPINA) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)", Array As Object _
+ (sigTicket, tipoPago, Subs.traeFecha, Starter.meseroActual, pa.RowCount, listaMontoDePago.Get(fdp).As(EditText).text, Starter.mesaActual, listaMontoDePago.Get(fdp).As(EditText).text, Starter.comensalesActuales, "MULTI-TICKET", formaPago, $"${Starter.mesaActual}|${sigTicketMT}"$, laPropina, cb_pagoPropina.SelectedItem))
ticketAnt = sigTicket
pagoAnt = formaPago
primeraVez = False
End If
If tipoPago = "EFECTIVO" Then
Log("INSERTAMOS EFECTIVO")
- Starter.skmt.ExecNonQuery2("INSERT INTO PEDIDO (PE_COSTO_TOT, PE_COSTOU, PE_CANT, PE_PRONOMBRE, PE_PROID, PE_TICKET, PE_FECHA, PE_MESERO, PE_MESA, PE_COSTO_SIN, PE_TIPO, PE_TIPO2, PE_ORIGEN) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?) ", Array As Object (listaMontoDePago.Get(fdp).As(EditText).text, listaMontoDePago.Get(fdp).As(EditText).text, 1, "Consumo de alimentos", "CDA01", sigTicket, Subs.traeFecha, Starter.meseroActual, Starter.mesaActual, listaMontoDePago.Get(fdp).As(EditText).text, tipoPago, formaPago, $"${Starter.mesaActual}|${sigTicketMT}"$))
+ Starter.skmt.ExecNonQuery2("INSERT INTO PEDIDO (PE_COSTO_TOT, PE_COSTOU, PE_CANT, PE_PRONOMBRE, PE_PROID, PE_TICKET, PE_FECHA, PE_MESERO, PE_MESA, PE_COSTO_SIN, PE_TIPO, PE_TIPO2, PE_ORIGEN) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?) ", Array As Object _
+ (listaMontoDePago.Get(fdp).As(EditText).text, listaMontoDePago.Get(fdp).As(EditText).text, 1, "Consumo de alimentos", "CDA01", sigTicket, Subs.traeFecha, Starter.meseroActual, Starter.mesaActual, listaMontoDePago.Get(fdp).As(EditText).text, tipoPago, formaPago, $"${Starter.mesaActual}|${sigTicketMT}"$))
+
+
Starter.skmt.ExecNonQuery2("insert into PEDIDO_TICKET(PT_TICKET, PT_PAGO, PT_FECHA, PT_MESERO, PT_NOART, PT_MONTO, PT_MESA, PT_COSTO_SIN, PT_COMENSALES, PT_ALMACEN, PT_PAGO2, PT_ORIGEN) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)", Array As Object(sigTicket, tipoPago, Subs.traeFecha, Starter.meseroActual, 1, listaMontoDePago.Get(fdp).As(EditText).text, Starter.mesaActual, listaMontoDePago.Get(fdp).As(EditText).text, Starter.comensalesActuales, "MULTI-TICKET", formaPago, $"${Starter.mesaActual}|${sigTicketMT}"$))
Log("INSERTAMOS EFECTIVO EN PT")
descXEfectivo = listaMontoDePago.Get(fdp).As(EditText).text
@@ -1926,6 +1932,7 @@ Sub b_imp2_Click
If elNombre.Length > 20 Then elNombre = elNombre.SubString2(0, 20)
Log($"${elNombre} - ${c.GetString("cuantos")}"$) '${c.Position} - ${elNombre.Length} -
cs.Color(Colors.DarkGray).Append($"${elNombre} - ${c.GetString("cuantos")} ${CRLF}"$).pop
+' Log(cs.Length)
Private monto As String = NumberFormat2(c.GetString("monto"), 1, 0, 0, True)
Private cuantos As String = c.GetString("cuantos")
@@ -1957,12 +1964,16 @@ Sub b_imp2_Click
l_resumen.Height = su.MeasureMultilineTextHeight(l_resumen, l_resumen.Text)
sv_resumen.Panel.Height = l_resumen.Height
End If
+
'RESUMEN
+ LogColor("sleeping ....", Colors.Magenta)
+ Sleep(4000)
Private rsm As Cursor = Starter.skmt.ExecQuery($"select distinct CAT_GP_CLASIF, sum(pe_cant) as cuantos, sum(pe_costo_tot) as monto from pedido join CAT_GUNAPROD on cat_gp_id = PE_PROID group by CAT_GP_CLASIF order by CAT_GP_CLASIF"$) '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(rsm.RowCount)
If rsm.RowCount > 0 Then
Printer1.WriteString(Printer1.BOLD)
If imprimirAqui Then Printer1.WriteString($"*** RESUMEN *** ${CRLF}"$)
+ Log($"*** RESUMEN ***${CRLF}"$)
cs.Color(Colors.red).Append($"** RESUMEN **${CRLF}"$).pop
Printer1.WriteString(Printer1.NOBOLD)
For i = 0 To rsm.RowCount - 1
@@ -1981,7 +1992,10 @@ Sub b_imp2_Click
cs.Color(Colors.DarkGray).Append($"${laCat}${primerEspacio}${cuantos}..${monto} ${CRLF}"$).pop
Log($"${laCat}${primerEspacio}${cuantos}..${monto} ${CRLF}"$)
Next
+
'COMENSALES
+ LogColor("sleeping ....", Colors.Magenta)
+ Sleep(3000)
Private coms As Cursor = Starter.skmt.ExecQuery($"select sum(PT_COMENSALES) as totComensales from PEDIDO_TICKET where ifnull(PT_ALMACEN,0) <> 'MULTI-TICKET'"$)
Private totalComensales As Int = 0
If coms.RowCount > 0 Then
@@ -1993,6 +2007,8 @@ Sub b_imp2_Click
Log($"Comensales ...........${totalComensales} ${CRLF}"$)
'PAGOS
+ LogColor("sleeping ....", Colors.Magenta)
+ Sleep(1000)
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}"$)
@@ -2023,11 +2039,12 @@ Sub b_imp2_Click
Next
totalPagos = NumberFormat2(totalPagos, 1, 0, 0, True)
If imprimirAqui Then Printer1.WriteString($"TOTAL PAGOS ......... ${i}..${totalPagos} ${CRLF}"$)
- If imprimirAqui Then Printer1.WriteString($"${CRLF}${CRLF}${CRLF}"$)
cs.Color(Colors.DarkGray).Append($"TOTAL PAGOS: .........${i}.. ${totalPagos} ${CRLF}"$).pop
Log($"TOTAL PAGOS: .........${i}.. ${totalPagos} ${CRLF}"$)
'PROPINAS
+ LogColor("sleeping ....", Colors.Magenta)
+ Sleep(1000)
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)
@@ -2048,12 +2065,14 @@ Sub b_imp2_Click
' LogColor($">>>>>>> ${Ceil(25.5)}"$, Colors.red)
' Efectivo...............$300.00
' Tarjeta................$910.00
+' If imprimirAqui Then Printer1.WriteString($"${CRLF}${CRLF}${CRLF}"$)
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)
+ l_resumen.Height = su.MeasureMultilineTextHeight(l_resumen, l_resumen.Text)
+ sv_resumen.Panel.Height = l_resumen.Height
Subs.panelVisible(p_transparenteResumen, 0, 0)
' Else
' ToastMessageShow("¡Es necesario que NO haya mesas abiertas para realizar el cierre!", True)
@@ -2160,6 +2179,8 @@ Sub b_imp3_Click
If imprimirAqui Then Printer1.WriteString(CRLF)
End If
l_resumen.Text = cs
+ l_resumen.Height = su.MeasureMultilineTextHeight(l_resumen, l_resumen.Text)
+ sv_resumen.Panel.Height = l_resumen.Height
Subs.panelVisible(p_transparenteResumen, 0, 0)
' Else
' ToastMessageShow("¡Es necesario que NO haya mesas abiertas para realizar el cierre!", True)
@@ -3469,7 +3490,7 @@ Private Sub b_resumen_Click
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, ifnull(PT_PAGO2, 'PENDIENTE') as PT_PAGO2 from PEDIDO_TICKET order by PT_FECHA desc"$)
+ Private o As ResultSet = Starter.skmt.ExecQuery($"select *, ifnull(PT_PROPINA, 0) as PT_PROPINA, ifnull(PT_FACTURAR, 'false') as PT_FACTURAR, ifnull(PT_PAGO2, 'PENDIENTE') as PT_PAGO2 from PEDIDO_TICKET where PT_PAGO <> 'MULTI-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)
@@ -3490,7 +3511,7 @@ Private Sub b_resumen_Click
n = n + 1
Loop
- Private rt As ResultSet = Starter.skmt.ExecQuery($"Select sum(pt_monto) as ptMonto, sum(pt_propina) as ptPropina, * from pedido_ticket where pt_pago <> 'VENTA' group by pt_pago2"$)
+ Private rt As ResultSet = Starter.skmt.ExecQuery($"Select sum(pt_monto) as ptMonto, sum(pt_propina) as ptPropina, * from pedido_ticket where pt_pago <> 'VENTA' and PT_PAGO <> 'MULTI-TICKET' group by pt_pago2"$)
Private consumoTotales As String = 0
Private propinaTotales As String = 0
Private totalTotales As String = 0
diff --git a/Starter.bas b/Starter.bas
index c20316d..4e8dd9f 100644
--- a/Starter.bas
+++ b/Starter.bas
@@ -31,7 +31,7 @@ Sub Process_Globals
Dim catActual, subcatActual As String
Dim atrasPresionado As Boolean = False
Dim cargaMeseros As Boolean = False
- dim ticketFactura as Boolean
+ Dim ticketFactura As Boolean
End Sub
Sub Service_Create
diff --git a/Subs.bas b/Subs.bas
index 7a771f8..832801c 100644
--- a/Subs.bas
+++ b/Subs.bas
@@ -1564,6 +1564,8 @@ Sub rellenaHasta(tamano As Int) As String
Return relleno
End Sub
+
+
'CAT_GUNAPRODS, CAT_MESAS y CAT_MESEROS
'1782
'10.0.0.106