feat(webstatement): tambah field no_receipt pada processed_statements
Perubahan yang dilakukan: - Menambahkan field no_receipt pada tabel processed_statements melalui migrasi baru. - Menambahkan no_receipt ke dalam fillable array di model ProcessedStatement. - Mengintegrasikan field recipt_no dari relasi ft ke dalam data yang disimpan di processed_statements. - Menambahkan kolom NO.RECEIPT pada header CSV export statement. - Menyertakan data recipt_no ke dalam output CSV export statement. - Mengomentari kode yang sebelumnya menambahkan receipt number ke narrative description untuk menghindari duplikasi. - Menggunakan nilai default '-' jika recipt_no tidak tersedia. File yang dimodifikasi: - app/Jobs/ExportStatementJob.php: Menambahkan mapping recipt_no ke no_receipt, update header CSV, dan menyertakan data dalam export. - app/Models/ProcessedStatement.php: Menambahkan no_receipt ke fillable fields. - Modules/Webstatement/database/migrations/2025_07_14_022029_add_no_receipt_to_processed_statements_table.php: Menambahkan kolom no_receipt di database. Tujuan perubahan: - Memisahkan nomor receipt transaksi dari narrative description untuk kemudahan pelaporan dan audit. - Memberikan fleksibilitas lebih dalam pengolahan data statement, khususnya untuk kebutuhan export dan compliance.
This commit is contained in:
@@ -156,6 +156,7 @@
|
|||||||
'description' => $this->generateNarrative($item),
|
'description' => $this->generateNarrative($item),
|
||||||
'end_balance' => $runningBalance,
|
'end_balance' => $runningBalance,
|
||||||
'actual_date' => $actualDate,
|
'actual_date' => $actualDate,
|
||||||
|
'recipt_no' => $item->ft?->recipt_no ?? '-',
|
||||||
'created_at' => now(),
|
'created_at' => now(),
|
||||||
'updated_at' => now(),
|
'updated_at' => now(),
|
||||||
];
|
];
|
||||||
@@ -242,9 +243,9 @@
|
|||||||
$narr[] = $item->narrative;
|
$narr[] = $item->narrative;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($item->ft?->recipt_no) {
|
/*if ($item->ft?->recipt_no) {
|
||||||
$narr[] = 'Receipt No: ' . $item->ft->recipt_no;
|
$narr[] = 'Receipt No: ' . $item->ft->recipt_no;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
return implode(' ', array_filter($narr));
|
return implode(' ', array_filter($narr));
|
||||||
}
|
}
|
||||||
@@ -404,7 +405,7 @@
|
|||||||
Storage::disk($this->disk)->delete($filePath);
|
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
|
// Ambil data yang sudah diproses dalam chunk untuk mengurangi penggunaan memori
|
||||||
ProcessedStatement::where('account_number', $this->account_number)
|
ProcessedStatement::where('account_number', $this->account_number)
|
||||||
@@ -420,7 +421,8 @@
|
|||||||
$statement->transaction_type,
|
$statement->transaction_type,
|
||||||
$statement->description,
|
$statement->description,
|
||||||
$statement->end_balance,
|
$statement->end_balance,
|
||||||
$statement->actual_date
|
$statement->actual_date,
|
||||||
|
$statement->recipt_no
|
||||||
]) . "\n";
|
]) . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
'transaction_type',
|
'transaction_type',
|
||||||
'description',
|
'description',
|
||||||
'end_balance',
|
'end_balance',
|
||||||
'actual_date'
|
'actual_date',
|
||||||
|
'no_receipt'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('processed_statements', function (Blueprint $table) {
|
||||||
|
$table->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');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user