|
dolibarr 25.0.0-alpha
|
Library files with common functions for Assets. More...
Go to the source code of this file.
Functions | |
| assetAdminPrepareHead () | |
| Prepare admin pages header. | |
| assetPrepareHead (Asset $object) | |
| Prepare array of tabs for Asset. | |
| assetModelPrepareHead ($object) | |
| Prepare array of tabs for AssetModel. | |
| getAssetDepreciationDayCountConventions () | |
| Return the list of the day count conventions available to compute the prorata temporis of a depreciation, with their translation key. | |
| getAssetDepreciationDayCountConvention () | |
| Return the day count convention to use to compute the prorata temporis of a depreciation. | |
| getAssetDepreciationPeriodFraction ($timestampStart, $timestampEnd, $convention='', $forcetimezone='') | |
| Return the fraction of a year (the prorata temporis) between two dates, for a given day count convention. | |
| getAssetDepreciationMonthFraction ($timestampStart, $timestampEnd, $convention='', $forcetimezone='') | |
| Return the fraction of a month covered by a period, for the given day count convention. | |
Library files with common functions for Assets.
Definition in file asset.lib.php.
| assetAdminPrepareHead | ( | ) |
Prepare admin pages header.
Definition at line 32 of file asset.lib.php.
References $conf, complete_head_from_modules(), and dolBuildUrl().
| assetModelPrepareHead | ( | $object | ) |
Prepare array of tabs for AssetModel.
| AssetModel | $object | AssetModel |
Definition at line 184 of file asset.lib.php.
References $conf, $object, complete_head_from_modules(), dolBuildUrl(), and getDolGlobalString().
| assetPrepareHead | ( | Asset | $object | ) |
Prepare array of tabs for Asset.
Definition at line 88 of file asset.lib.php.
References $conf, $object, complete_head_from_modules(), Link\count(), dol_dir_list(), dol_sanitizeFileName(), and getDolGlobalString().
| getAssetDepreciationDayCountConvention | ( | ) |
Return the day count convention to use to compute the prorata temporis of a depreciation.
When the new setup ASSET_DEPRECIATION_DAY_COUNT_CONVENTION is not set, the convention is deduced from the deprecated setup ASSET_DEPRECIATION_DURATION_PER_YEAR so that existing installations keep the divisor they were configured with (360 => THIRTY_360, 365 or more => ACT_365).
Definition at line 264 of file asset.lib.php.
References $mysoc, getAssetDepreciationDayCountConventions(), getDolGlobalInt(), and getDolGlobalString().
Referenced by Asset\calculationDepreciation(), getAssetDepreciationMonthFraction(), and getAssetDepreciationPeriodFraction().
| getAssetDepreciationDayCountConventions | ( | ) |
Return the list of the day count conventions available to compute the prorata temporis of a depreciation, with their translation key.
A convention defines both how the days of a partial period are counted and by how many days a full year is divided. Mixing the two (counting real calendar days then dividing by 360) is not a convention, it is a calculation error: it overestimates every partial period by about 1.39%.
Definition at line 246 of file asset.lib.php.
Referenced by getAssetDepreciationDayCountConvention(), getAssetDepreciationMonthFraction(), and getAssetDepreciationPeriodFraction().
| getAssetDepreciationMonthFraction | ( | $timestampStart, | |
| $timestampEnd, | |||
| $convention = '', | |||
| $forcetimezone = '' ) |
Return the fraction of a month covered by a period, for the given day count convention.
The monthly depreciation used to count the real calendar days of the period then divide them by ASSET_DEPRECIATION_DURATION_PER_MONTH, a conventional month of 30 days. Numerator and denominator came from two different systems, so the depreciation of a partial month depended on the length of that month: placed in service on the 3rd, a 31 day month gave 29/30 of the monthly amount while a 30 day month gave 28/30.
| int | $timestampStart | Start of the period |
| int | $timestampEnd | End of the period |
| string | $convention | 'THIRTY_360', 'ACT_365' or 'ACT_ACT'. Empty to use the setup. |
| string | $forcetimezone | '' to use the server timezone, 'gmt' to read the dates in GMT |
Definition at line 356 of file asset.lib.php.
References dol_get_last_day(), dol_getdate(), getAssetDepreciationDayCountConvention(), getAssetDepreciationDayCountConventions(), and num_between_day().
Referenced by Asset\calculationDepreciation().
| getAssetDepreciationPeriodFraction | ( | $timestampStart, | |
| $timestampEnd, | |||
| $convention = '', | |||
| $forcetimezone = '' ) |
Return the fraction of a year (the prorata temporis) between two dates, for a given day count convention.
Both bounds are included, so a period covering a whole standard year returns a value very close to 1 (exactly 1 with THIRTY_360).
WARNING: this function uses the PHP server timezone by default because THIRTY_360 and ACT_ACT work on the calendar representation of the dates. Force $forcetimezone to 'gmt' for UTC timestamps.
| int | $timestampStart | Timestamp of the first day of the period |
| int | $timestampEnd | Timestamp of the last day of the period |
| string | $convention | Day count convention ('' to read the current setup) |
| string | $forcetimezone | '' to use the PHP server timezone, or 'gmt', 'Europe/Paris', ... |
Definition at line 300 of file asset.lib.php.
References dol_getdate(), getAssetDepreciationDayCountConvention(), getAssetDepreciationDayCountConventions(), num_between_day(), num_between_day_30_360(), and num_days_in_year().
Referenced by Asset\calculationDepreciation().