fix kadar rebet on teller page
This commit is contained in:
@@ -114,11 +114,10 @@
|
||||
<div class="col-4">
|
||||
<div class="form-group row">
|
||||
<div class="col-md-6">
|
||||
Kadar Rebet
|
||||
Pendapatan Sebulan
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control" readonly name="rebate" id="rebate">
|
||||
<input type="text" class="form-control" readonly name="kadar_rebate" id="kadar_rebate">
|
||||
<input type="text" class="form-control" readonly name="keuntungan_sebulan" id="keuntungan_sebulan">
|
||||
</div>
|
||||
</diV>
|
||||
</div>
|
||||
@@ -152,13 +151,13 @@
|
||||
<div class="col-4">
|
||||
<div class="form-group row">
|
||||
<div class="col-md-6">
|
||||
Pendapatan Sebulan
|
||||
Pendapatan 6 Bulan
|
||||
</div>
|
||||
<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 class="col-3">
|
||||
<div class="form-group row">
|
||||
<div class="col-md-6">
|
||||
@@ -180,18 +179,19 @@
|
||||
<span class="input-group-text span-pinjaman-max-pelulus"></span>
|
||||
</div>
|
||||
</div>
|
||||
</diV>
|
||||
</diV>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="form-group row">
|
||||
<div class="col-md-6">
|
||||
Pendapatan 6 Bulan
|
||||
Kadar Rebet
|
||||
</div>
|
||||
<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 class="col-12">
|
||||
<input type="text" name="norujukan_gadai" id="norujukan_gadai" value="{{ $norujukan }}" hidden>
|
||||
<input type="text" name="marhun_detail" id="marhun_detail" value="" hidden>
|
||||
@@ -641,16 +641,19 @@
|
||||
});
|
||||
}
|
||||
|
||||
$('#pinjaman').on('input', function () {
|
||||
var pinjaman = Number(this.value);
|
||||
var nilaimarhun = Number($('#jumlah_nilai_marhun').val());
|
||||
var nokp = $('#nokp').val();
|
||||
$('#pinjaman').on('input',function(){
|
||||
var pinjaman = Number(this.value);
|
||||
var nilaimarhun = Number($('#jumlah_nilai_marhun').val());
|
||||
var nokp = $('#nokp').val();
|
||||
//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({
|
||||
method:'POST',
|
||||
@@ -669,9 +672,9 @@
|
||||
}
|
||||
});
|
||||
|
||||
var keuntungan_sebulan = getRoundedMethod(array_keuntungan['keuntungan']);
|
||||
var keuntungan_6bln = getRoundedMethod(keuntungan_sebulan * 6);
|
||||
var ujrah = getRoundedMethod(array_keuntungan['ujrah']);
|
||||
var keuntungan_sebulan = getRoundedMethod(array_keuntungan['keuntungan']);
|
||||
var keuntungan_6bln = getRoundedMethod(keuntungan_sebulan * 6);
|
||||
var ujrah = getRoundedMethod(array_keuntungan['ujrah']);
|
||||
var onepercent = getRoundedMethod(array_keuntungan['onepercent']);
|
||||
|
||||
// **Rebate Calculation**
|
||||
@@ -693,17 +696,15 @@
|
||||
rebate = getRoundedMethod(rebate); // ✅ Round rebate before displaying
|
||||
|
||||
// **Display values**
|
||||
$('.span-pinjaman').text(formatter.format(percent_pinjaman.toFixed(2)) + ' %');
|
||||
$('#keuntungan_sebulan').val(formatter.format(keuntungan_sebulan.toFixed(2)));
|
||||
$('#keuntungan_6bln').val(formatter.format(keuntungan_6bln.toFixed(2)));
|
||||
$('#ujrah').val(formatter.format(ujrah.toFixed(2)));
|
||||
$('#onepercent').val(formatter.format(onepercent.toFixed(2)));
|
||||
$('#rebate').val(formatter.format(rebate.toFixed(2))); // Correctly displaying rebate
|
||||
$('#kadar_rebate').val(formatter.format(kadar_rebate.toFixed(2)) + ' %');
|
||||
}
|
||||
});
|
||||
});
|
||||
$('.span-pinjaman').text(formatter.format(percent_pinjaman.toFixed(2)) + ' %');
|
||||
$('#keuntungan_sebulan').val(formatter.format(keuntungan_sebulan.toFixed(2)));
|
||||
$('#keuntungan_6bln').val(formatter.format(keuntungan_6bln.toFixed(2)));
|
||||
$('#ujrah').val(formatter.format(getRoundedMethod(array_keuntungan['ujrah']).toFixed(2)));
|
||||
$('#onepercent').val(formatter.format(getRoundedMethod(array_keuntungan['onepercent']).toFixed(2)));
|
||||
$('#rebate').val(formatter.format(rebate.toFixed(2))); // Correctly displaying rebate
|
||||
$('#kadar_rebate').val(formatter.format(kadar_rebate.toFixed(2)) + ' %');
|
||||
|
||||
});
|
||||
|
||||
const formatter = new Intl.NumberFormat('en-US', {
|
||||
minimumFractionDigits: 2
|
||||
|
||||
Reference in New Issue
Block a user