VERSION 6.01.01

- Se cambia e envio de las fotos a una formma para guardarlas en disco y no en BD
- Se agrega la hora de inico a las NO Ventas de la Bitacora!
This commit is contained in:
2026-01-05 17:04:33 -06:00
parent 90373fa40d
commit 4ec4846e4e
11 changed files with 151 additions and 61 deletions

View File

@@ -1121,7 +1121,7 @@ Version=12.8
#Region Project Attributes
#ApplicationLabel: ADM
#VersionCode: 1
#VersionName: 5.12.06
#VersionName: 6.01.01
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: False

View File

@@ -88,15 +88,15 @@ ModuleClosedNodes27=
ModuleClosedNodes28=
ModuleClosedNodes29=
ModuleClosedNodes3=
ModuleClosedNodes30=
ModuleClosedNodes30=3,4,5,6,7,8,9,10,11,12,13,14
ModuleClosedNodes31=
ModuleClosedNodes32=15,16,17,18,19
ModuleClosedNodes4=
ModuleClosedNodes5=
ModuleClosedNodes5=2
ModuleClosedNodes6=
ModuleClosedNodes7=
ModuleClosedNodes8=
ModuleClosedNodes9=
NavigationStack=C_BItacora,b_Inicio_Fin_venta2_Click,136,0,C_Principal,JobDone,2029,2,Main,Activity_Create,26,0,Main,Globals,23,0,Diseñador Visual,principal.bal,-100,1,Main,Process_Globals,21,0,C_Principal,B4XPage_Appear,428,6,C_Principal,cargar_Click,890,0,C_Principal,Class_Globals,148,0,C_Principal,B4XPage_Created,232,6
NavigationStack=C_Cliente,Camera1_Ready,2849,0,CameraExClass,FindCamera,42,0,CameraExClass,SetDisplayOrientation,75,0,Starter,mandaForma,191,0,C_Cliente,Camera1_PictureTaken,2974,5,C_BItacora,Initialize,25,0,C_BItacora,Class_Globals,13,0,C_BItacora,B4XPage_Created,35,0,C_BItacora,mandaBitacora,36,0,C_NoVenta,GUARDA_Click,99,0,Main,Process_Globals,19,0
SelectedBuild=0
VisibleModules=2,14,30,5,6,15,32,4,31,18,27
VisibleModules=2,14,30,12,11,5,6,32,31,18,21,4

View File

