Author: jleroux
Date: Tue Feb 24 07:01:44 2015 New Revision: 1661854 URL: http://svn.apache.org/r1661854 Log: "Applied fix from trunk for revision: 1661853 " ------------------------------------------------------------------------ r1661853 | jleroux | 2015-02-24 08:00:52 +0100 (mar., 24 févr. 2015) | 5 lines A patch from Pierre Smits for "Quote profit percentage is calculated wrong" https://issues.apache.org/jira/browse/OFBIZ-5858 When reviewing the profit page of a quote the profit percentage is calculated wrong. Instead of dividing the profit by the quote amount giving the margin, the quote amount is divided by the average cost (when provided). Thus giving the quote (amount) to cost ratio. jleroux: there was an interesting discussion with Divesh Dutta who suggested to calculate the profit mark-up instead of the profit margin as done here.I agree we want the profit margin ------------------------------------------------------------------------ Modified: ofbiz/branches/release14.12/ (props changed) ofbiz/branches/release14.12/applications/order/webapp/ordermgr/WEB-INF/actions/quote/ViewQuoteProfit.groovy Propchange: ofbiz/branches/release14.12/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Feb 24 07:01:44 2015 @@ -8,4 +8,4 @@ /ofbiz/branches/json-integration-refactoring:1634077-1635900 /ofbiz/branches/multitenant20100310:921280-927264 /ofbiz/branches/release13.07:1547657 -/ofbiz/trunk:1649393,1649742,1650240,1650583,1650642,1650678,1650882,1650887,1650938,1651593,1652361,1652706,1652725,1652731,1652739,1653248,1653456,1654175,1654273,1654509,1655046,1655668,1655979,1656185,1656198,1656445,1656983,1657323,1657506-1657507,1657514,1657714,1657790,1657848,1658364,1658662,1658882,1659224,1660031,1660053,1660389,1660444,1660579,1661303,1661328,1661778 +/ofbiz/trunk:1649393,1649742,1650240,1650583,1650642,1650678,1650882,1650887,1650938,1651593,1652361,1652706,1652725,1652731,1652739,1653248,1653456,1654175,1654273,1654509,1655046,1655668,1655979,1656185,1656198,1656445,1656983,1657323,1657506-1657507,1657514,1657714,1657790,1657848,1658364,1658662,1658882,1659224,1660031,1660053,1660389,1660444,1660579,1661303,1661328,1661778,1661853 Modified: ofbiz/branches/release14.12/applications/order/webapp/ordermgr/WEB-INF/actions/quote/ViewQuoteProfit.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/order/webapp/ordermgr/WEB-INF/actions/quote/ViewQuoteProfit.groovy?rev=1661854&r1=1661853&r2=1661854&view=diff ============================================================================== --- ofbiz/branches/release14.12/applications/order/webapp/ordermgr/WEB-INF/actions/quote/ViewQuoteProfit.groovy (original) +++ ofbiz/branches/release14.12/applications/order/webapp/ordermgr/WEB-INF/actions/quote/ViewQuoteProfit.groovy Tue Feb 24 07:01:44 2015 @@ -69,7 +69,7 @@ quoteItems.each { quoteItem -> Debug.logError("Problems getting the averageCost for quoteItem: " + quoteItem); } profit = unitPrice - averageCost; - percProfit = averageCost != 0 ? (unitPrice / averageCost) * 100.00 : 0.00; + percProfit = averageCost != 0 ? (profit / unitPrice) * 100.00 : 0.00; quoteItemAndCostInfo = new java.util.HashMap(quoteItem); quoteItemAndCostInfo.averageCost = averageCost; quoteItemAndCostInfo.profit = profit; @@ -85,4 +85,4 @@ context.quoteItemAndCostInfos = quoteIte context.totalCost = totalCost; context.totalPrice = totalPrice; context.totalProfit = totalProfit; -context.totalPercProfit = totalCost != 0 ? (totalPrice / totalCost) * 100.00: 0.00; +context.totalPercProfit = totalCost != 0 ? (totalProfit / totalPrice) * 100.00: 0.00; |
Free forum by Nabble | Edit this page |