From 5326fafcca1013c6c3febb367796e8fb9b8cd785 Mon Sep 17 00:00:00 2001 From: Nur Izzati Zulkifli Date: Sun, 3 Dec 2023 17:10:21 +0800 Subject: [PATCH] edit group id getKadarUjrah --- app/Http/Controllers/GadaiController.php | 8 ++++---- app/Services/OnePercentServices.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index d4cdac4..25884de 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -249,9 +249,9 @@ class GadaiController extends Controller $total_berat = Marhun::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->sum('berat'); //query kadar upah baru - $kadar_raw = KadarUpah::where('min','<=',$total_nilai_marhun)->where('max','>=',$total_nilai_marhun)->where('group_id',$cawagan['group_id'])->first(); + $kadar_raw = KadarUpah::where('min','<=',$total_nilai_marhun)->where('max','>=',$total_nilai_marhun)->where('group_id',$cawangan['group_id'])->first(); - dd($kadar_raw); + // dd($kadar_raw); // query kadar upah lama // $kadar_raw = KadarUpah::where('min','<=',$total_nilai_marhun)->where('max','>=',$total_nilai_marhun)->first(); @@ -3867,10 +3867,10 @@ class GadaiController extends Controller } public function getKadarUjrah(Request $request){ - + $cawangan = Cawangan::on('mysql7')->where('kodcaw',$request->kodcaw)->first(); $onePercentServices = new OnePercentServices(); - $kadarujrah = $onePercentServices->getKadarUjrah($request->nilaimarhun); + $kadarujrah = $onePercentServices->getKadarUjrah($request->nilaimarhun,$cawangan['group_id']); // $test = $this->kiraupahTawarruq('KB2','KB2231109-0001'); // dd($test); diff --git a/app/Services/OnePercentServices.php b/app/Services/OnePercentServices.php index 9c4c165..afce9d0 100644 --- a/app/Services/OnePercentServices.php +++ b/app/Services/OnePercentServices.php @@ -72,9 +72,9 @@ class OnePercentServices return ['keuntungan' => $keuntungan,'onepercent' => $onepercent, 'ujrah' => $ujrah_sebenar]; } - public function getKadarUjrah(float $nilaimarhun = 0.0) : Float{ + public function getKadarUjrah(float $nilaimarhun = 0.0, $groupid) : Float{ - $kadarujrah = KadarUpah::on('mysql7')->select('kadarujrah')->where([['min','<=',$nilaimarhun],['max','>=',$nilaimarhun]])->where('group_id',$cawagan['group_id'])->get()->toArray(); + $kadarujrah = KadarUpah::on('mysql7')->select('kadarujrah')->where([['min','<=',$nilaimarhun],['max','>=',$nilaimarhun]])->where('group_id',$groupid)->get()->toArray(); return isset($kadarujrah[0]) ? $kadarujrah[0]['kadarujrah'] : 0; }