fix active customer list

This commit is contained in:
omair saleh
2022-03-06 12:33:49 +08:00
parent 200a954730
commit b6834ac6f5
+3 -5
View File
@@ -223,17 +223,15 @@ Route::get('/customers/active/{active_start}/{active_end}/{inactive_start?}/{ina
$marking = $connection ? $connection->pivot->invitee_reference:'';
if($with_cbm){
$totalCbm = $company->orderPackingLists()->where('packing_lists.type', \App\Classes\ValueObjects\Constants\PackingListType::SHIPPING_PACKING_LIST)->get()->map(function ($packingList) {
$replica = $packingList->packingLists()->where('type', \App\Classes\ValueObjects\Constants\PackingListType::SHIPPING_PACKING_LIST_REPLICA)->first();
return $replica ? $replica : $packingList;
})->flatMap(function ($packingList) {
$packingList = $company->orderPackingLists()->where('packing_lists.type', \App\Classes\ValueObjects\Constants\PackingListType::SHIPPING_PACKING_LIST)->get();
$totalCbm = $packingList->flatMap(function ($packingList) {
return $packingList->packages;
})->sum(function($package){
return (( (float) $package->width / 100) * ( (float) $package->length / 100) * ( (float) $package->height / 100)) * $package->quantity;
});
}
$totalCbm = ($with_cbm ? '('. $totalCbm .')' : '');
$totalCbm = ($with_cbm ? '['. $packingList->count().'] ('. $totalCbm .')' : '');
echo $key + 1 .'. <a href="'.\route('customer.profile', $marking).'" target="_blank">'.$marking.'</a> '.$totalCbm.'<br><br>';
}