new calculation upah
This commit is contained in:
@@ -265,27 +265,24 @@ class GadaiController extends Controller
|
||||
->first();
|
||||
|
||||
if($gadai_data['tempoh'] > 6){
|
||||
$upahsemasa_raw = $gadai_data['jbg'] * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
||||
|
||||
$upah_semasa_round = round($upahsemasa_raw,2);
|
||||
|
||||
$tempoh_sebenar = $gadai_data['tempoh'] - $gadai_data['tempohbayar'];
|
||||
$upahsemasa_raw = $tempoh_sebenar * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
||||
$upah_semasa_round = number_format($upahsemasa_raw,2);
|
||||
$upah_semasa = (float)substr($upah_semasa_round, 0, -1);
|
||||
}else{
|
||||
if($gadai_data['tempoh'] == 6){
|
||||
if($gadai_data['bakiupah'] != 0){
|
||||
$upah_semasa = $gadai_data['bakiupah'];
|
||||
}else{
|
||||
$upahsemasa_raw = $gadai_data['jbg'] * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
||||
|
||||
$upah_semasa_round = round($upahsemasa_raw,2);
|
||||
|
||||
$tempoh_sebenar = $gadai_data['tempoh'] - $gadai_data['tempohbayar'];
|
||||
$upahsemasa_raw = $tempoh_sebenar * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
||||
$upah_semasa_round = number_format($upahsemasa_raw,2);
|
||||
$upah_semasa = (float)substr($upah_semasa_round, 0, -1);
|
||||
}
|
||||
}else{
|
||||
$upahsemasa_raw = $gadai_data['jbg'] * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
||||
|
||||
$upah_semasa_round = round($upahsemasa_raw,2);
|
||||
|
||||
$tempoh_sebenar = $gadai_data['tempoh'] - $gadai_data['tempohbayar'];
|
||||
$upahsemasa_raw = $tempoh_sebenar * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
||||
$upah_semasa_round = number_format($upahsemasa_raw,2);
|
||||
$upah_semasa = (float)substr($upah_semasa_round, 0, -1);
|
||||
}
|
||||
}
|
||||
@@ -346,7 +343,8 @@ class GadaiController extends Controller
|
||||
'bakiupah' => $baki_upah,
|
||||
'jbg' => 0,
|
||||
't_update' => $current->toDateString(),
|
||||
'bakihargajualan' => $baki_hargajualan
|
||||
'bakihargajualan' => $baki_hargajualan,
|
||||
'tempohbayar' => $gadai['tempoh']
|
||||
));
|
||||
return response()->json($update_gadai, 200);
|
||||
}
|
||||
@@ -404,7 +402,8 @@ class GadaiController extends Controller
|
||||
'bakiupah' => $baki_upah,
|
||||
'jbg' => 0,
|
||||
't_update' => $current->toDateString(),
|
||||
'bakihargajualan' => $baki_hargajualan
|
||||
'bakihargajualan' => $baki_hargajualan,
|
||||
'tempohbayar' => $gadai['tempoh']
|
||||
));
|
||||
return response()->json($update_gadai, 200);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user