mirror of
https://github.com/KeymonSoft/Mariana.git
synced 2026-04-19 21:59:15 +00:00
- VERSION 5.06.24
- Se Agregó un switch para activar/descativar la geocerca, solo se puede modficar dentro del almacen y requiere contraseña de supervisor de un solo uso. - Se agregaron recordatorios de "Envío de venta", a las 10:30, 13:00 y 15:30 y por cada uno de esos horarios, 10, 5, 1 minutos antes.
This commit is contained in:
@@ -94,6 +94,18 @@ Sub Class_Globals
|
||||
Private b_importarBD As Button
|
||||
Private p_importarBDWA As Panel
|
||||
Dim cb_importarBDWA As CheckBox
|
||||
Private cb_geocerca As CheckBox
|
||||
Private passSupervisor As String = ""
|
||||
Private p_transparente As Panel
|
||||
Private p_passGeocerca As Panel
|
||||
Private et_passGeocerca As EditText
|
||||
Private b_passGeocerca As Button
|
||||
Private l_geocerca As Label
|
||||
Private ime As IME
|
||||
Dim latAlmacen As String = "0"
|
||||
Dim lonAlmacen As String = "0"
|
||||
Dim pantallaActual As B4XView
|
||||
Dim recordatorio As C_Recordatorio
|
||||
End Sub
|
||||
|
||||
Public Sub Initialize
|
||||
@@ -105,6 +117,7 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
B4XPages.GetManager.LogEvents = True
|
||||
Root = Root1
|
||||
Root.LoadLayout("login")
|
||||
recordatorio.Initialize(Root)
|
||||
s.Initialize(Me, "Subs")
|
||||
B4XPages.SetTitle(Me, "Mariana Preventa")
|
||||
login.Initialize
|
||||
@@ -290,10 +303,14 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
Wait For MES_StorageAvailable
|
||||
End If
|
||||
End If
|
||||
p_transparente.Left = 0 : p_transparente.top = 0
|
||||
p_transparente.Width = Root.Width : p_transparente.Height = Root.Height
|
||||
Subs.centraPanel(p_passGeocerca, Root.Width)
|
||||
End Sub
|
||||
|
||||
Sub B4XPage_Appear
|
||||
|
||||
B4XPages.mainpage.pantallaActual = Root
|
||||
passSupervisor = ""
|
||||
If Starter.muestraProgreso = 1 Then
|
||||
muestraProgreso("Descargando actualización")
|
||||
Starter.muestraProgreso = 0
|
||||
@@ -339,26 +356,26 @@ Sub B4XPage_Appear
|
||||
'Obtenemos el usuario registrado
|
||||
' CallSubDelayed(FirebaseMessaging, "SubscribeToTopics")
|
||||
dameUsuario
|
||||
' If Not(CheckNotificationAccess) Then
|
||||
' Msgbox2Async($"Se necesita acceso a las notificaciones, haga clic en "Aceptar" y en la siguiente pantalla permita el acceso a la aplicación "${Application.LabelName}"."$, "Permisos necesarios", "Aceptar", "Cancelar", "", Null, True)
|
||||
' Wait For Msgbox_Result (resultado As Int)
|
||||
' If resultado = DialogResponse.POSITIVE Then
|
||||
' Dim In As Intent
|
||||
' In.Initialize("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS", "")
|
||||
' StartActivity(In)
|
||||
' End If
|
||||
'' Private cd1 As ColorDrawable
|
||||
'' cd1.Initialize(Colors.red, 10dip)
|
||||
'' b_notifAccess.Background = cd1
|
||||
'' b_notifAccess.TextColor = Colors.White
|
||||
'' b_notifAccess.Text = "Activar Permisos"
|
||||
' Else
|
||||
'' Private cd1 As ColorDrawable
|
||||
'' cd1.Initialize(Colors.RGB(109, 221, 101), 10dip)
|
||||
'' b_notifAccess.Background = cd1
|
||||
'' b_notifAccess.TextColor = Colors.White
|
||||
'' b_notifAccess.Text = "Permisos Activos"
|
||||
' End If
|
||||
If Not(CheckNotificationAccess) Then
|
||||
Msgbox2Async($"Se necesita acceso a las notificaciones, haga clic en "Aceptar" y en la siguiente pantalla permita el acceso a la aplicación "${Application.LabelName}"."$, "Permisos necesarios", "Aceptar", "Cancelar", "", Null, True)
|
||||
Wait For Msgbox_Result (resultado As Int)
|
||||
If resultado = DialogResponse.POSITIVE Then
|
||||
Dim In As Intent
|
||||
In.Initialize("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS", "")
|
||||
StartActivity(In)
|
||||
End If
|
||||
' Private cd1 As ColorDrawable
|
||||
' cd1.Initialize(Colors.red, 10dip)
|
||||
' b_notifAccess.Background = cd1
|
||||
' b_notifAccess.TextColor = Colors.White
|
||||
' b_notifAccess.Text = "Activar Permisos"
|
||||
Else
|
||||
' Private cd1 As ColorDrawable
|
||||
' cd1.Initialize(Colors.RGB(109, 221, 101), 10dip)
|
||||
' b_notifAccess.Background = cd1
|
||||
' b_notifAccess.TextColor = Colors.White
|
||||
' b_notifAccess.Text = "Permisos Activos"
|
||||
End If
|
||||
' ks.Initialize(Me, "ks")
|
||||
' ks.vacuum
|
||||
' ks.centraEtiqueta(l_version, Root.Width)
|
||||
@@ -546,7 +563,34 @@ Sub JobDone(Job As HttpJob)
|
||||
IMEI_BASE = ""
|
||||
IMEI = ""
|
||||
End If
|
||||
If result.Tag = "traePassGeocerca" Then 'query tag
|
||||
Subs.logJobDoneResultados(result)
|
||||
Log(result.Rows.Size)
|
||||
For Each records() As Object In result.Rows
|
||||
Log($"|${records(result.Columns.Get("TMP_PASS"))}|"$)
|
||||
Dim tmp_pass As String = records(result.Columns.Get("TMP_PASS")).As(String)
|
||||
Log(tmp_pass)
|
||||
|
||||
If et_passGeocerca.Text = tmp_pass Then
|
||||
passSupervisor = et_passGeocerca.Text
|
||||
p_transparente.Visible = False
|
||||
et_passGeocerca.Text = ""
|
||||
p_geocerca_Click
|
||||
Else
|
||||
Msgbox("Contraseña equivocada","ATENCIÓN")
|
||||
End If
|
||||
|
||||
cmd.Initialize
|
||||
cmd.Name = "borraPassGeocerca"
|
||||
cmd.Parameters = Array As Object(Subs.traeAlmacen, Subs.traeRuta)
|
||||
reqManager.ExecuteCommand(cmd , "borraPassGeocerca")
|
||||
Next
|
||||
If result.Rows.Size = 0 Then
|
||||
Msgbox("Contraseña equivocada","ATENCIÓN")
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
Job.Release
|
||||
End If
|
||||
Log($"Paso1 = ${paso1} - Name: ${name} - IMEI: ${IMEI} - IMEI_BASE: ${IMEI_BASE}"$)
|
||||
@@ -610,10 +654,16 @@ Private Sub B4XPage_CloseRequest As ResumableSub
|
||||
End Sub
|
||||
|
||||
Sub GPS_LocationChanged (Location1 As Location)
|
||||
If user.text = "GPS" Then
|
||||
user.Text=Location1.Latitude
|
||||
pass.text=Location1.Longitude
|
||||
End If
|
||||
Log("LocationChanged")
|
||||
l_geocerca.Text = "Habilitar Geocerca"
|
||||
Dim l2 As Location
|
||||
l2.Initialize2(latAlmacen, lonAlmacen) ' Coordenadas del almacen
|
||||
Dim distance As Long = Location1.DistanceTo(l2) 'the result is in meters
|
||||
Log("Distancia a almacen: " & distance)
|
||||
' If user.text = "GPS" Then
|
||||
' user.Text=Location1.Latitude
|
||||
' pass.text=Location1.Longitude
|
||||
' End If
|
||||
End Sub
|
||||
|
||||
Sub PopupMenu_Dismiss
|
||||
@@ -714,14 +764,45 @@ Sub ocultaProgreso
|
||||
End Sub
|
||||
|
||||
Sub i_engrane_Click
|
||||
Log(123456789)
|
||||
l_geocerca.Text = "Buscando ubicación ..."
|
||||
CallSubDelayed(Tracker, "StartFLPSmall")
|
||||
If Tracker.FLP.IsInitialized And Tracker.FLP.GetLastKnownLocation.IsInitialized Then 'Si tenemos "UltimaUbicaccionConocida" la usamos.
|
||||
B4XPages.MainPage.lat_gps = Tracker.FLP.GetLastKnownLocation.Latitude
|
||||
B4XPages.MainPage.lon_gps = Tracker.FLP.GetLastKnownLocation.Longitude
|
||||
Log($"Tenemos UUC: ${Tracker.FLP.GetLastKnownLocation.Latitude},${Tracker.FLP.GetLastKnownLocation.Longitude}"$)
|
||||
GPS_LocationChanged(Tracker.FLP.GetLastKnownLocation)
|
||||
End If
|
||||
' Log($"Coordenadas de la tienda - lat:${m_lat}, lon:${m_lon}"$)
|
||||
Private x As Cursor = Starter.skmt.ExecQuery($"select CAT_VA_VALOR from CAT_VARIABLES where CAT_VA_DESCRIPCION = 'COORDS_ALMACEN'"$)
|
||||
If x.RowCount > 0 Then
|
||||
x.Position = 0
|
||||
' Log(x.GetString("CAT_VA_VALOR"))
|
||||
Dim coords() As String = Regex.Split(",", x.GetString("CAT_VA_VALOR"))
|
||||
Dim latAlmacen As String = coords(0)
|
||||
Dim lonAlmacen As String = coords(1)
|
||||
End If
|
||||
Log($"lat:${latAlmacen}, lon: ${lonAlmacen}"$)
|
||||
|
||||
lv_server.Clear
|
||||
lv_server.AddSingleLine("http://keymon.net:1781")
|
||||
If user.Text = "KMTS1" Then lv_server.AddSingleLine("http://192.99.93.204:1781")
|
||||
' l_server.Text = Starter.DBReqServer
|
||||
et_server.Text = Starter.DBReqServer
|
||||
Log(222)
|
||||
p_transparente.Visible = False
|
||||
passSupervisor = ""
|
||||
Dim c As Cursor = Starter.skmt.ExecQuery("select * from cat_variables where cat_va_descripcion = 'GEOCERCA_ACTIVA'")
|
||||
' cb_geocerca.Checked = True
|
||||
If c.RowCount > 0 Then
|
||||
c.Position = 0
|
||||
' Log(c.GetString("CAT_VA_VALOR") & " <-------")
|
||||
If c.GetString("CAT_VA_VALOR") = 0 Then cb_geocerca.Checked = False Else cb_geocerca.Checked = True
|
||||
' Log("----> " & cb_geocerca.Checked)
|
||||
End If
|
||||
' Starter.skmt.ExecNonQuery("delete from cat_variables where cat_va_descripcion = 'GEOCERCA_ACTIVA'")
|
||||
' Starter.skmt.ExecNonQuery($"insert into cat_variables (cat_va_descripcion, cat_va_valor) values ('GEOCERCA_ACTIVA', ${cb_geocerca.Checked})"$)
|
||||
' Log("----> " & cb_geocerca.Checked)
|
||||
cb_importarBDWA.Checked = s.traeUsarIntentBDWA
|
||||
Log(333)
|
||||
If user.Text.Trim = "KMTS1" Then
|
||||
p_importarBDWA.Visible = True
|
||||
Else
|
||||
@@ -807,3 +888,55 @@ Private Sub cb_importarBDWA_CheckedChange(Checked As Boolean)
|
||||
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
|
||||
|
||||
Private Sub p_transparente_Click
|
||||
p_transparente.Visible = False
|
||||
End Sub
|
||||
|
||||
Private Sub b_passGeocerca_Click
|
||||
Log("b_passGeocerca clicked")
|
||||
cmd.Initialize
|
||||
cmd.Name = "traePassGeocerca"
|
||||
cmd.Parameters = Array As Object(Subs.traeAlmacen, Subs.traeRuta, et_passGeocerca.text)
|
||||
Log($"${Subs.traeAlmacen}, ${Subs.traeRuta}, ${et_passGeocerca.text}"$)
|
||||
reqManager.ExecuteQuery(cmd , 0, "traePassGeocerca")
|
||||
|
||||
' If et_passGeocerca.Text = "12345" Then
|
||||
' passSupervisor = et_passGeocerca.Text
|
||||
' p_transparente.Visible = False
|
||||
' et_passGeocerca.Text = ""
|
||||
' Else
|
||||
' Msgbox("Contraseña equivocada","ATENCIÓN")
|
||||
' End If
|
||||
ime.HideKeyboard
|
||||
End Sub
|
||||
|
||||
Private Sub p_geocerca_Click
|
||||
Log("CLICKED")
|
||||
Dim activa As Int = 1
|
||||
If Subs.estamosEnAlmacen(50) Then
|
||||
If l_geocerca.Text <> "Buscando ubicación ..." Then
|
||||
If passSupervisor = "" Then
|
||||
p_transparente.Visible = True
|
||||
Else
|
||||
If cb_geocerca.Checked = False Then
|
||||
cb_geocerca.Checked = True
|
||||
activa = 1
|
||||
Else
|
||||
cb_geocerca.Checked = False
|
||||
activa = 0
|
||||
End If
|
||||
Starter.skmt.ExecNonQuery("delete from cat_variables where cat_va_descripcion = 'GEOCERCA_ACTIVA'")
|
||||
Starter.skmt.ExecNonQuery($"insert into cat_variables (cat_va_descripcion, cat_va_valor) values ('GEOCERCA_ACTIVA', ${activa})"$)
|
||||
End If
|
||||
Else
|
||||
ToastMessageShow("Es necesario tener ubicación", True)
|
||||
End If
|
||||
Else
|
||||
ToastMessageShow("Es necesario estar en el almacen para esta operación", True)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub p_geocerca2_Click
|
||||
p_geocerca_Click
|
||||
End Sub
|
||||
Reference in New Issue
Block a user