update base price according to packlinglist drop date

This commit is contained in:
edmondlang
2022-07-31 22:08:48 +08:00
parent 2a0501ad99
commit ff68ee76ab
@@ -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);