20/10/23 - Abordo, Mapa y ticketsdia

- Se habilitó el botón de "Próxima carga" (abordo)
- Se habilitó el botón de "Ubicar Rutas"
- Se quitó el fondo degradado de "Tickets Dia"
This commit is contained in:
2023-10-20 01:41:42 -06:00
parent 59c37d1621
commit 524e32ffae
6 changed files with 355 additions and 23 deletions

View File

@@ -2444,10 +2444,11 @@ Sub Resumen_Click
End Sub
Sub B_PROXIMA_Click
' skmt.ExecNonQuery("delete from CUENTAA")
' skmt.ExecNonQuery2("INSERT INTO CUENTAA VALUES (?)", Array As Object("0"))
' Main.tipov = "ABORDO"
'' StartActivity(colonia2)
skmt.ExecNonQuery("delete from CUENTAA")
skmt.ExecNonQuery2("INSERT INTO CUENTAA VALUES (?)", Array As Object("0"))
Starter.tipov = "ABORDO"
B4XPages.ShowPage("Productos")
' StartActivity(colonia2)
End Sub
@@ -2559,7 +2560,7 @@ Sub Btn_UbicarR_Click
c.Close
skmt.ExecNonQuery("delete from CAT_GUNAPROD WHERE CAT_GP_CLASIF NOT IN (" & MARCASQ &")" )
skmt.ExecNonQuery("delete from CAT_GUNAPROD WHERE CAT_GP_ID IN (SELECT CAT_DP_ID FROM CAT_DETALLES_PAQ WHERE CAT_DP_IDPROD NOT IN (SELECT CAT_GP_ID FROM CAT_GUNAPROD))")
' StartActivity(MAPA_RUTAS)
StartActivity(MAPA_RUTAS)
End Sub
Sub SUBIR_P_Click

View File

@@ -743,14 +743,15 @@ Library18=json
Library19=okhttputils2
Library2=baqrcode
Library20=phone
Library21=randomaccessfile
Library22=reflection
Library23=runtimepermissions
Library24=serial
Library25=sql
Library26=xcustomlistview
Library27=zxing_scanner
Library28=preoptimizedclv
Library21=preoptimizedclv
Library22=randomaccessfile
Library23=reflection
Library24=runtimepermissions
Library25=serial
Library26=sql
Library27=xcustomlistview
Library28=zxing_scanner
Library29=googlemapsextras
Library3=batteryprogressview
Library4=bitmapcreator
Library5=byteconverter
@@ -767,10 +768,11 @@ Module13=EscPosPrinter
Module14=FirebaseMessaging
Module15=kms_helperSubs
Module16=ManageExternalStorage
Module17=Starter
Module18=Subs
Module19=Tracker
Module17=MAPA_RUTAS
Module18=Starter
Module19=Subs
Module2=BatteryUtilities
Module20=Tracker
Module3=C_Cliente
Module4=C_Clientes
Module5=C_Historico
@@ -779,8 +781,8 @@ Module7=C_NoVenta
Module8=C_Principal
Module9=C_Productos
NumberOfFiles=365
NumberOfLibraries=28
NumberOfModules=19
NumberOfLibraries=29
NumberOfModules=20
Version=12.5
@EndOfDesignText@
#Region Project Attributes

View File

