Akustes Karedex, Reporte Asistencias Checador 2024.04.17
This commit is contained in:
@@ -265,7 +265,16 @@ Partial Class RH_RepChecadorPreAsistencia
|
||||
|
||||
DdlAsistenciaInacistencia.DataSource = GlobalDTAsistenciasInasistencias(UsuarioActual.CveEmpresa).FiltraParametros(" CveAsistenciasInasistencias <> 6")
|
||||
DdlAsistenciaInacistencia.DataBind()
|
||||
DdlAsistenciaInacistencia.Items.Insert(0, New ListItem("Seleccionar una opción", "-1"))
|
||||
DdlAsistenciaInacistencia.Items.Insert(0, New ListItem("Seleccione Uno", "-1"))
|
||||
|
||||
DdlAsistenciaInacistenciaCarga.DataSource = GlobalDTAsistenciasInasistencias(UsuarioActual.CveEmpresa)
|
||||
DdlAsistenciaInacistenciaCarga.DataBind()
|
||||
DdlAsistenciaInacistenciaCarga.Items.Insert(0, New ListItem("Seleccione Uno", "-1"))
|
||||
|
||||
DdlMotivoHoraExtra.DataSource = GlobalDTMotivosHorasExtras(UsuarioActual.CveEmpresa)
|
||||
DdlMotivoHoraExtra.DataBind()
|
||||
DdlMotivoHoraExtra.Items.Insert(0, New ListItem("Seleccione Uno", "-1"))
|
||||
|
||||
Dim objNom As New ClsNominas
|
||||
|
||||
If objNom.GetTiposPeriodos() Then
|
||||
@@ -286,8 +295,20 @@ Partial Class RH_RepChecadorPreAsistencia
|
||||
DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
DdlTurno.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
DdlTurno.SelectedValue = "-1"
|
||||
|
||||
CargaDepartamento()
|
||||
End Sub
|
||||
Private Sub CargaDepartamento()
|
||||
DdlDepartamento.DataSource = GlobalDTDepartamentos(UsuarioActual.CveEmpresa)
|
||||
DdlDepartamento.DataBind()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDdlAsistencia()
|
||||
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub GeneraFechasInicioFinPerdiodo()
|
||||
|
||||
@@ -320,53 +341,54 @@ Partial Class RH_RepChecadorPreAsistencia
|
||||
|
||||
cargaPeriodos()
|
||||
|
||||
'Dim objNomina As New ClsNominas
|
||||
Dim objNomina As New ClsNominas
|
||||
|
||||
'If objNomina.GetPeriodos(DdlTipoPeriodo.SelectedValue.ToEntero, UsuarioActual.Empresa.CveEmpresa, -1, -1, -1) Then
|
||||
If objNomina.GetPeriodos(DdlTipoPeriodo.SelectedValue.ToEntero, UsuarioActual.Empresa.CveEmpresa, -1, -1, -1) Then
|
||||
|
||||
' TxtFechaModal.Text = ""
|
||||
' lblTituloPagina.Text = ""
|
||||
' UpTituloPagina.Update()
|
||||
' UpModalFechaBody.Update()
|
||||
' TxtFechaModal.Text = ""
|
||||
' lblTituloPagina.Text = ""
|
||||
' UpTituloPagina.Update()
|
||||
' UpModalFechaBody.Update()
|
||||
|
||||
' If objNomina.DtResultados.Rows.Count > 0 Then
|
||||
' BtnConsultar.Enabled = True
|
||||
' DTPeriodos = objNomina.DtResultados
|
||||
' Dim DTPeridosView As DataView = DTPeriodos.DefaultView
|
||||
' DTPeridosView.Sort = " FechaInicio desc "
|
||||
' DTPeriodos = DTPeridosView.ToTable
|
||||
' DdlPeriodo.DataSource = objNomina.DtResultados
|
||||
If objNomina.DtResultados.Rows.Count > 0 Then
|
||||
' BtnConsultar.Enabled = True
|
||||
DTPeriodos = objNomina.DtResultados
|
||||
' Dim DTPeridosView As DataView = DTPeriodos.DefaultView
|
||||
' DTPeridosView.Sort = " FechaInicio desc "
|
||||
' DTPeriodos = DTPeridosView.ToTable
|
||||
' DdlPeriodo.DataSource = objNomina.DtResultados
|
||||
|
||||
' ' LblPeriodo.Visible = True
|
||||
' 'DdlRango.Visible = True
|
||||
' Else
|
||||
' ' RegistraScript("$('#ModalModalFecha').modal({ backdrop: 'static', keyboard: false});")
|
||||
' Alert("No se encontraron periodos disponibles.", TipoMensaje.MsgAdvertencia)
|
||||
' DTPeriodos = Nothing
|
||||
' DdlPeriodo.DataSource = Nothing
|
||||
' End If
|
||||
'Else
|
||||
' DTPeriodos = Nothing
|
||||
' DdlPeriodo.DataSource = Nothing
|
||||
'End If
|
||||
'objNomina.Dispose()
|
||||
' ' LblPeriodo.Visible = True
|
||||
' 'DdlRango.Visible = True
|
||||
Else
|
||||
' ' RegistraScript("$('#ModalModalFecha').modal({ backdrop: 'static', keyboard: false});")
|
||||
' Alert("No se encontraron periodos disponibles.", TipoMensaje.MsgAdvertencia)
|
||||
DTPeriodos = Nothing
|
||||
' DdlPeriodo.DataSource = Nothing
|
||||
End If
|
||||
'Else
|
||||
' DTPeriodos = Nothing
|
||||
' DdlPeriodo.DataSource = Nothing
|
||||
End If
|
||||
|
||||
objNomina.Dispose()
|
||||
|
||||
Dim DtTempFechaInicial As DataTable = DTPeriodos.FiltraParametros("Estatus = 1")
|
||||
|
||||
|
||||
DdlPeriodo.DataBind()
|
||||
DdlPeriodo.DataBind()
|
||||
|
||||
If DtTempFechaInicial.Rows.Count > 0 Then
|
||||
Dim temCvePeriodoNomi As Integer = DtTempFechaInicial(0)("CvePeriodo").ToString().ToEntero
|
||||
DdlPeriodo.SelectedValueExist(temCvePeriodoNomi)
|
||||
End If
|
||||
If DtTempFechaInicial.Rows.Count > 0 Then
|
||||
Dim temCvePeriodoNomi As Integer = DtTempFechaInicial(0)("CvePeriodo").ToString().ToEntero
|
||||
DdlPeriodo.SelectedValueExist(temCvePeriodoNomi)
|
||||
End If
|
||||
|
||||
DdlPeriodo.Items.Insert(0, New ListItem("Seleccione uno", "-1"))
|
||||
UPFiltros.Update()
|
||||
' BtnConsultar.Enabled = True
|
||||
Else
|
||||
DdlPeriodo.Items.Insert(0, New ListItem("Seleccione uno", "-1"))
|
||||
UPFiltros.Update()
|
||||
' BtnConsultar.Enabled = True
|
||||
Else
|
||||
|
||||
DTPeriodos = Nothing
|
||||
DTPeriodos = Nothing
|
||||
DdlPeriodo.DataSource = Nothing
|
||||
|
||||
'DdlRango.Visible = False
|
||||
@@ -378,6 +400,8 @@ Partial Class RH_RepChecadorPreAsistencia
|
||||
End If
|
||||
|
||||
GeneraFechasInicioFinPerdiodo()
|
||||
|
||||
DdlPeriodo_SelectedIndexChanged(Nothing, Nothing)
|
||||
End Sub
|
||||
|
||||
Private Sub DdlRango_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlPeriodo.SelectedIndexChanged
|
||||
@@ -491,15 +515,27 @@ Partial Class RH_RepChecadorPreAsistencia
|
||||
Dim DtTempPeriodo As DataTable = DTPeriodos.FiltraParametros("CvePeriodo = " & DdlPeriodo.SelectedValue.ToEntero)
|
||||
Dim FechaInicioPeriodoFiltro = DtTempPeriodo(0)("FechaInicio").ToString().ToDate
|
||||
|
||||
'Dim FilasFiltradas = From fila In GlobalDTRHPersonal(UsuarioActual.Empresa.CveEmpresa).FiltraParametros(FiltroSubProyecto).AsEnumerable()
|
||||
' Let Inicio = fila.Field(Of Date)("FechaInicio")
|
||||
' Let FechaFinOriginal = fila.Field(Of Date?)("FechaFin")
|
||||
' Let FechaFin = If(FechaFinOriginal.HasValue, FechaFinOriginal.Value, Now)
|
||||
' Where Inicio <= FechaInicioPeriodoFiltro AndAlso FechaInicioPeriodoFiltro <= FechaFin
|
||||
' Select fila
|
||||
|
||||
Dim FilCveDepartamento As Integer = DdlDepartamento.SelectedValue.ToEntero
|
||||
|
||||
Dim FilasFiltradas = From fila In GlobalDTRHPersonal(UsuarioActual.Empresa.CveEmpresa).FiltraParametros(FiltroSubProyecto).AsEnumerable()
|
||||
Let Inicio = fila.Field(Of Date)("FechaInicio")
|
||||
Let FechaFinOriginal = fila.Field(Of Date?)("FechaFin")
|
||||
Let FechaFin = If(FechaFinOriginal.HasValue, FechaFinOriginal.Value, Now)
|
||||
Where Inicio <= FechaInicioPeriodoFiltro AndAlso FechaInicioPeriodoFiltro <= FechaFin
|
||||
Select fila
|
||||
Let Inicio = fila.Field(Of Date)("FechaInicio")
|
||||
Let FechaFinOriginal = fila.Field(Of Date?)("FechaFin")
|
||||
Let FechaFin = If(FechaFinOriginal.HasValue, FechaFinOriginal.Value, Now)
|
||||
Where Inicio <= FechaInicioPeriodoFiltro AndAlso FechaInicioPeriodoFiltro <= FechaFin _
|
||||
AndAlso (FilCveDepartamento = -1 OrElse fila.Field(Of Integer)("CveDepartamento") = FilCveDepartamento)
|
||||
Select fila
|
||||
|
||||
DtPersonal = FilasFiltradas.CopyToDataTable()
|
||||
|
||||
|
||||
|
||||
If objRH.ChecadorHorariosGet(-1, 1, UsuarioActual.Empresa.CveEmpresa) Then
|
||||
DTHorarios = objRH.DtResultados
|
||||
|
||||
@@ -531,7 +567,7 @@ Partial Class RH_RepChecadorPreAsistencia
|
||||
|
||||
End If
|
||||
|
||||
If objRH.PreAsistenciaRegistrosGet(FechaInicioPeriodo, FechaFinPeriodo, DdlTurno.SelectedValue.ToEntero, UsuarioActual.Empresa.CveEmpresa) Then
|
||||
If objRH.PreAsistenciaRegistrosGet(FechaInicioPeriodo, FechaFinPeriodo, DdlTurno.SelectedValue.ToEntero, UsuarioActual.Empresa.CveEmpresa, False) Then
|
||||
DTChecadorRegistros = objRH.DtResultados
|
||||
End If
|
||||
|
||||
@@ -571,6 +607,13 @@ Partial Class RH_RepChecadorPreAsistencia
|
||||
|
||||
Dim Fecha As Date = FechaInicioPeriodo
|
||||
Dim ContadorFaltas As Integer = 0
|
||||
|
||||
objRH = New ClsRH
|
||||
If objRH.PreAsistenciaRegistrosGet(FechaInicioPeriodo, FechaFinPeriodo, DdlTurno.SelectedValue.ToEntero, UsuarioActual.Empresa.CveEmpresa, True) Then
|
||||
DTChecadorRegistros = objRH.DtResultados
|
||||
End If
|
||||
objRH.Dispose()
|
||||
|
||||
Dim registrosPersonal As DataTable = DTChecadorRegistros.FiltraParametros(" CvePersonal = " & dRow(0).ToString())
|
||||
|
||||
Dim CveTurno As Integer = dRow("CveTurno").ToString.ToEntero
|
||||
@@ -1169,14 +1212,21 @@ Partial Class RH_RepChecadorPreAsistencia
|
||||
End Sub
|
||||
|
||||
Private Sub GvBind()
|
||||
|
||||
Dim Enviado As Boolean = PeriodoBloqueado(DdlPeriodo.SelectedValue.ToEntero)
|
||||
|
||||
LnkEnviarAsistencia.Visible = False
|
||||
LnkCargaMasiva.Visible = False
|
||||
|
||||
If DtDatosTabla.Rows.Count > 0 Then
|
||||
'BtnAgregar.Visible = True
|
||||
GVRegDatos.DataSource = DtDatosTabla
|
||||
LnkEnviarAsistencia.Visible = True
|
||||
|
||||
If Not Enviado Then
|
||||
LnkCargaMasiva.Visible = True
|
||||
End If
|
||||
|
||||
Else
|
||||
'BtnAgregar.Visible = False
|
||||
GVRegDatos.DataSource = Nothing
|
||||
End If
|
||||
|
||||
@@ -1861,7 +1911,7 @@ Partial Class RH_RepChecadorPreAsistencia
|
||||
|
||||
Dim objRH As New ClsRH
|
||||
|
||||
If objRH.PreAsistenciaRegistrosGet(FechaInicioPeriodo, FechaFinPeriodo, DdlTurno.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
|
||||
If objRH.PreAsistenciaRegistrosGet(FechaInicioPeriodo, FechaFinPeriodo, DdlTurno.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, False) Then
|
||||
DTChecadorRegistros = objRH.DtResultados
|
||||
End If
|
||||
|
||||
@@ -2366,4 +2416,107 @@ Partial Class RH_RepChecadorPreAsistencia
|
||||
ObjPersonal.Dispose()
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkCargaMasiva_Click(sender As Object, e As EventArgs)
|
||||
|
||||
DVEnvioMasivo.Visible = False
|
||||
Dim Enviado As Boolean = PeriodoBloqueado(DdlPeriodo.SelectedValue.ToEntero)
|
||||
|
||||
If Enviado Then
|
||||
Alert("El periodo ya ha sido enviado.", TipoMensaje.MsgAdvertencia)
|
||||
Else
|
||||
DVEnvioMasivo.Visible = True
|
||||
End If
|
||||
|
||||
UpDatos.Update()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function PeriodoBloqueado(CvePeriodo As Integer) As Boolean
|
||||
Dim respuesta As Boolean = True
|
||||
If CvePeriodo > 0 Then
|
||||
Using objPeriodos As New ClsNominas()
|
||||
If objPeriodos.GetPeriodos(-1, UsuarioActual.CveEmpresa, -1, -1, CvePeriodo) Then
|
||||
|
||||
If objPeriodos.DtResultados.Rows.Count > 0 Then
|
||||
respuesta = Boolean.Parse(objPeriodos.DtResultados.Rows(0)("PreAsistenciaEnviada").ToString)
|
||||
Else
|
||||
respuesta = False
|
||||
End If
|
||||
|
||||
End If
|
||||
End Using
|
||||
End If
|
||||
|
||||
Return respuesta
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Protected Sub DdlPeriodo_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
|
||||
Dim Enviado As Boolean = PeriodoBloqueado(DdlPeriodo.SelectedValue.ToEntero)
|
||||
|
||||
If Enviado Then
|
||||
LnkEnviarAsistencia.Visible = False
|
||||
'LnkCargaMasiva.Visible = False
|
||||
Else
|
||||
LnkEnviarAsistencia.Visible = True
|
||||
'LnkCargaMasiva.Visible = True
|
||||
End If
|
||||
|
||||
UPFiltros.Update()
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub LnklEnviarCargaMasiva_Click(sender As Object, e As EventArgs)
|
||||
|
||||
|
||||
Dim Enviado As Boolean = PeriodoBloqueado(DdlPeriodo.SelectedValue.ToEntero)
|
||||
|
||||
If Enviado Then
|
||||
Alert($"El periodo {DdlPeriodo.SelectedItem.Text} ya fue enviado.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim FechaCarga As Date = TxtFechaCargaMasiva.Text.ToDate
|
||||
Dim ProcesoOK As Boolean = True
|
||||
|
||||
If Not (FechaCarga >= FechaInicioPeriodo AndAlso FechaCarga <= FechaFinPeriodo) Then
|
||||
Alert("La fecha de carga masiva debe de estar en el rango de fechas del período seleccionado.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If DdlMotivoHoraExtra.SelectedValue.ToEntero > 0 And (TxtHorasDobles.Text.ToDecimal > 0 And TxtHorasTriples.Text.ToDecimal > 0) Then
|
||||
Alert("Debe seleccionar un motivo de horas extra.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim ObjRH As New ClsRH
|
||||
ObjRH.IniciaTransacSQL()
|
||||
|
||||
|
||||
For Each GvRow As GridViewRow In GVRegDatos.Rows
|
||||
|
||||
Dim CvePersonal As Integer = GvRow.DataKey("CvePersonal").ToEntero
|
||||
|
||||
If Not ObjRH.AddPreAsistencia(CvePersonal, FechaCarga, DdlAsistenciaInacistenciaCarga.SelectedValue.ToEntero, TxtPorcentajePago.Text.ToDecimal, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa,
|
||||
TxtHorasDobles.Text.ToDecimal, TxtHorasTriples.Text.ToDecimal, DdlMotivoHoraExtra.SelectedValue.ToEntero, TxtObs.Text) Then
|
||||
ProcesoOK = False
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
If ProcesoOK Then
|
||||
ObjRH.Commit()
|
||||
Alert("Carga realizada correctamente.")
|
||||
CargaDatos()
|
||||
Else
|
||||
ObjRH.RollBack()
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user