- Se agregó el cuestionario (en duro) para Pedigree.

This commit is contained in:
Jose Alberto Guerra Ugalde
2024-06-12 00:43:40 -06:00
parent ff1e2fae86
commit 38c779d01d
6 changed files with 516 additions and 46 deletions

View File

@@ -8,7 +8,7 @@ Sub Class_Globals
Private Root As B4XView 'ignore
Private xui As XUI 'ignore
Private p_cliente As Panel
Dim cuest As C_Cuestionario
Dim g As GPS
Dim ruta As String
Dim skmt As SQL
@@ -459,6 +459,7 @@ Private Sub B4XPage_Created (Root1 As B4XView)
p_pregunta1.Width = Root.Height
Tels.Visible = False
gest.Visible = False
cuest.Initialize(Me, "cuest", Root, B4XPages.MainPage.skmt)
End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
@@ -930,6 +931,13 @@ End Sub
Sub gest_Click
' If ALMACEN = "4" Or ALMACEN = "36" Then
' Log(Subs.traeAlmacen)
Log($"${cuest.encuestaIniciada} - ${cuest.clienteConCuestionario(Subs.traeCliente)}"$)
If Not(cuest.encuestaIniciada) And Not(cuest.clienteConCuestionario(Subs.traeCliente)) Then
cuest.agregaPreguntaCheckbox("1", "¿Qué productos de Kileo Perro encuentras en esta tienda?", Array As String("Pedigree Adulto", "Pedigree Cachorro", "Pedigree Razas Pequeñas", "Champ", "PAL","DOG CHOW ADULTO","DOG CHOW CACHORRO","DOG CHOW RAZAS PEQUEÑAS","Campeon","Ganador","Poder canino","Perron","Silverkan","Woow","Chapetes","Dyno","Beriscan","Nogacan","Nutrescan","Fidus","Amigo Gourmet","Otros","Ninguno de los anteriores"))
Return False
End If
If TOMAR_FOTO = 0 Then
Cuestionario
Else
@@ -1643,6 +1651,8 @@ End Sub
Private Sub B4XPage_CloseRequest As ResumableSub
' BACK key pressed
' Return True To close, False To cancel
cuest.encuestaIniciada = False
cuest.ocultPanelPregunta
If p_encuesta.Visible Then
p_encuesta.Visible = False
else If p_pregunta1.Visible Then
@@ -3712,7 +3722,6 @@ Private Sub CB4_P8_M3_CheckedChange(Checked As Boolean)
Log(textemp8)
End Sub
'Esta subrutina muestra las encuestas.
Sub Cuestionario
Log("Entramos a Cuestionario")
@@ -4029,4 +4038,56 @@ End Sub
Private Sub p_encuesta_Click
End Sub
Sub cuest_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 = "dd/MM/yyyy"
DateTime.TimeFormat = "HH:mm:ss"
B4XPages.MainPage.skmt.ExecNonQuery($"delete from CUESTIONARIO where Q_IDCLIENTE = '${Subs.traeCliente}' and Q_IDPREGUNTA = '${m.Get("idPregunta")}'"$)
B4XPages.MainPage.skmt.ExecNonQuery($"insert into CUESTIONARIO (Q_RUTA, Q_ALMACEN, Q_IDCLIENTE, Q_IDPREGUNTA, Q_PREGUNTA, Q_IDRESPUESTA, Q_RESPUESTA, Q_FECHA) values ('${Subs.traeRuta}', '${Subs.traeAlmacen}', '${Subs.traeCliente}', '${m.Get("idPregunta")}', '${m.Get("pregunta")}', '${m.Get("idRespuesta")}', '${m.Get("respuesta")}', '${DateTime.Date(DateTime.now)} ${DateTime.time(DateTime.now)}')"$)
Log(">> RESP: " & m.Get("respuesta"))
Select Case m.Get("idPregunta")
Case "1"
If m.Get("respuesta") = "Ninguno de los anteriores" Then
' Log("Ninguno de los anteriores")
' ToastMessageShow("Ninguno de los anteriores", False)
cuest.agregaPreguntaCheckbox("3", "¿Qué productos de Kileo Gato encuentras en esta tienda?", Array As String("Whiskas","KITEKAT","PAL GATO","CAT CHOW","GATINA","MININO","MI MISHI","Ninguno de los anteriores"))
Else
' Log(m.Get("idRespuesta"))
cuest.agregaPreguntaAbierta("2", "Captura el precio por kilo de los articulos seleccionados anteriormente", cuest.strToList(m.Get("idRespuesta")), cuest.strToList(m.Get("respuesta")))
End If
Case "2"
' Log(m.Get("respuesta"))
cuest.agregaPreguntaCheckbox("3", "¿Qué productos de Kileo Gato encuentras en esta tienda?", Array As String("Whiskas","KITEKAT","PAL GATO","CAT CHOW","GATINA","MININO","MI MISHI","Ninguno de los anteriores"))
Case "3"
' Log(m.Get("respuesta"))
If m.Get("respuesta") = "Ninguno de los anteriores" Then
' Log("Ninguno de los anteriores")
' ToastMessageShow("Ninguno de los anteriores", False)
cuest.agregaPreguntaCheckbox("5", "¿Qué productos de húmedo MARS encuentras en esta tienda?", Array As String("Pedigree Adulto res","Pedigree Adulto Pollo","Pedigree Cachorro res","Pedigree Cachorro Pollo","Pedigree Raz Peq res","Pedigree Raz Peq Pollo","Pedigree Adulto Cordero","Pedigree Adulto Lata res","Whiskas Atún","Whiskas Pollo","Whiskas res","Whiskas Salmón","Whiskas Parrillada Mixta","Whiskas Pescado BLANCO","Whiskas Souffle","Ninguno de los anteriores"))
Else
cuest.agregaPreguntaAbierta("4", "Captura el precio por kilo de los articulos seleccionados anteriormente", cuest.strToList(m.Get("idRespuesta")), cuest.strToList(m.Get("respuesta")))
End If
Case "4"
cuest.agregaPreguntaCheckbox("5", "¿Qué productos de húmedo MARS encuentras en esta tienda?", Array As String("Pedigree Adulto res","Pedigree Adulto Pollo","Pedigree Cachorro res","Pedigree Cachorro Pollo","Pedigree Raz Peq res","Pedigree Raz Peq Pollo","Pedigree Adulto Cordero","Pedigree Adulto Lata res","Whiskas Atún","Whiskas Pollo","Whiskas res","Whiskas Salmón","Whiskas Parrillada Mixta","Whiskas Pescado BLANCO","Whiskas Souffle","Ninguno de los anteriores"))
Case "5"
cuest.agregaPreguntaCheckbox("6", "¿Qué productos de húmedo otros encuentras en esta tienda?", Array As String("Dog Chow (cualquier sabor)","Ganador (cualquier sabor)","Felix (cualquier sabor)","Minino plus (cualquier sabor)","Cat Chow (cualquier sabor)","Beneful (cualquier sabor)","Amigo Gourmet (cualquier sabor)","Ninguno de los anteriores"))
Case "6"
cuest.agregaPreguntaCheckbox("7", "¿Qué productos de botanas encuentras en esta tienda?", Array As String("Dentastix","Biscrok","Ninguno de los anteriores"))
Case "7"
' Log(m.Get("respuesta"))
ToastMessageShow(m.Get("respuesta"), False)
Log(">>>>>>>>>> " & cuest.encuestaIniciada)
cuest.encuestaIniciada = False
Log(">>>>>>>>>> " & cuest.encuestaIniciada)
' refrescarCliente = True
' Log($"#### REFRESCAR CLIENTE -> ${refrescarCliente}"$)
B4XPage_Appear
' Case 6
End Select
End Sub