Files
SIG/Contabilidad/RepOrigenAplicacionAnual.aspx.vb
2023-10-09 11:55:07 -07:00

117 lines
3.3 KiB
VB.net

Option Explicit On
Option Strict On
Imports System.Data
Imports Extensiones
Imports Microsoft.Reporting.WebForms
Partial Class Contabilidad_RepOrigenAplicacionAnual
Inherits ClsPaginas
#Region " PROPIEDADES "
Private Property DtDatos As DataTable
Get
DtDatos = DirectCast(ViewState("DtDatos"), DataTable)
End Get
Set(ByVal value As DataTable)
ViewState("DtDatos") = value
End Set
End Property
Private Property TipoReporte As Integer
Get
TipoReporte = ViewState("TipoReporte").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("TipoReporte") = value
End Set
End Property
Private Property Anos As Integer
Get
Anos = ViewState("Anos").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("Anos") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
TipoReporte = -1
Anos = 0
DdlEjercicio.SelectedValue = NowADS().Year.ToString
CargaDatos()
End If
End Sub
Private Sub CargaDatos()
Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa)
TipoReporte = If(TipoReporte = -1, -1, DdlTipoReporte.SelectedValue.ToEntero)
If ObjConta.GetOrigenAplicacionAnual(DdlEjercicio.SelectedValue.ToEntero, TipoReporte) Then
DtDatos = ObjConta.DtResultados
Else
DtDatos = Nothing
Alert("Ocurrio un error al cargar los datos del estado de origen y aplicación de recursos", TipoMensaje.MsgError)
End If
ObjConta.Dispose()
Anos = (Year(NowADS()) - DdlEjercicio.SelectedValue.ToEntero) + 1
If DtDatos IsNot Nothing Then
CargaGrid()
End If
'Esconde todo
For index = 1 To 12
GvDatos.Columns(index).Visible = False
Next
For index = 1 To Anos
GvDatos.Columns(index).Visible = True
'GvDatos.HeaderRow.FCLabel("LbAno" + index.ToString).Text = (DdlEjercicio.SelectedValue.ToEntero + index - 1).ToString
Next
End Sub
Private Sub CargaGrid()
GvDatos.DataSource = DtDatos
GvDatos.DataBind()
UpDatos.Update()
End Sub
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
'AGRUPADOR DE CUENTAS
If e.Row.DBCampo("CtaMayor").ToString.ToEntero = 2 Then
e.Row.FCLabel("LbNombre").Font.Bold = True
End If
'CUENTAS
If e.Row.DBCampo("CtaMayor").ToString.ToEntero = 1 Then
e.Row.FCLabel("LbNombre").Attributes.Add("style", "padding-left: 20px;")
End If
'TOTALES
If e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then
e.Row.Attributes.Add("style", "border-top: 1px solid;")
e.Row.FCLabel("LbNombre").Font.Bold = True
e.Row.FCLabel("LbNombre").Font.Italic = True
End If
End If
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
CargaDatos()
End Sub
End Class