added form parking / toll
This commit is contained in:
@@ -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'];
|
||||
|
||||
Reference in New Issue
Block a user