@@ -41,7 +41,7 @@ End Sub
'En geocerca si mete la contraseña poner 0 en precision gps y si esta dentro de los 50 mts poner 1 y 2 para eventos que no lo ocupen
'Mandar fecha de sync(sysdate)
Sub mandaBitacora(fechab As String, usuariob As String, almacenb As String, rutab As String, eventob As String, clienteb As String, iniciob As String, finb As String, latitudb As String, longitudb As String, precisionb As String, motivoNoVentab As String, motivoNoVisitab As String, BAN_GEOB As String)
Log(motivoNoVisitab)
Log("=== " & motivoNoVisitab & "|" & eventob)
' Log("bitacora")
Private cmd As DBCommand
cmd.Initialize
@@ -57,7 +57,7 @@ Sub mandaBitacora(fechab As String, usuariob As String, almacenb As String, ruta
If eventob = "Fin Día" Then nombreCliente = "FIN DIA"
If eventob = "Carga día" Then nombreCliente = "CARGA DIA"
If eventob = "Carga día suplencia" Then nombreCliente = traeRutasSup
If eventob <> "Termina Venta" And eventob <> "No Venta" Then
If eventob <> "Termina Venta" Then
db.ExecNonQuery($"INSERT INTO BITACORAGPS (fechab, usuariob , almacenb , rutab , eventob , clienteb , iniciob , finb , latitudb, longitudb , precision , motivonoventa , motivonovisita, BAN_GEOB) VALUES ('${fechab}' ,'${usuariob}' , '${almacenb}' , '${rutab}' , '${eventob}' , '${clienteb}' , '${iniciob}' , '${finb}' , '${latitudb}' , '${longitudb}' , '${precisionb}' , '${motivoNoVentab}' , '${motivoNoVisitab}', '${BAN_GEOB}')"$)
Else
Private e As Cursor = db.ExecQuery($"select fechab from BITACORAGPS where usuariob = '${usuariob}' and almacenb = '${almacenb}' and rutab = '${rutab}' and clienteb = '${clienteb}' and eventob = 'Inicia Venta' order by fechab desc"$)
@@ -68,7 +68,8 @@ Sub mandaBitacora(fechab As String, usuariob As String, almacenb As String, ruta
db.ExecNonQuery($"update BITACORAGPS set finb = '${finb}' where rutab = '${rutab}' and almacenb = '${almacenb}' and usuariob = '${usuariob}' and clienteb = '${clienteb}' and fechab = '${e.GetString("fechab")}' "$)
cmd.Parameters = Array As Object(finb, rutab, almacenb, usuariob, clienteb, "Inicia Venta", e.GetString("fechab"))
else if eventob = "No Venta" Then
db.ExecNonQuery($"update BITACORAGPS set finb = '${finb}', motivonoventa = '${motivoNoVentab}', motivonovisita = '${motivoNoVisitab}' where rutab = '${rutab}' and almacenb = '${almacenb}' and usuariob = '${usuariob}' and clienteb = '${clienteb}' and fechab = '${e.GetString("fechab")}' "$)
Log("-- NV")
db.ExecNonQuery($"update BITACORAGPS set finb = '${finb}', iniciob = '${finb}', motivonoventa = '${motivoNoVentab}', motivonovisita = '${motivoNoVisitab}' where rutab = '${rutab}' and almacenb = '${almacenb}' and usuariob = '${usuariob}' and clienteb = '${clienteb}' and fechab = '${e.GetString("fechab")}' "$)
cmd.Parameters = Array As Object(finb, motivoNoVentab, motivoNoVisitab, rutab, almacenb, usuariob, clienteb, "Inicia Venta", e.GetString("fechab"))
End If
End If

View File

@@ -217,6 +217,8 @@ Private Sub B4XPage_Created (Root1 As B4XView)
File.Copy(File.DirAssets,"mariana1.jpg",xui.DefaultFolder,"mariana1.jpg")
Provider.Initialize
s.Position=0
p_tipopago.Top = 0 : p_tipopago.Left = 0
p_camara.Top = 0 : p_camara.Left = 0
If c.RowCount>0 Then
c.Position=0
la_cuenta.Text = c.GetString("CAT_CL_CODIGO")
@@ -2851,25 +2853,22 @@ Sub Camera1_Ready (Success As Boolean)
camEx.SetContinuousAutoFocus
camEx.CommitParameters
camEx.StartPreview
Log(camEx.GetPreviewSize)
' Log(camEx.GetPreviewSize)
Else
ToastMessageShow("Cannot open camera.", True)
End If
End Sub
Sub Camera1_PictureTaken (Data() As Byte)
If b_foto_inci.Text = "Foto tienda" Then
DateTime.DateFormat="ddMMyyyyHHmmss"
fototomada = DateTime.Now & "_cliente.jpg"
fototomada = DateTime.Now & "_tienda.jpg"
Dim filename As String = fototomada
Dim dir As String = File.DirInternal
camEx.SavePictureToFile(Data, dir, filename)
camEx.StartPreview 'restart preview
ToastMessageShow("Picture saved." & CRLF & "File size: " & File.Size(dir, filename), True)
Dim Dirp As String = File.DirInternal
Dim dir As String
Dim Dir2 As String
@@ -2881,7 +2880,7 @@ Sub Camera1_PictureTaken (Data() As Byte)
dir = ""
Log("creado en raiz")
End Try
Try
File.MakeDir(Dirp & dir,"/reduccion")
Dir2 = "/reduccion"
@@ -2890,23 +2889,29 @@ Sub Camera1_PictureTaken (Data() As Byte)
dir = ""
Log("creado en raiz")
End Try
DateTime.DateFormat = "MM/dd/yyyy"
DateTime.TimeFormat = "HH:mm:ss"
sDate = DateTime.Date(DateTime.Now)
sTime = DateTime.Time(DateTime.Now)
camEx.SavePictureToFile(Data, Dirp&dir, filename)
camEx.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)
Dim img As B4XBitmap = xui.LoadBitmapResize(File.DirInternal & dir, filename, 450, 600, True)
Dim out As OutputStream = File.OpenOutput(File.DirInternal & dir & Dir2, filename, False)
img.WriteToStream(out, 100, "PNG")
out.Close
Starter.skmt.ExecNonQuery2("INSERT INTO FOTOINICIAL (RUTAA, ALMACEN, LATITUD, LONGITUD, FECHAHORA, FOTO, USUARIO) VALUES (?,?,?,?,?,?,?)",Array As Object(LA_RUTA, ALMACEN, B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps, sDate & " " & sTime, File.ReadBytes(File.DirInternal & dir & Dir2, fototomada), Subs.traeUsuarioDeBD))
LogColor("Mandamos foto tienda: " & fototomada, Colors.red)
Log(dir)
Log(Dir2)
Log($"${Subs.traeAlmacen}, ${Subs.traeRuta}, ${Subs.traeCliente}, ${dir & Dir2 & "/" & fototomada}"$)
Starter.mandaForma(Subs.traeAlmacen, Subs.traeRuta, Subs.traeCliente, dir & Dir2 & "/" & fototomada)
' Starter.skmt.ExecNonQuery2("INSERT INTO FOTOINICIAL (RUTAA, ALMACEN, LATITUD, LONGITUD, FECHAHORA, FOTO, USUARIO) VALUES (?,?,?,?,?,?,?)",Array As Object(LA_RUTA, ALMACEN, B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps, sDate & " " & sTime, File.ReadBytes(File.DirInternal & dir & Dir2, fototomada), Subs.traeUsuarioDeBD))
b_foto_inci.Text = "Foto usuario"
ChangeCamera_Click
Else If b_foto_inci.Text = "Foto usuario" Then
@@ -2917,7 +2922,7 @@ Sub Camera1_PictureTaken (Data() As Byte)
camEx.SavePictureToFile(Data, dir, filename)
camEx.StartPreview 'restart preview
ToastMessageShow("Picture saved." & CRLF & "File size: " & File.Size(dir, filename), True)
Dim Dirp As String = File.DirInternal
Dim dir As String
Dim Dir2 As String
@@ -2929,7 +2934,7 @@ Sub Camera1_PictureTaken (Data() As Byte)
dir = ""
Log("creado en raiz")
End Try
Try
File.MakeDir(Dirp & dir,"/reduccion")
Dir2 = "/reduccion"
@@ -2938,24 +2943,27 @@ Sub Camera1_PictureTaken (Data() As Byte)
dir = ""
Log("creado en raiz")
End Try
DateTime.DateFormat = "MM/dd/yyyy"
DateTime.TimeFormat = "HH:mm:ss"
sDate = DateTime.Date(DateTime.Now)
sTime = DateTime.Time(DateTime.Now)
camEx.SavePictureToFile(Data, Dirp&dir, filename)
camEx.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)
Dim img As B4XBitmap = xui.LoadBitmapResize(File.DirInternal & dir, filename, 450, 600, True)
Dim out As OutputStream = File.OpenOutput(File.DirInternal & dir & Dir2, filename, False)
img.WriteToStream(out, 100, "PNG")
out.Close
LogColor("Mandamos foto usuario: " & fototomada, Colors.red)
Log($"${Subs.traeAlmacen}, ${Subs.traeRuta}, ${Subs.traeCliente}, ${dir & Dir2 & "/" & fototomada}"$)
Starter.mandaForma(Subs.traeAlmacen, Subs.traeRuta, Subs.traeCliente, dir & Dir2 & "/" & fototomada)
B4XPages.MainPage.skmt.ExecNonQuery2("UPDATE FOTOINICIAL set FOTO2 = ? where USUARIO = ? and RUTAA = ? and ALMACEN = ? ", Array As Object (File.ReadBytes(File.DirInternal & dir & Dir2, fototomada), Subs.traeUsuarioDeBD,LA_RUTA, ALMACEN ))
' B4XPages.MainPage.skmt.ExecNonQuery2("UPDATE FOTOINICIAL set FOTO2 = ? where USUARIO = ? and RUTAA = ? and ALMACEN = ? ", Array As Object (File.ReadBytes(File.DirInternal & dir & Dir2, fototomada), Subs.traeUsuarioDeBD,LA_RUTA, ALMACEN ))
b_foto_inci.Text = "Foto tienda"
ChangeCamera_Click
p_camara.Visible = False
@@ -2969,10 +2977,8 @@ Sub Camera1_PictureTaken (Data() As Byte)
End If
B4XPages.ShowPage("productos")
End If
End Sub
Sub ChangeCamera_Click
camEx.Release
frontCamera = Not(frontCamera)

