tambah route onepercent dan ujrah untuk arrahnbid

This commit is contained in:
Nur Izzati Zulkifli
2023-12-11 17:09:11 +08:00
parent 88329b3298
commit 72bc3b10c3
2 changed files with 64 additions and 0 deletions
+61
View File
@@ -29,6 +29,7 @@ use App\Pembeli;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
use App\Services\RingkasanHarianServices;
use App\Services\OnePercentServices;
use Log;
use DB;
@@ -1607,6 +1608,66 @@ class LelongController extends Controller
}
public function kiraupahUjrahOnePercent($kodcaw,$norujukan){
$onepercentservices = new OnePercentServices();
$cawangan = Cawangan::on('mysql7')
->where('kodcaw','=',$kodcaw)
->first();
$gadai_data = Gadai::on($cawangan['mysql'])
->where('norujukan','=',$norujukan)
->first();
if($gadai_data['tempoh'] >= 12.0){
$tempoh = 12;
}else{
$tempoh = $gadai_data['tempoh'];
}
$bilang_bln = $tempoh - $gadai_data['tempohbayar'];
$array_upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['percentpinj']);
$ujrah = $bilang_bln * $array_upah['ujrah'];
$onepercent = $bilang_bln * $array_upah['onepercent'];
$onepercent_semasa = $onepercent;
$ujrah_semasa = $ujrah;
return ['ujrah' => $ujrah_semasa, 'onepercent' => $onepercent_semasa];
}
public function kiraupahUjrahOnePercentRebate($kodcaw,$norujukan){
$onepercentservices = new OnePercentServices();
$cawangan = Cawangan::on('mysql7')
->where('kodcaw','=',$kodcaw)
->first();
$gadai_data = Gadai::on($cawangan['mysql'])
->where('norujukan','=',$norujukan)
->first();
if($gadai_data['tempoh'] >= 12.0){
$tempoh = 12;
}else{
$tempoh = $gadai_data['tempoh'];
}
$bilang_bln = $tempoh - $gadai_data['tempohbayar'];
$array_upah = $onepercentservices->kiraanKeuntunganRebet($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']);
$ujrah = $bilang_bln * $array_upah['ujrah'];
$onepercent = $bilang_bln * $array_upah['onepercent'];
// $rounded_ujrah = round(($ujrah*100)/5,0)*5/100;
$ujrah_semasa = $ujrah;
// $rounded_onepercent = round(($onepercent*100)/5,0)*5/100;
$onepercent_semasa = $onepercent;
return ['ujrah' => $ujrah_semasa, 'onepercent' => $onepercent_semasa];
}