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

122 lines
3.6 KiB
VB.net

Option Explicit On
Option Strict On
Imports System.Data
Imports Extensiones
Imports Microsoft.Reporting.WebForms
Partial Class Contabilidad_RepOrigenAplicacionMensual
Inherits ClsPaginas
#Region " PROPIEDADES "
Private Property DtDatos As DataTable
Get
DtDatos = DirectCast(ViewState("DtDatos"), DataTable)
End Get
Set(ByVal value As DataTable)
ViewState("DtDatos") = value
End Set
End Property
Private Property TipoReporte As Integer
Get
TipoReporte = ViewState("TipoReporte").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("TipoReporte") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
TipoReporte = -1
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.GetOrigenAplicacionMensual(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()
EscondeSubtotales()
If DtDatos IsNot Nothing Then
CargaGrid()
End If
End Sub
Private Sub EscondeSubtotales()
'Esconde Trimestral
GvDatos.Columns(4).Visible = False
GvDatos.Columns(9).Visible = False
GvDatos.Columns(14).Visible = False
GvDatos.Columns(18).Visible = False
'Esconde Cuatrimestral
GvDatos.Columns(6).Visible = False
GvDatos.Columns(12).Visible = False
GvDatos.Columns(19).Visible = False
If DdlSubtotales.SelectedValue = "2" Then
GvDatos.Columns(4).Visible = True
GvDatos.Columns(9).Visible = True
GvDatos.Columns(14).Visible = True
GvDatos.Columns(18).Visible = True
ElseIf DdlSubtotales.SelectedValue = "3" Then
GvDatos.Columns(6).Visible = True
GvDatos.Columns(12).Visible = True
GvDatos.Columns(19).Visible = True
End If
End Sub
Private Sub CargaGrid()
GvDatos.DataSource = DtDatos
GvDatos.DataBind()
UpDatos.Update()
End Sub
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
'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