fix kadar rebet on teller page

This commit is contained in:
nurafrinaalimi16
2026-09-02 11:32:19 +08:00
parent ac519f7a5f
commit f895ddb404
+31 -30
View File
@@ -114,11 +114,10 @@
<div class="col-4"> <div class="col-4">
<div class="form-group row"> <div class="form-group row">
<div class="col-md-6"> <div class="col-md-6">
Kadar Rebet Pendapatan Sebulan
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<input type="text" class="form-control" readonly name="rebate" id="rebate"> <input type="text" class="form-control" readonly name="keuntungan_sebulan" id="keuntungan_sebulan">
<input type="text" class="form-control" readonly name="kadar_rebate" id="kadar_rebate">
</div> </div>
</diV> </diV>
</div> </div>
@@ -152,13 +151,13 @@
<div class="col-4"> <div class="col-4">
<div class="form-group row"> <div class="form-group row">
<div class="col-md-6"> <div class="col-md-6">
Pendapatan Sebulan Pendapatan 6 Bulan
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<input type="text" class="form-control" readonly name="keuntungan_sebulan" id="keuntungan_sebulan"> <input type="text" class="form-control" readonly name="keuntungan_6bln" id="keuntungan_6bln">
</div> </div>
</diV> </diV>
</div> </div>
<div class="col-3"> <div class="col-3">
<div class="form-group row"> <div class="form-group row">
<div class="col-md-6"> <div class="col-md-6">
@@ -180,18 +179,19 @@
<span class="input-group-text span-pinjaman-max-pelulus"></span> <span class="input-group-text span-pinjaman-max-pelulus"></span>
</div> </div>
</div> </div>
</diV> </diV>
</div> </div>
<div class="col-4"> <div class="col-4">
<div class="form-group row"> <div class="form-group row">
<div class="col-md-6"> <div class="col-md-6">
Pendapatan 6 Bulan Kadar Rebet
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<input type="text" class="form-control" readonly name="keuntungan_6bln" id="keuntungan_6bln"> <input type="text" class="form-control" readonly name="rebate" id="rebate">
<input type="text" class="form-control" readonly name="kadar_rebate" id="kadar_rebate">
</div> </div>
</diV> </div>
</div> </div>
<div class="col-12"> <div class="col-12">
<input type="text" name="norujukan_gadai" id="norujukan_gadai" value="{{ $norujukan }}" hidden> <input type="text" name="norujukan_gadai" id="norujukan_gadai" value="{{ $norujukan }}" hidden>
<input type="text" name="marhun_detail" id="marhun_detail" value="" hidden> <input type="text" name="marhun_detail" id="marhun_detail" value="" hidden>
@@ -641,16 +641,19 @@
}); });
} }
$('#pinjaman').on('input', function () { $('#pinjaman').on('input',function(){
var pinjaman = Number(this.value); var pinjaman = Number(this.value);
var nilaimarhun = Number($('#jumlah_nilai_marhun').val()); var nilaimarhun = Number($('#jumlah_nilai_marhun').val());
var nokp = $('#nokp').val(); var nokp = $('#nokp').val();
//console.log('DEBUG NOKP:', nokp, kadarupah); //console.log('DEBUG NOKP:', nokp, kadarupah);
var percent_pinjaman = (pinjaman / total_nilai_marhun) * 100; // var keuntungan_sebulan = pinjaman * kadarupah;
// var keuntungan_6bln = keuntungan_sebulan * 6;
let array_keuntungan = {}; // Initialize as an object percent_pinjaman = (Number(pinjaman)/Number(total_nilai_marhun))*100;
let array_keuntungan = [];
$.ajax({ $.ajax({
method:'POST', method:'POST',
@@ -669,9 +672,9 @@
} }
}); });
var keuntungan_sebulan = getRoundedMethod(array_keuntungan['keuntungan']); var keuntungan_sebulan = getRoundedMethod(array_keuntungan['keuntungan']);
var keuntungan_6bln = getRoundedMethod(keuntungan_sebulan * 6); var keuntungan_6bln = getRoundedMethod(keuntungan_sebulan * 6);
var ujrah = getRoundedMethod(array_keuntungan['ujrah']); var ujrah = getRoundedMethod(array_keuntungan['ujrah']);
var onepercent = getRoundedMethod(array_keuntungan['onepercent']); var onepercent = getRoundedMethod(array_keuntungan['onepercent']);
// **Rebate Calculation** // **Rebate Calculation**
@@ -693,17 +696,15 @@
rebate = getRoundedMethod(rebate); // ✅ Round rebate before displaying rebate = getRoundedMethod(rebate); // ✅ Round rebate before displaying
// **Display values** // **Display values**
$('.span-pinjaman').text(formatter.format(percent_pinjaman.toFixed(2)) + ' %'); $('.span-pinjaman').text(formatter.format(percent_pinjaman.toFixed(2)) + ' %');
$('#keuntungan_sebulan').val(formatter.format(keuntungan_sebulan.toFixed(2))); $('#keuntungan_sebulan').val(formatter.format(keuntungan_sebulan.toFixed(2)));
$('#keuntungan_6bln').val(formatter.format(keuntungan_6bln.toFixed(2))); $('#keuntungan_6bln').val(formatter.format(keuntungan_6bln.toFixed(2)));
$('#ujrah').val(formatter.format(ujrah.toFixed(2))); $('#ujrah').val(formatter.format(getRoundedMethod(array_keuntungan['ujrah']).toFixed(2)));
$('#onepercent').val(formatter.format(onepercent.toFixed(2))); $('#onepercent').val(formatter.format(getRoundedMethod(array_keuntungan['onepercent']).toFixed(2)));
$('#rebate').val(formatter.format(rebate.toFixed(2))); // Correctly displaying rebate $('#rebate').val(formatter.format(rebate.toFixed(2))); // Correctly displaying rebate
$('#kadar_rebate').val(formatter.format(kadar_rebate.toFixed(2)) + ' %'); $('#kadar_rebate').val(formatter.format(kadar_rebate.toFixed(2)) + ' %');
}
});
});
});
const formatter = new Intl.NumberFormat('en-US', { const formatter = new Intl.NumberFormat('en-US', {
minimumFractionDigits: 2 minimumFractionDigits: 2