Imports System.Data Imports Extensiones Imports Microsoft.Reporting.WebForms Partial Class AC_RepIngresos Inherits ClsPaginas #Region "PROPIEDADES" Private Property DtIngresos As DataTable Get Return CType(ViewState("DtIngresos"), DataTable) End Get Set(value As DataTable) ViewState("DtIngresos") = value End Set End Property #End Region Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If Not Page.IsPostBack Then TxtFechaCorte.Text = Date.Now.ToShortDateString CargaDatos() End If End Sub Private Sub CargaDatos() Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa) Dim Fecha = TxtFechaCorte.Text.ToDate.ToShortDateString If ObjAC.GetPresupuestoIngresosRep(UsuarioActual.Empresa.EjercicioActual, Fecha) Then DtIngresos = ObjAC.DtResultados Else DtIngresos = Nothing Alert("Ocurrio un error al cargar los datos del reporte.", TipoMensaje.MsgError) End If ObjAC.Dispose() GvIngresos.DataSource = DtIngresos GvIngresos.DataBind() UpIngresos.Update() End Sub Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) CargaDatos() End Sub #Region "I M P R I M I R " Protected Sub BtnImprimir_Click(sender As Object, e As ImageClickEventArgs) ImprimiReporte() End Sub Protected Sub ImprimiReporte() Dim params As New List(Of ReportParameter) params.Add(New ReportParameter("pEmp", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("pImg", New Uri(Server.MapPath(String.Format("~/Empresas/{0}/Logo.png", UsuarioActual.CveEmpresa))).AbsoluteUri)) ImprimirPDF("AC/Reportes/RepPresupuestoIngresos.rdlc", DtIngresos, params, "ReporteIngresos") End Sub #End Region #Region "O R D E N A M I E N T O" Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs) Dim Orden As String = "" Dim Campo As String = "" Dim Literal As Literal = Nothing Const OrdenInicial As String = "" Dim Arg(2) As String Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c) Campo = Arg(0) Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(",", "_")), Literal) If ViewState(String.Format("O{0}", Campo)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo)).ToString = String.Format("{0} DESC", Campo) Then ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo) Literal.Text = String.Format("") Else ViewState(String.Format("O{0}", Campo)) = String.Format("{0} DESC", Campo) Literal.Text = String.Format("") End If Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo)).ToString ViewState("Orden") = Orden CargaGrid(Orden) End Sub Protected Sub CargaGrid(Orden As String) Dim DV As DataView = Nothing DV = New DataView(DtIngresos, "", Orden, DataViewRowState.CurrentRows) If Orden <> String.Empty Then GvIngresos.DataSource = DV.ToTable() GvIngresos.DataBind() Else GvIngresos.DataSource = DtIngresos End If DV.Dispose() End Sub #End Region Protected Sub GvIngresos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvIngresos.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.DBCampo("CvePresupuestoIngreso") = "" Then e.Row.FCLabel("LabelFuenteRecaudacion").Text = "Total" e.Row.ControlStyle.BackColor = Drawing.Color.LightGray e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Center e.Row.Cells(0).Font.Bold() = True e.Row.Cells(1).Font.Bold() = True e.Row.Cells(2).Font.Bold() = True e.Row.Cells(3).Font.Bold() = True e.Row.Cells(4).Font.Bold() = True e.Row.Cells(5).Font.Bold() = True e.Row.Cells(6).Font.Bold() = True End If End If End Sub End Class