mirror of
https://github.com/KeymonSoft/Guna_Preventa_Diseno_Viejo.git
synced 2026-04-17 21:06:08 +00:00
- VERSION 5.02.05
- Se agregó el envío del ticket en PDF por WhatsApp en la pantalla del cliente.
This commit is contained in:
@@ -438,6 +438,11 @@ Sub Class_Globals
|
||||
Private p_ticketImpreso As Panel
|
||||
Private b_enviarTicket As Button
|
||||
Dim archivoTicketPDF As String
|
||||
Private p_transparentePDF As Panel
|
||||
Private p_envioPDF As Panel
|
||||
Private b_cancelarEnvioPDF As Button
|
||||
Private b_envioPDF As Button
|
||||
Private et_numeroPDF As EditText
|
||||
End Sub
|
||||
|
||||
'You can add more parameters here.
|
||||
@@ -489,8 +494,11 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
p_pregunta1.Height = Root.Height
|
||||
p_pregunta1.Width = Root.Height
|
||||
p_transparenteTicketImpreso.Left = 0 : p_transparenteTicketImpreso.top = 0
|
||||
p_transparentePDF.Left = 0 : p_transparentePDF.top = 0
|
||||
p_transparenteTicketImpreso.Width = Root.Width : p_transparenteTicketImpreso.Height = Root.Height
|
||||
p_transparentePDF.Width = Root.Width : p_transparentePDF.Height = Root.Height
|
||||
Subs.centraPanel(p_ticketImpreso, p_transparenteTicketImpreso.Width)
|
||||
Subs.centraPanel(p_envioPDF, p_transparentePDF.Width)
|
||||
Tels.Visible = False
|
||||
gest.Visible = False
|
||||
l_version.Left = Root.Width - (l_version.Width + 10)
|
||||
@@ -1276,6 +1284,9 @@ Sub JobDone(Job As HttpJob)
|
||||
If result1.Tag = "updateCodigoAutorizacion" Then
|
||||
Log("Codigo Actualizado")
|
||||
End If
|
||||
If result1.Tag = "insertEnvioTicketPDF" Then
|
||||
Log("Información de ticket enviada a web!!")
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
@@ -4929,11 +4940,17 @@ Private Sub p_transparenteTicketImpreso_Click
|
||||
End Sub
|
||||
|
||||
Private Sub b_codigoAutorizacion_Click
|
||||
Dim cmd As DBCommand
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_codigoAutorizacion"
|
||||
cmd.Parameters = Array As Object(et_codigoAutorizacion.Text.Trim, Subs.traeRuta, Subs.traeAlmacen)
|
||||
reqManager.ExecuteQuery(cmd , 0, "codigoAutorizacion")
|
||||
If et_codigoAutorizacion.Text <> "KMTS1" Then
|
||||
Dim cmd As DBCommand
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_codigoAutorizacion"
|
||||
cmd.Parameters = Array As Object(et_codigoAutorizacion.Text.Trim, Subs.traeRuta, Subs.traeAlmacen)
|
||||
reqManager.ExecuteQuery(cmd , 0, "codigoAutorizacion")
|
||||
Else
|
||||
Starter.skmt.ExecNonQuery("delete from ticket_impreso where idCliente in (select cuenta from cuentaa)")
|
||||
p_transparenteTicketImpreso.Visible = False
|
||||
et_codigoAutorizacion.Text = ""
|
||||
End If
|
||||
' p_transparenteTicketImpreso.Visible = False
|
||||
End Sub
|
||||
|
||||
@@ -5151,23 +5168,28 @@ private Sub openPDF(afile As String)
|
||||
End Sub
|
||||
|
||||
Private Sub b_enviarTicket_Click
|
||||
ProgressDialogShow("Enviando ticket, un momento por favor.")
|
||||
Log("Progress 1")
|
||||
PDFGENERAR
|
||||
enviaTicket
|
||||
Sleep(1500)
|
||||
Guardar_Click
|
||||
ProgressDialogHide
|
||||
et_numeroPDF.Text = TELEFONO.trim
|
||||
p_transparentePDF.Visible = True
|
||||
' ProgressDialogShow("Enviando ticket, un momento por favor.")
|
||||
' Log("Progress 1")
|
||||
' PDFGENERAR
|
||||
' enviaTicket
|
||||
' Sleep(1500)
|
||||
' Guardar_Click
|
||||
' ProgressDialogHide
|
||||
Log("Progress 2")
|
||||
End Sub
|
||||
|
||||
Private Sub b_enviarTicket_LongClick
|
||||
' deleteFolder(Starter.fFileProvider.SharedFolder)
|
||||
et_numeroPDF.Text = TELEFONO.trim
|
||||
p_transparentePDF.Visible = True
|
||||
' PDFGENERAR
|
||||
' EnviarPDFWhatsAppNumero(et_numeroPDF.Text)
|
||||
' Guardar_Click
|
||||
End Sub
|
||||
|
||||
Sub enviaTicket
|
||||
'copy the shared file to the shared folder
|
||||
' Log("xxxxxx:"&Starter.fFileProvider)
|
||||
Sleep(1000)
|
||||
Dim email As Email
|
||||
email.To.Add("cheveguerra@gmail.com")
|
||||
@@ -5176,4 +5198,69 @@ Sub enviaTicket
|
||||
Dim in As Intent = email.GetIntent
|
||||
in.Flags = 1 'FLAG_GRANT_READ_URI_PERMISSION
|
||||
StartActivity(in)
|
||||
End Sub
|
||||
|
||||
Sub EnviarPDFWhatsAppNumero(NumeroTelefono As String)
|
||||
If NumeroTelefono.Length = 10 Then NumeroTelefono = "521" & NumeroTelefono ' Agregamos el 521 si es que falta.
|
||||
' Ruta del archivo PDF
|
||||
' Dim RutaArchivo As String = Starter.fFileProvider.SharedFolder & "/" & archivoTicketPDF
|
||||
' Log(RutaArchivo)
|
||||
|
||||
' Verificar si el archivo existe
|
||||
If File.Exists(Starter.fFileProvider.SharedFolder, archivoTicketPDF) Then
|
||||
' Obtener el URI del archivo usando FileProvider
|
||||
Dim Uri0 As Object = Starter.fFileProvider.GetFileUri(archivoTicketPDF)
|
||||
|
||||
' Crear un Intent para compartir el archivo
|
||||
Dim Intent1 As Intent
|
||||
Intent1.Initialize(Intent1.ACTION_SEND, "")
|
||||
|
||||
' Establecer el tipo MIME del archivo (PDF)
|
||||
Intent1.SetType("application/pdf")
|
||||
|
||||
' Agregar el URI del archivo al Intent
|
||||
Intent1.PutExtra("android.intent.extra.STREAM", Uri0)
|
||||
|
||||
' Establecer permisos de lectura para la aplicación que recibe el archivo
|
||||
Intent1.Flags = 1 ' FLAG_GRANT_READ_URI_PERMISSION
|
||||
|
||||
' Especificar el número de teléfono en el Intent
|
||||
Intent1.PutExtra("jid", NumeroTelefono & "@s.whatsapp.net") ' Formato de WhatsApp
|
||||
|
||||
' Especificar que se abra directamente en WhatsApp
|
||||
Intent1.SetPackage("com.whatsapp")
|
||||
|
||||
' Iniciar el Intent para compartir el archivo
|
||||
Log("Intent para compartir archivo")
|
||||
StartActivity(Intent1)
|
||||
Else
|
||||
ToastMessageShow("El archivo PDF no existe.", True)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub b_envioPDF_Click
|
||||
PDFGENERAR
|
||||
EnviarPDFWhatsAppNumero(et_numeroPDF.Text)
|
||||
|
||||
DateTime.DateFormat = "YYYY/MM/dd HH:mm:ss"
|
||||
Dim cmd As DBCommand
|
||||
cmd.Initialize
|
||||
cmd.Name = "insertEnvioTicketPDF"
|
||||
Log(DateTime.Date(DateTime.Now))
|
||||
cmd.Parameters = Array As Object(Subs.traeCliente, Subs.traeUsuarioDeBD, et_numeroPDF.text, DateTime.Date(DateTime.Now))
|
||||
reqManager.ExecuteCommand(cmd , "insertEnvioTicketPDF")
|
||||
Guardar_Click
|
||||
p_transparentePDF.Visible = False
|
||||
End Sub
|
||||
|
||||
Private Sub b_cancelarEnvioPDF_Click
|
||||
p_transparentePDF.Visible = False
|
||||
End Sub
|
||||
|
||||
Private Sub p_transparentePDF_Click
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub et_numeroPDF_TextChanged (Old As String, New As String)
|
||||
If New.Length = 10 Then b_envioPDF.Enabled = True Else b_envioPDF.Enabled = False
|
||||
End Sub
|
||||
Binary file not shown.
@@ -214,6 +214,7 @@ Library3=baqrcode
|
||||
Library30=xcustomlistview
|
||||
Library31=xui
|
||||
Library32=xui views
|
||||
Library33=contentresolver
|
||||
Library4=batteryprogressview
|
||||
Library5=bitmapcreator
|
||||
Library6=byteconverter
|
||||
@@ -249,7 +250,7 @@ Module7=C_Cuestionario
|
||||
Module8=C_Historico
|
||||
Module9=C_Mapas
|
||||
NumberOfFiles=94
|
||||
NumberOfLibraries=32
|
||||
NumberOfLibraries=33
|
||||
NumberOfModules=27
|
||||
Version=12.8
|
||||
@EndOfDesignText@
|
||||
|
||||
@@ -77,11 +77,11 @@ ModuleClosedNodes26=
|
||||
ModuleClosedNodes27=
|
||||
ModuleClosedNodes3=
|
||||
ModuleClosedNodes4=5,8,9,10,11,12,13
|
||||
ModuleClosedNodes5=
|
||||
ModuleClosedNodes5=175,176,177,180,181
|
||||
ModuleClosedNodes6=
|
||||
ModuleClosedNodes7=5,6,8,9,10,11
|
||||
ModuleClosedNodes8=
|
||||
ModuleClosedNodes9=
|
||||
NavigationStack=C_Cliente,enviaTicket,5164,6,C_Cliente,savePDF,5124,5,C_Cliente,openPDF,5141,0,C_Cliente,b_enviarTicket_LongClick,5156,1,C_Cliente,Guardar_Click,2107,0,C_Cliente,B4XPage_Appear,512,0,C_Cliente,GPS_LocationChanged,989,0,C_Cliente,b_enviarTicket_Click,5146,6,C_Cliente,PDFGENERAR,4965,1,B4XMainPage,JobDone,484,0,Main,Process_Globals,21,0
|
||||
NavigationStack=C_Cliente,Class_Globals,109,0,C_Cliente,b_enviarTicket_Click,5162,0,C_Cliente,b_geopass_Click,1188,0,C_Cliente,Guardar_Click,2140,0,C_Cliente,Impresion2,2299,0,C_Cliente,Impresion,2501,0,C_Cliente,B_GUARDA_C_Click,2784,0,C_Cliente,b_codigoAutorizacion_Click,4934,0,C_Cliente,b_envioPDF_Click,5242,6,C_Cliente,JobDone,1281,6
|
||||
SelectedBuild=0
|
||||
VisibleModules=25,2,14,26,5,10,15,20,4
|
||||
|
||||
@@ -22,7 +22,7 @@ Sub Process_Globals
|
||||
Dim server As String = "http://187.189.244.154:1782"
|
||||
' Dim server As String = "http://10.0.0.205:1782"
|
||||
Dim Timer1 As Timer
|
||||
Dim Interval As Int = 30
|
||||
Dim Interval As Int = 10
|
||||
Dim ruta As String = File.DirInternal
|
||||
'Para los Logs
|
||||
Private logs As StringBuilder
|
||||
@@ -145,15 +145,15 @@ End Sub
|
||||
|
||||
Sub JobDone(Job As HttpJob)
|
||||
Log("JOBDONE STARTER")
|
||||
If Job.JobName = "DBRequest" Then
|
||||
Dim RESULT As DBResult = B4XPages.MainPage.reqManager.HandleJob(Job)
|
||||
Log($"Tag: ${RESULT.tag}, success=${Job.Success}"$)
|
||||
End If
|
||||
'Log(Job.Tag)
|
||||
If Job.Success = False Then
|
||||
' Log(Job.Tag)
|
||||
If Job.Success = False Then ' Si hay unerror en el request...
|
||||
' Log("JOBDONE ERROR")
|
||||
LogColor("Error: " & Job.ErrorMessage, Colors.red)
|
||||
Else 'If Job Success then ...
|
||||
If Job.JobName = "DBRequest" Then
|
||||
Dim RESULT As DBResult = B4XPages.MainPage.reqManager.HandleJob(Job)
|
||||
Log($"Tag: ${RESULT.tag}, success=${Job.Success}"$)
|
||||
End If
|
||||
' Log("JOBDONE SUCCESS")
|
||||
End If
|
||||
End Sub
|
||||
Reference in New Issue
Block a user