Descarga FActuras Rep Productos Servicios
This commit is contained in:
@@ -73,6 +73,22 @@
|
|||||||
</li>
|
</li>
|
||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
</asp:UpdatePanel>
|
</asp:UpdatePanel>
|
||||||
|
|
||||||
|
<asp:UpdatePanel ID="UpDescargaZipPDF" runat="server" UpdateMode="Conditional">
|
||||||
|
<ContentTemplate>
|
||||||
|
<li>
|
||||||
|
<asp:LinkButton ID="BtnDescargarZipPDF" runat="server"> <i class="fa fa-cloud-download"></i> Descargar Facturas</asp:LinkButton>
|
||||||
|
</li>
|
||||||
|
</ContentTemplate>
|
||||||
|
<Triggers>
|
||||||
|
<asp:PostBackTrigger ControlID= "BtnDescargarZipPDF" />
|
||||||
|
</Triggers>
|
||||||
|
</asp:UpdatePanel>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
<asp:Content ID="Content4" ContentPlaceHolderID="E" runat="Server">
|
<asp:Content ID="Content4" ContentPlaceHolderID="E" runat="Server">
|
||||||
Reporte de Productos Servicios
|
Reporte de Productos Servicios
|
||||||
@@ -294,7 +310,9 @@
|
|||||||
</asp:UpdatePanel>
|
</asp:UpdatePanel>
|
||||||
<asp:UpdatePanel ID="UPDatos" runat="server" UpdateMode="Conditional">
|
<asp:UpdatePanel ID="UPDatos" runat="server" UpdateMode="Conditional">
|
||||||
<ContentTemplate>
|
<ContentTemplate>
|
||||||
<asp:GridView ID="GvDatos" runat="server" Width="99%" AutoGenerateColumns="False" EmptyDataText="No se encontraron Ventas con los filtros especificados" ToolTip="Listado de Ventas" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" GridLines="None">
|
|
||||||
|
<asp:GridView ID="GvDatos" runat="server" Width="99%" AutoGenerateColumns="False" EmptyDataText="No se encontraron Ventas con los filtros especificados" ToolTip="Listado de Ventas"
|
||||||
|
CssClass="table table-striped table-advance table-hover Widthall ScrollAD" GridLines="None" DataKeyNames="TipoDocumento,SerieFolio" >
|
||||||
<Columns>
|
<Columns>
|
||||||
<asp:HyperLinkField HeaderText="Serie Folio" DataTextField="SerieFolio" Target="_blank" DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="~/Ventas/Ventas.aspx?CveVenta={0}" ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Left" />
|
<asp:HyperLinkField HeaderText="Serie Folio" DataTextField="SerieFolio" Target="_blank" DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="~/Ventas/Ventas.aspx?CveVenta={0}" ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Left" />
|
||||||
<asp:BoundField HeaderText="Fecha" DataField="Fecha" DataFormatString="{0:d}" ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Center" />
|
<asp:BoundField HeaderText="Fecha" DataField="Fecha" DataFormatString="{0:d}" ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Center" />
|
||||||
@@ -316,6 +334,7 @@
|
|||||||
<RowStyle CssClass="Texto" />
|
<RowStyle CssClass="Texto" />
|
||||||
<HeaderStyle CssClass="Titulos" />
|
<HeaderStyle CssClass="Titulos" />
|
||||||
</asp:GridView>
|
</asp:GridView>
|
||||||
|
|
||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
</asp:UpdatePanel>
|
</asp:UpdatePanel>
|
||||||
<asp:UpdatePanel runat="server" ID="UPPersonalizar" UpdateMode="Conditional">
|
<asp:UpdatePanel runat="server" ID="UPPersonalizar" UpdateMode="Conditional">
|
||||||
|
|||||||
@@ -2,12 +2,14 @@
|
|||||||
Option Strict On
|
Option Strict On
|
||||||
|
|
||||||
Imports System.Data
|
Imports System.Data
|
||||||
|
Imports System.IO
|
||||||
Imports Extensiones
|
Imports Extensiones
|
||||||
Imports Microsoft.Reporting.WebForms
|
Imports Microsoft.Reporting.WebForms
|
||||||
|
Imports System.IO.Compression
|
||||||
|
|
||||||
Partial Class Ventas_RepProductosServiciosDetalle
|
Partial Class Ventas_RepProductosServiciosDetalle
|
||||||
Inherits ClsPaginas
|
Inherits ClsPaginas
|
||||||
|
|
||||||
#Region "PROPIEDADES"
|
#Region "PROPIEDADES"
|
||||||
Private Property TmpDT As DataTable
|
Private Property TmpDT As DataTable
|
||||||
Get
|
Get
|
||||||
@@ -57,9 +59,9 @@ Partial Class Ventas_RepProductosServiciosDetalle
|
|||||||
Set(value As String)
|
Set(value As String)
|
||||||
ViewState("Agrupador") = value
|
ViewState("Agrupador") = value
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||||
If Not IsPostBack Then
|
If Not IsPostBack Then
|
||||||
|
|
||||||
@@ -68,11 +70,11 @@ Partial Class Ventas_RepProductosServiciosDetalle
|
|||||||
CargaParametrosDetalle()
|
CargaParametrosDetalle()
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
#Region " CARGA DATOS INICIALES "
|
#Region " CARGA DATOS INICIALES "
|
||||||
|
|
||||||
Private Sub CargaGrupo()
|
Private Sub CargaGrupo()
|
||||||
DdlGrupo.Items.Insert(0, New ListItem("Categoria", "3"))
|
DdlGrupo.Items.Insert(0, New ListItem("Categoria", "3"))
|
||||||
DdlGrupo.Items.Insert(1, New ListItem("Clasificacion", "4"))
|
DdlGrupo.Items.Insert(1, New ListItem("Clasificacion", "4"))
|
||||||
@@ -382,9 +384,9 @@ Partial Class Ventas_RepProductosServiciosDetalle
|
|||||||
DdlTipoPSDes.SelectedValueExist(CveClasificacionDetalle)
|
DdlTipoPSDes.SelectedValueExist(CveClasificacionDetalle)
|
||||||
CargaDatos(CveProyecto, CveSubProyecto, CveCategoria, CveClasificacion, CvePS, Mes, MesEjec, CveCliente, CveSubProyectoEjecucion, CveVendedor, CveUsuario, CveEstatus, GPO.ToEntero, TipoDocto, CveMarca)
|
CargaDatos(CveProyecto, CveSubProyecto, CveCategoria, CveClasificacion, CvePS, Mes, MesEjec, CveCliente, CveSubProyectoEjecucion, CveVendedor, CveUsuario, CveEstatus, GPO.ToEntero, TipoDocto, CveMarca)
|
||||||
CargarMarcas(CveMarca)
|
CargarMarcas(CveMarca)
|
||||||
End Sub
|
End Sub
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region " CARGA DATOS "
|
#Region " CARGA DATOS "
|
||||||
Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click
|
Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click
|
||||||
CargaDatos()
|
CargaDatos()
|
||||||
@@ -465,11 +467,11 @@ Partial Class Ventas_RepProductosServiciosDetalle
|
|||||||
End If
|
End If
|
||||||
DdlMarcaPSDes.Items.Insert(0, New ListItem(" - ", "-1"))
|
DdlMarcaPSDes.Items.Insert(0, New ListItem(" - ", "-1"))
|
||||||
DdlMarcaPSDes.Items.FindByValue(CStr(CveMarca)).Selected = True
|
DdlMarcaPSDes.Items.FindByValue(CStr(CveMarca)).Selected = True
|
||||||
End Sub
|
End Sub
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region "TIPO CAMBIO"
|
#Region "TIPO CAMBIO"
|
||||||
|
|
||||||
Private Sub RblTipoCambio_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RblTipoCambio.SelectedIndexChanged
|
Private Sub RblTipoCambio_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RblTipoCambio.SelectedIndexChanged
|
||||||
TipoCambio = RblTipoCambio.SelectedValue.ToEntero
|
TipoCambio = RblTipoCambio.SelectedValue.ToEntero
|
||||||
If RblTipoCambio.SelectedValue.ToEntero = 3 Then
|
If RblTipoCambio.SelectedValue.ToEntero = 3 Then
|
||||||
@@ -481,10 +483,10 @@ Partial Class Ventas_RepProductosServiciosDetalle
|
|||||||
LiEspecifico.Visible = False
|
LiEspecifico.Visible = False
|
||||||
End If
|
End If
|
||||||
UpBodyTipoCambio.Update()
|
UpBodyTipoCambio.Update()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region " GV DATOS - PERSONALIZAR "
|
#Region " GV DATOS - PERSONALIZAR "
|
||||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
||||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||||
@@ -545,11 +547,11 @@ Partial Class Ventas_RepProductosServiciosDetalle
|
|||||||
|
|
||||||
CargaDatos()
|
CargaDatos()
|
||||||
UPDatos.Update()
|
UPDatos.Update()
|
||||||
End Sub
|
End Sub
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region " SELECTED INDEX CHANGED"
|
#Region " SELECTED INDEX CHANGED"
|
||||||
|
|
||||||
Protected Sub DdlClienteClasificacion_SelectedIndexChanged(sender As Object, e As EventArgs)
|
Protected Sub DdlClienteClasificacion_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||||
CargaClientes()
|
CargaClientes()
|
||||||
End Sub
|
End Sub
|
||||||
@@ -641,17 +643,17 @@ Partial Class Ventas_RepProductosServiciosDetalle
|
|||||||
End If
|
End If
|
||||||
DdlEstatus.Items.Add(New ListItem("Todos", "-1"))
|
DdlEstatus.Items.Add(New ListItem("Todos", "-1"))
|
||||||
DdlEstatus.DataBind()
|
DdlEstatus.DataBind()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region " EXCEL "
|
#Region " EXCEL "
|
||||||
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
|
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
|
||||||
GvDatos.ExportToExcel("ReporteProductosServicios" & Now.ToShortDateString)
|
GvDatos.ExportToExcel("ReporteProductosServicios" & Now.ToShortDateString)
|
||||||
End Sub
|
End Sub
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region " PDF "
|
#Region " PDF "
|
||||||
Protected Sub ImgImprimir_Click(sender As Object, e As EventArgs) Handles ImgImprimir.Click
|
Protected Sub ImgImprimir_Click(sender As Object, e As EventArgs) Handles ImgImprimir.Click
|
||||||
ImprimirReporte()
|
ImprimirReporte()
|
||||||
@@ -684,11 +686,11 @@ Partial Class Ventas_RepProductosServiciosDetalle
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
ObjVentas.Dispose()
|
ObjVentas.Dispose()
|
||||||
End Sub
|
End Sub
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region "GRAFICA"
|
#Region "GRAFICA"
|
||||||
|
|
||||||
Protected Sub LnkVerGrafica_Click(sender As Object, e As EventArgs)
|
Protected Sub LnkVerGrafica_Click(sender As Object, e As EventArgs)
|
||||||
If Not TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 Then
|
If Not TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 Then
|
||||||
Alert("No hay datos disponibles", TipoMensaje.MsgAdvertencia)
|
Alert("No hay datos disponibles", TipoMensaje.MsgAdvertencia)
|
||||||
@@ -818,9 +820,74 @@ Partial Class Ventas_RepProductosServiciosDetalle
|
|||||||
|
|
||||||
Protected Sub DdlVer_SelectedIndexChanged(sender As Object, e As EventArgs)
|
Protected Sub DdlVer_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||||
CambioGrafica()
|
CambioGrafica()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
|
#Region " D E S C A R G A S "
|
||||||
|
|
||||||
|
Private Sub BtnDescargarPDF_Click(sender As Object, e As EventArgs) Handles BtnDescargarZipPDF.Click
|
||||||
|
|
||||||
|
|
||||||
|
'If Not Directory.Exists(AppDomain.CurrentDomain.BaseDirectory & "Temp\" & UsuarioActual.CveUsuario.ToString & "\") Then
|
||||||
|
' Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory & "Temp\" & UsuarioActual.CveUsuario.ToString & "\")
|
||||||
|
'End If
|
||||||
|
|
||||||
|
|
||||||
|
Dim Archivo As String = String.Empty
|
||||||
|
Dim HuboInexistentes As Boolean = False
|
||||||
|
Dim SBInexistentes As New StringBuilder : SBInexistentes.Append("No se pudieron anexar los siguientes archivos:<br />")
|
||||||
|
|
||||||
|
Dim ArchivoDestino As String = String.Format("{0}Temp\{1}.zip", AppDomain.CurrentDomain.BaseDirectory, Now.ToString("yyyyMMddhhmmss") & UsuarioActual.CveUsuario.ToString)
|
||||||
|
|
||||||
|
Dim archiveZip As ZipArchive = ZipFile.Open(ArchivoDestino, ZipArchiveMode.Create)
|
||||||
|
|
||||||
|
Dim DTVentas As DataTable = TmpDT.FiltraParametros("", "", {"CveVenta", "TipoDocumento", "Folio", "SerieFolio"})
|
||||||
|
|
||||||
|
Try
|
||||||
|
|
||||||
|
For Each Drow As DataRow In DTVentas.Rows
|
||||||
|
|
||||||
|
Dim SerieFolio As String = Drow("SerieFolio").ToString.Replace("-", "_")
|
||||||
|
|
||||||
|
If Drow("TipoDocumento").ToString.Trim <> String.Empty Then
|
||||||
|
Archivo = String.Format("{0}PDF/{1}/{2}.pdf", UsuarioActual.Empresa.Ruta.Replace("\", "/"), Drow("TipoDocumento").ToString, Drow("SerieFolio").ToString)
|
||||||
|
If File.Exists(Archivo) Then
|
||||||
|
archiveZip.CreateEntryFromFile(Archivo, Drow("SerieFolio").ToString & ".pdf")
|
||||||
|
' Exit For
|
||||||
|
Else
|
||||||
|
HuboInexistentes = True
|
||||||
|
SBInexistentes.AppendFormat("Tipo {0}, Folio {1} - {2}<br />", Drow("TipoDocumento").ToString, SerieFolio, Archivo)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
|
||||||
|
End Try
|
||||||
|
|
||||||
|
archiveZip.Dispose()
|
||||||
|
|
||||||
|
|
||||||
|
Response.Clear()
|
||||||
|
Response.ContentType = "application/zip"
|
||||||
|
Response.AddHeader("content-disposition", $"attachment; filename=facturas{Now.ToString("yyyyMMddhhmmss")}.zip")
|
||||||
|
Response.TransmitFile(ArchivoDestino)
|
||||||
|
Response.Flush()
|
||||||
|
|
||||||
|
Try
|
||||||
|
File.Delete(ArchivoDestino)
|
||||||
|
Catch ex As Exception
|
||||||
|
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Response.End()
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
#End Region
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
Reference in New Issue
Block a user