From 377cb2d07914dd56df0153f6bed90c42c098fa54 Mon Sep 17 00:00:00 2001 From: Truong Vo <41848815+vmtruong301296@users.noreply.github.com> Date: Wed, 14 Aug 2024 10:04:08 +0700 Subject: [PATCH] =?UTF-8?q?Hi=E1=BB=87u=20ch=E1=BB=89nh=20job=20t=C3=ADnh?= =?UTF-8?q?=20ng=C3=A0y=20ph=C3=A9p=20d=C6=B0=20n=C4=83m=20r=E1=BB=93i?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BACKEND/app/Jobs/DeductLeaveDays.php | 3 ++- BACKEND/app/Jobs/InitializeLeaveDays.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) 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');