Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0018612Openbravo ERP09. Financial managementpublic2011-09-26 13:462011-12-01 18:17
mirurita 
ioritzCia 
normalminoralways
closedfixed 
5
 
3.0MP6 
Core
No
0018612: Assets - create amortization process not calculating properly percetages/amounts
When defining a linear depreciation type with percentage and the start date is not the first day of the year (01-01-YYYY) the amounts and percentages are not properly calculated.
1) Go to Assets window
2) Create new Asset
 - Search Key: XX
 - Name: XX
 - Asset Category: Buildings
 - Depreciate: Yes
 - Depreciation Type: Linear
 - Calculate Type: Percentage
 - Annual Depreciation %: 50
 - Purchase Date: 29-01-2010
 - Depreciation Start Date: 29-01-2010
 - Asset Value: 41064
 - Depreciation Amt.: 41064
 - Residual Asset Value: 0
 - Previously Depreciated Amt: 0
3) Click on 'Create Amortization' button
4) See the Asset Amortization tab

2010 - 46.15 % - 18952.62
2011 - 50 % - 20532
2012 - 3.85 % - 1579.38

when it should be

2010 - 46.03 % - 18900.69
2011 - 50 % - 20532
2012 - 3.97 % - 1631.31
SELECT TO_DATE('31-12-2010', 'DD-MM-YYYY') - TO_DATE('01-01-2010', 'DD-MM-YYYY')
from dual;
-- returns 364

Number of days of the year:

SELECT TO_DATE('01-01-2011', 'DD-MM-YYYY') - TO_DATE('01-01-2010', 'DD-MM-YYYY')
from dual;
-- returns 365

Change Line 215
v_Percentage:=to_number(to_number(TO_DATE('31-12-'||to_char(v_AMORTIZATIONSTARTDATE, 'YYYY'), 'DD-MM-YYYY') -v_AMORTIZATIONSTARTDATE) / (TO_DATE('01-01-'||to_char(to_number(to_char(v_AMORTIZATIONSTARTDATE, 'YYYY')) + 1), 'DD-MM-YYYY') -TO_DATE('01-01-'||to_char(v_AMORTIZATIONSTARTDATE, 'YYYY'), 'DD-MM-YYYY'))) * v_PercentageGeneral;
No tags attached.
png Asset - create amortization.png (91,944) 2011-09-26 13:46
https://issues.openbravo.com/file_download.php?file_id=4592&type=bug
png
Issue History
2011-09-26 13:46miruritaNew Issue
2011-09-26 13:46miruritaAssigned To => jonalegriaesarte
2011-09-26 13:46miruritaFile Added: Asset - create amortization.png
2011-09-26 13:46miruritaModules => Core
2011-09-26 13:46miruritaResolution time => 1322694000
2011-09-26 16:09miruritaTarget Version => 3.0MP6
2011-09-26 17:22miruritaProposed Solution updated
2011-11-17 16:08jonalegriaesarteAssigned Tojonalegriaesarte => ioritzCia
2011-11-24 10:34hgbotCheckin
2011-11-24 10:34hgbotNote Added: 0043141
2011-11-24 10:34hgbotStatusnew => resolved
2011-11-24 10:34hgbotResolutionopen => fixed
2011-11-24 10:34hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/45ee9420aa7bfe4d415e84edfcab146aa0432c65 [^]
2011-11-24 13:28ioritzCiaNote Added: 0043158
2011-11-30 12:29hudsonbotCheckin
2011-11-30 12:29hudsonbotNote Added: 0043434
2011-12-01 18:17miruritaNote Added: 0043660
2011-12-01 18:17miruritaStatusresolved => closed

Notes
(0043141)
hgbot   
2011-11-24 10:34   
Repository: erp/devel/pi
Changeset: 45ee9420aa7bfe4d415e84edfcab146aa0432c65
Author: Ioritz Cia <ioritz.cia <at> openbravo.com>
Date: Tue Nov 22 11:54:06 2011 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/45ee9420aa7bfe4d415e84edfcab146aa0432c65 [^]

Fixes issue 18612: Assets - create amortization process
not calculating properly percetages/amounts.

---
M src-db/database/model/functions/A_ASSET_POST.xml
---
(0043158)
ioritzCia   
2011-11-24 13:28   
Test Plan:

- Follow the steps to reproduce.
- Try with other quantities and dates, insist on border dates as the first and the last days of the month and the dates around that ones.
- Check that the percentage lost in the roundings gets recovered in the line of the last amortization.
(0043434)
hudsonbot   
2011-11-30 12:29   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/01809c7b3135 [^]

Maturity status: Test
(0043660)
mirurita   
2011-12-01 18:17   
Verified on revision 14787:d63e0b9b9bcc