mirror of
https://github.com/KeymonSoft/Mariana_Censos.git
synced 2026-04-20 22:29:13 +00:00
26/2/23 - Cuestionario para clientes
- Se agregó el cuestionario popup al entrar a un cliente. - FALTA PONERLO EN LOS CLIENTES NUEVOS
This commit is contained in:
@@ -74,6 +74,10 @@ Sub Class_Globals
|
|||||||
Private lv_server As ListView
|
Private lv_server As ListView
|
||||||
Private l_server As Label
|
Private l_server As Label
|
||||||
Private et_server As EditText
|
Private et_server As EditText
|
||||||
|
|
||||||
|
Dim q As C_Cuestionario
|
||||||
|
' Private bAceptarPregunta As Button
|
||||||
|
' Dim encuestaIniciada As Boolean = False
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Sub Initialize
|
Public Sub Initialize
|
||||||
@@ -94,7 +98,7 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
|||||||
B4XPages.AddPage("Clientes", clientes)
|
B4XPages.AddPage("Clientes", clientes)
|
||||||
cliente.Initialize
|
cliente.Initialize
|
||||||
B4XPages.AddPageAndCreate("Cliente", cliente)
|
B4XPages.AddPageAndCreate("Cliente", cliente)
|
||||||
' productos.Initialize
|
' productos.InitializeQuestionario
|
||||||
' B4XPages.AddPage("Productos", productos)
|
' B4XPages.AddPage("Productos", productos)
|
||||||
updateAvailable.Initialize
|
updateAvailable.Initialize
|
||||||
B4XPages.AddPage("updateAvailable", updateAvailable)
|
B4XPages.AddPage("updateAvailable", updateAvailable)
|
||||||
@@ -117,6 +121,7 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
|||||||
' historico.Initialize
|
' historico.Initialize
|
||||||
' B4XPages.AddPage("Historico", historico)
|
' B4XPages.AddPage("Historico", historico)
|
||||||
ruta = Starter.ruta
|
ruta = Starter.ruta
|
||||||
|
p_Main.Height = Root.Height
|
||||||
' Subs.borraArribaDe100Errores ' Para Websockets
|
' Subs.borraArribaDe100Errores ' Para Websockets
|
||||||
' Subs.borraArribaDe600RenglonesBitacora ' Para Websockets
|
' Subs.borraArribaDe600RenglonesBitacora ' Para Websockets
|
||||||
If File.Exists(ruta, "kmt.db") = False Then
|
If File.Exists(ruta, "kmt.db") = False Then
|
||||||
@@ -143,6 +148,7 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
|||||||
skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS CAT_GIROS (id TEXT, descripcion TEXT)")
|
skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS CAT_GIROS (id TEXT, descripcion TEXT)")
|
||||||
' skmt.ExecNonQuery("drop table kmt_info")
|
' skmt.ExecNonQuery("drop table kmt_info")
|
||||||
skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS kmt_info (CAT_CL_FOTO BLOB, CAT_CL_NUM_SERIEFISICO TEXT, CAT_CL_MTOCOMPRA TEXT, CAT_CL_CEDIS TEXT, CAT_CL_LAT TEXT, CAT_CL_LONG TEXT, CAT_CL_FBAJA TEXT, CAT_CL_FALTA TEXT, CAT_CL_CP TEXT, CAT_CL_EDO TEXT, CAT_CL_MUNI TEXT, CAT_CL_COLONIA TEXT, CAT_CL_CALLE2 TEXT, CAT_CL_CALLE1 TEXT, CAT_CL_NOINT TEXT, CAT_CL_NOEXT TEXT, CAT_CL_CALLE TEXT, CAT_CL_EMAIL TEXT, CAT_CL_TELEFONO TEXT, CAT_CL_ATIENTE2 TEXT, CAT_CL_ATIENDE1 TEXT, CAT_CL_NOMBRE TEXT, CAT_CL_GIRO TEXT, CAT_CL_DIAS_VISITA TEXT, CAT_CL_TIPO_RUTA TEXT, CAT_CL_RUTA TEXT, CAT_CL_CODIGO TEXT, gestion NUMERIC, CAT_CL_DIASEMANA TEXT, CAT_CL_SECUENCIA INT)")
|
skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS kmt_info (CAT_CL_FOTO BLOB, CAT_CL_NUM_SERIEFISICO TEXT, CAT_CL_MTOCOMPRA TEXT, CAT_CL_CEDIS TEXT, CAT_CL_LAT TEXT, CAT_CL_LONG TEXT, CAT_CL_FBAJA TEXT, CAT_CL_FALTA TEXT, CAT_CL_CP TEXT, CAT_CL_EDO TEXT, CAT_CL_MUNI TEXT, CAT_CL_COLONIA TEXT, CAT_CL_CALLE2 TEXT, CAT_CL_CALLE1 TEXT, CAT_CL_NOINT TEXT, CAT_CL_NOEXT TEXT, CAT_CL_CALLE TEXT, CAT_CL_EMAIL TEXT, CAT_CL_TELEFONO TEXT, CAT_CL_ATIENTE2 TEXT, CAT_CL_ATIENDE1 TEXT, CAT_CL_NOMBRE TEXT, CAT_CL_GIRO TEXT, CAT_CL_DIAS_VISITA TEXT, CAT_CL_TIPO_RUTA TEXT, CAT_CL_RUTA TEXT, CAT_CL_CODIGO TEXT, gestion NUMERIC, CAT_CL_DIASEMANA TEXT, CAT_CL_SECUENCIA INT)")
|
||||||
|
skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS CUESTIONARIO (Q_IDCLIENTE TEXT, Q_IDPREGUNTA TEXT, Q_PREGUNTA TEXT, Q_IDRESPUESTA TEXT, Q_RESPUESTA TEXT, Q_FECHA TEXT)")
|
||||||
Subs.agregaColumna("kmt_info", "CAT_CL_CRUCE1", "TEXT")
|
Subs.agregaColumna("kmt_info", "CAT_CL_CRUCE1", "TEXT")
|
||||||
Subs.agregaColumna("kmt_info", "CAT_CL_ESTATUS", "TEXT")
|
Subs.agregaColumna("kmt_info", "CAT_CL_ESTATUS", "TEXT")
|
||||||
Subs.agregaColumna("kmt_info", "CAT_CL_ENVIO_PENDIENTE", "TEXT")
|
Subs.agregaColumna("kmt_info", "CAT_CL_ENVIO_PENDIENTE", "TEXT")
|
||||||
@@ -203,8 +209,9 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
|||||||
almacen = 0
|
almacen = 0
|
||||||
rutaPreventa = 0
|
rutaPreventa = 0
|
||||||
p_appUpdate.Visible = False
|
p_appUpdate.Visible = False
|
||||||
|
Log(Starter.server)
|
||||||
reqManager.Initialize(Me, Starter.server)
|
reqManager.Initialize(Me, Starter.server)
|
||||||
|
' q.Initialize(Me, "q", Root, skmt)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub B4XPage_Appear
|
Sub B4XPage_Appear
|
||||||
@@ -218,12 +225,12 @@ Sub B4XPage_Appear
|
|||||||
Else
|
Else
|
||||||
Log("SIN permisos de ubicacion")
|
Log("SIN permisos de ubicacion")
|
||||||
End If
|
End If
|
||||||
Log("1")
|
|
||||||
p_Main.Width = Root.Width
|
p_Main.Width = Root.Width
|
||||||
Dim ph As Phone 'Get Id Device
|
Dim ph As Phone 'Get Id Device
|
||||||
Dim DeviceID As String = ph.GetSettings("android_id").ToUpperCase
|
Dim DeviceID As String = ph.GetSettings("android_id").ToUpperCase
|
||||||
LogColor($"////////////////// DeviceID: ${DeviceID} ////////////////// "$, Colors.Blue)
|
LogColor($"////////////////// DeviceID: ${DeviceID} ////////////////// "$, Colors.Blue)
|
||||||
server = Starter.server
|
server = Starter.server
|
||||||
|
Log(Starter.server)
|
||||||
reqManager.Initialize(Me, Starter.server)
|
reqManager.Initialize(Me, Starter.server)
|
||||||
tgl.Initialize()
|
tgl.Initialize()
|
||||||
If Not(Starter.gps.GPSEnabled) Then
|
If Not(Starter.gps.GPSEnabled) Then
|
||||||
@@ -261,7 +268,9 @@ Sub B4XPage_Appear
|
|||||||
'Obtenemos el usuario registrado
|
'Obtenemos el usuario registrado
|
||||||
' CallSubDelayed(FirebaseMessaging, "SubscribeToTopics")
|
' CallSubDelayed(FirebaseMessaging, "SubscribeToTopics")
|
||||||
dameUsuario
|
dameUsuario
|
||||||
|
' If Not(q.encuestaIniciada) Then q.agregaPregunta("1", "¿Se puede acceder al negocio o está enrejado?", Array As String("No, está enrejado o no se tiene acceso", "Si se pude acceder"))
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
||||||
|
|
||||||
Sub Entrar_Click
|
Sub Entrar_Click
|
||||||
@@ -577,8 +586,8 @@ End Sub
|
|||||||
|
|
||||||
Sub i_engrane_Click
|
Sub i_engrane_Click
|
||||||
lv_server.Clear
|
lv_server.Clear
|
||||||
lv_server.AddSingleLine("http://keymon.lat:1782")
|
lv_server.AddSingleLine("http://keymon.lat:1781")
|
||||||
If user.Text = "KMTS1" Then lv_server.AddSingleLine("http://10.0.0.205:1782")
|
If user.Text = "KMTS1" Then lv_server.AddSingleLine("http://10.0.0.205:1781")
|
||||||
l_server.Text = Starter.server
|
l_server.Text = Starter.server
|
||||||
et_server.Text = Starter.server
|
et_server.Text = Starter.server
|
||||||
Subs.panelVisible(p_appUpdate,0,0)
|
Subs.panelVisible(p_appUpdate,0,0)
|
||||||
@@ -587,6 +596,7 @@ End Sub
|
|||||||
Sub b_guardar_Click
|
Sub b_guardar_Click
|
||||||
p_appUpdate.Visible = False
|
p_appUpdate.Visible = False
|
||||||
Starter.reqManager.Initialize(Me, et_server.Text)
|
Starter.reqManager.Initialize(Me, et_server.Text)
|
||||||
|
reqManager.Initialize(Me, et_server.Text)
|
||||||
Starter.server = et_server.Text
|
Starter.server = et_server.Text
|
||||||
ToastMessageShow("Servidor modificado", False)
|
ToastMessageShow("Servidor modificado", False)
|
||||||
Subs.panelVisible(p_Main,0,0)
|
Subs.panelVisible(p_Main,0,0)
|
||||||
@@ -625,3 +635,32 @@ Private Sub b_enviarbd_Click
|
|||||||
in.Flags = 1 'FLAG_GRANT_READ_URI_PERMISSION
|
in.Flags = 1 'FLAG_GRANT_READ_URI_PERMISSION
|
||||||
StartActivity(in)
|
StartActivity(in)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
'Sub q_preguntaContestada(m As Map)
|
||||||
|
'' Recibimos el id de la pregunta, el id de la respuesta, el texto de la respuesta y el objeto del panelSombra para poder ocultarlo.
|
||||||
|
' Log(m)
|
||||||
|
'' If q.IsInitialized Then Log($"${q.encuestaIniciada}|${q.preguntaActual}"$)
|
||||||
|
'' m.Get("panel").As(Panel).Visible = False 'Ocultamos el panel de la pregunta.
|
||||||
|
' m.Get("panel").As(Panel).RemoveView 'Quitamos le panel de la pregunta
|
||||||
|
' DateTime.DateFormat = "yyyyMMdd"
|
||||||
|
' skmt.ExecNonQuery($"delete from QUESTIONARIO where Q_IDCLIENTE = '${Subs.traeCliente}' and Q_IDPREGUNTA = '${m.Get("idPregunta")}'"$)
|
||||||
|
' skmt.ExecNonQuery($"insert into QUESTIONARIO (Q_IDCLIENTE, Q_IDPREGUNTA, Q_PREGUNTA, Q_IDRESPUESTA, Q_RESPUESTA, Q_FECHA) values ('${Subs.traeCliente}', '${m.Get("idPregunta")}', '${m.Get("pregunta")}', '${m.Get("idRespuesta")}', '${m.Get("respuesta")}', '${DateTime.Date(DateTime.now)}')"$)
|
||||||
|
' Select Case m.Get("idPregunta")
|
||||||
|
' Case "1"
|
||||||
|
' If m.Get("respuesta") = "No, está enrejado o no se tiene acceso" Then
|
||||||
|
' Log("Tiendajon / Ventana / Kiosko")
|
||||||
|
' Else if m.Get("respuesta") = "Si se pude acceder" Then
|
||||||
|
' q.agregaPregunta("2", "¿Tiene al menos 2 pasillos con acceso directo a la mercancía?", Array As String("Si tiene al menos 2 pasillos con acceso directo a la mercancía", "No tiene pasillos o solo uno central"))
|
||||||
|
' End If
|
||||||
|
' Case "2"
|
||||||
|
' If m.Get("respuesta") = "Si tiene al menos 2 pasillos con acceso directo a la mercancía" Then
|
||||||
|
' Log("Mini-Super")
|
||||||
|
' else If m.Get("respuesta") = "No tiene pasillos o solo uno central" Then
|
||||||
|
' q.agregaPregunta("3", "¿Cuenta con enfriador horizontal para venta de perecederos como queso, jamon, crema, etc.?", Array As String("Si", "No tiene enfriador horizontal. ¿El local esta enfocado a venta especializada?"))
|
||||||
|
' End If
|
||||||
|
' Case 3
|
||||||
|
' Log(">>>>>>>>>> " & q.encuestaIniciada)
|
||||||
|
' q.encuestaIniciada = False
|
||||||
|
' Log(">>>>>>>>>> " & q.encuestaIniciada)
|
||||||
|
' End Select
|
||||||
|
'End Sub
|
||||||
@@ -151,7 +151,15 @@ Sub Class_Globals
|
|||||||
Dim turnoColor As Int = 1
|
Dim turnoColor As Int = 1
|
||||||
Dim cd As ColorDrawable
|
Dim cd As ColorDrawable
|
||||||
Dim camposModificados As List
|
Dim camposModificados As List
|
||||||
dim mandarTodo as Boolean = False
|
Dim mandarTodo As Boolean = False
|
||||||
|
Private sv_clientesDatos As ScrollView
|
||||||
|
' Private bAceptarPregunta As Button
|
||||||
|
' Dim encuestaIniciada As Boolean = False
|
||||||
|
Dim q As C_Cuestionario
|
||||||
|
Dim su As StringUtils
|
||||||
|
Dim clienteAnt As String = ""
|
||||||
|
Private l_cuestionario As Label
|
||||||
|
Private b_mapa2 As Button
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
'You can add more parameters here.
|
'You can add more parameters here.
|
||||||
@@ -177,9 +185,18 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
|||||||
m_lon = 0
|
m_lon = 0
|
||||||
|
|
||||||
reqManager.Initialize(Me, Starter.server)
|
reqManager.Initialize(Me, Starter.server)
|
||||||
|
sv_clientesDatos.Width = Root.Width
|
||||||
|
sv_clientesDatos.Height = Root.Height
|
||||||
|
sv_clientesDatos.Panel.LoadLayout("clienteDatos")
|
||||||
|
Subs.centraBoton(b_guardaCambios, p_cliente.Width)
|
||||||
|
If l_cuestionario.Visible Then
|
||||||
|
b_guardaCambios.Top = l_cuestionario.Top + l_cuestionario.Height + 20dip
|
||||||
|
Else
|
||||||
|
b_guardaCambios.Top = l_cuestionario.Top + 20dip
|
||||||
|
End If
|
||||||
Log("terminamos create")
|
Log("terminamos create")
|
||||||
camposModificados.Initialize
|
camposModificados.Initialize
|
||||||
|
q.Initialize(Me, "q", Root, skmt)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
||||||
@@ -187,9 +204,8 @@ End Sub
|
|||||||
Sub B4XPage_Appear
|
Sub B4XPage_Appear
|
||||||
rp.CheckAndRequest(Starter.rp.PERMISSION_CAMERA)
|
rp.CheckAndRequest(Starter.rp.PERMISSION_CAMERA)
|
||||||
Wait For B4XPage_PermissionResult (Permission As String, resultC As Boolean)
|
Wait For B4XPage_PermissionResult (Permission As String, resultC As Boolean)
|
||||||
rp.CheckAndRequest(Starter.rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
|
sv_clientesDatos.Panel.Height = p_cliente.Height
|
||||||
Wait For B4XPage_PermissionResult (Permission As String, resultC As Boolean)
|
l_cuestionario.Visible = False
|
||||||
CallSubDelayed(Tracker, "StartFLPSmall")
|
|
||||||
reqManager.Initialize(Me, Starter.server)
|
reqManager.Initialize(Me, Starter.server)
|
||||||
lv_colonia.Visible = False
|
lv_colonia.Visible = False
|
||||||
Timer2.Initialize("Timer2", Interval * 1)
|
Timer2.Initialize("Timer2", Interval * 1)
|
||||||
@@ -200,6 +216,7 @@ Sub B4XPage_Appear
|
|||||||
ToastMessageShow("Es necesario tener el GPS encendido", True)
|
ToastMessageShow("Es necesario tener el GPS encendido", True)
|
||||||
StartActivity(Starter.gps.LocationSettingsIntent)
|
StartActivity(Starter.gps.LocationSettingsIntent)
|
||||||
End If
|
End If
|
||||||
|
CallSubDelayed(Tracker, "StartFLPSmall")
|
||||||
If refrescarCliente Then
|
If refrescarCliente Then
|
||||||
LogColor("Cargamos cliente de BD", Colors.Magenta)
|
LogColor("Cargamos cliente de BD", Colors.Magenta)
|
||||||
skmt.Initialize(ruta,"kmt.db", True)
|
skmt.Initialize(ruta,"kmt.db", True)
|
||||||
@@ -240,6 +257,26 @@ Sub B4XPage_Appear
|
|||||||
l_lat.Text = m_lat
|
l_lat.Text = m_lat
|
||||||
l_lon.Text = m_lon
|
l_lon.Text = m_lon
|
||||||
End If
|
End If
|
||||||
|
Private cuest As Cursor = skmt.ExecQuery($"select * from cuestionario where Q_IDCLIENTE = '${Subs.traeCliente}'"$)
|
||||||
|
If cuest.RowCount > 0 Then
|
||||||
|
Private cs As CSBuilder
|
||||||
|
cs.Initialize
|
||||||
|
Private cuestText As String
|
||||||
|
For i = 0 To cuest.RowCount - 1
|
||||||
|
cuest.Position = i
|
||||||
|
' If i = 0 Then
|
||||||
|
cs.color(Colors.black).Append(cuest.GetString("Q_PREGUNTA")).popall.Append(CRLF).Append(" " & cuest.GetString("Q_RESPUESTA")).Append(CRLF).popall
|
||||||
|
' Else
|
||||||
|
' cuestText = cuestText & cs.bold.Append(CRLF).Append(cuest.GetString("Q_PREGUNTA")).pop.Append(CRLF).Append(cuest.GetString("Q_RESPUESTA")).popall
|
||||||
|
' End If
|
||||||
|
Next
|
||||||
|
l_cuestionario.Text = cs
|
||||||
|
l_cuestionario.Visible = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
l_cuestionario.Height = su.MeasureMultilineTextHeight(l_cuestionario, l_cuestionario.Text)
|
||||||
|
|
||||||
|
ajustaTamano
|
||||||
' Tracker.FLP.Connect
|
' Tracker.FLP.Connect
|
||||||
If Tracker.FLP.IsInitialized And Tracker.FLP.GetLastKnownLocation.IsInitialized Then 'Si tenemos "UltimaUbicaccionConocida" la usamos.
|
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.lat_gps = Tracker.FLP.GetLastKnownLocation.Latitude
|
||||||
@@ -269,11 +306,17 @@ Sub B4XPage_Appear
|
|||||||
cb_giro.SetItems(losGiros)
|
cb_giro.SetItems(losGiros)
|
||||||
cb_giro.SelectedIndex = losGiros.IndexOf(c.GetString("CAT_CL_GIRO"))
|
cb_giro.SelectedIndex = losGiros.IndexOf(c.GetString("CAT_CL_GIRO"))
|
||||||
cb_giro.mBase.Width = et_diaSemana.Width
|
cb_giro.mBase.Width = et_diaSemana.Width
|
||||||
Log("|"&c.GetString("CAT_CL_GIRO")&"|")
|
' Log("|"&c.GetString("CAT_CL_GIRO")&"|")
|
||||||
c.Close
|
c.Close
|
||||||
camposModificados.Clear
|
camposModificados.Clear
|
||||||
End If
|
End If
|
||||||
refrescarCliente = False
|
refrescarCliente = False
|
||||||
|
'Revisamos si el cliente actual es diferente del anterior y si es diferente ponemos encuestaIniciada en VERDADERO.
|
||||||
|
If clienteAnt <> Subs.traeCliente Then q.encuestaIniciada = False
|
||||||
|
clienteAnt = Subs.traeCliente
|
||||||
|
' Log("CON ENCUESTA: " & q.clienteConEncuesta(Subs.traeCliente))
|
||||||
|
' Log("INICIADA: " & q.encuestaIniciada)
|
||||||
|
If Not(q.encuestaIniciada) And Not(q.clienteConEncuesta(Subs.traeCliente)) Then q.agregaPregunta("1", "¿Se puede acceder al negocio o está enrejado?", Array As String("No, está enrejado o no se tiene acceso", "Si se pude acceder"))
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub Timer2_Tick
|
Private Sub Timer2_Tick
|
||||||
@@ -303,8 +346,8 @@ Sub GPS_LocationChanged (Location1 As Location)
|
|||||||
l2.Initialize2(m_lat, m_lon)
|
l2.Initialize2(m_lat, m_lon)
|
||||||
' Log($"${Location1.Latitude}, ${Location1.Longitude} - ${Tracker.FLP.GetLastKnownLocation.Latitude}, ${Tracker.FLP.GetLastKnownLocation.Longitude}"$)
|
' Log($"${Location1.Latitude}, ${Location1.Longitude} - ${Tracker.FLP.GetLastKnownLocation.Latitude}, ${Tracker.FLP.GetLastKnownLocation.Longitude}"$)
|
||||||
'now we need the distance between our location and the target location
|
'now we need the distance between our location and the target location
|
||||||
Dim distance As Long
|
' Dim distance As Long
|
||||||
distance = l1.DistanceTo(l2) 'the result is in meter
|
' distance = l1.DistanceTo(l2) 'the result is in meter
|
||||||
B4XPages.MainPage.skmt.ExecNonQuery("DELETE FROM HIST_GPS")
|
B4XPages.MainPage.skmt.ExecNonQuery("DELETE FROM HIST_GPS")
|
||||||
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO HIST_GPS (HGDATE, HGLAT, HGLON) VALUES(?,?,?) ", Array As Object (sDate & " " & sTime, B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps))
|
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO HIST_GPS (HGDATE, HGLAT, HGLON) VALUES(?,?,?) ", Array As Object (sDate & " " & sTime, B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps))
|
||||||
CallSubDelayed(Tracker, "CreateLocationRequest")
|
CallSubDelayed(Tracker, "CreateLocationRequest")
|
||||||
@@ -316,7 +359,10 @@ End Sub
|
|||||||
|
|
||||||
Private Sub B4XPage_CloseRequest As ResumableSub
|
Private Sub B4XPage_CloseRequest As ResumableSub
|
||||||
' BACK key pressed
|
' BACK key pressed
|
||||||
|
q.encuestaIniciada = False
|
||||||
|
q.ocultPanelPregunta
|
||||||
' Return True To close, False To cancel
|
' Return True To close, False To cancel
|
||||||
|
CallSubDelayed(Tracker, "StartFLP")
|
||||||
Return True
|
Return True
|
||||||
' Return False
|
' Return False
|
||||||
End Sub
|
End Sub
|
||||||
@@ -642,3 +688,98 @@ End Sub
|
|||||||
Private Sub et_diaSemana_TextChanged (Old As String, New As String)
|
Private Sub et_diaSemana_TextChanged (Old As String, New As String)
|
||||||
camposModificados.Add("CAT_CL_DIAS_VISITA")
|
camposModificados.Add("CAT_CL_DIAS_VISITA")
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Sub q_preguntaContestada(m As Map)
|
||||||
|
' Recibimos el id de la pregunta, el id de la respuesta, el texto de la respuesta y el objeto del panelSombra para poder ocultarlo.
|
||||||
|
Log(m)
|
||||||
|
' If q.IsInitialized Then Log($"${q.encuestaIniciada}|${q.preguntaActual}"$)
|
||||||
|
' m.Get("panel").As(Panel).Visible = False 'Ocultamos el panel de la pregunta.
|
||||||
|
m.Get("panel").As(Panel).RemoveView 'Quitamos le panel de la pregunta
|
||||||
|
DateTime.DateFormat = "yyyyMMdd"
|
||||||
|
skmt.ExecNonQuery($"delete from CUESTIONARIO where Q_IDCLIENTE = '${Subs.traeCliente}' and Q_IDPREGUNTA = '${m.Get("idPregunta")}'"$)
|
||||||
|
skmt.ExecNonQuery($"insert into CUESTIONARIO (Q_IDCLIENTE, Q_IDPREGUNTA, Q_PREGUNTA, Q_IDRESPUESTA, Q_RESPUESTA, Q_FECHA) values ('${Subs.traeCliente}', '${m.Get("idPregunta")}', '${m.Get("pregunta")}', '${m.Get("idRespuesta")}', '${m.Get("respuesta")}', '${DateTime.Date(DateTime.now)}')"$)
|
||||||
|
Select Case m.Get("idPregunta")
|
||||||
|
Case "1"
|
||||||
|
If m.Get("respuesta") = "No, está enrejado o no se tiene acceso" Then
|
||||||
|
Log("Tiendajon / Ventana / Kiosko")
|
||||||
|
ToastMessageShow("Tiendajon / Ventana / Kiosko", False)
|
||||||
|
q.agregaPregunta("6", "¿Cuenta con caja de salida para cobro con sistema de computo?", Array As String("Si, tiene sistema de computo para cobro", "No"))
|
||||||
|
Else if m.Get("respuesta") = "Si se pude acceder" Then
|
||||||
|
q.agregaPregunta("2", "¿Tiene al menos 2 pasillos con acceso directo a la mercancía?", Array As String("Si tiene al menos 2 pasillos con acceso directo a la mercancía", "No tiene pasillos o solo uno central"))
|
||||||
|
End If
|
||||||
|
Case "2"
|
||||||
|
If m.Get("respuesta") = "Si tiene al menos 2 pasillos con acceso directo a la mercancía" Then
|
||||||
|
Log("Mini-Super")
|
||||||
|
ToastMessageShow("Mini-Super", False)
|
||||||
|
q.agregaPregunta("6", "¿Cuenta con caja de salida para cobro con sistema de computo?", Array As String("Si, tiene sistema de computo para cobro", "No"))
|
||||||
|
else If m.Get("respuesta") = "No tiene pasillos o solo uno central" Then
|
||||||
|
q.agregaPregunta("3", "¿Cuenta con enfriador horizontal para venta de perecederos como queso, jamon, crema, etc.?", Array As String("Si", "No tiene enfriador horizontal."))
|
||||||
|
End If
|
||||||
|
Case "3"
|
||||||
|
Log("|"&m.Get("respuesta")&"|")
|
||||||
|
If m.Get("respuesta") = "Si" Then
|
||||||
|
Log("Miscelanea")
|
||||||
|
ToastMessageShow("Miscelanea", False)
|
||||||
|
q.agregaPregunta("6", "¿Cuenta con caja de salida para cobro con sistema de computo?", Array As String("Si, tiene sistema de computo para cobro", "No"))
|
||||||
|
else If m.Get("respuesta") = "No tiene enfriador horizontal." Then
|
||||||
|
q.agregaPregunta("4", "¿El local esta enfocado a venta especializada?", Array As String("No", "Si"))
|
||||||
|
End If
|
||||||
|
Case "4"
|
||||||
|
If m.Get("respuesta") = "No" Then
|
||||||
|
Log("Abarrotera")
|
||||||
|
ToastMessageShow("Abarrotera", False)
|
||||||
|
q.agregaPregunta("6", "¿Cuenta con caja de salida para cobro con sistema de computo?", Array As String("Si, tiene sistema de computo para cobro", "No"))
|
||||||
|
else If m.Get("respuesta") = "Si" Then
|
||||||
|
q.agregaPregunta("5", "¿Cual venta especializada?", Array As String("Carnicería / Pollería", "Cremería", "Depósito / Vinateria", "Dulcería", "Farmacia", "Fonda / Restaurante / Cafetería", "Verdulería"))
|
||||||
|
End If
|
||||||
|
Case "5"
|
||||||
|
Log(m.Get("respuesta"))
|
||||||
|
ToastMessageShow(m.Get("respuesta"), False)
|
||||||
|
' If m.Get("respuesta") = "No" Then
|
||||||
|
' Log("Abarrotera")
|
||||||
|
' q.agregaPregunta("5", "¿Cuenta con caja de salida para cobro con sistema de computo?", Array As String("Si, tiene sistema de computo para cobro", "No"))
|
||||||
|
' else If m.Get("respuesta") = "Si" Then
|
||||||
|
q.agregaPregunta("6", "¿Cuenta con caja de salida para cobro con sistema de computo?", Array As String("Si, tiene sistema de computo para cobro", "No"))
|
||||||
|
' End If
|
||||||
|
Case "6"
|
||||||
|
Log(m.Get("respuesta"))
|
||||||
|
ToastMessageShow(m.Get("respuesta"), False)
|
||||||
|
Log(">>>>>>>>>> " & q.encuestaIniciada)
|
||||||
|
q.encuestaIniciada = False
|
||||||
|
Log(">>>>>>>>>> " & q.encuestaIniciada)
|
||||||
|
' Case 6
|
||||||
|
End Select
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
'Ajusta el tamaño del panel de scroll.
|
||||||
|
Sub ajustaTamano
|
||||||
|
' Log("xx: " & sv_clientesDatos.Panel.Height)
|
||||||
|
' Log($"${b_guardaCambios.Top} + 350"$)
|
||||||
|
If l_cuestionario.Visible Then
|
||||||
|
Log("visible")
|
||||||
|
b_guardaCambios.Top = l_cuestionario.Top + l_cuestionario.Height + 20
|
||||||
|
Else
|
||||||
|
Log("INVisible")
|
||||||
|
b_guardaCambios.Top = b_mapa2.Top + b_mapa2.Height + 20
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
p_cliente.Height = b_guardaCambios.Top + 350
|
||||||
|
sv_clientesDatos.Panel.Height = p_cliente.Height
|
||||||
|
' Log("xx: " & sv_clientesDatos.Panel.Height)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub Label9_LongClick
|
||||||
|
' Log(b_guardaCambios.Top)
|
||||||
|
If l_cuestionario.Visible Then
|
||||||
|
l_cuestionario.Visible = False
|
||||||
|
' b_guardaCambios.Top = b_mapa2.Top + b_mapa2.Height + 20
|
||||||
|
' Log($"${b_mapa2.Top} + ${b_mapa2.Height} + 20dip"$)
|
||||||
|
Else
|
||||||
|
l_cuestionario.Visible = True
|
||||||
|
' b_guardaCambios.Top = l_cuestionario.Top + l_cuestionario.Height + 20
|
||||||
|
' Log($"${l_cuestionario.Top} + ${l_cuestionario.Height} + 20"$)
|
||||||
|
End If
|
||||||
|
' Log(b_guardaCambios.Top)
|
||||||
|
ajustaTamano
|
||||||
|
End Sub
|
||||||
@@ -177,7 +177,7 @@ Sub clv_clientes_ItemClick (index As Int, Value As Object)
|
|||||||
DateTime.TimeFormat = "HH:mm:ss"
|
DateTime.TimeFormat = "HH:mm:ss"
|
||||||
Subs.guardaClienteHoraInicio(value2(0))
|
Subs.guardaClienteHoraInicio(value2(0))
|
||||||
B4XPages.MainPage.cliente.refrescarCliente = True
|
B4XPages.MainPage.cliente.refrescarCliente = True
|
||||||
Log(Value)
|
' Log(Value)
|
||||||
If Value.As(String).StartsWith("N") Then
|
If Value.As(String).StartsWith("N") Then
|
||||||
B4XPages.MainPage.nuevoCliente.cargarCliente = True
|
B4XPages.MainPage.nuevoCliente.cargarCliente = True
|
||||||
B4XPages.ShowPage("NuevoCliente")
|
B4XPages.ShowPage("NuevoCliente")
|
||||||
|
|||||||
153
B4A/C_Cuestionario.bas
Normal file
153
B4A/C_Cuestionario.bas
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
B4A=true
|
||||||
|
Group=Default Group
|
||||||
|
ModulesStructureVersion=1
|
||||||
|
Type=Class
|
||||||
|
Version=12.2
|
||||||
|
@EndOfDesignText@
|
||||||
|
Sub Class_Globals
|
||||||
|
Private Root As B4XView 'ignore
|
||||||
|
Private xui As XUI 'ignore
|
||||||
|
Private bAceptarPregunta As Button
|
||||||
|
Dim encuestaIniciada As Boolean = False
|
||||||
|
Private Root2 As B4XView
|
||||||
|
Private EventName As String 'ignore
|
||||||
|
Private CallBack As Object 'ignore
|
||||||
|
Private vPreguntaActual As String
|
||||||
|
Private db As SQL
|
||||||
|
Private clienteAnt As String = ""
|
||||||
|
Dim panelSombra As Panel 'Panel de sombra.
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
'You can add more parameters here.
|
||||||
|
Public Sub Initialize (vCallback As Object, vEventName As String, vRoot As B4XView, skmt As SQL) As Object
|
||||||
|
Root2 = vRoot
|
||||||
|
EventName = vEventName
|
||||||
|
CallBack = vCallback
|
||||||
|
db = skmt
|
||||||
|
vPreguntaActual = 0
|
||||||
|
Return Me
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
'This event will be called once, before the page becomes visible.
|
||||||
|
Private Sub B4XPage_Created (Root1 As B4XView)
|
||||||
|
Root = Root1
|
||||||
|
'load the layout to Root
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
'Regresa verdadero o falso dependiendo de si ya se inició la encuesta.
|
||||||
|
'Sub encuestaIniciada As Boolean
|
||||||
|
' Return vEncuestaIniciada
|
||||||
|
'End Sub
|
||||||
|
|
||||||
|
'Regresa el Id de la pregunta actual (read-only).
|
||||||
|
Sub preguntaActual As String 'ignore
|
||||||
|
Return vPreguntaActual
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
||||||
|
|
||||||
|
'Muestra una pregunta con sus posibles respuestas.
|
||||||
|
' La lista de respuestas puede ser directamente un array p. ej. Array As String("value1", "value2")
|
||||||
|
' Crear un Sub_Click con el nombre del evento para que reciba un mapa con la respuesta p. ej.: Sub questionario_Click
|
||||||
|
' Regresa un mapa con:
|
||||||
|
' idPregunta - El Id especificado de la pregunta.
|
||||||
|
' pregunta - El texto de la pregunta.
|
||||||
|
' idRespuesta - Un numero consecutivo empezando en 1 por cada pregunta.
|
||||||
|
' respuesta - El texto de la respuesta.
|
||||||
|
' panel - El panel del popup para poder ocultarlo al contestar la pregunta. ( p. ej.: m.Get("panel").As(Panel).Visible = false )
|
||||||
|
'###########################################
|
||||||
|
' Sub questionario_Click
|
||||||
|
' if m.get("idPregunta") = "1" ..Then .. Else con nuevas preguntas
|
||||||
|
' End Sub
|
||||||
|
'###########################################
|
||||||
|
Sub agregaPregunta(id As String, pregunta As String, respuestas As List)
|
||||||
|
encuestaIniciada = True
|
||||||
|
vPreguntaActual = id
|
||||||
|
bAceptarPregunta.Initialize("bAceptarPregunta")
|
||||||
|
|
||||||
|
Private su As StringUtils
|
||||||
|
panelSombra.Initialize("pSombra")
|
||||||
|
Private cd As ColorDrawable
|
||||||
|
cd.Initialize(Colors.ARGB(125, 98, 98, 98), 0)
|
||||||
|
panelSombra.Background = cd
|
||||||
|
Private panelX As Panel 'Panel de la pregunta.
|
||||||
|
panelX.Initialize("pQuest")
|
||||||
|
Private lbl As Label 'Etiqueta de la pregunta.
|
||||||
|
lbl.Initialize("")
|
||||||
|
lbl.Text = pregunta
|
||||||
|
lbl.TextSize = 16
|
||||||
|
lbl.TextColor = Colors.Black
|
||||||
|
cd.Initialize2(Colors.white, 20, 1, Colors.Gray) 'Borde y esquinas redondeadas del panel de la pregunta.
|
||||||
|
panelX.Background = cd
|
||||||
|
panelSombra.AddView(panelX, 10dip, 0dip, 80%x, 200dip)
|
||||||
|
Root2.AddView(panelSombra, 0, 0, 100%x, 100%y) 'add the panel to the layout
|
||||||
|
panelX.AddView(lbl, 20dip, 20dip, (panelX.Width * 0.9), 40dip) 'Agregamos la etiqueta al panel.
|
||||||
|
lbl.Height = su.MeasureMultilineTextHeight(lbl, lbl.Text)
|
||||||
|
Private r(respuestas.Size) As RadioButton
|
||||||
|
For p = 0 To respuestas.Size - 1
|
||||||
|
r(p).Initialize("r")
|
||||||
|
r(p).Text = respuestas.Get(p)
|
||||||
|
r(p).Tag = CreateMap("id":id, "pregunta":pregunta, "panel":panelSombra, "idRespuesta":p + 1)
|
||||||
|
panelX.AddView(r(p), 10dip, (70 * (p + 1)), (panelX.Width * 0.9), 10) 'Agegamos el radio al panel.
|
||||||
|
r(p).Height = su.MeasureMultilineTextHeight(r(p), r(p).Text) + 25 'Calculamos el alto del radio de acuerdo al largo del texto.
|
||||||
|
Private newTop As Int = lbl.top + lbl.Height + 10 'Si es el primer radio, lo ponemos en top = alto de la "pregunta" + 10.
|
||||||
|
If p <> 0 Then newTop = r(p - 1).Top + r(p - 1).Height + 5 'Calculamos el Top del radio de acuerdo al top y alto del radio anterior.
|
||||||
|
r(p).Top = newTop
|
||||||
|
Next
|
||||||
|
r(0).Checked = True
|
||||||
|
bAceptarPregunta.Text = "Continuar"
|
||||||
|
panelX.AddView(bAceptarPregunta, 10, newTop + r(respuestas.Size - 1).Height + 20, 150dip, 50dip) 'Ponemos el boton de continuar despues del ultimo radio.
|
||||||
|
bAceptarPregunta.Left = (panelX.Width / 2) - (bAceptarPregunta.Width / 2)
|
||||||
|
panelX.Height = bAceptarPregunta.Top + bAceptarPregunta.Height + 15dip 'Calculamos el alto del panel de acuerdo al Top del boton.
|
||||||
|
panelX.left = (Root2.Width / 2) - (panelX.Width / 2)
|
||||||
|
panelX.top = (Root2.Height / 3) - (panelX.Height / 2)
|
||||||
|
panelSombra.Width = Root2.Width
|
||||||
|
panelSombra.Height = Root2.Height
|
||||||
|
panelSombra.BringToFront
|
||||||
|
' panelSombra.Elevation = 0
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
private Sub preguntaContestada(Success As Map) 'ignore
|
||||||
|
If SubExists(CallBack, EventName & "_preguntaContestada") Then
|
||||||
|
CallSubDelayed2(CallBack, EventName & "_preguntaContestada", Success)
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
private Sub pSombra_Click
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
private Sub r_CheckedChange(Checked As Boolean)
|
||||||
|
bAceptarPregunta.tag = CreateMap("idPregunta":Sender.As(RadioButton).tag.As(Map).Get("id").As(String), "pregunta":Sender.As(RadioButton).tag.As(Map).Get("pregunta"), "idRespuesta":Sender.As(RadioButton).tag.As(Map).Get("idRespuesta").As(String), "respuesta":Sender.As(RadioButton).text, "panel":Sender.As(RadioButton).tag.As(Map).Get("panel"))
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub bAceptarPregunta_Click
|
||||||
|
encuestaIniciada = True
|
||||||
|
Private m As Map = Sender.As(Button).tag.As(Map) 'Recibimos el id de la pregunta, el id de la respuesta, el texto de la respuesta y el objeto del panelSombra para poder ocultarlo.
|
||||||
|
preguntaContestada(m)
|
||||||
|
'' m.Get("panel").As(Panel).Visible = False 'Ocultamos el panel de la pregunta.
|
||||||
|
' m.Get("panel").As(Panel).RemoveView
|
||||||
|
' If m.Get("idPregunta") = "1" And m.Get("respuesta") = "No, está enrejado o no se tiene acceso" Then
|
||||||
|
' Log("Tiendajon / Ventana / Kiosko")
|
||||||
|
' else If m.Get("idPregunta") = "1" And m.Get("respuesta") = "Si se pude acceder" Then
|
||||||
|
' agregaPregunta("2", "¿Tiene al menos 2 pasillos con acceso directo a la mercancía?", Array As String("Si tiene al menos 2 pasillos con acceso directo a la mercancía", "No tiene pasillos o solo uno central"))
|
||||||
|
' End If
|
||||||
|
' If m.Get("idPregunta") = "2" And m.Get("respuesta") = "Si tiene al menos 2 pasillos con acceso directo a la mercancía" Then
|
||||||
|
' Log("Mini-Super")
|
||||||
|
' else If m.Get("idPregunta") = "2" And m.Get("respuesta") = "No tiene pasillos o solo uno central" Then
|
||||||
|
' agregaPregunta("3", "¿Cuenta con enfriador horizontal para venta de perecederos como queso, jamon, crema, etc.?", Array As String("Si", "No tiene enfriador horizontal. ¿El local esta enfocado a venta especializada?"))
|
||||||
|
' End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
'Regresa verdadero si el cliente dado tiene cuestionario contestado.
|
||||||
|
Sub clienteConEncuesta(idCliente As String) As Boolean 'ignore
|
||||||
|
Private r As Boolean = False
|
||||||
|
Private c As Cursor = db.ExecQuery($"select count(*) as q from CUESTIONARIO where Q_IDCLIENTE = '${idCliente}'"$)
|
||||||
|
c.Position = 0
|
||||||
|
If c.GetInt("q") > 0 Then r = True
|
||||||
|
Return r
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
'Oculta el anel de la pregunta.
|
||||||
|
Sub ocultPanelPregunta
|
||||||
|
If panelSombra.IsInitialized Then panelSombra.RemoveView
|
||||||
|
End Sub
|
||||||
@@ -51,6 +51,9 @@ Sub Class_Globals
|
|||||||
Dim elOtroCliente As String = ""
|
Dim elOtroCliente As String = ""
|
||||||
Dim camposModificados As List
|
Dim camposModificados As List
|
||||||
Dim mandarTodo As Boolean = False
|
Dim mandarTodo As Boolean = False
|
||||||
|
Private et_atiende As EditText
|
||||||
|
Private et_telefono As EditText
|
||||||
|
Private et_email As EditText
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
'You can add more parameters here.
|
'You can add more parameters here.
|
||||||
@@ -149,6 +152,9 @@ Sub CANCELA_Click
|
|||||||
fototomada = ""
|
fototomada = ""
|
||||||
et_nombre.Text = ""
|
et_nombre.Text = ""
|
||||||
et_direccion.Text = ""
|
et_direccion.Text = ""
|
||||||
|
et_atiende.Text = ""
|
||||||
|
et_telefono.Text = ""
|
||||||
|
et_email.Text = ""
|
||||||
CallSubDelayed(Tracker, "StartFLP")
|
CallSubDelayed(Tracker, "StartFLP")
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -188,7 +194,7 @@ Sub b_guardar_Click
|
|||||||
CAT_CL_LAT = '${B4XPages.MainPage.lat_gps}', CAT_CL_LONG = '${B4XPages.MainPage.lon_gps}', CAT_CL_GIRO = '${cb_giro.SelectedItem}', CAT_CL_NOMBRE = '${Subs.escapeSQLString(et_nombre.Text)}', CAT_CL_CALLE1 = '${Subs.escapeSQLString(et_direccion.text)}', CAT_CL_ENVIO_PENDIENTE = 1,
|
CAT_CL_LAT = '${B4XPages.MainPage.lat_gps}', CAT_CL_LONG = '${B4XPages.MainPage.lon_gps}', CAT_CL_GIRO = '${cb_giro.SelectedItem}', CAT_CL_NOMBRE = '${Subs.escapeSQLString(et_nombre.Text)}', CAT_CL_CALLE1 = '${Subs.escapeSQLString(et_direccion.text)}', CAT_CL_ENVIO_PENDIENTE = 1,
|
||||||
LAT_CENSADOR = '${B4XPages.MainPage.lat_gps}', LON_CENSADOR = '${B4XPages.MainPage.lon_gps}', CAMPOS_MODIFICADOS = '${Subs.list2string(camposModificados)}' where CAT_CL_CODIGO In (select cuenta from cuentaa)"$)
|
LAT_CENSADOR = '${B4XPages.MainPage.lat_gps}', LON_CENSADOR = '${B4XPages.MainPage.lon_gps}', CAMPOS_MODIFICADOS = '${Subs.list2string(camposModificados)}' where CAT_CL_CODIGO In (select cuenta from cuentaa)"$)
|
||||||
Else
|
Else
|
||||||
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO kmt_info(CAT_CL_CODIGO, CAT_CL_RUTA, CAT_CL_NOMBRE, CAT_CL_CALLE1, CAT_CL_LAT, CAT_CL_LONG, CAT_CL_FECHA_CAPTURA, CAT_CL_DIAS_VISITA, LAT_CENSADOR, LON_CENSADOR, CAT_CL_ENVIO_PENDIENTE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1) ", Array As Object (no_cliente, no_ruta, et_nombre.Text, et_direccion.Text, B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps, DateNC, Starter.dia_semana, B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps))
|
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO kmt_info(CAT_CL_CODIGO, CAT_CL_RUTA, CAT_CL_NOMBRE, CAT_CL_CALLE1, CAT_CL_LAT, CAT_CL_LONG, CAT_CL_FECHA_CAPTURA, CAT_CL_DIAS_VISITA, LAT_CENSADOR, LON_CENSADOR, CAT_CL_ENVIO_PENDIENTE, CAT_CL_TELEFONO, CAT_CL_ATIENDE1, CAT_CL_EMAIL) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?, ?, ?) ", Array As Object (no_cliente, no_ruta, et_nombre.Text, et_direccion.Text, B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps, DateNC, Starter.dia_semana, B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps, et_atiende.Text, et_telefono.Text, et_email.Text))
|
||||||
End If
|
End If
|
||||||
B4XPages.MainPage.skmt.ExecNonQuery("delete from CUENTAA")
|
B4XPages.MainPage.skmt.ExecNonQuery("delete from CUENTAA")
|
||||||
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO CUENTAA VALUES (?)", Array As Object(no_cliente))
|
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO CUENTAA VALUES (?)", Array As Object(no_cliente))
|
||||||
|
|||||||
153
B4A/C_Questionario.bas
Normal file
153
B4A/C_Questionario.bas
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
B4A=true
|
||||||
|
Group=Default Group
|
||||||
|
ModulesStructureVersion=1
|
||||||
|
Type=Class
|
||||||
|
Version=12.2
|
||||||
|
@EndOfDesignText@
|
||||||
|
Sub Class_Globals
|
||||||
|
Private Root As B4XView 'ignore
|
||||||
|
Private xui As XUI 'ignore
|
||||||
|
Private bAceptarPregunta As Button
|
||||||
|
Dim encuestaIniciada As Boolean = False
|
||||||
|
Private Root2 As B4XView
|
||||||
|
Private EventName As String 'ignore
|
||||||
|
Private CallBack As Object 'ignore
|
||||||
|
Private vPreguntaActual As String
|
||||||
|
Private db As SQL
|
||||||
|
Private clienteAnt As String = ""
|
||||||
|
Dim panelSombra As Panel 'Panel de sombra.
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
'You can add more parameters here.
|
||||||
|
Public Sub Initialize (vCallback As Object, vEventName As String, vRoot As B4XView, skmt As SQL) As Object
|
||||||
|
Root2 = vRoot
|
||||||
|
EventName = vEventName
|
||||||
|
CallBack = vCallback
|
||||||
|
db = skmt
|
||||||
|
vPreguntaActual = 0
|
||||||
|
Return Me
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
'This event will be called once, before the page becomes visible.
|
||||||
|
Private Sub B4XPage_Created (Root1 As B4XView)
|
||||||
|
Root = Root1
|
||||||
|
'load the layout to Root
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
'Regresa verdadero o falso dependiendo de si ya se inició la encuesta.
|
||||||
|
'Sub encuestaIniciada As Boolean
|
||||||
|
' Return vEncuestaIniciada
|
||||||
|
'End Sub
|
||||||
|
|
||||||
|
'Regresa el Id de la pregunta actual (read-only).
|
||||||
|
Sub preguntaActual As String 'ignore
|
||||||
|
Return vPreguntaActual
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
||||||
|
|
||||||
|
'Muestra una pregunta con sus posibles respuestas.
|
||||||
|
' La lista de respuestas puede ser directamente un array p. ej. Array As String("value1", "value2")
|
||||||
|
' Crear un Sub_Click con el nombre del evento para que reciba un mapa con la respuesta p. ej.: Sub questionario_Click
|
||||||
|
' Regresa un mapa con:
|
||||||
|
' idPregunta - El Id especificado de la pregunta.
|
||||||
|
' pregunta - El texto de la pregunta.
|
||||||
|
' idRespuesta - Un numero consecutivo empezando en 1 por cada pregunta.
|
||||||
|
' respuesta - El texto de la respuesta.
|
||||||
|
' panel - El panel del popup para poder ocultarlo al contestar la pregunta. ( p. ej.: m.Get("panel").As(Panel).Visible = false )
|
||||||
|
'###########################################
|
||||||
|
' Sub questionario_Click
|
||||||
|
' if m.get("idPregunta") = "1" ..Then .. Else con nuevas preguntas
|
||||||
|
' End Sub
|
||||||
|
'###########################################
|
||||||
|
Sub agregaPregunta(id As String, pregunta As String, respuestas As List)
|
||||||
|
encuestaIniciada = True
|
||||||
|
vPreguntaActual = id
|
||||||
|
bAceptarPregunta.Initialize("bAceptarPregunta")
|
||||||
|
|
||||||
|
Private su As StringUtils
|
||||||
|
panelSombra.Initialize("pSombra")
|
||||||
|
Private cd As ColorDrawable
|
||||||
|
cd.Initialize(Colors.ARGB(125, 98, 98, 98), 0)
|
||||||
|
panelSombra.Background = cd
|
||||||
|
Private panelX As Panel 'Panel de la pregunta.
|
||||||
|
panelX.Initialize("pQuest")
|
||||||
|
Private lbl As Label 'Etiqueta de la pregunta.
|
||||||
|
lbl.Initialize("")
|
||||||
|
lbl.Text = pregunta
|
||||||
|
lbl.TextSize = 16
|
||||||
|
lbl.TextColor = Colors.Black
|
||||||
|
cd.Initialize2(Colors.white, 20, 1, Colors.Gray) 'Borde y esquinas redondeadas del panel de la pregunta.
|
||||||
|
panelX.Background = cd
|
||||||
|
panelSombra.AddView(panelX, 10dip, 0dip, 80%x, 200dip)
|
||||||
|
Root2.AddView(panelSombra, 0, 0, 100%x, 100%y) 'add the panel to the layout
|
||||||
|
panelX.AddView(lbl, 20dip, 20dip, (panelX.Width * 0.9), 40dip) 'Agregamos la etiqueta al panel.
|
||||||
|
lbl.Height = su.MeasureMultilineTextHeight(lbl, lbl.Text)
|
||||||
|
Private r(respuestas.Size) As RadioButton
|
||||||
|
For p = 0 To respuestas.Size - 1
|
||||||
|
r(p).Initialize("r")
|
||||||
|
r(p).Text = respuestas.Get(p)
|
||||||
|
r(p).Tag = CreateMap("id":id, "pregunta":pregunta, "panel":panelSombra, "idRespuesta":p + 1)
|
||||||
|
panelX.AddView(r(p), 10dip, (70 * (p + 1)), (panelX.Width * 0.9), 10) 'Agegamos el radio al panel.
|
||||||
|
r(p).Height = su.MeasureMultilineTextHeight(r(p), r(p).Text) + 25 'Calculamos el alto del radio de acuerdo al largo del texto.
|
||||||
|
Private newTop As Int = lbl.top + lbl.Height + 10 'Si es el primer radio, lo ponemos en top = alto de la "pregunta" + 10.
|
||||||
|
If p <> 0 Then newTop = r(p - 1).Top + r(p - 1).Height + 5 'Calculamos el Top del radio de acuerdo al top y alto del radio anterior.
|
||||||
|
r(p).Top = newTop
|
||||||
|
Next
|
||||||
|
r(0).Checked = True
|
||||||
|
bAceptarPregunta.Text = "Continuar"
|
||||||
|
panelX.AddView(bAceptarPregunta, 10, newTop + r(respuestas.Size - 1).Height + 20, 150dip, 50dip) 'Ponemos el boton de continuar despues del ultimo radio.
|
||||||
|
bAceptarPregunta.Left = (panelX.Width / 2) - (bAceptarPregunta.Width / 2)
|
||||||
|
panelX.Height = bAceptarPregunta.Top + bAceptarPregunta.Height + 15dip 'Calculamos el alto del panel de acuerdo al Top del boton.
|
||||||
|
panelX.left = (Root2.Width / 2) - (panelX.Width / 2)
|
||||||
|
panelX.top = (Root2.Height / 3) - (panelX.Height / 2)
|
||||||
|
panelSombra.Width = Root2.Width
|
||||||
|
panelSombra.Height = Root2.Height
|
||||||
|
panelSombra.BringToFront
|
||||||
|
' panelSombra.Elevation = 0
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
private Sub preguntaContestada(Success As Map) 'ignore
|
||||||
|
If SubExists(CallBack, EventName & "_preguntaContestada") Then
|
||||||
|
CallSubDelayed2(CallBack, EventName & "_preguntaContestada", Success)
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
private Sub pSombra_Click
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
private Sub r_CheckedChange(Checked As Boolean)
|
||||||
|
bAceptarPregunta.tag = CreateMap("idPregunta":Sender.As(RadioButton).tag.As(Map).Get("id").As(String), "pregunta":Sender.As(RadioButton).tag.As(Map).Get("pregunta"), "idRespuesta":Sender.As(RadioButton).tag.As(Map).Get("idRespuesta").As(String), "respuesta":Sender.As(RadioButton).text, "panel":Sender.As(RadioButton).tag.As(Map).Get("panel"))
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub bAceptarPregunta_Click
|
||||||
|
encuestaIniciada = True
|
||||||
|
Private m As Map = Sender.As(Button).tag.As(Map) 'Recibimos el id de la pregunta, el id de la respuesta, el texto de la respuesta y el objeto del panelSombra para poder ocultarlo.
|
||||||
|
preguntaContestada(m)
|
||||||
|
'' m.Get("panel").As(Panel).Visible = False 'Ocultamos el panel de la pregunta.
|
||||||
|
' m.Get("panel").As(Panel).RemoveView
|
||||||
|
' If m.Get("idPregunta") = "1" And m.Get("respuesta") = "No, está enrejado o no se tiene acceso" Then
|
||||||
|
' Log("Tiendajon / Ventana / Kiosko")
|
||||||
|
' else If m.Get("idPregunta") = "1" And m.Get("respuesta") = "Si se pude acceder" Then
|
||||||
|
' agregaPregunta("2", "¿Tiene al menos 2 pasillos con acceso directo a la mercancía?", Array As String("Si tiene al menos 2 pasillos con acceso directo a la mercancía", "No tiene pasillos o solo uno central"))
|
||||||
|
' End If
|
||||||
|
' If m.Get("idPregunta") = "2" And m.Get("respuesta") = "Si tiene al menos 2 pasillos con acceso directo a la mercancía" Then
|
||||||
|
' Log("Mini-Super")
|
||||||
|
' else If m.Get("idPregunta") = "2" And m.Get("respuesta") = "No tiene pasillos o solo uno central" Then
|
||||||
|
' agregaPregunta("3", "¿Cuenta con enfriador horizontal para venta de perecederos como queso, jamon, crema, etc.?", Array As String("Si", "No tiene enfriador horizontal. ¿El local esta enfocado a venta especializada?"))
|
||||||
|
' End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
'Regresa verdadero si el cliente dado tiene cuestionario contestado.
|
||||||
|
Sub clienteConEncuesta(idCliente As String) As Boolean 'ignore
|
||||||
|
Private r As Boolean = False
|
||||||
|
Private c As Cursor = db.ExecQuery($"select count(*) as q from QUESTIONARIO where Q_IDCLIENTE = '${idCliente}'"$)
|
||||||
|
c.Position = 0
|
||||||
|
If c.GetInt("q") > 0 Then r = True
|
||||||
|
Return r
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
'Oculta el anel de la pregunta.
|
||||||
|
Sub ocultPanelPregunta
|
||||||
|
If panelSombra.IsInitialized Then panelSombra.RemoveView
|
||||||
|
End Sub
|
||||||
Binary file not shown.
BIN
B4A/Files/clientedatos.bal
Normal file
BIN
B4A/Files/clientedatos.bal
Normal file
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -6,6 +6,7 @@ ModuleBookmarks12=
|
|||||||
ModuleBookmarks13=
|
ModuleBookmarks13=
|
||||||
ModuleBookmarks14=
|
ModuleBookmarks14=
|
||||||
ModuleBookmarks15=
|
ModuleBookmarks15=
|
||||||
|
ModuleBookmarks16=
|
||||||
ModuleBookmarks2=
|
ModuleBookmarks2=
|
||||||
ModuleBookmarks3=
|
ModuleBookmarks3=
|
||||||
ModuleBookmarks4=
|
ModuleBookmarks4=
|
||||||
@@ -22,6 +23,7 @@ ModuleBreakpoints12=
|
|||||||
ModuleBreakpoints13=
|
ModuleBreakpoints13=
|
||||||
ModuleBreakpoints14=
|
ModuleBreakpoints14=
|
||||||
ModuleBreakpoints15=
|
ModuleBreakpoints15=
|
||||||
|
ModuleBreakpoints16=
|
||||||
ModuleBreakpoints2=
|
ModuleBreakpoints2=
|
||||||
ModuleBreakpoints3=
|
ModuleBreakpoints3=
|
||||||
ModuleBreakpoints4=
|
ModuleBreakpoints4=
|
||||||
@@ -34,18 +36,19 @@ ModuleClosedNodes0=
|
|||||||
ModuleClosedNodes1=
|
ModuleClosedNodes1=
|
||||||
ModuleClosedNodes10=
|
ModuleClosedNodes10=
|
||||||
ModuleClosedNodes11=
|
ModuleClosedNodes11=
|
||||||
ModuleClosedNodes12=3,5
|
ModuleClosedNodes12=
|
||||||
ModuleClosedNodes13=
|
ModuleClosedNodes13=3,5
|
||||||
ModuleClosedNodes14=63,64,65,67,68
|
ModuleClosedNodes14=
|
||||||
ModuleClosedNodes15=9,10,11,13,17,18,19
|
ModuleClosedNodes15=63,64,65,67,68
|
||||||
ModuleClosedNodes2=2,3,8,9,10,11,12,13,14,15,16,17,18,21,22
|
ModuleClosedNodes16=4,5,6,10,13,17,18,19
|
||||||
|
ModuleClosedNodes2=
|
||||||
ModuleClosedNodes3=
|
ModuleClosedNodes3=
|
||||||
ModuleClosedNodes4=8,10,11,14,16,17,18,19,20,21,22,23,24,25,26,27,28
|
ModuleClosedNodes4=6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,44
|
||||||
ModuleClosedNodes5=4,8,10,11,12,13
|
ModuleClosedNodes5=
|
||||||
ModuleClosedNodes6=
|
ModuleClosedNodes6=
|
||||||
ModuleClosedNodes7=6,9,11,12,13,14,16,17,18
|
ModuleClosedNodes7=
|
||||||
ModuleClosedNodes8=3
|
ModuleClosedNodes8=6,9,11,12,13,14,16,17,18
|
||||||
ModuleClosedNodes9=
|
ModuleClosedNodes9=3
|
||||||
NavigationStack=C_Cliente,JobDone,382,0,C_Cliente,mandaPendientes,378,0,B4XMainPage,JobDone,353,0,C_Principal,e_ruta_EnterPressed,946,3,B4XMainPage,B4XPage_Created,98,0,C_Clientes,Mods,0,0,C_Clientes,clv_clientes_ItemClick,174,0,C_Mapas,Class_Globals,0,0,MAPA_RUTAS,MapFragment1_Ready,249,0,MAPA_RUTAS,OnInfoWindowClickListener1_click,253,2
|
NavigationStack=C_Cliente,q_preguntaContestada,688,6,B4XMainPage,B4XPage_Created,144,0,C_Cuestionario,clienteConEncuesta,137,0,C_Cliente,Label9_LongClick,763,6,C_Cliente,ajustaTamano,745,6,C_Cuestionario,ocultPanelPregunta,144,0,C_Cuestionario,agregaPregunta,78,0,C_Cliente,B4XPage_Appear,270,6,Visual Designer,clienteDatos.bal,-100,4,C_Cliente,Class_Globals,156,0
|
||||||
SelectedBuild=0
|
SelectedBuild=0
|
||||||
VisibleModules=2,13,8,4,5,14,7,11,15,6,12
|
VisibleModules=2,14,6,9,4,5,15,8,7,16
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ Sub Process_Globals
|
|||||||
Public FLP As FusedLocationProvider
|
Public FLP As FusedLocationProvider
|
||||||
' Private flpStarted As Boolean
|
' Private flpStarted As Boolean
|
||||||
Dim reqManager As DBRequestManager
|
Dim reqManager As DBRequestManager
|
||||||
Dim server As String = "http://187.189.244.154:1782"
|
Dim server As String = "http://187.189.244.154:1781"
|
||||||
' Dim server As String = "http://187.189.244.154:1783"
|
' Dim server As String = "http://187.189.244.154:1783"
|
||||||
' Dim server As String = "http://10.0.0.205:1782"
|
' Dim server As String = "http://10.0.0.205:1782"
|
||||||
' Dim server As String = "http://11.0.0.231:1782"
|
' Dim server As String = "http://11.0.0.231:1782"
|
||||||
|
|||||||
@@ -76,13 +76,14 @@ Public Sub Track
|
|||||||
If Not(FLP.IsInitialized) Then FLP.Initialize("flp")
|
If Not(FLP.IsInitialized) Then FLP.Initialize("flp")
|
||||||
If Not(FLP.IsConnected) Then FLP.Connect
|
If Not(FLP.IsConnected) Then FLP.Connect
|
||||||
If Tracking And actualLR.IsInitialized Then
|
If Tracking And actualLR.IsInitialized Then
|
||||||
' Log(actualLR.GetSmallestDisplacement)
|
' Log("Smallest Displacement: " & actualLR.GetSmallestDisplacement)
|
||||||
Return 'Si ya estamos "rastreando" no hacemos nada (return)
|
Return 'Si ya estamos "rastreando" no hacemos nada (return)
|
||||||
End If
|
End If
|
||||||
If Starter.rp.Check(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION) = False Then
|
If Starter.rp.Check(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION) = False Then
|
||||||
Log("Sin permisos de ubicacion")
|
Log("Sin permisos de ubicacion")
|
||||||
Return
|
Return
|
||||||
Else
|
Else
|
||||||
|
' Log("Iniciamos StartFLP")
|
||||||
StartFLP 'Iniciamos FusedLocationProvider
|
StartFLP 'Iniciamos FusedLocationProvider
|
||||||
Tracking = True
|
Tracking = True
|
||||||
End If
|
End If
|
||||||
@@ -109,7 +110,7 @@ Public Sub StartFLPSmall
|
|||||||
Sleep(500)
|
Sleep(500)
|
||||||
Log("sleeping")
|
Log("sleeping")
|
||||||
Loop
|
Loop
|
||||||
dameUltimaUbicacionConocida 'Regresamos ultima ubicacion conocida
|
' dameUltimaUbicacionConocida 'Regresamos ultima ubicacion conocida
|
||||||
FLP.RequestLocationUpdates(CreateLocationRequestSmallD) 'Buscamos ubicacion 2 peticiones
|
FLP.RequestLocationUpdates(CreateLocationRequestSmallD) 'Buscamos ubicacion 2 peticiones
|
||||||
' Log("Buscamos ubicacion Small displacement")
|
' Log("Buscamos ubicacion Small displacement")
|
||||||
' Log("GPSSmallestDisplacement = " & actualLR.GetSmallestDisplacement)
|
' Log("GPSSmallestDisplacement = " & actualLR.GetSmallestDisplacement)
|
||||||
|
|||||||
Reference in New Issue
Block a user