From d7d0ddf42c1e66363a1c1c1953a019433706312e Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 23 Jun 2022 07:22:48 -0700 Subject: [PATCH] -- descarga masiva --- Ventas/RepVentaDetalle.aspx.vb | 46 +++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/Ventas/RepVentaDetalle.aspx.vb b/Ventas/RepVentaDetalle.aspx.vb index a25b75f11..ba2f54221 100644 --- a/Ventas/RepVentaDetalle.aspx.vb +++ b/Ventas/RepVentaDetalle.aspx.vb @@ -907,7 +907,7 @@ Partial Class RepVentaDetalle TipoDocto = "Dev" End Select - pathPDF = Server.MapPath(String.Format("~/Empresas/{0}/PDF/{1}/{2}.pdf", UsuarioActual.CveEmpresa, TipoDocto, gvr.DataKey("SerieFolio").ToString)) + pathPDF = String.Format("{0}/PDF/{1}/{2}.pdf", UsuarioActual.Empresa.Ruta, TipoDocto, gvr.DataKey("SerieFolio").ToString) If IO.File.Exists(pathPDF) Then 'NO AGREGAR ARCHIVOS REPETIDOS @@ -924,27 +924,6 @@ Partial Class RepVentaDetalle Response.ContentType = "application/zip" Response.End() End Sub - Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, CveUsuarioCreo As Integer) As Byte() - Dim Url = New Uri(String.Format("{0}Compras/PopUpVerFactura.aspx?P={1}", "http://localhost:85/", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta)))) - Dim File As Byte() = Nothing - Try - Using httpClient = New HttpClient() - httpClient.Timeout = New TimeSpan(0, 15, 0) - Using request = 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 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 Private Sub BtnDescargarXML_Click(sender As Object, e As EventArgs) Handles BtnDescargarXML.Click Dim pathXML As String @@ -973,7 +952,7 @@ Partial Class RepVentaDetalle TipoDocto = "Dev" End Select - pathXML = Server.MapPath(String.Format("~/Empresas/{0}/XML/{1}/{2}.xml", UsuarioActual.CveEmpresa, TipoDocto, gvr.DataKey("SerieFolio").ToString)) + pathXML = String.Format("{0}XML/{1}/{2}.xml", UsuarioActual.Empresa.Ruta, TipoDocto, gvr.DataKey("SerieFolio").ToString) If IO.File.Exists(pathXML) Then 'NO AGREGAR ARCHIVOS REPETIDOS @@ -990,6 +969,27 @@ Partial Class RepVentaDetalle Response.ContentType = "application/zip" Response.End() End Sub + Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, CveUsuarioCreo As Integer) As Byte() + Dim Url = New Uri(String.Format("{0}Compras/PopUpVerFactura.aspx?P={1}", "http://localhost:85/", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta)))) + Dim File As Byte() = Nothing + Try + Using httpClient = New HttpClient() + httpClient.Timeout = New TimeSpan(0, 15, 0) + Using request = 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 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 Private Sub GenerarPDF(Optional Formato As String = "PDF") If DtVentas IsNot Nothing Then