Option Explicit On Option Strict On Imports Extensiones Imports Microsoft.Reporting.WebForms Imports System.Data Partial Class Ventas_RepArqueosDetalle Inherits ClsPaginas #Region "P R O P I E D A D E S" Private Property DtVentas As DataTable Get Return DirectCast(ViewState("DtVentas"), DataTable) End Get Set(value As DataTable) ViewState("DtVentas") = value End Set End Property Private Property DtCuentas As DataTable Get Return DirectCast(ViewState("DtCuentas"), DataTable) End Get Set(value As DataTable) ViewState("DtCuentas") = value End Set End Property #End Region Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then Dim CveSubProyecto As Integer = -1 Dim Fecha As DateTime = Now If Request("CveSubProyecto") IsNot Nothing Then CveSubProyecto = Request("CveSubProyecto").ToString().ToEntero() End If If Request("Fecha") IsNot Nothing Then Fecha = Request("Fecha").ToString().ToDate() End If CargaDatos(Fecha, CveSubProyecto) End If End Sub Private Sub CargaDatos(Fecha As DateTime, CveSubProyecto As Integer) LtlTitulo.Text = String.Format("Reporte de Arqueos Detalle: Fecha {0:dd/MM/yyyy}", Fecha) Dim ObjVentas As New ClsVentas() If ObjVentas.GetRepArqueosDetalle(Fecha, CveSubProyecto, UsuarioActual.CveEmpresa) Then DtVentas = ObjVentas.DataSetResultados.Tables(0).Copy() DtCuentas = ObjVentas.DataSetResultados.Tables(1).Copy() End If ObjVentas.Dispose() GvDatos.DataSource = DtVentas GvCuentas.DataSource = DtCuentas GvDatos.DataBind() GvCuentas.DataBind() UPDatos.Update() End Sub Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.DBCampo("SerieFolio") = "Total" Then e.Row.CssClass = "Totales" End If End If End Sub Protected Sub GvCuentas_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvCuentas.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.DBCampo("Folio") = "Total" Then e.Row.CssClass = "Totales" End If End If End Sub Protected Sub GeneraPDF(Formato As String) Dim params As List(Of ReportParameter) = New List(Of ReportParameter)() Dim Imagen As System.IO.FileInfo = New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) params.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToString())) params.Add(New ReportParameter("Encabezado", String.Format("Fecha:{0}", Request("Fecha").ToString().ToDate().ToString("dd/MM/yyyy")))) Dim lrds As List(Of ReportDataSource) = New List(Of ReportDataSource)() Dim rds As ReportDataSource = New ReportDataSource() rds.Name = "DataSet1" rds.Value = DtVentas Dim rds2 As ReportDataSource = New ReportDataSource() rds2.Name = "DataSet2" rds2.Value = DtCuentas lrds.Add(rds) lrds.Add(rds2) If Imagen.Exists Then params.Add(New ReportParameter("LogoPath", logouri)) Else params.Add(New ReportParameter("LogoPath", "")) End If ImprimirPDF("Empresas/Grales/Formatos/RepArqueosDetalle.rdlc", lrds, params, "Rep Arqueos Detalle", Formato) End Sub Protected Sub LnkPdf_Click(sender As Object, e As EventArgs) GeneraPDF("PDF") End Sub Protected Sub LnkExportar_Click(sender As Object, e As EventArgs) GeneraPDF("EXCEL") End Sub End Class