diff --git a/app/Helpers/helpers.php b/app/Helpers/helpers.php new file mode 100644 index 0000000..3fafc2e --- /dev/null +++ b/app/Helpers/helpers.php @@ -0,0 +1,39 @@ + $period, + 'year' => $year, + 'month' => $month, + ]); + + if ($period === '202505') { + // Untuk periode 202505, mulai dari tanggal 9 + $startDate = \Carbon\Carbon::createFromDate($year, $month, 9,'Asia/Jakarta'); + } else { + // Untuk periode lain, mulai dari tanggal 1 + $startDate = \Carbon\Carbon::createFromDate($year, $month, 1,'Asia/Jakarta'); + } + + // Tanggal akhir selalu akhir bulan + $endDate = \Carbon\Carbon::createFromDate($year, $month, 1)->endOfMonth(); + + return [ + 'start' => $startDate, + 'end' => $endDate, + ]; + } + } \ No newline at end of file diff --git a/app/Http/Requests/PrintStatementRequest.php b/app/Http/Requests/PrintStatementRequest.php index c0c98b0..601e47d 100644 --- a/app/Http/Requests/PrintStatementRequest.php +++ b/app/Http/Requests/PrintStatementRequest.php @@ -33,8 +33,7 @@ class PrintStatementRequest extends FormRequest $fail('Account number is required when statement type is not specified.'); } } - }, - 'string' + } ], 'stmt_sent_type' => ['nullable', 'array'], 'stmt_sent_type.*' => ['string', 'in:ALL,BY.EMAIL,BY.MAIL.TO.DOM.ADDR,BY.MAIL.TO.KTP.ADDR,NO.PRINT,PRINT'], diff --git a/module.json b/module.json index 5f83d10..2e33c14 100644 --- a/module.json +++ b/module.json @@ -8,7 +8,9 @@ "providers": [ "Modules\\Webstatement\\Providers\\WebstatementServiceProvider" ], - "files": [], + "files": [ + "app/Helpers/helpers.php" + ], "menu": { "main": [ {