|
Author: jleroux
Date: Tue Jan 11 10:41:48 2011 New Revision: 1057571 URL: http://svn.apache.org/viewvc?rev=1057571&view=rev Log: A patch from Jonas Hoef "add taxPercentage and taxTotal member variables to ShoppingCartItem to ease tax calculation and display" (https://issues.apache.org/jira/browse/OFBIZ-4104) - OFBIZ-4104 Legal requirements in Germany mandate that tax-information is displayed for each shopping cart item. This is supported by the proposed improvement. JLR: only the fields and getters are provided in this patch, no UI changes Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=1057571&r1=1057570&r2=1057571&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java Tue Jan 11 10:41:48 2011 @@ -110,6 +110,8 @@ public class ShoppingCartItem implements private BigDecimal displayPrice = null; private BigDecimal recurringBasePrice = null; private BigDecimal recurringDisplayPrice = null; + private BigDecimal taxTotal = null; + private BigDecimal taxPercentage = null; /** comes from price calc, used for special promo price promotion action */ private BigDecimal specialPromoPrice = null; /** for reservations: extra % 2nd person */ @@ -1206,6 +1208,14 @@ public class ShoppingCartItem implements if (priceResult.get("specialPromoPrice") != null) { this.setSpecialPromoPrice(((BigDecimal) priceResult.get("specialPromoPrice")).divide(pieces, decimals, RoundingMode.HALF_UP)); } + + if (priceResult.get("taxTotal") != null) { + this.taxTotal = ((BigDecimal) priceResult.get("taxTotal")).divide(pieces, decimals, RoundingMode.HALF_UP); + } + + if (priceResult.get("taxPercentage") != null) { + this.taxPercentage = ((BigDecimal) priceResult.get("taxPercentage")).divide(pieces, decimals, RoundingMode.HALF_UP); + } }else{ if (priceResult.get("listPrice") != null) { this.listPrice = ((BigDecimal) priceResult.get("listPrice")); @@ -1219,6 +1229,9 @@ public class ShoppingCartItem implements this.setDisplayPrice(((BigDecimal) priceResult.get("price"))); } + taxTotal = (BigDecimal) priceResult.get("taxTotal"); + taxPercentage = (BigDecimal) priceResult.get("taxPercentage"); + this.setSpecialPromoPrice((BigDecimal) priceResult.get("specialPromoPrice")); } @@ -1911,7 +1924,6 @@ public class ShoppingCartItem implements } } - public Map getItemProductInfo() { Map itemInfo = FastMap.newInstance(); itemInfo.put("productId", this.getProductId()); @@ -1998,6 +2010,16 @@ public class ShoppingCartItem implements this.isModifiedPrice = isModifiedPrice; } + /** Get the total taxes */ + public BigDecimal getTaxTotal() { + return taxTotal; + } + + /** Get the percentage tax rate */ + public BigDecimal getTaxPercentage() { + return taxPercentage; + } + /** get the percentage for the second person */ public BigDecimal getReserv2ndPPPerc() { return reserv2ndPPPerc; |
| Free forum by Nabble | Edit this page |
