penebusan laporan

This commit is contained in:
MUHD HAFIFIE
2021-04-20 16:47:17 +08:00
parent 795c94d566
commit 4f2bd88c04
@@ -100,20 +100,23 @@
} }
}); });
}); });
async function tebustable(data){
function tebustable(data){
var counter = 1; var counter = 1;
var total_pinjaman = 0; var total_pinjaman = 0;
tabletebus.clear().draw(); tabletebus.clear().draw();
$.each(data,function(index,tebus){ $.each(data,function(index,tebus){
$.ajax({ $.ajax({
url:api_url + '/api/gadai/norujukan/' + tebus['norujukan'], url:api_url + '/api/gadai/norujukan/' + tebus['norujukan'],
method:'get', method:'get',
async:false,
success:function(gadai){ success:function(gadai){
$.ajax({ $.ajax({
url:api_url + '/api/customers/' + gadai[0][0]['nokp'], url:api_url + '/api/customers/' + gadai[0][0]['nokp'],
method:'get', method:'get',
success: function(customer){ success: function(customer){
total_pinjaman += parseFloat(tebus['bakipjm']);
console.log(total_pinjaman);
tabletebus.row.add([ tabletebus.row.add([
counter, counter,
customer[0]['nama'], customer[0]['nama'],
@@ -124,12 +127,13 @@
tebus['bakiupah'], tebus['bakiupah'],
tebus['bakipjm'] tebus['bakipjm']
]).draw(); ]).draw();
counter = counter + 1;
$('#jumlah_pinjaman').text('RM '+ total_pinjaman);
} }
}); });
} }
}); });
}); });
} }
</script> </script>
@endsection @endsection