修改科学计算字符类型

This commit is contained in:
2024-05-08 11:59:47 +08:00
parent 39a71a53e4
commit 3c22c9444b
6 changed files with 55 additions and 48 deletions
+5 -5
View File
@@ -225,13 +225,13 @@ class DoctorAccountService extends BaseService
(string)$order_service_package_detail['service_count'],
2
),
0.75,
"0.75",
2
);
}else{
$result['estimate_income'] = bcmul(
(string)$order_service_package_detail['service_price'],
0.75,
"0.75",
2
);
}
@@ -344,9 +344,9 @@ class DoctorAccountService extends BaseService
// 计算医生个人所得税
$income_tax = $this->computeIndividualIncomeTax($amount_total);
$withdrawal_amount = bcsub($amount_total, $income_tax, 2);
$withdrawal_amount = bcsub((string)$amount_total, (string)$income_tax, 2);
$income_tax = bcmul($income_tax, 1, 2);
$income_tax = bcmul((string)$income_tax, 1, 2);
$result = array();
$result['bank'] = $bank; //银行数据
@@ -673,7 +673,7 @@ class DoctorAccountService extends BaseService
}
// 提现金额
$amount_total = bcmul((string)$amount_total,0.75,2);
$amount_total = bcmul((string)$amount_total,"0.75",2);
// 计算医生个人所得税
$income_tax = $this->computeIndividualIncomeTax($amount_total);
+5 -5
View File
@@ -1098,11 +1098,11 @@ class OrderService extends BaseService
if ($order['order_type'] == 1){
$expected_amount_total = bcmul(
bcsub(
$order['amount_total'],
$refund_total,
(string)$order['amount_total'],
(string)$refund_total,
3
),
0.75,
"0.75",
2
);
}
@@ -1120,10 +1120,10 @@ class OrderService extends BaseService
(string)$order_service_package_detail['single_inquiry_price'],
3
),
$refund_total,
(string)$refund_total,
3
),
0.75,
"0.75",
2
);
}
+28 -28
View File
@@ -1593,12 +1593,12 @@ class PatientOrderService extends BaseService
$actual_product_price = bcadd(
bcmul(
35,
$product_datas[$key]['used_quantity'],
(string)$product_datas[$key]['used_quantity'],
2
),
bcmul(
$product_datas[$key]['product_price'],
$product_datas[$key]['actual_quantity'],
(string)$product_datas[$key]['product_price'],
(string)$product_datas[$key]['actual_quantity'],
2
),
2
@@ -1608,8 +1608,8 @@ class PatientOrderService extends BaseService
$payment_amount_total = bcadd(
$payment_amount_total,
bcmul(
$product_datas[$key]['product_price'],
$product_datas[$key]['actual_quantity'],
(string)$product_datas[$key]['product_price'],
(string)$product_datas[$key]['actual_quantity'],
2
),
2
@@ -1618,8 +1618,8 @@ class PatientOrderService extends BaseService
// 此处重新计算药品总金额
$amount_total = bcadd(
$amount_total,
$actual_product_price,
(string)$amount_total,
(string)$actual_product_price,
2
);
@@ -1627,8 +1627,8 @@ class PatientOrderService extends BaseService
$discount_amount = bcadd(
$discount_amount,
bcmul(
$product_datas[$key]['discount_amount'],
$product_datas[$key]['used_quantity'],
(string)$product_datas[$key]['discount_amount'],
(string)$product_datas[$key]['used_quantity'],
2
),
2
@@ -1638,8 +1638,8 @@ class PatientOrderService extends BaseService
$freight_calculation_amount = bcadd(
$freight_calculation_amount,
bcmul(
$product_datas[$key]['product_price'],
$product_datas[$key]['product_num'],
(string)$product_datas[$key]['product_price'],
(string)$product_datas[$key]['product_num'],
2
),
2
@@ -1673,8 +1673,8 @@ class PatientOrderService extends BaseService
// 实际支付金额=商品总金额-优惠卷金额+运费金额
$payment_amount_total = bcadd(
bcsub(
$payment_amount_total,
$coupon_amount_total,
(string)$payment_amount_total,
(string)$coupon_amount_total,
2
),
$logistics_fee,
@@ -1773,7 +1773,7 @@ class PatientOrderService extends BaseService
$data['order_prescription_id'] = $order_prescription['order_prescription_id'];
$data['product_id'] = $product_data['product_id'];
$data['product_name'] = $product_data['product_name'];
$data['product_price'] = bcmul($product_data['product_price'], $product_data['actual_quantity'], 3);
$data['product_price'] = bcmul((string)$product_data['product_price'], (string)$product_data['actual_quantity'], 3);
$data['product_platform_code'] = $product_data['product_platform_code'];
$data['amount'] = $product_data['product_num'];
$data['manufacturer'] = $product_data['manufacturer'];
@@ -2206,12 +2206,12 @@ class PatientOrderService extends BaseService
$actual_product_price = bcadd(
bcmul(
35,
$product_data['used_quantity'],
(string)$product_data['used_quantity'],
2
),
bcmul(
$product_data['product_price'],
$product_data['actual_quantity'],
(string)$product_data['product_price'],
(string)$product_data['actual_quantity'],
2
),
2
@@ -2219,10 +2219,10 @@ class PatientOrderService extends BaseService
// 此处重新计算药品支付金额
$payment_amount_total = bcadd(
$payment_amount_total,
(string)$payment_amount_total,
bcmul(
$product_data['product_price'],
$product_data['actual_quantity'],
(string)$product_data['product_price'],
(string)$product_data['actual_quantity'],
2
),
2
@@ -2231,24 +2231,24 @@ class PatientOrderService extends BaseService
// 此处重新计算药品总金额
$amount_total = bcadd(
$amount_total,
$actual_product_price,
(string)$amount_total,
(string)$actual_product_price,
2
);
// 此处重新计算药品优惠金额
$discount_amount = bcadd(
$discount_amount,
$product_data['discount_amount'],
(string)$discount_amount,
(string)$product_data['discount_amount'],
2
);
// 此处计算药品总金额-计算运费使用
$freight_calculation_amount = bcadd(
$freight_calculation_amount,
(string)$freight_calculation_amount,
bcmul(
$product_data['product_price'],
$product_data['product_num'],
(string)$product_data['product_price'],
(string)$product_data['product_num'],
2
),
2
@@ -2274,7 +2274,7 @@ class PatientOrderService extends BaseService
}
// 实际支付金额=商品总金额-优惠卷金额+运费金额
$payment_amount_total = bcadd(bcsub($payment_amount_total, $coupon_amount_total, 2), $logistics_fee, 2);
$payment_amount_total = bcadd(bcsub((string)$payment_amount_total, (string)$coupon_amount_total, 2), (string)$logistics_fee, 2);
// 药品优惠金额
$discount_amount = $discount_amount + $coupon_amount_total;
+8 -6
View File
@@ -388,10 +388,11 @@ class UserCouponService extends BaseService
continue;
}
$product_price = bcadd($product_price,
$product_price = bcadd(
(string)$product_price,
bcmul( // 商品价格*实际数量数量
$coupon_product_data['product_price'],
$coupon_product_data['actual_quantity'],
(string)$coupon_product_data['product_price'],
(string)$coupon_product_data['actual_quantity'],
2
),
2
@@ -403,10 +404,11 @@ class UserCouponService extends BaseService
if ($coupon['application_scope'] == 1 || $coupon['application_scope'] == 6){
foreach ($coupon_product_datas as $coupon_product_data){
// 计算商品总金额
$product_price = bcadd($product_price,
$product_price = bcadd(
(string)$product_price,
bcmul( // 商品价格*数量
$coupon_product_data['product_price'],
$coupon_product_data['actual_quantity'],
(string)$coupon_product_data['product_price'],
(string)$coupon_product_data['actual_quantity'],
2
),
2