diff --git a/app/Http/Controllers/Reports/BalanceSheetsController.php b/app/Http/Controllers/Reports/BalanceSheetsController.php new file mode 100644 index 0000000..9c0b1e7 --- /dev/null +++ b/app/Http/Controllers/Reports/BalanceSheetsController.php @@ -0,0 +1,22 @@ +where('kodcaw','=',$request->kodcaw)->first(); + + $list_imbangan = imbangdugabackup::on($cawangan['mysql']) + ->where([['tarikh','>=',$request->mula],['tarikh','<=',$request->hingga]]) + ->paginate(5); + + return json_encode($list_imbangan); + } +} diff --git a/app/Services/Reports/OnePercentService.php b/app/Services/Reports/OnePercentService.php index aeb93e3..bd63f56 100644 --- a/app/Services/Reports/OnePercentService.php +++ b/app/Services/Reports/OnePercentService.php @@ -469,7 +469,12 @@ class OnePercentService } private function filterCollection($collection,$type,$sumtype) : Float{ - return $collection->filter(function ($item) use($type) { + + $array_type = ['T','S','P','AT']; + return $collection->filter(function ($item) use($type,$array_type) { + if($type == 'T') + return in_array($type, $array_type); + return $item->trans_type === $type; })->sum($sumtype); } diff --git a/routes/report.php b/routes/report.php index 2903a97..14df879 100644 --- a/routes/report.php +++ b/routes/report.php @@ -25,5 +25,7 @@ $router->group(['prefix' => 'api/reports'], function () use ($router) { $router->get('getTotalCurrentProfit/{kod_cawangan}', ['uses' => 'OnePercentController@getCurrentProfit']); $router->get('stokaudit/get',['uses' => 'OnePercentController@getStokAuditBackdate']); + + $router->get('balancesheets/get',['uses' => 'BalanceSheetsController@getBalanceSheetsList']); }); });