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 #Region Project Attributes
#ApplicationLabel: ADM #ApplicationLabel: ADM
#VersionCode: 1 #VersionCode: 1
#VersionName: 5.12.06 #VersionName: 6.01.01
'SupportedOrientations possible values: unspecified, landscape or portrait. 'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait #SupportedOrientations: portrait
#CanInstallToExternalStorage: False #CanInstallToExternalStorage: False

View File

@@ -88,15 +88,15 @@ ModuleClosedNodes27=
ModuleClosedNodes28= ModuleClosedNodes28=
ModuleClosedNodes29= ModuleClosedNodes29=
ModuleClosedNodes3= ModuleClosedNodes3=
ModuleClosedNodes30= ModuleClosedNodes30=3,4,5,6,7,8,9,10,11,12,13,14
ModuleClosedNodes31= ModuleClosedNodes31=
ModuleClosedNodes32=15,16,17,18,19 ModuleClosedNodes32=15,16,17,18,19
ModuleClosedNodes4= ModuleClosedNodes4=
ModuleClosedNodes5= ModuleClosedNodes5=2
ModuleClosedNodes6= ModuleClosedNodes6=
ModuleClosedNodes7= ModuleClosedNodes7=
ModuleClosedNodes8= ModuleClosedNodes8=
ModuleClosedNodes9= 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 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 '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) '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) 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") ' Log("bitacora")
Private cmd As DBCommand Private cmd As DBCommand
cmd.Initialize 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 = "Fin Día" Then nombreCliente = "FIN DIA"
If eventob = "Carga día" Then nombreCliente = "CARGA DIA" If eventob = "Carga día" Then nombreCliente = "CARGA DIA"
If eventob = "Carga día suplencia" Then nombreCliente = traeRutasSup 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}')"$) 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 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"$) 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")}' "$) 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")) cmd.Parameters = Array As Object(finb, rutab, almacenb, usuariob, clienteb, "Inicia Venta", e.GetString("fechab"))
else if eventob = "No Venta" Then 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")) cmd.Parameters = Array As Object(finb, motivoNoVentab, motivoNoVisitab, rutab, almacenb, usuariob, clienteb, "Inicia Venta", e.GetString("fechab"))
End If End If
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") File.Copy(File.DirAssets,"mariana1.jpg",xui.DefaultFolder,"mariana1.jpg")
Provider.Initialize Provider.Initialize
s.Position=0 s.Position=0
p_tipopago.Top = 0 : p_tipopago.Left = 0
p_camara.Top = 0 : p_camara.Left = 0
If c.RowCount>0 Then If c.RowCount>0 Then
c.Position=0 c.Position=0
la_cuenta.Text = c.GetString("CAT_CL_CODIGO") la_cuenta.Text = c.GetString("CAT_CL_CODIGO")
@@ -2851,19 +2853,16 @@ Sub Camera1_Ready (Success As Boolean)
camEx.SetContinuousAutoFocus camEx.SetContinuousAutoFocus
camEx.CommitParameters camEx.CommitParameters
camEx.StartPreview camEx.StartPreview
Log(camEx.GetPreviewSize) ' Log(camEx.GetPreviewSize)
Else Else
ToastMessageShow("Cannot open camera.", True) ToastMessageShow("Cannot open camera.", True)
End If End If
End Sub End Sub
Sub Camera1_PictureTaken (Data() As Byte) Sub Camera1_PictureTaken (Data() As Byte)
If b_foto_inci.Text = "Foto tienda" Then If b_foto_inci.Text = "Foto tienda" Then
DateTime.DateFormat="ddMMyyyyHHmmss" DateTime.DateFormat="ddMMyyyyHHmmss"
fototomada = DateTime.Now & "_cliente.jpg" fototomada = DateTime.Now & "_tienda.jpg"
Dim filename As String = fototomada Dim filename As String = fototomada
Dim dir As String = File.DirInternal Dim dir As String = File.DirInternal
camEx.SavePictureToFile(Data, dir, filename) camEx.SavePictureToFile(Data, dir, filename)
@@ -2906,7 +2905,13 @@ Sub Camera1_PictureTaken (Data() As Byte)
img.WriteToStream(out, 100, "PNG") img.WriteToStream(out, 100, "PNG")
out.Close 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" b_foto_inci.Text = "Foto usuario"
ChangeCamera_Click ChangeCamera_Click
Else If b_foto_inci.Text = "Foto usuario" Then Else If b_foto_inci.Text = "Foto usuario" Then
@@ -2954,8 +2959,11 @@ Sub Camera1_PictureTaken (Data() As Byte)
img.WriteToStream(out, 100, "PNG") img.WriteToStream(out, 100, "PNG")
out.Close 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" b_foto_inci.Text = "Foto tienda"
ChangeCamera_Click ChangeCamera_Click
p_camara.Visible = False p_camara.Visible = False
@@ -2969,10 +2977,8 @@ Sub Camera1_PictureTaken (Data() As Byte)
End If End If
B4XPages.ShowPage("productos") B4XPages.ShowPage("productos")
End If End If
End Sub End Sub
Sub ChangeCamera_Click Sub ChangeCamera_Click
camEx.Release camEx.Release
frontCamera = Not(frontCamera) frontCamera = Not(frontCamera)

