606 lines
26 KiB
Plaintext
606 lines
26 KiB
Plaintext
Option Explicit On
|
||
Option Strict On
|
||
|
||
Imports System.Data
|
||
Imports Extensiones
|
||
Imports Microsoft.Reporting.WebForms
|
||
Partial Class AC2_SituacionFinanciera
|
||
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
|
||
#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
|
||
|
||
'TxtFechaInicio.Text = DateSerial(Year(Date.Now), 1, 1).ToShortDateString
|
||
'TxtFechaFin.Text = Date.Now.ToShortDateString
|
||
|
||
CargaEjercicios()
|
||
|
||
'CargaDatos()
|
||
End If
|
||
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 = Now.Year.ToString
|
||
|
||
DdlSubproyecto.DataSource = GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa, -1)
|
||
DdlSubproyecto.DataBind()
|
||
|
||
|
||
'DdlEjercicio.SelectedValueExist(UsuarioActual.Empresa.EjercicioActual.ToString)
|
||
DdlPeriodo.SelectedValue = Now.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 String = DdlSubproyecto.SelectedValue.ToString
|
||
|
||
If ObjConta.GetSituacionFinanciera("01/01/1900".ToDate, FechaF.ToDate, UsuarioActual.CveEmpresa, CveSubProyecto, 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") = " 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") = " 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") = " 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") = " 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") = " 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") = " 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") = " 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") = " 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") = " 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") = " 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") = " 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") = " 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") = " 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") = " 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") = " 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") = " 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 Imprimir_click(sender As Object, e As EventArgs) Handles Imprimir.Click
|
||
'Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa)
|
||
'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")
|
||
|
||
'If ObjConta.GetSituacionFinanciera("01/01/2000".ToDate, FechaF.ToDate, DdlTipoReporte.SelectedValue.ToEntero) Then
|
||
' DtDatos = ObjConta.DtResultados
|
||
' 'If ChkFirma.Checked = True Then
|
||
|
||
' ' Dim Row As DataRow = DtDatos.NewRow
|
||
' ' Row.Item("Nombre") = String.Format("C.P. Izelda Angulo Peraza{0} Subdirector de contabilidad", "")
|
||
' ' Row.Item("Sup") = String.Format("Lic. Juan Fortino Leon Robinson{0} Director General", "")
|
||
' ' Row.Item("ImporteActual") = "0"
|
||
' ' Row.Item("ImporteAnterior") = "0"
|
||
' ' Row.Item("Tipo") = "Firma"
|
||
' ' DtDatos.Rows.Add(Row)
|
||
' 'End If
|
||
'End If
|
||
'ObjConta.Dispose()
|
||
|
||
ImprimirReporte()
|
||
|
||
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
|
||
|
||
CargaDatos()
|
||
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("/Contabilidad2/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("/Contabilidad2/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(" {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("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString)
|
||
e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad2/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(" {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("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString)
|
||
e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad2/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(" {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
|
||
|
||
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
|
||
ImprimirReporte("Excel")
|
||
End Sub
|
||
|
||
|
||
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 = "AC/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(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
|
||
If Imagen.Exists Then
|
||
params.Add(New ReportParameter("pImg", $"file://{Imagen.FullName}"))
|
||
Else
|
||
params.Add(New ReportParameter("pImg", ""))
|
||
End If
|
||
params.Add(New ReportParameter("pFirma1", If(ChkFirma.Checked, String.Format("C.P. Izelda Angulo Peraza{0} Subdirector de Contabilidad", vbCrLf), "")))
|
||
params.Add(New ReportParameter("pFirma2", If(ChkFirma.Checked, String.Format("Lic. Juan Fortino Leon Robinson{0} Director General", vbCrLf), "")))
|
||
params.Add(New ReportParameter("pFechaFin", FechaF))
|
||
ImprimirPDF(reportpath, DtDatos, params, fileName, Formato)
|
||
End Sub
|
||
End Class
|