Personal vacaciones calculo dias feriados y fecha fin
This commit is contained in:
@@ -1896,6 +1896,8 @@ Partial Class RH_Personal
|
||||
|
||||
TxtFechaFinVac.Text = Now.AddDays(VacDiasDisponibles).ToString("dd/MM/yyyy")
|
||||
|
||||
|
||||
|
||||
'PERSONAL ALTAS
|
||||
If ObjPersonal.GetPersonalAltas(CvePersonal) Then
|
||||
GvPersonalAltas.DataSource = ObjPersonal.DtResultados
|
||||
@@ -7814,5 +7816,60 @@ Partial Class RH_Personal
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
Protected Sub LnkSolicitarVacaciones_Click(sender As Object, e As EventArgs)
|
||||
|
||||
TxtVacDiasPago.Text = VacDiasDisponibles.ToString
|
||||
|
||||
Dim diaDescanso As Integer = GlobalDTTurno(UsuarioActual.CveEmpresa).FiltroPrimeroValor("DiaDescanso", $" CveTurno = {DdlTurno.SelectedValue.ToEntero}").ToEntero
|
||||
diaDescanso = If(diaDescanso <= 0, 1, diaDescanso)
|
||||
|
||||
ContarDiasDeLaSemana(TxtFechaInicioVac.Text.ToDate, TxtVacDiasPago.Text.ToEntero)
|
||||
|
||||
If Not diaDescanso > 0 Then
|
||||
Alert("El turno no tiene día de descanso, provisionalmente se tomara el domingo.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
RegistraScript("$('#ModalAddVacaciones').modal('show');")
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub ContarDiasDeLaSemana(fechaInicio As Date, diasVacaciones As Integer)
|
||||
|
||||
Dim diaDescanso As Integer = GlobalDTTurno(UsuarioActual.CveEmpresa).FiltroPrimeroValor("DiaDescanso", $" CveTurno = {DdlTurno.SelectedValue.ToEntero}").ToEntero
|
||||
diaDescanso = If(diaDescanso <= 0, 1, diaDescanso)
|
||||
|
||||
Dim DiasAgregados As Integer = 0
|
||||
Dim FechaFin As Date = fechaInicio
|
||||
|
||||
For x = 2 To diasVacaciones
|
||||
Dim day_of_week = CType(FechaFin.DayOfWeek, Integer) + 1
|
||||
If day_of_week = diaDescanso Then
|
||||
FechaFin = FechaFin.AddDays(2)
|
||||
DiasAgregados = DiasAgregados + 1
|
||||
Else
|
||||
FechaFin = FechaFin.AddDays(1)
|
||||
day_of_week = CType(FechaFin.DayOfWeek, Integer) + 1
|
||||
If day_of_week = diaDescanso Then
|
||||
DiasAgregados = DiasAgregados + 1
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
TxtFechaFinVac.Text = FechaFin.ToString
|
||||
Txtdiasinabiles.Text = DiasAgregados.ToString
|
||||
|
||||
UpSolicitarVacaciones.Update()
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkCalculaFechasVacaciones_Click(sender As Object, e As EventArgs)
|
||||
|
||||
ContarDiasDeLaSemana(TxtFechaInicioVac.Text.ToDate, TxtVacDiasPago.Text.ToEntero)
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user