Option Strict On Option Explicit On Imports Extensiones Imports System.Data Imports Microsoft.Reporting.WebForms Partial Class Ventas_RepIndiceRotacionPersonal Inherits ClsPaginas Private Property DTGvDatos As DataTable Get If ViewState("DTGvDatos") Is Nothing Then Return New DataTable Else Return DirectCast(ViewState("DTGvDatos"), DataTable) End If End Get Set(value As DataTable) ViewState("DTGvDatos") = value End Set End Property 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.GetReporteRotacionPersonal(FechaInicio, FechaFin, CveTurno, CveProyecto, CveSubproyecto, UsuarioActual.Empresa.CveEmpresa) Then dTable = rh.DtResultados End If DTGvDatos = dTable 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("IRP").ToDecimal e.Row.FCLabel("LblIrp").CssClass = "label label-danger" e.Row.FCLabel("LblIrp").Font.Bold = True e.Row.FCLabel("lblIrp").Attributes.Add("dir", "rtl") e.Row.FCLabel("LblIrp").Text = porcentaje.ToString("0.00") & "%" If porcentaje <= 15.0 Then e.Row.FCLabel("LblIrp").CssClass = "label label-success" ElseIf (porcentaje > 15.0 And porcentaje <= 30.0) Then e.Row.FCLabel("LblIrp").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" Else If e.Row.DBCampo("Turno").ToString.Trim = "" Then e.Row.CssClass = "SubTotales3" End If End If End If End If End Sub Protected Sub BtnImprimir_Click(sender As Object, e As EventArgs) '"Empresas/Grales/Formatos/ClienteHistorial.rdlc" If GVRegDatos.Rows.Count > 0 Then Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png") Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) Dim params As New List(Of ReportParameter) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("FechaInicial", txtInicio.Text)) params.Add(New ReportParameter("FechaFinal", txtFin.Text)) params.Add(New ReportParameter("FechaRealizado", NowADS().ToString())) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", ""))) ImprimirPDF("Empresas/Grales/Formatos/RepIndiceRotacionPersonal.rdlc", DTGvDatos, params, "Reporte de Historial", "PDF") End If End Sub End Class