fix export arrival list

This commit is contained in:
omair saleh
2022-05-10 19:24:02 +08:00
parent 3100d42bd7
commit 9e060bccd3
@@ -44,7 +44,7 @@ class ExportsArrivedParcel implements WithHeadings, WithHeadingRow, WithMapping,
$packingLists = PackingList::where('type', '=', 1)->where('status', '=', 2)->where('owner_type', '!=', CompanyModule::class)->whereHas('transports', function ($query){
return $query->whereMonth('drop_date', '>', 3)->whereYear('drop_date', 2022);
})->get();
dd($packingLists);
foreach($packingLists as $packingList){
$packages = !$packingList->packingLists()->exists() ? $packingList->packages : $packingList->packingLists->first()->packages;
foreach ($packages as $package) {
@@ -63,9 +63,9 @@ dd($packingLists);
{
$packingList = $package->packingList;
$order = $packingList->owner;
// $connection = $order->companyModule()->first()->inviters()->withPivot('invitee_reference')->first();
// $marking = $connection ? $connection->pivot->invitee_reference:'';
dump($order);
$connection = $order->companyModule()->first()->inviters()->withPivot('invitee_reference')->first();
$marking = $connection ? $connection->pivot->invitee_reference:'';
$warehouse = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->appointee;
@@ -75,7 +75,7 @@ dd($packingLists);
return [
$packingList->owner->reference,
// $marking,
$marking,
$warehouse->reference,
$cbm,
$package->description,