141 lines
4.6 KiB
VB.net
141 lines
4.6 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports Extensiones
|
|
Partial Class Contabilidad2_RepAnexoCatalogoCC
|
|
Inherits ClsPaginas
|
|
|
|
#Region " PROPIEDADES "
|
|
Public Property CveCuenta As Integer
|
|
Get
|
|
Return ViewState("CveCuenta").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveCuenta") = value
|
|
End Set
|
|
End Property
|
|
#End Region
|
|
|
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
|
If Not IsPostBack Then
|
|
|
|
'Dim EjercicioParametro, SubProyectoParametro, DivisorParametro As Integer
|
|
'CveCuenta = IfNull(Request("C"), "-1").ToString.ToEntero
|
|
'EjercicioParametro = IfNull(Request("E"), "-1").ToString.ToEntero
|
|
'SubProyectoParametro = IfNull(Request("S"), "-1").ToString.ToEntero
|
|
'DivisorParametro = IfNull(Request("D"), "-1").ToString.ToEntero
|
|
|
|
|
|
Dim EjercicioParametro, SubProyectoParametro, DivisorParametro, Periodo As Integer
|
|
CveCuenta = IfNull(Request("CveCuenta"), "-1").ToString.ToEntero
|
|
EjercicioParametro = IfNull(Request("Ejercicio"), "-1").ToString.ToEntero
|
|
SubProyectoParametro = IfNull(Request("CveSubProyecto"), "-1").ToString.ToEntero
|
|
DivisorParametro = IfNull(Request("Divisor"), "-1").ToString.ToEntero
|
|
Periodo = IfNull(Request("Periodo"), "-1").ToString.ToEntero
|
|
|
|
InicializaValores()
|
|
|
|
CargarCentrosDeCosto(Nothing, DdlSubProyecto, Nothing, LblSubProyecto)
|
|
|
|
DdlEjercicio.SelectedValueExist(EjercicioParametro.ToString)
|
|
DdlSubProyecto.SelectedValueExist(SubProyectoParametro.ToString)
|
|
DdlDivisor.SelectedValueExist(DivisorParametro.ToString)
|
|
DdlPeriodo.SelectedValueExist(Periodo)
|
|
|
|
CargaDatos()
|
|
|
|
End If
|
|
End Sub
|
|
|
|
|
|
#Region " INICIALIZA VALORES "
|
|
Private Sub InicializaValores()
|
|
CargaCombos()
|
|
End Sub
|
|
Private Sub CargaCombos()
|
|
|
|
Dim Conta As New ClsContabilidad
|
|
If Conta.GetEjercicios(UsuarioActual.CveEmpresa) Then
|
|
DdlEjercicio.DataSource = Conta.DtResultados
|
|
Else
|
|
DdlEjercicio.DataSource = Nothing
|
|
End If
|
|
Conta.Dispose()
|
|
|
|
DdlEjercicio.DataBind()
|
|
DdlEjercicio.SelectedValueExist(Now.Year.ToString)
|
|
|
|
'DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa)
|
|
'DdlSubProyecto.DataBind()
|
|
'DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
'DdlSubProyecto.SelectedValue = "-1"
|
|
|
|
End Sub
|
|
#End Region
|
|
|
|
|
|
#Region " CARGA DATOS "
|
|
Protected Sub BtnCargaAsignados_Click(sender As Object, e As EventArgs) Handles BtnCargaAsignados.Click
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
Private Sub CargaDatos()
|
|
Dim Conta As New ClsContabilidad
|
|
|
|
If Conta.GetAnexoCatalagoCC(CveCuenta, DdlEjercicio.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlDivisor.SelectedValue.ToEntero, DdlPeriodo.SelectedValue.ToEntero) Then
|
|
|
|
Dim DtHeaders As DataTable = Conta.DSResultados.Tables(0)
|
|
GvCC.DataSource = Conta.DSResultados.Tables(1)
|
|
|
|
Dim Index = 4
|
|
For Index = 4 To GvCC.Columns.Count - 1
|
|
GvCC.Columns(Index).Visible = False
|
|
Next Index
|
|
|
|
Index = 4
|
|
For Each Dr As DataRow In DtHeaders.Rows
|
|
GvCC.Columns(Index).Visible = True
|
|
CType(GvCC.Columns(Index), BoundField).DataField = $"SubProyecto{Dr("SubProyecto").ToString}"
|
|
GvCC.Columns(Index).HeaderText = Dr("SubProyecto").ToString
|
|
|
|
|
|
GvCC.Columns(Index + 1).Visible = True
|
|
CType(GvCC.Columns(Index + 1), BoundField).DataField = $"SubProyecto{Dr("SubProyecto").ToString}Porcentaje"
|
|
GvCC.Columns(Index + 1).HeaderText = "%"
|
|
|
|
Index += 2
|
|
Next
|
|
|
|
GvCC.DataBind()
|
|
UpCC.Update()
|
|
|
|
Else
|
|
GvCC.DataSource = Nothing
|
|
End If
|
|
|
|
RegistraScript($"LimpiaCeros({DdlDivisor.SelectedValue});")
|
|
Conta.Dispose()
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
|
|
#Region " GV ROW DATABOUND "
|
|
Protected Sub GvCC_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvCC.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
|
|
If e.Row.RowIndex = 0 Then
|
|
e.Row.Style.Add("font-weight", "bold")
|
|
End If
|
|
|
|
e.Row.Style.Add("text-indent", $"{e.Row.DBCampo("Level").ToString.ToEntero * 2}em")
|
|
|
|
End If
|
|
End Sub
|
|
#End Region
|
|
|
|
|
|
|
|
End Class
|