Merge branch 'master' of http://jperez@192.168.10.111:8383/SIG.git
This commit is contained in:
@@ -3712,6 +3712,18 @@ Public Class ClsNominas
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
Public Function CalculaDiasFeriados(fechaInicio As String, fechaFin As String, DiasPagos As Int32, DiasFeriados As Int32, cveEmpresa As Int32, cveUsuario As Int32) As Boolean
|
||||||
|
Dim retorno As Boolean = False
|
||||||
|
DataAdapter("PA_Nom_CalculaDiasFeriados", CommandType.StoredProcedure)
|
||||||
|
addParameters("@FechaFin", SqlDbType.VarChar, fechaFin)
|
||||||
|
addParameters("@FechaInicio", SqlDbType.VarChar, fechaInicio)
|
||||||
|
addParameters("@DiasPagos", SqlDbType.Int, DiasPagos)
|
||||||
|
addParameters("@DiasFeriados", SqlDbType.Int, DiasFeriados)
|
||||||
|
addParameters("@CveEmpresa", SqlDbType.Int, cveEmpresa)
|
||||||
|
addParameters("@CveUsuario", SqlDbType.Int, cveUsuario)
|
||||||
|
retorno = RunQuery("Ocurrió un error al realizar la carga de periodos.")
|
||||||
|
Return retorno
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7899,88 +7899,95 @@ Partial Class RH_Personal
|
|||||||
|
|
||||||
Private Sub CalculaDiasVacaciones(fechaInicioParametro As Date, diasVacaciones As Integer, Optional fechaFinParametro As Date = Nothing)
|
Private Sub CalculaDiasVacaciones(fechaInicioParametro As Date, diasVacaciones As Integer, Optional fechaFinParametro As Date = Nothing)
|
||||||
|
|
||||||
Dim diaDescanso As Integer = GlobalDTTurno(UsuarioActual.CveEmpresa).FiltroPrimeroValor("DiaDescanso", $" CveTurno = {DdlTurno.SelectedValue.ToEntero}").ToEntero
|
'Dim diaDescanso As Integer = GlobalDTTurno(UsuarioActual.CveEmpresa).FiltroPrimeroValor("DiaDescanso", $" CveTurno = {DdlTurno.SelectedValue.ToEntero}").ToEntero
|
||||||
diaDescanso = If(diaDescanso <= 0, 1, diaDescanso)
|
'diaDescanso = If(diaDescanso <= 0, 1, diaDescanso)
|
||||||
|
|
||||||
If fechaFinParametro <> Nothing Then
|
'If fechaFinParametro <> Nothing Then
|
||||||
If fechaInicioParametro > fechaFinParametro Then
|
' If fechaInicioParametro > fechaFinParametro Then
|
||||||
Alert("La fecha fin no puede ser mayor a la fecha inicial", TipoMensaje.MsgAdvertencia)
|
' Alert("La fecha fin no puede ser mayor a la fecha inicial", TipoMensaje.MsgAdvertencia)
|
||||||
fechaFinParametro = Nothing
|
' fechaFinParametro = Nothing
|
||||||
TxtVacDiasPago.Text = DiasDisponibles.ToString
|
' TxtVacDiasPago.Text = DiasDisponibles.ToString
|
||||||
End If
|
' End If
|
||||||
End If
|
'End If
|
||||||
|
|
||||||
If fechaFinParametro <> Nothing Then
|
'If fechaFinParametro <> Nothing Then
|
||||||
|
|
||||||
Dim DiferenciaEntreFechas As Integer = (fechaFinParametro - fechaInicioParametro).Days + 1
|
' Dim DiferenciaEntreFechas As Integer = (fechaFinParametro - fechaInicioParametro).Days + 1
|
||||||
Dim DiasNolavorales As Integer = 0
|
' Dim DiasNolavorales As Integer = 0
|
||||||
Dim FechaTemp As Date = fechaInicioParametro
|
' Dim FechaTemp As Date = fechaInicioParametro
|
||||||
|
|
||||||
For x As Integer = 1 To DiferenciaEntreFechas
|
' For x As Integer = 1 To DiferenciaEntreFechas
|
||||||
Dim day_of_week As Integer = CType(FechaTemp.DayOfWeek, Integer) + 1
|
' Dim day_of_week As Integer = CType(FechaTemp.DayOfWeek, Integer) + 1
|
||||||
|
|
||||||
If day_of_week = diaDescanso Then
|
' If day_of_week = diaDescanso Then
|
||||||
DiasNolavorales = DiasNolavorales + 1
|
' DiasNolavorales = DiasNolavorales + 1
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' FechaTemp = FechaTemp.AddDays(1)
|
||||||
|
|
||||||
|
' If 1 = DiferenciaEntreFechas Then
|
||||||
|
' If day_of_week = diaDescanso Then
|
||||||
|
' DiasNolavorales = DiasNolavorales + 1
|
||||||
|
' End If
|
||||||
|
' End If
|
||||||
|
' Next x
|
||||||
|
|
||||||
|
|
||||||
|
' If (DiferenciaEntreFechas - DiasNolavorales) >= DiasDisponibles Then
|
||||||
|
' diasVacaciones = DiasDisponibles
|
||||||
|
' Else
|
||||||
|
' diasVacaciones = DiferenciaEntreFechas - DiasNolavorales
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' TxtVacDiasPago.Text = diasVacaciones.ToString
|
||||||
|
|
||||||
|
'End If
|
||||||
|
|
||||||
|
'If TxtVacDiasPago.Text.ToEntero > DiasDisponibles Then
|
||||||
|
' TxtVacDiasPago.Text = DiasDisponibles.ToString
|
||||||
|
' diasVacaciones = DiasDisponibles
|
||||||
|
'End If
|
||||||
|
|
||||||
|
|
||||||
|
'Dim DiasAgregados As Integer = 0
|
||||||
|
'Dim FechaFin As Date = fechaInicioParametro
|
||||||
|
'Dim Contador As Integer = 0
|
||||||
|
'For x As Integer = 2 To diasVacaciones
|
||||||
|
' Dim day_of_week As Integer = 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 (diasVacaciones = Contador + 2) AndAlso day_of_week = diaDescanso Then
|
||||||
|
' FechaFin = FechaFin.AddDays(1)
|
||||||
|
' DiasAgregados = DiasAgregados + 1
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' End If
|
||||||
|
' Contador = Contador + 1
|
||||||
|
'Next
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'Dim UltimoDiamasUno As Integer = CType(FechaFin.AddDays(1).DayOfWeek, Integer) + 1
|
||||||
|
|
||||||
|
'If UltimoDiamasUno = diaDescanso Then
|
||||||
|
' FechaFin = FechaFin.AddDays(1)
|
||||||
|
' DiasAgregados = DiasAgregados + 1
|
||||||
|
'End If
|
||||||
|
'TxtFechaFinVac.Text = FechaFin.ToString
|
||||||
|
'Txtdiasinabiles.Text = DiasAgregados.ToString
|
||||||
|
Using onom As New ClsNominas
|
||||||
|
If onom.CalculaDiasFeriados(fechaInicioParametro.ToDateTime().ToString("yyyy-MM-dd"), "", diasVacaciones, 0, UsuarioActual.CveEmpresa, UsuarioActual.CvePersonal) Then
|
||||||
|
If Not IsNothing(onom.DtResultados) AndAlso onom.DtResultados.Rows.Count > 0 Then
|
||||||
|
Dim drow As DataRow = onom.DtResultados.Rows(0)
|
||||||
|
TxtFechaFinVac.Text = String.Format("{0:dd/MM/yyyy}", drow("FechaInicio"))
|
||||||
|
Txtdiasinabiles.Text = String.Format("{0}", drow("DiaFeriadoB"))
|
||||||
End If
|
End If
|
||||||
|
|
||||||
FechaTemp = FechaTemp.AddDays(1)
|
|
||||||
|
|
||||||
If 1 = DiferenciaEntreFechas Then
|
|
||||||
If day_of_week = diaDescanso Then
|
|
||||||
DiasNolavorales = DiasNolavorales + 1
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
Next x
|
|
||||||
|
|
||||||
|
|
||||||
If (DiferenciaEntreFechas - DiasNolavorales) >= DiasDisponibles Then
|
|
||||||
diasVacaciones = DiasDisponibles
|
|
||||||
Else
|
|
||||||
diasVacaciones = DiferenciaEntreFechas - DiasNolavorales
|
|
||||||
End If
|
End If
|
||||||
|
End Using
|
||||||
TxtVacDiasPago.Text = diasVacaciones.ToString
|
|
||||||
|
|
||||||
End If
|
|
||||||
|
|
||||||
If TxtVacDiasPago.Text.ToEntero > DiasDisponibles Then
|
|
||||||
TxtVacDiasPago.Text = DiasDisponibles.ToString
|
|
||||||
diasVacaciones = DiasDisponibles
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
|
||||||
Dim DiasAgregados As Integer = 0
|
|
||||||
Dim FechaFin As Date = fechaInicioParametro
|
|
||||||
Dim Contador As Integer = 0
|
|
||||||
For x As Integer = 2 To diasVacaciones
|
|
||||||
Dim day_of_week As Integer = 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 (diasVacaciones = Contador + 2) AndAlso day_of_week = diaDescanso Then
|
|
||||||
FechaFin = FechaFin.AddDays(1)
|
|
||||||
DiasAgregados = DiasAgregados + 1
|
|
||||||
End If
|
|
||||||
|
|
||||||
End If
|
|
||||||
Contador = Contador + 1
|
|
||||||
Next
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Dim UltimoDiamasUno As Integer = CType(FechaFin.AddDays(1).DayOfWeek, Integer) + 1
|
|
||||||
|
|
||||||
If UltimoDiamasUno = diaDescanso Then
|
|
||||||
FechaFin = FechaFin.AddDays(1)
|
|
||||||
DiasAgregados = DiasAgregados + 1
|
|
||||||
End If
|
|
||||||
|
|
||||||
TxtFechaFinVac.Text = FechaFin.ToString
|
|
||||||
Txtdiasinabiles.Text = DiasAgregados.ToString
|
|
||||||
|
|
||||||
UpSolicitarVacaciones.Update()
|
UpSolicitarVacaciones.Update()
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|||||||
Reference in New Issue
Block a user