diff --git a/app/Http/Controllers/LelongController.php b/app/Http/Controllers/LelongController.php index 87b4853..8035f8c 100644 --- a/app/Http/Controllers/LelongController.php +++ b/app/Http/Controllers/LelongController.php @@ -171,7 +171,7 @@ class LelongController extends Controller ->where('t_jual','<=',$request->tarikh) ->where(function($query) use ($tarikhbaru){ $query->whereNull('trkhtuntut') - ->orWhere('trkhtuntut','>','2021-02-25'); + ->orWhere('trkhtuntut','>',$tarikhbaru); }) ->where('baki','>=',0) ->sum('baki'); @@ -236,57 +236,19 @@ class LelongController extends Controller $tarikhbaru = $request->mula; $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); - if($kodcaw == 'KB2') - { - if($request->tarikh <= '2021-02-25') - { - $bakilelong = Lelong::on($cawangan['mysql']) - ->where('t_jual','>=',$request->mula) - ->where('t_jual','<=',$request->hingga) - ->where(function($query) use ($tarikhbaru){ - $query->whereNull('trkhtuntut') - ->orWhere('trkhtuntut','>',$tarikhbaru); - }) - ->where('baki','>=',0) - ->sum('baki'); - }else{ - $bakilelong = Lelong::on($cawangan['mysql']) - ->where('t_jual','>=',$request->mula) - ->where('t_jual','<=',$request->hingga) - ->where(function($query) use ($tarikhbaru){ - $query->whereNull('trkhtuntut') - ->orWhere('trkhtuntut','>','2021-02-25'); - }) - ->where('baki','>=',0) - ->sum('baki'); - } - }else{ - $bakilelong = Lelong::on($cawangan['mysql']) - ->where('trkhtuntut','>=',$request->mula) - ->where('trkhtuntut','<=',$request->hingga) - // ->where(function($query) use ($tarikhbaru){ - // $query->whereNull('trkhtuntut') - // ->orWhere('trkhtuntut','>',$tarikhbaru); - // }) - ->where('baki','>=',0) - ->sum('baki'); - } - - $ansrugi = AnsRugi::on($cawangan['mysql']) - ->sum('bayaran'); + + $bakilelong = Lelong::on($cawangan['mysql']) + ->where('trkhtuntut','>=',$request->mula) + ->where('trkhtuntut','<=',$request->hingga) + ->where('baki','>=',0) + ->sum('baki'); $rugilelong = Lelong::on($cawangan['mysql']) ->where('trkhtuntut','>=',$request->mula) ->where('trkhtuntut','<=',$request->hingga) - //->where(function($query) use ($tarikhbaru) - //{ - // $query->whereNull('t_jual') - // ->orWhere('t_jual','>',$tarikhbaru); - //}) ->where('baki','<',0) ->sum('baki'); - - // $rugitotal = $rugilelong + $ansrugi; + $rugitotal = $rugilelong; $arraylelong = ['bakilelong' => $bakilelong, 'rugilelong' => $rugitotal];