Files
SIG/RH/RepAusentismoLaboral.aspx.vb
JORGE LUIS CAUDILLO ESPARZA c35cf91883 Commit inicial Ventas Productivo
2019-08-14 16:40:54 -07:00

133 lines
3.9 KiB
VB.net

Option Strict On
Option Explicit On
Imports Extensiones
Imports System.Data
Partial Class RH_RepAusentismoLaboral
Inherits ClsPaginas
Private Sub Ventas_RepIndiceRotacionPersonal_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not IsPostBack Then
txtInicio.Text = Date.Now.AddDays(-30).ToString("dd/MM/yyyy")
txtFin.Text = Date.Now.ToString("dd/MM/yyyy")
CargaProyecto()
CargaTurnos()
CargaDatos()
loadData()
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)
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
Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlProyecto.SelectedIndexChanged
CargaSubProyecto()
End Sub
Private Sub CargaDatos()
End Sub
Private Sub loadData()
Dim rh As New ClsRH
Dim dTable As New DataTable
Dim CveProyecto As Integer = -1
Dim CveSubproyecto As Integer = -1
Dim CveTurno As Integer = -1
Dim FechaInicio As Date = Date.Now.AddDays(-30)
Dim FechaFin As Date = Date.Now
Try
FechaInicio = Date.Parse(txtInicio.Text)
FechaFin = Date.Parse(txtFin.Text)
If DdlProyecto.SelectedIndex <> 0 Then
CveProyecto = DdlProyecto.SelectedValue.ToEntero
End If
If DdlSubProyecto.SelectedIndex <> 0 Then
CveSubproyecto = DdlSubProyecto.SelectedValue.ToEntero
End If
If DdlTurno.SelectedIndex <> 0 Then
CveTurno = DdlTurno.SelectedValue.ToEntero
End If
If rh.GetReporteAusentismoLaboral(FechaInicio, FechaFin, CveTurno, CveProyecto, CveSubproyecto, UsuarioActual.Empresa.CveEmpresa) Then
dTable = rh.DtResultados
End If
GVRegDatos.DataSource = dTable
GVRegDatos.DataBind()
Catch ex As Exception
Dim exe As String = ex.Message
End Try
rh.Dispose()
UpDatos.Update()
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
loadData()
End Sub
Protected Sub GVRegDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GVRegDatos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If Not (e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5) Then
Dim sPorcentaje As String = e.Row.DBCampo("AUSENTISMO").Trim
Dim porcentaje As Double = Convert.ToDouble(sPorcentaje)
e.Row.FCLabel("lblAusentismo").CssClass = "label label-danger"
e.Row.FCLabel("lblAusentismo").Font.Bold = True
e.Row.FCLabel("lblAusentismo").Attributes.Add("dir", "rtl")
e.Row.FCLabel("lblAusentismo").Text = sPorcentaje & "%"
If porcentaje <= 15.0 Then
e.Row.FCLabel("lblAusentismo").CssClass = "label label-success"
ElseIf (porcentaje > 15.0 And porcentaje <= 30.0) Then
e.Row.FCLabel("lblAusentismo").CssClass = "label label-warning"
End If
End If
End If
End Sub
End Class