- Memperbarui fungsi `combinePdfs` di `CombinePdfController`: - Menghapus penggunaan parameter dari request dan mengganti dengan parameter langsung `$period`. - Menambahkan filter `branch_code` `ID0010001` pada pemanggilan data akun untuk memastikan hanya akun tertentu yang diproses. - Mengubah jalur pencarian file PDF ke direktori baru: `app/STMT/r14` dan `app/STMT/r23` untuk menyelaraskan struktur penyimpanan file. - Memperbarui command `webstatement:combine-pdf`: - Menambahkan opsi baru `--period` untuk menyederhanakan pengaturan periode penggabungan PDF melalui format `Ym` (contoh: 202506). - Menghapus penggunaan `request()` pada command untuk memaksimalkan pengelolaan periode langsung dari opsi command-line. - Tujuan pembaruan ini: - Memastikan proses combine PDF hanya memproses data relevan berdasarkan filter branch dan struktur direktori baru. - Menyempurnakan fleksibilitas parameter periode pada command-line untuk mengurangi dependensi terhadap input request. - Meningkatkan konsistensi dan efisiensi dalam pengelolaan file PDF sesuai periode dan filter branch tertentu. Signed-off-by: Daeng Deni Mardaeni <ddeni05@gmail.com>
49 lines
1.4 KiB
PHP
49 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Modules\Webstatement\Console;
|
|
|
|
use Exception;
|
|
use Illuminate\Console\Command;
|
|
use Modules\Webstatement\Http\Controllers\CombinePdfController;
|
|
|
|
class CombinePdf extends Command
|
|
{
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'webstatement:combine-pdf {--period= : Period to process migration format Ym contoh. 202506}';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'Process combine pdf';
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*
|
|
* @return int
|
|
*/
|
|
public function handle()
|
|
{
|
|
$this->info('Starting combine pdf process...');
|
|
$period = $this->option('period');
|
|
|
|
try {
|
|
$controller = app(CombinePdfController::class);
|
|
$response = $controller->combinePdfs($period);
|
|
|
|
$responseData = json_decode($response->getContent(), true);
|
|
$this->info($responseData['message'] ?? 'Process completed');
|
|
|
|
return Command::SUCCESS;
|
|
} catch (Exception $e) {
|
|
$this->error('Error processing combine pdf: ' . $e->getMessage());
|
|
return Command::FAILURE;
|
|
}
|
|
}
|
|
}
|