update generate invoice api

This commit is contained in:
edmondlang
2022-05-07 20:08:22 +08:00
parent a30421a3e9
commit 2c2e4eece8
2 changed files with 8 additions and 5 deletions
@@ -117,7 +117,8 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
$base_price = $this->getConstantByKey($base_price_constant, date('Y-m-d'));
$warehouseId = $order->orderRoles()->where('role_id', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->company_module_id;
$warehouse_rate = $this->getConstantByKey($warehouse_rate_constant, $warehouseId)->amount;
$selected_warehouse_rate = $this->getConstantByKey($warehouse_rate_constant, $warehouseId);
$warehouse_rate = $selected_warehouse_rate == 0 ? 0 : $selected_warehouse_rate->amount;
$stateId = $address->state_id;
$state_rate_constant = $this->getConstantByKey($state_rate_constant, $stateId);
@@ -127,7 +128,7 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
$this->checkPostcodeExistInConstant($center_postcode_constant, $postcode) === true ? $state_select = 'center' : '' ;
$this->checkPostcodeExistInConstant($outstation_postcode_constant, $postcode) === true ? $state_select = 'outstation' : '' ;
$state_rate_constant = (array)$state_rate_constant;
$state_rate = $state_rate_constant[$state_select];
$state_rate = $state_select == '' ? 0 : $state_rate_constant[$state_select];
$price_cbm = $base_price + $warehouse_rate + $state_rate;
$total_cbm = $price_cbm * ($cbm + $over_weight_cbm);
@@ -202,9 +203,11 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
}
function checkPostcodeExistInConstant($segmentConstantObject, $postcode) {
if ($segmentConstantObject) {
$segmentConstantObject = $segmentConstantObject->value;
$segmentConstantObject = $segmentConstantObject->value;
if (!empty($segmentConstantObject)) {
return in_array($postcode, $segmentConstantObject);
} else {
return false;
}
}
@@ -89,7 +89,7 @@
},
methods: {
generateInvoice() {
this.submit(this.route('api.transaction.supplier.create'), 'post', '', true, true);
this.submit(this.route('api.transaction.supplier.create'), 'post', this.section, true, true);
},
updateStatus(status){
this.submit(this.route('api.packing_list.status.update', this.item.id, status), 'put', '', true, true)