fix tanya upah

This commit is contained in:
Hafifie PKB
2024-02-03 23:29:44 +08:00
parent 363402dcf0
commit bfc9dcf065
2 changed files with 44 additions and 8 deletions
+23 -8
View File
@@ -677,6 +677,8 @@ class Penebusan
}
public function kiraupahTawarruqByTarikh($kodcaw,$norujukan,$tarikh){
$onepercentservices = new Calculation();
$cawangan = Cawangan::on('mysql7')
->where('kodcaw','=',$kodcaw)
->first();
@@ -685,6 +687,10 @@ class Penebusan
->where('norujukan','=',$norujukan)
->first();
$transaction_keuntungan = TransaksiKeuntungan::on('mysql7')
->where('norujukan','=',$norujukan)
->sum('keuntungan_rebet');
$tempoh_func = $this->kiraanTarikhJBG($gadai_data['t_gadai'],$tarikh);
if($tempoh_func >= 12.0){
@@ -696,19 +702,28 @@ class Penebusan
$upahsemasa_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['pinjaman']);
$upah_semasa_round = number_format($upahsemasa_raw,2);
if(strpos($upah_semasa_round,',')){
$upah_semasa_round = str_replace(',','',$upah_semasa_round);
}
$upah_semasa = substr($upah_semasa_round, 0, -1);
if(strpos($upah_semasa,',')){
$upah_semasa = str_replace(',','',$upah_semasa);
}
// $upah_semasa_round = number_format($upahsemasa_raw,2);
// if(strpos($upah_semasa_round,',')){
// $upah_semasa_round = str_replace(',','',$upah_semasa_round);
// }
// $upah_semasa = substr($upah_semasa_round, 0, -1);
// if(strpos($upah_semasa,',')){
// $upah_semasa = str_replace(',','',$upah_semasa);
// }
$upah_semasa = $onepercentservices->getRoundedMethod($upahsemasa_raw);
$upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
$upah_rebet = $onepercentservices->getRoundedMethod($upahrebet_raw);
$rebet_raw =$gadai_data['upah12'] - $transaction_keuntungan - $upah_rebet;
$harga_tebus = $gadai_data['bakihargajualan'] - $rebet_raw;
$array_return = [
'upahsemasa' => $upah_semasa,
'tempoh' => $tempoh,
'harga_tebus' => $harga_tebus,
];
return $array_return;