changing to banker's rounding
This commit is contained in:
@@ -98,14 +98,14 @@ public class CalculateChargesHandler implements HandlerInterface {
|
|||||||
chargeAmount = charge.getFlat();
|
chargeAmount = charge.getFlat();
|
||||||
}else {
|
}else {
|
||||||
BigDecimal fraction = charge.getPercentageRate().divide(
|
BigDecimal fraction = charge.getPercentageRate().divide(
|
||||||
new BigDecimal(100), 4, RoundingMode.CEILING);
|
new BigDecimal(100), 4, RoundingMode.HALF_EVEN);
|
||||||
chargeAmount = amountToCharge.multiply(fraction)
|
chargeAmount = amountToCharge.multiply(fraction)
|
||||||
.setScale(2, RoundingMode.CEILING);
|
.setScale(2, RoundingMode.HALF_EVEN);
|
||||||
|
|
||||||
// if it's a composite charge then add the flat component as well
|
// if it's a composite charge then add the flat component as well
|
||||||
if(charge.isComposite()) {
|
if(charge.isComposite()) {
|
||||||
chargeAmount = chargeAmount.add(charge.getFlat())
|
chargeAmount = chargeAmount.add(charge.getFlat())
|
||||||
.setScale(2, RoundingMode.CEILING);
|
.setScale(2, RoundingMode.HALF_EVEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -119,9 +119,9 @@ public class PurchaseInvoiceHandler implements HandlerInterface {
|
|||||||
Provider provider = providerService.getProviderRepository()
|
Provider provider = providerService.getProviderRepository()
|
||||||
.findByClientId(transaction.getBillClientId());
|
.findByClientId(transaction.getBillClientId());
|
||||||
BigDecimal commissionPercentage = BigDecimal.valueOf(provider.getPercentageCommission())
|
BigDecimal commissionPercentage = BigDecimal.valueOf(provider.getPercentageCommission())
|
||||||
.divide(BigDecimal.valueOf(100), 2, RoundingMode.CEILING);
|
.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_EVEN);
|
||||||
BigDecimal commission = transaction.getAmount().multiply(commissionPercentage)
|
BigDecimal commission = transaction.getAmount().multiply(commissionPercentage)
|
||||||
.setScale(2, RoundingMode.CEILING);
|
.setScale(2, RoundingMode.HALF_EVEN);
|
||||||
BigDecimal amount = transaction.getAmount().subtract(commission);
|
BigDecimal amount = transaction.getAmount().subtract(commission);
|
||||||
|
|
||||||
PurchaseTaxDto purchaseTaxDto = PurchaseTaxDto.builder()
|
PurchaseTaxDto purchaseTaxDto = PurchaseTaxDto.builder()
|
||||||
|
|||||||
@@ -110,9 +110,9 @@ public class PurchasePaymentEntryHandler implements HandlerInterface {
|
|||||||
Provider provider = providerService.getProviderRepository()
|
Provider provider = providerService.getProviderRepository()
|
||||||
.findByClientId(transaction.getBillClientId());
|
.findByClientId(transaction.getBillClientId());
|
||||||
BigDecimal commissionPercentage = BigDecimal.valueOf(provider.getPercentageCommission())
|
BigDecimal commissionPercentage = BigDecimal.valueOf(provider.getPercentageCommission())
|
||||||
.divide(BigDecimal.valueOf(100), 2, RoundingMode.CEILING);
|
.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_EVEN);
|
||||||
BigDecimal commission = transaction.getAmount().multiply(commissionPercentage)
|
BigDecimal commission = transaction.getAmount().multiply(commissionPercentage)
|
||||||
.setScale(2, RoundingMode.CEILING);
|
.setScale(2, RoundingMode.HALF_EVEN);
|
||||||
BigDecimal amount = transaction.getAmount().subtract(commission);
|
BigDecimal amount = transaction.getAmount().subtract(commission);
|
||||||
|
|
||||||
PaymentReferenceDto paymentReferenceDto = PaymentReferenceDto.builder()
|
PaymentReferenceDto paymentReferenceDto = PaymentReferenceDto.builder()
|
||||||
|
|||||||
Reference in New Issue
Block a user