Skip to content

Commit

Permalink
NEW CONST ASSET_ROUND_INTEGER_NUMBER_UPWARDS
Browse files Browse the repository at this point in the history
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
  • Loading branch information
josett225 authored Oct 28, 2024
1 parent b3b8f52 commit 2c624f6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion htdocs/asset/class/asset.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,12 @@ public function calculationDepreciation()
$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);
}
}

Check warning on line 1121 in htdocs/asset/class/asset.class.php

View workflow job for this annotation

GitHub Actions / phan / Run phan

asset.class.php: PhanPluginWhitespaceTrailing: The first occurrence of trailing whitespace was seen here.
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');
$cumulative_depreciation_ht = $depreciation_amount;
Expand Down

0 comments on commit 2c624f6

Please sign in to comment.