修改创建药品订单+支付页数据的药品价格计算
This commit is contained in:
parent
1671fcac2f
commit
7000436312
@ -1505,6 +1505,7 @@ class PatientOrderService extends BaseService
|
|||||||
// 商品数据
|
// 商品数据
|
||||||
$product['product_num'] = $order_prescription_product['prescription_product_num'];
|
$product['product_num'] = $order_prescription_product['prescription_product_num'];
|
||||||
$product['used_quantity'] = 0; // 健康包服务下已使用赠送药品的数量,默认赋0
|
$product['used_quantity'] = 0; // 健康包服务下已使用赠送药品的数量,默认赋0
|
||||||
|
$product['actual_quantity'] = $order_prescription_product['prescription_product_num']; // 实际药品数量 = 处方数量 - 健康包可使用的赠送药品数量
|
||||||
$product_data = $product->toArray();
|
$product_data = $product->toArray();
|
||||||
$product_datas[] = $product_data;
|
$product_datas[] = $product_data;
|
||||||
}
|
}
|
||||||
@ -1550,9 +1551,15 @@ class PatientOrderService extends BaseService
|
|||||||
|
|
||||||
// 已使用数量 = 原数量+此次使用数量
|
// 已使用数量 = 原数量+此次使用数量
|
||||||
$product_datas[$key]['used_quantity'] = $product_data['product_num'];
|
$product_datas[$key]['used_quantity'] = $product_data['product_num'];
|
||||||
|
|
||||||
|
// 实际药品数量 = 处方数量 - 健康包可使用的赠送药品数量
|
||||||
|
$product_data['actual_quantity'] = 0;
|
||||||
} else {
|
} else {
|
||||||
// 已使用数量 = 最大可用数量;表示此服务包商品已使用完毕
|
// 已使用数量 = 最大可用数量;表示此服务包商品已使用完毕
|
||||||
$product_datas[$key]['used_quantity'] = $remaining_quantity;
|
$product_datas[$key]['used_quantity'] = $remaining_quantity;
|
||||||
|
|
||||||
|
// 实际药品数量 = 处方数量 - 健康包可使用的赠送药品数量
|
||||||
|
$product_data[$key]['actual_quantity'] = $product_data['product_num'] - $remaining_quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 此处重新计算药品总金额
|
// 此处重新计算药品总金额
|
||||||
@ -1560,7 +1567,7 @@ class PatientOrderService extends BaseService
|
|||||||
$amount_total,
|
$amount_total,
|
||||||
bcmul(
|
bcmul(
|
||||||
$product_datas[$key]['product_price'],
|
$product_datas[$key]['product_price'],
|
||||||
$product_data['product_num'],
|
$product_data['actual_quantity'],
|
||||||
2
|
2
|
||||||
),
|
),
|
||||||
2
|
2
|
||||||
@ -1693,7 +1700,7 @@ class PatientOrderService extends BaseService
|
|||||||
$data['order_prescription_id'] = $order_prescription['order_prescription_id'];
|
$data['order_prescription_id'] = $order_prescription['order_prescription_id'];
|
||||||
$data['product_id'] = $product_data['product_id'];
|
$data['product_id'] = $product_data['product_id'];
|
||||||
$data['product_name'] = $product_data['product_name'];
|
$data['product_name'] = $product_data['product_name'];
|
||||||
$data['product_price'] = bcmul($product_data['product_price'],$product_data['product_num'],3);
|
$data['product_price'] = bcmul($product_data['product_price'], $product_data['actual_quantity'], 3);
|
||||||
$data['product_platform_code'] = $product_data['product_platform_code'];
|
$data['product_platform_code'] = $product_data['product_platform_code'];
|
||||||
$data['amount'] = $product_data['product_num'];
|
$data['amount'] = $product_data['product_num'];
|
||||||
$data['manufacturer'] = $product_data['manufacturer'];
|
$data['manufacturer'] = $product_data['manufacturer'];
|
||||||
@ -2047,6 +2054,8 @@ class PatientOrderService extends BaseService
|
|||||||
|
|
||||||
// 处方药品数据
|
// 处方药品数据
|
||||||
$product['product_num'] = $order_prescription_product['prescription_product_num'];
|
$product['product_num'] = $order_prescription_product['prescription_product_num'];
|
||||||
|
$product['used_quantity'] = 0; // 已使用数量
|
||||||
|
$product['actual_quantity'] = $order_prescription_product['prescription_product_num']; // 实际药品数量 = 处方数量 - 健康包可使用的赠送药品数量
|
||||||
$product_data = $product->toArray();
|
$product_data = $product->toArray();
|
||||||
$product_datas[] = $product_data;
|
$product_datas[] = $product_data;
|
||||||
}
|
}
|
||||||
@ -2082,6 +2091,18 @@ class PatientOrderService extends BaseService
|
|||||||
if ($remaining_quantity >= $product_data['product_num']) {
|
if ($remaining_quantity >= $product_data['product_num']) {
|
||||||
// 把商品价格置为0。金额按照0计算
|
// 把商品价格置为0。金额按照0计算
|
||||||
$product_data['product_price'] = 0;
|
$product_data['product_price'] = 0;
|
||||||
|
|
||||||
|
// 已使用数量 = 原数量+此次使用数量
|
||||||
|
$product_data['used_quantity'] = $product_data['product_num'];
|
||||||
|
|
||||||
|
// 实际药品数量 = 处方数量 - 健康包可使用的赠送药品数量
|
||||||
|
$product_data['actual_quantity'] = 0;
|
||||||
|
} else {
|
||||||
|
// 已使用数量 = 最大可用数量;表示此服务包商品已使用完毕
|
||||||
|
$product_data['used_quantity'] = $remaining_quantity;
|
||||||
|
|
||||||
|
// 实际药品数量 = 处方数量 - 健康包可使用的赠送药品数量
|
||||||
|
$product_data['actual_quantity'] = $product_data['product_num'] - $remaining_quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 此处重新计算药品总金额
|
// 此处重新计算药品总金额
|
||||||
@ -2089,7 +2110,7 @@ class PatientOrderService extends BaseService
|
|||||||
$amount_total,
|
$amount_total,
|
||||||
bcmul(
|
bcmul(
|
||||||
$product_data['product_price'],
|
$product_data['product_price'],
|
||||||
$product_data['product_num'],
|
$product_data['actual_quantity'],
|
||||||
2
|
2
|
||||||
),
|
),
|
||||||
2
|
2
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user