diff --git a/BACKEND/app/Jobs/DeductLeaveDays.php b/BACKEND/app/Jobs/DeductLeaveDays.php index 1fea2ed..94c7383 100644 --- a/BACKEND/app/Jobs/DeductLeaveDays.php +++ b/BACKEND/app/Jobs/DeductLeaveDays.php @@ -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([ diff --git a/BACKEND/app/Jobs/InitializeLeaveDays.php b/BACKEND/app/Jobs/InitializeLeaveDays.php index c73e559..3c545b5 100644 --- a/BACKEND/app/Jobs/InitializeLeaveDays.php +++ b/BACKEND/app/Jobs/InitializeLeaveDays.php @@ -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');