Openbravo Issue Tracking System - Modules
View Issue Details
0013984ModulesAccruals and Deferralspublic2010-07-16 16:192010-09-10 19:08
networkb 
vmromanos 
immediateminoralways
closedfixed 
5
2.50 
2.501.0.10 
0013984: Wrong amounts when generating accruals and deferrals plan using Daily calculation and starting at the middle of the month
Wrong amounts when generating accruals and deferrals plan using Daily calculation and starting at the middle of the month.
1. Install Accruals and Deferrals module, version 1.0.5
2. Go to General Setup || Client || Client || Client >> Information : set calculation=dalily
3. Procurement Management || Transactions || Purchase Invoice: create header for
  BP=mcgiver
  document=AP Invoice
  Invoice Date =Accounting Date =Tax Date=15/07/2010
  Acc Def Type = Prepaid expenses
  Date from=15/07/2010 Date To = 14/07/2011
4. Procurement Management || Transactions || Purchase Invoice || Header >> Lines: create record for Hat and Total Line Amount=1200

(Psanjuan= it is required to add here that Tax Rate must be exempt so the system only takes into account an amount = 1.200)

5. Go back to header and complete
6. Go to Procurement Management || Transactions || Purchase Invoice || Header >> Accruals and Deferrals Plan and realize that the amount of the first and the last month are the same as the rest of months.


In the current version, there is an error, because the first and the last month are calculated with all days, e.g. date from = 15.7. => 31 days for July and this is false
if it is calculated on a daily basis, the exact number of days in a month should be calculated: June = 30, July = 31 etc and take that into account as well for the Date From and Date To
In the scenario above it should be:
15 for the firt period
14 for the last one

Proposed Solution dated on August 31st:

For daily calculation this is the way it should work.
(1) There are no constrains in relation to Periods. End-use can enter whatever "Date From" and whatever "Date To" no restrictions but the proper ones for Acc&Def functionality. Period range should be at least 1 year.
(2) For each month count we need to take into account the number of calendar days each month has (31,30,28..)
(3) Monthly amount formula is = Line Net Amount * Number of days in the month/Total number of days between the two dates (Date From and Date To)

Example:
Accounting date = 12-06-2010
Date From = 12-06-2010
Date To = 20-05-2011
Line Net Amount = 8000,00

Total number of days= 343
June 2010 = 30-12+1 = 19
July 2010 = 31
August 2010 = 31
September 2010 = 30
October 2010 = 31
November 2010 = 30
December 2010 = 31
January 2011 = 31
February 2011 = 28
March 2011 = 31
April 2011 = 30
May 2011 = 20

Monthly amount:
June 2010 = 8000*19/343=443.15
July 2010 = 8000*31/343=723,03
August 2010 = 8000*31/343=723,03
September 2010 = 8000*30/343=699,71
October 2010 = 8000*31/343=723,03
November 2010 = 8000*30/343=699,71
December 2010 = 8000*31/343=723,03
January 2011 = 8000*31/343=723,03
February 2011 = 8000*28/343=653.06
March 2011 = 8000*31/343=723,03
April 2011 = 8000*30/343=699,71
May 2011 = 8000*20/343=466,47
total=8000







No tags attached.
png 13984.png (69,718) 2010-08-31 13:17
https://issues.openbravo.com/file_download.php?file_id=3003&type=bug
png

