mirror of
https://github.com/KeymonSoft/Guna_Preventa.git
synced 2026-04-17 21:06:32 +00:00
- Se agregó el cuestionario (en duro) para Pedigree.
This commit is contained in:
@@ -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
|
||||
395
B4A/C_Cuestionario.bas
Normal file
395
B4A/C_Cuestionario.bas
Normal file
@@ -0,0 +1,395 @@
|
||||
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.
|
||||
Dim cb_respuestas As String = ""
|
||||
Dim panelActual As Panel
|
||||
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
|
||||
db.ExecNonQuery("CREATE TABLE IF NOT EXISTS CUESTIONARIO (Q_RUTA TEXT, Q_ALMACEN TEXT, Q_IDCLIENTE TEXT, Q_IDPREGUNTA TEXT, Q_PREGUNTA TEXT, Q_IDRESPUESTA TEXT, Q_RESPUESTA TEXT, Q_FECHA TEXT, Q_ENVIO_OK INTEGER DEFAULT 0)")
|
||||
agregaColumna("CUESTIONARIO", "Q_RUTA", "TEXT")
|
||||
agregaColumna("CUESTIONARIO", "Q_ALMACEN", "TEXT")
|
||||
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 agregaPreguntaCheckbox(id As String, pregunta As String, respuestas As List) 'ignore
|
||||
encuestaIniciada = True
|
||||
vPreguntaActual = id
|
||||
bAceptarPregunta.Initialize("bAceptarPregunta")
|
||||
bAceptarPregunta.Enabled = False
|
||||
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")
|
||||
panelActual = panelX
|
||||
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 cb(respuestas.Size) As CheckBox
|
||||
For p = 0 To respuestas.Size - 1
|
||||
cb(p).Initialize("cb")
|
||||
cb(p).Text = respuestas.Get(p)
|
||||
cb(p).Tag = CreateMap("id":id, "pregunta":pregunta, "panel":panelSombra, "idRespuesta":p + 1)
|
||||
panelX.AddView(cb(p), 10dip, (70 * (p + 1)), (panelX.Width * 0.9), 10) 'Agegamos el radio al panel.
|
||||
cb(p).Height = su.MeasureMultilineTextHeight(cb(p), cb(p).Text) + 1 '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 =cb(p - 1).Top + cb(p - 1).Height + 10 'Calculamos el Top del radio de acuerdo al top y alto del radio anterior.
|
||||
cb(p).Top = newTop
|
||||
Next
|
||||
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.
|
||||
panelX.AddView(bAceptarPregunta, 10, newTop + cb(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 / 3)
|
||||
panelSombra.Width = Root2.Width
|
||||
panelSombra.Height = Root2.Height
|
||||
panelSombra.Elevation = 100
|
||||
panelSombra.BringToFront
|
||||
' panelSombra.Elevation = 0
|
||||
End Sub
|
||||
|
||||
Sub agregaPreguntaRadio(id As String, pregunta As String, respuestas As List) 'ignore
|
||||
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")
|
||||
panelActual = panelX
|
||||
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.
|
||||
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.Elevation = 100
|
||||
panelSombra.BringToFront
|
||||
End Sub
|
||||
|
||||
'Agrega preguntas de respuesta abierta, los ids y texto de las preguntas deben de ser listas.
|
||||
Sub agregaPreguntaAbierta(id As String, pregunta As String, ids As List, respuestas As List) 'ignore
|
||||
Log("Iniciamos PreguntaAbierta")
|
||||
Log(ids)
|
||||
Log(respuestas)
|
||||
encuestaIniciada = True
|
||||
vPreguntaActual = id
|
||||
bAceptarPregunta.Initialize("bAceptarPregunta")
|
||||
bAceptarPregunta.Enabled = False
|
||||
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")
|
||||
panelActual = panelX
|
||||
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 et(respuestas.Size) As EditText
|
||||
Private labelX(respuestas.Size) As Label
|
||||
For p = 0 To respuestas.Size - 1
|
||||
et(p).Initialize("et")
|
||||
labelX(p).Initialize("labelX")
|
||||
' et(p).Color = Colors.red
|
||||
' labelX(p).Color = Colors.Blue
|
||||
et(p).As(B4XView).SetTextAlignment("CENTER", "CENTER")
|
||||
labelX(p).As(B4XView).SetTextAlignment("CENTER", "CENTER")
|
||||
et(p).SetTextSizeAnimated(0, 14)
|
||||
et(p).Tag = CreateMap("id":id, "pregunta":pregunta, "panel":panelSombra, "idRespuesta":ids.Get(p))
|
||||
' Log($"Agregamos ET ${p}"$)
|
||||
panelX.AddView(labelX(p), 10dip, (70 * (p + 1)), (panelX.Width * 0.75), 60) 'Agregamos la etiqueta al panel.
|
||||
panelX.AddView(et(p), (labelX(p).Width + 10), (70 * (p + 1)), (panelX.Width * 0.2), 60) 'Agregamos el edittext al panel.
|
||||
et(p).Text = ""
|
||||
labelX(p).Text = respuestas.Get(p)
|
||||
Private newTop As Int = lbl.top + lbl.Height + 20 'Si es el primer radio, lo ponemos en top = alto de la "pregunta" + 10.
|
||||
If p <> 0 Then newTop = et(p - 1).Top + et(p - 1).Height + 5 'Calculamos el Top del radio de acuerdo al top y alto del radio anterior.
|
||||
et(p).Top = newTop
|
||||
labelX(p).Top = newTop
|
||||
Next
|
||||
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.
|
||||
panelX.AddView(bAceptarPregunta, 10, newTop + 80 + 15, 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.Elevation = 100dip
|
||||
panelSombra.BringToFront
|
||||
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 cb_CheckedChange(Checked As Boolean)
|
||||
Private elCB As CheckBox = Sender.As(CheckBox)
|
||||
Private elCBMap As Map = elCB.tag.As(Map)
|
||||
Private cuantosChks As Int = 0
|
||||
' Log(panelActual.NumberOfViews)
|
||||
If elCB.Text = "Ninguno de los anteriores" And elCB.Checked = True Then
|
||||
For Each v As View In panelActual.GetAllViewsRecursive
|
||||
If getViewType(v) = "CheckBox" Then
|
||||
cuantosChks = cuantosChks + 1
|
||||
v.As(CheckBox).Checked = False
|
||||
v.As(CheckBox).Enabled = False
|
||||
' Log(v.As(CheckBox).Text)
|
||||
' Log(v.As(CheckBox).Checked)
|
||||
If v.As(CheckBox).Text = "Ninguno de los anteriores" Then
|
||||
v.As(CheckBox).Enabled = True
|
||||
v.As(CheckBox).Checked = True
|
||||
End If
|
||||
If v.As(CheckBox).Checked Then cb_respuestas = cb_respuestas &"|" & v.As(CheckBox).Text
|
||||
End If
|
||||
Next
|
||||
else if elCB.Text = "Ninguno de los anteriores" And elCB.Checked = False Then
|
||||
For Each v As View In panelActual.GetAllViewsRecursive
|
||||
If getViewType(v) = "CheckBox" Then
|
||||
v.As(CheckBox).Enabled = True
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
If cuantosChks = 0 Then bAceptarPregunta.Enabled = False ' Si no hay opciones palomeadas, deshabilitamos el boton.
|
||||
cb_respuestas = ""
|
||||
Private cb_idRespuestas As String= ""
|
||||
For Each v As View In panelActual.GetAllViewsRecursive
|
||||
' Log(getViewType(v))
|
||||
If getViewType(v) = "CheckBox" Then
|
||||
' Log(v.As(CheckBox).Text)
|
||||
' Log(v.As(CheckBox).Checked)
|
||||
If v.As(CheckBox).Checked Then
|
||||
' Log(v.As(CheckBox).Tag.As(Map))
|
||||
If cb_respuestas = "" Then
|
||||
cb_respuestas = v.As(CheckBox).Text
|
||||
cb_idRespuestas = v.As(CheckBox).Tag.As(Map).Get("idRespuesta")
|
||||
Else
|
||||
cb_respuestas = cb_respuestas &"|" & v.As(CheckBox).Text
|
||||
cb_idRespuestas = cb_idRespuestas &"|" & v.As(CheckBox).Tag.As(Map).Get("idRespuesta")
|
||||
End If
|
||||
bAceptarPregunta.Enabled = True ' Si hay opciones palomeadas, habilitamos el boton.
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
' Log(cb_idRespuestas)
|
||||
' Log(elCBMap)
|
||||
' Log(cb_idRespuestas)
|
||||
bAceptarPregunta.tag = CreateMap("idPregunta":elCBMap.Get("id").As(String), "pregunta":elCBMap.Get("pregunta"), "idRespuesta":cb_idRespuestas, "respuesta":cb_respuestas, "panel":elCBMap.Get("panel"))
|
||||
End Sub
|
||||
|
||||
Private Sub et_TextChanged(Old As String, New As String)
|
||||
' Log($"${Old}, ${New}"$)
|
||||
Private etTotales As Int = 0
|
||||
Private etCont As Int = 0
|
||||
Private etResps As String = ""
|
||||
Private etIdResps As String = ""
|
||||
For Each v As View In panelActual.GetAllViewsRecursive
|
||||
' Log(getViewType(v))
|
||||
If getViewType(v) = "EditText" Then
|
||||
etTotales = etTotales + 1
|
||||
' Log($"Este ET: ${v.As(EditText).text}"$)
|
||||
If v.As(EditText).text <> "" Then
|
||||
etCont = etCont + 1
|
||||
If etResps = "" Then
|
||||
etResps = v.As(EditText).Text
|
||||
etIdResps = v.As(EditText).Tag.As(Map).Get("idRespuesta")
|
||||
Else
|
||||
etResps = etResps &"|" & v.As(EditText).Text
|
||||
etIdResps = etIdResps &"|" & v.As(EditText).Tag.As(Map).Get("idRespuesta")
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
' Log($"${etResps}, ${etIdResps}"$)
|
||||
bAceptarPregunta.Tag = CreateMap("idPregunta":Sender.As(EditText).tag.As(Map).Get("id").As(String), "pregunta":Sender.As(EditText).tag.As(Map).Get("pregunta"), "idRespuesta":etIdResps, "respuesta":etResps, "panel":Sender.As(EditText).tag.As(Map).Get("panel"))
|
||||
If etCont = etTotales Then bAceptarPregunta.Enabled = True Else bAceptarPregunta.Enabled = False
|
||||
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 clienteConCuestionario(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
|
||||
|
||||
'Agrega una columna a la tabla especificada.
|
||||
'Hay que indicar el "tipo" de la columna (TEXT, INTEGER, ETC)
|
||||
'Ej. agregaColumna("TABLA", "COLUMNA", "TIPO")
|
||||
Sub agregaColumna(tabla As String, columna As String, tipo As String) 'ignore
|
||||
Try 'Intentamos usar "pragma_table_info" para revisar si existe la columna en la tabla
|
||||
Private c As Cursor = db.ExecQuery($"SELECT COUNT(*) AS fCol FROM pragma_table_info('${tabla}') WHERE name='${columna}'"$)
|
||||
c.Position = 0
|
||||
If c.GetString("fCol") = 0 Then 'Si no esta la columna la agregamos
|
||||
db.ExecNonQuery($"ALTER TABLE ${tabla} ADD COLUMN ${columna} ${tipo}"$)
|
||||
Log($"Columna "${columna} ${tipo}", agregada a "${tabla}"."$)
|
||||
End If
|
||||
Catch 'Si no funciona "pragma_table_info" lo hacemos con try/catch
|
||||
Try
|
||||
db.ExecNonQuery($"ALTER TABLE ${tabla} ADD COLUMN ${columna} ${tipo}"$)
|
||||
Log($"Columna "${columna} ${tipo}", agregada a "${tabla}".."$)
|
||||
Catch
|
||||
Log(LastException)
|
||||
End Try
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Sub getViewType (v As View) As String 'ignore
|
||||
Private t As String = GetType(v)
|
||||
' Log(t)
|
||||
Private t2() As String = Regex.Split("\.", t)
|
||||
' Log(t2.Length)
|
||||
If t2.Length = 3 Then
|
||||
t = t2(2)
|
||||
End If
|
||||
Return t
|
||||
End Sub
|
||||
|
||||
'Regresa una lista de una cadena (separada por pipes) dada.
|
||||
Sub strToList(str As String) As List 'ignore
|
||||
Private resps() As String = Regex.Split("\|", str)
|
||||
Private l As List
|
||||
l.Initialize
|
||||
For r = 0 To resps.Length - 1
|
||||
l.Add(resps(r))
|
||||
Next
|
||||
Return l
|
||||
End Sub
|
||||
@@ -525,11 +525,10 @@ Sub Subir_Click
|
||||
d.Position=0
|
||||
cuantos_pedidosc = D.GetString("CUANTOS_PEDIDOSC")
|
||||
d.Close
|
||||
|
||||
|
||||
' ENVIO DE LOS CODIGOS QR
|
||||
'c=skmt.ExecQuery2("SELECT CAT_CL_NUM_SERIEFISICO,CAT_CL_CODIGO ,CAT_CL_LONG,CAT_CL_LAT, CAT_CL_FOTO FROM kmt_info where CAT_CL_NUM_SERIEFISICO = ?", Array As String("OK"))
|
||||
|
||||
|
||||
|
||||
c=B4XPages.MainPage.skmt.ExecQuery("SELECT CODIGOKMTS, CODIGOB, LAT, LON FROM HIST_CODIGO_BARRAS" )
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
@@ -542,8 +541,7 @@ Sub Subir_Click
|
||||
Next
|
||||
End If
|
||||
c.Close
|
||||
|
||||
|
||||
|
||||
c=B4XPages.MainPage.skmt.ExecQuery("SELECT CAT_CL_NUM_SERIEFISICO,CAT_CL_CODIGO ,CAT_CL_LONG,CAT_CL_LAT, CAT_CL_FOTO FROM kmt_info where CAT_CL_NUM_SERIEFISICO IS NOT NULL")
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
@@ -589,6 +587,21 @@ Sub Subir_Click
|
||||
d.Position=0
|
||||
cuantos_pedido = D.GetString("CUANTOS_PEDIDO")
|
||||
d.Close
|
||||
|
||||
'CUESTIONARIO
|
||||
c = B4XPages.MainPage.skmt.ExecQuery($"select * from cuestionario"$)
|
||||
Private rutaActual As String = Subs.traeRuta
|
||||
If c.RowCount > 0 Then
|
||||
For i = 0 To c.RowCount - 1
|
||||
c.Position = i
|
||||
Dim cmd As DBCommand
|
||||
cmd.Initialize
|
||||
cmd.Name = "insert_CUESTIONARIO_GUNA"
|
||||
cmd.Parameters = Array As Object(c.GetString("Q_IDCLIENTE"), rutaActual, ALMACEN, c.GetString("Q_FECHA"), c.GetString("Q_IDPREGUNTA"), c.GetString("Q_PREGUNTA"), c.GetString("Q_IDRESPUESTA"), C.GetString("Q_RESPUESTA"))
|
||||
B4XPages.MainPage.reqManager.ExecuteCommand(cmd , "ins_cuestionario")
|
||||
Next
|
||||
End If
|
||||
c.Close
|
||||
|
||||
' NOVENTA
|
||||
c=B4XPages.MainPage.skmt.ExecQuery("SELECT NV_CLIENTE,NV_FECHA,NV_USER,NV_MOTIVO,NV_COMM,NV_LAT,NV_LON FROM NOVENTA")
|
||||
@@ -622,12 +635,8 @@ Sub Subir_Click
|
||||
Next
|
||||
End If
|
||||
c.Close
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
' GEO CERCA
|
||||
|
||||
c=B4XPages.MainPage.skmt.ExecQuery("Select HGCLIENTE, HGDATE, HGLAT, HGLON from HIST_GEOCERCA")
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
@@ -642,7 +651,6 @@ Sub Subir_Click
|
||||
c.Close
|
||||
|
||||
' LO DEL LIKE
|
||||
|
||||
c=B4XPages.MainPage.skmt.ExecQuery("Select HFCLIENTE, HFALIAS,HFRUTA,HFALMACEN from HIST_FACE")
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
@@ -654,7 +662,8 @@ Sub Subir_Click
|
||||
B4XPages.MainPage.reqManager.ExecuteCommand(cmd , "inst_noventa")
|
||||
Next
|
||||
End If
|
||||
c.Close'
|
||||
c.Close
|
||||
|
||||
' DROP
|
||||
t1.Initialize("T1", 30000) ' 1000 = 1 second
|
||||
t1.Enabled = True
|
||||
@@ -684,6 +693,7 @@ Sub Subir_Click
|
||||
Next
|
||||
End If
|
||||
x.Close
|
||||
|
||||
Private x1 As Cursor = B4XPages.MainPage.skmt.ExecQuery("Select CLIENTE, ALMACEN, P1, P2, P3, P4, P5, P6 from ENCUESTA_MODULO2")
|
||||
If x1.RowCount>0 Then
|
||||
For i=0 To x1.RowCount -1
|
||||
|
||||
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -15,6 +15,7 @@ ModuleBookmarks20=
|
||||
ModuleBookmarks21=
|
||||
ModuleBookmarks22=
|
||||
ModuleBookmarks23=
|
||||
ModuleBookmarks24=
|
||||
ModuleBookmarks3=
|
||||
ModuleBookmarks4=
|
||||
ModuleBookmarks5=
|
||||
@@ -39,6 +40,7 @@ ModuleBreakpoints20=
|
||||
ModuleBreakpoints21=
|
||||
ModuleBreakpoints22=
|
||||
ModuleBreakpoints23=
|
||||
ModuleBreakpoints24=
|
||||
ModuleBreakpoints3=
|
||||
ModuleBreakpoints4=
|
||||
ModuleBreakpoints5=
|
||||
@@ -49,27 +51,28 @@ ModuleBreakpoints9=
|
||||
ModuleClosedNodes0=
|
||||
ModuleClosedNodes1=5,7,8,9,10,11,12,13,14
|
||||
ModuleClosedNodes10=
|
||||
ModuleClosedNodes11=6
|
||||
ModuleClosedNodes12=2,3,8,10,14
|
||||
ModuleClosedNodes13=6,10,11,13,14,16,17,20,21,22,23
|
||||
ModuleClosedNodes14=
|
||||
ModuleClosedNodes11=
|
||||
ModuleClosedNodes12=6
|
||||
ModuleClosedNodes13=2,3,8,10,14
|
||||
ModuleClosedNodes14=6,10,11,13,14,16,17,20,21,22,23
|
||||
ModuleClosedNodes15=
|
||||
ModuleClosedNodes16=
|
||||
ModuleClosedNodes17=
|
||||
ModuleClosedNodes18=
|
||||
ModuleClosedNodes19=
|
||||
ModuleClosedNodes2=
|
||||
ModuleClosedNodes20=3,4
|
||||
ModuleClosedNodes21=1
|
||||
ModuleClosedNodes22=
|
||||
ModuleClosedNodes20=
|
||||
ModuleClosedNodes21=3,4
|
||||
ModuleClosedNodes22=1
|
||||
ModuleClosedNodes23=
|
||||
ModuleClosedNodes24=
|
||||
ModuleClosedNodes3=
|
||||
ModuleClosedNodes4=
|
||||
ModuleClosedNodes4=12,13,14,15,16
|
||||
ModuleClosedNodes5=7
|
||||
ModuleClosedNodes6=
|
||||
ModuleClosedNodes6=6,8,9,10
|
||||
ModuleClosedNodes7=
|
||||
ModuleClosedNodes8=
|
||||
ModuleClosedNodes9=
|
||||
NavigationStack=C_Cliente,CB4_P8_M3_CheckedChange,3708,0,C_Cliente,b_preguntag_Click,1132,0,C_Cliente,gest_Click,1015,0,C_Cliente,DATOS_Click,1657,0,C_Principal,Class_Globals,0,0,C_Principal,cargar_Click,867,0,C_Cliente,B_E_NEXT_Click,2163,0,C_Cliente,Cuestionario,3710,0,C_Principal,JobDone,1527,0,C_Principal,Subir_Click,562,0
|
||||
NavigationStack=C_Cuestionario,strToList,385,0,C_Cuestionario,agregaPreguntaRadio,158,0,C_Principal,cargar_Click,936,0,C_Principal,JobDone,1531,0,C_Principal,Subir_Click,588,6,C_Cuestionario,agregaPreguntaAbierta,197,6,C_Cuestionario,et_TextChanged,310,6,C_Cuestionario,cb_CheckedChange,281,0,C_Cliente,cuest_preguntaContestada,4048,6,C_Cliente,p_encuesta_Click,4034,0,Visual Designer,login.bal,-100,1
|
||||
SelectedBuild=0
|
||||
VisibleModules=21,2,22,12,13,4,8,11,5,10
|
||||
VisibleModules=22,2,23,13,14,4,6,9,12,5
|
||||
|
||||
Reference in New Issue
Block a user