From 5e1407418967656a78e2dce6769ead1d3fecb024 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Tue, 12 May 2020 01:21:06 -0700 Subject: [PATCH] Correciones de descarga de archivos --- Compras/PopUpVerFactura.aspx.vb | 24 ++++++++++++++++++++++++ OI/CircularDetalleB.aspx.cs | 1 + OI/MinutaDetalle.aspx.cs | 2 +- Planeacion/CargarArchivo.aspx.vb | 1 + Ventas/PopUpBuscarFolio.aspx.vb | 6 ++++-- 5 files changed, 31 insertions(+), 3 deletions(-) diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index f5b7abb16..5d0a34f8c 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -130,6 +130,30 @@ Partial Class PopUpVerFactura Dim Path As String = String.Format("{0}Ventas\{1}\{2}", UsuarioActual.Empresa.Ruta, Request("RFC"), Request("FileV")) Dim Archivo As New System.IO.FileInfo(Path) + If Archivo.Exists Then + HttpContext.Current.Response.Clear() + HttpContext.Current.Response.ClearContent() + HttpContext.Current.Response.ContentType = If(IO.Path.GetExtension(Archivo.Name) = "xml", "application/xml", "application/pdf") + HttpContext.Current.Response.AppendHeader("Content-disposition", String.Format("attachment; filename={0}", Archivo.Name)) + HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString()) + HttpContext.Current.Response.TransmitFile(Path) + 'HttpContext.Current.Response.Flush() + HttpContext.Current.Response.End() + End If + Archivo = Nothing + + ElseIf Request("File") IsNot Nothing AndAlso Request("TipoDocto") IsNot Nothing AndAlso Request("TipoArchivo") IsNot Nothing Then + Dim Path As String = "" ' String.Format("{0}Ventas\{1}\{2}", UsuarioActual.Empresa.Ruta, Request("RFC"), Request("FileV")) + + Select Case Request("TipoArchivo") + Case "PDF" + Path = String.Format("{0}PDF\{1}\{2}", UsuarioActual.Empresa.Ruta, Request("TipoDocto"), Request("File")) + Case "XML" + Path = String.Format("{0}XML\{1}\{2}", UsuarioActual.Empresa.Ruta, Request("TipoDocto"), Request("File")) + End Select + + Dim Archivo As New System.IO.FileInfo(Path) + If Archivo.Exists Then HttpContext.Current.Response.Clear() HttpContext.Current.Response.ClearContent() diff --git a/OI/CircularDetalleB.aspx.cs b/OI/CircularDetalleB.aspx.cs index b779a7fe3..c2834be37 100644 --- a/OI/CircularDetalleB.aspx.cs +++ b/OI/CircularDetalleB.aspx.cs @@ -187,6 +187,7 @@ public partial class OI_CircularDetalleB : ClsPaginas } catch (Exception ex) { + ModExtensiones.OnError(this, "Ocurrió un error al obtener al archivo", ex); Filename = "-1"; } } diff --git a/OI/MinutaDetalle.aspx.cs b/OI/MinutaDetalle.aspx.cs index c99f72ace..ca90c9953 100644 --- a/OI/MinutaDetalle.aspx.cs +++ b/OI/MinutaDetalle.aspx.cs @@ -54,7 +54,7 @@ public partial class OI_MinutaDetalle : ClsPaginas LnkGuardar.Visible = false; using (ClsOIEventos oieve = new ClsOIEventos()) { - oieve.UpUsuarioseventosVisto(RCveEvento, UsuarioActual.CveUsuario); + oieve.UpUsuarioseventosVisto(RCveEvento, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa); } LoadMinuata(); } diff --git a/Planeacion/CargarArchivo.aspx.vb b/Planeacion/CargarArchivo.aspx.vb index 9cc1ebded..929ee65a1 100644 --- a/Planeacion/CargarArchivo.aspx.vb +++ b/Planeacion/CargarArchivo.aspx.vb @@ -1,4 +1,5 @@ Imports System.IO +Imports Extensiones Partial Class CargarArchivo Inherits ClsPaginas diff --git a/Ventas/PopUpBuscarFolio.aspx.vb b/Ventas/PopUpBuscarFolio.aspx.vb index d628ab5d6..f5dc1d44e 100644 --- a/Ventas/PopUpBuscarFolio.aspx.vb +++ b/Ventas/PopUpBuscarFolio.aspx.vb @@ -172,13 +172,15 @@ Partial Class PopUpBuscarFolio e.Row.FCLiteral("LtlSucursal").Text = String.Format("
{0}{1}
", Liga, e.Row.DBCampo("SubProyecto")) e.Row.FCLiteral("LtlEstatus").Text = String.Format("
{0}{1}
", Liga, e.Row.DBCampo("EstatusFactura")) e.Row.FCLiteral("LtlPedidoContrato").Text = String.Format("
{0}{1}
", Liga, e.Row.DBCampo("PedidoContrato")) + If IO.File.Exists($"{Ruta}XML\{e.Row.DBCampo("TipoDocto")}\{e.Row.DBCampo("Folio")}.xml") Then - e.Row.FCLiteral("LtlXML").Text = String.Format("
XML
", UsuarioActual.CveEmpresa, e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("Folio")) + e.Row.FCLiteral("LtlXML").Text = String.Format("
XML
", e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("Folio")) Else e.Row.FCLiteral("LtlXML").Text = "
" End If + If IO.File.Exists($"{Ruta}PDF\{e.Row.DBCampo("TipoDocto")}\{e.Row.DBCampo("Folio")}.pdf") Then - e.Row.FCLiteral("LtlPDF").Text = String.Format("
PDF
", UsuarioActual.CveEmpresa, e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("Folio")) + e.Row.FCLiteral("LtlPDF").Text = String.Format("
PDF
", e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("Folio")) Else e.Row.FCLiteral("LtlPDF").Text = "
" End If