From 8cb1030c971d45860bb70ecb9dd822827d8a523e Mon Sep 17 00:00:00 2001 From: cheveguerra Date: Thu, 7 Sep 2023 13:36:19 -0600 Subject: [PATCH] Cambios para que si se cambia la impresora no sea necesario borrar la MAC. --- B4A/B4XMainPage.bas | 5 ++--- B4A/C_Cliente.bas | 32 +++++++++++++++++++++++++++----- B4A/C_Principal.bas | 2 +- B4A/C_Productos.bas | 11 +++++------ B4A/Files/login.bal | Bin 12591 -> 12593 bytes B4A/KelloggsV4.b4a | 4 ++-- B4A/Subs.bas | 6 +++--- B4A/Tracker.bas | 2 +- 8 files changed, 41 insertions(+), 21 deletions(-) diff --git a/B4A/B4XMainPage.bas b/B4A/B4XMainPage.bas index 6cc642e..3588b5b 100644 --- a/B4A/B4XMainPage.bas +++ b/B4A/B4XMainPage.bas @@ -17,7 +17,6 @@ Version=9.85 '########################################################################################################### #End Region - Sub Class_Globals Private Root As B4XView Private xui As XUI @@ -58,7 +57,7 @@ Sub Class_Globals Private ImageView4 As ImageView Private E_SERVER As EditText Private B_SERVER As Button - Private B_FECHA As Button + Private B_MACIMP As Button Private CUANTOS As String Private foto_g () As Byte @@ -564,7 +563,7 @@ Sub B_SERVER_Click Entrar.Visible = True End Sub -Sub B_FECHA_Click +Sub B_MACIMP_Click Starter.skmt.ExecNonQuery2("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = ?", Array As Object ("MACIMP")) Starter.skmt.ExecNonQuery2("INSERT INTO CAT_VARIABLES(CAT_VA_DESCRIPCION, CAT_VA_VALOR) VALUES (?,?)", Array As Object ("MACIMP","0")) Panel1.Visible = False diff --git a/B4A/C_Cliente.bas b/B4A/C_Cliente.bas index 1ecedf5..2ae433e 100644 --- a/B4A/C_Cliente.bas +++ b/B4A/C_Cliente.bas @@ -276,6 +276,7 @@ Sub Class_Globals Private Panel11 As Panel Private BP_DOE_R1 As Button Dim RMI_VALOR As String + Dim errorImpresora As Int = 0 End Sub 'You can add more parameters here. @@ -336,7 +337,7 @@ Private Sub B4XPage_Created (Root1 As B4XView) End If End If c=Starter.skmt.ExecQuery2("select CAT_VA_VALOR from CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = ?", Array As String ("MACIMP")) - c.Position =0 + c.Position = 0 If c.RowCount > 0 Then MAC_IMPRESORA = c.GetString("CAT_VA_VALOR") Else @@ -357,6 +358,15 @@ Sub B4XPage_Appear Subs.panelVisibleCompleto(P_INF_GENERAL, Root) ' P_INF_GENERAL.Height = Root.Height ' P_INF_GENERAL.Width = Root.Width + c=Starter.skmt.ExecQuery2("select CAT_VA_VALOR from CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = ?", Array As String ("MACIMP")) + c.Position = 0 + If c.RowCount > 0 Then + MAC_IMPRESORA = c.GetString("CAT_VA_VALOR") + Else + MAC_IMPRESORA = 0 + Starter.skmt.ExecNonQuery2("INSERT INTO CAT_VARIABLES(CAT_VA_DESCRIPCION, CAT_VA_VALOR) VALUES (?,?)", Array As Object ("MACIMP","0")) + End If + Starter.MAC_IMPRESORA = MAC_IMPRESORA et_geopass.Text = "" If Subs.traeUltimaActividadBD <> "Cliente" Then Subs.iniciaActividad(Subs.traeUltimaActividadBD) If Not(muestraBoleta) Then P_INF_GENERAL.Visible = True @@ -416,7 +426,7 @@ Sub B4XPage_Appear If c.GetString("CAT_CL_LONG") <> Null And c.GetString("CAT_CL_LONG") <> "null" And IsNumber(c.GetString("CAT_CL_LONG")) Then LONGITUD = c.GetString("CAT_CL_LONG") LATITUD = 0 If c.GetString("CAT_CL_LAT") <> Null And c.GetString("CAT_CL_LAT") <> "null" And IsNumber(c.GetString("CAT_CL_LAT")) Then LATITUD = c.GetString("CAT_CL_LAT") - LogColor($"${c.GetString("CAT_CL_LAT")}, ${c.GetString("CAT_CL_LONG")}"$, Colors.red) +' LogColor($"${c.GetString("CAT_CL_LAT")}, ${c.GetString("CAT_CL_LONG")}"$, Colors.red) If logger Then Log($"Lat: ${LATITUD}, Lon: ${LONGITUD}"$) NOMBRE = c.GetString("CAT_CL_NOMBRE") ' Log(l_total.text) @@ -501,6 +511,7 @@ Sub B4XPage_Appear Else Cuestionario End If +' Log(Subs.revisaImpresa) If YA_IMPRIMIO2 = 0 Then Guardar.Visible = False Else @@ -599,6 +610,8 @@ Sub B4XPage_Appear GPS_LocationChanged(Tracker.FLP.GetLastKnownLocation) End If muestraBoleta = False +' Log(Subs.revisaImpresa) + If Subs.revisaImpresa Then Guardar.Visible = True End Sub Sub Printer1_Connected (Success As Boolean) @@ -613,10 +626,19 @@ Sub Printer1_Connected (Success As Boolean) Else ' Msgbox(Printer1.ConnectedErrorMsg, "Error connecting.") 'ignore ' ToastMessageShow("Error conectando la impresora", False) - If logger Then LogColor("Error conectando la impresora", Colors.Red) + LogColor("Error conectando la impresora", Colors.Red) + errorImpresora = errorImpresora + 1 + If errorImpresora > 1 Then + Starter.MAC_IMPRESORA = "0" + errorImpresora = 0 + End If End If End Sub +Sub Printer1_Error + Log("error printer") +End Sub + Sub GPS_LocationChanged (Location1 As Location) 'Este codigo se corre desde Tracker/flp_LocationChanged b_ubicacion.TextColor = Colors.Gray @@ -624,8 +646,8 @@ Sub GPS_LocationChanged (Location1 As Location) b_ubicacion.TextColor = Colors.White If logger Then Log($"${Location1.Latitude}, ${Location1.Longitude}, ${Location1.Accuracy}"$) - If m_lat = Null Or m_lat = "" Then m_lat = 0 - If m_lon = Null Or m_lon = "" Then m_lon = 0 + If m_lat = Null Or m_lat = "null" Or m_lat = "" Then m_lat = 0 + If m_lon = Null Or m_lon = "null" Or m_lon = "" Then m_lon = 0 Private ubicacionTienda As Location ubicacionTienda.Initialize diff --git a/B4A/C_Principal.bas b/B4A/C_Principal.bas index 110e9a5..3d22b8a 100644 --- a/B4A/C_Principal.bas +++ b/B4A/C_Principal.bas @@ -1831,7 +1831,7 @@ Sub JobDone(Job As HttpJob) Dim CAT_GP_ID As String = records(RESULT.COLUMNS.GET("CAT_GP_ID")) Dim CAT_GP_NOMBRE As String = records(RESULT.COLUMNS.GET("CAT_GP_NOMBRE")) Dim CAT_GP_PRECIO As String = records(RESULT.COLUMNS.GET("CAT_GP_PRECIO")) - Starter.skmt.ExecNonQuery2("INSERT INTO CAT_RMI (CAT_ID, CAT_DESCRIPCION, CAT_MONTO) VALUES (?,?,?)", Array As Object (CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_PRECIO)) + Starter.skmt.ExecNonQuery2("INSERT INTO CAT_RMI (CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_PRECIO) VALUES (?,?,?)", Array As Object (CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_PRECIO)) Next End If End If diff --git a/B4A/C_Productos.bas b/B4A/C_Productos.bas index daf15d4..4f7ee58 100644 --- a/B4A/C_Productos.bas +++ b/B4A/C_Productos.bas @@ -248,8 +248,7 @@ Sub B4XPage_Appear b_rmi.Visible = False l_mDisponible.Visible = True End If - - Log(Starter.tipov) +' Log(Starter.tipov) End Sub Sub PCLV_AddProds @@ -868,7 +867,7 @@ Private Sub b_rechazar_Click p_vistaPreviaTrans.Visible = False End If Else - Msgbox("LA VENTA YA SE TRANSMITIO, FAVOR DE LLAMAR A SOPORTE PARA ASISTENCIA","AVISO") 'ignore +' Msgbox("LA VENTA YA SE TRANSMITIO, FAVOR DE LLAMAR A SOPORTE PARA ASISTENCIA","AVISO") 'ignore End If p_vistaPreviaTrans.Visible=False Subs.iniciaActividad("Cliente") @@ -1093,7 +1092,7 @@ Sub LlenaProdsLL(p As ResultSet, extra As String) ' Log("LlenaProdsLL") listaProds.Initialize hayPedido = Subs.hayPedido - Log($"HAYPEDIDO: ${hayPedido}"$) +' Log($"HAYPEDIDO: ${hayPedido}"$) If hayPedido Then 'Si hay pedido obtenemos las cantidades de los productos para agregarlos al CLV. Dim cantsMap As Map cantsMap.Initialize @@ -1101,7 +1100,7 @@ Sub LlenaProdsLL(p As ResultSet, extra As String) 'Si EXTRA es igual a rmi, entonces regresamos los RMIs existentes. If extra = "rmi" Then pe = Starter.skmt.ExecQuery($"select PE_PROID, PE_CANT from PEDIDO where PE_CLIENTE = '${clienteId}' and PE_CEDIS = 'DUR'"$) - LogColor("Ponemos productos de pedido anterior: "&pe.RowCount, Colors.red) +' LogColor("Ponemos productos de pedido anterior: "&pe.RowCount, Colors.red) Do While pe.NextRow Private cant As Int = 0 cantsMap.put(pe.GetString("PE_PROID"), pe.GetString("PE_CANT")) @@ -1152,7 +1151,7 @@ Sub LlenaProdsLL(p As ResultSet, extra As String) Private tempMap As Map = listaProdsConCant.Get(pr0) Private inv = tempMap.Get("almacen") + tempMap.Get("cant") tempMap.Put("almacen", inv) - Log(tempMap) +' Log(tempMap) clv_prods_ll.Add(Pnl, tempMap) listaHints.Add(listaProdsConCant.get(pr0).As(Map).Get("prod")) cont = cont + 1 diff --git a/B4A/Files/login.bal b/B4A/Files/login.bal index 9938fa000bbca407af5e66a6dd7e166471844e5e..da11282ffe647ab7ba73129f68b4e5f8fb038add 100644 GIT binary patch delta 62 zcmZ3Vv@wa5m4Si5ej;m`6c><@6rYxvmy((2pUnZ}ImP=rI(zyCY@DLW&4Vnk`2=^m FDgfoc58D6$ delta 60 zcmdm(v_6TIm4Si5ZX#=$Bs-Ad6z}Hh?BU1-WG2O@W#*-1Ci-V@oT|yqjU>DI6nDBR E0JJa<82|tP diff --git a/B4A/KelloggsV4.b4a b/B4A/KelloggsV4.b4a index 993c25f..061c87f 100644 --- a/B4A/KelloggsV4.b4a +++ b/B4A/KelloggsV4.b4a @@ -136,7 +136,7 @@ Library6=camera Library7=contentresolver Library8=core Library9=fusedlocationprovider -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~AddApplicationText(~\n~)~\n~'Set activity to Landscape~\n~SetActivityAttribute(foto, android:screenOrientation, "landscape")~\n~AddApplicationText(~\n~~\n~ ~\n~)~\n~AddManifestText(~\n~~\n~)~\n~'''' para el teclado~\n~ SetActivityAttribute(main, android:windowSoftInputMode, adjustResize|stateHidden)~\n~ SetApplicationAttribute(android:allowBackup, "false")~\n~ SetServiceAttribute(Tracker, android:foregroundServiceType, "location")~\n~ ~\n~ AddManifestText(~\n~~\n~)~\n~''CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)~\n~ 'End of default text.~\n~ ~\n~SetApplicationAttribute(android:usesCleartextTraffic, "true")~\n~ AddManifestText(~\n~~\n~)~\n~AddPermission(android.permission.ACCESS_BACKGROUND_LOCATION)~\n~AddManifestText(~\n~~\n~)~\n~AddManifestText(~\n~~\n~)~\n~AddManifestText(~\n~~\n~) 'in order to access the device non-resettable identifiers such as IMEI and serial number.~\n~~\n~'///////////////////////// FLP Y PUSH /////////////~\n~' CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)~\n~' CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)~\n~' CreateResourceFromFile(Macro, FirebaseAnalytics.FirebaseAnalytics)~\n~' CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)~\n~ SetServiceAttribute(Tracker, android:foregroundServiceType, "location")~\n~'//////////////////////////////////////////////////////~\n~'Le da mas memoria a la aplicacion~\n~SetApplicationAttribute(android:largeHeap, "true")~\n~ AddApplicationText(~\n~ ~\n~ ~\n~ ~\n~ )~\n~ CreateResource(xml, provider_paths,~\n~ ~\n~ ~\n~ ~\n~ ~\n~ ~\n~ )~\n~~\n~'Si al cargar un mapa de google manda este error "java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion". agregar la siguiente linea:~\n~AddApplicationText()~\n~SetApplicationAttribute(android:allowBackup, "false") +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~AddApplicationText(~\n~)~\n~'Set activity to Landscape~\n~SetActivityAttribute(foto, android:screenOrientation, "landscape")~\n~AddApplicationText(~\n~~\n~ ~\n~)~\n~AddManifestText(~\n~~\n~)~\n~'''' para el teclado~\n~ SetActivityAttribute(main, android:windowSoftInputMode, adjustResize|stateHidden)~\n~ SetApplicationAttribute(android:allowBackup, "false")~\n~ SetServiceAttribute(Tracker, android:foregroundServiceType, "location")~\n~ ~\n~ AddManifestText(~\n~~\n~)~\n~''CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)~\n~ 'End of default text.~\n~ ~\n~SetApplicationAttribute(android:usesCleartextTraffic, "true")~\n~ AddManifestText(~\n~~\n~)~\n~AddPermission(android.permission.ACCESS_BACKGROUND_LOCATION)~\n~AddManifestText(~\n~~\n~)~\n~AddManifestText(~\n~~\n~)~\n~AddManifestText(~\n~~\n~) 'in order to access the device non-resettable identifiers such as IMEI and serial number.~\n~~\n~'///////////////////////// FLP Y PUSH /////////////~\n~' CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)~\n~' CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)~\n~' CreateResourceFromFile(Macro, FirebaseAnalytics.FirebaseAnalytics)~\n~' CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)~\n~ SetServiceAttribute(Tracker, android:foregroundServiceType, "location")~\n~'//////////////////////////////////////////////////////~\n~'Le da mas memoria a la aplicacion~\n~SetApplicationAttribute(android:largeHeap, "true")~\n~ AddApplicationText(~\n~ ~\n~ ~\n~ ~\n~ )~\n~ CreateResource(xml, provider_paths,~\n~ ~\n~ ~\n~ ~\n~ ~\n~ ~\n~ )~\n~~\n~'Si al cargar un mapa de google manda este error "java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion". agregar la siguiente linea:~\n~AddApplicationText()~\n~SetApplicationAttribute(android:allowBackup, "false")~\n~AddManifestText() Module1=B4XMainPage Module10=C_Pedidos Module11=C_Principal @@ -172,7 +172,7 @@ Version=12.2 #Region Project Attributes #ApplicationLabel: Kelloggs Venta #VersionCode: 3000 - #VersionName: 3.08.29 PRUEBA V4 + #VersionName: 3.09.06 PRUEBA V4 #SupportedOrientations: portrait #CanInstallToExternalStorage: False #BridgeLogger:true diff --git a/B4A/Subs.bas b/B4A/Subs.bas index fed0412..c57c942 100644 --- a/B4A/Subs.bas +++ b/B4A/Subs.bas @@ -671,14 +671,14 @@ End Sub 'Regresa la ultima actividad guardada en base de datos. Sub traeUltimaActividadBD As String - If Starter.logger Then LogColor("Buscamos ultima actividad en BD", Colors.Magenta) +' If Starter.logger Then LogColor("Buscamos ultima actividad en BD", Colors.Magenta) Private c As Cursor Private x As String c = Starter.skmt.ExecQuery("select CAT_VA_VALOR from CAT_VARIABLES where CAT_VA_DESCRIPCION = 'ULTIMOMODULO'") If c.RowCount > 0 Then c.Position = 0 x = c.GetString("CAT_VA_VALOR") - If Starter.logger Then Log("Encontramos: " & x) +' If Starter.logger Then Log("Encontramos: " & x) End If c.Close Return x @@ -691,7 +691,7 @@ Sub iniciaActividad(ia As String) Starter.skmt.ExecNonQuery2("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = ?", Array As Object ("ULTIMOMODULO")) Starter.skmt.ExecNonQuery2("INSERT INTO CAT_VARIABLES(CAT_VA_DESCRIPCION, CAT_VA_VALOR) VALUES (?,?)", Array As Object ("ULTIMOMODULO", ia)) B4XPages.ShowPage(ia) - If Starter.logger Then LogColor("Iniciamos --> " & ia, Colors.Blue) +' If Starter.logger Then LogColor("Iniciamos --> " & ia, Colors.Blue) End If End Sub diff --git a/B4A/Tracker.bas b/B4A/Tracker.bas index c5fdd53..1cdfa75 100644 --- a/B4A/Tracker.bas +++ b/B4A/Tracker.bas @@ -49,7 +49,7 @@ End Sub Sub Service_Create Service.AutomaticForegroundMode = Service.AUTOMATIC_FOREGROUND_NEVER 'we are handling it ourselves UUGCoords.Initialize - logger = true + logger = False 'Para FusedLocationProvider (2 lineas) FLP.Initialize("flp") FLP.Connect