customer report

This commit is contained in:
omair saleh
2021-10-01 19:34:25 +08:00
parent bf7443887c
commit 7bde77036d
+4 -4
View File
@@ -133,7 +133,7 @@ Route::get('/report', function(){
$containers = Container::whereMonth('loading_date', '=', '09')->whereYear('loading_date', '=', '2021')->get();
$total = 0;
$customers = [];
$customers = collect();
foreach ($containers as $container){
foreach($container->packingLists as $packingList){
@@ -142,13 +142,13 @@ Route::get('/report', function(){
});
$total += $cbm;
if(!array_key_exists($packingList->owner->id, $customers)){
if(!$customers->has($packingList->owner->id)){
$marking = $packingList->owner->companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference;
$customers[$packingList->owner->id] = [
$customers->put($packingList->owner->id, collect([
'marking' => $marking,
'cbm' => $cbm,
'packages' => $packingList->packages->sum('quantity')
];
]));
continue;
}