mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-26 07:54:18 +00:00
fix daily cbm report
This commit is contained in:
@@ -38,6 +38,10 @@ class MonthlyReportController
|
||||
return (( (float) $package->width / 100) * ( (float) $package->length / 100) * ( (float) $package->height / 100)) * $package->quantity;
|
||||
});
|
||||
|
||||
$newCustomers = CompanyModule::where('type', BusinessType::IMPORTER)->whereBetween('created_at', [$from, $to])->count();
|
||||
$newConvertedCustomers = CompanyModule::where('type', BusinessType::IMPORTER)->whereBetween('created_at', [$from, $to])->whereHas('orders', function($order){
|
||||
return $order->whereHas('packingLists');
|
||||
})->count();
|
||||
|
||||
$startDay = $request->route('to') ? Carbon::parse($request->route('to')) : Carbon::now();
|
||||
$days = $startDay->addDay()->diffInDaysFiltered(function (Carbon $date) {
|
||||
@@ -52,10 +56,8 @@ class MonthlyReportController
|
||||
'containers' => count($containers),
|
||||
'activated_orders' => count($orders),
|
||||
'active_customers' => count($customers),
|
||||
'new_customers' => CompanyModule::where('type', BusinessType::IMPORTER)->whereBetween('created_at', [$from, $to])->count(),
|
||||
'new_converted_customers' => CompanyModule::where('type', BusinessType::IMPORTER)->whereBetween('created_at', [$from, $to])->whereHas('orders', function($order){
|
||||
return $order->whereHas('packingLists');
|
||||
})->count(),
|
||||
'new_customers' => $newCustomers,
|
||||
'new_converted_customers' => $newConvertedCustomers,
|
||||
'total_customers' => CompanyModule::where('type', BusinessType::IMPORTER)->count(),
|
||||
'total_cbm' => $totalCbm,
|
||||
'daily_cbm' => $days ? (800 - $totalCbm) / $days : (800 - $totalCbm),
|
||||
|
||||
Reference in New Issue
Block a user