new calculation upah

This commit is contained in:
afiq
2021-02-25 05:23:18 +08:00
parent 4a6fb03882
commit 6ab2203fea
6 changed files with 80 additions and 69 deletions
+13 -14
View File
@@ -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);
}