mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 20:44:19 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| acfd16a4b1 |
@@ -45,14 +45,14 @@ class ExportsArrivedParcel implements WithHeadings, WithHeadingRow, WithMapping,
|
||||
public function query()
|
||||
{
|
||||
$query = PackingList::with([
|
||||
'owner.companyModule.inviters',
|
||||
'owner.orderRoles',
|
||||
// 'owner.companyModule.inviters',
|
||||
// 'owner.orderRoles',
|
||||
'packages',
|
||||
'transports'
|
||||
])
|
||||
->where('type', '=', 1)
|
||||
->where('status', '=', 2)
|
||||
->where('owner_type', Order::class);
|
||||
->where('type', '=', 1);
|
||||
// ->where('status', '=', 2)
|
||||
// ->where('owner_type', Order::class);
|
||||
|
||||
if (!is_null($this->start_date) && !is_null($this->end_date)) {
|
||||
$query->whereHas('transports', function ($q) {
|
||||
@@ -68,9 +68,14 @@ class ExportsArrivedParcel implements WithHeadings, WithHeadingRow, WithMapping,
|
||||
|
||||
public function map($packingList): array
|
||||
{
|
||||
$order = $packingList->owner;
|
||||
$marking = $order->companyModule->getMarking();
|
||||
$warehouse = $order->orderRoles->firstWhere('role_id', '=', OrderRoleTypes::ORIGIN_WAREHOUSE)->appointee;
|
||||
$order = null;
|
||||
$marking = null;
|
||||
$warehouse = null;
|
||||
if ($packingList->owner instanceof Order) {
|
||||
$order = $packingList->owner;
|
||||
$marking = $order->companyModule->getMarking();
|
||||
$warehouse = $order->orderRoles->firstWhere('role_id', '=', OrderRoleTypes::ORIGIN_WAREHOUSE)->appointee;
|
||||
}
|
||||
$cbm = $packingList->packages->sum(function ($package) {
|
||||
return (($package->width / 100) * ($package->height / 100) * ($package->length / 100)) * $package->quantity;
|
||||
});
|
||||
@@ -79,9 +84,9 @@ class ExportsArrivedParcel implements WithHeadings, WithHeadingRow, WithMapping,
|
||||
$days_to_record = Carbon::parse($arrival_date)->diffInDays(Carbon::parse($recorded_on));
|
||||
|
||||
return [
|
||||
$packingList->owner->reference,
|
||||
$marking,
|
||||
$warehouse->reference,
|
||||
$order ? $order->reference : 'Unclaimed',
|
||||
$marking ? $marking : 'Unclaimed',
|
||||
$warehouse ? $warehouse->reference : 'Unclaimed',
|
||||
$cbm,
|
||||
$packingList->packages->implode('description', ', '),
|
||||
$packingList->packages->sum('quantity'),
|
||||
|
||||
Reference in New Issue
Block a user