tebus
This commit is contained in:
@@ -205,43 +205,6 @@ class GadaiController extends Controller
|
||||
return response()->json($update_gadai, 200);
|
||||
}
|
||||
|
||||
public function showTebusToday($kodcaw,$norujukan){
|
||||
$cawangan = Cawangan::on('mysql7')
|
||||
->where('kodcaw','=',$kodcaw)
|
||||
->first();
|
||||
|
||||
$gadai_data = Gadai::on($cawangan['mysql'])
|
||||
->where('norujukan','=',$norujukan)
|
||||
->first();
|
||||
|
||||
$upahsemasa = $gadai_data['jbg'] * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
||||
|
||||
$transaction = Transaction::on('mysql7')
|
||||
->where('norujukan','=',$norujukan)
|
||||
->get();
|
||||
|
||||
$transaction_keuntungan = TransaksiKeuntungan::on('mysql7')
|
||||
->where('norujukan','=',$norujukan)
|
||||
->get();
|
||||
|
||||
$totalBayaranKeuntungan = 0;
|
||||
$totalBayaran = 0;
|
||||
|
||||
foreach($transaction as $index=>$trans){
|
||||
$totalBayaran += $trans['duit_masuk'];
|
||||
}
|
||||
|
||||
foreach($transaction_keuntungan as $index=>$untung){
|
||||
$totalBayaranKeuntungan += $untung['bayaran_keuntungan'];
|
||||
}
|
||||
|
||||
$rebet = $gadai_data['upah12'] - $totalBayaranKeuntungan - $upahsemasa;
|
||||
|
||||
$harga_tebus = $gadai_data['bakihargajualan'] - $rebet;
|
||||
|
||||
return response()->json($harga_tebus);
|
||||
}
|
||||
|
||||
public function getGadaianSemasa($kodcaw){
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user