Fix "Sales percent discount doesn't show up in Journal" (https://issues.apache.org/jira/browse/OFBIZ-1608) - OFBIZ-1608

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk/specialpurpose@628551 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacques Le Roux
2008-02-17 21:23:18 +00:00
parent 3882519745
commit 94431c0c1f
+9 -2
View File
@@ -915,13 +915,20 @@ public class PosTransaction implements Serializable {
Iterator iter = adjustments.iterator();
while(iter.hasNext()){
GenericValue orderAdjustment = (GenericValue) iter.next();
Double amount = orderAdjustment.getDouble("amount");
Double sourcePercentage = orderAdjustment.getDouble("sourcePercentage");
if (UtilValidate.isNotEmpty(sourcePercentage)) {
double percentage = sourcePercentage.doubleValue()/100.0; // sourcePercentage is negative
amount = total / ((1 + percentage) / percentage);
}
XModel adjustmentLine = Journal.appendNode(model, "tr", "adjustment", "");
Journal.appendNode(adjustmentLine, "td", "sku", "");
Journal.appendNode(adjustmentLine, "td", "desc",
UtilProperties.getMessage("pos", "(SalesDiscount)",defaultLocale));
Journal.appendNode(adjustmentLine, "td", "qty", "");
Journal.appendNode(adjustmentLine, "td", "price",
UtilFormatOut.formatPrice(orderAdjustment.getDouble("amount")));
if (UtilValidate.isNotEmpty(amount)) {
Journal.appendNode(adjustmentLine, "td", "price", UtilFormatOut.formatPrice(amount));
}
Journal.appendNode(adjustmentLine, "td", "index", "-1");
}
}