@@ -11,6 +11,7 @@ ModuleBookmarks17=
ModuleBookmarks18=
ModuleBookmarks19=
ModuleBookmarks2=
ModuleBookmarks20=
ModuleBookmarks3=
ModuleBookmarks4=
ModuleBookmarks5=
@@ -31,6 +32,7 @@ ModuleBreakpoints17=
ModuleBreakpoints18=
ModuleBreakpoints19=
ModuleBreakpoints2=
ModuleBreakpoints20=
ModuleBreakpoints3=
ModuleBreakpoints4=
ModuleBreakpoints5=
@@ -47,10 +49,11 @@ ModuleClosedNodes13=
ModuleClosedNodes14=
ModuleClosedNodes15=
ModuleClosedNodes16=
ModuleClosedNodes17=1
ModuleClosedNodes18=10,12,14
ModuleClosedNodes19=
ModuleClosedNodes17=
ModuleClosedNodes18=1
ModuleClosedNodes19=10,12,14
ModuleClosedNodes2=
ModuleClosedNodes20=
ModuleClosedNodes3=
ModuleClosedNodes4=
ModuleClosedNodes5=
@@ -58,6 +61,6 @@ ModuleClosedNodes6=
ModuleClosedNodes7=
ModuleClosedNodes8=
ModuleClosedNodes9=
NavigationStack=Subs,bitacora,1411,0,C_Productos,clv_prods_ll_ItemLongClick,965,6,C_Productos,l_prodX_Click,972,0,C_Productos,b_rmi_menos_Click,1250,1,C_Productos,PCLV2_HintRequested,1232,0,C_Productos,b_rmi_aceptar_Click,1240,1,C_Productos,p_rmi_Click,1236,0,Visual Designer,productos.bal,-100,1,Visual Designer,Cliente.bal,-100,2,C_Productos,l_prodX_LongClick,1001,6,C_Cliente,B_INV_Click,807,0
NavigationStack=C_Principal,Btn_UbicarR_Click,2555,5,MAPA_RUTAS,Globals,48,0,MAPA_RUTAS,MapFragment1_Ready,239,0,MAPA_RUTAS,OnInfoWindowClickListener1_click,245,6,C_Principal,B_PROXIMA_Click,2442,6,C_Principal,Resumen_Click,2428,0,C_TicketsDia,Class_Globals,0,0,Visual Designer,principal.bal,-100,2,Visual Designer,ticketsDia.bal,-100,1,C_TicketsDia,B4XPage_Created,22,0
SelectedBuild=0
VisibleModules=17,1,8,15,6,3,7,9,18,10
VisibleModules=18,1,8,15,6,3,7,9,19,10,17,11

Binary file not shown.

Binary file not shown.

326
B4A/MAPA_RUTAS.bas Normal file
View File

