IDEMPIERE-2753 Discount is not calculated when Price List Price <1

This commit is contained in:
tsvikruha 2015-09-20 22:30:38 +02:00
parent 632c4c6e2d
commit e38b301b75
2 changed files with 4 additions and 4 deletions

View File

@ -624,7 +624,7 @@ public class CalloutInvoice extends CalloutEngine
// calculate Discount // calculate Discount
else else
{ {
if (PriceList.intValue() == 0) if (PriceList.compareTo(Env.ZERO) == 0)
Discount = Env.ZERO; Discount = Env.ZERO;
else else
Discount = new BigDecimal ((PriceList.doubleValue() - PriceActual.doubleValue()) / PriceList.doubleValue() * 100.0); Discount = new BigDecimal ((PriceList.doubleValue() - PriceActual.doubleValue()) / PriceList.doubleValue() * 100.0);
@ -654,7 +654,7 @@ public class CalloutInvoice extends CalloutEngine
mTab.setValue ("PriceEntered", PriceEntered); mTab.setValue ("PriceEntered", PriceEntered);
mTab.fireDataStatusEEvent ("UnderLimitPrice", "", false); mTab.fireDataStatusEEvent ("UnderLimitPrice", "", false);
// Repeat Discount calc // Repeat Discount calc
if (PriceList.intValue() != 0) if (PriceList.compareTo(Env.ZERO) != 0)
{ {
Discount = BigDecimal.valueOf((PriceList.doubleValue () - PriceActual.doubleValue ()) / PriceList.doubleValue () * 100.0); Discount = BigDecimal.valueOf((PriceList.doubleValue () - PriceActual.doubleValue ()) / PriceList.doubleValue () * 100.0);
if (Discount.scale () > 2) if (Discount.scale () > 2)

View File

@ -1148,7 +1148,7 @@ public class CalloutOrder extends CalloutEngine
// calculate Discount // calculate Discount
else else
{ {
if (PriceList.intValue() == 0) if (PriceList.compareTo(Env.ZERO) == 0)
Discount = Env.ZERO; Discount = Env.ZERO;
else else
Discount = BigDecimal.valueOf((PriceList.doubleValue() - PriceActual.doubleValue()) / PriceList.doubleValue() * 100.0); Discount = BigDecimal.valueOf((PriceList.doubleValue() - PriceActual.doubleValue()) / PriceList.doubleValue() * 100.0);
@ -1177,7 +1177,7 @@ public class CalloutOrder extends CalloutEngine
mTab.setValue ("PriceEntered", PriceEntered); mTab.setValue ("PriceEntered", PriceEntered);
mTab.fireDataStatusEEvent ("UnderLimitPrice", "", false); mTab.fireDataStatusEEvent ("UnderLimitPrice", "", false);
// Repeat Discount calc // Repeat Discount calc
if (PriceList.intValue() != 0) if (PriceList.compareTo(Env.ZERO) != 0)
{ {
Discount = BigDecimal.valueOf((PriceList.doubleValue () - PriceActual.doubleValue ()) / PriceList.doubleValue () * 100.0); Discount = BigDecimal.valueOf((PriceList.doubleValue () - PriceActual.doubleValue ()) / PriceList.doubleValue () * 100.0);
if (Discount.scale () > 2) if (Discount.scale () > 2)