View File

@@ -30,6 +30,7 @@ Sub Class_Globals
Private stay_hh As String
Private stay_mi As String
Private stay_ss As String
Dim bitacora As C_BItacora
End Sub
'You can add more parameters here.
@@ -60,6 +61,7 @@ Sub B4XPage_Appear
ToastMessageShow("Es necesario tener el GPS encendido", True)
StartActivity(Starter.gps.LocationSettingsIntent)
End If
bitacora.Initialize("bitacora", "bitacora", Root, Starter.skmt, reqManager)
r_1.Checked = False
r_2.Checked = False
r_3.Checked = False
@@ -101,12 +103,13 @@ Sub GUARDA_Click
B4XPages.MainPage.skmt.ExecNonQuery2("update cat_gunaprod set cat_gp_almacen = cat_gp_almacen + ? where cat_gp_id = ?", Array As Object(c.GetString("PE_CANT"),c.GetString("PE_PROID")))
Next
End If
' B4XPages.MainPage.skmt.ExecNonQuery("delete from pedido_cliente where pc_cliente in (Select CUENTA from cuentaa)")
' B4XPages.MainPage.skmt.ExecNonQuery("delete from pedido where pe_cliente in (Select CUENTA from cuentaa)")
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO NOVENTA (NV_CLIENTE,NV_FECHA,NV_USER,NV_MOTIVO,NV_COMM,NV_LAT,NV_LON) VALUES(?,?,?,?,?,?,?) ", Array As Object (cuenta,sDate & sTime, usuario, motivo,e_comm.text, B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps))
bitacora.mandaBitacora(Subs.fechanormal(DateTime.Now), Subs.traeUsuarioDeBD, Subs.traeAlmacen, Subs.traeRutaBitacora, "No Venta", Subs.traeCliente, Subs.fechanormal(DateTime.Now), Subs.fechanormal(DateTime.Now), B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps, 2, motivo, "", "")
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO NOVENTA (NV_CLIENTE,NV_FECHA,NV_USER,NV_MOTIVO,NV_COMM,NV_LAT,NV_LON) VALUES(?,?,?,?,?,?,?) ", Array As Object (cuenta,sDate & sTime, usuario, motivo,e_comm.text, B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps))
B4XPages.MainPage.skmt.ExecNonQuery("UPDATE kmt_info set gestion = 3 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
DateTime.TimeFormat = "HHmmss"
sTime=DateTime.Time(DateTime.Now)

View File

@@ -7,11 +7,11 @@ Version=11.5
Sub Class_Globals
Private Root As B4XView 'ignore
Private xui As XUI 'ignore
Dim g As GPS
Dim ruta As String
Dim c As Cursor
Dim CANCELA As Button
Dim GUARDA As Button
Dim cuenta As String
@@ -20,7 +20,7 @@ Sub Class_Globals
Dim sDate2,sTime2 As String
Dim no_cliente As String
Dim no_ruta As String
Dim r_4 As RadioButton
Dim E_NOMBRE As EditText
Dim tgl As Toggle
@@ -45,6 +45,8 @@ Sub Class_Globals
Dim giros As String
Private L_Atiende As Label
Private ET_Atiende As EditText
Dim bitacora As C_BItacora
Dim reqManager As DBRequestManager
End Sub
'You can add more parameters here.
@@ -62,6 +64,7 @@ Private Sub B4XPage_Created (Root1 As B4XView)
If File.Exists(ruta, "kmt.db") = False Then
File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
End If
reqManager.Initialize(Me, Starter.DBReqServer)
' skmt.Initialize(ruta,"kmt.db", True)
' p_camara.Height = Root.Height
' p_camara.Width = Root.Width
@@ -81,7 +84,7 @@ Private Sub B4XPage_Created (Root1 As B4XView)
Else
ToastMessageShow("Sin permisos de escritura!!!", 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
@@ -94,6 +97,7 @@ End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
Sub B4XPage_Appear
bitacora.Initialize("bitacora", "bitacora", Root, Starter.skmt, reqManager)
et_direccion.Text = ""
E_NOMBRE.Text = ""
ET_Atiende.Text = ""
@@ -117,7 +121,7 @@ Sub B4XPage_Appear
GUARDA.Visible = True 'Si hay ubicaccion, mostramos el boton de guardar.
l_sinUbicacion.Visible = True
End If
If Not(Starter.GPS.GPSEnabled) Then
ToastMessageShow("Debe Activar el GPS del Equipo.", True)
StartActivity(Starter.GPS.LocationSettingsIntent)
@@ -125,8 +129,16 @@ Sub B4XPage_Appear
Starter.GPS.Start(0, 0)
' If Starter.ubicacionActual.Latitude <> 0 Then GPS_LocationChanged(Starter.ubicacionActual)
End If
If Tracker.FLP.IsInitialized And Tracker.FLP.GetLastKnownLocation.IsInitialized Then
lat = Tracker.FLP.GetLastKnownLocation.Latitude
lon = Tracker.FLP.GetLastKnownLocation.Longitude
l_sinUbicacion.Text = ("Latitud: " & lat & ", Longitud: "& lon)
Log("Latitud: " & lat & " - " & "Longuitud: " & lon)
End If
CallSubDelayed(Tracker, "StartFLPSmall")
c = Starter.skmt.ExecQuery("SELECT GIRO FROM CAT_GIRO order by 1")
Dim Items As List
Items.Initialize
@@ -144,13 +156,14 @@ End Sub
Sub GPS_LocationChanged (Location1 As Location)
If B4XPages.MainPage.lat_gps <> "0.0" Then
Log("-- LOC CHANGED")
GUARDA.Visible = True 'Si hay ubicaccion, mostramos el boton de guardar.
l_sinUbicacion.Visible = True
lat = Location1.Latitude
lon = Location1.Longitude
l_sinUbicacion.Text = ("Latitud: " & lat & ", Longotud: "& lon)
l_sinUbicacion.Text = ("Latitud: " & lat & ", Longitud: "& lon)
End If
b_ubicacion.TextSize = 13
b_ubicacion.Text = $"Precisión GPS $1.0{Location1.Accuracy} m"$
If Location1.Accuracy > 200 Then
@@ -158,6 +171,7 @@ Sub GPS_LocationChanged (Location1 As Location)
b_ubicacion.TextSize = 16
b_ubicacion.Text = $"Mala señal $1.0{Location1.Accuracy} m"$
End If
Log("Latitud: " & lat & " - " & "Longuitud: " & lon)
End Sub
Sub CANCELA_Click
@@ -172,6 +186,7 @@ Sub GUARDA_Click
' Verifica si la dirección tiene más de 3 caracteres
Else If et_direccion.Text.Length > 3 Then
' Verifica si la latitud es diferente de 0
If lat <> 0 Then
' Verifica si el giro del cliente está seleccionado
If giros <> "SELECCIONA UNA OPCIÓN" Or cb_giro.SelectedItem <> "SELECCIONA UNA OPCIÓN" Then
@@ -210,16 +225,18 @@ Sub GUARDA_Click
c.Close
' Starter.skmt.ExecNonQuery2("INSERT INTO HIST_FOTO_CLIENTE(CODIGO, ALMACEN, RUTA) VALUES(?,?,?)", Array As Object(no_cliente, ALMACEN, no_ruta))
' Starter.skmt.ExecNonQuery2("INSERT INTO NOVENTA (NV_CLIENTE,NV_FECHA,NV_USER,NV_MOTIVO,NV_LAT,NV_LON,NV_NOMBRE,NV_DIRECCION) VALUES(?,?,?,?,?,?,?,?) ", Array As Object (no_cliente,sDate & sTime, usuario, "NUEVO CLIENTE", lat, lon, E_NOMBRE.Text,et_direccion.Text))
DateTime.DateFormat = "dd/MM/yyyy"
DateTime.Timeformat = "HH:mm:ss"
sDate2 = DateTime.Date(DateTime.Now)
sTime2 = DateTime.Time(DateTime.Now)
Starter.skmt.ExecNonQuery2("INSERT INTO CLIENTES_NUEVOS(CN_ID, CN_FECHA, CN_USER, CN_LAT, CN_LON, CN_NOMBRE, CN_DIRECCION, CN_FOTO, CN_RUTA, CN_GIRO, CN_SOLICITA) VALUES (?,?,?,?,?,?,?,?,?,?,?)", Array As String(no_cliente, sDate2 &" "&sTime2, usuario, lat, lon, E_NOMBRE.Text, et_direccion.Text, ALMACEN, no_ruta, cb_giro.SelectedItem, ET_Atiende.Text))
' fototomada = "0"
B4XPages.ShowPage("Cliente")
CallSubDelayed(Tracker, "StartFLP")
Log("-- XX")
bitacora.mandaBitacora(Subs.fechanormal(DateTime.Now), Subs.traeUsuarioDeBD, Subs.traeAlmacen, Subs.traeRutaBitacora, "Nuevo Cliente", Subs.traeCliente, "", Subs.fechanormal(DateTime.Now), B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps, 2, "", "", "")
' CallSubDelayed(Tracker, "StartFLP")
Else
' Mensaje de advertencia si ET_Atiende.Text está vacío
MsgboxAsync("Por favor, debe capturar al encargado que atiende el negocio.","Atención")

View File

@@ -899,7 +899,7 @@ Sub cargar_Click
Subs.panelVisible(P1, 0, 0)
Subs.centraPanel(P1, Root.Width)
Subs.centraPanelV(P1, Root.Height)
' trabajar.Visible = False
' trabajar.Visible = False
NUEVO.Visible =False
BUSCA.Visible=False
connecta.Visible=False
@@ -1829,7 +1829,7 @@ Sub JobDone(Job As HttpJob)
Next
End If
End If
If Job.JobName = "DBRequest" Then
Dim RESULT As DBResult = reqManager.HandleJob(Job)
If RESULT.Tag = "valida_pedido" Then 'query tag
@@ -1846,7 +1846,7 @@ Sub JobDone(Job As HttpJob)
Next
End If
End If
If Job.JobName = "DBRequest" Then
Dim RESULT As DBResult = reqManager.HandleJob(Job)
If RESULT.Tag = "valida_pedidoc" Then 'query tag
@@ -1889,7 +1889,7 @@ Sub JobDone(Job As HttpJob)
Log("5")
End If
End If
If Job.JobName = "DBRequest" Then
Dim RESULT As DBResult = reqManager.HandleJob(Job)
If RESULT.Tag = "version" Then 'query tag
@@ -1900,7 +1900,7 @@ Sub JobDone(Job As HttpJob)
Next
End If
End If
If Job.JobName = "DBRequest" Then
Dim RESULT As DBResult = reqManager.HandleJob(Job)
If RESULT.Tag = "count_cli" Then 'query tag
@@ -1909,7 +1909,7 @@ Sub JobDone(Job As HttpJob)
Next
End If
End If
If Job.JobName = "DBRequest" Then
Dim RESULT As DBResult = reqManager.HandleJob(Job)
If RESULT.Tag = "ruta" Then 'query tag
@@ -1936,7 +1936,7 @@ Sub JobDone(Job As HttpJob)
Next
End If
End If
If Job.JobName = "DBRequest" Then
Dim RESULT As DBResult = reqManager.HandleJob(Job)
If RESULT.Tag = "usuario" Then 'query tag
@@ -1972,7 +1972,7 @@ Sub JobDone(Job As HttpJob)
Next
End If
End If
If Job.JobName = "DBRequest" Then
Dim RESULT As DBResult = reqManager.HandleJob(Job)
If RESULT.Tag = "hist_avance" Then 'query tag
@@ -1985,7 +1985,7 @@ Sub JobDone(Job As HttpJob)
Next
End If
End If
If Job.JobName = "DBRequest" Then
Dim RESULT As DBResult = reqManager.HandleJob(Job)
If RESULT.Tag = "select_abonosp" Then 'query tag
@@ -1998,7 +1998,7 @@ Sub JobDone(Job As HttpJob)
End If
End If
End If
If Job.JobName = "DBRequest" Then
Dim RESULT As DBResult = reqManager.HandleJob(Job)
If RESULT.Tag = "ins_cuestionario" Then 'query tag
@@ -2021,7 +2021,7 @@ Sub JobDone(Job As HttpJob)
Next
End If
End If
If Listo1 = 1 And Listo2 = 1 And Listo3 = 1 And Listo4 = 1 Then
'Para suplencia
If Panel11.Visible = True And E_RUTA2.Visible = True Then
@@ -2029,14 +2029,13 @@ Sub JobDone(Job As HttpJob)
bitacora.mandaBitacora(Subs.fechanormal(DateTime.Now),usuario,Subs.traeAlmacen, e_ruta.text,"Carga día suplencia","",Subs.fechanormal(DateTime.Now),Subs.fechanormal(DateTime.Now),B4XPages.MainPage.lat_gps,B4XPages.MainPage.lon_gps,"2","","", "")
Else if e_ruta.Text <> "" Then
Log("-- BB")
bitacora.mandaBitacora(Subs.fechanormal(DateTime.Now),usuario,Subs.traeAlmacen, Subs.traeRuta,"Carga día", "",Subs.fechanormal(DateTime.Now),Subs.fechanormal(DateTime.Now),B4XPages.MainPage.lat_gps,B4XPages.MainPage.lon_gps,"2","","", "")
bitacora.mandaBitacora(Subs.fechanormal(DateTime.Now),usuario,Subs.traeAlmacen, e_ruta.text,"Carga día", "",Subs.fechanormal(DateTime.Now),Subs.fechanormal(DateTime.Now),B4XPages.MainPage.lat_gps,B4XPages.MainPage.lon_gps,"2","","", "")
End If
Panel11.Visible = False
' E_RUTA2.Text = ""
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO RUTAA(RUTAA) VALUES(?)",Array As String(e_ruta.Text))
e_ruta.Text = ""
End If
Job.Release
End Sub

View File

@@ -42,17 +42,17 @@ Private Sub FindCamera (frontCamera As Boolean) As CameraInfoAndId
Dim ci As CameraInfoAndId
Dim cameraInfo As Object
Dim cameraValue As Int
Log("findCamera")
' Log("findCamera")
If frontCamera Then cameraValue = 1 Else cameraValue = 0
cameraInfo = r.CreateObject("android.hardware.Camera$CameraInfo")
Dim numberOfCameras As Int = r.RunStaticMethod("android.hardware.Camera", "getNumberOfCameras", Null, Null)
Log(r.target)
Log(numberOfCameras)
' Log(r.target)
' Log(numberOfCameras)
For i = 0 To numberOfCameras - 1
r.RunStaticMethod("android.hardware.Camera", "getCameraInfo", Array As Object(i, cameraInfo), _
Array As String("java.lang.int", "android.hardware.Camera$CameraInfo"))
r.target = cameraInfo
Log("facing: " & r.GetField("facing") & ", " & cameraValue)
' Log("facing: " & r.GetField("facing") & ", " & cameraValue)
If r.GetField("facing") = cameraValue Then
ci.cameraInfo = r.target
ci.Id = i
@@ -79,7 +79,7 @@ Private Sub SetDisplayOrientation
Else
previewResult = (orientation - degrees + 360) Mod 360
result = previewResult
Log(previewResult)
' Log(previewResult)
End If
r.target = nativeCam
r.RunMethod2("setDisplayOrientation", previewResult, "java.lang.int")

Binary file not shown.

View File

@@ -193,4 +193,57 @@ Sub JobDone(Job As HttpJob)
Catch
Log(LastException)
End Try
End Sub
Sub mandaForma(almacen_ As String, ruta_ As String, cliente_ As String, imagen_ As String)
' 1. Inicializa un nuevo HttpJob
Dim job As HttpJob
job.Initialize("", Me)
' 2. Define la URL del servidor
Dim url As String = "https://keymon.net/ADM/POST_IMAGEN.aspx"
' 3. Crea un Map para los campos de texto del formulario
Dim params As Map
params.Initialize
params.Put("Almacen", almacen_)
params.Put("Ruta", ruta_)
params.Put("Cliente", cliente_)
params.Put("btnUpload", "Subir Imagen") ' El botón de submit también envía su valor
' --- CAMPOS OCULTOS DE ASP.NET ---
' Estos valores suelen ser dinámicos. Para este ejemplo, los ponemos fijos.
' Si falla, es posible que primero necesites hacer un GET a la página para obtener los valores actualizados.
' params.Put("__VIEWSTATE", "/wEPDwUKMjA1ODU4NjY1MGRkhSExd19qC1l3GdX6jvTnbM9pxPQR8urGAvs76UsqsDU=")
' params.Put("__VIEWSTATEGENERATOR", "6050E242")
' params.Put("__EVENTVALIDATION", "/wEdAAX5q9hoCUC745WBVO+/1ZWhraEDRZI2xn7OC3a5LAUoRlfyZCZSVcs/gLubOxTf2dCyEN4makXuwRjezU2tU1hn5vhDofrSSRcWtmHPtJVt4HHStaEfV6fkOi3uRRJDHybxwaB9FuVcVFxi7uoxeGMX")
' 4. Crea una lista de archivos a subir
Dim files As List
files.Initialize
' Creamos el objeto MultipartFileData para nuestra imagen
' KeyName: Es el atributo "name" del input en HTML ("Imagen")
' ContentType: El tipo de archivo
Dim mfd As MultipartFileData = Subs.CreateMultipartFileData(File.DirInternal, imagen_, "Imagen", "image/jpeg")
files.Add(mfd)
' 5. Realiza la petición POST de tipo multipart
job.PostMultipart(url, params, files)
' 6. Espera a que el trabajo termine
Wait For (job) JobDone(job As HttpJob)
If job.Success Then
' El servidor respondió correctamente (HTTP 200 OK)
Log("Respuesta del servidor: " & job.GetString)
' MsgboxAsync("¡Imagen subida con éxito!", "Completado")
Else
' Hubo un error en la conexión o el servidor respondió con un error
Log("Error al subir la imagen: " & job.ErrorMessage)
' MsgboxAsync("Error: " & job.ErrorMessage, "Fallo")
End If
' Libera los recursos del job
job.Release
End Sub

View File

@@ -1615,4 +1615,15 @@ Sub traeUsarIntentBDWA As Boolean 'ignore
End If
' Log($"cb_importarBDWA = ${BDWA}"$)
Return BDWA
End Sub
' Función de ayuda para crear el objeto MultipartFileData de forma más limpia
Sub CreateMultipartFileData(Dir As String, FileName As String, KeyName As String, ContentType As String) As MultipartFileData
Dim mfd As MultipartFileData
mfd.Initialize
mfd.Dir = Dir
mfd.FileName = FileName
mfd.KeyName = KeyName
mfd.ContentType = ContentType
Return mfd
End Sub