mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
container monthly report
This commit is contained in:
+10
-5
@@ -132,15 +132,20 @@ Route::group(['prefix' => 'template', 'as' => 'template.'], function () {
|
||||
Route::get('/report', function(){
|
||||
$containers = Container::whereMonth('loading_date', '=', '09')->whereYear('loading_date', '=', '2021')->get();
|
||||
|
||||
dd(count($containers));
|
||||
$totalCbm = $containers->sum(function($container){
|
||||
return $container->packingLists->sum(function($packing_list){
|
||||
$total = 0;
|
||||
|
||||
foreach ($containers as $container){
|
||||
$cbm = $container->packingLists->sum(function($packing_list){
|
||||
return $packing_list->packages->sum(function ($package){
|
||||
return (( (float) $package->width / 100) * ( (float) $package->length / 100) * ( (float) $package->height / 100));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
echo 'total cbm: '. $totalCbm;
|
||||
$total += $cbm;
|
||||
|
||||
echo $container->reference.': '.$cbm;
|
||||
}
|
||||
|
||||
echo 'total cbm: '. $total;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user