@@ -0,0 +1,326 @@
B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=Activity
Version=9.3
@EndOfDesignText@
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
'Activity module
Sub Process_Globals
' Dim GPS As GPS
' Dim rp As RuntimePermissions
Dim ruta As String
Dim skmt As SQL
Dim c As Cursor
Dim c2 As Cursor
Dim c3 As Cursor
End Sub
Sub Globals
Private gmap As GoogleMap
Private MapFragment1 As MapFragment
Dim Latitud As Double = 0
Dim Longitud As Double = 0
Dim Lat2 As Double = 0
Dim Lon2 As Double = 0
Dim p1, p2 As Location
Dim Distance As Float
Dim boton1 As Button
Dim HUE_BLUE As Float
Dim HUE_RED As Float
Dim HUE_GREEN As Float
Private B_AZUL As Button
Private B_ROJO As Button
Private B_VERDE As Button
Private B_TODOS As Button
Dim Tienda As String
Dim LatitudRu As Double
Dim LongitudRU As Double
Dim LIST_AZUL As List
Dim LIST_ROJO As List
Dim LIST_VERDE As List
Dim MARK_AZUL As Marker
Dim MARK_ROJO As Marker
Dim MARK_VERDE As Marker
Dim MARK_CEDIS As Marker
Dim rojo As String
Dim azul As String
Dim verde As String
Dim todos As String
Dim NumSerie As Int
Dim OnInfoWindowClickListener1 As OnInfoWindowClickListener
Dim GoogleMapEXTRA As GoogleMapsExtras
Dim CODIGO As String
Private SEMANA As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("MAPA_RUTAS")
ruta = File.DirInternal
If File.Exists(ruta, "kmt.db") = False Then
File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
End If
skmt.Initialize(ruta,"kmt.db", True)
'GPS
' If(FirstTime) Then
' GPS.Initialize("GPS")
' End If
If MapFragment1.IsGooglePlayServicesAvailable = False Then
ToastMessageShow("Please install Google Play Services.", True)
End If
'Boton velocidad'
' boton1.Initialize(0)
' boton1.Text = 0 &" "&"km/h"
' boton1.TextColor = Colors.Red
' boton1.TextSize = 15
' Activity.AddView(boton1, 40%x, 5dip, 25%x, 40dip)
'Fin Boton velocidad'
'MARK_CEDIS.IsInitialized
MARK_AZUL.IsInitialized
MARK_ROJO.IsInitialized
MARK_VERDE.IsInitialized
LIST_AZUL.Initialize
LIST_ROJO.Initialize
LIST_VERDE.Initialize
verde = 0
azul = 0
rojo = 0
todos = 1
' c=skmt.ExecQuery2("select count(*) AS CUANTOS from CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = ?", Array As String ("SEMANA"))
' c.Position =0
' SEMANA = c.GetString("CUANTOS")
' c.Close
'
' If SEMANA > 0 Then
' c=skmt.ExecQuery2("select CAT_VA_VALOR from CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = ?", Array As String ("SEMANA"))
' c.Position =0
' SEMANA = c.GetString("CAT_VA_VALOR")
' c.Close
' End If
End Sub
Sub MapFragment1_Ready
' skmt.Initialize(ruta,"kmt.db", True)
gmap = MapFragment1.GetMap
gmap.IsInitialized
'todos= 1
'permisos
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
gmap.MyLocationEnabled = Result
Dim JavaMapsObject As JavaObject
JavaMapsObject = gmap.GetUiSettings
JavaMapsObject.RunMethod("setMapToolbarEnabled", Array As Object(True))
'''''''----------------------------MARKER AZUL - POR VISITAR
If azul = 1 Or todos = 1 Then
c.IsInitialized
'''''''''VERIFICAR EN QUE TABLA O EN QUE CAMPO NOS LEE LA VENTAS PENDIENTES POR VISITAR
c=skmt.ExecQuery("select CAT_CL_CODIGO,CAT_CL_NOMBRE,CAT_CL_LAT,CAT_CL_LONG,CAT_CL_NUM_SERIEFISICO from kmt_info where gestion = 0 and CAT_CL_LAT is not null and CAT_CL_LONG is not null and CAT_CL_LAT <> 0 and CAT_CL_LONG <> 0 AND CAT_CL_NOMBRE <>'VENTA ABORDO' ORDER BY CAT_CL_NUM_SERIEFISICO ")
If c.RowCount > 0 Then
For i = 0 To c.RowCount -1
c.Position = i
LatitudRu = c.GetDouble("CAT_CL_LAT")
LongitudRU = c.GetDouble("CAT_CL_LONG")
CODIGO=c.GetString("CAT_CL_CODIGO")
Tienda= c.GetString("CAT_CL_NOMBRE")
NumSerie=c.GetInt("CAT_CL_NUM_SERIEFISICO")
MARK_AZUL = gmap.AddMarker3(LongitudRU,LatitudRu,CODIGO,LoadBitmap(File.DirAssets, "marker-azul-" & NumSerie &".png"))
MARK_AZUL.Snippet = Tienda
' MARK_AZUL = gmap.AddMarker2(LatitudRu,LongitudRU,CODIGO, gmap.HUE_BLUE)
' MARK_AZUL.Snippet = Tienda
Next
LIST_AZUL.Add(MARK_AZUL)
End If
c.Close
End If
'''''''----------------------------MARKER VERDE - VENTA
If verde = 1 Or todos = 1 Then
c2.IsInitialized
'''''''''VERIFICAR EN QUE TABLA O EN QUE CAMPO NOS LEE LA VENTAS
c2=skmt.ExecQuery("select CAT_CL_CODIGO, CAT_CL_NOMBRE,CAT_CL_LONG,CAT_CL_LAT, CAT_CL_NUM_SERIEFISICO from kmt_info where gestion = 2 and CAT_CL_LAT is not null and CAT_CL_LONG is not null and CAT_CL_LAT <> 0 and CAT_CL_LONG <> 0 AND CAT_CL_NOMBRE <>'VENTA ABORDO' ORDER BY CAT_CL_NUM_SERIEFISICO")
For i = 0 To c2.RowCount -1
c2.Position = i
LongitudRU = c2.GetDouble("CAT_CL_LONG")
LatitudRu = c2.GetDouble("CAT_CL_LAT")
CODIGO=c2.GetString("CAT_CL_CODIGO")
Tienda= c2.GetString("CAT_CL_NOMBRE")
NumSerie=c2.GetInt("CAT_CL_NUM_SERIEFISICO")
MARK_VERDE = gmap.AddMarker3(LongitudRU,LatitudRu,CODIGO, LoadBitmap(File.DirAssets, "marker-verde-"&NumSerie&".png"))
MARK_VERDE.Snippet = Tienda
' MARK_VERDE = gmap.AddMarker2(LatitudRu,LongitudRU,CODIGO,gmap.HUE_GREEN)
' MARK_VERDE.Snippet = Tienda
Next
Else
'''''''''VERIFICAR EN QUE TABLA O EN QUE CAMPO NOS LEE LA VENTAS--- ESTE VA IGUAL QUE EL ANTERIOR
If verde =1 Or todos = 1 Then
c2.IsInitialized
c2=skmt.ExecQuery("select CAT_CL_CODIGO, CAT_CL_NOMBRE,CAT_CL_LONG,CAT_CL_LAT,CAT_CL_NUM_SERIEFISICO from kmt_info where gestion = 2 and CAT_CL_LAT is not null and CAT_CL_LONG is not null and CAT_CL_LAT <> 0 and CAT_CL_LONG <> 0 AND CAT_CL_NOMBRE <>'VENTA ABORDO' ORDER BY CAT_CL_NUM_SERIEFISICO")
For i = 0 To c2.RowCount -1
c2.Position = i
LongitudRU = c2.GetDouble("CAT_CL_LONG")
LatitudRu = c2.GetDouble("CAT_CL_LAT")
CODIGO=c2.GetString("CAT_CL_CODIGO")
Tienda= c2.GetString("CAT_CL_NOMBRE")
NumSerie=c2.GetInt("CAT_CL_NUM_SERIEFISICO")
MARK_VERDE = gmap.AddMarker3(LongitudRU,LatitudRu,CODIGO, LoadBitmap(File.DirAssets, "marker-verde-"&NumSerie&".png"))
MARK_VERDE.Snippet = Tienda
' MARK_VERDE = gmap.AddMarker2(LatitudRu,LongitudRU,CODIGO,gmap.HUE_GREEN)
' MARK_VERDE.Snippet = Tienda
Next
c2 .Close
LIST_VERDE.Add(MARK_VERDE)
End If
End If
' '''''''----------------------------MARKER ROJO - NO VENTA
'''''''''VERIFICAR EN QUE TABLA O EN QUE CAMPO NOS LEE LAS NO VENTAS
If rojo =1 Or todos = 1 Then
c3.IsInitialized
c3=skmt.ExecQuery("select CAT_CL_CODIGO, CAT_CL_NOMBRE,CAT_CL_LONG,CAT_CL_LAT ,CAT_CL_NUM_SERIEFISICO from kmt_info where gestion = 3 and CAT_CL_LAT is not null and CAT_CL_LONG is not null and CAT_CL_LAT <> 0 and CAT_CL_LONG <> 0 AND CAT_CL_NOMBRE <>'VENTA ABORDO' ORDER BY CAT_CL_NUM_SERIEFISICO")
For i = 0 To c3.RowCount -1
c3.Position = i
LongitudRU = c3.GetDouble("CAT_CL_LONG")
LatitudRu = c3.GetDouble("CAT_CL_LAT")
Tienda= c3.GetString("CAT_CL_NOMBRE")
NumSerie=c3.GetInt("CAT_CL_NUM_SERIEFISICO")
MARK_ROJO = gmap.AddMarker3(LongitudRU,LatitudRu,CODIGO, LoadBitmap(File.DirAssets, "marker-rojo-" & NumSerie &".png"))
MARK_ROJO.Snippet = Tienda
' MARK_ROJO = gmap.AddMarker2(LatitudRu,LongitudRU,Tienda, gmap.HUE_RED)
' MARK_ROJO.Snippet = Tienda
Next
Else
'''''''''VERIFICAR EN QUE TABLA O EN QUE CAMPO NOS LEE LAS NO VENTAS- ESTE VA IGUAL QUE EL ANTERIOR
If rojo =1 Or todos = 1 Then
c3.IsInitialized
c3=skmt.ExecQuery("select CAT_CL_CODIGO, CAT_CL_NOMBRE,CAT_CL_LONG,CAT_CL_LAT, CAT_CL_NUM_SERIEFISICO from kmt_info where gestion = 3 and CAT_CL_LAT is not null and CAT_CL_LONG is not null and CAT_CL_LAT <> 0 and CAT_CL_LONG <> 0 AND CAT_CL_NOMBRE <>'VENTA ABORDO' ORDER BY CAT_CL_NUM_SERIEFISICO")
For i = 0 To c3.RowCount -1
c3.Position = i
LongitudRU = c3.GetDouble("CAT_CL_LONG")
LatitudRu = c3.GetDouble("CAT_CL_LAT")
Tienda= c3.GetString("CAT_CL_NOMBRE")
NumSerie=c3.GetInt("CAT_CL_NUM_SERIEFISICO")
MARK_ROJO = gmap.AddMarker3(LongitudRU,LatitudRu,CODIGO, LoadBitmap(File.DirAssets, "marker-rojo-" & NumSerie &".png"))
MARK_ROJO.Snippet = Tienda
' MARK_ROJO = gmap.AddMarker2(LatitudRu,LongitudRU,Tienda, gmap.HUE_RED)
' MARK_ROJO.Snippet = Tienda
Next
LIST_ROJO.Add(MARK_ROJO)
c3.Close
End If
End If
''------------------------------
' MARK_CEDIS = gmap.AddMarker3("19.3961802","-99.0784293","CEDIS", LoadBitmap(File.DirAssets, "marker-azul-0.png"))
' If MARK_VERDE.Visible Or MARK_ROJO.Visible Then
' MARK_CEDIS.Remove
' End If
Dim aa As CameraPosition
aa.Initialize(LongitudRU,LatitudRu,15)''' RECOMENDABLE CAMBIAR A 10 PARA QUE SE VEAN MAS MARCADORES
gmap.AnimateCamera(aa)
'''''---------------------- ESTO ES PARA LOS CLICK EN LAS VENTANAS DE INFORMACION-----------
Dim OnInfoWindowClickListener1 As OnInfoWindowClickListener
OnInfoWindowClickListener1.Initialize("OnInfoWindowClickListener1")
GoogleMapEXTRA.SetOnInfoWindowClickListener(gmap, OnInfoWindowClickListener1)
End Sub
Sub OnInfoWindowClickListener1_click(Marker1 As Marker)
Log("Info clicked")
skmt.ExecNonQuery("delete from CUENTAA")
skmt.ExecNonQuery2("INSERT INTO CUENTAA VALUES (?) ", Array As Object(Marker1.Title))
B4XPages.ShowPage("Cliente")
Activity.Finish
Log(1)
End Sub
Sub GPS_LocationChanged (Parametro As Location)
MARK_CEDIS.IsInitialized
' Parametro.ConvertToSeconds(Parametro.Latitude)
' Parametro.ConvertToSeconds(Parametro.Longitude)
'
' Dim sp As Int
' sp = Ceil(Parametro.Speed * 3.6)
' boton1.Text = sp &" "&"km/h"
' Latitud = Parametro.Latitude
' Longitud = Parametro.Longitude
' p2.Initialize2(Latitud,Longitud)
' p1.Initialize2(Lat2, Lon2)
' Distance = p1.DistanceTo(p2)
' If Latitud <> 0 And Longitud <> 0 Then
' If Distance > 10 Then
' Lat2 = Latitud
' Lon2 = Longitud
' Dim cp As CameraPosition
' cp.Initialize2(Parametro.Latitude, Parametro.Longitude, gmap.CameraPosition.Zoom, Parametro.Bearing, 0)
' gmap.AnimateCamera(cp)
' End If
' End If
End Sub
Sub Activity_Resume
' If GPS.GPSEnabled = False Then
' ToastMessageShow("Debe Activar el GPS del Equipo.", True)
' StartActivity(GPS.LocationSettingsIntent)
' Else
' GPS.Start(0, 0)
' End If
End Sub
Sub Activity_Pause (UserClosed As Boolean)
' GPS.Stop
End Sub
Sub B_TODOS_Click
todos =1
verde = 0
azul = 0
rojo = 0
MapFragment1_Ready
End Sub
Sub B_VERDE_Click
verde = 1
azul = 0
rojo = 0
todos = 0
gmap.Clear
MapFragment1_Ready
End Sub
Sub B_ROJO_Click
rojo = 1
verde = 0
azul = 0
todos = 0
gmap.Clear
MapFragment1_Ready
End Sub
Sub B_AZUL_Click
azul = 1
verde = 0
rojo = 0
todos = 0
gmap.Clear
MapFragment1_Ready
End Sub