diff --git a/app/Jobs/ExportStatementJob.php b/app/Jobs/ExportStatementJob.php index f8e8aa4..da7527e 100644 --- a/app/Jobs/ExportStatementJob.php +++ b/app/Jobs/ExportStatementJob.php @@ -156,6 +156,7 @@ 'description' => $this->generateNarrative($item), 'end_balance' => $runningBalance, 'actual_date' => $actualDate, + 'recipt_no' => $item->ft?->recipt_no ?? '-', 'created_at' => now(), 'updated_at' => now(), ]; @@ -242,9 +243,9 @@ $narr[] = $item->narrative; } - if ($item->ft?->recipt_no) { + /*if ($item->ft?->recipt_no) { $narr[] = 'Receipt No: ' . $item->ft->recipt_no; - } + }*/ return implode(' ', array_filter($narr)); } @@ -404,7 +405,7 @@ Storage::disk($this->disk)->delete($filePath); } - $csvContent = "NO|TRANSACTION.DATE|REFERENCE.NUMBER|TRANSACTION.AMOUNT|TRANSACTION.TYPE|DESCRIPTION|END.BALANCE|ACTUAL.DATE\n"; + $csvContent = "NO|TRANSACTION.DATE|REFERENCE.NUMBER|TRANSACTION.AMOUNT|TRANSACTION.TYPE|DESCRIPTION|END.BALANCE|ACTUAL.DATE|NO.RECEIPT\n"; // Ambil data yang sudah diproses dalam chunk untuk mengurangi penggunaan memori ProcessedStatement::where('account_number', $this->account_number) @@ -420,7 +421,8 @@ $statement->transaction_type, $statement->description, $statement->end_balance, - $statement->actual_date + $statement->actual_date, + $statement->recipt_no ]) . "\n"; } diff --git a/app/Models/ProcessedStatement.php b/app/Models/ProcessedStatement.php index b199add..9d0e6be 100644 --- a/app/Models/ProcessedStatement.php +++ b/app/Models/ProcessedStatement.php @@ -16,6 +16,7 @@ 'transaction_type', 'description', 'end_balance', - 'actual_date' + 'actual_date', + 'no_receipt' ]; } diff --git a/database/migrations/2025_07_14_022029_add_no_receipt_to_processed_statements_table.php b/database/migrations/2025_07_14_022029_add_no_receipt_to_processed_statements_table.php new file mode 100644 index 0000000..93dc6e5 --- /dev/null +++ b/database/migrations/2025_07_14_022029_add_no_receipt_to_processed_statements_table.php @@ -0,0 +1,32 @@ +string('no_receipt')->nullable()->after('reference_number'); + + // Menambahkan index untuk field no_receipt jika diperlukan untuk pencarian + $table->index('no_receipt'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('processed_statements', function (Blueprint $table) { + $table->dropIndex(['no_receipt']); + $table->dropColumn('no_receipt'); + }); + } +};