Fixed: precision issue on the order total paid in the back office

This commit is contained in:
vishalsingh.qlo325
2025-07-01 16:02:04 +05:30
parent 250ff04d5d
commit 7d496c00a9
2 changed files with 6 additions and 6 deletions

View File

@@ -2572,7 +2572,7 @@ class OrderCore extends ObjectModel
if (!empty($item['id_tax_rules_group'])) {
$qty = isset($item['quantity']) ? $item['quantity'] : 0;
$price = isset($item['total_price_tax_excl']) ? $item['total_price_tax_excl'] : 0;
$carry['quantity'] += $qty;
$carry['total_price_tax_excl'] += $price;
}
@@ -2633,7 +2633,7 @@ class OrderCore extends ObjectModel
/*
* This tax recalculation logic is intentionally disabled.
*
*
* Taxes have already been calculated and stored in the `order_detail_tax` table,
* so there is no need to recompute them here.
*
@@ -2665,8 +2665,8 @@ class OrderCore extends ObjectModel
/*
* The following tax adjustment logic was disabled as it is not currently in use.
* It was intended to handle rounding errors in tax and base amounts by spreading
* the discrepancy across order detail tax rows. However, this logic is not required
* It was intended to handle rounding errors in tax and base amounts by spreading
* the discrepancy across order detail tax rows. However, this logic is not required
* due to updated tax calculation and breakdown handling.
*/
@@ -2813,7 +2813,7 @@ class OrderCore extends ObjectModel
$this->id,
0,
isset($product['id']) ? $product['id'] : 0,
isset($product['id_service_product_order_detail']) ? $product['id_service_product_order_detail'] : 0,
isset($product['id_service_product_order_detail']) ? $product['id_service_product_order_detail'] : 0
)) {
$refundDetail = reset($refundDetail);
if ($refundDetail['refunded']) {

View File

@@ -1041,7 +1041,7 @@ class OrderInvoiceCore extends ObjectModel
*/
public function getRestPaid()
{
return round($this->total_paid_tax_incl + $this->getSiblingTotal() - $this->getTotalPaid(), 2);
return Tools::ps_round($this->total_paid_tax_incl + $this->getSiblingTotal() - $this->getTotalPaid(), _PS_PRICE_COMPUTE_PRECISION_);
}
/**