diff --git a/B4A/B4XMainPage.bas b/B4A/B4XMainPage.bas index e249bd7..ef977c1 100644 --- a/B4A/B4XMainPage.bas +++ b/B4A/B4XMainPage.bas @@ -7,16 +7,10 @@ Version=9.85 #Region Shared Files #CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\Shared Files" "..\Files" 'Ctrl + click to sync files: ide://run?file=%WINDIR%\System32\Robocopy.exe&args=..\..\Shared+Files&args=..\Files&FilesSync=True -'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=Project.zip -'########################################################################################################### -'###################### PULL ############################################################# -'Ctrl + click ide://run?file=%WINDIR%\System32\cmd.exe&Args=/c&Args=..\..\gitpull.bat -'########################################################################################################### -'###################### PUSH ############################################################# -'Ctrl + click ide://run?file=%WINDIR%\System32\cmd.exe&Args=/c&Args=github&Args=..\..\ -'########################################################################################################### #End Region +'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=Project.zip + Sub Class_Globals Private Root As B4XView Private xui As XUI @@ -36,6 +30,7 @@ Sub Class_Globals Public historico As C_Historico Public checklist As C_CheckList + Dim reqManager As DBRequestManager Dim ultimaActualizacionGPS As String = 235959 Dim almacen, ruta As String diff --git a/B4A/C_NuevoCliente.bas b/B4A/C_NuevoCliente.bas index ae66a5a..e269721 100644 --- a/B4A/C_NuevoCliente.bas +++ b/B4A/C_NuevoCliente.bas @@ -63,7 +63,7 @@ Sub GUARDA_Click DateTime.Timeformat = "HHmmss" sDate=DateTime.Date(DateTime.Now) sTime=DateTime.Time(DateTime.Now) - c=Starter.skmt.ExecQuery("select CAT_CL_RUTA ,CAT_CL_DIAS_VISITA FROM kmt_info WHERE CAT_CL_DIAS_VISITA = (SELECT CAT_VA_VALOR FROM CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = 'DIA_VISITA')") + c=Starter.skmt.ExecQuery("select CAT_CL_RUTA ,CAT_CL_DIAS_VISITA FROM kmt_info ") ' WHERE CAT_CL_DIAS_VISITA = (SELECT CAT_VA_VALOR FROM CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = 'DIA_VISITA')") c.Position=0 no_ruta= c.GetString("CAT_CL_RUTA") DIA_VISITA=c.GetString("CAT_CL_DIAS_VISITA") @@ -74,12 +74,18 @@ Sub GUARDA_Click Private segs As String = sTime.SubString(4) Private sTime2 As String = hora&":"&mins&":"&segs Log("////////////// sTime: "&sTime&" ////////////////") + If Starter.lat_gps = 0 Or Starter.lat_gps = Null Then 'Si latitud es CERO o NULL traemos las ultimas coordenadas de la base de datos. + Private coords As List = Subs.traeCoordsDeBD + Starter.lat_gps = coords.Get(0) + Starter.lon_gps = coords.Get(1) + End If no_cliente= "N" & sTime2 & no_ruta c.Close C2=Starter.skmt.ExecQuery("SELECT ID_ALMACEN FROM CAT_ALMACEN") C2.Position=0 ALMACEN= C2.GetString("ID_ALMACEN") C2.Close + 'Msgbox("coordenadas "&Starter.lon_gps & Starter.lat_gps,"aviso") Starter.skmt.ExecNonQuery2("INSERT INTO kmt_info(CAT_CL_CODIGO,CAT_CL_RUTA,CAT_CL_NOMBRE,CAT_CL_DIAS_VISITA,CAT_CL_ATIENDE1,CAT_CL_ATIENTE2,CAT_CL_TELEFONO,CAT_CL_EMAIL,CAT_CL_CALLE,CAT_CL_NOEXT,CAT_CL_NOINT,CAT_CL_CALLE1,CAT_CL_CALLE2,CAT_CL_COLONIA,CAT_CL_MUNI,CAT_CL_EDO,CAT_CL_CP,CAT_CL_LONG,CAT_CL_LAT,CAT_CL_MTOCOMPRA,CAT_CL_NUM_SERIEFISICO,CAT_CL_BCREDITO, gestion,CAT_CL_BFACTURA,IMPRESION) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,0,0,0,0,1000000,0) ",Array As Object (no_cliente,no_ruta, E_NOMBRE.Text,DIA_VISITA,"new","null","null","null","null","null","null","null","null","NULL","NULL","null","0",Starter.lon_gps,Starter.lat_gps)) Starter.skmt.ExecNonQuery("delete from CUENTAA") Starter.skmt.ExecNonQuery2("INSERT INTO CUENTAA VALUES (?)", Array As Object(no_cliente)) diff --git a/B4A/C_Principal.bas b/B4A/C_Principal.bas index 9f38d9a..e49897b 100644 --- a/B4A/C_Principal.bas +++ b/B4A/C_Principal.bas @@ -337,20 +337,18 @@ Sub B4XPage_Appear l_ruta.Text = f.GetString("CAT_CL_RUTA") f.Close End If - c=Starter.skmt.ExecQuery("select usuario from usuarioa") - c.Position = 0 - If c.RowCount > 0 Then - usuario = c.GetString("USUARIO") - Starter.usuario = usuario - End If - c.Close - c=Starter.skmt.ExecQuery("select ID_ALMACEN from CAT_ALMACEN") - C.Position =0 - ALMACEN = C.GetString("ID_ALMACEN") - C.Close - Cursor_check = Starter.skmt.ExecQuery("select count(*) as CUANTOS from TMP_INSPECCION_AUTO_DIARIA where tmp_auto_kilometraje <> '' ") - Cursor_check.Position = 0 - Cedis_Check = Cursor_check.GetString("CUANTOS") + c=Starter.skmt.ExecQuery("select usuario from usuarioa") + c.Position = 0 + usuario = c.GetString("USUARIO") + Starter.usuario = usuario + c.Close + c=Starter.skmt.ExecQuery("select ID_ALMACEN from CAT_ALMACEN") + C.Position =0 + ALMACEN = C.GetString("ID_ALMACEN") + C.Close + Cursor_check = Starter.skmt.ExecQuery("select count(*) as CUANTOS from TMP_INSPECCION_AUTO_DIARIA where tmp_auto_kilometraje <> '' ") + Cursor_check.Position = 0 + Cedis_Check = Cursor_check.GetString("CUANTOS") If Not(File.Exists(File.DirInternal,"FOTO1.jpg")) Or _ Not(File.Exists(File.DirInternal,"FOTO2.jpg")) Or _ diff --git a/B4A/Files/principal.bal b/B4A/Files/principal.bal index 2fe5b96..6c89267 100644 Binary files a/B4A/Files/principal.bal and b/B4A/Files/principal.bal differ diff --git a/B4A/KelloggsV3.b4a b/B4A/KelloggsV3.b4a index 52b2156..b8eb8f5 100644 --- a/B4A/KelloggsV3.b4a +++ b/B4A/KelloggsV3.b4a @@ -130,7 +130,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~~\n~'Si al cargar un mapa de google mande este error "java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion". agregar la siguiente linea:~\n~AddApplicationText() +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.INTERNET)~\n~AddPermission(android.permission.ACCESS_BACKGROUND_LOCATION)~\n~AddManifestText(~\n~~\n~)~\n~~\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~~\n~'Si al cargar un mapa de google mande este error "java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion". agregar la siguiente linea:~\n~AddApplicationText()~\n~~\n~AddManifestText(~\n~ ~\n~ ) Module1=B4XMainPage Module10=C_Pedidos Module11=C_Principal @@ -161,12 +161,12 @@ Module9=C_NuevoCliente NumberOfFiles=51 NumberOfLibraries=28 NumberOfModules=27 -Version=12.2 +Version=12.5 @EndOfDesignText@ #Region Project Attributes #ApplicationLabel: Kelloggs Venta #VersionCode: 3000 - #VersionName: 3.07.28 RMI + #VersionName: 3.07.29 RMI #SupportedOrientations: portrait #CanInstallToExternalStorage: False #BridgeLogger:true diff --git a/B4A/MAPA_RUTAS.bas b/B4A/MAPA_RUTAS.bas index b04f792..986d308 100644 --- a/B4A/MAPA_RUTAS.bas +++ b/B4A/MAPA_RUTAS.bas @@ -117,8 +117,11 @@ End Sub Sub MapFragment1_Ready gmap = MapFragment1.GetMap - LongitudRU = 19.4316281 - LatitudRU = -99.1333579 +' LongitudRU = 19.4316281 +' LatitudRU = -99.1333579 + + LongitudRU = Starter.lon_gps + LatitudRU = Starter.lat_gps ' todos= 1 'permisos @@ -154,8 +157,8 @@ Sub MapFragment1_Ready '''''''---------------------------- MARKER VERDE - VENTA If verde = 1 Or todos = 1 Then - c2.IsInitialized - c2=Starter.skmt.ExecQuery("select CAT_CL_CODIGO, CAT_CL_NOMBRE,CAT_CL_LONG,CAT_CL_LAT,CAT_CL_NUM_SERIEFISICO from kmt_info WHERE CAT_CL_NOMBRE <>'VENTA ABORDO' AND CAT_CL_CODIGO IN (Select PE_CLIENTE from PEDIDO) AND CAT_CL_CODIGO NOT In (Select NV_CLIENTE from NOVENTA) and CAT_CL_DIAS_VISITA = (SELECT CAT_VA_VALOR FROM CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = 'DIA_VISITA')") + c2.IsInitialized ''''''''''''' AND CAT_CL_CODIGO NOT In (Select NV_CLIENTE from NOVENTA) and CAT_CL_DIAS_VISITA = (SELECT CAT_VA_VALOR FROM CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = 'DIA_VISITA') + c2=Starter.skmt.ExecQuery("select CAT_CL_CODIGO, CAT_CL_NOMBRE,CAT_CL_LONG,CAT_CL_LAT,CAT_CL_NUM_SERIEFISICO from kmt_info WHERE CAT_CL_NOMBRE <>'VENTA ABORDO' AND CAT_CL_CODIGO IN (Select PE_CLIENTE from PEDIDO)") For i = 0 To c2.RowCount -1 c2.Position = i LongitudRU = c2.GetDouble("CAT_CL_LONG") @@ -163,13 +166,17 @@ Sub MapFragment1_Ready CODIGO=c2.GetString("CAT_CL_CODIGO") Tienda= c2.GetString("CAT_CL_NOMBRE") NumSerie=c2.GetInt("CAT_CL_NUM_SERIEFISICO") + If LongitudRU < 0 Then + LatitudRU= c2.GetDouble("CAT_CL_LONG") + LongitudRU = c2.GetDouble("CAT_CL_LAT") + End If MARK_VERDE = gmap.AddMarker3(LongitudRU,LatitudRU,CODIGO, LoadBitmap(File.DirAssets, "marker-verde-"&NumSerie&".png")) MARK_VERDE.Snippet = Tienda Next Else If verde = 1 Or todos = 1 Then - c2.IsInitialized - c2=Starter.skmt.ExecQuery("select CAT_CL_CODIGO, CAT_CL_NOMBRE,CAT_CL_LONG,CAT_CL_LAT, CAT_CL_NUM_SERIEFISICO from kmt_info WHERE CAT_CL_NOMBRE <>'VENTA ABORDO' AND CAT_CL_CODIGO IN (Select PE_CLIENTE from PEDIDO) AND CAT_CL_CODIGO NOT In (Select NV_CLIENTE from NOVENTA ) AND CAT_CL_DIAS_VISITA = (SELECT CAT_VA_VALOR FROM CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = 'DIA_VISITA')") + c2.IsInitialized ''''''''''AND CAT_CL_CODIGO NOT In (Select NV_CLIENTE from NOVENTA ) AND CAT_CL_DIAS_VISITA = (SELECT CAT_VA_VALOR FROM CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = 'DIA_VISITA') + c2=Starter.skmt.ExecQuery("select CAT_CL_CODIGO, CAT_CL_NOMBRE,CAT_CL_LONG,CAT_CL_LAT, CAT_CL_NUM_SERIEFISICO from kmt_info WHERE CAT_CL_NOMBRE <>'VENTA ABORDO' AND CAT_CL_CODIGO IN (Select PE_CLIENTE from PEDIDO) ") For i = 0 To c2.RowCount -1 c2.Position = i LongitudRU = c2.GetDouble("CAT_CL_LONG") @@ -177,6 +184,10 @@ Sub MapFragment1_Ready CODIGO=c2.GetString("CAT_CL_CODIGO") Tienda= c2.GetString("CAT_CL_NOMBRE") NumSerie=c2.GetInt("CAT_CL_NUM_SERIEFISICO") + If LongitudRU < 0 Then + LatitudRU= c2.GetDouble("CAT_CL_LONG") + LongitudRU = c2.GetDouble("CAT_CL_LAT") + End If MARK_VERDE = gmap.AddMarker3(LongitudRU,LatitudRU,CODIGO, LoadBitmap(File.DirAssets, "marker-verde-"&NumSerie&".png")) MARK_VERDE.Snippet = Tienda Next @@ -224,10 +235,26 @@ Sub MapFragment1_Ready ' If MARK_VERDE.Visible Or MARK_ROJO.Visible Then ' MARK_CEDIS.Remove ' End If - If LatitudRU > -1 Then - LongitudRU = 19.4316281 - LatitudRU = -99.1333579 - End If +' If LatitudRU > -1 Then +' LongitudRU = 19.4316281 +' LatitudRU = -99.1333579 +' End If + c.IsInitialized + c=Starter.skmt.ExecQuery2("select CAT_CL_CODIGO,CAT_CL_NOMBRE,CAT_CL_LONG,CAT_CL_LAT,CAT_CL_NUM_SERIEFISICO from kmt_info where CAT_CL_NOMBRE <>'VENTA ABORDO' AND CAT_CL_CODIGO NOT IN (Select PE_CLIENTE from PEDIDO) AND CAT_CL_CODIGO NOT In (Select NV_CLIENTE from NOVENTA) AND CAT_CL_CODIGO NOT LIKE 'N%' and CAT_CL_DIAS_VISITA = (SELECT CAT_VA_VALOR FROM CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = 'DIA_VISITA') and cat_cl_codigo <> 0 AND CAT_CL_TIPO_RUTA IN (?,?) ORDER BY CAT_CL_NUM_SERIEFISICO", Array As String(SEMANA, "SEMANAL")) +' skmt.Initialize(ruta,"kmt.db", True) + If c.RowCount > 0 Then +' For i = 0 To c.RowCount -1 + c.Position = 1 + LongitudRU = c.GetDouble("CAT_CL_LONG") + LatitudRU = c.GetDouble("CAT_CL_LAT") + If LongitudRU < 0 Then + LatitudRU= c.GetDouble("CAT_CL_LONG") + LongitudRU = c.GetDouble("CAT_CL_LAT") + End If +End If +' Next + c .Close + Dim aa As CameraPosition aa.Initialize(LongitudRU,LatitudRU,10)''' RECOMENDABLE CAMBIAR A 10 PARA QUE SE VEAN MAS MARCADORES gmap.AnimateCamera(aa) @@ -236,6 +263,7 @@ Sub MapFragment1_Ready Dim OnInfoWindowClickListener1 As OnInfoWindowClickListener OnInfoWindowClickListener1.Initialize("OnInfoWindowClickListener1") GoogleMapEXTRA.SetOnInfoWindowClickListener(gmap, OnInfoWindowClickListener1) + End Sub ' ''''-------------------------- PRUEBA CON MARKER _CLICK