added form parking / toll
This commit is contained in:
@@ -37,27 +37,29 @@ class FormOtherController extends Controller
|
||||
$startDay = (int) env('STARTING_DATE', 11);
|
||||
$closingDay = (int) env('CLOSING_DATE', 10);
|
||||
|
||||
// Referensi waktu sekarang
|
||||
$now = Carbon::now();
|
||||
|
||||
// Tentukan periode aktif
|
||||
// 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();
|
||||
}
|
||||
|
||||
// Periode untuk keperluan budget
|
||||
$periodeMonth = strtolower($startDate->format('F'));
|
||||
$periodeYear = (int) $startDate->format('Y');
|
||||
// Calculate the actual start date for data retrieval (1 month before currentPeriodStartDate)
|
||||
$dataRetrievalStartDate = $currentPeriodStartDate->copy()->subMonth()->startOfDay();
|
||||
|
||||
$forms = FormOthers::whereBetween('tanggal', [$startDate, $closingDate])
|
||||
$forms = FormOthers::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