View File

@@ -30,6 +30,7 @@ Sub Class_Globals
Private stay_hh As String Private stay_hh As String
Private stay_mi As String Private stay_mi As String
Private stay_ss As String Private stay_ss As String
Dim bitacora As C_BItacora
End Sub End Sub
'You can add more parameters here. 'You can add more parameters here.
@@ -60,6 +61,7 @@ Sub B4XPage_Appear
ToastMessageShow("Es necesario tener el GPS encendido", True) ToastMessageShow("Es necesario tener el GPS encendido", True)
StartActivity(Starter.gps.LocationSettingsIntent) StartActivity(Starter.gps.LocationSettingsIntent)
End If End If
bitacora.Initialize("bitacora", "bitacora", Root, Starter.skmt, reqManager)
r_1.Checked = False r_1.Checked = False
r_2.Checked = False r_2.Checked = False
r_3.Checked = False r_3.Checked = False
@@ -102,10 +104,11 @@ Sub GUARDA_Click
Next Next
End If 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_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.ExecNonQuery("delete from pedido where pe_cliente in (Select CUENTA from cuentaa)")
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.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)") B4XPages.MainPage.skmt.ExecNonQuery("UPDATE kmt_info set gestion = 3 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
DateTime.TimeFormat = "HHmmss" DateTime.TimeFormat = "HHmmss"

View File

