fix penebusan upah
This commit is contained in:
@@ -25,9 +25,9 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3">
|
||||
{{-- <div class="input-group mb-3">
|
||||
<input type="text" class="form-control col-3" placeholder="Pilih Tarikh" aria-label="Tarikh" id="dashboarddate" name="dashboarddate" aria-describedby="basic-addon1">
|
||||
</div>
|
||||
</div> --}}
|
||||
|
||||
<div class="row mt-4 col-12 d-flex justify-content-center">
|
||||
{{-- First Column --}}
|
||||
|
||||
@@ -21,21 +21,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-">
|
||||
<div class="col-md-5">
|
||||
<form action="{{ route('gadaian.laporancetak') }}" target="_blank" method="post">
|
||||
@csrf
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend ml-3">
|
||||
<span class="input-group-text" id="basic-addon1">Mula</span>
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text" id="basic-addon1">Tarikh</span>
|
||||
</div>
|
||||
<input type="text" class="form-control col-4" placeholder="Pilih Tarikh" aria-label="Tarikh" id="datemula" name="datemula" aria-describedby="basic-addon1">
|
||||
|
||||
<div class="input-group-prepend ml-2 ">
|
||||
<span class="input-group-text" id="basic-addon1">Hingga</span>
|
||||
</div>
|
||||
<input type="text" class="form-control col-4" placeholder="Pilih Tarikh" aria-label="Tarikh" id="datehingga" name="datehingga" aria-describedby="basic-addon1">
|
||||
|
||||
|
||||
<input type="text" class="form-control" placeholder="Pilih Tarikh" aria-label="Tarikh" id="datetarikh" name="datetarikh" aria-describedby="basic-addon1">
|
||||
<input type="submit" class="btn btn-primary ml-md-5" id="submit_button" name="submit_button" value="Cetak">
|
||||
</div>
|
||||
</form>
|
||||
@@ -85,10 +78,7 @@
|
||||
"ordering": false
|
||||
});
|
||||
$(document).ready( function () {
|
||||
$('#datemula').datepicker({
|
||||
format: 'dd-mm-yyyy'
|
||||
});
|
||||
$('#datehingga').datepicker({
|
||||
$('#datetarikh').datepicker({
|
||||
format: 'dd-mm-yyyy'
|
||||
});
|
||||
var current = new Date();
|
||||
@@ -98,81 +88,22 @@
|
||||
var today_date = current_year + '-' +current_month+'-'+current_date;
|
||||
$.ajax({
|
||||
method:'get',
|
||||
url: api_url + '/api/gadailaporanRange/'+kodcaw,
|
||||
data:{'mula' : today_date, 'akhir' : today_date },
|
||||
url: api_url + '/api/gadai/laporan/'+kodcaw+'/' + today_date,
|
||||
success: function(gadai){
|
||||
console.log(gadai);
|
||||
gadaitable(gadai);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#datemula').change(function(){
|
||||
//mula
|
||||
$('#datetarikh').change(function(){
|
||||
var input_date = this.value;
|
||||
var split_date = input_date.split('-');
|
||||
var mula_date = split_date[2] + '-' +split_date[1]+'-'+split_date[0];
|
||||
|
||||
var mula = mula_date;
|
||||
|
||||
//current time
|
||||
var hinggainput = $('#datehingga').val();
|
||||
|
||||
if(hinggainput != '')
|
||||
{
|
||||
var input_date = hinggainput;
|
||||
var split_date = input_date.split('-');
|
||||
var hingga_date = split_date[2] + '-' +split_date[1]+'-'+split_date[0];
|
||||
|
||||
var hingga = hingga_date;
|
||||
|
||||
}else{
|
||||
|
||||
var hingga = mula_date;
|
||||
}
|
||||
|
||||
var today_date = split_date[2] + '-' +split_date[1]+'-'+split_date[0];
|
||||
$.ajax({
|
||||
method:'get',
|
||||
url: api_url + '/api/gadailaporanRange/' + kodcaw,
|
||||
data:{'mula' : mula, 'akhir' : hingga },
|
||||
success: function(panjar){
|
||||
gadaitable(panjar);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#datehingga').change(function(){
|
||||
var input_date = this.value;
|
||||
var split_date = input_date.split('-');
|
||||
var hingga_date = split_date[2] + '-' +split_date[1]+'-'+split_date[0];
|
||||
|
||||
var hingga = hingga_date;
|
||||
|
||||
//current time
|
||||
var mulainput = $('#datemula').val();
|
||||
|
||||
if(mulainput != '')
|
||||
{
|
||||
var input_date = mulainput;
|
||||
var split_date = input_date.split('-');
|
||||
var mula_date = split_date[2] + '-' +split_date[1]+'-'+split_date[0];
|
||||
|
||||
var mula = mula_date;
|
||||
|
||||
}else{
|
||||
|
||||
|
||||
var dulu_date = hingga_date;
|
||||
|
||||
var mula = dulu_date;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
method:'get',
|
||||
url: api_url + '/api/gadailaporanRange/' + kodcaw,
|
||||
data:{'mula' : mula, 'akhir' : hingga },
|
||||
success: function(panjar){
|
||||
gadaitable(panjar);
|
||||
url: api_url + '/api/gadai/laporan/'+kodcaw+'/' + today_date,
|
||||
success: function(gadai){
|
||||
gadaitable(gadai);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -190,17 +121,13 @@
|
||||
|
||||
tablegadai.clear().draw();
|
||||
$.each(data,function(index,gadai){
|
||||
$.ajax({
|
||||
method:'get',
|
||||
url:api_url + '/api/customers/' + gadai['nokp'],
|
||||
success:function(customer){
|
||||
total_pinjaman += Number(gadai['pinjaman']);
|
||||
total_upah12 += Number(gadai['upah12']);
|
||||
total_nm += Number(gadai['nilaimarhun']);
|
||||
total_berat += Number(gadai['berat']);
|
||||
tablegadai.row.add([
|
||||
counter,
|
||||
customer['nama'],
|
||||
gadai['nama'],
|
||||
gadai['nokp'],
|
||||
gadai['norujukan'],
|
||||
formatter.format(gadai['pinjaman']),
|
||||
@@ -213,11 +140,8 @@
|
||||
$('#nmtotal').text(formatter.format(total_nm.toFixed(2)));
|
||||
$('#berattotal').text(formatter.format(total_berat.toFixed(2)));
|
||||
counter = counter + 1;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
|
||||
@@ -21,21 +21,15 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-">
|
||||
<div class="col-md-5">
|
||||
<form action="{{ route('tebus.laporancetak') }}" target="_blank" method="post">
|
||||
@csrf
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend ml-3">
|
||||
<span class="input-group-text" id="basic-addon1">Mula</span>
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text" id="basic-addon1">Tarikh</span>
|
||||
</div>
|
||||
<input type="text" class="form-control col-4" placeholder="Pilih Tarikh" aria-label="Tarikh" id="datemula" name="datemula" aria-describedby="basic-addon1">
|
||||
|
||||
<div class="input-group-prepend ml-2 ">
|
||||
<span class="input-group-text" id="basic-addon1">Hingga</span>
|
||||
</div>
|
||||
<input type="text" class="form-control col-4" placeholder="Pilih Tarikh" aria-label="Tarikh" id="datehingga" name="datehingga" aria-describedby="basic-addon1">
|
||||
|
||||
|
||||
<input type="text" class="form-control" placeholder="Pilih Tarikh" aria-label="Tarikh" id="datetarikh" name="datetarikh" aria-describedby="basic-addon1">
|
||||
|
||||
<input type="submit" class="btn btn-primary ml-md-5" id="submit_button" name="submit_button" value="Cetak">
|
||||
</div>
|
||||
</form>
|
||||
@@ -47,17 +41,16 @@
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th>Bil</th>
|
||||
<th>Nama</th>
|
||||
<th width="22%">Nama</th>
|
||||
<th>No K/P</th>
|
||||
<th>No Rujukan</th>
|
||||
<th>Tarikh Tebus</th>
|
||||
<th>Pembiayaan (RM)</th>
|
||||
<th>Keuntungan (RM)</th>
|
||||
<th>Bayaran (RM)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot class="thead-dark">
|
||||
<th colspan="5">TOTAL</th>
|
||||
<th colspan="4">TOTAL</th>
|
||||
<th id="pinjamantotal"></th>
|
||||
<th id="keuntungantotal"></th>
|
||||
<th id="bayarantotal"></th>
|
||||
@@ -83,115 +76,41 @@
|
||||
"ordering": true
|
||||
});
|
||||
$(document).ready( function () {
|
||||
$('#datemula').datepicker({
|
||||
format: 'dd-mm-yyyy'
|
||||
});
|
||||
$('#datehingga').datepicker({
|
||||
$('#datetarikh').datepicker({
|
||||
format: 'dd-mm-yyyy'
|
||||
});
|
||||
|
||||
var current = new Date();
|
||||
var current_date = current.getDate();
|
||||
var current_month = current.getMonth()+1;
|
||||
var current_year = current.getFullYear();
|
||||
var today_date = current_year + '-' +current_month+'-'+current_date;
|
||||
var today_date = current_year + '-' + current_month + '-' + current_date;
|
||||
$.ajax({
|
||||
method:'get',
|
||||
url: api_url + '/api/tebuslaporanRange/' + kodcaw,
|
||||
data:{'mula' : today_date, 'akhir' : today_date },
|
||||
url: api_url + '/api/tebus/laporan/' +kodcaw+ '/' + today_date,
|
||||
success: function(tebus){
|
||||
tebustable(tebus);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// $('#datetimepicker1').change(function(){
|
||||
// var input_date = this.value;
|
||||
// var split_date = input_date.split('-');
|
||||
// var today_date = split_date[2] + '-' +split_date[1]+'-'+split_date[0];
|
||||
// $.ajax({
|
||||
// method:'get',
|
||||
// url: api_url + '/api/tebus/laporan/'+kodcaw+'/' + today_date,
|
||||
// success: function(tebus){
|
||||
// tebustable(tebus);
|
||||
// }
|
||||
// });
|
||||
// $('#pinjamantotal').text('0.00');
|
||||
// $('#keuntungantotal').text('0.00');
|
||||
// $('#bayarantotal').text('0.00');
|
||||
|
||||
// });
|
||||
|
||||
$('#datemula').change(function(){
|
||||
//mula
|
||||
$('#datetarikh').change(function(){
|
||||
var input_date = this.value;
|
||||
var split_date = input_date.split('-');
|
||||
var mula_date = split_date[2] + '-' +split_date[1]+'-'+split_date[0];
|
||||
|
||||
var mula = mula_date;
|
||||
|
||||
//current time
|
||||
var hinggainput = $('#datehingga').val();
|
||||
|
||||
if(hinggainput != '')
|
||||
{
|
||||
var input_date = hinggainput;
|
||||
var split_date = input_date.split('-');
|
||||
var hingga_date = split_date[2] + '-' +split_date[1]+'-'+split_date[0];
|
||||
|
||||
var hingga = hingga_date;
|
||||
|
||||
}else{
|
||||
|
||||
var hingga = mula_date;
|
||||
}
|
||||
|
||||
var today_date = split_date[2] + '-' + split_date[1] + '-' + split_date[0];
|
||||
$.ajax({
|
||||
method:'get',
|
||||
url: api_url + '/api/tebuslaporanRange/' + kodcaw,
|
||||
data:{'mula' : mula, 'akhir' : hingga },
|
||||
success: function(panjar){
|
||||
tebustable(panjar);
|
||||
url: api_url + '/api/tebus/laporan/' + kodcaw + '/' + today_date,
|
||||
success: function(tebus){
|
||||
tebustable(tebus);
|
||||
}
|
||||
});
|
||||
$('#pinjamantotal').text('0.00');
|
||||
$('#keuntungantotal').text('0.00');
|
||||
$('#bayarantotal').text('0.00');
|
||||
|
||||
});
|
||||
|
||||
$('#datehingga').change(function(){
|
||||
var input_date = this.value;
|
||||
var split_date = input_date.split('-');
|
||||
var hingga_date = split_date[2] + '-' +split_date[1]+'-'+split_date[0];
|
||||
|
||||
var hingga = hingga_date;
|
||||
|
||||
//current time
|
||||
var mulainput = $('#datemula').val();
|
||||
|
||||
if(mulainput != '')
|
||||
{
|
||||
var input_date = mulainput;
|
||||
var split_date = input_date.split('-');
|
||||
var mula_date = split_date[2] + '-' +split_date[1]+'-'+split_date[0];
|
||||
|
||||
var mula = mula_date;
|
||||
|
||||
}else{
|
||||
|
||||
|
||||
var dulu_date = hingga_date;
|
||||
|
||||
var mula = dulu_date;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
method:'get',
|
||||
url: api_url + '/api/gadailaporanRange/' + kodcaw,
|
||||
data:{'mula' : mula, 'akhir' : hingga },
|
||||
success: function(panjar){
|
||||
tebustable(panjar);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
const formatter = new Intl.NumberFormat('en-US', {
|
||||
minimumFractionDigits: 2
|
||||
});
|
||||
@@ -201,40 +120,62 @@
|
||||
var total_pinjaman = 0;
|
||||
var total_keuntungan = 0;
|
||||
var total_bayaran = 0;
|
||||
|
||||
console.log(data);
|
||||
|
||||
tabletebus.clear().draw();
|
||||
$.each(data,function(index,tebus){
|
||||
$.ajax({
|
||||
url:api_url + '/api/gadai/norujukan/' + tebus['norujukan'],
|
||||
method:'get',
|
||||
success:function(gadai){
|
||||
$.ajax({
|
||||
url:api_url + '/api/customers/' + gadai[0][0]['nokp'],
|
||||
method:'get',
|
||||
success:function(customer){
|
||||
total_pinjaman += parseFloat(tebus['pinjaman']);
|
||||
total_keuntungan += parseFloat(tebus['bakiupah']);
|
||||
total_bayaran += parseFloat(tebus['bakipjm']);
|
||||
tabletebus.row.add([
|
||||
counter,
|
||||
customer['nama'],
|
||||
gadai[0][0]['nokp'],
|
||||
tebus['norujukan'],
|
||||
tebus['t_tebus'],
|
||||
formatter.format(tebus['pinjaman']),
|
||||
formatter.format(tebus['bakiupah']),
|
||||
formatter.format(tebus['bakipjm'])
|
||||
]).draw();
|
||||
counter = counter + 1;
|
||||
$('#pinjamantotal').text(formatter.format(total_pinjaman.toFixed(2)));
|
||||
$('#keuntungantotal').text(formatter.format(total_keuntungan.toFixed(2)));
|
||||
$('#bayarantotal').text(formatter.format(total_bayaran.toFixed(2)));
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
total_pinjaman += parseFloat(tebus['pinjaman']);
|
||||
total_keuntungan += parseFloat(tebus['bakiupah']);
|
||||
total_bayaran += parseFloat(tebus['bakipjm']);
|
||||
tabletebus.row.add([
|
||||
counter,
|
||||
tebus['nama'],
|
||||
tebus['nokp'],
|
||||
tebus['norujukan'],
|
||||
formatter.format(tebus['pinjaman']),
|
||||
formatter.format(tebus['bakiupah']),
|
||||
formatter.format(tebus['bakipjm'])
|
||||
]).draw();
|
||||
counter = counter + 1;
|
||||
$('#pinjamantotal').text(formatter.format(total_pinjaman.toFixed(2)));
|
||||
$('#keuntungantotal').text(formatter.format(total_keuntungan.toFixed(2)));
|
||||
$('#bayarantotal').text(formatter.format(total_bayaran.toFixed(2)));
|
||||
});
|
||||
|
||||
|
||||
// $.each(data,function(index,tebus){
|
||||
// $.ajax({
|
||||
// url:api_url + '/api/gadai/norujukan/' + tebus['norujukan'],
|
||||
// method:'get',
|
||||
// success:function(gadai){
|
||||
// $.ajax({
|
||||
// url:api_url + '/api/customers/' + gadai[0][0]['nokp'],
|
||||
// method:'get',
|
||||
// success:function(customer){
|
||||
// total_pinjaman += parseFloat(tebus['pinjaman']);
|
||||
// total_keuntungan += parseFloat(tebus['bakiupah']);
|
||||
// total_bayaran += parseFloat(tebus['bakipjm']);
|
||||
// tabletebus.row.add([
|
||||
// counter,
|
||||
// customer['nama'],
|
||||
// gadai[0][0]['nokp'],
|
||||
// tebus['norujukan'],
|
||||
// tebus['t_tebus'],
|
||||
// formatter.format(tebus['pinjaman']),
|
||||
// formatter.format(tebus['bakiupah']),
|
||||
// formatter.format(tebus['bakipjm'])
|
||||
// ]).draw();
|
||||
// counter = counter + 1;
|
||||
// $('#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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user