From ab5a94cbc08d932b193a2161d2695f084dd49506 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sat, 28 Jun 2025 10:16:48 +0800 Subject: [PATCH 01/25] E-Invoice - Debug Pending Payment at /payment-and-billing no data --- .../SingleAdminPaymentsBillingWithStorageComponent.vue | 2 +- .../sections/AdminPaymentsBillingSectionComponent.vue | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/assets/vue/components/paymentsBilling/elements/SingleAdminPaymentsBillingWithStorageComponent.vue b/resources/assets/vue/components/paymentsBilling/elements/SingleAdminPaymentsBillingWithStorageComponent.vue index f4a9fb53..840132a8 100644 --- a/resources/assets/vue/components/paymentsBilling/elements/SingleAdminPaymentsBillingWithStorageComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/elements/SingleAdminPaymentsBillingWithStorageComponent.vue @@ -16,7 +16,7 @@

Container

-
{{item.packages[0].container.container_reference}}
+
{{item.packages[0].container.container_reference}}
{{item.container.container_reference}}
diff --git a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue index 92d8ef4c..e579055c 100644 --- a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue @@ -113,7 +113,8 @@
- + +
From 8d75da288a9da009471261164a1acb48ba86693d Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sat, 28 Jun 2025 10:32:48 +0800 Subject: [PATCH 02/25] E-Invoice - Debug Pending Payment at /payment-and-billing no data --- .../sections/AdminPaymentsBillingSectionComponent.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue index e579055c..aec98d14 100644 --- a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue @@ -114,7 +114,7 @@
- +
From e047632de00584b6ccc3d1e961cf7fcda835cf29 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sat, 28 Jun 2025 10:45:55 +0800 Subject: [PATCH 03/25] E-Invoice - Debug Pending Payment at /payment-and-billing no data --- .../sections/AdminPaymentsBillingSectionComponent.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue index aec98d14..d29a3d2a 100644 --- a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue @@ -114,7 +114,7 @@
- +
From 878e69fdb0f4a00b584125fb4b6545af28cc15ab Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sat, 28 Jun 2025 11:00:34 +0800 Subject: [PATCH 04/25] E-Invoice - Debug Pending Payment at /payment-and-billing no data --- app/Http/Resources/PackingListBaseResource.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Resources/PackingListBaseResource.php b/app/Http/Resources/PackingListBaseResource.php index a29f174a..729f8663 100644 --- a/app/Http/Resources/PackingListBaseResource.php +++ b/app/Http/Resources/PackingListBaseResource.php @@ -36,9 +36,9 @@ class PackingListBaseResource extends JsonResource 'transport' => new TransportResource($this->transports()->first()), 'type' => $this->type, 'container' => new ContainerResource($this->containers->first()), - $this->mergeWhen($this->owner instanceof Order, [ - 'order' => New OrderResource($this->owner) - ]), + // $this->mergeWhen($this->owner instanceof Order, [ + // 'order' => New OrderResource($this->owner) + // ]), // 'suspended_invoices' => TransactionResource::collection($this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [ApprovalStatus::SUSPENDED])->get()), ]; From 8e6c70c67b7d686a6c4893a7d049f2a257bf8ce7 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sat, 28 Jun 2025 11:14:44 +0800 Subject: [PATCH 05/25] E-Invoice - Debug Pending Payment at /payment-and-billing no data --- app/Http/Resources/CompanyModuleResource.php | 4 ++-- app/Http/Resources/PackingListBaseResource.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Http/Resources/CompanyModuleResource.php b/app/Http/Resources/CompanyModuleResource.php index f48cbc43..2dd971d6 100644 --- a/app/Http/Resources/CompanyModuleResource.php +++ b/app/Http/Resources/CompanyModuleResource.php @@ -51,10 +51,10 @@ class CompanyModuleResource extends JsonResource 'connections' => $this->connections, 'contact' => new ContactResource ($this->when($this->has('contacts'), $this->contacts->first())), 'debtor' => $this->company->debtor, - 'e_invoice' => $this->company->e_invoice, + // 'e_invoice' => $this->company->e_invoice, 'tin' => $this->company->tin, 'msic_code' => $this->company->msic_code, - 'address_einvoice' => $this->company->e_invoice ? new AddressEInvoiceResource($this->when($this->has('addresses'), $this->addresses->where('type', AddressType::E_INVOICE)->sortByDesc('created_at')->first())) : null, + // 'address_einvoice' => $this->company->e_invoice ? new AddressEInvoiceResource($this->when($this->has('addresses'), $this->addresses->where('type', AddressType::E_INVOICE)->sortByDesc('created_at')->first())) : null, ]; } diff --git a/app/Http/Resources/PackingListBaseResource.php b/app/Http/Resources/PackingListBaseResource.php index 729f8663..a29f174a 100644 --- a/app/Http/Resources/PackingListBaseResource.php +++ b/app/Http/Resources/PackingListBaseResource.php @@ -36,9 +36,9 @@ class PackingListBaseResource extends JsonResource 'transport' => new TransportResource($this->transports()->first()), 'type' => $this->type, 'container' => new ContainerResource($this->containers->first()), - // $this->mergeWhen($this->owner instanceof Order, [ - // 'order' => New OrderResource($this->owner) - // ]), + $this->mergeWhen($this->owner instanceof Order, [ + 'order' => New OrderResource($this->owner) + ]), // 'suspended_invoices' => TransactionResource::collection($this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [ApprovalStatus::SUSPENDED])->get()), ]; From c046a533d84c8c6cc7aaaa7c85eddeb5db29a59a Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sat, 28 Jun 2025 11:35:02 +0800 Subject: [PATCH 06/25] E-Invoice - Debug Pending Payment at /payment-and-billing no data --- app/Http/Resources/PackingListBaseResource.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/Http/Resources/PackingListBaseResource.php b/app/Http/Resources/PackingListBaseResource.php index a29f174a..8c9868ad 100644 --- a/app/Http/Resources/PackingListBaseResource.php +++ b/app/Http/Resources/PackingListBaseResource.php @@ -9,6 +9,7 @@ use App\Classes\ValueObjects\Constants\RoleTypes; use App\Models\Order; use App\Models\PackingList; use Illuminate\Http\Resources\Json\JsonResource; +use Illuminate\Support\Facades\Log; class PackingListBaseResource extends JsonResource { @@ -26,6 +27,7 @@ class PackingListBaseResource extends JsonResource $packages = []; $receive_packing_list = null; + Log::info("Log 0"); //The Base $data = [ @@ -42,6 +44,7 @@ class PackingListBaseResource extends JsonResource // 'suspended_invoices' => TransactionResource::collection($this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [ApprovalStatus::SUSPENDED])->get()), ]; + Log::info("Log 1"); //option 1: include_packages if($this->include_packages){ @@ -62,7 +65,7 @@ class PackingListBaseResource extends JsonResource } } $data['packages'] = PackageBaseResource::collection($packages); - + Log::info("Log 2"); //option 2a: include_receive_packing_list if($this->include_receive_packing_list){ @@ -79,6 +82,7 @@ class PackingListBaseResource extends JsonResource $receive_packing_list = $this->when($this->type === PackingListType::SHIPPING_PACKING_LIST, new PackingListBaseResource($temp)); } + Log::info("Log 3"); //option 2b: include_base_only_in_receive_packing_list if($this->include_base_only_in_receive_packing_list){ @@ -96,19 +100,20 @@ class PackingListBaseResource extends JsonResource $receive_packing_list = $this->when($this->type === PackingListType::SHIPPING_PACKING_LIST, new PackingListBaseResource($temp)); } $data['receive_packing_list'] = $receive_packing_list; - + Log::info("Log 4"); //option 3: include_shipping_transaction WITHOUT warehouse storage if($this->include_shipping_transaction && !$this->storages){ $shippingTransaction = $this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->whereNotIn('status', [ApprovalStatus::SUSPENDED, ApprovalStatus::EXPIRED])->first(); $data['shipping_transaction'] = new TransactionResource($shippingTransaction); } - + Log::info("Log 5"); //option 4: include_suspended_invoice if($this->include_suspended_invoice){ $data['suspended_invoice'] = new TransactionResource($this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [ApprovalStatus::SUSPENDED])->first()); } + Log::info("Log 6"); //option 5: include_shipping_transaction WITH warehouse storage if($this->include_shipping_transaction && $this->storages){ @@ -127,6 +132,7 @@ class PackingListBaseResource extends JsonResource $data['storages'] = $storages; $data['invoices'] = TransactionWithStorageResource::collection($transactions); } + Log::info("Log 7"); return $data; } From 2bd96075cc18a020ba324d1eeee684bdfe76d3a1 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sat, 28 Jun 2025 12:14:20 +0800 Subject: [PATCH 07/25] E-Invoice - Debug Pending Payment at /payment-and-billing no data --- .../PackingLists/ControllersLogic/ListPackingListsLogic.php | 3 ++- app/Http/Resources/PackingListBaseResource.php | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php b/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php index 16ac1272..1f575dcb 100644 --- a/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php +++ b/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php @@ -97,10 +97,11 @@ class ListPackingListsLogic extends AbstractControllerLogic $useNew = true; } } - + Log::info("ListPackingListsLogic storages debug 1"); if($useNew){ return $this->collectionResponse(PackingListBaseResource::collection($query)); } + Log::info("ListPackingListsLogic storages debug 2"); //Fallback return $this->collectionResponse(PackingListResource::collection($query)); diff --git a/app/Http/Resources/PackingListBaseResource.php b/app/Http/Resources/PackingListBaseResource.php index 8c9868ad..911a1378 100644 --- a/app/Http/Resources/PackingListBaseResource.php +++ b/app/Http/Resources/PackingListBaseResource.php @@ -21,9 +21,9 @@ class PackingListBaseResource extends JsonResource */ public function toArray($request) { - // $exceptionUsers = in_array(Auth()->user()->type, [RoleTypes::SHADOW_ADMIN, RoleTypes::SUPER_ADMIN]); - $userType = Auth() && Auth()->user() ? Auth()->user()->type : RoleTypes::USER; - $exceptionUsers = in_array($userType, [RoleTypes::SHADOW_ADMIN, RoleTypes::SUPER_ADMIN]); + $exceptionUsers = in_array(Auth()->user()->type, [RoleTypes::SHADOW_ADMIN, RoleTypes::SUPER_ADMIN]); + // $userType = Auth() && Auth()->user() ? Auth()->user()->type : RoleTypes::USER; + // $exceptionUsers = in_array($userType, [RoleTypes::SHADOW_ADMIN, RoleTypes::SUPER_ADMIN]); $packages = []; $receive_packing_list = null; From 59fbdfa7890e597769427c8f5d41616933c64ef0 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sat, 28 Jun 2025 12:27:52 +0800 Subject: [PATCH 08/25] E-Invoice - Debug Pending Payment at /payment-and-billing no data --- .../PackingLists/ControllersLogic/ListPackingListsLogic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php b/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php index 1f575dcb..4711726f 100644 --- a/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php +++ b/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php @@ -52,7 +52,7 @@ class ListPackingListsLogic extends AbstractControllerLogic public function logic(Request $request) : JsonResponse { $this->canListPackingLists->passes(); - + Log::info("ListPackingListsLogic storages debug 0"); $query = $this->listsPackingLists->execute($this->listsPackingLists->deserializeFilters($request->input('filters'))); $data = json_encode($request->input('storages')); From bd8b212f6faef39b18942c3f0e428b6c30e443ba Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sat, 28 Jun 2025 12:49:18 +0800 Subject: [PATCH 09/25] E-Invoice - Debug Pending Payment at /payment-and-billing no data --- ...PackingListLimitOneByTypeOrderedByInvoiceDate.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Classes/General/Eloquent/Filters/PackingListLimitOneByTypeOrderedByInvoiceDate.php b/app/Classes/General/Eloquent/Filters/PackingListLimitOneByTypeOrderedByInvoiceDate.php index 1ebc952d..d0839721 100644 --- a/app/Classes/General/Eloquent/Filters/PackingListLimitOneByTypeOrderedByInvoiceDate.php +++ b/app/Classes/General/Eloquent/Filters/PackingListLimitOneByTypeOrderedByInvoiceDate.php @@ -21,12 +21,12 @@ class PackingListLimitOneByTypeOrderedByInvoiceDate implements Filter { return $builder->select('packing_lists.*')->join('transactions', function($join){ $join->on('transactions.owner_id', '=', 'packing_lists.id'); - $join->where('transactions.owner_type', '=', PackingList::class); - $join->where('transactions.status', '=', ApprovalStatus::APPROVED); - $join->whereNull('transactions.deleted_at'); - $join->whereRaw('(transactions.type <> 16 OR transactions.id = ( - SELECT id FROM transactions WHERE owner_id = packing_lists.id AND type = 16 LIMIT 1 - ))'); + // $join->where('transactions.owner_type', '=', PackingList::class); + // $join->where('transactions.status', '=', ApprovalStatus::APPROVED); + // $join->whereNull('transactions.deleted_at'); + // $join->whereRaw('(transactions.type <> 16 OR transactions.id = ( + // SELECT id FROM transactions WHERE owner_id = packing_lists.id AND type = 16 LIMIT 1 + // ))'); })->orderBy('transactions.updated_at', 'DESC'); } From 1a318ead7e393cd9db8918102dfa0164d00c49f5 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sat, 28 Jun 2025 13:35:42 +0800 Subject: [PATCH 10/25] E-Invoice - Debug Pending Payment at /payment-and-billing no data --- ...PackingListLimitOneByTypeOrderedByInvoiceDate.php | 12 ++++++------ .../AdminPaymentsBillingSectionComponent.vue | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/Classes/General/Eloquent/Filters/PackingListLimitOneByTypeOrderedByInvoiceDate.php b/app/Classes/General/Eloquent/Filters/PackingListLimitOneByTypeOrderedByInvoiceDate.php index d0839721..1ebc952d 100644 --- a/app/Classes/General/Eloquent/Filters/PackingListLimitOneByTypeOrderedByInvoiceDate.php +++ b/app/Classes/General/Eloquent/Filters/PackingListLimitOneByTypeOrderedByInvoiceDate.php @@ -21,12 +21,12 @@ class PackingListLimitOneByTypeOrderedByInvoiceDate implements Filter { return $builder->select('packing_lists.*')->join('transactions', function($join){ $join->on('transactions.owner_id', '=', 'packing_lists.id'); - // $join->where('transactions.owner_type', '=', PackingList::class); - // $join->where('transactions.status', '=', ApprovalStatus::APPROVED); - // $join->whereNull('transactions.deleted_at'); - // $join->whereRaw('(transactions.type <> 16 OR transactions.id = ( - // SELECT id FROM transactions WHERE owner_id = packing_lists.id AND type = 16 LIMIT 1 - // ))'); + $join->where('transactions.owner_type', '=', PackingList::class); + $join->where('transactions.status', '=', ApprovalStatus::APPROVED); + $join->whereNull('transactions.deleted_at'); + $join->whereRaw('(transactions.type <> 16 OR transactions.id = ( + SELECT id FROM transactions WHERE owner_id = packing_lists.id AND type = 16 LIMIT 1 + ))'); })->orderBy('transactions.updated_at', 'DESC'); } diff --git a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue index d29a3d2a..e371fccd 100644 --- a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue @@ -114,7 +114,7 @@
- +
From 679bb9978ab3009fa8ae590c9cd8f274367f04ea Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sat, 28 Jun 2025 13:49:32 +0800 Subject: [PATCH 11/25] E-Invoice - Debug Pending Payment at /payment-and-billing no data --- .../sections/AdminPaymentsBillingSectionComponent.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue index e371fccd..3cc618bb 100644 --- a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue @@ -114,7 +114,7 @@
- +
From 52b839c741ec5901a84577769211c700c3163950 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sat, 28 Jun 2025 16:32:22 +0800 Subject: [PATCH 12/25] E-Invoice - Debug Pending Payment at /payment-and-billing no data --- .../sections/AdminPaymentsBillingSectionComponent.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue index 3cc618bb..92d8ef4c 100644 --- a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue @@ -113,8 +113,7 @@
- - +
From 137dfe0669b2954aa3f8590f26c6fa3fa641e343 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sat, 28 Jun 2025 17:14:33 +0800 Subject: [PATCH 13/25] E-Invoice - Debug Pending Payment at /payment-and-billing no data --- .../PackingListLimitOneByTypeOrderedByInvoiceDate.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Classes/General/Eloquent/Filters/PackingListLimitOneByTypeOrderedByInvoiceDate.php b/app/Classes/General/Eloquent/Filters/PackingListLimitOneByTypeOrderedByInvoiceDate.php index 1ebc952d..c7768c74 100644 --- a/app/Classes/General/Eloquent/Filters/PackingListLimitOneByTypeOrderedByInvoiceDate.php +++ b/app/Classes/General/Eloquent/Filters/PackingListLimitOneByTypeOrderedByInvoiceDate.php @@ -24,10 +24,12 @@ class PackingListLimitOneByTypeOrderedByInvoiceDate implements Filter $join->where('transactions.owner_type', '=', PackingList::class); $join->where('transactions.status', '=', ApprovalStatus::APPROVED); $join->whereNull('transactions.deleted_at'); - $join->whereRaw('(transactions.type <> 16 OR transactions.id = ( - SELECT id FROM transactions WHERE owner_id = packing_lists.id AND type = 16 LIMIT 1 - ))'); + // $join->whereRaw('(transactions.type <> 16 OR transactions.id = ( + // SELECT id FROM transactions WHERE owner_id = packing_lists.id AND type = 16 LIMIT 1 + // ))'); })->orderBy('transactions.updated_at', 'DESC'); + + } } From cad314d6a7fbb0b81324c228dc9865ac5e3a40b1 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sat, 28 Jun 2025 19:25:57 +0800 Subject: [PATCH 14/25] E-Invoice - Debug Pending Payment at /payment-and-billing no data --- ...ListLimitOneByTypeOrderedByInvoiceDate.php | 39 ++++++++++++++----- .../CheckForStorageInvoiceByPackingLists.php | 8 +++- ...minPaymentsBillingWithStorageComponent.vue | 2 +- 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/app/Classes/General/Eloquent/Filters/PackingListLimitOneByTypeOrderedByInvoiceDate.php b/app/Classes/General/Eloquent/Filters/PackingListLimitOneByTypeOrderedByInvoiceDate.php index c7768c74..fb9c4d84 100644 --- a/app/Classes/General/Eloquent/Filters/PackingListLimitOneByTypeOrderedByInvoiceDate.php +++ b/app/Classes/General/Eloquent/Filters/PackingListLimitOneByTypeOrderedByInvoiceDate.php @@ -19,17 +19,38 @@ class PackingListLimitOneByTypeOrderedByInvoiceDate implements Filter */ public static function apply(Builder $builder, $value) { - return $builder->select('packing_lists.*')->join('transactions', function($join){ - $join->on('transactions.owner_id', '=', 'packing_lists.id'); - $join->where('transactions.owner_type', '=', PackingList::class); - $join->where('transactions.status', '=', ApprovalStatus::APPROVED); - $join->whereNull('transactions.deleted_at'); - // $join->whereRaw('(transactions.type <> 16 OR transactions.id = ( - // SELECT id FROM transactions WHERE owner_id = packing_lists.id AND type = 16 LIMIT 1 - // ))'); - })->orderBy('transactions.updated_at', 'DESC'); + // return $builder->select('packing_lists.*')->join('transactions', function($join){ + // $join->on('transactions.owner_id', '=', 'packing_lists.id'); + // $join->where('transactions.owner_type', '=', PackingList::class); + // $join->where('transactions.status', '=', ApprovalStatus::APPROVED); + // $join->whereNull('transactions.deleted_at'); + // $join->whereRaw('(transactions.type <> 16 OR transactions.id = ( + // SELECT id FROM transactions WHERE owner_id = packing_lists.id AND type = 16 LIMIT 1 + // ))'); + // })->orderBy('transactions.updated_at', 'DESC'); + // return $builder->with(['transactions' => function ($query) { + // $query->where('status', ApprovalStatus::APPROVED) + // ->whereNull('deleted_at') + // ->whereRaw('( + // transactions.type <> 16 OR transactions.id = ( + // SELECT id FROM transactions AS t2 + // WHERE t2.owner_id = transactions.owner_id + // AND t2.owner_type = ? + // AND t2.type = 16 + // LIMIT 1 + // ) + // )', [PackingList::class]) + // ->orderBy('updated_at', 'DESC'); + // }]); + return $builder->with(['transactions' => function ($query) { + $query->where('status', ApprovalStatus::APPROVED) + ->where('type', '<>', 16 ) + ->whereNull('deleted_at') + ->orderBy('updated_at', 'DESC'); + // ->orderBy('updated_at', 'DESC'); + }]); } } diff --git a/app/Http/Middleware/CheckForStorageInvoiceByPackingLists.php b/app/Http/Middleware/CheckForStorageInvoiceByPackingLists.php index a393e3b5..4fbe571c 100644 --- a/app/Http/Middleware/CheckForStorageInvoiceByPackingLists.php +++ b/app/Http/Middleware/CheckForStorageInvoiceByPackingLists.php @@ -47,12 +47,16 @@ class CheckForStorageInvoiceByPackingLists // } if(isset($filters['check_for_storage_invoice'])){ - unset($filters['order_by']); - $packinglists = $this->listsPackingLists->execute($filters); + // unset($filters['order_by']); + // $packinglists = $this->listsPackingLists->execute($filters); + $packinglists = $this->listsPackingLists->execute($this->listsPackingLists->deserializeFilters($request->input('filters'))); + + Log::info('CheckForStorageInvoiceByPackingLists $packinglists ' . json_encode($packinglists)); foreach($packinglists as $packingList){ if($packingList){ $order = $packingList->owner()->first(); if($order instanceof Order){ + Log::info('CheckForStorageInvoiceByPackingLists orderId: '.$order->id.', orderReference: '.$order->reference); $storages = $this->storageInvoiceTransactionProcessor->executeOrder($order); if($storages){ $results = array_merge($results, $storages); diff --git a/resources/assets/vue/components/paymentsBilling/elements/SingleAdminPaymentsBillingWithStorageComponent.vue b/resources/assets/vue/components/paymentsBilling/elements/SingleAdminPaymentsBillingWithStorageComponent.vue index 840132a8..a371b573 100644 --- a/resources/assets/vue/components/paymentsBilling/elements/SingleAdminPaymentsBillingWithStorageComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/elements/SingleAdminPaymentsBillingWithStorageComponent.vue @@ -23,7 +23,7 @@

