fix dashboard and penebusan laporan
This commit is contained in:
@@ -49,15 +49,20 @@
|
||||
<th>Bayaran (RM)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot class="thead-dark">
|
||||
<th colspan="5">TOTAL</th>
|
||||
<th id="pinjamantotal"></th>
|
||||
<th id="keuntungantotal"></th>
|
||||
<th id="bayarantotal"></th>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
{{-- <div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
Bilangan Surat : <span id="bilangan_surat">3</span>
|
||||
Jumlah Pinjaman : <span id="jumlah_pinjaman">RM 3,000.00</span>
|
||||
<h5> Jumlah Pinjaman : <span id="jumlah_pinjaman"></span></h5>
|
||||
</div>
|
||||
</div>
|
||||
</div> --}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -68,7 +73,7 @@
|
||||
var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";
|
||||
|
||||
var tabletebus = $('#myTable').DataTable({
|
||||
"ordering": false
|
||||
"ordering": true
|
||||
});
|
||||
$(document).ready( function () {
|
||||
$('#datetimepicker1').datepicker({
|
||||
@@ -99,41 +104,59 @@
|
||||
tebustable(tebus);
|
||||
}
|
||||
});
|
||||
$('#pinjamantotal').text('0.00');
|
||||
$('#keuntungantotal').text('0.00');
|
||||
$('#bayarantotal').text('0.00');
|
||||
|
||||
});
|
||||
async function tebustable(data){
|
||||
|
||||
|
||||
const formatter = new Intl.NumberFormat('en-US', {
|
||||
minimumFractionDigits: 2
|
||||
});
|
||||
|
||||
function tebustable(data){
|
||||
var counter = 1;
|
||||
var total_pinjaman = 0;
|
||||
var total_keuntungan = 0;
|
||||
var total_bayaran = 0;
|
||||
|
||||
tabletebus.clear().draw();
|
||||
$.each(data,function(index,tebus){
|
||||
$.ajax({
|
||||
url:api_url + '/api/gadai/norujukan/' + tebus['norujukan'],
|
||||
method:'get',
|
||||
async:false,
|
||||
success:function(gadai){
|
||||
$.ajax({
|
||||
url:api_url + '/api/customers/' + gadai[0][0]['nokp'],
|
||||
method:'get',
|
||||
success: function(customer){
|
||||
total_pinjaman += parseFloat(tebus['bakipjm']);
|
||||
console.log(total_pinjaman);
|
||||
success:function(customer){
|
||||
total_pinjaman += parseFloat(tebus['pinjaman']);
|
||||
total_keuntungan += parseFloat(tebus['bakiupah']);
|
||||
total_bayaran += parseFloat(tebus['bakipjm']);
|
||||
tabletebus.row.add([
|
||||
counter,
|
||||
customer[0]['nama'],
|
||||
gadai[0][0]['nokp'],
|
||||
tebus['norujukan'],
|
||||
tebus['t_tebus'],
|
||||
tebus['pinjaman'],
|
||||
tebus['bakiupah'],
|
||||
tebus['bakipjm']
|
||||
formatter.format(tebus['pinjaman']),
|
||||
formatter.format(tebus['bakiupah']),
|
||||
formatter.format(tebus['bakipjm'])
|
||||
]).draw();
|
||||
counter = counter + 1;
|
||||
$('#jumlah_pinjaman').text('RM '+ total_pinjaman);
|
||||
$('#pinjamantotal').text(formatter.format(total_pinjaman.toFixed(2)));
|
||||
$('#keuntungantotal').text(formatter.format(total_keuntungan.toFixed(2)));
|
||||
$('#bayarantotal').text(formatter.format(total_bayaran.toFixed(2)));
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
// console.log('Total Pinjam : ' + total_pinjaman);
|
||||
// $('#jumlah_pinjaman').text('RM '+ total_pinjaman);
|
||||
|
||||
}
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
Reference in New Issue
Block a user