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
This commit is contained in:
Pichi1966 2024-10-29 17:31:38 +01:00 committed by GitHub
parent 4cc5eb4dce
commit d2316eb6e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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');