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

127 lines
4.7 KiB
VB.net

Option Strict On
Imports Extensiones
Imports System.Data
Partial Class RH_RepVacaciones
Inherits ClsPaginas
Private Sub RH_RepVacaciones_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
TxtFechaI.Text = Now.ToString("dd/MM/yyyy")
TxtFechaF.Text = Now.AddDays(30).ToString("dd/MM/yyyy")
CargaCombos()
CargaDatos()
End If
End Sub
Private Sub CargaCombos()
DDLSubProyecto.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa)
DDLSubProyecto.DataBind()
DDLSubProyecto.Items.Insert(0, New ListItem("Todos", "-1"))
DDLPersonal.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa)
DDLPersonal.DataBind()
DDLPersonal.Items.Insert(0, New ListItem("Todos", "-1"))
DDLPuesto.DataSource = GlobalDTRHPuestos(UsuarioActual.CveEmpresa)
DDLPuesto.DataBind()
DDLPuesto.Items.Insert(0, New ListItem("Todos", "-1"))
'DDLSucursal.DataSource = GlobalDTSucursales(UsuarioActual.Empresa.CveEmpresa)
'DDLSucursal.DataBind()
'DDLSucursal.Items.Insert(0, New ListItem("Todas", "-1"))
DdlSupervisor.DataSource = GlobalDTUsuarios.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa & " AND EsSupervisorRH = 1 ")
DdlSupervisor.DataBind()
DdlRuta.DataSource = GlobalDTRutas.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
DdlRuta.DataBind()
DdlTurno.DataSource = GlobalDTTurno.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
DdlTurno.DataBind()
DdlTurno.Items.Insert(0, New ListItem("Todos", "-1"))
DdlJornada.DataSource = GlobalDTJornadas
DdlJornada.DataBind()
DdlJornada.Items.Insert(0, New ListItem("Todas", "-1"))
Dim objRH As New ClsRH
If objRH.SubproyectoZonaGet(-1, -1, UsuarioActual.Empresa.CveEmpresa) Then
DdlSubproyectoZona.DataSource = objRH.DtResultados.FiltraParametros("Estatus=1")
Else
DdlSubproyectoZona.DataSource = Nothing
End If
objRH.Dispose()
DdlSubproyectoZona.DataBind()
End Sub
Private Sub CargaDatos()
Dim objRH As New ClsRH
If objRH.VacacionesRepGet(DDLPersonal.SelectedValue.ToEntero, UsuarioActual.Empresa.CveEmpresa, TxtFechaI.Text.ToDate, TxtFechaF.Text.ToDate,
DDLPuesto.SelectedValue.ToEntero, DdlSupervisor.SelectedValue.ToEntero, DdlRuta.SelectedValue.ToEntero, DdlSubproyectoZona.SelectedValue.ToEntero,
DDLSubProyecto.SelectedValue.ToEntero, DdlTurno.SelectedValue.ToEntero, DdlJornada.SelectedValue.ToEntero) Then
GvVacacionesRep.DataSource = objRH.DtResultados
End If
objRH.Dispose()
GvVacacionesRep.DataBind()
UpGvVacacionesRep.Update()
End Sub
Protected Sub btConsultar_Click(sender As Object, e As EventArgs) Handles btConsultar.Click
CargaDatos()
End Sub
Protected Sub LnkDescargarExcel_Click(sender As Object, e As EventArgs) Handles LnkDescargarExcel.Click
GvVacacionesRep.ExportToExcel("RepVavaciones_" & Now.ToString("yyyyMMddhhmmss"))
End Sub
Protected Sub GvVacacionesRep_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvVacacionesRep.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim lnkVerFechas As LinkButton = e.Row.FCLinkButton("ImgVerFechas")
Dim DiasFechas As Integer = e.Row.DBCampo("DiasFechas").ToString.ToEntero
If DiasFechas > 0 Then
lnkVerFechas.Visible = True
Else
lnkVerFechas.Visible = False
End If
e.Row.Cells(0).Text = String.Format("<a href='Personal.aspx?CvePersonal={0}' target='_blank'>{1}</a>", e.Row.DataKey("CvePersonal"), e.Row.DataKey("NombreCompleto"))
End If
End Sub
Public Sub View_ClickVacacionesFechasAutorizadas(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim CvePersonal As Integer = GvRow.DataKey("CvePersonal").ToEntero
Dim objRH As New ClsRH
If objRH.VacacionesGet(CvePersonal, UsuarioActual.Empresa.CveEmpresa, TxtFechaI.Text.ToDate, TxtFechaF.Text.ToDate) Then
GvVacaciones.DataSource = objRH.DtResultados
Else
GvVacaciones.DataSource = Nothing
End If
objRH.Dispose()
GvVacaciones.DataBind()
UpModalEditarDiaVacacion.Update()
RegistraScript("$('#DivFechasVacaciones').modal({ backdrop: 'static', keyboard: false});")
End Sub
End Class