Files
SIG/RH/RepPersonalNecesidades.aspx.vb
2019-10-02 13:43:33 -07:00

102 lines
3.6 KiB
VB.net

Option Strict On
Option Explicit On
Imports Extensiones
Imports System.Data
Partial Class RH_RepPersonalNecesidades
Inherits ClsPaginas
#Region "Propiedades"
Private Property DTNecesidades As DataTable
Get
Return CType(ViewState("DTProyectos"), DataTable)
End Get
Set(value As DataTable)
ViewState("DTProyectos") = 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
CargaProyecto()
CargaTurnos()
CargaDatos()
CargaDepartamento()
End If
End Sub
Private Sub CargaTurnos()
DdlTurno.DataSource = GlobalDTTurno.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
DdlTurno.DataBind()
DdlTurno.Items.Insert(0, New ListItem("Todos", "-1"))
End Sub
Private Sub CargaProyecto()
DdlProyecto.DataSource = GlobalDTProyectos(UsuarioActual.Empresa.CveEmpresa).FiltraParametros("", "", {"CveProyecto", "Proyecto"})
DdlProyecto.DataBind()
DdlProyecto.Items.Insert(0, New ListItem("Todos", "-1"))
End Sub
Private Sub CargaSubProyecto()
DdlSubProyecto.Items.Clear()
DdlSubProyecto.DataSource = GlobalDTSubProyectos(DdlProyecto.SelectedValue.ToEntero)
DdlSubProyecto.DataBind()
DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1"))
End Sub
Private Sub CargaDepartamento()
DdlDepartamento.Items.Clear()
DdlDepartamento.DataSource = GlobalDTDepartamentos.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
DdlDepartamento.DataBind()
DdlDepartamento.Items.Insert(0, New ListItem("Todos", "-1"))
End Sub
Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlProyecto.SelectedIndexChanged
CargaSubProyecto()
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
CargaDatos()
End Sub
Private Sub CargaDatos()
Dim objpersonal As New ClsRH
If objpersonal.GetReportePersonalNecesidades(DdlTurno.SelectedValue.ToEntero, DdlProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlEstatus.SelectedValue.ToEntero, UsuarioActual.Empresa.CveEmpresa, DdlDepartamento.SelectedValue.ToEntero) Then
GVDatos.DataSource = objpersonal.DtResultados
Else
GVDatos.DataSource = Nothing
End If
objpersonal.Dispose()
GVDatos.DataBind()
UpDatos.Update()
End Sub
Protected Sub GVDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVDatos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If Not (e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5) Then
e.Row.FCLabel("LblEstatus").Font.Bold = True
Select Case e.Row.DBCampo("Estatus").Trim
Case "Sobrante de personal"
With e.Row.FCLabel("LblEstatus")
.CssClass = "label label-sm"
.BackColor = Drawing.Color.DarkSalmon
End With
Case "Faltante de personal"
e.Row.FCLabel("LblEstatus").CssClass = "label label-sm label-danger" 'Rojo
Case "Sin necesidades de personal"
e.Row.FCLabel("LblEstatus").CssClass = "label label-sm label-success" 'Verde
End Select
End If
End If
End Sub
End Class