This commit is contained in:
Jagad R R
2025-01-19 19:39:28 +07:00
parent a393f3f46f
commit 6034c331c5
3 changed files with 14 additions and 8 deletions
+10 -4
View File
@@ -14,8 +14,11 @@ use App\Models\UserHasCabang;
class FormHelper
{
public static function getFormsByUserIds($userIds, $month, $year) {
$startDate = date("$year-$month-" . env('STARTING_DATE'));
$closingDateNextMonth = date("$year-$month-", strtotime("+1 month", strtotime("$year-$month-01"))) . env('CLOSING_DATE');
$monthNumber = date('m', strtotime($month . ' 1'));
$startDate = "$year-$monthNumber-" . env('STARTING_DATE');
$nextMonthTimestamp = strtotime("first day of next month", strtotime("$year-$monthNumber-01"));
$closingDateNextMonth = date('Y-m-', $nextMonthTimestamp) . env('CLOSING_DATE');
$users = Admin::with(['region', 'cabang'])
->whereIn('id', $userIds)
@@ -98,8 +101,11 @@ class FormHelper
}
public static function getAllForms($month, $year) {
$startDate = date("$year-$month-" . env('STARTING_DATE'));
$closingDateNextMonth = date("$year-$month-", strtotime("+1 month", strtotime("$year-$month-01"))) . env('CLOSING_DATE');
$monthNumber = date('m', strtotime($month . ' 1'));
$startDate = "$year-$monthNumber-" . env('STARTING_DATE');
$nextMonthTimestamp = strtotime("first day of next month", strtotime("$year-$monthNumber-01"));
$closingDateNextMonth = date('Y-m-', $nextMonthTimestamp) . env('CLOSING_DATE');
$users = Admin::with(['region', 'cabang'])
->get();
@@ -98,7 +98,7 @@ class FormOtherController extends Controller
return view('backend.pages.forms.other.view', [
'form' => $form,
'kategori' => Kategori::whereNotIn('name', ['Up Country', 'Vehicle Running Cost', 'Entertainment & Presentation', 'Meeting & Seminar'])->get()
'kategori' => Kategori::whereNotIn('name', ['Up Country', 'Vehicle Running Cost', 'Entertainment', 'Meeting / Seminar'])->get()
]);
}
@@ -107,7 +107,7 @@ class FormOtherController extends Controller
$this->checkAuthorization(auth()->user(), ['forms.other.create']);
return view('backend.pages.forms.other.create', [
'kategori' => Kategori::whereNotIn('name', ['Up Country', 'Vehicle Running Cost', 'Entertainment & Presentation', 'Meeting & Seminar'])->get()
'kategori' => Kategori::whereNotIn('name', ['Up Country', 'Vehicle Running Cost', 'Entertainment', 'Meeting / Seminar'])->get()
]);
}
@@ -243,7 +243,7 @@ class FormOtherController extends Controller
return view('backend.pages.forms.other.edit', [
'form' => $form,
'kategori' => Kategori::whereNotIn('name', ['Up Country', 'Vehicle Running Cost', 'Entertainment & Presentation', 'Meeting & Seminar'])->get()
'kategori' => Kategori::whereNotIn('name', ['Up Country', 'Vehicle Running Cost', 'Entertainment', 'Meeting / Seminar'])->get()
]);
}