This commit is contained in:
e.arrahn
2021-07-08 12:22:25 +08:00
parent 8395fa0c77
commit efcff2e4a1
10 changed files with 113 additions and 20 deletions
+28 -11
View File
@@ -61,7 +61,13 @@ class TebusController extends Controller
$upahsemasa_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['pinjaman']);
$upah_semasa_round = number_format($upahsemasa_raw,2);
if(strpos($upah_semasa_round,',')){
$upah_semasa_round = str_replace(',','',$upah_semasa_round);
}
$upah_semasa = (float)substr($upah_semasa_round, 0, -1);
if(strpos($upah_semasa,',')){
$upah_semasa = str_replace(',','',$upah_semasa);
}
return $upah_semasa;
}
@@ -80,7 +86,13 @@ class TebusController extends Controller
$upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
$upah_rebet_round = number_format($upahrebet_raw,2);
if(strpos($upah_rebet_round,',')){
$upah_rebet_round = str_replace(',','',$upah_rebet_round);
}
$upah_rebet = (float)substr($upah_rebet_round, 0, -1);
if(strpos($upah_rebet,',')){
$upah_rebet = str_replace(',','',$upah_rebet);
}
return $upah_rebet;
}
@@ -494,15 +506,16 @@ class TebusController extends Controller
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
$tebus = Tebus::on($cawangan['mysql'])
->select('tebus.t_tebus', 'gad.t_gadai','Tebus.tagterima', 'tebus.teller','tebus.jenistebus','tebus.pinjaman','tebus.bakiupah','tebus.bakipjm','gad.norujukan','cust.nama','gad.nokp','tebus.jbg')
->join('Gadai as gad','gad.norujukan','=','Tebus.norujukan')
->join('Customer as cust', function($join)
->select('tebus.t_tebus', 'gad.t_gadai','tebus.tagterima', 'tebus.teller','tebus.jenistebus','tebus.pinjaman','tebus.bakiupah','tebus.bakipjm','gad.norujukan','cust.nama','gad.nokp','tebus.jbg')
->join('gadai as gad','gad.norujukan','=','tebus.norujukan')
->join('online_arrahn.customer as cust', function($join)
{
$join->on('gad.nokp', '=', 'cust.kpbaru');
$join->orOn('gad.nokp', '=', 'cust.kplama');
})
->where('Tebus.t_tebus','=',$tarikh)
->orderBy('Tebus.teller')
->where('tebus.t_tebus','=',$tarikh)
->orderBy('tebus.teller')
->orderBy('tebus.sirit')
->get();
return response()->json($tebus);
@@ -954,7 +967,9 @@ class TebusController extends Controller
$total = ($utgrugilama + $lelong + $upahsimpantebus + $upahsimpanlelong + $upahsimpanansur + $gstcajlelong) + $parameter;
if($kodcaw == '011229')
$total -= 45390.37;
return response()->json($total,200);
}
@@ -994,7 +1009,7 @@ class TebusController extends Controller
$keuntunganreducing = TransaksiKeuntungan::on('mysql7')
->join($cawangan['db_name'].'.gadai as db2','transaksi_keuntungan.norujukan','=','db2.norujukan')
->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'<', $request->tarikh)
->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'<', '2021-06-09')
->whereDate('transaksi_keuntungan.tarikh_bayaran','>=', $dateSM)
->whereYear('tarikh_bayaran','=',$current->year)
->whereNotNull('db2.hargajualan')
@@ -1008,8 +1023,9 @@ class TebusController extends Controller
$join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at');
})
->where('trans.trans_type','!=','A')
->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'=', $request->tarikh)
->whereDate('transaksi_keuntungan.tarikh_bayaran','>=', $dateSM)
->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'<=', $request->tarikh)
->whereDate('transaksi_keuntungan.tarikh_bayaran','>=', '2021-06-09')
//->whereDate('transaksi_keuntungan.tarikh_bayaran','>=', $dateSM)
->whereYear('tarikh_bayaran','=',$current->year)
->whereNotNull('db2.hargajualan')
->sum('keuntungan_rebet');
@@ -1022,8 +1038,9 @@ class TebusController extends Controller
$join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at');
})
->where('trans.trans_type','=','A')
->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'=', $request->tarikh)
->whereDate('transaksi_keuntungan.tarikh_bayaran','>=', $dateSM)
->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'<=', $request->tarikh)
->whereDate('transaksi_keuntungan.tarikh_bayaran','>=', '2021-06-09')
//->whereDate('transaksi_keuntungan.tarikh_bayaran','>=', $dateSM)
->whereYear('tarikh_bayaran','=',$current->year)
->whereNotNull('db2.hargajualan')
->sum('bayaran_keuntungan');