mirror of
https://github.com/KeymonSoft/Intmex_Promotoria.git
synced 2026-04-17 21:06:28 +00:00
717 lines
26 KiB
QBasic
717 lines
26 KiB
QBasic
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 ScrollView1 As ScrollView
|
|
Private Panel1 As Panel
|
|
Dim IME As IME
|
|
Private p_cuestionario As Panel
|
|
Private paneltop As Panel
|
|
Private camEx2 As CameraExClass2
|
|
Dim frontCamera As Boolean = False
|
|
Private p_cam As Panel
|
|
Dim nombrefoto As String = "0"
|
|
Dim nombrefoto1 As String = "0"
|
|
Dim nombrefoto2 As String = "0"
|
|
Dim nombrefoto3 As String = "0"
|
|
Dim nombrefoto4 As String = "0"
|
|
Dim nombrefoto5 As String = "0"
|
|
Dim nombrefoto6 As String = "0"
|
|
Dim nombrefoto7 As String = "0"
|
|
Dim nombrefoto8 As String = "0"
|
|
Private p_camara As Panel
|
|
Private teclado As IME
|
|
Private ImageView1 As ImageView
|
|
Private ImageView2 As ImageView
|
|
Private ImageView3 As ImageView
|
|
Private ImageView4 As ImageView
|
|
Private ImageView5 As ImageView
|
|
Private ImageView6 As ImageView
|
|
Private ImageView7 As ImageView
|
|
Private ImageView8 As ImageView
|
|
Private ImageView9 As ImageView
|
|
Private RadioButton1 As RadioButton
|
|
Private RadioButton2 As RadioButton
|
|
Private RadioButton3 As RadioButton
|
|
Private RadioButton4 As RadioButton
|
|
Private RadioButton5 As RadioButton
|
|
Private RadioButton6 As RadioButton
|
|
Private RadioButton7 As RadioButton
|
|
Private RadioButton8 As RadioButton
|
|
Private RadioButton9 As RadioButton
|
|
Private RadioButton10 As RadioButton
|
|
Private RadioButton11 As RadioButton
|
|
Private RadioButton12 As RadioButton
|
|
Private RadioButton13 As RadioButton
|
|
Private RadioButton14 As RadioButton
|
|
Private RadioButton15 As RadioButton
|
|
Private RadioButton16 As RadioButton
|
|
Private RadioButton17 As RadioButton
|
|
Private RadioButton18 As RadioButton
|
|
Private EditText1 As EditText
|
|
Private EditText2 As EditText
|
|
Private EditText3 As EditText
|
|
Private EditText4 As EditText
|
|
Private EditText5 As EditText
|
|
Private EditText6 As EditText
|
|
Private EditText7 As EditText
|
|
Private EditText8 As EditText
|
|
Private EditText9 As EditText
|
|
Dim p1 As String
|
|
Dim p2 As String
|
|
Dim p3 As String
|
|
Dim p4 As String
|
|
Dim p5 As String
|
|
Dim p6 As String
|
|
Dim p7 As String
|
|
Dim p8 As String
|
|
Dim p9 As String
|
|
Private Label2 As Label
|
|
Private Label4 As Label
|
|
Private Label6 As Label
|
|
Private Label8 As Label
|
|
Private Label10 As Label
|
|
Private Label12 As Label
|
|
Private Label14 As Label
|
|
Private Label16 As Label
|
|
Private Label18 As Label
|
|
Dim c As Cursor
|
|
Dim d As Cursor
|
|
Dim e As Cursor
|
|
Dim fototomada As String
|
|
Dim timer As Timer
|
|
Dim timer2 As Timer
|
|
Dim reqManager As DBRequestManager
|
|
Private l_ubicacion As Label
|
|
Dim mlat As String
|
|
Dim mlon As String
|
|
Dim logger As Boolean = False
|
|
Dim laDist As Float
|
|
Private ubicacion As Location
|
|
Dim l1, l2 As Location
|
|
Dim distance As Long
|
|
End Sub
|
|
|
|
'You can add more parameters here.
|
|
Public Sub Initialize As Object
|
|
Return Me
|
|
End Sub
|
|
|
|
'This event will be called once, before the page becomes visible.
|
|
Private Sub B4XPage_Created (Root1 As B4XView)
|
|
Root = Root1
|
|
Root.LoadLayout("cliente")
|
|
reqManager.Initialize(Me, Starter.DBReqServer)
|
|
IME.Initialize("IME")
|
|
IME.AddHeightChangedEvent
|
|
IME_HeightChanged(100%y, 0)
|
|
'load the layout to Root
|
|
ScrollView1.height = Root.Height - Panel1.Height
|
|
|
|
ScrollView1.Panel.LoadLayout("p_cuest")
|
|
ScrollView1.Panel.Height = p_cuestionario.Height
|
|
Log(Starter.latitud & " , " & Starter.longitud)
|
|
p_camara.Height = Root.Height
|
|
p_camara.Width = Root.Width
|
|
p_camara.Visible = False
|
|
End Sub
|
|
|
|
|
|
Sub B4XPage_Appear
|
|
Log(Starter.latitud & " , " & Starter.longitud)
|
|
c = Starter.skmt.ExecQuery("SELECT latitud, longitud FROM CUENTAA")
|
|
c.Position = 0
|
|
mlat=0
|
|
mlon=0
|
|
If c.GetString("latitud") <> "" Then
|
|
mlat = c.GetString("latitud")
|
|
mlon = c.GetString("longitud")
|
|
End If
|
|
c.Close
|
|
|
|
If Not(Starter.GPS.GPSEnabled) Then
|
|
ToastMessageShow("Debe Activar el GPS del Equipo.", True)
|
|
StartActivity(Starter.GPS.LocationSettingsIntent)
|
|
Else
|
|
Starter.GPS.Start(0, 0)
|
|
If Starter.ubicacionActual.Latitude <> 0 Then GPS_LocationChanged(Starter.ubicacionActual)
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Sub GPS_LocationChanged (Location1 As Location)
|
|
|
|
' ubicacion.Initialize
|
|
' ubicacion.Latitude = mlat
|
|
' ubicacion.Longitude = mlon
|
|
' If logger Then Log($"${Location1.Latitude}, ${Location1.Longitude}, ${Location1.Accuracy}"$)
|
|
' laDist = Location1.DistanceTo(ubicacion)
|
|
' l_ubicacion.Text = $"Dist: $1.0{laDist} mts."$
|
|
|
|
l1.Initialize2(Starter.latitud,Starter.longitud)
|
|
l2.Initialize2(mlat, mlon)
|
|
distance = l1.DistanceTo(l2) ' resultado en metros
|
|
' Log (distance)
|
|
' Log(mlat & " , " & mlon)
|
|
' Log(Starter.latitud & " , " & Starter.longitud)
|
|
l_ubicacion.Text = $"Dist: $1.0{distance} mts."$
|
|
If laDist > 50 Then l_ubicacion.TextColor = Colors.Red Else l_ubicacion.TextColor = Colors.Blue
|
|
|
|
End Sub
|
|
|
|
'tomar foto
|
|
|
|
Private Sub InitializeCamera2
|
|
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_CAMERA)
|
|
Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
|
|
If Result Then
|
|
camEx2.Initialize(p_cam, frontCamera, Me, "Camera1")
|
|
frontCamera = camEx2.Front
|
|
Log("inicializamos Camara")
|
|
Else
|
|
ToastMessageShow("No permission!!!", True)
|
|
End If
|
|
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
|
|
Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
|
|
If Result Then
|
|
Log("conpermisos para escritura")
|
|
Else
|
|
ToastMessageShow("No permission!!!", True)
|
|
End If
|
|
|
|
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_READ_EXTERNAL_STORAGE)
|
|
Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
|
|
If Result Then
|
|
Log("conpermisos para escritura")
|
|
Else
|
|
ToastMessageShow("No permission!!!", True)
|
|
End If
|
|
End Sub
|
|
|
|
Sub Camera1_Ready (Success As Boolean)
|
|
Log("Camara ready")
|
|
If Success Then
|
|
camEx2.SetJpegQuality(90)
|
|
camEx2.SetContinuousAutoFocus
|
|
camEx2.CommitParameters
|
|
camEx2.StartPreview
|
|
Log(camEx2.GetPreviewSize)
|
|
Else
|
|
ToastMessageShow("Cannot open camera.", True)
|
|
Log("Cannot open camera")
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub ImageView1_Click
|
|
' foto = 2
|
|
DateTime.DateFormat="ddMMyyyyHHmmss"
|
|
InitializeCamera2
|
|
p_camara.Visible = True
|
|
nombrefoto = DateTime.Now & "_planograma.jpg"
|
|
teclado.HideKeyboard
|
|
fototomada = nombrefoto
|
|
End Sub
|
|
|
|
Private Sub ImageView2_Click
|
|
' foto = 2
|
|
DateTime.DateFormat="ddMMyyyyHHmmss"
|
|
InitializeCamera2
|
|
p_camara.Visible = True
|
|
nombrefoto1 = DateTime.Now & "_catalogo.jpg"
|
|
teclado.HideKeyboard
|
|
fototomada = nombrefoto1
|
|
End Sub
|
|
|
|
Private Sub ImageView3_Click
|
|
' foto = 2
|
|
DateTime.DateFormat="ddMMyyyyHHmmss"
|
|
InitializeCamera2
|
|
p_camara.Visible = True
|
|
nombrefoto2 = DateTime.Now & "_presenciaanaqel.jpg"
|
|
teclado.HideKeyboard
|
|
fototomada = nombrefoto2
|
|
End Sub
|
|
|
|
Private Sub ImageView4_Click
|
|
' foto = 2
|
|
DateTime.DateFormat="ddMMyyyyHHmmss"
|
|
InitializeCamera2
|
|
p_camara.Visible = True
|
|
nombrefoto3 = DateTime.Now & "_exhibicion.jpg"
|
|
teclado.HideKeyboard
|
|
fototomada = nombrefoto3
|
|
End Sub
|
|
|
|
Private Sub ImageView5_Click
|
|
' foto = 2
|
|
DateTime.DateFormat="ddMMyyyyHHmmss"
|
|
InitializeCamera2
|
|
p_camara.Visible = True
|
|
nombrefoto4 = DateTime.Now & "_cabecera.jpg"
|
|
teclado.HideKeyboard
|
|
fototomada = nombrefoto4
|
|
End Sub
|
|
|
|
Private Sub ImageView6_Click
|
|
' foto = 2
|
|
DateTime.DateFormat="ddMMyyyyHHmmss"
|
|
InitializeCamera2
|
|
p_camara.Visible = True
|
|
nombrefoto5 = DateTime.Now & "_innovacion.jpg"
|
|
teclado.HideKeyboard
|
|
fototomada = nombrefoto5
|
|
End Sub
|
|
|
|
Private Sub ImageView7_Click
|
|
' foto = 2
|
|
DateTime.DateFormat="ddMMyyyyHHmmss"
|
|
InitializeCamera2
|
|
p_camara.Visible = True
|
|
nombrefoto6 = DateTime.Now & "_abasto.jpg"
|
|
teclado.HideKeyboard
|
|
fototomada = nombrefoto6
|
|
End Sub
|
|
|
|
Private Sub ImageView8_Click
|
|
' foto = 2
|
|
DateTime.DateFormat="ddMMyyyyHHmmss"
|
|
InitializeCamera2
|
|
p_camara.Visible = True
|
|
nombrefoto7 = DateTime.Now & "_foods.jpg"
|
|
teclado.HideKeyboard
|
|
fototomada = nombrefoto7
|
|
End Sub
|
|
|
|
Private Sub ImageView9_Click
|
|
' foto = 2
|
|
DateTime.DateFormat="ddMMyyyyHHmmss"
|
|
InitializeCamera2
|
|
p_camara.Visible = True
|
|
nombrefoto8 = DateTime.Now & "_pc.jpg"
|
|
teclado.HideKeyboard
|
|
fototomada = nombrefoto8
|
|
End Sub
|
|
|
|
|
|
Private Sub p_camara_Click
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub b_foto_inci_Click
|
|
camEx2.TakePicture
|
|
p_camara.Visible = False
|
|
' StopCamera2
|
|
End Sub
|
|
|
|
Sub Camera1_PictureTaken (Data()As Byte)
|
|
Log("tome foto")
|
|
Dim filename As String = fototomada
|
|
Dim Dirp As String = File.DirInternal
|
|
Dim Dir As String
|
|
Dim Dir2 As String
|
|
Try
|
|
File.MakeDir(Dirp,"/promotoriakmts")
|
|
Dir = "/promotoriakmts"
|
|
Log("creado en promotoria " & Dirp & Dir)
|
|
Catch
|
|
Dir = ""
|
|
Log("creado en raiz")
|
|
End Try
|
|
|
|
Try
|
|
File.MakeDir(Dirp & Dir,"/reduccion")
|
|
Dir2 = "/reduccion"
|
|
Log("creado en promotoria " & Dirp & Dir & Dir2)
|
|
Catch
|
|
Dir = ""
|
|
Log("creado en raiz")
|
|
End Try
|
|
|
|
camEx2.SavePictureToFile(Data, Dirp&Dir, filename)
|
|
camEx2.StartPreview 'restart preview
|
|
ToastMessageShow("Picture saved." & CRLF & "File size: " & File.Size(Dir, filename) & Dir &"," & filename, True)
|
|
Log("Picture saved." & CRLF & "File size: " & File.Size(Dir, filename) & Dir &"," & filename)
|
|
p_camara.Visible = False
|
|
|
|
|
|
If nombrefoto <> 0 Then
|
|
Dim img As B4XBitmap = xui.LoadBitmapResize(File.DirInternal & Dir, filename, 300, 450, True)
|
|
Dim out As OutputStream = File.OpenOutput(File.DirInternal & Dir & Dir2, filename, False)
|
|
img.WriteToStream(out, 100, "PNG")
|
|
out.Close
|
|
ImageView1.Bitmap = LoadBitmap(File.DirInternal & Dir & Dir2,nombrefoto)
|
|
End If
|
|
|
|
If nombrefoto1 <> 0 Then
|
|
Dim img As B4XBitmap = xui.LoadBitmapResize(File.DirInternal & Dir, filename, 300, 450, True)
|
|
Dim out As OutputStream = File.OpenOutput(File.DirInternal & Dir & Dir2, filename, False)
|
|
img.WriteToStream(out, 100, "PNG")
|
|
out.Close
|
|
ImageView2.Bitmap = LoadBitmap(File.DirInternal & Dir& Dir2,nombrefoto1)
|
|
End If
|
|
|
|
If nombrefoto2 <> 0 Then
|
|
Dim img As B4XBitmap = xui.LoadBitmapResize(File.DirInternal & Dir, filename, 300, 450, True)
|
|
Dim out As OutputStream = File.OpenOutput(File.DirInternal & Dir & Dir2, filename, False)
|
|
img.WriteToStream(out, 100, "PNG")
|
|
out.Close
|
|
ImageView3.Bitmap = LoadBitmap(File.DirInternal & Dir& Dir2,nombrefoto2)
|
|
End If
|
|
|
|
If nombrefoto3 <> 0 Then
|
|
Dim img As B4XBitmap = xui.LoadBitmapResize(File.DirInternal & Dir, filename, 300, 450, True)
|
|
Dim out As OutputStream = File.OpenOutput(File.DirInternal & Dir & Dir2, filename, False)
|
|
img.WriteToStream(out, 100, "PNG")
|
|
out.Close
|
|
ImageView4.Bitmap = LoadBitmap(File.DirInternal & Dir & Dir2,nombrefoto3)
|
|
End If
|
|
|
|
If nombrefoto4 <> 0 Then
|
|
Dim img As B4XBitmap = xui.LoadBitmapResize(File.DirInternal & Dir, filename, 300, 450, True)
|
|
Dim out As OutputStream = File.OpenOutput(File.DirInternal & Dir & Dir2, filename, False)
|
|
img.WriteToStream(out, 100, "PNG")
|
|
out.Close
|
|
ImageView5.Bitmap = LoadBitmap(File.DirInternal & Dir & Dir2,nombrefoto4)
|
|
End If
|
|
|
|
If nombrefoto5 <> 0 Then
|
|
Dim img As B4XBitmap = xui.LoadBitmapResize(File.DirInternal & Dir, filename, 300, 450, True)
|
|
Dim out As OutputStream = File.OpenOutput(File.DirInternal & Dir & Dir2, filename, False)
|
|
img.WriteToStream(out, 100, "PNG")
|
|
out.Close
|
|
ImageView6.Bitmap = LoadBitmap(File.DirInternal & Dir & Dir2,nombrefoto5)
|
|
End If
|
|
|
|
If nombrefoto6 <> 0 Then
|
|
Dim img As B4XBitmap = xui.LoadBitmapResize(File.DirInternal & Dir, filename, 300, 450, True)
|
|
Dim out As OutputStream = File.OpenOutput(File.DirInternal & Dir & Dir2, filename, False)
|
|
img.WriteToStream(out, 100, "PNG")
|
|
out.Close
|
|
ImageView7.Bitmap = LoadBitmap(File.DirInternal & Dir & Dir2,nombrefoto6)
|
|
End If
|
|
|
|
If nombrefoto7 <> 0 Then
|
|
Dim img As B4XBitmap = xui.LoadBitmapResize(File.DirInternal & Dir, filename, 300, 450, True)
|
|
Dim out As OutputStream = File.OpenOutput(File.DirInternal & Dir & Dir2, filename, False)
|
|
img.WriteToStream(out, 100, "PNG")
|
|
out.Close
|
|
ImageView8.Bitmap = LoadBitmap(File.DirInternal & Dir & Dir2,nombrefoto7)
|
|
End If
|
|
|
|
If nombrefoto8 <> 0 Then
|
|
Dim img As B4XBitmap = xui.LoadBitmapResize(File.DirInternal & Dir, filename, 300, 450, True)
|
|
Dim out As OutputStream = File.OpenOutput(File.DirInternal & Dir & Dir2, filename, False)
|
|
img.WriteToStream(out, 100, "PNG")
|
|
out.Close
|
|
ImageView9.Bitmap = LoadBitmap(File.DirInternal & Dir & Dir2,nombrefoto8)
|
|
End If
|
|
StopCamera2
|
|
|
|
End Sub
|
|
|
|
Private Sub StopCamera2
|
|
' Capturing = False
|
|
If camEx2.IsInitialized Then
|
|
camEx2.Release
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub b_guardar_Click
|
|
If EditText1.Text <> "" And nombrefoto <> 0 And RadioButton1.Checked = True Or RadioButton2.Checked = True Then
|
|
If RadioButton1.Checked Then p1 = "Satisfactorio"
|
|
If RadioButton2.Checked Then p1 = "Incompleto"
|
|
' Log(nombrefoto)
|
|
|
|
If EditText2.Text <> "" And nombrefoto1 <> 0 And RadioButton3.Checked = True Or RadioButton4.Checked = True Then
|
|
If RadioButton3.Checked Then p2 = "Satisfactorio"
|
|
If RadioButton4.Checked Then p2 = "Incompleto"
|
|
|
|
If EditText3.Text <> "" And nombrefoto2 <> 0 And RadioButton5.Checked = True Or RadioButton6.Checked = True Then
|
|
If RadioButton5.Checked Then p3 = "Satisfactorio"
|
|
If RadioButton6.Checked Then p3 = "Incompleto"
|
|
|
|
If EditText4.Text <> "" And nombrefoto3 <> 0 And RadioButton7.Checked = True Or RadioButton8.Checked = True Then
|
|
If RadioButton7.Checked Then p4 = "Satisfactorio"
|
|
If RadioButton8.Checked Then p4 = "Incompleto"
|
|
|
|
If EditText5.Text <> "" And nombrefoto4 <> 0 And RadioButton9.Checked = True Or RadioButton10.Checked = True Then
|
|
If RadioButton9.Checked Then p5 = "Satisfactorio"
|
|
If RadioButton10.Checked Then p5 = "Incompleto"
|
|
|
|
If EditText6.Text <> "" And nombrefoto5 <> 0 And RadioButton11.Checked = True Or RadioButton12.Checked = True Then
|
|
If RadioButton11.Checked Then p6 = "Satisfactorio"
|
|
If RadioButton12.Checked Then p6 = "Incompleto"
|
|
|
|
If EditText7.Text <> "" And nombrefoto6 <> 0 And RadioButton13.Checked = True Or RadioButton14.Checked = True Then
|
|
If RadioButton13.Checked Then p7 = "Satisfactorio"
|
|
If RadioButton14.Checked Then p7 = "Incompleto"
|
|
|
|
If EditText8.Text <> "" And nombrefoto7 <> 0 And RadioButton15.Checked = True Or RadioButton16.Checked = True Then
|
|
If RadioButton15.Checked Then p8 = "Satisfactorio"
|
|
If RadioButton16.Checked Then p8 = "Incompleto"
|
|
|
|
If EditText9.Text <> "" And nombrefoto8 <> 0 And RadioButton17.Checked = True Or RadioButton18.Checked = True Then
|
|
If RadioButton17.Checked Then p9 = "Satisfactorio"
|
|
If RadioButton18.Checked Then p9 = "Incompleto"
|
|
|
|
|
|
|
|
|
|
|
|
If distance > 50 Then
|
|
|
|
c = Starter.skmt.ExecQuery("SELECT cuenta FROM CUENTAA")
|
|
c.Position = 0
|
|
|
|
Starter.skmt.ExecNonQuery2("INSERT INTO HIST_PREGUNTAS(CLIENTE, CATEGORIA, PREGUNTA1, COMENTARIOS, NOMBRE_FOTO) VALUES(?,?,?,?,?)", Array As Object(c.GetString("cuenta"),Label2.Text,p1,EditText1.Text,nombrefoto))
|
|
Starter.skmt.ExecNonQuery2("INSERT INTO HIST_PREGUNTAS(CLIENTE, CATEGORIA, PREGUNTA1, COMENTARIOS, NOMBRE_FOTO) VALUES(?,?,?,?,?)", Array As Object(c.GetString("cuenta"),Label4.Text,p2,EditText2.Text,nombrefoto1))
|
|
Starter.skmt.ExecNonQuery2("INSERT INTO HIST_PREGUNTAS(CLIENTE, CATEGORIA, PREGUNTA1, COMENTARIOS, NOMBRE_FOTO) VALUES(?,?,?,?,?)", Array As Object(c.GetString("cuenta"),Label6.Text,p3,EditText3.Text,nombrefoto2))
|
|
Starter.skmt.ExecNonQuery2("INSERT INTO HIST_PREGUNTAS(CLIENTE, CATEGORIA, PREGUNTA1, COMENTARIOS, NOMBRE_FOTO) VALUES(?,?,?,?,?)", Array As Object(c.GetString("cuenta"),Label8.Text,p4,EditText4.Text,nombrefoto3))
|
|
Starter.skmt.ExecNonQuery2("INSERT INTO HIST_PREGUNTAS(CLIENTE, CATEGORIA, PREGUNTA1, COMENTARIOS, NOMBRE_FOTO) VALUES(?,?,?,?,?)", Array As Object(c.GetString("cuenta"),Label10.Text,p5,EditText5.Text,nombrefoto4))
|
|
Starter.skmt.ExecNonQuery2("INSERT INTO HIST_PREGUNTAS(CLIENTE, CATEGORIA, PREGUNTA1, COMENTARIOS, NOMBRE_FOTO) VALUES(?,?,?,?,?)", Array As Object(c.GetString("cuenta"),Label12.Text,p6,EditText6.Text,nombrefoto5))
|
|
Starter.skmt.ExecNonQuery2("INSERT INTO HIST_PREGUNTAS(CLIENTE, CATEGORIA, PREGUNTA1, COMENTARIOS, NOMBRE_FOTO) VALUES(?,?,?,?,?)", Array As Object(c.GetString("cuenta"),Label14.Text,p7,EditText7.Text,nombrefoto6))
|
|
Starter.skmt.ExecNonQuery2("INSERT INTO HIST_PREGUNTAS(CLIENTE, CATEGORIA, PREGUNTA1, COMENTARIOS, NOMBRE_FOTO) VALUES(?,?,?,?,?)", Array As Object(c.GetString("cuenta"),Label16.Text,p8,EditText8.Text,nombrefoto7))
|
|
Starter.skmt.ExecNonQuery2("INSERT INTO HIST_PREGUNTAS(CLIENTE, CATEGORIA, PREGUNTA1, COMENTARIOS, NOMBRE_FOTO) VALUES(?,?,?,?,?)", Array As Object(c.GetString("cuenta"),Label18.Text,p9,EditText9.Text,nombrefoto8))
|
|
Starter.skmt.ExecNonQuery("UPDATE CUENTAA SET asignado = '0'")
|
|
Starter.skmt.ExecNonQuery2("UPDATE DATOS_CLIENTE SET ESTATUS = 1 WHERE CAT_CL_CODIGO = ?", Array As String(c.GetString("cuenta")))
|
|
MsgboxAsync("Datos guardados","Atención")
|
|
|
|
Dim cmd As DBCommand
|
|
d = Starter.skmt.ExecQuery("SELECT CLIENTE, CATEGORIA, PREGUNTA1, COMENTARIOS, NOMBRE_FOTO FROM HIST_PREGUNTAS")
|
|
e = Starter.skmt.ExecQuery("SELECT RUTA FROM CARGA")
|
|
e.Position = 0
|
|
Log("estoy aqui")
|
|
For i = 0 To d.RowCount - 1
|
|
d.Position = i
|
|
Log("estoy aqui 2")
|
|
cmd.Initialize
|
|
cmd.Name = "delete_hist_promotoria_INTMEX"
|
|
cmd.Parameters = Array As Object(Starter.almacen, e.GetString("RUTA"),B4XPages.MainPage.user,d.GetString("CLIENTE"),d.GetString("CATEGORIA"))
|
|
B4XPages.MainPage.reqManager.ExecuteCommand(cmd , "delete")
|
|
Next
|
|
|
|
c.Close
|
|
d.Close
|
|
e.Close
|
|
|
|
timer.Initialize("Timerconteo",20000)
|
|
timer.Enabled = True
|
|
|
|
Timerconteo_tick
|
|
guardado
|
|
B4XPages.ShowPage ("principal")
|
|
|
|
Else if distance < 50 Then
|
|
|
|
Dim result As Int
|
|
result = Msgbox2("Estas fuera de rango de check-in. ¿Deseas enviar la información?", "Atención","Si","","No",Null)
|
|
If result = DialogResponse.POSITIVE Then
|
|
|
|
c = Starter.skmt.ExecQuery("SELECT cuenta FROM CUENTAA")
|
|
c.Position = 0
|
|
|
|
Starter.skmt.ExecNonQuery2("INSERT INTO HIST_PREGUNTAS(CLIENTE, CATEGORIA, PREGUNTA1, COMENTARIOS, NOMBRE_FOTO) VALUES(?,?,?,?,?)", Array As Object(c.GetString("cuenta"),Label2.Text,p1,EditText1.Text,nombrefoto))
|
|
Starter.skmt.ExecNonQuery2("INSERT INTO HIST_PREGUNTAS(CLIENTE, CATEGORIA, PREGUNTA1, COMENTARIOS, NOMBRE_FOTO) VALUES(?,?,?,?,?)", Array As Object(c.GetString("cuenta"),Label4.Text,p2,EditText2.Text,nombrefoto1))
|
|
Starter.skmt.ExecNonQuery2("INSERT INTO HIST_PREGUNTAS(CLIENTE, CATEGORIA, PREGUNTA1, COMENTARIOS, NOMBRE_FOTO) VALUES(?,?,?,?,?)", Array As Object(c.GetString("cuenta"),Label6.Text,p3,EditText3.Text,nombrefoto2))
|
|
Starter.skmt.ExecNonQuery2("INSERT INTO HIST_PREGUNTAS(CLIENTE, CATEGORIA, PREGUNTA1, COMENTARIOS, NOMBRE_FOTO) VALUES(?,?,?,?,?)", Array As Object(c.GetString("cuenta"),Label8.Text,p4,EditText4.Text,nombrefoto3))
|
|
Starter.skmt.ExecNonQuery2("INSERT INTO HIST_PREGUNTAS(CLIENTE, CATEGORIA, PREGUNTA1, COMENTARIOS, NOMBRE_FOTO) VALUES(?,?,?,?,?)", Array As Object(c.GetString("cuenta"),Label10.Text,p5,EditText5.Text,nombrefoto4))
|
|
Starter.skmt.ExecNonQuery2("INSERT INTO HIST_PREGUNTAS(CLIENTE, CATEGORIA, PREGUNTA1, COMENTARIOS, NOMBRE_FOTO) VALUES(?,?,?,?,?)", Array As Object(c.GetString("cuenta"),Label12.Text,p6,EditText6.Text,nombrefoto5))
|
|
Starter.skmt.ExecNonQuery2("INSERT INTO HIST_PREGUNTAS(CLIENTE, CATEGORIA, PREGUNTA1, COMENTARIOS, NOMBRE_FOTO) VALUES(?,?,?,?,?)", Array As Object(c.GetString("cuenta"),Label14.Text,p7,EditText7.Text,nombrefoto6))
|
|
Starter.skmt.ExecNonQuery2("INSERT INTO HIST_PREGUNTAS(CLIENTE, CATEGORIA, PREGUNTA1, COMENTARIOS, NOMBRE_FOTO) VALUES(?,?,?,?,?)", Array As Object(c.GetString("cuenta"),Label16.Text,p8,EditText8.Text,nombrefoto7))
|
|
Starter.skmt.ExecNonQuery2("INSERT INTO HIST_PREGUNTAS(CLIENTE, CATEGORIA, PREGUNTA1, COMENTARIOS, NOMBRE_FOTO) VALUES(?,?,?,?,?)", Array As Object(c.GetString("cuenta"),Label18.Text,p9,EditText9.Text,nombrefoto8))
|
|
Starter.skmt.ExecNonQuery("UPDATE CUENTAA SET asignado = '0'")
|
|
Starter.skmt.ExecNonQuery2("UPDATE DATOS_CLIENTE SET ESTATUS = 1 WHERE CAT_CL_CODIGO = ?", Array As String(c.GetString("cuenta")))
|
|
MsgboxAsync("Datos guardados","Atención")
|
|
|
|
Dim cmd As DBCommand
|
|
d = Starter.skmt.ExecQuery("SELECT CLIENTE, CATEGORIA, PREGUNTA1, COMENTARIOS, NOMBRE_FOTO FROM HIST_PREGUNTAS")
|
|
e = Starter.skmt.ExecQuery("SELECT RUTA FROM CARGA")
|
|
e.Position = 0
|
|
Log("estoy aqui")
|
|
For i = 0 To d.RowCount - 1
|
|
d.Position = i
|
|
Log("estoy aqui 2")
|
|
cmd.Initialize
|
|
cmd.Name = "delete_hist_promotoria_INTMEX"
|
|
cmd.Parameters = Array As Object(Starter.almacen, e.GetString("RUTA"),B4XPages.MainPage.user,d.GetString("CLIENTE"),d.GetString("CATEGORIA"))
|
|
B4XPages.MainPage.reqManager.ExecuteCommand(cmd , "delete")
|
|
Next
|
|
|
|
c.Close
|
|
d.Close
|
|
e.Close
|
|
|
|
timer2.Initialize("Timerconteo",20000)
|
|
timer2.Enabled = True
|
|
|
|
Timerconteo2_tick
|
|
guardado
|
|
B4XPages.ShowPage ("principal")
|
|
|
|
Else If result = DialogResponse.NEGATIVE Then
|
|
|
|
End If
|
|
End If
|
|
Else
|
|
MsgboxAsync("Completa todos los campos de la Categoria PC", "Atención")
|
|
End If
|
|
Else
|
|
MsgboxAsync("Completa todos los campos de la Categoria Foods", "Atención")
|
|
End If
|
|
Else
|
|
MsgboxAsync("Completa todos los campos de Abasto", "Atención")
|
|
End If
|
|
Else
|
|
MsgboxAsync("Completa todos los campos de Innovacion", "Atención")
|
|
End If
|
|
Else
|
|
MsgboxAsync("Completa todos los campos de Cabecera", "Atención")
|
|
End If
|
|
Else
|
|
MsgboxAsync("Completa todos los campos de Exhibicion adicional", "Atención")
|
|
End If
|
|
Else
|
|
MsgboxAsync("Completa todos los campos de Presencia Anaquel", "Atención")
|
|
End If
|
|
Else
|
|
MsgboxAsync("Completa todos los campos de Catalogo", "Atención")
|
|
End If
|
|
Else
|
|
MsgboxAsync("Completa todos los campos del Planograma", "Atención")
|
|
End If
|
|
teclado.HideKeyboard
|
|
End Sub
|
|
|
|
Sub IME_HeightChanged(NewHeight As Int, OldHeight As Int)
|
|
paneltop.Top = NewHeight - paneltop.Height
|
|
ScrollView1.Height = paneltop.Top - ScrollView1.Top
|
|
End Sub
|
|
|
|
Private Sub B4XPage_CloseRequest As ResumableSub
|
|
|
|
If p_camara.Visible = True Then
|
|
p_camara.Visible = False
|
|
StopCamera2
|
|
Else
|
|
B4XPages.ShowPage("principal")
|
|
End If
|
|
|
|
' Return True
|
|
Return False
|
|
End Sub
|
|
|
|
Sub guardado
|
|
RadioButton1.Checked = False
|
|
RadioButton2.Checked = False
|
|
RadioButton3.Checked = False
|
|
RadioButton4.Checked = False
|
|
RadioButton5.Checked = False
|
|
RadioButton6.Checked = False
|
|
RadioButton7.Checked = False
|
|
RadioButton8.Checked = False
|
|
RadioButton9.Checked = False
|
|
RadioButton10.Checked = False
|
|
RadioButton11.Checked = False
|
|
RadioButton12.Checked = False
|
|
RadioButton13.Checked = False
|
|
RadioButton14.Checked = False
|
|
RadioButton15.Checked = False
|
|
RadioButton16.Checked = False
|
|
RadioButton17.Checked = False
|
|
RadioButton18.Checked = False
|
|
EditText1.Text = ""
|
|
EditText2.Text = ""
|
|
EditText3.Text = ""
|
|
EditText4.Text = ""
|
|
EditText5.Text = ""
|
|
EditText6.Text = ""
|
|
EditText7.Text = ""
|
|
EditText8.Text = ""
|
|
EditText9.Text = ""
|
|
ImageView1.Bitmap = LoadBitmap(File.DirAssets,"camara1.png")
|
|
ImageView2.Bitmap = LoadBitmap(File.DirAssets,"camara1.png")
|
|
ImageView3.Bitmap = LoadBitmap(File.DirAssets,"camara1.png")
|
|
ImageView4.Bitmap = LoadBitmap(File.DirAssets,"camara1.png")
|
|
ImageView5.Bitmap = LoadBitmap(File.DirAssets,"camara1.png")
|
|
ImageView6.Bitmap = LoadBitmap(File.DirAssets,"camara1.png")
|
|
ImageView7.Bitmap = LoadBitmap(File.DirAssets,"camara1.png")
|
|
ImageView8.Bitmap = LoadBitmap(File.DirAssets,"camara1.png")
|
|
ImageView9.Bitmap = LoadBitmap(File.DirAssets,"camara1.png")
|
|
nombrefoto = 0
|
|
nombrefoto1 = 0
|
|
nombrefoto2 = 0
|
|
nombrefoto3 = 0
|
|
nombrefoto4 = 0
|
|
nombrefoto5 = 0
|
|
nombrefoto6 = 0
|
|
nombrefoto7 = 0
|
|
nombrefoto8 = 0
|
|
End Sub
|
|
|
|
Sub Timerconteo_tick
|
|
Dim fotox() As Byte
|
|
Dim cmd As DBCommand
|
|
c = Starter.skmt.ExecQuery("SELECT cuenta, latitud, longitud FROM CUENTAA")
|
|
d = Starter.skmt.ExecQuery("SELECT CLIENTE, CATEGORIA, PREGUNTA1, COMENTARIOS, NOMBRE_FOTO FROM HIST_PREGUNTAS")
|
|
e = Starter.skmt.ExecQuery("SELECT RUTA FROM CARGA")
|
|
c.Position = 0
|
|
e.Position = 0
|
|
Dim Dirp As String = File.DirInternal
|
|
Dim Dir As String
|
|
Dim Dir2 As String
|
|
Dir = "/promotoriakmts"
|
|
Dir2 = "/reduccion"
|
|
|
|
For i = 0 To d.RowCount - 1
|
|
d.Position = i
|
|
Log(File.Exists(Dirp&Dir&Dir2,d.GetString("NOMBRE_FOTO")))
|
|
fotox = Bit.InputStreamToBytes(File.OpenInput(Dirp&Dir&Dir2,d.GetString("NOMBRE_FOTO")))
|
|
cmd.Initialize
|
|
cmd.Name = "insert_promotoria_INTMEX"
|
|
cmd.Parameters = Array As Object(Starter.almacen, e.GetString("RUTA"),B4XPages.MainPage.user,d.GetString("CLIENTE"),d.GetString("CATEGORIA"),d.GetString("PREGUNTA1"),d.GetString("COMENTARIOS"),fotox,c.GetString("latitud"),c.GetString("longitud"),c.GetString("lalitud"),c.GetString("longitud"))
|
|
B4XPages.MainPage.reqManager.ExecuteCommand(cmd, $"insert_promotoria_${d.GetString("CLIENTE")}_${d.GetString("CATEGORIA")}"$)
|
|
Next
|
|
|
|
c.Close
|
|
d.Close
|
|
e.Close
|
|
timer.Enabled = False
|
|
End Sub
|
|
|
|
Sub Timerconteo2_tick
|
|
Dim fotox() As Byte
|
|
Dim cmd As DBCommand
|
|
c = Starter.skmt.ExecQuery("SELECT cuenta, latitud, longitud FROM CUENTAA")
|
|
d = Starter.skmt.ExecQuery("SELECT CLIENTE, CATEGORIA, PREGUNTA1, COMENTARIOS, NOMBRE_FOTO FROM HIST_PREGUNTAS")
|
|
e = Starter.skmt.ExecQuery("SELECT RUTA FROM CARGA")
|
|
c.Position = 0
|
|
e.Position = 0
|
|
Dim Dirp As String = File.DirInternal
|
|
Dim Dir As String
|
|
Dim Dir2 As String
|
|
Dir = "/promotoriakmts"
|
|
Dir2 = "/reduccion"
|
|
|
|
For i = 0 To d.RowCount - 1
|
|
d.Position = i
|
|
Log(File.Exists(Dirp&Dir&Dir2,d.GetString("NOMBRE_FOTO")))
|
|
fotox = Bit.InputStreamToBytes(File.OpenInput(Dirp&Dir&Dir2,d.GetString("NOMBRE_FOTO")))
|
|
cmd.Initialize
|
|
cmd.Name = "insert_promotoria_INTMEX"
|
|
cmd.Parameters = Array As Object(Starter.almacen, e.GetString("RUTA"),B4XPages.MainPage.user,d.GetString("CLIENTE"),d.GetString("CATEGORIA"),d.GetString("PREGUNTA1"),d.GetString("COMENTARIOS"),fotox,c.GetString("latitud"),c.GetString("longitud"), Starter.latitud, Starter.longitud)
|
|
B4XPages.MainPage.reqManager.ExecuteCommand(cmd, $"insert_promotoria_${d.GetString("CLIENTE")}_${d.GetString("CATEGORIA")}"$)
|
|
Next
|
|
|
|
c.Close
|
|
d.Close
|
|
e.Close
|
|
timer2.Enabled = False
|
|
End Sub
|
|
|
|
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage. |