From d2316eb6e1a7600f9978cbd87cc3c69ec22fc5dd Mon Sep 17 00:00:00 2001 From: Pichi1966 <57623859+josett225@users.noreply.github.com> Date: Tue, 29 Oct 2024 17:31:38 +0100 Subject: [PATCH] NEW Const ASSET_ROUND_INTEGER_NUMBER_UPWARDS for ASSET Module. Compatibily to migrate from other accounting solutions. (#31615) * NEW CONST ASSET_ROUND_INTEGER_NUMBER_UPWARDS New CONST ASSET_ROUND_INTEGER_NUMBER_UPWARDS During several months, we worked with 3 accounting experts in migrating from Quadratus to Dolibarr several assets.(more than 200). We compared all of them ot get same result in Dolibarr. During this test we discoverd that Quadratus has an option to round upwards all the calculated asset values (less the last one). With this const and the code attach we get same result. This is really helpful to migration and also clarity in the lines. Update asset.class.php Round upwards AssetCalculationThis new CONSTUpdate asset.class.php Round upwards AssetCalculation * Update asset.class.php --- htdocs/asset/class/asset.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index fc5c9324121..37a4203b8c9 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -1113,6 +1113,11 @@ class Asset extends CommonObject $nb_days = min($nb_days_in_year, num_between_day($begin_date, $end_date, 1)); $depreciation_ht = (float) price2num($period_amount * $nb_days / $nb_days_in_year, 'MT'); } + if (getDolGlobalInt('ASSET_ROUND_INTEGER_NUMBER_UPWARDS') == 1) { + if ($idx_loop < $max_loop) { // avoid last depreciation value + $depreciation_ht = ceil($depreciation_ht); + } + } if ($fiscal_period_start <= $depreciation_date_end && $depreciation_date_end <= $fiscal_period_end) { // last period $depreciation_ht = (float) price2num($depreciation_amount - (float) $cumulative_depreciation_ht, 'MT');