reducing method
This commit is contained in:
@@ -272,6 +272,25 @@ class GadaiController extends Controller
|
||||
return $upah_semasa;
|
||||
}
|
||||
|
||||
public function kiraUpahRebet($kodcaw,$norujukan){
|
||||
$cawangan = Cawangan::on('mysql7')
|
||||
->where('kodcaw','=',$kodcaw)
|
||||
->first();
|
||||
|
||||
$gadai_data = Gadai::on($cawangan['mysql'])
|
||||
->where('norujukan','=',$norujukan)
|
||||
->first();
|
||||
|
||||
$bilang_bln = $gadai_data['tempoh'] - $gadai_data['tempohbayar'];
|
||||
|
||||
$upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
||||
|
||||
$upah_rebet_round = number_format($upahrebet_raw,2);
|
||||
$upah_rebet = (float)substr($upah_rebet_round, 0, -1);
|
||||
|
||||
return $upah_rebet;
|
||||
}
|
||||
|
||||
public function updateGadaiMarhunOnline($kodcaw,$norujukan,Request $request){
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
@@ -280,6 +299,7 @@ class GadaiController extends Controller
|
||||
$gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first();
|
||||
|
||||
$upahsemasa = $this->kiraupahTawarruq($kodcaw,$norujukan);
|
||||
$upahrebet = $this->kiraUpahRebet($kodcaw,$norujukan);
|
||||
|
||||
$total_bayaran_prev = Transaction::on('mysql7')->where([['norujukan','=',$norujukan],['trans_type','=','A']])->sum('duit_masuk');
|
||||
|
||||
@@ -312,6 +332,7 @@ class GadaiController extends Controller
|
||||
'norujukan' => $norujukan,
|
||||
'bayaran_keuntungan' => $upahsemasa,
|
||||
'bayaran_pembiayaan' => $baki_bayaran,
|
||||
'keuntungan_rebet'=> $upahrebet,
|
||||
'tarikh_bayaran'=> $current,
|
||||
'kodcaw'=> $kodcaw
|
||||
]);
|
||||
@@ -333,6 +354,7 @@ class GadaiController extends Controller
|
||||
$gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first();
|
||||
|
||||
$upahsemasa = $this->kiraupahTawarruq($kodcaw,$norujukan);
|
||||
$upahrebet = $this->kiraUpahRebet($kodcaw,$norujukan);
|
||||
|
||||
$total_bayaran_prev = Transaction::on('mysql7')->where([['norujukan','=',$norujukan],['trans_type','=','A']])->sum('duit_masuk');
|
||||
|
||||
@@ -365,6 +387,7 @@ class GadaiController extends Controller
|
||||
'norujukan' => $norujukan,
|
||||
'bayaran_keuntungan' => $upahsemasa,
|
||||
'bayaran_pembiayaan' => $baki_bayaran,
|
||||
'keuntungan_rebet'=> $upahrebet,
|
||||
'tarikh_bayaran'=> $current,
|
||||
'kodcaw'=> $kodcaw
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user