fix(salary):memperbaiki oenggajian ketika pertama kali gaji itu hasilnya pasti 0

This commit is contained in:
Yoga Pangestu 2025-02-13 08:06:48 +07:00
parent 3931600346
commit 909e7c787c

View File

@ -163,11 +163,6 @@ public function getSalaryEmployee(string $employeeId): JsonResponse
if ($employee->role_id === 4 && $latestPayroll->created_at->isToday()) {
$query->where('is_paid', '0');
}
}, function ($query) {
$query->whereBetween('created_at', [
now()->subMonth()->startOfMonth(),
now()->subMonth()->endOfMonth(),
]);
})
->sum('total');
$debt = Debt::where('user_id', $employeeId)->where('is_paid', '0')->sum('amount');