From d663dc2ea46b566400a5cba0b5971e183234e237 Mon Sep 17 00:00:00 2001
From: atm-adrien <67913809+atm-adrien@users.noreply.github.com>
Date: Mon, 22 Apr 2024 16:29:02 +0200
Subject: [PATCH] FIX : No decimals in result.php (#29377)
* FIX : No decimals in result.php
* FIX : PR returns
---
htdocs/compta/resultat/result.php | 55 +++++++++++++++++++++++++------
1 file changed, 45 insertions(+), 10 deletions(-)
diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php
index daa017a0130..6ced467dbfa 100644
--- a/htdocs/compta/resultat/result.php
+++ b/htdocs/compta/resultat/result.php
@@ -354,7 +354,11 @@ if ($modecompta == 'CREANCES-DETTES') {
//$r = $AccCat->calculate($result);
$r = (float) dol_eval($result, 1, 1, '1');
- print '
'.price($r).' | ';
+ if (getDolGlobalInt('ACCOUNTANCY_TRUNC_DECIMAL_ON_BALANCE_REPORT')) {
+ print ''.price($r, 0, '', 1, 0, 0).' | ';
+ } else {
+ print ''.price($r).' | ';
+ }
}
if (!isset($sommes[$code])) {
@@ -381,7 +385,11 @@ if ($modecompta == 'CREANCES-DETTES') {
//$r = $AccCat->calculate($result);
$r = (float) dol_eval($result, 1, 1, '1');
- print ''.price($r).' | ';
+ if (getDolGlobalInt('ACCOUNTANCY_TRUNC_DECIMAL_ON_BALANCE_REPORT')) {
+ print ''.price($r, 0, '', 1, 0, 0).' | ';
+ } else {
+ print ''.price($r).' | ';
+ }
if (empty($sommes[$code]['N'])) {
$sommes[$code]['N'] = $r;
} else {
@@ -400,7 +408,12 @@ if ($modecompta == 'CREANCES-DETTES') {
//$r = $AccCat->calculate($result);
$r = (float) dol_eval($result, 1, 1, '1');
- print ''.price($r).' | ';
+
+ if (getDolGlobalInt('ACCOUNTANCY_TRUNC_DECIMAL_ON_BALANCE_REPORT')) {
+ print ''.price($r, 0, '', 1, 0, 0).' | ';
+ } else {
+ print ''.price($r).' | ';
+ }
if (empty($sommes[$code]['M'][$k])) {
$sommes[$code]['M'][$k] = $r;
} else {
@@ -420,7 +433,11 @@ if ($modecompta == 'CREANCES-DETTES') {
//$r = $AccCat->calculate($result);
$r = (float) dol_eval($result, 1, 1, '1');
- print ''.price($r).' | ';
+ if (getDolGlobalInt('ACCOUNTANCY_TRUNC_DECIMAL_ON_BALANCE_REPORT')) {
+ print ''.price($r, 0, '', 1, 0, 0).' | ';
+ } else {
+ print ''.price($r).' | ';
+ }
if (empty($sommes[$code]['M'][$k])) {
$sommes[$code]['M'][$k] = $r;
} else {
@@ -581,18 +598,31 @@ if ($modecompta == 'CREANCES-DETTES') {
print $labeltoshow;
print '';
- print ''.price($totCat['NP']).' | ';
- print ''.price($totCat['N']).' | ';
+ if (getDolGlobalInt('ACCOUNTANCY_TRUNC_DECIMAL_ON_BALANCE_REPORT')) {
+ print ''.price($totCat['NP'], 0, '', 1, 0, 0).' | ';
+ print ''.price($totCat['N'], 0, '', 1, 0, 0).' | ';
+ } else {
+ print ''.price($totCat['NP']).' | ';
+ print ''.price($totCat['N']).' | ';
+ }
// Each month
foreach ($totCat['M'] as $k => $v) {
if (($k + 1) >= $date_startmonth && $k < $date_endmonth) {
- print ''.price($v).' | ';
+ if (getDolGlobalInt('ACCOUNTANCY_TRUNC_DECIMAL_ON_BALANCE_REPORT')) {
+ print ''.price($v, 0, '', 1, 0, 0).' | ';
+ } else {
+ print ''.price($v).' | ';
+ }
}
}
foreach ($totCat['M'] as $k => $v) {
if (($k + 1) < $date_startmonth) {
- print ''.price($v).' | ';
+ if (getDolGlobalInt('ACCOUNTANCY_TRUNC_DECIMAL_ON_BALANCE_REPORT')) {
+ print ''.price($v, 0, '', 1, 0, 0).' | ';
+ } else {
+ print ''.price($v).' | ';
+ }
}
}
@@ -622,8 +652,13 @@ if ($modecompta == 'CREANCES-DETTES') {
print '';
print dol_escape_htmltag($labeldetail);
print ' | ';
- print ''.price($resultNP).' | ';
- print ''.price($resultN).' | ';
+ if (getDolGlobalInt('ACCOUNTANCY_TRUNC_DECIMAL_ON_BALANCE_REPORT')) {
+ print ''.price($resultNP, 0, '', 1, 0, 0).' | ';
+ print ''.price($resultN, 0, '', 1, 0, 0).' | ';
+ } else {
+ print ''.price($resultNP).' | ';
+ print ''.price($resultN).' | ';
+ }
// Make one call for each month
foreach ($months as $k => $v) {