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 = NowADS().AddDays(-30).ToString("dd/MM/yyyy") txtFin.Text = NowADS().ToString("dd/MM/yyyy") CargaProyecto() CargaTurnos() CargaDatos() loadData() End If End Sub Private Sub CargaTurnos() DdlTurno.DataSource = GlobalDTTurno(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 = NowADS().AddDays(-30) Dim FechaFin As Date = NowADS() 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() 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 porcentaje As Decimal = e.Row.DBCampo("AUSENTISMO").ToDecimal 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 = porcentaje.RoundSQL & "%" 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 If e.Row.DBCampo("SubProyecto").ToString.Trim = "" Then e.Row.CssClass = "SubTotales2" Else If e.Row.DBCampo("Turno").ToString.Trim = "" Then e.Row.CssClass = "SubTotales" End If End If End If End Sub End Class