mirror of
https://github.com/KeymonSoft/Durakelo.git
synced 2026-04-17 19:36:12 +00:00
Corregido el cuestinario para que mande la fecha con hora!
This commit is contained in:
@@ -1721,9 +1721,10 @@ Sub cuest_preguntaContestada(m As Map)
|
||||
' 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"
|
||||
DateTime.DateFormat = "dd/MM/yyyy"
|
||||
DateTime.TimeFormat = "HH:mm:ss"
|
||||
Starter.skmt.ExecNonQuery($"delete from CUESTIONARIO where Q_IDCLIENTE = '${Subs.traeCliente}' and Q_IDPREGUNTA = '${m.Get("idPregunta")}'"$)
|
||||
Starter.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)}')"$)
|
||||
Starter.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)} ${DateTime.time(DateTime.now)}')"$)
|
||||
Select Case m.Get("idPregunta")
|
||||
Case "1"
|
||||
If m.Get("respuesta") = "No, está enrejado o no se tiene acceso" Then
|
||||
|
||||
155
B4A/C_Cuestionario.bas
Normal file
155
B4A/C_Cuestionario.bas
Normal file
@@ -0,0 +1,155 @@
|
||||
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
|
||||
db.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)")
|
||||
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.Elevation = 100
|
||||
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 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
|
||||
@@ -707,7 +707,6 @@ Sub Subir_Click
|
||||
End If
|
||||
cuantos_pedido = D.GetString("CUANTOS_PEDIDO")
|
||||
d.Close
|
||||
|
||||
' NOVENTA
|
||||
c=skmt.ExecQuery("SELECT NV_CLIENTE,NV_FECHA,NV_USER,NV_MOTIVO,NV_COMM,NV_LAT,NV_LON FROM NOVENTA")
|
||||
D=skmt.ExecQuery("SELECT COUNT(*) AS CUANTOS_NOVENTA FROM NOVENTA")
|
||||
|
||||
@@ -69,10 +69,10 @@ ModuleClosedNodes24=
|
||||
ModuleClosedNodes3=
|
||||
ModuleClosedNodes4=
|
||||
ModuleClosedNodes5=
|
||||
ModuleClosedNodes6=
|
||||
ModuleClosedNodes6=5
|
||||
ModuleClosedNodes7=
|
||||
ModuleClosedNodes8=
|
||||
ModuleClosedNodes9=
|
||||
NavigationStack=Subs,revisaRMIs,1444,0,C_Cuestionario,agregaPregunta,90,4,C_Cliente,gest_Click,382,0,C_Cliente,GPS_LocationChanged,377,0,C_Cliente,ListView1_ItemLongClick,379,0,C_Principal,cargar_Click,1080,0,C_Principal,Class_Globals,0,0,C_Principal,B4XPage_Created,168,0,C_Principal,Subir_Click,750,6,C_Principal,JobDone,1073,3
|
||||
NavigationStack=C_Cliente,ListView1_ItemLongClick,381,0,C_Cliente,B4XPage_Appear,228,0,C_Principal,Class_Globals,0,0,C_Principal,B4XPage_Created,168,0,C_Principal,JobDone,1074,3,C_Cuestionario,Class_Globals,0,0,C_Principal,Subir_Click,706,6,C_Cuestionario,Initialize,21,0,C_Cliente,B_IMP_Click,759,0,C_Cliente,cuest_preguntaContestada,1717,6
|
||||
SelectedBuild=0
|
||||
VisibleModules=1,2,10,3,4,5,7,8,9,11,6,23
|
||||
VisibleModules=1,2,10,4,5,6,8,9,11
|
||||
|
||||
Reference in New Issue
Block a user