mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-24 15:05:09 +00:00
fix monthly report
This commit is contained in:
@@ -38,10 +38,15 @@ class MonthlyReportController
|
||||
return $container->orders;
|
||||
})->unique();
|
||||
|
||||
$packages = $containers->flatMap(function ($container) {
|
||||
return $container->packages()->where('packingList', function($query){
|
||||
return $query->type === PackingListType::SHIPPING_PACKING_LIST_REPLICA;
|
||||
});
|
||||
$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