@@ -45,6 +45,8 @@ Sub Class_Globals
Dim giros As String Dim giros As String
Private L_Atiende As Label Private L_Atiende As Label
Private ET_Atiende As EditText Private ET_Atiende As EditText
Dim bitacora As C_BItacora
Dim reqManager As DBRequestManager
End Sub End Sub
'You can add more parameters here. '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 If File.Exists(ruta, "kmt.db") = False Then
File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db") File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
End If End If
reqManager.Initialize(Me, Starter.DBReqServer)
' skmt.Initialize(ruta,"kmt.db", True) ' skmt.Initialize(ruta,"kmt.db", True)
' p_camara.Height = Root.Height ' p_camara.Height = Root.Height
' p_camara.Width = Root.Width ' p_camara.Width = Root.Width
@@ -94,6 +97,7 @@ End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage. 'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
Sub B4XPage_Appear Sub B4XPage_Appear
bitacora.Initialize("bitacora", "bitacora", Root, Starter.skmt, reqManager)
et_direccion.Text = "" et_direccion.Text = ""
E_NOMBRE.Text = "" E_NOMBRE.Text = ""
ET_Atiende.Text = "" ET_Atiende.Text = ""
@@ -125,6 +129,14 @@ Sub B4XPage_Appear
Starter.GPS.Start(0, 0) Starter.GPS.Start(0, 0)
' If Starter.ubicacionActual.Latitude <> 0 Then GPS_LocationChanged(Starter.ubicacionActual) ' If Starter.ubicacionActual.Latitude <> 0 Then GPS_LocationChanged(Starter.ubicacionActual)
End If 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") CallSubDelayed(Tracker, "StartFLPSmall")
c = Starter.skmt.ExecQuery("SELECT GIRO FROM CAT_GIRO order by 1") c = Starter.skmt.ExecQuery("SELECT GIRO FROM CAT_GIRO order by 1")
@@ -144,11 +156,12 @@ End Sub
Sub GPS_LocationChanged (Location1 As Location) Sub GPS_LocationChanged (Location1 As Location)
If B4XPages.MainPage.lat_gps <> "0.0" Then If B4XPages.MainPage.lat_gps <> "0.0" Then
Log("-- LOC CHANGED")
GUARDA.Visible = True 'Si hay ubicaccion, mostramos el boton de guardar. GUARDA.Visible = True 'Si hay ubicaccion, mostramos el boton de guardar.
l_sinUbicacion.Visible = True l_sinUbicacion.Visible = True
lat = Location1.Latitude lat = Location1.Latitude
lon = Location1.Longitude lon = Location1.Longitude
l_sinUbicacion.Text = ("Latitud: " & lat & ", Longotud: "& lon) l_sinUbicacion.Text = ("Latitud: " & lat & ", Longitud: "& lon)
End If End If
b_ubicacion.TextSize = 13 b_ubicacion.TextSize = 13
@@ -158,6 +171,7 @@ Sub GPS_LocationChanged (Location1 As Location)
b_ubicacion.TextSize = 16 b_ubicacion.TextSize = 16
b_ubicacion.Text = $"Mala señal $1.0{Location1.Accuracy} m"$ b_ubicacion.Text = $"Mala señal $1.0{Location1.Accuracy} m"$
End If End If
Log("Latitud: " & lat & " - " & "Longuitud: " & lon)
End Sub End Sub
Sub CANCELA_Click Sub CANCELA_Click
@@ -172,6 +186,7 @@ Sub GUARDA_Click
' Verifica si la dirección tiene más de 3 caracteres ' Verifica si la dirección tiene más de 3 caracteres
Else If et_direccion.Text.Length > 3 Then Else If et_direccion.Text.Length > 3 Then
' Verifica si la latitud es diferente de 0 ' Verifica si la latitud es diferente de 0
If lat <> 0 Then If lat <> 0 Then
' Verifica si el giro del cliente está seleccionado ' Verifica si el giro del cliente está seleccionado
If giros <> "SELECCIONA UNA OPCIÓN" Or cb_giro.SelectedItem <> "SELECCIONA UNA OPCIÓN" Then If giros <> "SELECCIONA UNA OPCIÓN" Or cb_giro.SelectedItem <> "SELECCIONA UNA OPCIÓN" Then
@@ -219,7 +234,9 @@ Sub GUARDA_Click
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)) 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" ' fototomada = "0"
B4XPages.ShowPage("Cliente") 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 Else
' Mensaje de advertencia si ET_Atiende.Text está vacío ' Mensaje de advertencia si ET_Atiende.Text está vacío
MsgboxAsync("Por favor, debe capturar al encargado que atiende el negocio.","Atención") MsgboxAsync("Por favor, debe capturar al encargado que atiende el negocio.","Atención")

View File

@@ -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","","", "") 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 Else if e_ruta.Text <> "" Then
Log("-- BB") 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 End If
Panel11.Visible = False Panel11.Visible = False
' E_RUTA2.Text = "" ' E_RUTA2.Text = ""
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO RUTAA(RUTAA) VALUES(?)",Array As String(e_ruta.Text)) B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO RUTAA(RUTAA) VALUES(?)",Array As String(e_ruta.Text))
e_ruta.Text = "" e_ruta.Text = ""
End If End If
Job.Release Job.Release
End Sub End Sub

View File

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

Binary file not shown.

View File

@@ -194,3 +194,56 @@ Sub JobDone(Job As HttpJob)
Log(LastException) Log(LastException)
End Try End Try
End Sub 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

@@ -1616,3 +1616,14 @@ Sub traeUsarIntentBDWA As Boolean 'ignore
' Log($"cb_importarBDWA = ${BDWA}"$) ' Log($"cb_importarBDWA = ${BDWA}"$)
Return BDWA Return BDWA
End Sub 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