png 13984_1.png (40,082) 2010-08-31 13:17
https://issues.openbravo.com/file_download.php?file_id=3004&type=bug
png
Issue History
2010-07-16 16:19networkbNew Issue
2010-07-16 16:19networkbAssigned To => sathiyan
2010-07-16 17:08rafarodaIssue Monitored: rafaroda
2010-07-16 17:14psanjuanProposed Solution updated
2010-08-03 08:13hgbotCheckin
2010-08-03 08:13hgbotNote Added: 0029760
2010-08-03 08:13hgbotStatusnew => resolved
2010-08-03 08:13hgbotResolutionopen => fixed
2010-08-03 08:13hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.accrualsanddeferrals/rev/c4dbe79b947e1c7dc595e14599ebdbae2fdfc0c6 [^]
2010-08-27 10:07psanjuanSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=745#r745
2010-08-31 12:31psanjuanStatusresolved => new
2010-08-31 12:31psanjuanDescription Updatedbug_revision_view_page.php?rev_id=784#r784
2010-08-31 12:31psanjuanSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=785#r785
2010-08-31 12:31psanjuanProposed Solution updated
2010-08-31 12:43psanjuanProposed Solution updated
2010-08-31 12:58psanjuanProposed Solution updated
2010-08-31 13:05psanjuanProposed Solution updated
2010-08-31 13:06psanjuanNote Added: 0030539
2010-08-31 13:17psanjuanFile Added: 13984.png
2010-08-31 13:17psanjuanFile Added: 13984_1.png
2010-08-31 13:18psanjuanAssigned Tosathiyan => dalsasua
2010-08-31 13:29psanjuanProposed Solution updated
2010-09-08 13:51psanjuanProposed Solution updated
2010-09-08 13:55psanjuanProposed Solution updated
2010-09-09 09:13vmromanosNote Added: 0030879
2010-09-09 09:13vmromanosAssigned Todalsasua => vmromanos
2010-09-09 09:13vmromanosStatusnew => scheduled
2010-09-09 09:13vmromanosfix_in_branch => pi
2010-09-09 09:21psanjuanNote Added: 0030881
2010-09-09 09:21psanjuanfix_in_branchpi =>
2010-09-09 09:21psanjuanProposed Solution updated
2010-09-09 09:24psanjuanNote Added: 0030882
2010-09-09 10:06hgbotCheckin
2010-09-09 10:06hgbotNote Added: 0030885
2010-09-09 10:06hgbotStatusscheduled => resolved
2010-09-09 10:06hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.accrualsanddeferrals/rev/c4dbe79b947e1c7dc595e14599ebdbae2fdfc0c6 [^] => http://code.openbravo.com/erp/pmods/org.openbravo.accrualsanddeferrals/rev/9a85f7e12ab00d68d0b5fb9ac97d1fea5e1f0380 [^]
2010-09-10 18:52psanjuanNote Added: 0030949
2010-09-10 18:52psanjuanStatusresolved => closed
2010-09-10 19:08psanjuanFixed in Version => 1.0.10

Notes
(0029760)
hgbot   
2010-08-03 08:13   
Repository: erp/pmods/org.openbravo.accrualsanddeferrals
Changeset: c4dbe79b947e1c7dc595e14599ebdbae2fdfc0c6
Author: Sathiyan Sivaprakasam <sathiyan.sivaprakasam <at> openbravo.com>
Date: Tue Aug 03 11:42:21 2010 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.accrualsanddeferrals/rev/c4dbe79b947e1c7dc595e14599ebdbae2fdfc0c6 [^]

Fixes Issue 13984: Wrong amounts when generating acc. and def. plan using Daily calculation

---
M src-db/database/model/functions/ACCDEF_GENERATE_PLAN.xml
---
(0030539)
psanjuan   
2010-08-31 13:06   
In case of rounding issues please ask as we need to decide those will be added to the first or the last month.

See screen attached in order to see current wrong behaviour.
(0030879)
vmromanos   
2010-09-09 09:13   
Hi Patricia,

There are two wrong things in the proposed solution:

February 2011 = 8000*28/343= 653.06

May 2011 = it's the last month so we must compensate the deviation due to the rounding in the previous months. So the amount should be 466.48. This way the sum of the months is equal to the grand total.

Regards.
(0030881)
psanjuan   
2010-09-09 09:21   
That's right Victor.
February amount was not OK, I realize about that. Now it is fixed.
Regarding rounding - that's right as well. I already mentioned that in a note.
Let's add rounding differences to the last month. I'll get confirmation from our customer.
(0030882)
psanjuan   
2010-09-09 09:24   
Confirmed - rounding differences should be allocated to the last month.
Thanks.
(0030885)
hgbot   
2010-09-09 10:06   
Repository: erp/pmods/org.openbravo.accrualsanddeferrals
Changeset: 9a85f7e12ab00d68d0b5fb9ac97d1fea5e1f0380
Author: Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
Date: Thu Sep 09 10:08:05 2010 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.accrualsanddeferrals/rev/9a85f7e12ab00d68d0b5fb9ac97d1fea5e1f0380 [^]

Fixed bug 13984 in module version 1.0.10
Indent ACCDEF_GENERATE_PLAN code
Refactor code to improve performance and quality
Fixed Daily calculation method
Fixed rounding issues

---
M src-db/database/model/functions/ACCDEF_GENERATE_PLAN.xml
M src-db/database/sourcedata/AD_MODULE.xml
---
(0030949)
psanjuan   
2010-09-10 18:52   
fixed in version 1.0.10