mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-20 21:14:10 +00:00
fix monthly report
This commit is contained in:
@@ -144,8 +144,15 @@ class MonthlyReportController
|
||||
|
||||
$containers = Container::whereBetween('loading_date', [$from, $to])->orderBy('loading_date')->get();
|
||||
|
||||
$packages = $containers->flatMap(function ($container) {
|
||||
return $container->packages;
|
||||
$packingLists = $containers->flatMap(function ($container) {
|
||||
return $container->packingLists;
|
||||
});
|
||||
|
||||
$packages = $packingLists->map(function ($packingList) {
|
||||
$replica = in_array(Auth()->user()->type, [RoleTypes::SHADOW_ADMIN, RoleTypes::SUPER_ADMIN]) ? $packingList : $packingList->packingLists()->where('type', PackingListType::SHIPPING_PACKING_LIST_REPLICA)->first();
|
||||
return $replica ? $replica : $packingList;
|
||||
})->flatMap(function ($packingList) {
|
||||
return $packingList->packages;
|
||||
});
|
||||
|
||||
$packages = $packages->filter(function($package) use ($id) {
|
||||
|
||||
Reference in New Issue
Block a user