Project:
View Issue Details[ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||||||
ID | ||||||||||||
0035773 | ||||||||||||
Type | Category | Severity | Reproducibility | Date Submitted | Last Update | |||||||
feature request | [Openbravo ERP] 09. Financial management | trivial | have not tried | 2017-04-12 14:06 | 2017-04-12 14:07 | |||||||
Reporter | vmromanos | View Status | public | |||||||||
Assigned To | Triage Omni OMS | |||||||||||
Priority | normal | Resolution | open | Fixed in Version | ||||||||
Status | new | Fix in branch | Fixed in SCM revision | |||||||||
Projection | none | ETA | none | Target Version | ||||||||
OS | Any | Database | Any | Java version | ||||||||
OS Version | Database version | Ant version | ||||||||||
Product Version | SCM revision | |||||||||||
Review Assigned To | ||||||||||||
Web browser | ||||||||||||
Modules | Core | |||||||||||
Regression level | ||||||||||||
Regression date | ||||||||||||
Regression introduced in release | ||||||||||||
Regression introduced by commit | ||||||||||||
Triggers an Emergency Pack | No | |||||||||||
Summary | 0035773: Several improvements in FinancialUtils class | |||||||||||
Description | The Taxes Calculation at document level project (0032265) slightly changed the way taxes are calculated to avoid rounding precision issues. Right now the line net amount is calculated from the line gross amount instead of getting the line net price from the line gross amount and then line net amount from line net price. The FinancialUtils.calculateNetFromGross() method was deprecated and a new calculateNetAmtFromGross() was created as part of the project. These two methods are not equivalent, because the first one returns a Price, and the second one returns an Amount, so that usually means that, if you want to get the Price after the refactor, you need to manually divide the Amount by the Quantity (Price = Amount/Quantity). This could create a misunderstanding when refactoring affected code. | |||||||||||
Steps To Reproduce | NA | |||||||||||
Proposed Solution | These are the proposed changes: 1. The Javadoc for FinancialUtils.calculateNetAmtFromGross() method must say "Calculates the net amount using the C_GET_NET_AMOUNT_FROM_GROSS stored procedure" (amount, not unit price). 2. A new method called calculateNetUnitPriceFromGross() must be developed that will be in charge of returning the net unit price. It will receive the same parameters as calculateNetAmtFromGross() and the quantity and price precission. It will call the calculateNetAmtFromGross() and divide the amount by the quantity rounding to the price precision (control divide by 0 scenario). 3. The deprecated info at calculateNetFromGross() method will point to the new method calculateNetUnitPriceFromGross() 4. We will replace the calls to calculateNetAmtFromGross() by the new method calculateNetUnitPriceFromGross() in the places where we are interested in getting the price only. Example of a candidate to change: BigDecimal netAmount = FinancialUtils.calculateNetAmtFromGross(strTaxId, grossAmount, StdPrecision, taxBaseAmt); priceActual = BigDecimal.ZERO; if (qtyInvoice.compareTo(BigDecimal.ZERO) != 0) { priceActual = netAmount.divide(qtyInvoice, PricePrecision, RoundingMode.HALF_UP); } | |||||||||||
Tags | No tags attached. | |||||||||||
Attached Files | ||||||||||||
Relationships [ Relation Graph ] [ Dependency Graph ] | |||||||||||||||
|
Issue History | |||
Date Modified | Username | Field | Change |
2017-04-12 14:06 | vmromanos | New Issue | |
2017-04-12 14:06 | vmromanos | Assigned To | => Triage Finance |
2017-04-12 14:06 | vmromanos | Modules | => Core |
2017-04-12 14:06 | vmromanos | Triggers an Emergency Pack | => No |
2017-04-12 14:07 | vmromanos | Relationship added | related to 0035428 |
2017-04-12 14:07 | vmromanos | Relationship added | related to 0032265 |
Copyright © 2000 - 2009 MantisBT Group |