From fe1c2c1948841bafdbc57b50fb486b5c1b652623 Mon Sep 17 00:00:00 2001 From: AbrahamCastilloV Date: Fri, 12 Jan 2024 17:29:20 -0700 Subject: [PATCH 1/6] =?UTF-8?q?--Se=20modific=C3=B3=20contratos=20para=20q?= =?UTF-8?q?ue=20agregara=20Importe=20en=20d=C3=B3lares=20a=20Importe=20en?= =?UTF-8?q?=20ClsContratos,=20ImporteMax=20para=20los=20pesos=20e=20Import?= =?UTF-8?q?eMin=20para=20el=20anticipo.=20Se=20limpio=20el=20campo=20de=20?= =?UTF-8?q?DdlClientes=20al=20querer=20guardar=20un=20contrato=20nuevo.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Transportes/Boletos.aspx.vb | 2 +- Transportes/RepBoletos.aspx | 2 +- Transportes/RepContratos.aspx | 4 ++-- Transportes/RepContratos.aspx.vb | 17 ++++++++++++++--- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Transportes/Boletos.aspx.vb b/Transportes/Boletos.aspx.vb index 8958a0446..17c035f09 100644 --- a/Transportes/Boletos.aspx.vb +++ b/Transportes/Boletos.aspx.vb @@ -157,6 +157,7 @@ Partial Class Boletos Dim retorno As Integer = ObjTransporte.AddViajesPasajeros(CveViaje, DdlPartida.SelectedValue.ToEntero, DdlDestino.SelectedValue.ToEntero, Importe, AsientoSeleccionado.ToEntero, TxtNombre.Text, TxtVisa.Text, TxtCelular.Text, CBool(RblSexo.SelectedValue), TxtObservaciones.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) If retorno > 1 Then + Alert("Boleto generado correctamente") ObjTransporte.Commit() End If Catch ex As Exception @@ -164,7 +165,6 @@ Partial Class Boletos Alert($"No se pudo generar el boleto {ex}", TipoMensaje.MsgError) Finally ObjTransporte.Dispose() - Response.Redirect($"/Transportes/Boletos.aspx?CveViaje={CveViaje}") End Try End Sub diff --git a/Transportes/RepBoletos.aspx b/Transportes/RepBoletos.aspx index 5255ff9a3..382af7e19 100644 --- a/Transportes/RepBoletos.aspx +++ b/Transportes/RepBoletos.aspx @@ -94,7 +94,7 @@ + data-sort="true" DataKeyNames="CveContrato, DescripcionContrato, Ubicacion, FechaInicial, FechaFinal, CveCliente, CveTipoAF, Importe, ImporteMin, ImporteMax "> @@ -261,7 +261,7 @@
- +
diff --git a/Transportes/RepContratos.aspx.vb b/Transportes/RepContratos.aspx.vb index 3877a3cdb..a39ff2de3 100644 --- a/Transportes/RepContratos.aspx.vb +++ b/Transportes/RepContratos.aspx.vb @@ -47,6 +47,10 @@ Partial Class ListadoContratos TxtObservaciones.Text = "" TxtUbicacion.Text = "" DdlTransporte.SelectedValue = "" + DdlClientes.SelectedText = "" + TxtDolares.Text = "" + TxtPesos.Text = "" + TxtAnticipo.Text = "" BtnGuardar.Text = "Guardar" myModalLabel.InnerHtml = "Agregar Contrato" @@ -77,7 +81,7 @@ Partial Class ListadoContratos End If 'Agregar contrato If BtnGuardar.Text = "Guardar" Then - CveContratoHijo = ObjContratos.AddContratos("", TxtDescripcion.Text, "", UsuarioActual.CveProveedor, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, -1, -1, -1, -1, 0, CveContratoTipo:=2, CveContratosEstatus:=1, CveTipoAF:=DdlTransporte.SelectedValue.ToEntero) + CveContratoHijo = ObjContratos.AddContratos("", TxtDescripcion.Text, "", UsuarioActual.CveProveedor, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=2, CveContratosEstatus:=1, CveTipoAF:=DdlTransporte.SelectedValue.ToEntero) End If If CveContratoHijo > 0 Then @@ -87,7 +91,7 @@ Partial Class ListadoContratos 'Actualizar contrato If BtnGuardar.Text = "Editar" Then - retorno = ObjContratos.UpdateContratos(CveContrato, "", TxtDescripcion.Text, "", -1, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, -1, -1, -1, -1, 0, CveContratoTipo:=2, CveContratosEstatus:=1) + retorno = ObjContratos.UpdateContratos(CveContrato, "", TxtDescripcion.Text, "", -1, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=2, CveContratosEstatus:=1) End If If retorno Then @@ -100,8 +104,11 @@ Partial Class ListadoContratos TxtFechaRegreso.Text = "" TxtObservaciones.Text = "" TxtUbicacion.Text = "" - DdlClientes.SelectedValue = "" + DdlClientes.SelectedText = "" DdlTransporte.SelectedValue = "" + TxtDolares.Text = "" + TxtPesos.Text = "" + TxtAnticipo.Text = "" BtnGuardar.Text = "Guardar" Catch ex As Exception Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError) @@ -129,6 +136,10 @@ Partial Class ListadoContratos TxtObservaciones.Text = GvRow.DataKey("DescripcionContrato") TxtUbicacion.Text = GvRow.DataKey("Ubicacion") DdlTransporte.SelectedValue = GvRow.DataKey("CveTipoAF") + TxtDolares.Text = GvRow.DataKey("Importe") + TxtPesos.Text = GvRow.DataKey("ImporteMax") + TxtAnticipo.Text = GvRow.DataKey("ImporteMin") + If DateTime.TryParse(GvRow.DataKey("FechaInicial").ToString, fechaInicial) And DateTime.TryParse(GvRow.DataKey("FechaFinal").ToString, fechaFinal) Then TxtFechaSalida.Text = fechaInicial.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T") TxtFechaRegreso.Text = fechaFinal.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T") From 7c2d2f9102307c565b410c4a9c20a6d3d86c97b5 Mon Sep 17 00:00:00 2001 From: AbrahamCastilloV Date: Sat, 13 Jan 2024 10:12:26 -0700 Subject: [PATCH 2/6] =?UTF-8?q?--Se=20hizo=20publish=20a=20Stimulsoft=20pa?= =?UTF-8?q?ra=20poder=20correrlo=20de=20manera=20local.=20Se=20agreg=C3=B3?= =?UTF-8?q?=20a=20PA=5FTrans=5FViajesPasajerosGet=20la=20columna=20de=20Ag?= =?UTF-8?q?encia(NombreCorto-Empresas)=20y=20TelefonoAgencia(Telefono-Empr?= =?UTF-8?q?esas).=20Se=20agregaron=20esos=20campos=20a=20los=20param=C3=A9?= =?UTF-8?q?tros=20que=20van=20hacia=20la=20impresi=C3=B3n=20del=20boleto.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Transportes/RepBoletos.aspx | 2 +- Transportes/RepBoletos.aspx.vb | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Transportes/RepBoletos.aspx b/Transportes/RepBoletos.aspx index 382af7e19..27869d3d3 100644 --- a/Transportes/RepBoletos.aspx +++ b/Transportes/RepBoletos.aspx @@ -31,7 +31,7 @@
+ data-sort="true" DataKeyNames="Asiento,Nombre, Visa,Celular,Sexo,Estatus,Partida,Destino, Importe,FechaIng, Agencia, TelefonoAgencia"> diff --git a/Transportes/RepBoletos.aspx.vb b/Transportes/RepBoletos.aspx.vb index c658b7b15..adf167f18 100644 --- a/Transportes/RepBoletos.aspx.vb +++ b/Transportes/RepBoletos.aspx.vb @@ -88,20 +88,23 @@ Partial Class ListadoBoletos Protected Sub ImprimirBoleto(sender As Object, e As EventArgs) Dim dtResult As New DataTable() Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim Fecha As Date = GvRow.DataKey("FechaIng").ToDate + Dim Importe As Decimal = GvRow.DataKey("Importe").ToDecimal Dim params As New List(Of ReportParameter) From { New ReportParameter("Ruta", Ruta), New ReportParameter("Origen", GvRow.DataKey("Partida")), New ReportParameter("Destino", GvRow.DataKey("Destino")), - New ReportParameter("FechaSalida", "2024-01-03"), - New ReportParameter("HoraSalida", "17:00"), + New ReportParameter("FechaSalida", Fecha.ToShortDateString()), + New ReportParameter("HoraSalida", Fecha.ToString("HH:mm")), New ReportParameter("Nombre", GvRow.DataKey("Nombre")), New ReportParameter("Visa", GvRow.DataKey("Visa")), New ReportParameter("Celular", GvRow.DataKey("Celular")), - New ReportParameter("Importe", GvRow.DataKey("Importe")), + New ReportParameter("Importe", Math.Round(Importe, 2).ToString), New ReportParameter("TipoBoleto", "Tipo Boleto"), - New ReportParameter("Agencia", "Agencia"), - New ReportParameter("TelefonoAgencia", "Telefono Agencia") + New ReportParameter("Agencia", GvRow.DataKey("Agencia")), + New ReportParameter("TelefonoAgencia", GvRow.DataKey("TelefonoAgencia")), + New ReportParameter("Asiento", GvRow.DataKey("Asiento")) } ImprimirPDFStimul($"{UsuarioActual.Empresa.Ruta}Formatos\Boleto.mrt", dtResult, params, NombreArchivo:="Boleto") From 7f9914f0ca9f4275703f2153e7b5165fa061a86e Mon Sep 17 00:00:00 2001 From: AbrahamCastilloV Date: Sat, 13 Jan 2024 10:22:13 -0700 Subject: [PATCH 3/6] --Se reinician los valores de los TextBox --- Transportes/Boletos.aspx.vb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Transportes/Boletos.aspx.vb b/Transportes/Boletos.aspx.vb index 17c035f09..62774dc29 100644 --- a/Transportes/Boletos.aspx.vb +++ b/Transportes/Boletos.aspx.vb @@ -159,6 +159,12 @@ Partial Class Boletos If retorno > 1 Then Alert("Boleto generado correctamente") ObjTransporte.Commit() + DdlPartida.SelectedValue = "" + DdlDestino.SelectedValue = "" + TxtNombre.Text = "" + TxtVisa.Text = "" + TxtCelular.Text = "" + TxtObservaciones.Text = "" End If Catch ex As Exception ObjTransporte.RollBack() From 0a4d6811b0e1d18ebbf53fe23741207a4e6b5622 Mon Sep 17 00:00:00 2001 From: AbrahamCastilloV Date: Sat, 13 Jan 2024 10:25:28 -0700 Subject: [PATCH 4/6] -- --- Transportes/RepBoletos.aspx.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Transportes/RepBoletos.aspx.vb b/Transportes/RepBoletos.aspx.vb index adf167f18..55a6df615 100644 --- a/Transportes/RepBoletos.aspx.vb +++ b/Transportes/RepBoletos.aspx.vb @@ -100,7 +100,7 @@ Partial Class ListadoBoletos New ReportParameter("Nombre", GvRow.DataKey("Nombre")), New ReportParameter("Visa", GvRow.DataKey("Visa")), New ReportParameter("Celular", GvRow.DataKey("Celular")), - New ReportParameter("Importe", Math.Round(Importe, 2).ToString), + New ReportParameter("Importe", Math.Round(Importe, 1).ToString), New ReportParameter("TipoBoleto", "Tipo Boleto"), New ReportParameter("Agencia", GvRow.DataKey("Agencia")), New ReportParameter("TelefonoAgencia", GvRow.DataKey("TelefonoAgencia")), From 95292f428baccedf3f7440cf3549230d3eb9a048 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Sat, 13 Jan 2024 13:12:24 -0700 Subject: [PATCH 5/6] --fix de envio de correo de factura --- Ventas/Clientes.aspx.vb | 12 +++++++++++- Ventas/Ventas.aspx.vb | 29 ++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index 60219d322..4b8cb4d48 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -2137,7 +2137,17 @@ Partial Class Clientes Protected Sub BtnSendMail_Click(sender As Object, e As System.EventArgs) Handles BtnSendMail.Click Try - If HdnCveVenta.Value <> "-1" AndAlso HdnFolioVenta.Value <> "-1" Then + If HdnCveVenta.Value <> "-1" AndAlso HdnFolioVenta.Value <> "-1" Then + + Dim ArchivoPDF As String = String.Format("{0}/PDF/{1}/{2}.pdf", UsuarioActual.Empresa.Ruta, HdnTipoDocto.Value, HdnFolioVenta.Value) + 'REGENERAR EL PDF + If Not File.Exists(ArchivoPDF) Then + Try + GenerarPDFVenta(HdnCveVenta.Value.ToEntero(), AplicaPagare:="1", GuardarPDF:=True, RegenerarPDF:=True, DescargarArchivo:=False) + Catch ex As Exception + OnError("Ocurrió un error al regenerar el PDF", ex) + End Try + End If Dim ObjMail As New ClsSisMail() Dim Ruta As String = UsuarioActual.Empresa.Ruta diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index c26238a26..78638fa73 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -15556,7 +15556,7 @@ Partial Class Ventas 'TIMBRADO NUEVO Try - GenerarPDFVenta(Factura.CveVenta, AplicaPagare:="1", GuardarPDF:=True, RegenerarPDF:=True, DescargarArchivo:=False) + DescargarFactura(Factura.CveVenta, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, Regenerar:=True, strURLHOST:=strURLHOST) Catch ex As Exception OnError("Ocurrió un error al generar el PDF", ex) End Try @@ -33471,6 +33471,33 @@ Partial Class Ventas End If End Sub + + Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, CveUsuarioCreo As Integer, Optional GetBytes As Boolean = True, Optional Regenerar As Boolean = False, Optional strURLHOST As String = "") As Byte() + + If String.IsNullOrEmpty(strURLHOST) Then + strURLHOST = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port) + End If + + Dim Url As New Uri(String.Format("{0}/Compras/PopUpVerFactura.aspx?P={1}", strURLHOST, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1®ENERAR={1}", CveVenta, If(Regenerar, "1", "0"))))) + Dim File As Byte() = Nothing + Try + Using httpClient As New HttpClient() + httpClient.Timeout = New TimeSpan(0, 2, 0) + Using request As New HttpRequestMessage(HttpMethod.Get, Url) + request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CveUsuario={2}", CveEmpresa, DateTime.UtcNow.Ticks, CveUsuarioCreo))) + Dim response = httpClient.SendAsync(request).Result + If GetBytes AndAlso response.StatusCode = Net.HttpStatusCode.OK Then + File = response.Content.ReadAsByteArrayAsync().Result + End If + End Using + End Using + Catch ex As Exception + File = Nothing + OnError("Ocurrió un error al descargar la factura", ex) + End Try + + Return File + End Function Protected Sub LnkGenerarOC_Click(sender As Object, e As EventArgs) Response.Redirect($"~/OC/OC.aspx?CveCotizacion={Me.CveVenta}&Tipo=OC") End Sub From 37e0768e8e65ad441418108d6cc629800d07e648 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Sat, 13 Jan 2024 15:22:30 -0700 Subject: [PATCH 6/6] --si utiliza la funcionalida 109 generar el pdf en el mismo thread --- Ventas/Ventas.aspx.vb | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 04f557f2f..9282f899e 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -10370,12 +10370,17 @@ Partial Class Ventas If File.Exists(ArchivoXML) Then MensajeAlert.AppendFormat("", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", CveVenta, "XML", ObjFactura.SerieFolio, ObjFactura.TipoDocto))) End If + 'MANDA CORREO Try - 'MANDA CORREO - Dim strURLHOST As String = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port) Dim Factura As New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=False, CargaDTDetalle:=False, CargaDatosCliente:=False, CargaDatosRelacionados:=False, VerificaAlmacen:=False) - Dim Hilo As New System.Threading.Thread(Sub() GeneraPDFFactura(ChkEnviarFactura.Checked, Factura, UsuarioActual, strURLHOST)) - Hilo.Start() + 'SE SE VA UTILIZAR LA DESCARGA AUTOMATICA, NO GENERAR PDF A TRAVEZ DE UN THREAD + If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then + GeneraPDFFactura(ChkEnviarFactura.Checked, Factura, UsuarioActual, "", UsarDescargaDesdePopUpVerFactura:=False) + Else + Dim strURLHOST As String = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port) + Dim Hilo As New System.Threading.Thread(Sub() GeneraPDFFactura(ChkEnviarFactura.Checked, Factura, UsuarioActual, strURLHOST)) + Hilo.Start() + End If Catch ex As Exception OnError("Ocurrió un error al enviar el PDF", ex) End Try @@ -10383,11 +10388,8 @@ Partial Class Ventas 'PARA PRUEBAS, GENERAR PDF AUNQUE NO ESTE TIMBRADA If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then Try - 'MANDA CORREO - Dim strURLHOST As String = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port) Dim Factura As New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=False, CargaDTDetalle:=False, CargaDatosCliente:=False, CargaDatosRelacionados:=False, VerificaAlmacen:=False) - Dim Hilo As New System.Threading.Thread(Sub() GeneraPDFFactura(ChkEnviarFactura.Checked, Factura, UsuarioActual, strURLHOST)) - Hilo.Start() + GeneraPDFFactura(ChkEnviarFactura.Checked, Factura, UsuarioActual, "", UsarDescargaDesdePopUpVerFactura:=False) Catch ex As Exception OnError("Ocurrió un error al enviar el PDF", ex) End Try @@ -15549,14 +15551,28 @@ Partial Class Ventas #End Region #Region "¡ P D F R E P O R T V I E W E R !" - Private Sub GeneraPDFFactura(EnviaCorreo As Boolean, Factura As Modelos.Factura, UsuarioActual As Usuario, strURLHOST As String, Optional CorreoCRM As String = "") + ''' + ''' Generación y envío de correo de factura, UsarDescargaDesdePopUpVerFactura si se va realizar a travez de un thread + ''' + ''' + ''' + ''' + ''' + ''' + ''' + Private Sub GeneraPDFFactura(EnviaCorreo As Boolean, Factura As Modelos.Factura, UsuarioActual As Usuario, strURLHOST As String, Optional CorreoCRM As String = "", Optional UsarDescargaDesdePopUpVerFactura As Boolean = True) 'GUARDA PDF Dim LocalSerieFolio As String = String.Empty Dim LocalTipoDocto As String = String.Empty 'TIMBRADO NUEVO Try - DescargarFactura(Factura.CveVenta, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, Regenerar:=True, strURLHOST:=strURLHOST) + If UsarDescargaDesdePopUpVerFactura Then + DescargarFactura(Factura.CveVenta, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, Regenerar:=True, strURLHOST:=strURLHOST) + Else + GenerarPDFVenta(Factura.CveVenta, AplicaPagare:="1", GuardarPDF:=True, RegenerarPDF:=True, DescargarArchivo:=False) + End If + Catch ex As Exception OnError("Ocurrió un error al generar el PDF", ex) End Try @@ -16783,19 +16799,18 @@ Partial Class Ventas CargaPS(DdlClasificacion.SelectedValue.ToEntero(), Ddl) End If - If UsuarioActual.CveEmpresa.Contiene(186, 189) Then TxtPrecio.Focus() End If - UPPPS.Update() UpPS.Update() - If UsuarioActual.CveEmpresa = 189 Then + If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then AgregarPS() End If + End Sub Private Function CalculaPrecioSugerido(CvePSParametro As Integer, CveClasificacion As Integer, Optional CvePrecioListaSugerido As Integer = -1) As Modelos.MPrecioSugerido