added form parking / toll
This commit is contained in:
@@ -42,25 +42,26 @@ class FormEntertainmentPresentationController extends Controller
|
||||
|
||||
$now = Carbon::now();
|
||||
|
||||
// Tentukan periode aktif (mulai dan tutup)
|
||||
// Determine the period
|
||||
if ($now->day >= $startDay) {
|
||||
$startDate = Carbon::create($now->year, $now->month, $startDay)->startOfDay();
|
||||
$closingDate = Carbon::create($now->copy()->addMonth()->year, $now->copy()->addMonth()->month, $closingDay)->endOfDay();
|
||||
$currentPeriodStartDate = Carbon::create($now->year, $now->month, $startDay)->startOfDay();
|
||||
$currentPeriodClosingDate = Carbon::create($now->copy()->addMonth()->year, $now->copy()->addMonth()->month, $closingDay)->endOfDay();
|
||||
} else {
|
||||
$startDate = Carbon::create($now->copy()->subMonth()->year, $now->copy()->subMonth()->month, $startDay)->startOfDay();
|
||||
$closingDate = Carbon::create($now->year, $now->month, $closingDay)->endOfDay();
|
||||
$currentPeriodStartDate = Carbon::create($now->copy()->subMonth()->year, $now->copy()->subMonth()->month, $startDay)->startOfDay();
|
||||
$currentPeriodClosingDate = Carbon::create($now->year, $now->month, $closingDay)->endOfDay();
|
||||
}
|
||||
|
||||
// Ambil nama bulan dan tahun dari $startDate untuk keperluan BudgetHelper
|
||||
$periodeMonth = strtolower($startDate->format('F')); // ex: 'august'
|
||||
$periodeYear = (int) $startDate->format('Y'); // ex: 2025
|
||||
// Calculate the actual start date for data retrieval (1 month before currentPeriodStartDate)
|
||||
$dataRetrievalStartDate = $currentPeriodStartDate->copy()->subMonth()->startOfDay();
|
||||
|
||||
$forms = FormEntertaimentPresentation::whereBetween('tanggal', [$startDate, $closingDate])
|
||||
$forms = FormEntertaimentPresentation::whereBetween('tanggal', [$dataRetrievalStartDate, $currentPeriodClosingDate])
|
||||
->orderBy('tanggal', 'desc')
|
||||
->with('user')
|
||||
->get();
|
||||
|
||||
$availableBudget = null;
|
||||
$periodeMonth = strtolower($currentPeriodStartDate->format('F'));
|
||||
$periodeYear = (int) $currentPeriodStartDate->format('Y');
|
||||
|
||||
if ($role == 'Admin Region' || $role == 'Marketing Operational Manager Region') {
|
||||
$region_id = auth()->user()->getMyCabangAndRegionId()['region'];
|
||||
|
||||
Reference in New Issue
Block a user