132 lines
5.1 KiB
VB.net
132 lines
5.1 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports Extensiones
|
|
Partial Class RH_ComparativoNomina
|
|
Inherits ClsPaginas
|
|
|
|
Private ReadOnly Property DTPeriodos As Data.DataTable
|
|
Get
|
|
Return DirectCast(ViewState("DTPeriodos"), Data.DataTable)
|
|
End Get
|
|
End Property
|
|
|
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
|
If Not IsPostBack Then
|
|
DdlTipoPeriodo.DataSource = GlobalDTTipoPeriodo.FiltraParametros("Estatus = 'Activo'")
|
|
DdlTipoPeriodo.DataBind()
|
|
DdlTipoPeriodo.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
|
|
DdlEjercicio.Items.Add(New ListItem(UsuarioActual.Empresa.EjercicioActual.ToString, UsuarioActual.Empresa.EjercicioActual.ToString))
|
|
DdlEjercicio.Items.Add(New ListItem((UsuarioActual.Empresa.EjercicioActual - 1).ToString, (UsuarioActual.Empresa.EjercicioActual - 1).ToString))
|
|
'DdlEjercicio.Items.Insert(0, New ListItem("Seleccionar", "-1"))
|
|
|
|
ViewState("Orden") = ""
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub DdlEjercicio_SelectedIndexChanged(sender As Object, e As EventArgs)
|
|
If DdlEjercicio.SelectedValue.ToEntero > 0 And DdlTipoPeriodo.SelectedValue.ToEntero > 0 Then
|
|
|
|
Dim ObjPeriodos As New ClsNominas
|
|
If ObjPeriodos.GetPeriodos(DdlTipoPeriodo.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlEjercicio.SelectedValue.ToEntero, -1, -1) Then
|
|
ViewState("DTPeriodos") = ObjPeriodos.DtResultados
|
|
DdlPeriodo.DataSource = DTPeriodos
|
|
DdlPeriodo.Items.Clear()
|
|
DdlPeriodo.DataBind()
|
|
DdlPeriodo.Items.Insert(0, New ListItem("Seleccione un Periodo", "-1"))
|
|
Else
|
|
DdlPeriodo.DataSource = Nothing
|
|
End If
|
|
ObjPeriodos.Dispose()
|
|
End If
|
|
Gv.DataBind()
|
|
UPDatos.Update()
|
|
End Sub
|
|
|
|
Protected Sub DdlTipoPeriodo_SelectedIndexChanged(sender As Object, e As EventArgs)
|
|
If DdlTipoPeriodo.SelectedValue.ToEntero > 0 Then
|
|
|
|
Dim ObjPeriodos As New ClsNominas
|
|
If ObjPeriodos.GetPeriodos(DdlTipoPeriodo.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlEjercicio.SelectedValue.ToEntero, -1, -1) Then
|
|
ViewState("DTPeriodos") = ObjPeriodos.DtResultados
|
|
DdlPeriodo.DataSource = DTPeriodos
|
|
Else
|
|
DdlPeriodo.DataSource = Nothing
|
|
End If
|
|
ObjPeriodos.Dispose()
|
|
End If
|
|
|
|
DdlPeriodo.Items.Clear()
|
|
DdlPeriodo.DataBind()
|
|
DdlPeriodo.Items.Insert(0, New ListItem("Seleccione un Periodo", "-1"))
|
|
End Sub
|
|
|
|
Protected Sub CargaDatos()
|
|
Dim ObjComparativoNomina As New ClsRH
|
|
UPDatos.Update()
|
|
Gv.DataBind()
|
|
|
|
If ObjComparativoNomina.GetComparativoNomina(DdlPeriodo.SelectedValue.ToEntero, "-1") Then
|
|
ViewState("DTComparativoNomina") = ObjComparativoNomina.DtResultados
|
|
End If
|
|
|
|
ObjComparativoNomina.Dispose()
|
|
|
|
If ViewState("Orden").ToString() <> String.Empty Then
|
|
CargaGrid(ViewState("Orden").ToString())
|
|
Else
|
|
CargaGrid("")
|
|
End If
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
Protected Sub CargarComparativoNomina(sender As Object, e As EventArgs)
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
#Region "O R D E N A M I E N T O"
|
|
Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs)
|
|
Dim Orden As String = ""
|
|
Dim Campo As String = ""
|
|
Dim Literal As Literal = Nothing
|
|
Const OrdenInicial As String = ""
|
|
Dim Arg(2) As String
|
|
|
|
Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c)
|
|
Campo = Arg(0)
|
|
Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(",", "_")), Literal)
|
|
|
|
If ViewState(String.Format("O{0}", Campo)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo)).ToString = String.Format("{0} DESC", Campo) Then
|
|
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo)
|
|
Literal.Text = String.Format("<i class='fa fa-sort-asc' style='color:#999' ></i>")
|
|
Else
|
|
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} DESC", Campo)
|
|
Literal.Text = String.Format("<i class='fa fa-sort-desc' style='color:#999' ></i>")
|
|
End If
|
|
Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo)).ToString
|
|
ViewState("Orden") = Orden
|
|
CargaGrid(Orden)
|
|
End Sub
|
|
|
|
Protected Sub CargaGrid(Orden As String)
|
|
If Orden <> String.Empty Then
|
|
Dim DV As New DataView(CType(ViewState("DTComparativoNomina"), DataTable), "", Orden, DataViewRowState.CurrentRows)
|
|
Gv.DataSource = DV.ToTable()
|
|
DV.Dispose()
|
|
Else
|
|
Gv.DataSource = CType(ViewState("DTComparativoNomina"), DataTable)
|
|
End If
|
|
Gv.DataBind()
|
|
UPDatos.Update()
|
|
End Sub
|
|
#End Region
|
|
|
|
Protected Sub ImgExcel_Click(sender As Object, e As ImageClickEventArgs) Handles ImgExcel.Click
|
|
Gv.ExportToExcel("ComparativoNomina")
|
|
End Sub
|
|
End Class
|