Hiệu chỉnh job tính ngày phép dư năm rồi

This commit is contained in:
Truong Vo 2024-08-14 10:04:08 +07:00
parent 93aa85be8c
commit 377cb2d079
2 changed files with 3 additions and 2 deletions

View File

@ -58,7 +58,7 @@ class DeductLeaveDays implements ShouldQueue
->first();
if ($totalLeaveDaysByMonth) {
//Nếu ngày phép thừa năm trước chưa sử dụng hết => cập nhật lại ngày đó
//Nếu ngày phép thừa năm trước chưa sử dụng hết => cập nhật lại ngày đó (Ngày tồn đọng - ngày sử dụng)
if ($existingData->ld_date_additional > $totalLeaveDaysByMonth->leave_days) {
LeaveDays::where('ld_year', $this->year)
->where('ld_user_id', $user->id)
@ -67,6 +67,7 @@ class DeductLeaveDays implements ShouldQueue
]);
}
} else {
//Nếu không sử dụng ngày nghỉ còn lại ở nằm rồi thì xóa => theo luật ld
LeaveDays::where('ld_year', $this->year)
->where('ld_user_id', $user->id)
->update([

View File

@ -55,7 +55,7 @@ class InitializeLeaveDays implements ShouldQueue
$ld_note = '';
if ($previousYearData) {
$ld_date_additional = $previousYearData->ld_day;
$ld_date_additional = $previousYearData->ld_day + $previousYearData->ld_date_additional;
$totalLeaveDaysByMonth = Notes::join('categories', function ($join) {
$join->on('notes.n_time_type', '=', 'categories.c_code')
->where('categories.c_type', 'TIME_TYPE');