tambah tagujrah,ujrah dan onepercent dlm arrahnbid
This commit is contained in:
@@ -232,7 +232,7 @@ class SimulasiUjrahController extends Controller
|
||||
'fasa' => $fasa,
|
||||
'kali' => $kali,
|
||||
'success_import' => 1,
|
||||
'ujrah' => 1
|
||||
'tagujrah' => 1
|
||||
]);
|
||||
|
||||
//create harga asas berdasarkan input harga asas
|
||||
@@ -264,7 +264,7 @@ class SimulasiUjrahController extends Controller
|
||||
$caw_simulasi->lokasi = $cawsimulasi['cawangan']->lokasi;
|
||||
$caw_simulasi->fasa = $request->fasa;
|
||||
$caw_simulasi->kali = $request->kali;
|
||||
$caw_simulasi->ujrah = 1;
|
||||
$caw_simulasi->tagujrah = 1;
|
||||
$caw_simulasi->save();
|
||||
|
||||
$suratcaw = $cawsimulasi['data'];
|
||||
@@ -296,7 +296,7 @@ class SimulasiUjrahController extends Controller
|
||||
$simulasi_to_be_inserted->status_payment = 0;
|
||||
$simulasi_to_be_inserted->mora_upah = 0;
|
||||
$simulasi_to_be_inserted->fasa = $request->fasa;
|
||||
$simulasi_to_be_inserted->ujrah = 1;
|
||||
$simulasi_to_be_inserted->tagujrah = 1;
|
||||
$simulasi_bid_arr[] = $simulasi_to_be_inserted->attributesToArray();
|
||||
}
|
||||
|
||||
@@ -360,7 +360,7 @@ class SimulasiUjrahController extends Controller
|
||||
}
|
||||
public function senaraisimulasi()
|
||||
{
|
||||
$simulasiAll = Simulasi::with('cawangan')->where('ujrah', 1)->orderBy('id', 'desc')->get();
|
||||
$simulasiAll = Simulasi::with('cawangan')->where('tagujrah', 1)->orderBy('id', 'desc')->get();
|
||||
|
||||
return view('simulasiujrah.senaraisimulasi',compact('simulasiAll'));
|
||||
}
|
||||
@@ -479,12 +479,16 @@ class SimulasiUjrahController extends Controller
|
||||
$total_untung_asal = TransaksiKeuntungan::on('main')->where('norujukan','=',$data['norujukan'])->sum('bayaran_keuntungan');
|
||||
$beza_keuntungan = $total_untung_asal - $total_untung_rebet;
|
||||
|
||||
$jbg = $data['tempoh']-$data['tempohbayar'];
|
||||
$jbg2 = 12- $data['tempohbayar'];
|
||||
if($data['tempoh'] <= '12.00'){
|
||||
$keuntungan = bcdiv(($jbg)*$data['kadarupah']/100*$data['bakipjm'],1,1)-$beza_keuntungan;
|
||||
if($data['tempoh'] == $data['tempohbayar']){
|
||||
$keuntungan = 0.00;
|
||||
}else{
|
||||
$keuntungan = bcdiv(($jbg2)*$data['kadarupah']/100*$data['bakipjm'],1,1)-$beza_keuntungan;
|
||||
//kiraan keuntungan ujrah
|
||||
$jeniskeuntungan = 'onepercent';
|
||||
$keuntungan = Http::get(config('app.api_url'). 'upahrebettawarruq/'.$data['kodcaw'].'/'.$data['norujukan'].'/'.$jeniskeuntungan)->json();
|
||||
$ujrahonepercentrebet = Http::get(config('app.api_url'). 'kiraupahUjrahOnePercentRebate/'.$data['kodcaw'].'/'.$data['norujukan'])->json();
|
||||
$rounded_keuntungan = round(($keuntungan*100)/5,0)*5/100;
|
||||
$rounded_ujrah = round(($ujrahonepercentrebet['ujrah']*100)/5,0)*5/100;
|
||||
$rounded_onepercent = round(($ujrahonepercentrebet['onepercent']*100)/5,0)*5/100;
|
||||
}
|
||||
// dd($keuntungan);
|
||||
//update dalam simulasibid
|
||||
@@ -493,7 +497,10 @@ class SimulasiUjrahController extends Controller
|
||||
->first();
|
||||
$updatetempoh->jbg = $data['tempoh'];
|
||||
$updatetempoh->pinjaman = $data['bakipjm'];
|
||||
$updatetempoh->bakiupah = bcdiv($keuntungan,1,1);
|
||||
// $updatetempoh->bakiupah = bcdiv($keuntungan,1,1);
|
||||
$updatetempoh->bakiupah = $rounded_keuntungan;
|
||||
$updatetempoh->ujrah = $rounded_ujrah;
|
||||
$updatetempoh->onepercent = $rounded_onepercent;
|
||||
$updatetempoh->update();
|
||||
|
||||
//insert loguser
|
||||
@@ -555,12 +562,16 @@ class SimulasiUjrahController extends Controller
|
||||
$total_untung_asal = TransaksiKeuntungan::on('main')->where('norujukan','=',$data['norujukan'])->sum('bayaran_keuntungan');
|
||||
$beza_keuntungan = $total_untung_asal - $total_untung_rebet;
|
||||
|
||||
$jbg = $data['tempoh']-$data['tempohbayar'];
|
||||
$jbg2 = 12- $data['tempohbayar'];
|
||||
if($data['tempoh'] <= '12.00'){
|
||||
$keuntungan = bcdiv(($jbg)*$data['kadarupah']/100*$data['bakipjm'],1,1)-$beza_keuntungan;
|
||||
if($data['tempoh'] == $data['tempohbayar']){
|
||||
$keuntungan = 0.00;
|
||||
}else{
|
||||
$keuntungan = bcdiv(($jbg2)*$data['kadarupah']/100*$data['bakipjm'],1,1)-$beza_keuntungan;
|
||||
//kiraan keuntungan ujrah
|
||||
$jeniskeuntungan = 'onepercent';
|
||||
$keuntungan = Http::get(config('app.api_url'). 'upahrebettawarruq/'.$data['kodcaw'].'/'.$data['norujukan'].'/'.$jeniskeuntungan)->json();
|
||||
$ujrahonepercentrebet = Http::get(config('app.api_url'). 'kiraupahUjrahOnePercentRebate/'.$data['kodcaw'].'/'.$data['norujukan'])->json();
|
||||
$rounded_keuntungan = round(($keuntungan*100)/5,0)*5/100;
|
||||
$rounded_ujrah = round(($ujrahonepercentrebet['ujrah']*100)/5,0)*5/100;
|
||||
$rounded_onepercent = round(($ujrahonepercentrebet['onepercent']*100)/5,0)*5/100;
|
||||
}
|
||||
// dd($keuntungan);
|
||||
//update dalam simulasibid
|
||||
@@ -569,7 +580,10 @@ class SimulasiUjrahController extends Controller
|
||||
->first();
|
||||
$updatetempoh->jbg = $data['tempoh'];
|
||||
$updatetempoh->pinjaman = $data['bakipjm'];
|
||||
$updatetempoh->bakiupah = bcdiv($keuntungan,1,1);
|
||||
// $updatetempoh->bakiupah = bcdiv($keuntungan,1,1);
|
||||
$updatetempoh->bakiupah = $rounded_keuntungan;
|
||||
$updatetempoh->ujrah = $rounded_ujrah;
|
||||
$updatetempoh->onepercent = $rounded_onepercent;
|
||||
$updatetempoh->update();
|
||||
|
||||
//insert loguser
|
||||
@@ -600,7 +614,7 @@ class SimulasiUjrahController extends Controller
|
||||
{
|
||||
$simulasi_id = $id;
|
||||
$simulasi = Simulasi::with(['cawangan', 'simulasiBid.simulasiBidMarhun', 'simkarat'])
|
||||
->where('ujrah',1)
|
||||
->where('tagujrah',1)
|
||||
->find($id);
|
||||
$data = $simulasi;
|
||||
$simkarat = $simulasi->simkarat;
|
||||
|
||||
Reference in New Issue
Block a user