Invoice Date

({{ singleInvoice.bill_no }})
n/a
-
{{ singleInvoice.updated_at }}
+
{{ singleInvoice.created_at }}
From a7aad5373b45cd871ee4532b26a6c9dd416c6141 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sat, 28 Jun 2025 19:51:52 +0800 Subject: [PATCH 15/25] E-Invoice - Debug Pending Payment at /payment-and-billing no data --- .../PackingListLimitOneByTypeOrderedByInvoiceDate.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Classes/General/Eloquent/Filters/PackingListLimitOneByTypeOrderedByInvoiceDate.php b/app/Classes/General/Eloquent/Filters/PackingListLimitOneByTypeOrderedByInvoiceDate.php index fb9c4d84..12a96466 100644 --- a/app/Classes/General/Eloquent/Filters/PackingListLimitOneByTypeOrderedByInvoiceDate.php +++ b/app/Classes/General/Eloquent/Filters/PackingListLimitOneByTypeOrderedByInvoiceDate.php @@ -19,6 +19,7 @@ class PackingListLimitOneByTypeOrderedByInvoiceDate implements Filter */ public static function apply(Builder $builder, $value) { + //Original with problem // return $builder->select('packing_lists.*')->join('transactions', function($join){ // $join->on('transactions.owner_id', '=', 'packing_lists.id'); // $join->where('transactions.owner_type', '=', PackingList::class); @@ -29,6 +30,7 @@ class PackingListLimitOneByTypeOrderedByInvoiceDate implements Filter // ))'); // })->orderBy('transactions.updated_at', 'DESC'); + //Attempt 1 // return $builder->with(['transactions' => function ($query) { // $query->where('status', ApprovalStatus::APPROVED) // ->whereNull('deleted_at') @@ -44,13 +46,12 @@ class PackingListLimitOneByTypeOrderedByInvoiceDate implements Filter // ->orderBy('updated_at', 'DESC'); // }]); + //Attempt 2 return $builder->with(['transactions' => function ($query) { $query->where('status', ApprovalStatus::APPROVED) ->where('type', '<>', 16 ) ->whereNull('deleted_at') ->orderBy('updated_at', 'DESC'); - // ->orderBy('updated_at', 'DESC'); }]); } - } From dca9682c598a93afe5201e3d2fc3f4ce352b6c50 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sun, 29 Jun 2025 17:38:52 +0800 Subject: [PATCH 16/25] E-Invoice - Debug Pending Payment at /payment-and-billing no data (undo) --- app/Http/Resources/CompanyModuleResource.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Resources/CompanyModuleResource.php b/app/Http/Resources/CompanyModuleResource.php index 2dd971d6..f48cbc43 100644 --- a/app/Http/Resources/CompanyModuleResource.php +++ b/app/Http/Resources/CompanyModuleResource.php @@ -51,10 +51,10 @@ class CompanyModuleResource extends JsonResource 'connections' => $this->connections, 'contact' => new ContactResource ($this->when($this->has('contacts'), $this->contacts->first())), 'debtor' => $this->company->debtor, - // 'e_invoice' => $this->company->e_invoice, + 'e_invoice' => $this->company->e_invoice, 'tin' => $this->company->tin, 'msic_code' => $this->company->msic_code, - // 'address_einvoice' => $this->company->e_invoice ? new AddressEInvoiceResource($this->when($this->has('addresses'), $this->addresses->where('type', AddressType::E_INVOICE)->sortByDesc('created_at')->first())) : null, + 'address_einvoice' => $this->company->e_invoice ? new AddressEInvoiceResource($this->when($this->has('addresses'), $this->addresses->where('type', AddressType::E_INVOICE)->sortByDesc('created_at')->first())) : null, ]; } From 2cbee2323497965b9b0e92b5670ae7979638fe02 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sun, 29 Jun 2025 17:52:07 +0800 Subject: [PATCH 17/25] E-Invoice - Debug Pending Payment at /payment-and-billing no data (undo) --- app/Http/Resources/PackingListBaseResource.php | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/app/Http/Resources/PackingListBaseResource.php b/app/Http/Resources/PackingListBaseResource.php index 911a1378..d1de8d66 100644 --- a/app/Http/Resources/PackingListBaseResource.php +++ b/app/Http/Resources/PackingListBaseResource.php @@ -21,13 +21,12 @@ class PackingListBaseResource extends JsonResource */ public function toArray($request) { - $exceptionUsers = in_array(Auth()->user()->type, [RoleTypes::SHADOW_ADMIN, RoleTypes::SUPER_ADMIN]); - // $userType = Auth() && Auth()->user() ? Auth()->user()->type : RoleTypes::USER; - // $exceptionUsers = in_array($userType, [RoleTypes::SHADOW_ADMIN, RoleTypes::SUPER_ADMIN]); + // $exceptionUsers = in_array(Auth()->user()->type, [RoleTypes::SHADOW_ADMIN, RoleTypes::SUPER_ADMIN]); + $userType = Auth() && Auth()->user() ? Auth()->user()->type : RoleTypes::USER; + $exceptionUsers = in_array($userType, [RoleTypes::SHADOW_ADMIN, RoleTypes::SUPER_ADMIN]); $packages = []; $receive_packing_list = null; - Log::info("Log 0"); //The Base $data = [ @@ -44,8 +43,6 @@ class PackingListBaseResource extends JsonResource // 'suspended_invoices' => TransactionResource::collection($this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [ApprovalStatus::SUSPENDED])->get()), ]; - Log::info("Log 1"); - //option 1: include_packages if($this->include_packages){ $packages = !$this->packingLists()->exists() || $exceptionUsers ? $this->packages : $this->packingLists->first()->packages; @@ -65,7 +62,6 @@ class PackingListBaseResource extends JsonResource } } $data['packages'] = PackageBaseResource::collection($packages); - Log::info("Log 2"); //option 2a: include_receive_packing_list if($this->include_receive_packing_list){ @@ -82,7 +78,6 @@ class PackingListBaseResource extends JsonResource $receive_packing_list = $this->when($this->type === PackingListType::SHIPPING_PACKING_LIST, new PackingListBaseResource($temp)); } - Log::info("Log 3"); //option 2b: include_base_only_in_receive_packing_list if($this->include_base_only_in_receive_packing_list){ @@ -100,20 +95,17 @@ class PackingListBaseResource extends JsonResource $receive_packing_list = $this->when($this->type === PackingListType::SHIPPING_PACKING_LIST, new PackingListBaseResource($temp)); } $data['receive_packing_list'] = $receive_packing_list; - Log::info("Log 4"); //option 3: include_shipping_transaction WITHOUT warehouse storage if($this->include_shipping_transaction && !$this->storages){ $shippingTransaction = $this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->whereNotIn('status', [ApprovalStatus::SUSPENDED, ApprovalStatus::EXPIRED])->first(); $data['shipping_transaction'] = new TransactionResource($shippingTransaction); } - Log::info("Log 5"); //option 4: include_suspended_invoice if($this->include_suspended_invoice){ $data['suspended_invoice'] = new TransactionResource($this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [ApprovalStatus::SUSPENDED])->first()); } - Log::info("Log 6"); //option 5: include_shipping_transaction WITH warehouse storage if($this->include_shipping_transaction && $this->storages){ @@ -132,7 +124,6 @@ class PackingListBaseResource extends JsonResource $data['storages'] = $storages; $data['invoices'] = TransactionWithStorageResource::collection($transactions); } - Log::info("Log 7"); return $data; } From f061b5eb86966ae2dac6b1a8e8ae2c91ea0067d8 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sat, 9 Aug 2025 17:35:05 +0800 Subject: [PATCH 18/25] Debug an old 504 problem at payment-and-billing page > pending payment tab with no data --- ...ListLimitOneByTypeOrderedByInvoiceDate.php | 24 +++++++++++++------ .../ListPackingListsLogic.php | 5 ++-- .../CheckForStorageInvoiceByPackingLists.php | 13 ++++++---- .../Resources/PackingListBaseResource.php | 5 +++- 4 files changed, 31 insertions(+), 16 deletions(-) diff --git a/app/Classes/General/Eloquent/Filters/PackingListLimitOneByTypeOrderedByInvoiceDate.php b/app/Classes/General/Eloquent/Filters/PackingListLimitOneByTypeOrderedByInvoiceDate.php index 12a96466..2c598ea3 100644 --- a/app/Classes/General/Eloquent/Filters/PackingListLimitOneByTypeOrderedByInvoiceDate.php +++ b/app/Classes/General/Eloquent/Filters/PackingListLimitOneByTypeOrderedByInvoiceDate.php @@ -19,6 +19,16 @@ class PackingListLimitOneByTypeOrderedByInvoiceDate implements Filter */ public static function apply(Builder $builder, $value) { + return $builder->select('packing_lists.*')->join('transactions', function($join){ + $join->on('transactions.owner_id', '=', 'packing_lists.id'); + $join->where('transactions.owner_type', '=', PackingList::class); + $join->where('transactions.status', '=', ApprovalStatus::APPROVED); + $join->whereNull('transactions.deleted_at'); + $join->whereRaw('(transactions.type <> 16 OR transactions.id = ( + SELECT id FROM transactions WHERE owner_id = packing_lists.id AND type = 16 LIMIT 1 + ))'); + })->orderBy('transactions.updated_at', 'DESC'); + //Original with problem // return $builder->select('packing_lists.*')->join('transactions', function($join){ // $join->on('transactions.owner_id', '=', 'packing_lists.id'); @@ -46,12 +56,12 @@ class PackingListLimitOneByTypeOrderedByInvoiceDate implements Filter // ->orderBy('updated_at', 'DESC'); // }]); - //Attempt 2 - return $builder->with(['transactions' => function ($query) { - $query->where('status', ApprovalStatus::APPROVED) - ->where('type', '<>', 16 ) - ->whereNull('deleted_at') - ->orderBy('updated_at', 'DESC'); - }]); + //Attempt 2 + // return $builder->with(['transactions' => function ($query) { + // $query->where('status', ApprovalStatus::APPROVED) + // ->where('type', '<>', 16 ) + // ->whereNull('deleted_at') + // ->orderBy('updated_at', 'DESC'); + // }]); } } diff --git a/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php b/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php index 4711726f..16ac1272 100644 --- a/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php +++ b/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php @@ -52,7 +52,7 @@ class ListPackingListsLogic extends AbstractControllerLogic public function logic(Request $request) : JsonResponse { $this->canListPackingLists->passes(); - Log::info("ListPackingListsLogic storages debug 0"); + $query = $this->listsPackingLists->execute($this->listsPackingLists->deserializeFilters($request->input('filters'))); $data = json_encode($request->input('storages')); @@ -97,11 +97,10 @@ class ListPackingListsLogic extends AbstractControllerLogic $useNew = true; } } - Log::info("ListPackingListsLogic storages debug 1"); + if($useNew){ return $this->collectionResponse(PackingListBaseResource::collection($query)); } - Log::info("ListPackingListsLogic storages debug 2"); //Fallback return $this->collectionResponse(PackingListResource::collection($query)); diff --git a/app/Http/Middleware/CheckForStorageInvoiceByPackingLists.php b/app/Http/Middleware/CheckForStorageInvoiceByPackingLists.php index 4fbe571c..15a4a6b6 100644 --- a/app/Http/Middleware/CheckForStorageInvoiceByPackingLists.php +++ b/app/Http/Middleware/CheckForStorageInvoiceByPackingLists.php @@ -47,16 +47,19 @@ class CheckForStorageInvoiceByPackingLists // } if(isset($filters['check_for_storage_invoice'])){ - // unset($filters['order_by']); - // $packinglists = $this->listsPackingLists->execute($filters); - $packinglists = $this->listsPackingLists->execute($this->listsPackingLists->deserializeFilters($request->input('filters'))); + unset($filters['order_by']); + $packinglists = $this->listsPackingLists->execute($filters); - Log::info('CheckForStorageInvoiceByPackingLists $packinglists ' . json_encode($packinglists)); + // unset($filters['order_by']); //cief todo: 90 - DEBUG + // $packinglists = $this->listsPackingLists->execute($filters); //cief todo: 90 - DEBUG + // $packinglists = $this->listsPackingLists->execute($this->listsPackingLists->deserializeFilters($request->input('filters'))); //cief todo: 90 - DEBUG + + // Log::info('CheckForStorageInvoiceByPackingLists $packinglists ' . json_encode($packinglists)); //cief todo: 90 - DEBUG foreach($packinglists as $packingList){ if($packingList){ $order = $packingList->owner()->first(); if($order instanceof Order){ - Log::info('CheckForStorageInvoiceByPackingLists orderId: '.$order->id.', orderReference: '.$order->reference); + // Log::info('CheckForStorageInvoiceByPackingLists orderId: '.$order->id.', orderReference: '.$order->reference); //cief todo: 90 - DEBUG $storages = $this->storageInvoiceTransactionProcessor->executeOrder($order); if($storages){ $results = array_merge($results, $storages); diff --git a/app/Http/Resources/PackingListBaseResource.php b/app/Http/Resources/PackingListBaseResource.php index d1de8d66..a29f174a 100644 --- a/app/Http/Resources/PackingListBaseResource.php +++ b/app/Http/Resources/PackingListBaseResource.php @@ -9,7 +9,6 @@ use App\Classes\ValueObjects\Constants\RoleTypes; use App\Models\Order; use App\Models\PackingList; use Illuminate\Http\Resources\Json\JsonResource; -use Illuminate\Support\Facades\Log; class PackingListBaseResource extends JsonResource { @@ -43,6 +42,7 @@ class PackingListBaseResource extends JsonResource // 'suspended_invoices' => TransactionResource::collection($this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [ApprovalStatus::SUSPENDED])->get()), ]; + //option 1: include_packages if($this->include_packages){ $packages = !$this->packingLists()->exists() || $exceptionUsers ? $this->packages : $this->packingLists->first()->packages; @@ -63,6 +63,7 @@ class PackingListBaseResource extends JsonResource } $data['packages'] = PackageBaseResource::collection($packages); + //option 2a: include_receive_packing_list if($this->include_receive_packing_list){ $temp = PackingList::where('reference', $this->reference)->where('type', PackingListType::WAREHOUSE_RECEIVE_LIST)->first(); @@ -96,12 +97,14 @@ class PackingListBaseResource extends JsonResource } $data['receive_packing_list'] = $receive_packing_list; + //option 3: include_shipping_transaction WITHOUT warehouse storage if($this->include_shipping_transaction && !$this->storages){ $shippingTransaction = $this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->whereNotIn('status', [ApprovalStatus::SUSPENDED, ApprovalStatus::EXPIRED])->first(); $data['shipping_transaction'] = new TransactionResource($shippingTransaction); } + //option 4: include_suspended_invoice if($this->include_suspended_invoice){ $data['suspended_invoice'] = new TransactionResource($this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [ApprovalStatus::SUSPENDED])->first()); From 6d26f690c076c8399c4de7b2e6afadc83f657370 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sat, 9 Aug 2025 18:10:53 +0800 Subject: [PATCH 19/25] Debug an old 504 problem at payment-and-billing page > pending payment tab with no data --- .../Filters/PackingListOrderedByInvoiceDate.php | 1 + .../CheckForStorageInvoiceByPackingLists.php | 13 +++++-------- .../AdminPaymentsBillingPollingSectionComponent.vue | 2 +- .../AdminPaymentsBillingSectionComponent.vue | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/app/Classes/General/Eloquent/Filters/PackingListOrderedByInvoiceDate.php b/app/Classes/General/Eloquent/Filters/PackingListOrderedByInvoiceDate.php index a8981a19..1fdb2321 100644 --- a/app/Classes/General/Eloquent/Filters/PackingListOrderedByInvoiceDate.php +++ b/app/Classes/General/Eloquent/Filters/PackingListOrderedByInvoiceDate.php @@ -23,6 +23,7 @@ class PackingListOrderedByInvoiceDate implements Filter $join->on('transactions.owner_id', '=', 'packing_lists.id'); $join->where('transactions.owner_type', '=', PackingList::class); $join->where('transactions.status', '=', ApprovalStatus::APPROVED); + $join->whereNull('transactions.deleted_at'); })->orderBy('transactions.updated_at', 'DESC'); } diff --git a/app/Http/Middleware/CheckForStorageInvoiceByPackingLists.php b/app/Http/Middleware/CheckForStorageInvoiceByPackingLists.php index 15a4a6b6..0cac30a8 100644 --- a/app/Http/Middleware/CheckForStorageInvoiceByPackingLists.php +++ b/app/Http/Middleware/CheckForStorageInvoiceByPackingLists.php @@ -47,19 +47,16 @@ class CheckForStorageInvoiceByPackingLists // } if(isset($filters['check_for_storage_invoice'])){ - unset($filters['order_by']); - $packinglists = $this->listsPackingLists->execute($filters); + // unset($filters['order_by']); //cief todo: 90 - DEBUG, original + // $packinglists = $this->listsPackingLists->execute($filters); //cief todo: 90 - DEBUG, original - // unset($filters['order_by']); //cief todo: 90 - DEBUG - // $packinglists = $this->listsPackingLists->execute($filters); //cief todo: 90 - DEBUG - // $packinglists = $this->listsPackingLists->execute($this->listsPackingLists->deserializeFilters($request->input('filters'))); //cief todo: 90 - DEBUG - - // Log::info('CheckForStorageInvoiceByPackingLists $packinglists ' . json_encode($packinglists)); //cief todo: 90 - DEBUG + $packinglists = $this->listsPackingLists->execute($this->listsPackingLists->deserializeFilters($request->input('filters'))); //cief todo: 90 - DEBUG + Log::info('CheckForStorageInvoiceByPackingLists $packinglists ' . count($packinglists)); + Log::info('CheckForStorageInvoiceByPackingLists $packinglists ' . json_encode($packinglists)); //cief todo: 90 - DEBUG foreach($packinglists as $packingList){ if($packingList){ $order = $packingList->owner()->first(); if($order instanceof Order){ - // Log::info('CheckForStorageInvoiceByPackingLists orderId: '.$order->id.', orderReference: '.$order->reference); //cief todo: 90 - DEBUG $storages = $this->storageInvoiceTransactionProcessor->executeOrder($order); if($storages){ $results = array_merge($results, $storages); diff --git a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingPollingSectionComponent.vue b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingPollingSectionComponent.vue index a8315f55..f790c3c6 100644 --- a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingPollingSectionComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingPollingSectionComponent.vue @@ -113,7 +113,7 @@
- +
diff --git a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue index 92d8ef4c..99b8d1d5 100644 --- a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue @@ -113,7 +113,7 @@
- +
From d8f3f50bb0ed76ee228e99eb11f7ec178613cc54 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sat, 9 Aug 2025 18:44:31 +0800 Subject: [PATCH 20/25] Debug an old 504 problem at payment-and-billing page > pending payment tab with no data --- .../sections/AdminPaymentsBillingPollingSectionComponent.vue | 1 + .../sections/AdminPaymentsBillingSectionComponent.vue | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingPollingSectionComponent.vue b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingPollingSectionComponent.vue index f790c3c6..e928bb21 100644 --- a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingPollingSectionComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingPollingSectionComponent.vue @@ -113,6 +113,7 @@
+
diff --git a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue index 99b8d1d5..67c3164c 100644 --- a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue @@ -113,7 +113,8 @@
- + +
From b3d904f3c8fa692e777c2e802684a02302373dbc Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sat, 9 Aug 2025 19:16:29 +0800 Subject: [PATCH 21/25] Debug an old 504 problem at payment-and-billing page > pending payment tab with no data --- .../PackingLists/ControllersLogic/ListPackingListsLogic.php | 6 ++++++ .../sections/AdminPaymentsBillingSectionComponent.vue | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php b/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php index 16ac1272..001dd9a3 100644 --- a/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php +++ b/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php @@ -75,6 +75,12 @@ class ListPackingListsLogic extends AbstractControllerLogic } //from front end component + if(isset($filters['exclude_storages'])){ + if (isset($item['storages'])) { + unset($item['storages']); + } + } + if(isset($filters['include_packages'])){ //'include_packages' filter is an attempt to reduce the request-response time to only load basic information unless explicitly indicated to be included $item['include_packages'] = $filters['include_packages']; diff --git a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue index 67c3164c..d9d8fab1 100644 --- a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue @@ -114,7 +114,7 @@
- +
From a716a7a38b97e52679b780996edd4d44baf09a60 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sat, 9 Aug 2025 19:55:05 +0800 Subject: [PATCH 22/25] Debug an old 504 problem at payment-and-billing page > pending payment tab with no data --- .../PackingLists/ControllersLogic/ListPackingListsLogic.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php b/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php index 001dd9a3..a4185e20 100644 --- a/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php +++ b/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php @@ -76,6 +76,7 @@ class ListPackingListsLogic extends AbstractControllerLogic //from front end component if(isset($filters['exclude_storages'])){ + Log::info("ListPackingListsLogic exclude_storages"); if (isset($item['storages'])) { unset($item['storages']); } @@ -102,8 +103,12 @@ class ListPackingListsLogic extends AbstractControllerLogic $item['include_suspended_invoice'] = $filters['include_suspended_invoice']; $useNew = true; } + + Log::info("ListPackingListsLogic useNew"); } + + Log::info("ListPackingListsLogic useNew: " . ($useNew ? 'true' : 'false')); if($useNew){ return $this->collectionResponse(PackingListBaseResource::collection($query)); } From bdc45282a423931ba026c806a924e99feafe8f64 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sat, 9 Aug 2025 20:12:37 +0800 Subject: [PATCH 23/25] Debug an old 504 problem at payment-and-billing page > pending payment tab with no data --- .../PackingLists/ControllersLogic/ListPackingListsLogic.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php b/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php index a4185e20..7bbae993 100644 --- a/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php +++ b/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php @@ -68,6 +68,7 @@ class ListPackingListsLogic extends AbstractControllerLogic $filters = json_decode($request->input('filters'), true); $useNew = false; + Log::info('Filters:', $filters); foreach ($query->items() as $item) { //from middleware if($request->input('storages')){ From 0625c37cdc17740de278d4ed6a7a65e8c1845147 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sat, 9 Aug 2025 20:30:42 +0800 Subject: [PATCH 24/25] Debug an old 504 problem at payment-and-billing page > pending payment tab with no data --- .../sections/AdminPaymentsBillingSectionComponent.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue index d9d8fab1..142d4e22 100644 --- a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue @@ -114,7 +114,7 @@
- +
From 5414be594dcb96e41c8c75f1d4b6d3c897cb8a32 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sat, 9 Aug 2025 21:16:05 +0800 Subject: [PATCH 25/25] Debug an old 504 problem at payment-and-billing page > pending payment tab with no data --- ...StorageInvoicesSingleOrderV2CommandJob.php | 44 +++++++++++++++++++ .../ListPackingListsLogic.php | 17 +------ .../CheckForStorageInvoiceByPackingLists.php | 13 ++++-- ...minPaymentsBillingWithStorageComponent.vue | 8 ++-- ...PaymentsBillingWithoutStorageComponent.vue | 12 ++--- .../AdminPaymentsBillingSectionComponent.vue | 2 +- 6 files changed, 67 insertions(+), 29 deletions(-) create mode 100644 app/Classes/Jobs/Commands/V2/CheckStorageInvoicesSingleOrderV2CommandJob.php diff --git a/app/Classes/Jobs/Commands/V2/CheckStorageInvoicesSingleOrderV2CommandJob.php b/app/Classes/Jobs/Commands/V2/CheckStorageInvoicesSingleOrderV2CommandJob.php new file mode 100644 index 00000000..db6f06eb --- /dev/null +++ b/app/Classes/Jobs/Commands/V2/CheckStorageInvoicesSingleOrderV2CommandJob.php @@ -0,0 +1,44 @@ +order = $order; + } + + public function handle() + { + Log::info(Carbon::now() . ': Start job - Check single order for storage invoice.'); + $start = new Carbon(); + + try{ + Log::info("Processing Order - ID: {$this->order->id}, Reference: {$this->order->reference}"); + (App()->make(CheckStorageInvoiceTransactionProcessor::class))->executeOrder($this->order); + } + catch(\Exception $ex){ + Log::info('Exception '.$ex->getMessage()); + } + + $end = new Carbon(); + $elapsedTime = $start->diff($end)->format('%H:%I:%S'); + Log::info(Carbon::now() . ': End job - Check single order for storage invoice. ElapsedTime: ' . $elapsedTime . '.'); + } +} diff --git a/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php b/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php index 7bbae993..70c02729 100644 --- a/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php +++ b/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php @@ -55,9 +55,6 @@ class ListPackingListsLogic extends AbstractControllerLogic $query = $this->listsPackingLists->execute($this->listsPackingLists->deserializeFilters($request->input('filters'))); - $data = json_encode($request->input('storages')); - Log::info("ListPackingListsLogic storages A"); - // if($request->input('storages')){ // Log::info("ListPackingListsLogic storages B"); // foreach ($query->items() as $item) { @@ -67,8 +64,9 @@ class ListPackingListsLogic extends AbstractControllerLogic // } $filters = json_decode($request->input('filters'), true); + Log::info('ListPackingListsLogic storages A with Filters:' . json_encode($filters)); + $useNew = false; - Log::info('Filters:', $filters); foreach ($query->items() as $item) { //from middleware if($request->input('storages')){ @@ -76,13 +74,6 @@ class ListPackingListsLogic extends AbstractControllerLogic } //from front end component - if(isset($filters['exclude_storages'])){ - Log::info("ListPackingListsLogic exclude_storages"); - if (isset($item['storages'])) { - unset($item['storages']); - } - } - if(isset($filters['include_packages'])){ //'include_packages' filter is an attempt to reduce the request-response time to only load basic information unless explicitly indicated to be included $item['include_packages'] = $filters['include_packages']; @@ -104,12 +95,8 @@ class ListPackingListsLogic extends AbstractControllerLogic $item['include_suspended_invoice'] = $filters['include_suspended_invoice']; $useNew = true; } - - Log::info("ListPackingListsLogic useNew"); } - - Log::info("ListPackingListsLogic useNew: " . ($useNew ? 'true' : 'false')); if($useNew){ return $this->collectionResponse(PackingListBaseResource::collection($query)); } diff --git a/app/Http/Middleware/CheckForStorageInvoiceByPackingLists.php b/app/Http/Middleware/CheckForStorageInvoiceByPackingLists.php index 0cac30a8..ac293df4 100644 --- a/app/Http/Middleware/CheckForStorageInvoiceByPackingLists.php +++ b/app/Http/Middleware/CheckForStorageInvoiceByPackingLists.php @@ -2,6 +2,7 @@ namespace App\Http\Middleware; +use App\Classes\Jobs\Commands\V2\CheckStorageInvoicesSingleOrderV2CommandJob; use Closure; use App\Classes\Modules\Transactions\Processors\CheckStorageInvoiceTransactionProcessor; use App\Classes\Modules\PackingLists\Services\ListsPackingLists; @@ -57,9 +58,15 @@ class CheckForStorageInvoiceByPackingLists if($packingList){ $order = $packingList->owner()->first(); if($order instanceof Order){ - $storages = $this->storageInvoiceTransactionProcessor->executeOrder($order); - if($storages){ - $results = array_merge($results, $storages); + if(isset($filters['check_for_storage_invoice_asynchronously'])){ + Log::info("check_for_storage_invoice_asynchronously Order - ID: {$order->id}, Reference: {$order->reference}"); + CheckStorageInvoicesSingleOrderV2CommandJob::dispatch($order); + } + else{ + $storages = $this->storageInvoiceTransactionProcessor->executeOrder($order); + if($storages){ + $results = array_merge($results, $storages); + } } } } diff --git a/resources/assets/vue/components/paymentsBilling/elements/SingleAdminPaymentsBillingWithStorageComponent.vue b/resources/assets/vue/components/paymentsBilling/elements/SingleAdminPaymentsBillingWithStorageComponent.vue index a371b573..5839794f 100644 --- a/resources/assets/vue/components/paymentsBilling/elements/SingleAdminPaymentsBillingWithStorageComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/elements/SingleAdminPaymentsBillingWithStorageComponent.vue @@ -75,9 +75,9 @@
-
+
@@ -96,7 +96,7 @@
-
+
diff --git a/resources/assets/vue/components/paymentsBilling/elements/SingleAdminPaymentsBillingWithoutStorageComponent.vue b/resources/assets/vue/components/paymentsBilling/elements/SingleAdminPaymentsBillingWithoutStorageComponent.vue index 3b9aafab..f92fee28 100644 --- a/resources/assets/vue/components/paymentsBilling/elements/SingleAdminPaymentsBillingWithoutStorageComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/elements/SingleAdminPaymentsBillingWithoutStorageComponent.vue @@ -75,9 +75,9 @@
-
+
@@ -196,7 +196,7 @@
-
+ +
MYR {{(Math.round((item.shipping_transaction.paid_amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
Paid Total
@@ -259,7 +259,7 @@
Floating Amount:
- +
MYR {{(Math.round((item.shipping_transaction.floating_amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
Floating Amount
@@ -295,7 +295,7 @@
-
+ --> diff --git a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue index 142d4e22..bd23d9ae 100644 --- a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue @@ -114,7 +114,7 @@
- +