diff --git a/app/Console/CombinePdf.php b/app/Console/CombinePdf.php index 97719d4..d5dc007 100644 --- a/app/Console/CombinePdf.php +++ b/app/Console/CombinePdf.php @@ -13,7 +13,7 @@ * * @var string */ - protected $signature = 'webstatement:combine-pdf'; + protected $signature = 'webstatement:combine-pdf {--period= : Period to process migration format Ym contoh. 202506}'; /** * The console command description. @@ -30,7 +30,8 @@ public function handle() { $this->info('Starting combine pdf process...'); - $period = request()->set(['period' => $this->argument('period')]); + $period = $this->option('period'); + try { $controller = app(CombinePdfController::class); $response = $controller->combinePdfs($period); diff --git a/app/Http/Controllers/CombinePdfController.php b/app/Http/Controllers/CombinePdfController.php index 4998c61..f05eebe 100644 --- a/app/Http/Controllers/CombinePdfController.php +++ b/app/Http/Controllers/CombinePdfController.php @@ -25,13 +25,13 @@ class CombinePdfController extends Controller * @param Request $request * @return \Illuminate\Http\JsonResponse */ - public function combinePdfs(Request $request) + public function combinePdfs($period) { // Get period from request or use current period - $period = $request->input('period', date('Ym')); + $period = $period ?? date('Ym'); // Get all accounts - $accounts = Account::all(); + $accounts = Account::where('branch_code','ID0010001')->get(); $processedCount = 0; $skippedCount = 0; $errorCount = 0; @@ -41,8 +41,8 @@ class CombinePdfController extends Controller $accountNumber = $account->account_number; // Define file paths - $r14Path = storage_path("app/r14/{$period}/{$branchCode}/{$accountNumber}_{$period}.pdf"); - $r23Path = storage_path("app/r23/{$period}/{$branchCode}/{$accountNumber}_{$period}.pdf"); + $r14Path = storage_path("app/STMT/r14/{$period}/{$branchCode}/{$accountNumber}_{$period}.pdf"); + $r23Path = storage_path("app/STMT/r23/{$period}/{$branchCode}/{$accountNumber}_{$period}.pdf"); $outputDir = storage_path("app/combine/{$period}/{$branchCode}"); $outputFilename = "{$accountNumber}_{$period}.pdf";