From ff451ce022a5713e448e87e7ed6844f9e4a3fbe7 Mon Sep 17 00:00:00 2001 From: Jose Alberto Guerra Ugalde Date: Fri, 17 May 2024 03:48:40 -0600 Subject: [PATCH] =?UTF-8?q?-=20Se=20agreg=C3=B3=20la=20opcion=20de=20impor?= =?UTF-8?q?tar=20la=20base=20de=20datos=20directamente=20desde=20Whatsapp,?= =?UTF-8?q?=20hay=20que=20ingresar=20al=20engrane=20con=20el=20usuario=20K?= =?UTF-8?q?MTS1.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- B4A/B4XMainPage.bas | 51 +++++++++++++++++++++++++++++++++++++++- B4A/C_Productos.bas | 2 +- B4A/Files/login.bal | Bin 22339 -> 23539 bytes B4A/KelloggsV4.b4a | 4 ++-- B4A/KelloggsV4.b4a.meta | 8 +++---- B4A/Subs.bas | 4 +--- B4A/kms_helperSubs.bas | 12 ++++++++++ 7 files changed, 70 insertions(+), 11 deletions(-) diff --git a/B4A/B4XMainPage.bas b/B4A/B4XMainPage.bas index 0aa000e..b8a0abe 100644 --- a/B4A/B4XMainPage.bas +++ b/B4A/B4XMainPage.bas @@ -113,6 +113,10 @@ Sub Class_Globals Private l_cartaPorte As Label Private et_maxClientesNuevos As EditText Private l_maxClientesNuevos As Label + Dim in As Intent + Dim intentUsado As Boolean = False + Private p_importarBDWA As Panel + Private cb_importarBDWA As CheckBox End Sub Public Sub Initialize @@ -339,6 +343,37 @@ Private Sub B4XPage_Created (Root1 As B4XView) End Sub Sub B4XPage_Appear + Log("LLAMAMOS traeUsarIntentBDWA") + If kh.traeUsarIntentBDWA Then + Private tmpBDWA As Boolean = kh.traeUsarIntentBDWA + If Not(in.IsInitialized) Then in = B4XPages.GetNativeParent(Me).GetStartingIntent + If Not(intentUsado) And in <> Null Then +' Log(in) + intentUsado = True +' Log(in.As(String)) + If in.GetData <> Null Then + Dim XmlData As String + XmlData = in.GetData +' ToastMessageShow(XmlData, False) +' Send_Make_somthing(in) +' Activity.Finish + 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 +' ExitApplication + End If + End If + Starter.skmt.ExecNonQuery("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = 'IMPORTAR_BD_WA'") + Starter.skmt.ExecNonQuery($"insert into CAT_VARIABLES (CAT_VA_DESCRIPCION, CAT_VA_VALOR) values ('IMPORTAR_BD_WA', '${tmpBDWA}')"$) + + End If MES1.Initialize(Me, "MES1") Log("SDK: " & device.SdkVersion) ' Get the device SDK version @@ -371,6 +406,8 @@ Sub B4XPage_Appear kh.SetButtonTintList(cb_cartaPorte, Colors.LightGray, Colors.RGB(43, 154, 211)) cb_geocerca.Checked = kh.traeUsarGeocerca cb_cartaPorte.Checked = kh.traeUsarCartaPorte +' Log("LLAMAMOS traeUsarIntentBDWA") + cb_importarBDWA.Checked = kh.traeUsarIntentBDWA et_maxClientesNuevos.Text = kh.traeMaxClientesNuevos ' server = "http://keymon.com.mx:1782" ' server = "http://201.99.139.28:1782" @@ -623,7 +660,13 @@ Sub i_engranes_Click Panel1.Top = (Root.Height/2) - (Panel1.Height/2) Panel1.Elevation = 100 Panel1.BringToFront - If user.Text = "KMTS1" Then b_importarBD.Visible = True Else b_importarBD.Visible = False + If user.Text.Trim = "KMTS1" Then + b_importarBD.Visible = True + p_importarBDWA.Visible = True + Else + b_importarBD.Visible = False + p_importarBDWA.Visible = False + End If End Sub Private Sub i_engranes_LongClick @@ -844,3 +887,9 @@ Private Sub b_aceptarExtras_Click et_geocerca.Text = "" p_extras.Visible = False End Sub + +Private Sub cb_importarBDWA_CheckedChange(Checked As Boolean) +' LogColor($"cb_importarBDWA_CheckedChange = ${Checked}"$, Colors.Red) + Starter.skmt.ExecNonQuery("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = 'IMPORTAR_BD_WA'") + Starter.skmt.ExecNonQuery($"insert into CAT_VARIABLES (CAT_VA_DESCRIPCION, CAT_VA_VALOR) values ('IMPORTAR_BD_WA', '${Checked}')"$) +End Sub \ No newline at end of file diff --git a/B4A/C_Productos.bas b/B4A/C_Productos.bas index 21a5b7f..8127409 100644 --- a/B4A/C_Productos.bas +++ b/B4A/C_Productos.bas @@ -570,7 +570,7 @@ Sub b_prodMenos_Click ' clv_prods_ll.GetValue(index).As(Map).Get("almacen") = clv_prods_ll.GetValue(index).As(Map).Get("almacen") + 1 End If If laCant.Text = "" Then laCant.Text = 0 - laCant.Text = $"$1.0{laCant.Text - 1}"$ + laCant.Text = $"${NumberFormat2((laCant.Text - 1), 1, 0, 0, False)}"$ If laCant.Text < 0 Then laCant.Text = 0 Private tmpMap As Map = clv_prods_ll.GetValue(index).As(Map) Private precio As String=clv_prods_ll.GetValue(index).As(Map).Get("precio") diff --git a/B4A/Files/login.bal b/B4A/Files/login.bal index 260e6870209818761379c5dcfb697ae6820a140b..8cee95643f4c99152ba426a85fba8071a41e340e 100644 GIT binary patch delta 2159 zcma)7TTok76ulb=^hU@fAv~H`2yY4m$%8^jAv{ge;gPnq{FqjRjIH#6;2+S|+E%1M zMz?jUg^Hub`f5pUOP%q@j^j8wqvAMI{h{iN{-_`A_*Lr+?sEzB+(OlleeSyZ?sfJ) zXYF(Drx)SRYmlN51Ytf&5VZ94L{oy0CK2j=V(28#t0uc;4`fxzy z$Dz0zihDrq_QyM+5|6}xe$+smG_nk`OtLJpjb!m;31lX+6~CFo4|8}EhqDRikXgub zIh;p$WuAP(1!RSSa8xL|_aYQ?xP-%-Ib6!&G7gt>*vjDw4nM--O2RhEFW3n<$ed(V zWLr2~&EXmjyEt6SVK;}ja=4E0%IfPmoGhQ$d`xdyydXN2P{ z5r#b($lLe;mx;p}4nm=8sIecHtqO%geblcHWWyC#o z5&XN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OOADLflv!aH(e1P4CWLKahbHVIFYiv= I)0wWoe=MtMAOHXW diff --git a/B4A/KelloggsV4.b4a b/B4A/KelloggsV4.b4a index 3508bff..d0cc8c6 100644 --- a/B4A/KelloggsV4.b4a +++ b/B4A/KelloggsV4.b4a @@ -849,7 +849,7 @@ Library6=camera Library7=contentresolver Library8=core Library9=fileprovider -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~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~'AddManifestText()~\n~'AddManifestText()~\n~'AddManifestText()~\n~~\n~AddPermission(android.permission.ACCESS_FINE_LOCATION)~\n~AddPermission(android.permission.BLUETOOTH_ADVERTISE)~\n~AddPermission(android.permission.BLUETOOTH_CONNECT)~\n~AddPermission(android.permission.BLUETOOTH_SCAN)~\n~~\n~AddPermission(android.permission.MANAGE_EXTERNAL_STORAGE)~\n~AddManifestText() '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~SetApplicationAttribute(android:exported, "true")~\n~AddManifestText()~\n~AddApplicationText(~\n~~\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~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~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~'AddManifestText()~\n~'AddManifestText()~\n~'AddManifestText()~\n~~\n~AddPermission(android.permission.ACCESS_FINE_LOCATION)~\n~AddPermission(android.permission.BLUETOOTH_ADVERTISE)~\n~AddPermission(android.permission.BLUETOOTH_CONNECT)~\n~AddPermission(android.permission.BLUETOOTH_SCAN)~\n~~\n~AddPermission(android.permission.MANAGE_EXTERNAL_STORAGE)~\n~AddManifestText() '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~SetApplicationAttribute(android:exported, "true")~\n~AddManifestText()~\n~AddApplicationText(~\n~~\n~ ~\n~ )~\n~~\n~ 'Para que se registre para abrir bases de datos~\n~ AddActivityText(main,~\n~~\n~~\n~~\n~~\n~) Module1=B4XMainPage Module10=C_Pedidos Module11=C_Principal @@ -888,7 +888,7 @@ Version=12.8 #Region Project Attributes #ApplicationLabel: Kelloggs Venta #VersionCode: 3000 - #VersionName: 4.05.14 + #VersionName: 4.05.16 #SupportedOrientations: portrait #CanInstallToExternalStorage: False #BridgeLogger:true diff --git a/B4A/KelloggsV4.b4a.meta b/B4A/KelloggsV4.b4a.meta index 54ee0b2..2a859e5 100644 --- a/B4A/KelloggsV4.b4a.meta +++ b/B4A/KelloggsV4.b4a.meta @@ -61,7 +61,7 @@ ModuleBreakpoints7= ModuleBreakpoints8= ModuleBreakpoints9= ModuleClosedNodes0= -ModuleClosedNodes1= +ModuleClosedNodes1=4 ModuleClosedNodes10= ModuleClosedNodes11= ModuleClosedNodes12= @@ -82,7 +82,7 @@ ModuleClosedNodes25= ModuleClosedNodes26= ModuleClosedNodes27= ModuleClosedNodes28= -ModuleClosedNodes29= +ModuleClosedNodes29=69 ModuleClosedNodes3= ModuleClosedNodes30= ModuleClosedNodes4= @@ -91,6 +91,6 @@ ModuleClosedNodes6= ModuleClosedNodes7= ModuleClosedNodes8= ModuleClosedNodes9= -NavigationStack=Subs,traeinventario,1780,1,C_Productos,l_prodX_Click,1093,6,C_Productos,CreateListItem,543,0,Subs,hayPedido,1566,0,C_Productos,Class_Globals,97,0,Subs,totalPedido,1569,0,C_Productos,b_prodMas_Click,708,6,C_Productos,b_prodMenos_Click,606,0,C_Productos,et_pCant_FocusChanged,797,0,C_Productos,et_pCant_TextChanged,733,6 +NavigationStack=Visual Designer,login.bal,-100,6,B4XMainPage,cb_geocerca_CheckedChange,809,0,kms_helperSubs,traeUsarGeocerca,873,0,B4XMainPage,i_engranes_Click,652,6,kms_helperSubs,traeUsarCartaPorte,884,0,B4XMainPage,b_aceptarExtras_Click,876,0,kms_helperSubs,RD_Init,58,0,B4XMainPage,cb_importarBDWA_CheckedChange,885,6,kms_helperSubs,traeUsarIntentBDWA,893,4,B4XMainPage,B4XPage_Appear,402,6 SelectedBuild=0 -VisibleModules=1,28,11,3,26,29,12,4,13 +VisibleModules=1,28,11,3,26,23,29,12,4,13 diff --git a/B4A/Subs.bas b/B4A/Subs.bas index a890a32..ac5af00 100644 --- a/B4A/Subs.bas +++ b/B4A/Subs.bas @@ -993,8 +993,6 @@ Sub actualizaProducto(cedis As String, costoU As String, cant As String, nombre c.Close End Sub - - 'Regresa un mapa con la información de la promo. 'Regresa: {id, maxXcliente, maxRecurrente, maxPromos, historico, ' productos={idProducto={idProducto, preciosimptos, precio, almacen, tipo, piezas, usuario, fecha, regalo, clasif}} 'Mapa con los productos de la promo y los datos de cada uno. @@ -1782,7 +1780,7 @@ Sub logJobDoneResultados(resultado As DBResult) Next End Sub -Sub traeinventario(id As String) As String +Sub traeinventario(id As String) As Int Dim c As Cursor Dim inventario As String = "0" c=Starter.skmt.ExecQuery($"select CAT_GP_ALMACEN from ${traeTablaProds(Starter.tipov)} where CAT_GP_ID = '${id}'"$) diff --git a/B4A/kms_helperSubs.bas b/B4A/kms_helperSubs.bas index 5a437e1..bcab0e6 100644 --- a/B4A/kms_helperSubs.bas +++ b/B4A/kms_helperSubs.bas @@ -889,6 +889,18 @@ Sub traeUsarCartaPorte As Boolean 'ignore Return CP End Sub +'Regresa si se debe de usar el intent de importar la base d datos desde Whatsapp. +Sub traeUsarIntentBDWA As Boolean 'ignore + Private BDWA As Boolean = False + Private x As Cursor = Starter.skmt.ExecQuery($"select CAT_VA_VALOR from CAT_VARIABLES where CAT_VA_DESCRIPCION = 'IMPORTAR_BD_WA'"$) + If x.RowCount > 0 Then + x.Position = 0 + If x.GetString("CAT_VA_VALOR") = "true" Then BDWA = True + End If +' Log($"cb_importarBDWA = ${BDWA}"$) + Return BDWA +End Sub + 'Regresa los clientes nuevos maximos. 'Si no está especificado, el default es 2. Sub traeMaxClientesNuevos As Int 'ignore