mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
fix monthly report
This commit is contained in:
@@ -91,8 +91,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 = $packingList->packingLists()->where('type', PackingListType::SHIPPING_PACKING_LIST_REPLICA)->first();
|
||||
return $replica ? $replica : $packingList;
|
||||
})->flatMap(function ($packingList) {
|
||||
return $packingList->packages;
|
||||
});
|
||||
|
||||
$totalCbm = $packages->sum(function($package){
|
||||
|
||||
Reference in New Issue
Block a user