mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| acfd16a4b1 | |||
| c493b3786c |
@@ -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'),
|
||||
|
||||
@@ -49,12 +49,15 @@
|
||||
@php
|
||||
$addresses = $supplier->addresses()->where('type', 1)->first();
|
||||
@endphp
|
||||
{{ $addresses->street_one }}
|
||||
{{ $addresses->street_two }} ,
|
||||
{{ $addresses->district()->first()->name }},
|
||||
{{ $addresses->postcode }}
|
||||
{{ $addresses->state()->first()->name }},
|
||||
{{ $addresses->country()->first()->name }}
|
||||
|
||||
@if($addresses)
|
||||
{{ $addresses->street_one }}
|
||||
{{ $addresses->street_two }} ,
|
||||
{{ $addresses->district()->first()->name }},
|
||||
{{ $addresses->postcode }}
|
||||
{{ $addresses->state()->first()->name }},
|
||||
{{ $addresses->country()->first()->name }}
|
||||
@endif
|
||||
</div>
|
||||
<div>
|
||||
@php
|
||||
|
||||
Reference in New Issue
Block a user