149 lines
4.8 KiB
VB.net
149 lines
4.8 KiB
VB.net
Option Strict On
|
|
|
|
|
|
Imports Extensiones
|
|
Imports System.Data
|
|
Imports Microsoft.Reporting.WebForms
|
|
|
|
|
|
|
|
Partial Class RH_RepUniformesResguardo
|
|
Inherits ClsPaginas
|
|
|
|
Property DTDatos As DataTable
|
|
Get
|
|
If ViewState("DTDatos") Is Nothing Then
|
|
Return New DataTable
|
|
Else
|
|
Return DirectCast(ViewState("DTDatos"), DataTable)
|
|
End If
|
|
End Get
|
|
Set(value As DataTable)
|
|
ViewState("DTDatos") = value
|
|
End Set
|
|
End Property
|
|
Private Sub RH_RepUniformes_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
|
|
If Not Page.IsPostBack Then
|
|
|
|
DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa, 1)
|
|
DdlSubProyecto.DataBind()
|
|
DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
DdlDepartamento.DataSource = GlobalDTDepartamentos.FiltraParametros("CveEmpresa =" & UsuarioActual.CveEmpresa & " AND Departamento <> 'Seleccione' ")
|
|
DdlDepartamento.DataBind()
|
|
DdlDepartamento.Items.Insert(0, New ListItem("Todos", "-1"))
|
|
|
|
DdlPersonal.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltraParametros("", "NombreCompleto")
|
|
DdlPersonal.DataBind()
|
|
DdlPersonal.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
|
|
'TxtFechaInicio.Text = Now.ToString("dd/MM/yyyy")
|
|
'TxtFechaFin.Text = Now.AddMonths(1).ToString("dd/MM/yyyy")
|
|
|
|
CargaDatos()
|
|
End If
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub CargaDatos()
|
|
|
|
|
|
Dim ObjInv As New ClsInventarios
|
|
|
|
Dim strFechaInicio As String = "-1"
|
|
Dim strFechaFin As String = "-1"
|
|
|
|
Dim dfecha As Date = TxtFechaInicio.Text.ToDate()
|
|
If dfecha.Year > 1900 Then
|
|
strFechaInicio = dfecha.ToString("yyyy/MM/dd")
|
|
End If
|
|
|
|
dfecha = TxtFechaFin.Text.ToDate()
|
|
If dfecha.Year > 1900 Then
|
|
strFechaFin = dfecha.ToString("yyyy/MM/dd")
|
|
End If
|
|
If ObjInv.GetResguardoUniformesRep(UsuarioActual.CveEmpresa, CvePersonal:=DdlPersonal.SelectedValue.ToEntero, CveSubProyecto:=DdlSubProyecto.SelectedValue.ToEntero, CveDepartamento:=DdlDepartamento.SelectedValue.ToEntero, FechaInicio:=strFechaInicio, FechaFin:=strFechaFin, Todo:=False) Then
|
|
GvUniformes.DataSource = ObjInv.DtResultados
|
|
DTDatos = ObjInv.DtResultados
|
|
Else
|
|
GvUniformes.DataSource = Nothing
|
|
DTDatos = New DataTable
|
|
End If
|
|
|
|
ObjInv.Dispose()
|
|
|
|
GvUniformes.DataBind()
|
|
UpGvUniforme.Update()
|
|
|
|
'Dim objRH As New ClsRH
|
|
|
|
'If objRH.UniformesRepGet(DdlSubProyecto.SelectedValue.ToEntero, DdlDepartamento.SelectedValue.ToEntero, TxtFechaInicio.Text.ToDate, TxtFechaFin.Text.ToDate, UsuarioActual.CveEmpresa) Then
|
|
' GvUniformes.DataSource = objRH.DtResultados
|
|
' DTDatos = objRH.DtResultados
|
|
'Else
|
|
' GvUniformes.DataSource = Nothing
|
|
' DTDatos = Nothing
|
|
'End If
|
|
|
|
'objRH.Dispose()
|
|
|
|
'GvUniformes.DataBind()
|
|
'UpGvUniforme.Update()
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
Private Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
|
|
#Region "I M P R I M I R P D F/Excel"
|
|
|
|
Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
|
|
GenerarPDF("Excel")
|
|
End Sub
|
|
Private Sub LinkPDF_Click(sender As Object, e As EventArgs) Handles LinkPDF.Click
|
|
GenerarPDF()
|
|
End Sub
|
|
|
|
Private Sub GenerarPDF(Optional Formato As String = "PDF")
|
|
|
|
|
|
If DTDatos.Rows.Count > 0 Then
|
|
Dim ObjTareas As New ClsOIEventos
|
|
|
|
Dim params As New List(Of ReportParameter)
|
|
|
|
|
|
|
|
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 Filtros As String = "<b>Filtros: </b> "
|
|
|
|
|
|
|
|
'Dim FechaI, FechaF As String
|
|
|
|
' params.Add(New ReportParameter("AgrupadoPor", Filtros))
|
|
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
|
'params.Add(New ReportParameter("FechaInicio", FechaI))
|
|
'params.Add(New ReportParameter("FechaFin", FechaF))
|
|
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
|
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
|
|
|
|
params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
|
|
ImprimirPDF("Empresas\Grales\Formatos\RepUniformesResguardo.rdlc", DTDatos, params, "ReporteUniformes", Formato:=Formato)
|
|
End If
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
#End Region
|
|
|
|
End Class
|