Option Explicit On Option Strict On Imports System.Data Imports Extensiones Imports Microsoft.Reporting.WebForms Partial Class Contabilidad2_RepEstadoResultados Inherits ClsPaginas #Region " PROPIEDADES NORMAL " 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 DtIngresos As DataTable Get DtIngresos = DirectCast(ViewState("DtIngresos"), DataTable) End Get Set(ByVal value As DataTable) ViewState("DtIngresos") = value End Set End Property Private Property DtGastos As DataTable Get DtGastos = DirectCast(ViewState("DtGastos"), DataTable) End Get Set(ByVal value As DataTable) ViewState("DtGastos") = value End Set End Property Private Property TotalActual As Double Get TotalActual = ViewState("TotalActual").ToString.ToDouble End Get Set(value As Double) ViewState("TotalActual") = value End Set End Property Private Property TotalAnterior As Double Get TotalAnterior = ViewState("TotalAnterior").ToString.ToDouble End Get Set(value As Double) ViewState("TotalAnterior") = value End Set End Property Private Property FechaI As String Get Return ViewState("FechaI").ToString End Get Set(value As String) ViewState("FechaI") = value End Set End Property Private Property FechaF As String Get Return ViewState("FechaF").ToString End Get Set(value As String) ViewState("FechaF") = value End Set End Property Private Property ReporteComplementario As Boolean Get ReporteComplementario = CBool(ViewState("ReporteComplementario").ToString) End Get Set(value As Boolean) ViewState("ReporteComplementario") = value End Set End Property #End Region #Region " PROPIEDADES MENSUAL " Private Property DtDatosMensual As DataTable Get DtDatosMensual = DirectCast(ViewState("DtDatosMensual"), DataTable) End Get Set(ByVal value As DataTable) ViewState("DtDatosMensual") = value End Set End Property #End Region #Region " PROPIEDADES ANUAL " Private Property DtDatosAnual As DataTable Get DtDatosAnual = DirectCast(ViewState("DtDatosAnual"), DataTable) End Get Set(ByVal value As DataTable) ViewState("DtDatosAnual") = value End Set End Property Private Property Anos As Integer Get Anos = ViewState("Anos").ToString.ToEntero End Get Set(value As Integer) ViewState("Anos") = value End Set End Property #End Region #Region " PROPIEDADES" 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.TipoContabilidad = 2 Then Response.Redirect($"/Contabilidad/RepEstadoResultados.aspx") End If 'tdTipoReporte.Visible = True TipoReporte = 1 CargaDatosGenerales() DdlEjercicio.SelectedValue = Now.Year.ToString Anos = 0 'Normal TotalActual = 0 TotalAnterior = 0 DdlPeriodo.SelectedValue = Now.Month.ToString TabContainer_ActiveTabChanged(TabContainer, EventArgs.Empty) End If End Sub Private Sub CargaDatosGenerales() 'Dim ClsConta As New ClsContPAQi(UsuarioActual.Empresa) Dim ClsConta As New ClsContabilidad If ClsConta.GetEjercicios(UsuarioActual.CveEmpresa) Then DdlEjercicio.DataSource = ClsConta.DtResultados Else DdlEjercicio.DataSource = Nothing End If DdlSubproyecto.DataSource = GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa, -1) DdlSubproyecto.DataBind() ClsConta.Dispose() DdlEjercicio.DataBind() End Sub #Region " NORMAL " Private Sub CargaDatos() FechaI = String.Format("01/{0}/{1}", DdlPeriodo.SelectedValue.PadLeft(2, CChar("0")), DdlEjercicio.SelectedValue) FechaF = DateAdd(DateInterval.Day, -1, DateAdd(DateInterval.Month, 1, CDate(FechaI))).ToString("dd/MM/yyyy") TipoReporte = If(TipoReporte = -1, -1, DdlTipoReporte.SelectedValue.ToEntero) 'Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa) Dim CveSubProyecto As String = DdlSubproyecto.SelectedValue.ToString Dim ObjConta As New ClsContabilidad If ObjConta.GetEstadoActividades(FechaI.ToDate, FechaF.ToDate, TipoReporte, CveSubProyecto, UsuarioActual.CveEmpresa) Then DtDatos = ObjConta.DtResultados.FiltraParametros("(ImporteActual <> 0 OR ImporteAcumulado <> 0)") Else DtDatos = Nothing Alert("Ocurrio un error al cargar los datos del Estado de Actividades", TipoMensaje.MsgError) End If ObjConta.Dispose() If DtDatos IsNot Nothing Then CargaGrids() SumaTotales() End If End Sub Private Sub CargaGrids() DtIngresos = DtDatos.FiltraParametros("Orden Like '0004%' OR Tipo = 'H'") DtGastos = DtDatos.FiltraParametros("Orden Like '0005%' OR Tipo = 'G'") Dim Row As DataRow = DtIngresos.NewRow Dim TotalActualLocal = 0.0, TotalAnteriorLocal = 0.0 If DtIngresos.Rows.Count > 0 Then For Each dr As DataRow In DtIngresos.FiltraParametros("CtaMayor = 1").Rows TotalActualLocal += dr("ImporteActual").ToString.ToDouble TotalAnteriorLocal += dr("ImporteAcumulado").ToString.ToDouble Next Row.Item("Nombre") = "TOTAL INGRESOS " Row.Item("ImporteActual") = TotalActualLocal.ToString Row.Item("PorcentajeActual") = "100" Row.Item("ImporteAcumulado") = TotalAnteriorLocal.ToString Row.Item("PorcentajeAcumulado") = "100" Row.Item("CtaMayor") = -1 DtIngresos.Rows.Add(Row) Else Row.Item("Nombre") = "TOTAL INGRESOS " Row.Item("ImporteActual") = "0.00" Row.Item("ImporteAcumulado") = "0.00" Row.Item("CtaMayor") = -1 DtIngresos.Rows.Add(Row) End If Dim T1 = TotalActualLocal, T2 = TotalAnteriorLocal TotalActual = TotalActualLocal TotalAnterior = TotalAnteriorLocal TotalActualLocal = 0 TotalAnteriorLocal = 0 Row = DtGastos.NewRow If DtGastos.Rows.Count > 0 Then For Each dr As DataRow In DtGastos.FiltraParametros("CtaMayor = 1").Rows TotalActualLocal += dr("ImporteActual").ToString.ToDouble TotalAnteriorLocal += dr("ImporteAcumulado").ToString.ToDouble Next Row.Item("Nombre") = "TOTAL GASTOS" Row.Item("ImporteActual") = TotalActualLocal Row.Item("PorcentajeActual") = If(T1 > 0, (TotalActualLocal * 100 / T1).ToString, "0").FormatoNumero Row.Item("ImporteAcumulado") = TotalAnteriorLocal.ToString Row.Item("PorcentajeAcumulado") = If(T2 > 0, (TotalAnteriorLocal * 100 / T2).ToString, "0").FormatoNumero Row.Item("CtaMayor") = -1 DtGastos.Rows.Add(Row) Else Row.Item("Nombre") = "TOTAL GASTOS" Row.Item("ImporteActual") = "0.00" Row.Item("ImporteAcumulado") = "0.00" Row.Item("CtaMayor") = -1 DtGastos.Rows.Add(Row) End If TotalActual -= TotalActualLocal TotalAnterior -= TotalAnteriorLocal 'INSERTA UTILIDAD Row = DtGastos.NewRow Row.Item("Nombre") = "Utilidad (o Pérdida)" Row.Item("ImporteActual") = TotalActual Row.Item("PorcentajeActual") = If(T1 > 0, (TotalActual * 100 / T1).ToString, "0").FormatoNumero Row.Item("ImporteAcumulado") = TotalAnterior.ToString Row.Item("PorcentajeAcumulado") = If(T2 > 0, (TotalAnterior * 100 / T2).ToString, "0").FormatoNumero Row.Item("CtaMayor") = -2 DtGastos.Rows.Add(Row) GvIngresos.DataSource = DtIngresos GvIngresos.DataBind() GvGastos.DataSource = DtGastos GvGastos.DataBind() UpDatos.Update() End Sub Private Sub SumaTotales() 'Llena Lb´s Totales LbTotalActual.Text = TotalActual.ToString.FormatoNumero LbTotalAnterior.Text = TotalAnterior.ToString.FormatoNumero LbTotalActual.ForeColor = If(TotalActual < 0, Drawing.Color.Red, Drawing.Color.Black) LbTotalAnterior.ForeColor = If(TotalAnterior < 0, Drawing.Color.Red, Drawing.Color.Black) End Sub #Region "GV´S ROW DATA BOUND" Protected Sub GvIngresos_RowDataBound(sender As Object, e As GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then 'METODO ANTERIOR 'TotalActual += e.Row.DBCampo("ImporteActual").ToString.ToDouble 'TotalAnterior += e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble 'e.Row.ControlStyle.BackColor = Drawing.Color.LightGray 'e.Row.ControlStyle.ForeColor = Drawing.Color.White e.Row.ControlStyle.Font.Bold = True ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then 'e.Row.CssClass = "SubTotales3" e.Row.ControlStyle.Font.Bold = True End If If e.Row.DBCampo("CtaMayor").ToString.ToEntero > 0 Then e.Row.FCHyperLink("HLActual").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&CM=1&CveSubProyecto={2}", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, DdlSubproyecto.SelectedValue) e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&CM=1&CveSubProyecto={2}", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, DdlSubproyecto.SelectedValue) End If If e.Row.DBCampo("ImporteActual").ToString.ToDouble < 0 Then e.Row.FCHyperLink("HLActual").ForeColor = Drawing.Color.Red End If If e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble < 0 Then e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red End If End If End Sub Protected Sub GvGastos_RowDataBound(sender As Object, e As GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then 'METODO ANTERIOR 'TotalActual -= e.Row.DBCampo("ImporteActual").ToString.ToDouble 'TotalAnterior -= e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble 'e.Row.ControlStyle.BackColor = Drawing.Color.LightGray 'e.Row.ControlStyle.ForeColor = Drawing.Color.White e.Row.ControlStyle.Font.Bold = True If e.Row.DBCampo("CtaMayor").ToString.ToEntero = -2 Then 'e.Row.CssClass = "SubTotales" e.Row.ControlStyle.BackColor = Drawing.Color.LightGray End If ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then 'e.Row.CssClass = "SubTotales" e.Row.ControlStyle.Font.Bold = True End If If e.Row.DBCampo("CtaMayor").ToString.ToEntero > 0 Then e.Row.FCHyperLink("HLActual").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&CM=1&CveSubProyecto={2}", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, DdlSubproyecto.SelectedValue) e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&CM=1&CveSubProyecto={2}", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, DdlSubproyecto.SelectedValue) End If If e.Row.DBCampo("ImporteActual").ToString.ToDouble < 0 Then e.Row.FCHyperLink("HLActual").ForeColor = Drawing.Color.Red End If If e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble < 0 Then e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red End If End If End Sub #End Region #End Region #Region " MENSUAL " Private Sub CargaDatosMensual() 'Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa) Dim ObjConta As New ClsContabilidad TipoReporte = If(TipoReporte = -1, -1, DdlTipoReporte.SelectedValue.ToEntero) Dim CveSubProyecto As String = DdlSubproyecto.SelectedValue.ToString If ObjConta.GetEstadoResultadosMensual(DdlEjercicio.SelectedValue.ToEntero, TipoReporte, CveSubProyecto, UsuarioActual.CveEmpresa) Then DtDatosMensual = ObjConta.DtResultados Else DtDatosMensual = Nothing Alert("Ocurrio un error al cargar los datos del estado de resultados", TipoMensaje.MsgError) End If ObjConta.Dispose() EscondeSubtotales() If DtDatosMensual IsNot Nothing Then CargaGridMensual() End If End Sub Private Sub EscondeSubtotales() 'Esconde Trimestral GvDatosMensual.Columns(7).Visible = False GvDatosMensual.Columns(8).Visible = False GvDatosMensual.Columns(17).Visible = False GvDatosMensual.Columns(18).Visible = False GvDatosMensual.Columns(27).Visible = False GvDatosMensual.Columns(28).Visible = False GvDatosMensual.Columns(35).Visible = False GvDatosMensual.Columns(36).Visible = False 'Esconde Cuatrimestral GvDatosMensual.Columns(11).Visible = False GvDatosMensual.Columns(12).Visible = False GvDatosMensual.Columns(23).Visible = False GvDatosMensual.Columns(24).Visible = False GvDatosMensual.Columns(37).Visible = False GvDatosMensual.Columns(38).Visible = False If DdlSubtotales.SelectedValue = "2" Then GvDatosMensual.Columns(7).Visible = True GvDatosMensual.Columns(8).Visible = True GvDatosMensual.Columns(17).Visible = True GvDatosMensual.Columns(18).Visible = True GvDatosMensual.Columns(27).Visible = True GvDatosMensual.Columns(28).Visible = True GvDatosMensual.Columns(35).Visible = True GvDatosMensual.Columns(36).Visible = True ElseIf DdlSubtotales.SelectedValue = "3" Then GvDatosMensual.Columns(11).Visible = True GvDatosMensual.Columns(12).Visible = True GvDatosMensual.Columns(23).Visible = True GvDatosMensual.Columns(24).Visible = True GvDatosMensual.Columns(37).Visible = True GvDatosMensual.Columns(38).Visible = True End If End Sub Private Sub CargaGridMensual() GvDatosMensual.DataSource = DtDatosMensual GvDatosMensual.DataBind() UpDatosMensual.Update() End Sub Protected Sub GvDatosMensual_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatosMensual.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then If 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 = "" e.Row.Cells(2).Text = "" e.Row.Cells(4).Text = "" e.Row.Cells(6).Text = "" e.Row.Cells(8).Text = "" e.Row.Cells(10).Text = "" e.Row.Cells(12).Text = "" e.Row.Cells(14).Text = "" e.Row.Cells(16).Text = "" e.Row.Cells(18).Text = "" e.Row.Cells(20).Text = "" e.Row.Cells(22).Text = "" e.Row.Cells(24).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 = 3 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;") End If If e.Row.DBCampo("CtaMayor").ToString.ToEntero = 1 Or e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then e.Row.FCHyperLink("HLEnero").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/01/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue) e.Row.FCHyperLink("HLFebrero").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/02/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue) e.Row.FCHyperLink("HLMarzo").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/03/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue) e.Row.FCHyperLink("HLAbril").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/04/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue) e.Row.FCHyperLink("HLMayo").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/05/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue) e.Row.FCHyperLink("HLJunio").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/06/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue) e.Row.FCHyperLink("HLJulio").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/07/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue) e.Row.FCHyperLink("HLAgosto").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/08/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue) e.Row.FCHyperLink("HLSeptiembre").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("09/01/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue) e.Row.FCHyperLink("HLOctubre").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/10/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue) e.Row.FCHyperLink("HLNoviembre").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/11/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue) e.Row.FCHyperLink("HLDiciembre").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/12/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue) e.Row.FCHyperLink("HLTrimestral1").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FI={1}&FF={2}&TP={3}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/01/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/03/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue) e.Row.FCHyperLink("HLTrimestral2").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FI={1}&FF={2}&TP={3}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/04/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/06/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue) e.Row.FCHyperLink("HLTrimestral3").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FI={1}&FF={2}&TP={3}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/07/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/09/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue) e.Row.FCHyperLink("HLTrimestral4").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FI={1}&FF={2}&TP={3}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/10/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/12/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue) e.Row.FCHyperLink("HLCuatrimestral1").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FI={1}&FF={2}&TP={3}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/01/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/04/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue) e.Row.FCHyperLink("HLCuatrimestral2").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FI={1}&FF={2}&TP={3}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/05/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/08/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue) e.Row.FCHyperLink("HLCuatrimestral3").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FI={1}&FF={2}&TP={3}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/09/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/12/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue) End If 'TOTALES If e.Row.DBCampo("CtaMayor").ToString.ToEntero = 5 Then e.Row.Attributes.Add("style", "border-top: 1px solid;") e.Row.FCLabel("LbNombre").Font.Italic = True End If End If End Sub #End Region #Region " ANUAL " Private Sub CargaDatosAnual() 'Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa) Dim ObjConta As New ClsContabilidad TipoReporte = If(TipoReporte = -1, -1, DdlTipoReporte.SelectedValue.ToEntero) Dim CveSubProyecto As String = DdlSubproyecto.SelectedValue.ToString If ObjConta.GetEstadoResultadosAnual(DdlEjercicio.SelectedValue.ToEntero, TipoReporte, CveSubProyecto, UsuarioActual.CveEmpresa) Then DtDatosAnual = ObjConta.DtResultados Else DtDatosAnual = Nothing Alert("Ocurrio un error al cargar los datos del balance general anual", TipoMensaje.MsgError) End If ObjConta.Dispose() Anos = (Year(Date.Now) - DdlEjercicio.SelectedValue.ToEntero) + 1 'Esconde todo For index = 1 To 40 Step 2 GvDatosAnual.Columns(index).Visible = False GvDatosAnual.Columns(index + 1).Visible = False Next Dim i = 0 For index = 1 To Anos * 2 Step 2 GvDatosAnual.Columns(index).Visible = True GvDatosAnual.Columns(index + 1).Visible = True GvDatosAnual.Columns(index).HeaderText = (DdlEjercicio.SelectedValue.ToEntero + i).ToString i = i + 1 Next If DtDatosAnual IsNot Nothing Then CargaGridAnual() End If End Sub Private Sub CargaGridAnual() GvDatosAnual.DataSource = DtDatosAnual GvDatosAnual.DataBind() UpDatosAnual.Update() End Sub Protected Sub GvDatosAnual_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatosAnual.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.DBCampo("CtaMayor").ToString.ToEntero = 4 Then For index = 1 To Anos e.Row.FCHyperLink("HLAno" + index.ToString).Text = "" e.Row.Cells(index + index).Text = "" Next 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 = 3 Then e.Row.FCLabel("LbNombre").Attributes.Add("style", "padding-left: 10px;") e.Row.FCLabel("LbNombre").Font.Italic = True End If 'CUENTAS If e.Row.DBCampo("CtaMayor").ToString.ToEntero = 1 Then e.Row.FCLabel("LbNombre").Attributes.Add("style", "padding-left: 20px;") End If If e.Row.DBCampo("CtaMayor").ToString.ToEntero = 1 Or e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then For index = 1 To Anos e.Row.FCHyperLink("HLAno" + index.ToString).NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FI={1}&FF={2}&TP={3}&CM=1&CveSubProyecto={4}", e.Row.DBCampo("CveCuenta"), String.Format("01/01/{0}", (DdlEjercicio.SelectedValue.ToEntero + index - 1).ToString), String.Format("31/12/{0}", (DdlEjercicio.SelectedValue.ToEntero + index - 1).ToString), TipoReporte, DdlSubproyecto.SelectedValue) Next End If 'TOTALES If e.Row.DBCampo("CtaMayor").ToString.ToEntero = 5 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 #End Region Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) 'Nota: ' 0 = Normal ' 1 = Mensual ' 2 = Anual If TabContainer.ActiveTabIndex = 0 Then CargaDatos() ElseIf TabContainer.ActiveTabIndex = 1 Then CargaDatosMensual() ElseIf TabContainer.ActiveTabIndex = 2 Then CargaDatosAnual() End If End Sub Protected Sub TabContainer_ActiveTabChanged(sender As Object, e As EventArgs) 'Nota: ' 0 = Normal ' 1 = Mensual ' 2 = Anual 'Esconde Todo de lo variable de Filtros TdSubTotales.Visible = False TdPeriodo.Visible = False If TabContainer.ActiveTabIndex = 0 Then TdPeriodo.Visible = True ElseIf TabContainer.ActiveTabIndex = 1 Then TdSubTotales.Visible = True ElseIf TabContainer.ActiveTabIndex = 2 Then End If UpFiltros.Update() BtnConsultar_Click(BtnConsultar, EventArgs.Empty) End Sub End Class