Option Explicit On Option Strict On Imports System.Data Imports Extensiones Imports Microsoft.Reporting.WebForms Partial Class Contabilidad_RepBalanceGeneralMensual Inherits ClsPaginas #Region " PROPIEDADES " Private Property DtDatos As DataTable Get DtDatos = DirectCast(ViewState("DtDatos"), DataTable) End Get Set(ByVal value As DataTable) ViewState("DtDatos") = value End Set End Property Private Property TipoReporte As Integer Get TipoReporte = ViewState("TipoReporte").ToString.ToEntero End Get Set(value As Integer) ViewState("TipoReporte") = 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 If UsuarioActual.Empresa.UsaAC Then TipoReporte = -1 Else TipoReporte = 1 tdTipoReporte.Visible = True End If DdlEjercicio.SelectedValue = Now.Year.ToString CargaDatos() End If End Sub Private Sub CargaDatos() Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa) TipoReporte = If(TipoReporte = -1, -1, DdlTipoReporte.SelectedValue.ToEntero) If ObjConta.GetBalanceGeneralMensual(DdlEjercicio.SelectedValue.ToEntero, TipoReporte, DdlSubtotales.SelectedValue.ToEntero) Then DtDatos = ObjConta.DtResultados Else DtDatos = Nothing Alert("Ocurrió un error al cargar los datos del balance general mensual", TipoMensaje.MsgError) End If ObjConta.Dispose() EscondeSubtotales() If DtDatos IsNot Nothing Then CargaGrid() End If End Sub Private Sub EscondeSubtotales() 'Esconde Trimestral GvDatos.Columns(4).Visible = False GvDatos.Columns(9).Visible = False GvDatos.Columns(14).Visible = False GvDatos.Columns(18).Visible = False 'Esconde Cuatrimestral GvDatos.Columns(6).Visible = False GvDatos.Columns(12).Visible = False GvDatos.Columns(19).Visible = False If DdlSubtotales.SelectedValue = "2" Then GvDatos.Columns(4).Visible = True GvDatos.Columns(9).Visible = True GvDatos.Columns(14).Visible = True GvDatos.Columns(18).Visible = True ElseIf DdlSubtotales.SelectedValue = "3" Then GvDatos.Columns(6).Visible = True GvDatos.Columns(12).Visible = True GvDatos.Columns(19).Visible = True End If End Sub Private Sub CargaGrid() GvDatos.DataSource = DtDatos GvDatos.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("CtaMayor").ToString.ToEntero = 5 Or e.Row.DBCampo("CtaMayor").ToString.ToEntero = 4 Then e.Row.FCHyperLink("HLEnero").Text = "" e.Row.FCHyperLink("HLFebrero").Text = "" e.Row.FCHyperLink("HLMarzo").Text = "" e.Row.FCHyperLink("HLAbril").Text = "" e.Row.FCHyperLink("HLMayo").Text = "" e.Row.FCHyperLink("HLJunio").Text = "" e.Row.FCHyperLink("HLJulio").Text = "" e.Row.FCHyperLink("HLAgosto").Text = "" e.Row.FCHyperLink("HLSeptiembre").Text = "" e.Row.FCHyperLink("HLOctubre").Text = "" e.Row.FCHyperLink("HLNoviembre").Text = "" e.Row.FCHyperLink("HLDiciembre").Text = "" End If 'AGRUPADOR DE CUENTAS If e.Row.DBCampo("CtaMayor").ToString.ToEntero = 4 Then e.Row.FCLabel("LbNombre").Font.Bold = True End If 'TITULO DE CUENTAS If e.Row.DBCampo("CtaMayor").ToString.ToEntero = 5 Then e.Row.FCLabel("LbNombre").Attributes.Add("style", "padding-left: 10px;") End If 'CUENTAS If e.Row.DBCampo("CtaMayor").ToString.ToEntero = 1 Then e.Row.FCLabel("LbNombre").Attributes.Add("style", "padding-left: 20px;") e.Row.FCHyperLink("HLEnero").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}", e.Row.DBCampo("Id"), String.Format("01/01/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte) e.Row.FCHyperLink("HLFebrero").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}", e.Row.DBCampo("Id"), String.Format("01/02/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte) e.Row.FCHyperLink("HLMarzo").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}", e.Row.DBCampo("Id"), String.Format("01/03/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte) e.Row.FCHyperLink("HLAbril").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}", e.Row.DBCampo("Id"), String.Format("01/04/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte) e.Row.FCHyperLink("HLMayo").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}", e.Row.DBCampo("Id"), String.Format("01/05/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte) e.Row.FCHyperLink("HLJunio").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}", e.Row.DBCampo("Id"), String.Format("01/06/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte) e.Row.FCHyperLink("HLJulio").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}", e.Row.DBCampo("Id"), String.Format("01/07/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte) e.Row.FCHyperLink("HLAgosto").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}", e.Row.DBCampo("Id"), String.Format("01/08/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte) e.Row.FCHyperLink("HLSeptiembre").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}", e.Row.DBCampo("Id"), String.Format("09/01/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte) e.Row.FCHyperLink("HLOctubre").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}", e.Row.DBCampo("Id"), String.Format("01/10/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte) e.Row.FCHyperLink("HLNoviembre").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}", e.Row.DBCampo("Id"), String.Format("01/11/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte) e.Row.FCHyperLink("HLDiciembre").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}", e.Row.DBCampo("Id"), String.Format("01/12/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte) e.Row.FCHyperLink("HLTrimestral1").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FI={1}&FF={2}&TP={3}", e.Row.DBCampo("Id"), String.Format("01/01/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/03/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte) e.Row.FCHyperLink("HLTrimestral2").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FI={1}&FF={2}&TP={3}", e.Row.DBCampo("Id"), String.Format("01/04/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/06/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte) e.Row.FCHyperLink("HLTrimestral3").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FI={1}&FF={2}&TP={3}", e.Row.DBCampo("Id"), String.Format("01/07/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/09/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte) e.Row.FCHyperLink("HLTrimestral4").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FI={1}&FF={2}&TP={3}", e.Row.DBCampo("Id"), String.Format("01/10/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/12/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte) e.Row.FCHyperLink("HLCuatrimestral1").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FI={1}&FF={2}&TP={3}", e.Row.DBCampo("Id"), String.Format("01/01/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/04/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte) e.Row.FCHyperLink("HLCuatrimestral2").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FI={1}&FF={2}&TP={3}", e.Row.DBCampo("Id"), String.Format("01/05/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/08/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte) e.Row.FCHyperLink("HLCuatrimestral3").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FI={1}&FF={2}&TP={3}", e.Row.DBCampo("Id"), String.Format("01/09/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/12/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte) End If 'TOTALES If e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then e.Row.Attributes.Add("style", "border-top: 1px solid;") e.Row.FCLabel("LbNombre").Attributes.Add("style", "padding-left: 10px;") e.Row.FCLabel("LbNombre").Font.Italic = True End If 'SUMAS If e.Row.DBCampo("CtaMayor").ToString.ToEntero = 6 Then e.Row.FCLabel("LbNombre").Font.Bold = True End If End If End Sub Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) CargaDatos() End Sub End Class