List<Map<String, String>> invoicesCreated = FastList.newInstance();
Map<String, List<Map<String, Object>>> commissionParties = FastMap.newInstance();
for (String salesInvoiceId : salesInvoiceIds) {
List<String> salesRepPartyIds = UtilGenerics.checkList(context.get("partyIds"));
BigDecimal amountTotal = InvoiceWorker.getInvoiceTotal(delegator, salesInvoiceId);
if (amountTotal.signum() == 0) {
Debug.logWarning("Invoice [" + salesInvoiceId + "] has an amount total of [" + amountTotal + "], so no commission invoice will be created", module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingInvoiceCommissionZeroInvoiceAmount", locale));
}
BigDecimal appliedFraction = amountTotal.divide(amountTotal, 12, ROUNDING);