Files
SIG/Contabilidad/RepBalanceGeneralHorizontal.aspx.vb

2319 lines
104 KiB
VB.net
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Option Explicit On
Option Strict On
Imports System.Data
Imports Extensiones
Imports Microsoft.Reporting.WebForms
Partial Class Contabilidad_RepBalanceGeneralHorizontal
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 TotalActivoActual As Double
Get
TotalActivoActual = ViewState("TotalActivoActual").ToString.ToDouble
End Get
Set(value As Double)
ViewState("TotalActivoActual") = value
End Set
End Property
Private Property TotalActivoAnterior As Double
Get
TotalActivoAnterior = ViewState("TotalActivoAnterior").ToString.ToDouble
End Get
Set(value As Double)
ViewState("TotalActivoAnterior") = value
End Set
End Property
Private Property TotalPasivoActual As Double
Get
TotalPasivoActual = ViewState("TotalPasivoActual").ToString.ToDouble
End Get
Set(value As Double)
ViewState("TotalPasivoActual") = value
End Set
End Property
Private Property TotalPasivoAnterior As Double
Get
TotalPasivoAnterior = ViewState("TotalPasivoAnterior").ToString.ToDouble
End Get
Set(value As Double)
ViewState("TotalPasivoAnterior") = value
End Set
End Property
Private Property TotalPatrimonioActual As Double
Get
TotalPatrimonioActual = ViewState("TotalPatrimonioActual").ToString.ToDouble
End Get
Set(value As Double)
ViewState("TotalPatrimonioActual") = value
End Set
End Property
Private Property TotalPatrimonioAnterior As Double
Get
TotalPatrimonioAnterior = ViewState("TotalPatrimonioAnterior").ToString.ToDouble
End Get
Set(value As Double)
ViewState("TotalPatrimonioAnterior") = value
End Set
End Property
Private Property TotalPasivoPatrimonioActual As Double
Get
TotalPasivoPatrimonioActual = ViewState("TotalPasivoPatrimonioActual").ToString.ToDouble
End Get
Set(value As Double)
ViewState("TotalPasivoPatrimonioActual") = value
End Set
End Property
Private Property TotalPasivoPatrimonioAnterior As Double
Get
TotalPasivoPatrimonioAnterior = ViewState("TotalPasivoPatrimonioAnterior").ToString.ToDouble
End Get
Set(value As Double)
ViewState("TotalPasivoPatrimonioAnterior") = value
End Set
End Property
Private Property FechaInicioActual As Date
Get
FechaInicioActual = ViewState("FechaInicioActual").ToString.ToDate
End Get
Set(value As Date)
ViewState("FechaInicioActual") = value
End Set
End Property
Private Property FechaFinActual As Date
Get
FechaFinActual = ViewState("FechaFinActual").ToString.ToDate
End Get
Set(value As Date)
ViewState("FechaFinActual") = value
End Set
End Property
Private Property FechaInicioAnterior As Date
Get
FechaInicioAnterior = ViewState("FechaInicioAnterior").ToString.ToDate
End Get
Set(value As Date)
ViewState("FechaInicioAnterior") = value
End Set
End Property
Private Property FechaFinAnterior As Date
Get
FechaFinAnterior = ViewState("FechaFinAnterior").ToString.ToDate
End Get
Set(value As Date)
ViewState("FechaFinAnterior") = 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
Private Property FechaIMes As String
Get
Return ViewState("FechaIMes").ToString
End Get
Set(value As String)
ViewState("FechaIMes") = value
End Set
End Property
Private Property FechaFMes As String
Get
Return ViewState("FechaFMes").ToString
End Get
Set(value As String)
ViewState("FechaFMes") = value
End Set
End Property
#End Region
#Region " M E S H O R I Z O N T A L "
Private Property DtDatosMesH As DataTable
Get
DtDatosMesH = DirectCast(ViewState("DtDatosMesH"), DataTable)
End Get
Set(ByVal value As DataTable)
ViewState("DtDatosMesH") = value
End Set
End Property
Private Property DtIngresosMesH As DataTable
Get
DtIngresosMesH = DirectCast(ViewState("DtIngresosMesH"), DataTable)
End Get
Set(ByVal value As DataTable)
ViewState("DtIngresosMesH") = value
End Set
End Property
Private Property DtGastosMesH As DataTable
Get
DtGastosMesH = DirectCast(ViewState("DtGastosMesH"), DataTable)
End Get
Set(ByVal value As DataTable)
ViewState("DtGastosMesH") = value
End Set
End Property
Private Property DTTotalesMesH As DataTable
Get
DTTotalesMesH = DirectCast(ViewState("DTTotalesMesH"), DataTable)
End Get
Set(ByVal value As DataTable)
ViewState("DTTotalesMesH") = value
End Set
End Property
#End Region
#Region " A N U A L H O R I Z O N T A L "
Private Property DtDatosAnualH As DataTable
Get
DtDatosAnualH = DirectCast(ViewState("DtDatosAnualH"), DataTable)
End Get
Set(ByVal value As DataTable)
ViewState("DtDatosAnualH") = value
End Set
End Property
Private Property DtIngresosAnualH As DataTable
Get
DtIngresosAnualH = DirectCast(ViewState("DtIngresosAnualH"), DataTable)
End Get
Set(ByVal value As DataTable)
ViewState("DtIngresosAnualH") = value
End Set
End Property
Private Property DtGastosAnualH As DataTable
Get
DtGastosAnualH = DirectCast(ViewState("DtGastosAnualH"), DataTable)
End Get
Set(ByVal value As DataTable)
ViewState("DtGastosAnualH") = value
End Set
End Property
Private Property DTTotalesAnualH As DataTable
Get
DTTotalesAnualH = DirectCast(ViewState("DTTotalesAnualH"), DataTable)
End Get
Set(ByVal value As DataTable)
ViewState("DTTotalesAnualH") = value
End Set
End Property
#End Region
#Region " S U B P R O Y E C T O H O R I Z O N T A L "
Private Property DtDatosSubProyectoH As DataTable
Get
DtDatosSubProyectoH = DirectCast(ViewState("DtDatosSubProyectoH"), DataTable)
End Get
Set(ByVal value As DataTable)
ViewState("DtDatosSubProyectoH") = value
End Set
End Property
Private Property DtIngresosSubProyectoH As DataTable
Get
DtIngresosSubProyectoH = DirectCast(ViewState("DtIngresosSubProyectoH"), DataTable)
End Get
Set(ByVal value As DataTable)
ViewState("DtIngresosSubProyectoH") = value
End Set
End Property
Private Property DtGastosSubProyectoH As DataTable
Get
DtGastosSubProyectoH = DirectCast(ViewState("DtGastosSubProyectoH"), DataTable)
End Get
Set(ByVal value As DataTable)
ViewState("DtGastosSubProyectoH") = value
End Set
End Property
Private Property DTTotalesSubProyectoH As DataTable
Get
DTTotalesSubProyectoH = DirectCast(ViewState("DTTotalesSubProyectoH"), DataTable)
End Get
Set(ByVal value As DataTable)
ViewState("DTTotalesSubProyectoH") = value
End Set
End Property
Private Property DTSubProyectosCabecerasH As DataTable
Get
DTSubProyectosCabecerasH = DirectCast(ViewState("DTSubProyectosCabecerasH"), DataTable)
End Get
Set(ByVal value As DataTable)
ViewState("DTSubProyectosCabecerasH") = 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
LtTitulo.Text = "Balance General"
End If
TotalActivoActual = 0
TotalActivoAnterior = 0
TotalPasivoActual = 0
TotalPasivoAnterior = 0
TotalPatrimonioActual = 0
TotalPatrimonioAnterior = 0
TotalPasivoPatrimonioActual = 0
TotalPasivoPatrimonioAnterior = 0
CargaEjercicios()
DdlSubproyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa)
DdlSubproyecto.DataBind()
'CargaDatos()
End If
End Sub
Protected Sub Tab_ActiveTabChanged(sender As Object, e As EventArgs)
If Tab.ActiveTabIndex = 0 Then
LiSubProyectoDdl.Visible = True
LiSubProyectoLbl.Visible = True
LiEjercicioDdl.Visible = True
LiEjercicioLbl.Visible = True
'LiEjercicioDdl2.Visible = False
'LiEjercicioLbl2.Visible = False
LiPeriodoDdl.Visible = True
LiPeriodoLbl.Visible = True
LiDivisorDdl.Visible = True
LiDivisorLbl.Visible = True
End If
If Tab.ActiveTabIndex = 1 Then
LiSubProyectoDdl.Visible = True
LiSubProyectoLbl.Visible = True
LiEjercicioDdl.Visible = True
LiEjercicioLbl.Visible = True
'LiEjercicioDdl2.Visible = False
'LiEjercicioLbl2.Visible = False
LiPeriodoDdl.Visible = False
LiPeriodoLbl.Visible = False
LiDivisorDdl.Visible = True
LiDivisorLbl.Visible = True
End If
If Tab.ActiveTabIndex = 2 Then
LiSubProyectoDdl.Visible = True
LiSubProyectoLbl.Visible = True
LiEjercicioDdl.Visible = True
LiEjercicioLbl.Visible = True
'LiEjercicioDdl2.Visible = True
'LiEjercicioLbl2.Visible = True
LiPeriodoDdl.Visible = False
LiPeriodoLbl.Visible = False
LiDivisorDdl.Visible = True
LiDivisorLbl.Visible = True
End If
If Tab.ActiveTabIndex = 3 Then
LiSubProyectoDdl.Visible = True
LiSubProyectoLbl.Visible = True
LiEjercicioDdl.Visible = True
LiEjercicioLbl.Visible = True
'LiEjercicioDdl2.Visible = False
'LiEjercicioLbl2.Visible = False
LiPeriodoDdl.Visible = True
LiPeriodoLbl.Visible = True
LiDivisorDdl.Visible = True
LiDivisorLbl.Visible = True
End If
UpFiltros.Update()
End Sub
Private Sub CargaEjercicios()
'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
Clsconta.Dispose()
DdlEjercicio.DataBind()
DdlEjercicio.SelectedValue = NowADS().Year.ToString
'DdlEjercicio.SelectedValueExist(UsuarioActual.Empresa.EjercicioActual.ToString)
DdlPeriodo.SelectedValue = NowADS().Month.ToString
End Sub
Private Sub CargaDatos()
''Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa)
Dim ObjConta As New ClsContabilidad
Dim FechaI = String.Format("01/{0}/{1}", DdlPeriodo.SelectedValue.PadLeft(2, CChar("0")), DdlEjercicio.SelectedValue)
Dim FechaF = FechaI.ToDate.LastDayOfMonth.ToShortDateString
TipoReporte = DdlTipoReporte.SelectedValue.ToEntero
GvActivo.Columns(1).HeaderText = DdlEjercicio.SelectedValue
GvActivo.Columns(2).HeaderText = (DdlEjercicio.SelectedValue.ToEntero - 1).ToString
GvPasivo.Columns(1).HeaderText = DdlEjercicio.SelectedValue
GvPasivo.Columns(2).HeaderText = (DdlEjercicio.SelectedValue.ToEntero - 1).ToString
Dim CveSubProyecto As Integer = If(DdlSubproyecto.SelectedValue.ToEntero = -1, -2, DdlSubproyecto.SelectedValue.ToEntero)
If ObjConta.GetSituacionFinanciera2("01/01/1900".ToDate, FechaF.ToDate, CveSubProyecto, DdlDivisor.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, TipoReporte) Then
DtDatos = ObjConta.DtResultados
CargaGrids()
If GvPatrimonio.HeaderRow IsNot Nothing Then
GvPatrimonio.HeaderRow.FCLabel("LbTitulo").Text = "CAPITAL CONTABLE"
End If
SumaTotales()
Else
DtDatos = Nothing
Alert("Ocurrio un error al cargar los datos del estado de situación financiera", TipoMensaje.MsgError)
End If
ObjConta.Dispose()
End Sub
Private Sub CargaGrids()
If Not ChkNivel.Checked Then
DtDatos = DtDatos.FiltraParametros("Level < 3")
End If
Dim DtActivoCirculante = DtDatos.FiltraParametros("Tipo in ('A','B','C') AND TipoCuenta=1")
Dim DtActivoNoCirculante = DtDatos.FiltraParametros("Tipo in ('A','B','C') AND TipoCuenta=2 ")
Dim DtActivoDiferido = DtDatos.FiltraParametros(" TipoCuenta=9 ")
' Dim DtActivoCirculante = DtDatos.FiltraParametros("Tipo in ('A','B','C') AND Orden LIKE '%/00011%' ")
' Dim DtActivoNoCirculante = DtDatos.FiltraParametros("Tipo in ('A','B','C') AND Orden LIKE '%/00012%' ")
Dim Row As DataRow = DtActivoCirculante.NewRow
If DtActivoCirculante.Rows.Count > 0 Then
Row.Item("Nombre") = "&nbsp;&nbsp;&nbsp;TOTAL ACTIVO CIRCULANTE"
Row.Item("ImporteActual") = DtActivoCirculante.SUM("ImporteActual").ToString
Row.Item("ImporteAnterior") = DtActivoCirculante.SUM("ImporteAnterior").ToString
Row.Item("CtaMayor") = -1
'DtActivoCirculante.Rows.RemoveAt(0)
Else
Row.Item("Nombre") = "&nbsp;&nbsp;&nbsp;TOTAL ACTIVO CIRCULANTE"
Row.Item("ImporteActual") = "0.00"
Row.Item("ImporteAnterior") = "0.00"
Row.Item("CtaMayor") = -1
End If
DtActivoCirculante.Rows.Add(Row)
Row = DtActivoNoCirculante.NewRow
If DtActivoNoCirculante.Rows.Count > 0 Then
Row.Item("Nombre") = "&nbsp;&nbsp;&nbsp;TOTAL ACTIVO NO CIRCULANTE"
Row.Item("ImporteActual") = DtActivoNoCirculante.SUM("ImporteActual").ToString
Row.Item("ImporteAnterior") = DtActivoNoCirculante.SUM("ImporteAnterior").ToString
Row.Item("CtaMayor") = -1
'DtActivoNoCirculante.Rows.RemoveAt(0)
Else
Row.Item("Nombre") = "&nbsp;&nbsp;&nbsp;TOTAL ACTIVO NO CIRCULANTE"
Row.Item("ImporteActual") = "0.00"
Row.Item("ImporteAnterior") = "0.00"
Row.Item("CtaMayor") = -1
End If
DtActivoNoCirculante.Rows.Add(Row)
Row = DtActivoDiferido.NewRow
If DtActivoDiferido.Rows.Count > 0 Then
Row.Item("Nombre") = "&nbsp;&nbsp;&nbsp;TOTAL ACTIVO DIFERIDO"
Row.Item("ImporteActual") = DtActivoDiferido.SUM("ImporteActual").ToString
Row.Item("ImporteAnterior") = DtActivoDiferido.SUM("ImporteAnterior").ToString
Row.Item("CtaMayor") = -1
'DtActivoDiferido.Rows.RemoveAt(0)
Else
Row.Item("Nombre") = "&nbsp;&nbsp;&nbsp;TOTAL ACTIVO DIFERIDO"
Row.Item("ImporteActual") = "0.00"
Row.Item("ImporteAnterior") = "0.00"
Row.Item("CtaMayor") = -1
End If
DtActivoDiferido.Rows.Add(Row)
GvActivo.DataSource = DtActivoCirculante
GvActivo.DataBind()
GvActivoNoCirculante.DataSource = DtActivoNoCirculante
GvActivoNoCirculante.DataBind()
GvActivoDiferido.DataSource = DtActivoDiferido
GvActivoDiferido.DataBind()
UpActivo.Update()
'PASIVO
Dim DtPasivoCirculante = DtDatos.FiltraParametros("Tipo in ('D') AND TipoCuenta=3")
Dim DtPasivoNoCirculante = DtDatos.FiltraParametros("Tipo in ('D') AND TipoCuenta=4")
'Dim DtPasivoCirculante = DtDatos.FiltraParametros("Tipo in ('D') AND Orden LIKE '%/00021%' ")
'Dim DtPasivoNoCirculante = DtDatos.FiltraParametros("Tipo in ('D') AND Orden LIKE '%/00022%' ")
Row = DtPasivoCirculante.NewRow
If DtPasivoCirculante.Rows.Count > 0 Then
Row.Item("Nombre") = "&nbsp;&nbsp;&nbsp;TOTAL PASIVO CIRCULANTE"
Row.Item("ImporteActual") = DtPasivoCirculante.SUM("ImporteActual").ToString
Row.Item("ImporteAnterior") = DtPasivoCirculante.SUM("ImporteAnterior").ToString
Row.Item("CtaMayor") = -1
'DtPasivoCirculante.Rows.RemoveAt(0)
Else
Row.Item("Nombre") = "&nbsp;&nbsp;&nbsp;TOTAL PASIVO CIRCULANTE"
Row.Item("ImporteActual") = "0.00"
Row.Item("ImporteAnterior") = "0.00"
Row.Item("CtaMayor") = -1
End If
DtPasivoCirculante.Rows.Add(Row)
Row = DtPasivoNoCirculante.NewRow
If DtPasivoNoCirculante.Rows.Count > 0 Then
Row.Item("Nombre") = "&nbsp;&nbsp;&nbsp;TOTAL PASIVO NO CIRCULANTE"
Row.Item("ImporteActual") = DtPasivoNoCirculante.SUM("ImporteActual").ToString
Row.Item("ImporteAnterior") = DtPasivoNoCirculante.SUM("ImporteAnterior").ToString
Row.Item("CtaMayor") = -1
'DtPasivoNoCirculante.Rows.RemoveAt(0)
Else
Row.Item("Nombre") = "&nbsp;&nbsp;&nbsp;TOTAL PASIVO NO CIRCULANTE"
Row.Item("ImporteActual") = "0.00"
Row.Item("ImporteAnterior") = "0.00"
Row.Item("CtaMayor") = -1
End If
DtPasivoNoCirculante.Rows.Add(Row)
GvPasivo.DataSource = DtPasivoCirculante
GvPasivo.DataBind()
GvPasivoNoCirculante.DataSource = DtPasivoNoCirculante
GvPasivoNoCirculante.DataBind()
UpPasivo.Update()
'PATRIMONIO
Dim DtPatrimonioContribuido = DtDatos.FiltraParametros("Tipo in ('F') AND TipoCuenta in (5,6,8,7)")
Dim DtPatrimonioGenerado = DtDatos.FiltraParametros("Tipo in ('F') AND TipoCuenta in (6,8)")
Dim DtPatrimonioActualizacion = DtDatos.FiltraParametros("Tipo in ('F') AND TipoCuenta=7")
Dim DtUtilidad = DtDatos.FiltraParametros("Tipo in ('F') AND TipoCuenta=5")
'Dim DtPatrimonioContribuido = DtDatos.FiltraParametros("Tipo in ('F') AND Orden LIKE '%/00031%' ")
'Dim DtPatrimonioGenerado = DtDatos.FiltraParametros("Tipo in ('F') AND Orden LIKE '%/00032%' ")
'Dim DtPatrimonioActualizacion = DtDatos.FiltraParametros("Tipo in ('F') AND Orden LIKE '%/00033%' ")
Row = DtPatrimonioContribuido.NewRow
If DtPatrimonioContribuido.Rows.Count > 0 Then
Row.Item("Nombre") = "&nbsp;&nbsp;&nbsp;TOTAL CAPITAL"
Row.Item("ImporteActual") = DtPatrimonioContribuido.SUM("ImporteActual").ToString
Row.Item("ImporteAnterior") = DtPatrimonioContribuido.SUM("ImporteAnterior").ToString
Row.Item("CtaMayor") = -1
'DtPatrimonioContribuido.Rows.RemoveAt(0)
Else
Row.Item("Nombre") = "&nbsp;&nbsp;&nbsp;TOTAL CAPITAL"
Row.Item("ImporteActual") = "0.00"
Row.Item("ImporteAnterior") = "0.00"
Row.Item("CtaMayor") = -1
End If
DtPatrimonioContribuido.Rows.Add(Row)
''Row = DtPatrimonioGenerado.NewRow
''If DtPatrimonioGenerado.Rows.Count > 0 Then
'' Row.Item("Nombre") = "&nbsp;&nbsp;&nbsp;TOTAL PATRIMONIO GENERADO"
'' 'El id = 87 es el id de la cuenta "RESULTADOS DEL EJERCICIO:(AHORRO/DESAHORRO)"
'' Row.Item("ImporteActual") = DtPatrimonioGenerado.SUM("ImporteActual").ToString
'' Row.Item("ImporteAnterior") = DtPatrimonioGenerado.SUM("ImporteAnterior").ToString
'' Row.Item("CtaMayor") = -1
'' 'DtPatrimonioGenerado.Rows.RemoveAt(0)
''Else
'' Row.Item("Nombre") = "&nbsp;&nbsp;&nbsp;TOTAL PATRIMONIO GENERADO"
'' Row.Item("ImporteActual") = "0.00"
'' Row.Item("ImporteAnterior") = "0.00"
'' Row.Item("CtaMayor") = -1
''End If
''DtPatrimonioGenerado.Rows.Add(Row)
''Row = DtPatrimonioActualizacion.NewRow
''If DtPatrimonioActualizacion.Rows.Count > 0 Then
'' Row.Item("Nombre") = "&nbsp;&nbsp;&nbsp;TOTAL EXCESO O INSUFICIENCIA EN LA ACTUALIZACION"
'' Row.Item("ImporteActual") = DtPatrimonioActualizacion.SUM("ImporteActual").ToString
'' Row.Item("ImporteAnterior") = DtPatrimonioActualizacion.SUM("ImporteAnterior").ToString
'' Row.Item("CtaMayor") = -1
'' 'DtPatrimonioActualizacion.Rows.RemoveAt(0)
''Else
'' Row.Item("Nombre") = "&nbsp;&nbsp;&nbsp;TOTAL EXCESO O INSUFICIENCIA EN LA ACTUALIZACION"
'' Row.Item("ImporteActual") = "0.00"
'' Row.Item("ImporteAnterior") = "0.00"
'' Row.Item("CtaMayor") = -1
''End If
''DtPatrimonioActualizacion.Rows.Add(Row)
GvPatrimonio.DataSource = DtPatrimonioContribuido
GvPatrimonio.DataBind()
'GvPatrimonioGenerado.DataSource = DtPatrimonioGenerado
'GvPatrimonioGenerado.DataBind()
'GvPatrimonioActualizacion.DataSource = DtPatrimonioActualizacion
'GvPatrimonioActualizacion.DataBind()
'GvUtilidad.DataSource = DtUtilidad
'GvUtilidad.DataBind()
UpPatrimonio.Update()
End Sub
Private Sub SumaTotales()
TotalPasivoPatrimonioActual = TotalPasivoActual + TotalPatrimonioActual
TotalPasivoPatrimonioAnterior = TotalPasivoAnterior + TotalPatrimonioAnterior
'Llena Lb´s Totales
LbTotalActivoActual.Text = TotalActivoActual.ToString.FormatoNumero
LbTotalActivoAnterior.Text = TotalActivoAnterior.ToString.FormatoNumero
LbTotalPasivoActual.Text = TotalPasivoActual.ToString.FormatoNumero
LbTotalPasivoAnterior.Text = TotalPasivoAnterior.ToString.FormatoNumero
LbTotalPatrimonioActual.Text = TotalPatrimonioActual.ToString.FormatoNumero
LbTotalPatrimonioAnterior.Text = TotalPatrimonioAnterior.ToString.FormatoNumero
LbTotalPasivoPatrimonioActual.Text = TotalPasivoPatrimonioActual.ToString.FormatoNumero
LbTotalPasivoPatrimonioAnterior.Text = TotalPasivoPatrimonioAnterior.ToString.FormatoNumero
Dim Descuadre = False
'COLOREA ROJO SI NO CUADRAN TOTALES
If Math.Round(TotalActivoActual, 2) <> Math.Round(TotalPasivoPatrimonioActual, 2) Then
LbTotalActivoActual.ForeColor = Drawing.Color.Red
LbTotalPasivoPatrimonioActual.ForeColor = Drawing.Color.Red
Descuadre = True
Else
LbTotalActivoActual.ForeColor = Drawing.Color.Black
LbTotalPasivoPatrimonioActual.ForeColor = Drawing.Color.Black
End If
'If Math.Round(TotalActivoAnterior, 2) <> Math.Round(TotalPasivoPatrimonioAnterior, 2) Then
' LbTotalActivoAnterior.ForeColor = Drawing.Color.Red
' LbTotalPasivoPatrimonioAnterior.ForeColor = Drawing.Color.Red
' Descuadre = True
'Else
' LbTotalActivoAnterior.ForeColor = Drawing.Color.Black
' LbTotalPasivoPatrimonioAnterior.ForeColor = Drawing.Color.Black
'End If
If Descuadre Then
LbDescuadre.Text = "Las sumas de los totales están descuadradas."
Else
LbDescuadre.Text = ""
End If
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
TotalActivoActual = 0
TotalActivoAnterior = 0
TotalPasivoActual = 0
TotalPasivoAnterior = 0
TotalPatrimonioActual = 0
TotalPatrimonioAnterior = 0
TotalPasivoPatrimonioActual = 0
TotalPasivoPatrimonioAnterior = 0
'Mes
If Tab.ActiveTabIndex = 0 Then
CargaDatos()
End If
'MES HORIZONTAL
If Tab.ActiveTabIndex = 1 Then
CargaDatosMesH()
End If
'AÑO HORIZONTAL
If Tab.ActiveTabIndex = 2 Then
CargaDatosAnualH()
End If
'SUBPROYECTO
If Tab.ActiveTabIndex = 3 Then
CargaDatosSubProyectoH()
End If
End Sub
#Region "GV´S ROW DATA BOUND"
Protected Sub GvActivo_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then
TotalActivoActual += e.Row.DBCampo("ImporteActual").ToString.ToDouble
TotalActivoAnterior += e.Row.DBCampo("ImporteAnterior").ToString.ToDouble
e.Row.FCLabel("LbNombre").Font.Italic = True
e.Row.FCLabel("LbNombre").Font.Bold = True
e.Row.Attributes.Add("style", "border-top: thick solid; border-top-width: thin;")
Else
e.Row.FCHyperLink("HLActual").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, TipoReporte)
e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFAnterior").ToDate.ToShortDateString, TipoReporte)
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("ImporteAnterior").ToString.ToDouble < 0 Then
e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red
End If
If e.Row.DBCampo("Level").ToString = "2" Then
e.Row.FCLabel("LbNombre").Text = String.Format("&nbsp;&nbsp;&nbsp;{0}", e.Row.DBCampo("Nombre").ToString)
ElseIf e.Row.DBCampo("Level").ToString = "1" Then
e.Row.FCLabel("LbNombre").Font.Bold = True
End If
End If
End Sub
Protected Sub GvPasivo_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
'Totales
If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then
TotalPasivoActual += e.Row.DBCampo("ImporteActual").ToString.ToDouble
TotalPasivoAnterior += e.Row.DBCampo("ImporteAnterior").ToString.ToDouble
e.Row.FCLabel("LbNombre").Font.Italic = True
e.Row.FCLabel("LbNombre").Font.Bold = True
e.Row.Attributes.Add("style", "border-top: thick solid; border-top-width: thin;")
'Cuentas
Else
e.Row.FCHyperLink("HLActual").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString)
e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFAnterior").ToDate.ToShortDateString)
End If
'Colorea NEGATIVOS
If e.Row.DBCampo("ImporteActual").ToString.ToDouble < 0 Then
e.Row.FCHyperLink("HLActual").ForeColor = Drawing.Color.Red
End If
If e.Row.DBCampo("ImporteAnterior").ToString.ToDouble < 0 Then
e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red
End If
If e.Row.DBCampo("Level").ToString = "2" Then
e.Row.FCLabel("LbNombre").Text = String.Format("&nbsp;&nbsp;&nbsp;{0}", e.Row.DBCampo("Nombre").ToString)
ElseIf e.Row.DBCampo("Level").ToString = "1" Then
e.Row.FCLabel("LbNombre").Font.Bold = True
End If
End If
End Sub
Protected Sub GvPatrimonio_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then
TotalPatrimonioActual += e.Row.DBCampo("ImporteActual").ToString.ToDouble
TotalPatrimonioAnterior += e.Row.DBCampo("ImporteAnterior").ToString.ToDouble
e.Row.FCLabel("LbNombre").Font.Italic = True
e.Row.FCLabel("LbNombre").Font.Bold = True
e.Row.Attributes.Add("style", "border-top: thick solid; border-top-width: thin;")
'e.Row.ControlStyle.BackColor = Drawing.Color.LightGray
'e.Row.ControlStyle.ForeColor = Drawing.Color.White
'e.Row.ControlStyle.Font.Bold = True
ElseIf e.Row.DBCampo("CveCuenta") <> "55276" Then
e.Row.FCHyperLink("HLActual").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString)
e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFAnterior").ToDate.ToShortDateString)
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("ImporteAnterior").ToString.ToDouble < 0 Then
e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red
End If
If e.Row.DBCampo("Level").ToString = "2" Then
e.Row.FCLabel("LbNombre").Text = String.Format("&nbsp;&nbsp;&nbsp;{0}", e.Row.DBCampo("Nombre").ToString)
ElseIf e.Row.DBCampo("Level").ToString = "1" Then
e.Row.FCLabel("LbNombre").Font.Bold = True
End If
End If
End Sub
#End Region
Private Sub ImprimirReporte(Optional Formato As String = "PDF")
Dim FechaI = String.Format("01/{0}/{1}", DdlPeriodo.SelectedValue.PadLeft(2, CChar("0")), DdlEjercicio.SelectedValue)
Dim FechaF = DateAdd(DateInterval.Day, -1, DateAdd(DateInterval.Month, 1, CDate(FechaI))).ToString("dd/MM/yyyy")
'nombre del archivo a generar
Dim fileName As String = "EdoSituacionFinanciera"
'ubicacion del rdlc
Dim reportpath As String = "Contabilidad/Reportes/RepSituacionFinanciera.rdlc"
'parametros a enviar al reporte
Dim params As New List(Of ReportParameter)
params.Add(New ReportParameter("pEmp", UsuarioActual.Empresa.Empresa))
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
params.Add(New ReportParameter("pImg", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
params.Add(New ReportParameter("pFirma1", If(ChkFirma.Checked, String.Format("{0}", vbCrLf), "")))
params.Add(New ReportParameter("pFirma2", If(ChkFirma.Checked, String.Format("{0}l", vbCrLf), "")))
params.Add(New ReportParameter("pFechaFin", FechaF))
params.Add(New ReportParameter("periodo", String.Format("de {0} {1}", DdlPeriodo.SelectedItem.ToString, DdlEjercicio.SelectedItem.ToString)))
'ImprimirPDF(reportpath, DtDatos, params, fileName, Formato)
End Sub
#Region "M E S H O R I Z O N T A L"
Private Sub CargaDatosMesH()
FechaIMes = $"01/01/1900"
FechaFMes = $"31/12/{DdlEjercicio.SelectedValue}"
Dim CveSubProyecto As Integer = If(DdlSubproyecto.SelectedValue.ToEntero = -1, -2, DdlSubproyecto.SelectedValue.ToEntero)
'Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa)
Dim ObjConta As New ClsContabilidad
If ObjConta.GetSituacionFinancieraMensuallHorizontal(FechaIMes.ToDate, FechaFMes.ToDate, CveSubProyecto, DdlDivisor.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then
DtDatosMesH = ObjConta.DtResultados.FiltraParametros("(ImporteActual <> 0 OR ImporteAcumulado <> 0)")
Else
DtDatosMesH = Nothing
Alert("Ocurrio un error al cargar los datos del Estado de Actividades", TipoMensaje.MsgError)
End If
ObjConta.Dispose()
If DtDatosMesH IsNot Nothing Then
CargaGridsMesH()
Else
End If
End Sub
Private Sub CargaGridsMesH()
'DtIngresosMesH = DtDatosMesH.FiltraParametros("Tipo IN ('A', 'D', 'F')")
'DtGastosMesH = DtDatosMesH.FiltraParametros("Tipo ='G' ")
DTTotalesMesH = DtDatosMesH.Clone()
Dim DT_ACTIVO As DataTable = DtDatosMesH.Clone()
Dim DT_PASIVO As DataTable = DtDatosMesH.Clone()
Dim DT_TOTALES As DataTable = DtDatosMesH.Clone()
Dim DT_ACTIVO_CIRCULANTE As DataTable = DtDatosMesH.FiltraParametros(" Sup = 'ACTIVO CIRCULANTE' ")
Dim DT_ACTIVO_FIJO As DataTable = DtDatosMesH.FiltraParametros(" Sup = 'ACTIVO FIJO' ")
Dim DT_ACTIVO_DIFERIDO As DataTable = DtDatosMesH.FiltraParametros(" Sup = 'ACTIVO DIFERIDO' ")
Dim DT_PASIVO_CIRCULANTE As DataTable = DtDatosMesH.FiltraParametros(" Sup = 'PASIVO CIRCULANTE' ")
Dim DT_PASIVO_NO_CIRCULANTE As DataTable = DtDatosMesH.FiltraParametros(" Sup = 'PASIVO NO CIRCULANTE' ")
Dim DT_CAPITAL_CONTABLE As DataTable = DtDatosMesH.FiltraParametros(" Sup = 'CAPITAL CONTABLE' ")
Dim TotalActual = 0.0, TotalAnterior = 0.0
Dim RowAF As DataRow = DT_ACTIVO_CIRCULANTE.NewRow
If DT_ACTIVO_CIRCULANTE.Rows.Count > 0 Then
For Each dr As DataRow In DT_ACTIVO_CIRCULANTE.FiltraParametros("NOT CtaMayor in (3,4)").Rows
TotalActual += dr("ImporteActual").ToString.ToDouble
TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble
Next
RowAF.Item("Enero") = DT_ACTIVO_CIRCULANTE.SUM("Enero", "NOT CtaMayor in (3,4)")
RowAF.Item("Febrero") = DT_ACTIVO_CIRCULANTE.SUM("Febrero", "NOT CtaMayor in (3,4)")
RowAF.Item("Marzo") = DT_ACTIVO_CIRCULANTE.SUM("Marzo", "NOT CtaMayor in (3,4)")
RowAF.Item("Abril") = DT_ACTIVO_CIRCULANTE.SUM("Abril", "NOT CtaMayor in (3,4)")
RowAF.Item("Mayo") = DT_ACTIVO_CIRCULANTE.SUM("Mayo", "NOT CtaMayor in (3,4)")
RowAF.Item("Junio") = DT_ACTIVO_CIRCULANTE.SUM("Junio", "NOT CtaMayor in (3,4)")
RowAF.Item("Julio") = DT_ACTIVO_CIRCULANTE.SUM("Julio", "NOT CtaMayor in (3,4)")
RowAF.Item("Agosto") = DT_ACTIVO_CIRCULANTE.SUM("Agosto", "NOT CtaMayor in (3,4)")
RowAF.Item("Septiembre") = DT_ACTIVO_CIRCULANTE.SUM("Septiembre", "NOT CtaMayor in (3,4)")
RowAF.Item("Octubre") = DT_ACTIVO_CIRCULANTE.SUM("Octubre", "NOT CtaMayor in (3,4)")
RowAF.Item("Noviembre") = DT_ACTIVO_CIRCULANTE.SUM("Noviembre", "NOT CtaMayor in (3,4)")
RowAF.Item("Diciembre") = DT_ACTIVO_CIRCULANTE.SUM("Diciembre", "NOT CtaMayor in (3,4)")
RowAF.Item("Nombre") = "TOTAL ACTIVO CIRCULANTE"
RowAF.Item("ImporteActual") = TotalActual.ToString
RowAF.Item("PorcentajeActual") = 100.0
RowAF.Item("ImporteAcumulado") = TotalAnterior.ToString
RowAF.Item("PorcentajeAcumulado") = 100.0
RowAF.Item("CtaMayor") = -1
DT_ACTIVO_CIRCULANTE.Rows.Add(RowAF)
Else
RowAF.Item("Nombre") = "TOTAL ACTIVO CIRCULANTE"
RowAF.Item("ImporteActual") = 0.00
RowAF.Item("ImporteAcumulado") = 0.00
RowAF.Item("CtaMayor") = -1
DT_ACTIVO_CIRCULANTE.Rows.Add(RowAF)
End If
TotalActual = 0
TotalAnterior = 0
RowAF = DT_ACTIVO_FIJO.NewRow
If DT_ACTIVO_FIJO.Rows.Count > 0 Then
For Each dr As DataRow In DT_ACTIVO_FIJO.FiltraParametros("NOT CtaMayor in (3,4)").Rows
TotalActual += dr("ImporteActual").ToString.ToDouble
TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble
Next
RowAF.Item("Enero") = DT_ACTIVO_FIJO.SUM("Enero", "NOT CtaMayor in (3,4)")
RowAF.Item("Febrero") = DT_ACTIVO_FIJO.SUM("Febrero", "NOT CtaMayor in (3,4)")
RowAF.Item("Marzo") = DT_ACTIVO_FIJO.SUM("Marzo", "NOT CtaMayor in (3,4)")
RowAF.Item("Abril") = DT_ACTIVO_FIJO.SUM("Abril", "NOT CtaMayor in (3,4)")
RowAF.Item("Mayo") = DT_ACTIVO_FIJO.SUM("Mayo", "NOT CtaMayor in (3,4)")
RowAF.Item("Junio") = DT_ACTIVO_FIJO.SUM("Junio", "NOT CtaMayor in (3,4)")
RowAF.Item("Julio") = DT_ACTIVO_FIJO.SUM("Julio", "NOT CtaMayor in (3,4)")
RowAF.Item("Agosto") = DT_ACTIVO_FIJO.SUM("Agosto", "NOT CtaMayor in (3,4)")
RowAF.Item("Septiembre") = DT_ACTIVO_FIJO.SUM("Septiembre", "NOT CtaMayor in (3,4)")
RowAF.Item("Octubre") = DT_ACTIVO_FIJO.SUM("Octubre", "NOT CtaMayor in (3,4)")
RowAF.Item("Noviembre") = DT_ACTIVO_FIJO.SUM("Noviembre", "NOT CtaMayor in (3,4)")
RowAF.Item("Diciembre") = DT_ACTIVO_FIJO.SUM("Diciembre", "NOT CtaMayor in (3,4)")
RowAF.Item("Nombre") = "TOTAL ACTIVO NO CIRCULANTE"
RowAF.Item("ImporteActual") = TotalActual.ToString
RowAF.Item("PorcentajeActual") = 100.0
RowAF.Item("ImporteAcumulado") = TotalAnterior.ToString
RowAF.Item("PorcentajeAcumulado") = 100.0
RowAF.Item("CtaMayor") = -1
DT_ACTIVO_FIJO.Rows.Add(RowAF)
Else
RowAF.Item("Nombre") = "TOTAL ACTIVO NO CIRCULANTE"
RowAF.Item("ImporteActual") = 0.00
RowAF.Item("ImporteAcumulado") = 0.00
RowAF.Item("CtaMayor") = -1
DT_ACTIVO_FIJO.Rows.Add(RowAF)
End If
TotalActual = 0
TotalAnterior = 0
RowAF = DT_ACTIVO_DIFERIDO.NewRow
If DT_ACTIVO_DIFERIDO.Rows.Count > 0 Then
For Each dr As DataRow In DT_ACTIVO_DIFERIDO.FiltraParametros("NOT CtaMayor in (3,4)").Rows
TotalActual += dr("ImporteActual").ToString.ToDouble
TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble
Next
RowAF.Item("Enero") = DT_ACTIVO_DIFERIDO.SUM("Enero", "NOT CtaMayor in (3,4)")
RowAF.Item("Febrero") = DT_ACTIVO_DIFERIDO.SUM("Febrero", "NOT CtaMayor in (3,4)")
RowAF.Item("Marzo") = DT_ACTIVO_DIFERIDO.SUM("Marzo", "NOT CtaMayor in (3,4)")
RowAF.Item("Abril") = DT_ACTIVO_DIFERIDO.SUM("Abril", "NOT CtaMayor in (3,4)")
RowAF.Item("Mayo") = DT_ACTIVO_DIFERIDO.SUM("Mayo", "NOT CtaMayor in (3,4)")
RowAF.Item("Junio") = DT_ACTIVO_DIFERIDO.SUM("Junio", "NOT CtaMayor in (3,4)")
RowAF.Item("Julio") = DT_ACTIVO_DIFERIDO.SUM("Julio", "NOT CtaMayor in (3,4)")
RowAF.Item("Agosto") = DT_ACTIVO_DIFERIDO.SUM("Agosto", "NOT CtaMayor in (3,4)")
RowAF.Item("Septiembre") = DT_ACTIVO_DIFERIDO.SUM("Septiembre", "NOT CtaMayor in (3,4)")
RowAF.Item("Octubre") = DT_ACTIVO_DIFERIDO.SUM("Octubre", "NOT CtaMayor in (3,4)")
RowAF.Item("Noviembre") = DT_ACTIVO_DIFERIDO.SUM("Noviembre", "NOT CtaMayor in (3,4)")
RowAF.Item("Diciembre") = DT_ACTIVO_DIFERIDO.SUM("Diciembre", "NOT CtaMayor in (3,4)")
RowAF.Item("Nombre") = "TOTAL ACTIVO DIFERIDO"
RowAF.Item("ImporteActual") = TotalActual.ToString
RowAF.Item("PorcentajeActual") = 100.0
RowAF.Item("ImporteAcumulado") = TotalAnterior.ToString
RowAF.Item("PorcentajeAcumulado") = 100.0
RowAF.Item("CtaMayor") = -1
DT_ACTIVO_DIFERIDO.Rows.Add(RowAF)
Else
RowAF.Item("Nombre") = "TOTAL ACTIVO DIFERIDO"
RowAF.Item("ImporteActual") = 0.00
RowAF.Item("ImporteAcumulado") = 0.00
RowAF.Item("CtaMayor") = -1
DT_ACTIVO_DIFERIDO.Rows.Add(RowAF)
End If
TotalActual = 0
TotalAnterior = 0
RowAF = DT_PASIVO_CIRCULANTE.NewRow
If DT_PASIVO_CIRCULANTE.Rows.Count > 0 Then
For Each dr As DataRow In DT_PASIVO_CIRCULANTE.FiltraParametros("NOT CtaMayor in (3,4)").Rows
TotalActual += dr("ImporteActual").ToString.ToDouble
TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble
Next
RowAF.Item("Enero") = DT_PASIVO_CIRCULANTE.SUM("Enero", "NOT CtaMayor in (3,4)")
RowAF.Item("Febrero") = DT_PASIVO_CIRCULANTE.SUM("Febrero", "NOT CtaMayor in (3,4)")
RowAF.Item("Marzo") = DT_PASIVO_CIRCULANTE.SUM("Marzo", "NOT CtaMayor in (3,4)")
RowAF.Item("Abril") = DT_PASIVO_CIRCULANTE.SUM("Abril", "NOT CtaMayor in (3,4)")
RowAF.Item("Mayo") = DT_PASIVO_CIRCULANTE.SUM("Mayo", "NOT CtaMayor in (3,4)")
RowAF.Item("Junio") = DT_PASIVO_CIRCULANTE.SUM("Junio", "NOT CtaMayor in (3,4)")
RowAF.Item("Julio") = DT_PASIVO_CIRCULANTE.SUM("Julio", "NOT CtaMayor in (3,4)")
RowAF.Item("Agosto") = DT_PASIVO_CIRCULANTE.SUM("Agosto", "NOT CtaMayor in (3,4)")
RowAF.Item("Septiembre") = DT_PASIVO_CIRCULANTE.SUM("Septiembre", "NOT CtaMayor in (3,4)")
RowAF.Item("Octubre") = DT_PASIVO_CIRCULANTE.SUM("Octubre", "NOT CtaMayor in (3,4)")
RowAF.Item("Noviembre") = DT_PASIVO_CIRCULANTE.SUM("Noviembre", "NOT CtaMayor in (3,4)")
RowAF.Item("Diciembre") = DT_PASIVO_CIRCULANTE.SUM("Diciembre", "NOT CtaMayor in (3,4)")
RowAF.Item("Nombre") = "TOTAL PASIVO CIRCULANTE"
RowAF.Item("ImporteActual") = TotalActual.ToString
RowAF.Item("PorcentajeActual") = 100.0
RowAF.Item("ImporteAcumulado") = TotalAnterior.ToString
RowAF.Item("PorcentajeAcumulado") = 100.0
RowAF.Item("CtaMayor") = -1
DT_PASIVO_CIRCULANTE.Rows.Add(RowAF)
Else
RowAF.Item("Nombre") = "TOTAL PASIVO CIRCULANTE"
RowAF.Item("ImporteActual") = 0.00
RowAF.Item("ImporteAcumulado") = 0.00
RowAF.Item("CtaMayor") = -1
DT_PASIVO_CIRCULANTE.Rows.Add(RowAF)
End If
TotalActual = 0
TotalAnterior = 0
RowAF = DT_PASIVO_NO_CIRCULANTE.NewRow
If DT_PASIVO_NO_CIRCULANTE.Rows.Count > 0 Then
For Each dr As DataRow In DT_PASIVO_NO_CIRCULANTE.FiltraParametros("NOT CtaMayor in (3,4)").Rows
TotalActual += dr("ImporteActual").ToString.ToDouble
TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble
Next
RowAF.Item("Enero") = DT_PASIVO_NO_CIRCULANTE.SUM("Enero", "NOT CtaMayor in (3,4)")
RowAF.Item("Febrero") = DT_PASIVO_NO_CIRCULANTE.SUM("Febrero", "NOT CtaMayor in (3,4)")
RowAF.Item("Marzo") = DT_PASIVO_NO_CIRCULANTE.SUM("Marzo", "NOT CtaMayor in (3,4)")
RowAF.Item("Abril") = DT_PASIVO_NO_CIRCULANTE.SUM("Abril", "NOT CtaMayor in (3,4)")
RowAF.Item("Mayo") = DT_PASIVO_NO_CIRCULANTE.SUM("Mayo", "NOT CtaMayor in (3,4)")
RowAF.Item("Junio") = DT_PASIVO_NO_CIRCULANTE.SUM("Junio", "NOT CtaMayor in (3,4)")
RowAF.Item("Julio") = DT_PASIVO_NO_CIRCULANTE.SUM("Julio", "NOT CtaMayor in (3,4)")
RowAF.Item("Agosto") = DT_PASIVO_NO_CIRCULANTE.SUM("Agosto", "NOT CtaMayor in (3,4)")
RowAF.Item("Septiembre") = DT_PASIVO_NO_CIRCULANTE.SUM("Septiembre", "NOT CtaMayor in (3,4)")
RowAF.Item("Octubre") = DT_PASIVO_NO_CIRCULANTE.SUM("Octubre", "NOT CtaMayor in (3,4)")
RowAF.Item("Noviembre") = DT_PASIVO_NO_CIRCULANTE.SUM("Noviembre", "NOT CtaMayor in (3,4)")
RowAF.Item("Diciembre") = DT_PASIVO_NO_CIRCULANTE.SUM("Diciembre", "NOT CtaMayor in (3,4)")
RowAF.Item("Nombre") = "TOTAL PASIVO NO CIRCULANTE"
RowAF.Item("ImporteActual") = TotalActual.ToString
RowAF.Item("PorcentajeActual") = 100.0
RowAF.Item("ImporteAcumulado") = TotalAnterior.ToString
RowAF.Item("PorcentajeAcumulado") = 100.0
RowAF.Item("CtaMayor") = -1
DT_PASIVO_NO_CIRCULANTE.Rows.Add(RowAF)
Else
RowAF.Item("Nombre") = "TOTAL PASIVO NO CIRCULANTE"
RowAF.Item("ImporteActual") = 0.00
RowAF.Item("ImporteAcumulado") = 0.00
RowAF.Item("CtaMayor") = -1
DT_PASIVO_NO_CIRCULANTE.Rows.Add(RowAF)
End If
TotalActual = 0
TotalAnterior = 0
RowAF = DT_CAPITAL_CONTABLE.NewRow
If DT_PASIVO_NO_CIRCULANTE.Rows.Count > 0 Then
For Each dr As DataRow In DT_CAPITAL_CONTABLE.FiltraParametros("NOT CtaMayor in (3,4)").Rows
TotalActual += dr("ImporteActual").ToString.ToDouble
TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble
Next
RowAF.Item("Enero") = DT_CAPITAL_CONTABLE.SUM("Enero", "NOT CtaMayor in (3,4)")
RowAF.Item("Febrero") = DT_CAPITAL_CONTABLE.SUM("Febrero", "NOT CtaMayor in (3,4)")
RowAF.Item("Marzo") = DT_CAPITAL_CONTABLE.SUM("Marzo", "NOT CtaMayor in (3,4)")
RowAF.Item("Abril") = DT_CAPITAL_CONTABLE.SUM("Abril", "NOT CtaMayor in (3,4)")
RowAF.Item("Mayo") = DT_CAPITAL_CONTABLE.SUM("Mayo", "NOT CtaMayor in (3,4)")
RowAF.Item("Junio") = DT_CAPITAL_CONTABLE.SUM("Junio", "NOT CtaMayor in (3,4)")
RowAF.Item("Julio") = DT_CAPITAL_CONTABLE.SUM("Julio", "NOT CtaMayor in (3,4)")
RowAF.Item("Agosto") = DT_CAPITAL_CONTABLE.SUM("Agosto", "NOT CtaMayor in (3,4)")
RowAF.Item("Septiembre") = DT_CAPITAL_CONTABLE.SUM("Septiembre", "NOT CtaMayor in (3,4)")
RowAF.Item("Octubre") = DT_CAPITAL_CONTABLE.SUM("Octubre", "NOT CtaMayor in (3,4)")
RowAF.Item("Noviembre") = DT_CAPITAL_CONTABLE.SUM("Noviembre", "NOT CtaMayor in (3,4)")
RowAF.Item("Diciembre") = DT_CAPITAL_CONTABLE.SUM("Diciembre", "NOT CtaMayor in (3,4)")
RowAF.Item("Nombre") = "TOTAL CAPITAL CONTABLE"
RowAF.Item("ImporteActual") = TotalActual.ToString
RowAF.Item("PorcentajeActual") = 100.0
RowAF.Item("ImporteAcumulado") = TotalAnterior.ToString
RowAF.Item("PorcentajeAcumulado") = 100.0
RowAF.Item("CtaMayor") = -1
DT_CAPITAL_CONTABLE.Rows.Add(RowAF)
Else
RowAF.Item("Nombre") = "TOTAL CAPITAL CONTABLE"
RowAF.Item("ImporteActual") = 0.00
RowAF.Item("ImporteAcumulado") = 0.00
RowAF.Item("CtaMayor") = -1
DT_CAPITAL_CONTABLE.Rows.Add(RowAF)
End If
TotalActual = 0
TotalAnterior = 0
DT_ACTIVO.Merge(DT_ACTIVO_CIRCULANTE)
DT_ACTIVO.Merge(DT_ACTIVO_FIJO)
DT_ACTIVO.Merge(DT_ACTIVO_DIFERIDO)
DT_PASIVO.Merge(DT_PASIVO_CIRCULANTE)
DT_PASIVO.Merge(DT_PASIVO_NO_CIRCULANTE)
RowAF = DT_ACTIVO.NewRow
If DT_ACTIVO.Rows.Count > 0 Then
For Each dr As DataRow In DT_ACTIVO.FiltraParametros("NOT CtaMayor in (3,4)").Rows
TotalActual += dr("ImporteActual").ToString.ToDouble
TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble
Next
RowAF.Item("Enero") = DT_ACTIVO.SUM("Enero", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Febrero") = DT_ACTIVO.SUM("Febrero", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Marzo") = DT_ACTIVO.SUM("Marzo", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Abril") = DT_ACTIVO.SUM("Abril", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Mayo") = DT_ACTIVO.SUM("Mayo", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Junio") = DT_ACTIVO.SUM("Junio", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Julio") = DT_ACTIVO.SUM("Julio", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Agosto") = DT_ACTIVO.SUM("Agosto", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Septiembre") = DT_ACTIVO.SUM("Septiembre", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Octubre") = DT_ACTIVO.SUM("Octubre", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Noviembre") = DT_ACTIVO.SUM("Noviembre", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Diciembre") = DT_ACTIVO.SUM("Diciembre", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Nombre") = "TOTAL ACTIVO"
RowAF.Item("ImporteActual") = TotalActual.ToString
RowAF.Item("PorcentajeActual") = 100.0
RowAF.Item("ImporteAcumulado") = TotalAnterior.ToString
RowAF.Item("PorcentajeAcumulado") = 100.0
RowAF.Item("CtaMayor") = -1
DT_ACTIVO.Rows.Add(RowAF)
Else
RowAF.Item("Nombre") = "TOTAL ACTIVO"
RowAF.Item("ImporteActual") = 0.00
RowAF.Item("ImporteAcumulado") = 0.00
RowAF.Item("CtaMayor") = -1
DT_ACTIVO.Rows.Add(RowAF)
End If
TotalActual = 0
TotalAnterior = 0
RowAF = DT_PASIVO.NewRow
If DT_PASIVO.Rows.Count > 0 Then
For Each dr As DataRow In DT_PASIVO.FiltraParametros("NOT CtaMayor in (3,4)").Rows
TotalActual += dr("ImporteActual").ToString.ToDouble
TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble
Next
RowAF.Item("Enero") = DT_PASIVO.SUM("Enero", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Febrero") = DT_PASIVO.SUM("Febrero", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Marzo") = DT_PASIVO.SUM("Marzo", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Abril") = DT_PASIVO.SUM("Abril", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Mayo") = DT_PASIVO.SUM("Mayo", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Junio") = DT_PASIVO.SUM("Junio", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Julio") = DT_PASIVO.SUM("Julio", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Agosto") = DT_PASIVO.SUM("Agosto", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Septiembre") = DT_PASIVO.SUM("Septiembre", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Octubre") = DT_PASIVO.SUM("Octubre", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Noviembre") = DT_PASIVO.SUM("Noviembre", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Diciembre") = DT_PASIVO.SUM("Diciembre", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Nombre") = "TOTAL PASIVO"
RowAF.Item("ImporteActual") = TotalActual.ToString
RowAF.Item("PorcentajeActual") = 100.0
RowAF.Item("ImporteAcumulado") = TotalAnterior.ToString
RowAF.Item("PorcentajeAcumulado") = 100.0
RowAF.Item("CtaMayor") = -1
DT_PASIVO.Rows.Add(RowAF)
Else
RowAF.Item("Nombre") = "TOTAL PASIVO"
RowAF.Item("ImporteActual") = 0.00
RowAF.Item("ImporteAcumulado") = 0.00
RowAF.Item("CtaMayor") = -1
DT_PASIVO.Rows.Add(RowAF)
End If
DT_TOTALES.Merge(DT_ACTIVO)
DT_TOTALES.Merge(DT_PASIVO)
DT_TOTALES.Merge(DT_CAPITAL_CONTABLE)
TotalActual = 0
TotalAnterior = 0
RowAF = DT_TOTALES.NewRow
If DT_ACTIVO.Rows.Count > 0 Then
RowAF.Item("Enero") = DT_ACTIVO.SUM("Enero", "NOT CtaMayor in (-1,3,4)") - DT_PASIVO.SUM("Enero", "NOT CtaMayor in (-1,3,4)") - DT_CAPITAL_CONTABLE.SUM("Enero", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Febrero") = DT_ACTIVO.SUM("Febrero", "NOT CtaMayor in (-1,3,4)") - DT_PASIVO.SUM("Febrero", "NOT CtaMayor in (-1,3,4)") - DT_CAPITAL_CONTABLE.SUM("Febrero", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Marzo") = DT_ACTIVO.SUM("Marzo", "NOT CtaMayor in (-1,3,4)") - DT_PASIVO.SUM("Marzo", "NOT CtaMayor in (-1,3,4)") - DT_CAPITAL_CONTABLE.SUM("Marzo", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Abril") = DT_ACTIVO.SUM("Abril", "NOT CtaMayor in (-1,3,4)") - DT_PASIVO.SUM("Abril", "NOT CtaMayor in (-1,3,4)") - DT_CAPITAL_CONTABLE.SUM("Abril", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Mayo") = DT_ACTIVO.SUM("Mayo", "NOT CtaMayor in (-1,3,4)") - DT_PASIVO.SUM("Mayo", "NOT CtaMayor in (-1,3,4)") - DT_CAPITAL_CONTABLE.SUM("Mayo", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Junio") = DT_ACTIVO.SUM("Junio", "NOT CtaMayor in (-1,3,4)") - DT_PASIVO.SUM("Junio", "NOT CtaMayor in (-1,3,4)") - DT_CAPITAL_CONTABLE.SUM("Junio", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Julio") = DT_ACTIVO.SUM("Julio", "NOT CtaMayor in (-1,3,4)") - DT_PASIVO.SUM("Julio", "NOT CtaMayor in (-1,3,4)") - DT_CAPITAL_CONTABLE.SUM("Julio", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Agosto") = DT_ACTIVO.SUM("Agosto", "NOT CtaMayor in (-1,3,4)") - DT_PASIVO.SUM("Agosto", "NOT CtaMayor in (-1,3,4)") - DT_CAPITAL_CONTABLE.SUM("Agosto", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Septiembre") = DT_ACTIVO.SUM("Septiembre", "NOT CtaMayor in (-1,3,4)") - DT_PASIVO.SUM("Septiembre", "NOT CtaMayor in (-1,3,4)") - DT_CAPITAL_CONTABLE.SUM("Septiembre", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Octubre") = DT_ACTIVO.SUM("Octubre", "NOT CtaMayor in (-1,3,4)") - DT_PASIVO.SUM("Octubre", "NOT CtaMayor in (-1,3,4)") - DT_CAPITAL_CONTABLE.SUM("Octubre", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Noviembre") = DT_ACTIVO.SUM("Noviembre", "NOT CtaMayor in (-1,3,4)") - DT_PASIVO.SUM("Noviembre", "NOT CtaMayor in (-1,3,4)") - DT_CAPITAL_CONTABLE.SUM("Noviembre", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Diciembre") = DT_ACTIVO.SUM("Diciembre", "NOT CtaMayor in (-1,3,4)") - DT_PASIVO.SUM("Diciembre", "NOT CtaMayor in (-1,3,4)") - DT_CAPITAL_CONTABLE.SUM("Diciembre", "NOT CtaMayor in (-1,3,4)")
RowAF.Item("Nombre") = "TOTALES"
RowAF.Item("CtaMayor") = -1
RowAF.Item("ImporteAcumulado") = DT_ACTIVO.SUM("ImporteAcumulado", "NOT CtaMayor in (-1,3,4)") - DT_PASIVO.SUM("ImporteAcumulado", "NOT CtaMayor in (-1,3,4)") - DT_CAPITAL_CONTABLE.SUM("ImporteAcumulado", "NOT CtaMayor in (-1,3,4)") ' TotalAnterior.ToString
DT_TOTALES.Rows.Add(RowAF)
End If
GvIngresosMesH.DataSource = DT_TOTALES
GvIngresosMesH.DataBind()
UpDatosMesH.Update()
End Sub
Protected Sub GvIngresosMesH_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then
'TotalActualMes += e.Row.DBCampo("ImporteActual").ToString.ToDouble
'TotalAnteriorMes += e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble
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("HLEnero").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/01/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/01/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString)
e.Row.FCHyperLink("HLFebrero").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/02/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/02/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString)
e.Row.FCHyperLink("HLMarzo").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/03/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/03/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString)
e.Row.FCHyperLink("HLAbril").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/04/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/04/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString)
e.Row.FCHyperLink("HLMayo").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/05/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/05/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString)
e.Row.FCHyperLink("HLJunio").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/06/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/06/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString)
e.Row.FCHyperLink("HLJulio").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/07/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/07/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString)
e.Row.FCHyperLink("HLAgosto").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/08/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/08/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString)
e.Row.FCHyperLink("HLSeptiembre").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/09/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/09/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString)
e.Row.FCHyperLink("HLOctubre").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/10/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/10/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString)
e.Row.FCHyperLink("HLNoviembre").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/11/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/11/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString)
e.Row.FCHyperLink("HLDiciembre").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/12/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/12/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString)
e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, e.Row.DBCampo("FechaInicial").ToDate.ToShortDateString)
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 GvGastosMesH_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then
'TotalActualMes -= e.Row.DBCampo("ImporteActual").ToString.ToDouble
'TotalAnteriorMes -= e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble
e.Row.ControlStyle.Font.Bold = True
ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then
e.Row.ControlStyle.Font.Bold = True
End If
If e.Row.DBCampo("CtaMayor").ToString.ToEntero > 0 Then
Dim CveCuenta As Integer = e.Row.DataKey("CveCuenta").ToEntero
e.Row.FCHyperLink("HLEnero").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/01/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/01/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString)
e.Row.FCHyperLink("HLFebrero").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/02/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/02/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString)
e.Row.FCHyperLink("HLMarzo").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/03/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/03/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString)
e.Row.FCHyperLink("HLAbril").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/04/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/04/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString)
e.Row.FCHyperLink("HLMayo").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/05/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/05/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString)
e.Row.FCHyperLink("HLJunio").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/06/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/06/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString)
e.Row.FCHyperLink("HLJulio").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/07/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/07/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString)
e.Row.FCHyperLink("HLAgosto").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/08/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/08/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString)
e.Row.FCHyperLink("HLSeptiembre").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/09/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/09/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString)
e.Row.FCHyperLink("HLOctubre").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/10/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/10/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString)
e.Row.FCHyperLink("HLNoviembre").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/11/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/11/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString)
e.Row.FCHyperLink("HLDiciembre").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/12/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/12/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString)
e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, e.Row.DBCampo("FechaInicial").ToDate.ToShortDateString)
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 GvTotalesMesH_RowDataBound(sender As Object, e As GridViewRowEventArgs)
' If e.Row.RowType = DataControlRowType.Header Then
' e.Row.Attributes.Add("style", "display:none")
' End If
' If e.Row.RowType = DataControlRowType.DataRow Then
' e.Row.Attributes.Add("style", "Font-weight: bold")
' End If
'End Sub
#End Region
#Region "Anual H O R I Z O N T A L"
Private Sub CargaDatosAnualH()
FechaIMes = $"01/01/1900"
FechaFMes = $"31/12/{DdlEjercicio.SelectedValue}"
Dim CveSubProyecto As Integer = If(DdlSubproyecto.SelectedValue.ToEntero = -1, -2, DdlSubproyecto.SelectedValue.ToEntero)
Dim ObjConta As New ClsContabilidad
If ObjConta.GetSituacionFinancieraAnualHorizontal(FechaIMes.ToDate, FechaFMes.ToDate, CveSubProyecto, DdlDivisor.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then
DtDatosAnualH = ObjConta.DtResultados.FiltraParametros("(ImporteActual <> 0 OR ImporteAcumulado <> 0)")
Else
DtDatosAnualH = Nothing
Alert("Ocurrio un error al cargar los datos del Estado de Actividades", TipoMensaje.MsgError)
End If
ObjConta.Dispose()
If DtDatosAnualH IsNot Nothing Then
CargaGridsAnualH()
End If
End Sub
Private Sub CargaGridsAnualH()
DtIngresosAnualH = DtDatosAnualH.FiltraParametros("Tipo ='H' ")
DtGastosAnualH = DtDatosAnualH.FiltraParametros("Tipo ='G' ")
DTTotalesAnualH = DtDatosAnualH.Clone()
Dim DT_ACTIVO As DataTable = DtDatosAnualH.Clone()
Dim DT_PASIVO As DataTable = DtDatosAnualH.Clone()
Dim DT_TOTALES As DataTable = DtDatosAnualH.Clone()
Dim DT_ACTIVO_CIRCULANTE As DataTable = DtDatosAnualH.FiltraParametros(" Sup = 'ACTIVO CIRCULANTE' ")
Dim DT_ACTIVO_FIJO As DataTable = DtDatosAnualH.FiltraParametros(" Sup = 'ACTIVO FIJO' ")
Dim DT_ACTIVO_DIFERIDO As DataTable = DtDatosAnualH.FiltraParametros(" Sup = 'ACTIVO DIFERIDO' ")
Dim DT_PASIVO_CIRCULANTE As DataTable = DtDatosAnualH.FiltraParametros(" Sup = 'PASIVO CIRCULANTE' ")
Dim DT_PASIVO_NO_CIRCULANTE As DataTable = DtDatosAnualH.FiltraParametros(" Sup = 'PASIVO NO CIRCULANTE' ")
Dim DT_CAPITAL_CONTABLE As DataTable = DtDatosAnualH.FiltraParametros(" Sup = 'CAPITAL CONTABLE' ")
Dim TotalActual = 0.0, TotalAnterior = 0.0
Dim IndexData As Integer = 0
Dim IndexGv As Integer = 1
Dim IndexMax As Integer = 11
For Each dCoumn As DataColumn In DtDatosAnualH.Columns
If IndexData >= 11 Then
If dCoumn.ColumnName.ToEntero > 0 And dCoumn.ColumnName.ToEntero <= DdlEjercicio.SelectedValue.ToEntero Then
CType(GvIngresosAnualH.Columns(IndexGv), BoundField).DataField = dCoumn.ColumnName
CType(GvIngresosAnualH.Columns(IndexGv), BoundField).HeaderText = dCoumn.ColumnName
GvIngresosAnualH.Columns(IndexGv).Visible = True
GvTotalesAnualH.Columns(IndexGv).Visible = True
IndexMax = IndexData
Else
GvIngresosAnualH.Columns(IndexGv).Visible = False
GvTotalesAnualH.Columns(IndexGv).Visible = False
End If
IndexGv = IndexGv + 1
End If
IndexData = IndexData + 1
Next
'IndexData = 14
'Dim Row As DataRow = DT_ACTIVO_CIRCULANTE.NewRow
'If DtDatosAnualH.Rows.Count > 0 Then
' For IndexData = 13 To IndexMax
' Row.Item(IndexData) = DtIngresosAnualH.SUM($"[{DtIngresosAnualH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (3,4)")
' Next
' Row.Item("Nombre") = "TOTAL INGRESOS "
' Row.Item("ImporteActual") = DtIngresosAnualH.SUM("ImporteActual", "NOT CtaMayor in (3,4)")
' Row.Item("PorcentajeActual") = 100.0
' Row.Item("ImporteAcumulado") = DtIngresosAnualH.SUM("ImporteAcumulado", "NOT CtaMayor in (3,4)")
' Row.Item("PorcentajeAcumulado") = 100.0
' Row.Item("CtaMayor") = -1
' DtIngresosAnualH.Rows.Add(Row)
'Else
' Row.Item("Nombre") = "TOTAL INGRESOS "
' Row.Item("ImporteActual") = "0.00"
' Row.Item("ImporteAcumulado") = "0.00"
' Row.Item("CtaMayor") = -1
' DtIngresosAnualH.Rows.Add(Row)
'End If
'Dim T1 = TotalActual, T2 = TotalAnterior
TotalActual = 0
TotalAnterior = 0
IndexData = 11
Dim Row As DataRow = DT_ACTIVO_CIRCULANTE.NewRow
'Row = DT_ACTIVO_CIRCULANTE.NewRow
If DT_ACTIVO_CIRCULANTE.Rows.Count > 0 Then
For IndexData = 11 To IndexMax
Row.Item(IndexData) = DT_ACTIVO_CIRCULANTE.SUM($"[{DT_ACTIVO_CIRCULANTE.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (3,4)")
Next
Row.Item("Nombre") = "TOTAL ACTIVO CIRCULANTE"
Row.Item("ImporteActual") = DT_ACTIVO_CIRCULANTE.SUM("ImporteActual", "NOT CtaMayor in (3,4)")
Row.Item("PorcentajeActual") = 100.0
Row.Item("ImporteAcumulado") = DT_ACTIVO_CIRCULANTE.SUM("ImporteAcumulado", "NOT CtaMayor in (3,4)")
Row.Item("PorcentajeAcumulado") = 100.0
Row.Item("CtaMayor") = -1
DT_ACTIVO_CIRCULANTE.Rows.Add(Row)
Else
Row.Item("Nombre") = "TOTAL ACTIVO CIRCULANTE"
Row.Item("ImporteActual") = "0.00"
Row.Item("ImporteAcumulado") = "0.00"
Row.Item("CtaMayor") = -1
DT_ACTIVO_CIRCULANTE.Rows.Add(Row)
End If
TotalActual = 0
TotalAnterior = 0
IndexData = 11
Row = DT_ACTIVO_FIJO.NewRow
If DT_ACTIVO_FIJO.Rows.Count > 0 Then
For IndexData = 11 To IndexMax
Row.Item(IndexData) = DT_ACTIVO_FIJO.SUM($"[{DT_ACTIVO_FIJO.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (3,4)")
Next
Row.Item("Nombre") = "TOTAL ACTIVO NO CIRCULANTE"
Row.Item("ImporteActual") = DT_ACTIVO_FIJO.SUM("ImporteActual", "NOT CtaMayor in (3,4)")
Row.Item("PorcentajeActual") = 100.0
Row.Item("ImporteAcumulado") = DT_ACTIVO_FIJO.SUM("ImporteAcumulado", "NOT CtaMayor in (3,4)")
Row.Item("PorcentajeAcumulado") = 100.0
Row.Item("CtaMayor") = -1
DT_ACTIVO_FIJO.Rows.Add(Row)
Else
Row.Item("Nombre") = "TOTAL ACTIVO NO CIRCULANTE"
Row.Item("ImporteActual") = "0.00"
Row.Item("ImporteAcumulado") = "0.00"
Row.Item("CtaMayor") = -1
DT_ACTIVO_FIJO.Rows.Add(Row)
End If
TotalActual = 0
TotalAnterior = 0
IndexData = 11
Row = DT_ACTIVO_DIFERIDO.NewRow
If DT_ACTIVO_DIFERIDO.Rows.Count > 0 Then
For IndexData = 11 To IndexMax
Row.Item(IndexData) = DT_ACTIVO_DIFERIDO.SUM($"[{DT_ACTIVO_DIFERIDO.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (3,4)")
Next
Row.Item("Nombre") = "TOTAL ACTIVO DIFERIDO"
Row.Item("ImporteActual") = DT_ACTIVO_DIFERIDO.SUM("ImporteActual", "NOT CtaMayor in (3,4)")
Row.Item("PorcentajeActual") = 100.0
Row.Item("ImporteAcumulado") = DT_ACTIVO_DIFERIDO.SUM("ImporteAcumulado", "NOT CtaMayor in (3,4)")
Row.Item("PorcentajeAcumulado") = 100.0
Row.Item("CtaMayor") = -1
DT_ACTIVO_DIFERIDO.Rows.Add(Row)
Else
Row.Item("Nombre") = "TOTAL ACTIVO DIFERIDO"
Row.Item("ImporteActual") = "0.00"
Row.Item("ImporteAcumulado") = "0.00"
Row.Item("CtaMayor") = -1
DT_ACTIVO_DIFERIDO.Rows.Add(Row)
End If
TotalActual = 0
TotalAnterior = 0
IndexData = 11
Row = DT_PASIVO_CIRCULANTE.NewRow
If DT_PASIVO_CIRCULANTE.Rows.Count > 0 Then
For IndexData = 11 To IndexMax
Row.Item(IndexData) = DT_PASIVO_CIRCULANTE.SUM($"[{DT_PASIVO_CIRCULANTE.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (3,4)")
Next
Row.Item("Nombre") = "TOTAL PASIVO CIRCULANTE"
Row.Item("ImporteActual") = DT_PASIVO_CIRCULANTE.SUM("ImporteActual", "NOT CtaMayor in (3,4)")
Row.Item("PorcentajeActual") = 100.0
Row.Item("ImporteAcumulado") = DT_PASIVO_CIRCULANTE.SUM("ImporteAcumulado", "NOT CtaMayor in (3,4)")
Row.Item("PorcentajeAcumulado") = 100.0
Row.Item("CtaMayor") = -1
DT_PASIVO_CIRCULANTE.Rows.Add(Row)
Else
Row.Item("Nombre") = "TOTAL PASIVO CIRCULANTE"
Row.Item("ImporteActual") = "0.00"
Row.Item("ImporteAcumulado") = "0.00"
Row.Item("CtaMayor") = -1
DT_PASIVO_CIRCULANTE.Rows.Add(Row)
End If
TotalActual = 0
TotalAnterior = 0
IndexData = 11
Row = DT_PASIVO_NO_CIRCULANTE.NewRow
If DT_PASIVO_NO_CIRCULANTE.Rows.Count > 0 Then
For IndexData = 11 To IndexMax
Row.Item(IndexData) = DT_PASIVO_NO_CIRCULANTE.SUM($"[{DT_PASIVO_NO_CIRCULANTE.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (3,4)")
Next
Row.Item("Nombre") = "TOTAL PASIVO NO CIRCULANTE"
Row.Item("ImporteActual") = DT_PASIVO_NO_CIRCULANTE.SUM("ImporteActual", "NOT CtaMayor in (3,4)")
Row.Item("PorcentajeActual") = 100.0
Row.Item("ImporteAcumulado") = DT_PASIVO_NO_CIRCULANTE.SUM("ImporteAcumulado", "NOT CtaMayor in (3,4)")
Row.Item("PorcentajeAcumulado") = 100.0
Row.Item("CtaMayor") = -1
DT_PASIVO_NO_CIRCULANTE.Rows.Add(Row)
Else
Row.Item("Nombre") = "TOTAL PASIVO NO CIRCULANTE"
Row.Item("ImporteActual") = "0.00"
Row.Item("ImporteAcumulado") = "0.00"
Row.Item("CtaMayor") = -1
DT_PASIVO_NO_CIRCULANTE.Rows.Add(Row)
End If
TotalActual = 0
TotalAnterior = 0
IndexData = 11
Row = DT_CAPITAL_CONTABLE.NewRow
If DT_CAPITAL_CONTABLE.Rows.Count > 0 Then
For IndexData = 11 To IndexMax
Row.Item(IndexData) = DT_CAPITAL_CONTABLE.SUM($"[{DT_CAPITAL_CONTABLE.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (3,4)")
Next
Row.Item("Nombre") = "TOTAL CAPITAL CONTABLE"
Row.Item("ImporteActual") = DT_CAPITAL_CONTABLE.SUM("ImporteActual", "NOT CtaMayor in (3,4)")
Row.Item("PorcentajeActual") = 100.0
Row.Item("ImporteAcumulado") = DT_CAPITAL_CONTABLE.SUM("ImporteAcumulado", "NOT CtaMayor in (3,4)")
Row.Item("PorcentajeAcumulado") = 100.0
Row.Item("CtaMayor") = -1
DT_CAPITAL_CONTABLE.Rows.Add(Row)
Else
Row.Item("Nombre") = "TOTAL CAPITAL CONTABLE"
Row.Item("ImporteActual") = "0.00"
Row.Item("ImporteAcumulado") = "0.00"
Row.Item("CtaMayor") = -1
DT_CAPITAL_CONTABLE.Rows.Add(Row)
End If
TotalActual = 0
TotalAnterior = 0
DT_ACTIVO.Merge(DT_ACTIVO_CIRCULANTE)
DT_ACTIVO.Merge(DT_ACTIVO_FIJO)
DT_ACTIVO.Merge(DT_ACTIVO_DIFERIDO)
DT_PASIVO.Merge(DT_PASIVO_CIRCULANTE)
DT_PASIVO.Merge(DT_PASIVO_NO_CIRCULANTE)
IndexData = 11
Row = DT_ACTIVO.NewRow
If DT_ACTIVO.Rows.Count > 0 Then
For IndexData = 11 To IndexMax
Row.Item(IndexData) = DT_ACTIVO.SUM($"[{DT_ACTIVO.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (-1,3,4)")
Next
Row.Item("Nombre") = "TOTAL ACTIVO"
Row.Item("ImporteActual") = DT_ACTIVO.SUM("ImporteActual", "NOT CtaMayor in (-1,3,4)")
Row.Item("PorcentajeActual") = 100.0
Row.Item("ImporteAcumulado") = DT_ACTIVO.SUM("ImporteAcumulado", "NOT CtaMayor in (-1,3,4)")
Row.Item("PorcentajeAcumulado") = 100.0
Row.Item("CtaMayor") = -1
DT_ACTIVO.Rows.Add(Row)
Else
Row.Item("Nombre") = "TOTAL ACTIVO"
Row.Item("ImporteActual") = "0.00"
Row.Item("ImporteAcumulado") = "0.00"
Row.Item("CtaMayor") = -1
DT_ACTIVO.Rows.Add(Row)
End If
IndexData = 11
Row = DT_PASIVO.NewRow
If DT_PASIVO.Rows.Count > 0 Then
For IndexData = 11 To IndexMax
Row.Item(IndexData) = DT_PASIVO.SUM($"[{DT_PASIVO.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (-1,3,4)")
Next
Row.Item("Nombre") = "TOTAL PASIVO"
Row.Item("ImporteActual") = DT_PASIVO.SUM("ImporteActual", "NOT CtaMayor in (-1,3,4)")
Row.Item("PorcentajeActual") = 100.0
Row.Item("ImporteAcumulado") = DT_PASIVO.SUM("ImporteAcumulado", "NOT CtaMayor in (-1,3,4)")
Row.Item("PorcentajeAcumulado") = 100.0
Row.Item("CtaMayor") = -1
DT_PASIVO.Rows.Add(Row)
Else
Row.Item("Nombre") = "TOTAL PASIVO"
Row.Item("ImporteActual") = "0.00"
Row.Item("ImporteAcumulado") = "0.00"
Row.Item("CtaMayor") = -1
DT_PASIVO.Rows.Add(Row)
End If
DT_TOTALES.Merge(DT_ACTIVO)
DT_TOTALES.Merge(DT_PASIVO)
DT_TOTALES.Merge(DT_CAPITAL_CONTABLE)
Row = DT_TOTALES.NewRow
If DT_TOTALES.Rows.Count > 0 Then
Row = DT_TOTALES.NewRow
IndexData = 11
For IndexData = 11 To IndexMax
Row.Item(IndexData) = DT_ACTIVO.SUM($"[{DT_ACTIVO.Columns(IndexData).ColumnName}]", "Not CtaMayor In (-1,3,4)") - DT_PASIVO.SUM($"[{DT_PASIVO.Columns(IndexData).ColumnName}]", "Not CtaMayor In (-1,3,4)") - DT_CAPITAL_CONTABLE.SUM($"[{DT_CAPITAL_CONTABLE.Columns(IndexData).ColumnName}]", "Not CtaMayor In (-1,3,4)")
Next
Row.Item("Nombre") = "TOTALES"
Row.Item("CtaMayor") = -1
Row.Item("ImporteActual") = DT_ACTIVO.SUM($"ImporteActual", "Not CtaMayor in (-1,3,4)") - DT_PASIVO.SUM($"ImporteActual", "Not CtaMayor in (-1,3,4)") - DT_CAPITAL_CONTABLE.SUM($"ImporteActual", "Not CtaMayor in (-1,3,4)")
Row.Item("ImporteAcumulado") = DT_ACTIVO.SUM($"ImporteAcumulado", "Not CtaMayor in (-1,3,4)") - DT_PASIVO.SUM($"ImporteAcumulado", "Not CtaMayor in (-1,3,4)") - DT_CAPITAL_CONTABLE.SUM($"ImporteAcumulado", "Not CtaMayor in (-1,3,4)")
DT_TOTALES.Rows.Add(Row)
End If
GvIngresosAnualH.DataSource = DT_TOTALES
GvIngresosAnualH.DataBind()
'GvGastosAnualH.DataSource = DtGastosAnualH
'GvGastosAnualH.DataBind()
'GvTotalesAnualH.DataSource = DTTotalesAnualH
'GvTotalesAnualH.DataBind()
UpDatosAnualH.Update()
End Sub
Protected Sub GvIngresosAnualH_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then
'TotalActualMes += e.Row.DBCampo("ImporteActual").ToString.ToDouble
'TotalAnteriorMes += e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble
e.Row.ControlStyle.Font.Bold = True
ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then
e.Row.ControlStyle.Font.Bold = True
End If
Dim CveCuenta As Integer = e.Row.DataKey("CveCuenta").ToEntero
Dim CveSubProyecto As Integer = e.Row.DataKey("CveSubProyecto").ToEntero
If e.Row.DBCampo("CtaMayor").ToString.ToEntero > 0 Then
Dim CountDinamico As Integer = e.Row.DataKey("CountDinamico").ToEntero
Dim IndiceInicio As Integer = 1
Dim IndiceMax As Integer = 1 + CountDinamico
For IndiceInicio = 1 To IndiceMax
Dim Anio As String = CType(GvIngresosAnualH.Columns(IndiceInicio), BoundField).DataField
Dim Importe As String = e.Row.Cells(IndiceInicio).Text
e.Row.Cells(IndiceInicio).Text = $"<a target='_blank' href='./RepAnexoCatalogo.aspx?CveCuenta={CveCuenta}&FF=31/12/{Anio}&FI=01/01/{Anio}&ER=1&CveSubProyecto={CveSubProyecto}' >{Importe}</a>"
Next IndiceInicio
e.Row.FCHyperLink("HLAnterior").NavigateUrl = $"./RepAnexoCatalogo.aspx?CveCuenta={CveCuenta}&FF=31/12/{DdlEjercicio.SelectedValue}&FI=01/01/1900&ER=1&CveSubProyecto={CveSubProyecto}"
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 GvGastosAnualH_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then
'TotalActualMes -= e.Row.DBCampo("ImporteActual").ToString.ToDouble
'TotalAnteriorMes -= e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble
e.Row.ControlStyle.Font.Bold = True
ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then
e.Row.ControlStyle.Font.Bold = True
End If
Dim CveCuenta As Integer = e.Row.DataKey("CveCuenta").ToEntero
Dim CveSubProyecto As Integer = e.Row.DataKey("CveSubProyecto").ToEntero
If e.Row.DBCampo("CtaMayor").ToString.ToEntero > 0 Then
Dim CountDinamico As Integer = e.Row.DataKey("CountDinamico").ToEntero
Dim IndiceInicio As Integer = 1
Dim IndiceMax As Integer = 1 + CountDinamico
For IndiceInicio = 1 To IndiceMax
Dim Anio As String = CType(GvGastosAnualH.Columns(IndiceInicio), BoundField).DataField
Dim Importe As String = e.Row.Cells(IndiceInicio).Text
e.Row.Cells(IndiceInicio).Text = $"<a target='_blank' href='./RepAnexoCatalogo.aspx?CveCuenta={CveCuenta}&FF=31/12/{Anio}&FI=01/01/{Anio}&ER=1&CveSubProyecto={CveSubProyecto}' >{Importe}</a>"
Next IndiceInicio
e.Row.FCHyperLink("HLAnterior").NavigateUrl = $"./RepAnexoCatalogo.aspx?CveCuenta={CveCuenta}&FF=31/12/{DdlEjercicio.SelectedValue}&FI=01/01/1900&ER=1&CveSubProyecto={CveSubProyecto}"
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 GvTotalesAnualH_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.Header Then
e.Row.Attributes.Add("style", "display:none")
End If
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Attributes.Add("style", "Font-weight: bold")
End If
End Sub
#End Region
#Region "S U B P R O Y E C T O H O R I Z O N T A L"
Private Sub CargaDatosSubProyectoH()
FechaIMes = $"01/01/1900"
FechaFMes = $"01/12/{DdlEjercicio.SelectedValue}"
'FechaFMes = DateAdd(DateInterval.Day, -1, DateAdd(DateInterval.Month, 1, CDate(FechaFMes))).ToString("dd/MM/yyyy")
Dim CveSubProyecto As Integer = DdlSubproyecto.SelectedValue.ToEntero
Dim ObjConta As New ClsContabilidad
If ObjConta.GetSituacionFinancieraSubProyectolHorizontal(FechaIMes.ToDate, FechaFMes.ToDate, CveSubProyecto, DdlDivisor.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then
DTSubProyectosCabecerasH = ObjConta.DSResultados.Tables(0)
DtDatosSubProyectoH = ObjConta.DSResultados.Tables(1).FiltraParametros("(ImporteActual <> 0 OR ImporteAcumulado <> 0)")
Else
DtDatosSubProyectoH = Nothing
Alert("Ocurrio un error al cargar los datos del Estado de Actividades", TipoMensaje.MsgError)
End If
ObjConta.Dispose()
If DtDatosSubProyectoH IsNot Nothing And DTSubProyectosCabecerasH IsNot Nothing Then
CargaGridsSubProyectoH()
'SumaTotalesSubProyectoH()
End If
End Sub
Private Sub CargaGridsSubProyectoH()
DtIngresosSubProyectoH = DtDatosSubProyectoH.FiltraParametros("Tipo ='H' ")
DtGastosSubProyectoH = DtDatosSubProyectoH.FiltraParametros("Tipo ='G' ")
DTTotalesSubProyectoH = DtDatosSubProyectoH.Clone()
Dim DT_ACTIVO As DataTable = DtDatosSubProyectoH.Clone()
Dim DT_PASIVO As DataTable = DtDatosSubProyectoH.Clone()
Dim DT_TOTALES As DataTable = DtDatosSubProyectoH.Clone()
Dim DT_ACTIVO_CIRCULANTE As DataTable = DtDatosSubProyectoH.FiltraParametros(" Sup = 'ACTIVO CIRCULANTE' ")
Dim DT_ACTIVO_FIJO As DataTable = DtDatosSubProyectoH.FiltraParametros(" Sup = 'ACTIVO FIJO' ")
Dim DT_ACTIVO_DIFERIDO As DataTable = DtDatosSubProyectoH.FiltraParametros(" Sup = 'ACTIVO DIFERIDO' ")
Dim DT_PASIVO_CIRCULANTE As DataTable = DtDatosSubProyectoH.FiltraParametros(" Sup = 'PASIVO CIRCULANTE' ")
Dim DT_PASIVO_NO_CIRCULANTE As DataTable = DtDatosSubProyectoH.FiltraParametros(" Sup = 'PASIVO NO CIRCULANTE' ")
Dim DT_CAPITAL_CONTABLE As DataTable = DtDatosSubProyectoH.FiltraParametros(" Sup = 'CAPITAL CONTABLE' ")
Dim Row As DataRow
Dim TotalActual = 0.0, TotalAnterior = 0.0
Dim IndexData As Integer = 0
Dim IndexGv As Integer = 1
Dim IndexMax As Integer = 1
Dim IndexSubProyecto = 0
Dim IndexSubProyectoMAx As Integer = DTSubProyectosCabecerasH.Rows.Count - 1
Dim IndexTotatles As Integer = 11 + IndexSubProyectoMAx
For Each dCoumn As DataColumn In DT_ACTIVO_CIRCULANTE.Columns
If IndexData >= 11 Then
If IndexSubProyecto <= IndexSubProyectoMAx Then
CType(GvIngresosSubProyectoH.Columns(IndexGv), BoundField).DataField = dCoumn.ColumnName
GvIngresosSubProyectoH.Columns(IndexGv).Visible = True
CType(GvTotalesSubProyectoH.Columns(IndexGv), BoundField).DataField = dCoumn.ColumnName
GvTotalesSubProyectoH.Columns(IndexGv).Visible = True
If IndexSubProyecto <= IndexSubProyectoMAx Then
CType(GvIngresosSubProyectoH.Columns(IndexGv), BoundField).HeaderText = DTSubProyectosCabecerasH.Rows(IndexSubProyecto)(0).ToString
CType(GvTotalesSubProyectoH.Columns(IndexGv), BoundField).HeaderText = DTSubProyectosCabecerasH.Rows(IndexSubProyecto)(0).ToString
CType(GvGastosSubProyectoH.Columns(IndexGv), BoundField).HeaderText = DTSubProyectosCabecerasH.Rows(IndexSubProyecto)(0).ToString
End If
Else
GvIngresosSubProyectoH.Columns(IndexGv).Visible = False
GvTotalesSubProyectoH.Columns(IndexGv).Visible = False
End If
IndexGv = IndexGv + 1
IndexSubProyecto = IndexSubProyecto + 1
IndexMax = IndexMax + 1
End If
IndexData = IndexData + 1
Next
Row = DT_ACTIVO_CIRCULANTE.NewRow
If DT_ACTIVO_CIRCULANTE.Rows.Count > 0 Then
For Each dr As DataRow In DT_ACTIVO_CIRCULANTE.FiltraParametros("NOT CtaMayor in (3,4)").Rows
TotalActual += dr("ImporteActual").ToString.ToDouble
TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble
Next
IndexData = 11
For IndexData = 11 To IndexTotatles
Row.Item(IndexData) = DT_ACTIVO_CIRCULANTE.SUM($"[{DtIngresosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (3,4)")
Next
Row.Item("Nombre") = "TOTAL ACTIVO CIRCULANTE"
Row.Item("ImporteActual") = DT_ACTIVO_CIRCULANTE.SUM("ImporteActual", "NOT CtaMayor in (3,4)") 'TotalActual.ToString
Row.Item("PorcentajeActual") = 100.0
Row.Item("ImporteAcumulado") = DT_ACTIVO_CIRCULANTE.SUM("ImporteActual", "NOT CtaMayor in (3,4)") 'TotalAnterior.ToString
Row.Item("PorcentajeAcumulado") = 100.0
Row.Item("CtaMayor") = -1
Row.Item("SinSP") = DT_ACTIVO_CIRCULANTE.SUM("SinSP", "NOT CtaMayor in (3,4)") 'Sin SP
DT_ACTIVO_CIRCULANTE.Rows.Add(Row)
Else
Row.Item("Nombre") = "TOTAL ACTIVO CIRCULANTE"
Row.Item("ImporteActual") = 0.00
Row.Item("ImporteAcumulado") = 0.00
Row.Item("CtaMayor") = -1
DT_ACTIVO_CIRCULANTE.Rows.Add(Row)
End If
TotalActual = 0
TotalAnterior = 0
Row = DT_ACTIVO_FIJO.NewRow
If DT_ACTIVO_FIJO.Rows.Count > 0 Then
For Each dr As DataRow In DT_ACTIVO_FIJO.FiltraParametros("NOT CtaMayor in (3,4)").Rows
TotalActual += dr("ImporteActual").ToString.ToDouble
TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble
Next
IndexData = 11
For IndexData = 11 To IndexTotatles
Row.Item(IndexData) = DT_ACTIVO_FIJO.SUM($"[{DtIngresosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (3,4)")
Next
Row.Item("Nombre") = "TOTAL ACTIVO NO CIRCULANTE"
Row.Item("ImporteActual") = DT_ACTIVO_FIJO.SUM("ImporteActual", "NOT CtaMayor in (3,4)") 'TotalActual.ToString
Row.Item("PorcentajeActual") = 100.0
Row.Item("ImporteAcumulado") = DT_ACTIVO_FIJO.SUM("ImporteActual", "NOT CtaMayor in (3,4)") 'TotalAnterior.ToString
Row.Item("PorcentajeAcumulado") = 100.0
Row.Item("CtaMayor") = -1
Row.Item("SinSP") = DT_ACTIVO_FIJO.SUM("SinSP", "NOT CtaMayor in (3,4)") 'Sin SP
DT_ACTIVO_FIJO.Rows.Add(Row)
Else
Row.Item("Nombre") = "TOTAL ACTIVO NO CIRCULANTE"
Row.Item("ImporteActual") = 0.00
Row.Item("ImporteAcumulado") = 0.00
Row.Item("CtaMayor") = -1
DT_ACTIVO_FIJO.Rows.Add(Row)
End If
TotalActual = 0
TotalAnterior = 0
Row = DT_ACTIVO_DIFERIDO.NewRow
If DT_ACTIVO_DIFERIDO.Rows.Count > 0 Then
For Each dr As DataRow In DT_ACTIVO_DIFERIDO.FiltraParametros("NOT CtaMayor in (3,4)").Rows
TotalActual += dr("ImporteActual").ToString.ToDouble
TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble
Next
IndexData = 11
For IndexData = 11 To IndexTotatles
Row.Item(IndexData) = DT_ACTIVO_DIFERIDO.SUM($"[{DtIngresosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (3,4)")
Next
Row.Item("Nombre") = "TOTAL ACTIVO DIFERIDO"
Row.Item("ImporteActual") = DT_ACTIVO_DIFERIDO.SUM("ImporteActual", "NOT CtaMayor in (3,4)") 'TotalActual.ToString
Row.Item("PorcentajeActual") = 100.0
Row.Item("ImporteAcumulado") = DT_ACTIVO_DIFERIDO.SUM("ImporteActual", "NOT CtaMayor in (3,4)") 'TotalAnterior.ToString
Row.Item("PorcentajeAcumulado") = 100.0
Row.Item("CtaMayor") = -1
Row.Item("SinSP") = DT_ACTIVO_DIFERIDO.SUM("SinSP", "NOT CtaMayor in (3,4)") 'Sin SP
DT_ACTIVO_DIFERIDO.Rows.Add(Row)
Else
Row.Item("Nombre") = "TOTAL ACTIVO DIFERIDO"
Row.Item("ImporteActual") = 0.00
Row.Item("ImporteAcumulado") = 0.00
Row.Item("CtaMayor") = -1
DT_ACTIVO_DIFERIDO.Rows.Add(Row)
End If
TotalActual = 0
TotalAnterior = 0
Row = DT_PASIVO_CIRCULANTE.NewRow
If DT_PASIVO_CIRCULANTE.Rows.Count > 0 Then
For Each dr As DataRow In DT_PASIVO_CIRCULANTE.FiltraParametros("NOT CtaMayor in (3,4)").Rows
TotalActual += dr("ImporteActual").ToString.ToDouble
TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble
Next
IndexData = 11
For IndexData = 11 To IndexTotatles
Row.Item(IndexData) = DT_PASIVO_CIRCULANTE.SUM($"[{DtIngresosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (3,4)")
Next
Row.Item("Nombre") = "TOTAL PASIVO CIRCULANTE"
Row.Item("ImporteActual") = DT_PASIVO_CIRCULANTE.SUM("ImporteActual", "NOT CtaMayor in (3,4)") 'TotalActual.ToString
Row.Item("PorcentajeActual") = 100.0
Row.Item("ImporteAcumulado") = DT_PASIVO_CIRCULANTE.SUM("ImporteActual", "NOT CtaMayor in (3,4)") 'TotalAnterior.ToString
Row.Item("PorcentajeAcumulado") = 100.0
Row.Item("CtaMayor") = -1
Row.Item("SinSP") = DT_PASIVO_CIRCULANTE.SUM("SinSP", "NOT CtaMayor in (3,4)") 'Sin SP
DT_PASIVO_CIRCULANTE.Rows.Add(Row)
Else
Row.Item("Nombre") = "TOTAL PASIVO CIRCULANTE"
Row.Item("ImporteActual") = 0.00
Row.Item("ImporteAcumulado") = 0.00
Row.Item("CtaMayor") = -1
DT_PASIVO_CIRCULANTE.Rows.Add(Row)
End If
TotalActual = 0
TotalAnterior = 0
Row = DT_PASIVO_NO_CIRCULANTE.NewRow
If DT_PASIVO_NO_CIRCULANTE.Rows.Count > 0 Then
For Each dr As DataRow In DT_PASIVO_NO_CIRCULANTE.FiltraParametros("NOT CtaMayor in (3,4)").Rows
TotalActual += dr("ImporteActual").ToString.ToDouble
TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble
Next
IndexData = 11
For IndexData = 11 To IndexTotatles
Row.Item(IndexData) = DT_PASIVO_NO_CIRCULANTE.SUM($"[{DtIngresosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (3,4)")
Next
Row.Item("Nombre") = "TOTAL PASIVO NO CIRCULANTE"
Row.Item("ImporteActual") = DT_PASIVO_NO_CIRCULANTE.SUM("ImporteActual", "NOT CtaMayor in (3,4)") 'TotalActual.ToString
Row.Item("PorcentajeActual") = 100.0
Row.Item("ImporteAcumulado") = DT_PASIVO_NO_CIRCULANTE.SUM("ImporteActual", "NOT CtaMayor in (3,4)") 'TotalAnterior.ToString
Row.Item("PorcentajeAcumulado") = 100.0
Row.Item("CtaMayor") = -1
DT_PASIVO_NO_CIRCULANTE.Rows.Add(Row)
Else
Row.Item("Nombre") = "TOTAL PASIVO NO CIRCULANTE"
Row.Item("ImporteActual") = 0.00
Row.Item("ImporteAcumulado") = 0.00
Row.Item("CtaMayor") = -1
Row.Item("SinSP") = DT_PASIVO_NO_CIRCULANTE.SUM("SinSP", "NOT CtaMayor in (3,4)") 'Sin SP
DT_PASIVO_NO_CIRCULANTE.Rows.Add(Row)
End If
TotalActual = 0
TotalAnterior = 0
Row = DT_CAPITAL_CONTABLE.NewRow
If DT_CAPITAL_CONTABLE.Rows.Count > 0 Then
For Each dr As DataRow In DT_CAPITAL_CONTABLE.FiltraParametros("NOT CtaMayor in (3,4)").Rows
TotalActual += dr("ImporteActual").ToString.ToDouble
TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble
Next
IndexData = 11
For IndexData = 11 To IndexTotatles
Row.Item(IndexData) = DT_CAPITAL_CONTABLE.SUM($"[{DtIngresosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (3,4)")
Next
Row.Item("Nombre") = "TOTAL CAPITAL CONTABLE"
Row.Item("ImporteActual") = DT_CAPITAL_CONTABLE.SUM("ImporteActual", "NOT CtaMayor in (3,4)") 'TotalActual.ToString
Row.Item("PorcentajeActual") = 100.0
Row.Item("ImporteAcumulado") = DT_CAPITAL_CONTABLE.SUM("ImporteActual", "NOT CtaMayor in (3,4)") 'TotalAnterior.ToString
Row.Item("PorcentajeAcumulado") = 100.0
Row.Item("CtaMayor") = -1
Row.Item("SinSP") = DT_CAPITAL_CONTABLE.SUM("SinSP", "NOT CtaMayor in (3,4)") 'Sin SP
DT_CAPITAL_CONTABLE.Rows.Add(Row)
Else
Row.Item("Nombre") = "TOTAL CAPITAL CONTABLE"
Row.Item("ImporteActual") = 0.00
Row.Item("ImporteAcumulado") = 0.00
Row.Item("CtaMayor") = -1
DT_CAPITAL_CONTABLE.Rows.Add(Row)
End If
TotalActual = 0
TotalAnterior = 0
DT_ACTIVO.Merge(DT_ACTIVO_CIRCULANTE)
DT_ACTIVO.Merge(DT_ACTIVO_FIJO)
DT_ACTIVO.Merge(DT_ACTIVO_DIFERIDO)
DT_PASIVO.Merge(DT_PASIVO_CIRCULANTE)
DT_PASIVO.Merge(DT_PASIVO_NO_CIRCULANTE)
Row = DT_ACTIVO.NewRow
If DT_ACTIVO.Rows.Count > 0 Then
For Each dr As DataRow In DT_ACTIVO.FiltraParametros("NOT CtaMayor in (-1,3,4)").Rows
TotalActual += dr("ImporteActual").ToString.ToDouble
TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble
Next
IndexData = 11
For IndexData = 11 To IndexTotatles
Row.Item(IndexData) = DT_ACTIVO.SUM($"[{DtIngresosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (-1,3,4)")
Next
Row.Item("Nombre") = "TOTAL ACTIVO"
Row.Item("ImporteActual") = DT_ACTIVO.SUM("ImporteActual", "NOT CtaMayor in (-1,3,4)") 'TotalActual.ToString
Row.Item("PorcentajeActual") = 100.0
Row.Item("ImporteAcumulado") = DT_ACTIVO.SUM("ImporteActual", "NOT CtaMayor in (-1,3,4)") 'TotalAnterior.ToString
Row.Item("PorcentajeAcumulado") = 100.0
Row.Item("CtaMayor") = -1
Row.Item("SinSP") = DT_ACTIVO.SUM("SinSP", "NOT CtaMayor in (-1,3,4)") 'Sin SP
DT_ACTIVO.Rows.Add(Row)
Else
Row.Item("Nombre") = "TOTAL ACTIVO"
Row.Item("ImporteActual") = 0.00
Row.Item("ImporteAcumulado") = 0.00
Row.Item("CtaMayor") = -1
DT_ACTIVO.Rows.Add(Row)
End If
TotalActual = 0
TotalAnterior = 0
Row = DT_PASIVO.NewRow
If DT_PASIVO.Rows.Count > 0 Then
For Each dr As DataRow In DT_PASIVO.FiltraParametros("NOT CtaMayor in (-1,3,4)").Rows
TotalActual += dr("ImporteActual").ToString.ToDouble
TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble
Next
IndexData = 11
For IndexData = 11 To IndexTotatles
Row.Item(IndexData) = DT_PASIVO.SUM($"[{DtIngresosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (-1,3,4)")
Next
Row.Item("Nombre") = "TOTAL PASIVO"
Row.Item("ImporteActual") = DT_PASIVO.SUM("ImporteActual", "NOT CtaMayor in (-1,3,4)") 'TotalActual.ToString
Row.Item("PorcentajeActual") = 100.0
Row.Item("ImporteAcumulado") = DT_PASIVO.SUM("ImporteActual", "NOT CtaMayor in (-1,3,4)") 'TotalAnterior.ToString
Row.Item("PorcentajeAcumulado") = 100.0
Row.Item("CtaMayor") = -1
Row.Item("SinSP") = DT_PASIVO.SUM("SinSP", "NOT CtaMayor in (-1,3,4)") 'Sin SP
DT_PASIVO.Rows.Add(Row)
Else
Row.Item("Nombre") = "TOTAL PASIVO"
Row.Item("ImporteActual") = 0.00
Row.Item("ImporteAcumulado") = 0.00
Row.Item("CtaMayor") = -1
DT_PASIVO.Rows.Add(Row)
End If
TotalActual = 0
TotalAnterior = 0
DT_TOTALES.Merge(DT_ACTIVO)
DT_TOTALES.Merge(DT_PASIVO)
DT_TOTALES.Merge(DT_CAPITAL_CONTABLE)
If DT_TOTALES.Rows.Count > 0 Then
Row = DT_TOTALES.NewRow
IndexData = 11
For IndexData = 11 To IndexTotatles
Row.Item(IndexData) = DT_ACTIVO.SUM($"[{DT_ACTIVO.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (-1,3,4)") - DT_PASIVO.SUM($"[{DT_PASIVO.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (-1,3,4)") - DT_CAPITAL_CONTABLE.SUM($"[{DT_CAPITAL_CONTABLE.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (-1,3,4)")
Next
Row.Item("Nombre") = "TOTALES:"
Row.Item("ImporteAcumulado") = DT_ACTIVO.SUM($"ImporteAcumulado", "NOT CtaMayor in (-1,3,4)") - DT_PASIVO.SUM($"ImporteAcumulado", "NOT CtaMayor in (-1,3,4)") - DT_CAPITAL_CONTABLE.SUM($"ImporteAcumulado", "NOT CtaMayor in (-1,3,4)")
Row.Item("CtaMayor") = -2
Row.Item("SinSP") = DT_TOTALES.SUM("SinSP", "NOT CtaMayor in (-1,3,4)") 'Sin SP
DT_TOTALES.Rows.Add(Row)
End If
'DtIngresosSubProyectoH.Merge(DtGastosSubProyectoH)
'DtIngresosSubProyectoH.Merge(DTTotalesSubProyectoH)
GvIngresosSubProyectoH.DataSource = DT_TOTALES
GvIngresosSubProyectoH.DataBind()
UpDatosSubProyectoH.Update()
End Sub
Protected Sub GvIngresosSubProyectoH_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("CtaMayor").ToString.ToEntero = -1 Then
'TotalActualMes += e.Row.DBCampo("ImporteActual").ToString.ToDouble
'TotalAnteriorMes += e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble
e.Row.ControlStyle.Font.Bold = True
ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then
e.Row.ControlStyle.Font.Bold = True
ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = -2 Then
e.Row.ControlStyle.Font.Bold = True
e.Row.ControlStyle.Font.Size = 13
End If
Dim CveCuenta As Integer = e.Row.DataKey("CveCuenta").ToEntero
If e.Row.DBCampo("CtaMayor").ToString.ToEntero > 0 Then
Dim CountDinamico As Integer = e.Row.DataKey("CountDinamico").ToEntero
Dim IndiceInicio As Integer = 1
Dim IndiceMax As Integer = 1 + CountDinamico
Dim FEchaMesFinal As Date = New Date(DdlEjercicio.SelectedValue.ToEntero, DdlPeriodo.SelectedValue.ToEntero, 1).LastDayOfMonth
For IndiceInicio = 1 To IndiceMax
Dim CveSubProyectoIntermo As String = CType(GvIngresosSubProyectoH.Columns(IndiceInicio), BoundField).DataField
Dim Importe As String = e.Row.Cells(IndiceInicio).Text
e.Row.Cells(IndiceInicio).Text = $"<a target='_blank' href='./RepAnexoCatalogo.aspx?CveCuenta={CveCuenta}&FF={FEchaMesFinal.ToString("dd/MM/yyyy")}&FI=01/01/1900&ER=1&CveSubProyecto={CveSubProyectoIntermo}' >{Importe}</a>"
Next IndiceInicio
e.Row.FCHyperLink("HLAnterior").NavigateUrl = $"./RepAnexoCatalogo.aspx?CveCuenta={CveCuenta}&FF={FEchaMesFinal.ToString("dd/MM/yyyy")}&FI=01/01/1900&ER=1&CveSubProyecto={-1}"
e.Row.FCHyperLink("HLSinSP").NavigateUrl = $"./RepAnexoCatalogo.aspx?CveCuenta={CveCuenta}&FF={FEchaMesFinal.ToString("dd/MM/yyyy")}&FI=01/01/1900&ER=1&CveSubProyecto=0"
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 GvGastosSubProyectoH_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then
'TotalActualMes -= e.Row.DBCampo("ImporteActual").ToString.ToDouble
'TotalAnteriorMes -= e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble
e.Row.ControlStyle.Font.Bold = True
ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then
e.Row.ControlStyle.Font.Bold = True
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 GvTotalesSubProyectoH_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.Header Then
End If
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Attributes.Add("style", "Font-weight: bold")
End If
End Sub
#End Region
End Class