diff --git a/app/Console/GenerateAtmTransactionReport.php b/app/Console/GenerateAtmTransactionReport.php new file mode 100644 index 0000000..5aa41dc --- /dev/null +++ b/app/Console/GenerateAtmTransactionReport.php @@ -0,0 +1,59 @@ +info('Starting ATM Transaction report generation...'); + $period = $this->option('period'); + + if (!$period) { + $this->error('Period parameter is required. Format: Ymd (example: 20250512)'); + return Command::FAILURE; + } + + // Validate period format + if (!preg_match('/^\d{8}$/', $period)) { + $this->error('Invalid period format. Use Ymd format (example: 20250512)'); + return Command::FAILURE; + } + + try { + // Dispatch the job + GenerateAtmTransactionReportJob::dispatch($period); + + $this->info("ATM Transaction report generation job queued for period: {$period}"); + $this->info('The report will be generated in the background.'); + + return Command::SUCCESS; + } catch (Exception $e) { + $this->error('Error queuing ATM Transaction report job: ' . $e->getMessage()); + return Command::FAILURE; + } + } +}