added form parking / toll

This commit is contained in:
Jagad R R
2025-06-19 19:39:20 +07:00
parent a7fd26d2e6
commit a286e4c28a
11 changed files with 264 additions and 100 deletions
@@ -43,25 +43,26 @@ class FormMeetingSeminarController extends Controller
// Referensi waktu sekarang
$now = Carbon::now();
// Tentukan periode
// 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 bulan dan tahun dari $startDate untuk keperluan budget
$periodeMonth = strtolower($startDate->format('F')); // contoh: 'august'
$periodeYear = (int) $startDate->format('Y');
// Calculate the actual start date for data retrieval (1 month before currentPeriodStartDate)
$dataRetrievalStartDate = $currentPeriodStartDate->copy()->subMonth()->startOfDay();
$forms = FormMeetingSeminar::whereBetween('tanggal', [$startDate, $closingDate])
$forms = FormMeetingSeminar::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'];