update untuk paparan keuntungan arcc

This commit is contained in:
Nur Izzati
2025-07-28 15:47:35 +08:00
parent d60237bc80
commit 5783382d7f
3 changed files with 115 additions and 68 deletions
+30 -27
View File
@@ -1304,10 +1304,10 @@
$.ajax({
method:'get',
url:'{{ route("arcc.history") }}',
url: '{{ route("arcc.history", ":kodcaw") }}'.replace(':kodcaw', kodcaw),
data:{ "norujukan" : histid},
success:function(data){
historytebustable(data);
historytebustable(data,histid);
$.ajax({
method: 'get',
@@ -1386,7 +1386,10 @@
urlroute = urlroute.replace(':id', bayaran['id']);
historybayarandatatable.row.add([
counter,
bayaran['norujukan'],
bayaran['created_at'],
"RM " + bayaran['bayaran_pembiayaan'],
"RM " + bayaran['bayaran_keuntungan'],
"RM " + bayaran['duit_masuk'],
bayaranteller,
bayaran['trans_type'],
@@ -1400,54 +1403,54 @@
"ordering": false
});
function historytebustable(data){
function historytebustable(data, histid)
{
console.log("Full data returned tebus:", histid); // Debug
var counter = 1;
historytebusbayaran.clear().draw();
$.each(data,function(index,tebusaz){
// TAPIS hanya entry yang sama dengan norujukan klik user
let filtered = data.filter(tebusaz => tebusaz.norujukan === histid);
$.each(filtered, function(index, tebusaz){
console.log("Tebus untuk:", tebusaz.norujukan);
var urlroute = '';
switch(tebusaz['jenistebus']) {
case 'P':
var urlroute = '{{ route("resit.tambahpinjam", ":id") }}';
urlroute = urlroute.replace(':id', tebusaz['norujukan']);
urlroute = '{{ route("resit.tambahpinjam", ":id") }}'.replace(':id', tebusaz['norujukan']);
break;
case 'T':
if(tebusaz['hargajualan'] === '')
{
var urlroute = '{{ route("resit.belumtebus", ":id") }}';
urlroute = urlroute.replace(':id', tebusaz['norujukan']);
}else{
var urlroute = '{{ route("resit.tebus", ":id") }}';
urlroute = urlroute.replace(':id', tebusaz['norujukan']);
}
urlroute = (tebusaz['hargajualan'] === '')
? '{{ route("resit.belumtebus", ":id") }}'.replace(':id', tebusaz['norujukan'])
: '{{ route("resit.tebus", ":id") }}'.replace(':id', tebusaz['norujukan']);
break;
case 'A':
var urlroute = '{{ route("resit.belumansurans", ":id") }}';
urlroute = urlroute.replace(':id', tebusaz['norujukan']);
urlroute = '{{ route("resit.belumansurans", ":id") }}'.replace(':id', tebusaz['norujukan']);
break;
case 'S':
var urlroute = '{{ route("resit.tebusseparuh", ":id") }}';
urlroute = urlroute.replace(':id', tebusaz['norujukan']);
break;
}
urlroute = '{{ route("resit.tebusseparuh", ":id") }}'.replace(':id', tebusaz['id']);
break;
}
historytebusbayaran.row.add([
counter,
tebusaz['norujukan'],
tebusaz['jenistebus'],
tebusaz['pinjaman'],
histid,
tebusaz['trans_type'],
"RM " + tebusaz['bayaran_pembiayaan'],
"RM " + tebusaz['bayaran_keuntungan'],
"RM " + tebusaz['duit_masuk'],
tebusaz['jbg'],
tebusaz['t_tebus'],
''
]).draw();
counter = counter + 1;
counter++;
});
}
function daftarwakil()
{
let nopelanggan = $('#nopelangganwakil').val();
+14 -3
View File
@@ -1,6 +1,12 @@
<style>
.modal-custom-size {
max-width: 95%; /* atau 100% */
}
</style>
<!-- Modal HistoryBayaran -->
<div class="modal fade" id="historytebusModal" tabindex="-1" role="dialog" aria-labelledby="ModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
<!-- <div class="modal-dialog modal-dialog-centered modal-lg" role="document"> -->
<div class="modal-dialog modal-dialog-centered modal-xl" role="document">
<div class="modal-content">
<div class="modal-header">
{{-- <h5 class="modal-title" id="ModalTitle">Rekod Tebus</h5> --}}
@@ -41,8 +47,11 @@
<thead class="thead-dark">
<tr>
<th>Bil</th>
<th>Norujukan</th>
<th>Tarikh Bayaran</th>
<th>Bayaran</th>
<th>Pembiayaan</th>
<th>Keuntungan</th>
<th>Jumlah Bayaran</th>
<th>Jenis Bayaran</th>
<th>Tindakan</th>
</tr>
@@ -74,7 +83,9 @@
<th>Bil</th>
<th>No Rujukan</th>
<th>Jenis Penyelesaian<br>Pembiayaan</th>
<th>Pembiayaan Asal</th>
<th>Bayaran Pembiayaan</th>
<th>Keuntungan</th>
<th>Jumlah Penyelesaian<br>Pembiayaan</th>
<th>JBG</th>
<th>Tarikh Penyelesaian<br>Pembiayaan</th>
<th>Tindakan</th>