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 260e687..8cee956 100644 Binary files a/B4A/Files/login.bal and b/B4A/Files/login.bal differ 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