From ff68ee76ab76148b92d4420d732199c41946a1d3 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Sun, 31 Jul 2022 22:08:48 +0800 Subject: [PATCH] update base price according to packlinglist drop date --- .../CreateShippingInvoiceTransactionLogic.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php b/app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php index 50b6165f..a8274aea 100644 --- a/app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php +++ b/app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php @@ -25,6 +25,7 @@ use App\Classes\ValueObjects\Constants\SegmentConstants; use App\Classes\ValueObjects\Constants\TransactionDetailType; use App\Models\Document; +use App\Models\PackingList; use App\Models\Transaction; use Carbon\Carbon; use Illuminate\Http\JsonResponse; @@ -114,7 +115,8 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic $state_rate = 0; $state_select = ''; - $base_price = $this->getConstantByKey($base_price_constant, date('Y-m-d')); + $packing_list_drop_date = Carbon::parse(PackingList::where('reference', $packing_list->reference)->where('type', 1)->first()->transports->first()->drop_date)->format('d/m/Y'); + $base_price = $this->getConstantByKey($base_price_constant, $packing_list_drop_date); $warehouseId = $order->orderRoles()->where('role_id', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->company_module_id; $selected_warehouse_rate = $this->getConstantByKey($warehouse_rate_constant, $warehouseId);