}
} else if ("PPIP_ORST_YEAR".equals(inputParamEnumId)) {
// description="Order sub-total X since beginning of current year"
if (partyId != null && userLogin != null && UtilValidate.isNotEmpty(condValue)) {
// call the getOrderedSummaryInformation service to get the sub-total
Calendar calendar = Calendar.getInstance();
calendar.setTime(nowTimestamp);
int monthsToInclude = calendar.get(Calendar.MONTH) + 1;
Map<String, Object> serviceIn = UtilMisc.<String, Object>toMap("partyId", partyId,
"roleTypeId", "PLACING_CUSTOMER",
"orderTypeId", "SALES_ORDER",
"statusId", "ORDER_COMPLETED",
"monthsToInclude", Integer.valueOf(monthsToInclude),
"userLogin", userLogin);
try {
Map<String, Object> result = dispatcher.runSync("getOrderedSummaryInformation", serviceIn);
if (ServiceUtil.isError(result)) {
Debug.logError("Error calling getOrderedSummaryInformation service for the PPIP_ORST_YEAR ProductPromo condition input value: " + ServiceUtil.getErrorMessage(result), module);
return false;
} else {
BigDecimal orderSubTotal = (BigDecimal) result.get("totalSubRemainingAmount");
if (Debug.verboseOn()) Debug.logVerbose("Doing order history sub-total compare: orderSubTotal=" + orderSubTotal + ", for the last " + monthsToInclude + " months.", module);
compareBase = Integer.valueOf(orderSubTotal.compareTo(new BigDecimal((condValue))));
}
} catch (GenericServiceException e) {
Debug.logError(e, "Error getting order history sub-total in the getOrderedSummaryInformation service, evaluating condition to false.", module);
return false;
}
}
} else if ("PPIP_ORST_LAST_YEAR".equals(inputParamEnumId)) {
// description="Order sub-total X since beginning of last year"
if (partyId != null && userLogin != null && UtilValidate.isNotEmpty(condValue)) {
// call the getOrderedSummaryInformation service to get the sub-total
Calendar calendar = Calendar.getInstance();
calendar.setTime(nowTimestamp);
int lastYear = calendar.get(Calendar.YEAR) - 1;
Calendar fromDateCalendar = Calendar.getInstance();
fromDateCalendar.set(lastYear, 0, 0, 0, 0);
Timestamp fromDate = new Timestamp(fromDateCalendar.getTime().getTime());
Calendar thruDateCalendar = Calendar.getInstance();
thruDateCalendar.set(lastYear, 12, 0, 0, 0);
Timestamp thruDate = new Timestamp(thruDateCalendar.getTime().getTime());
Map<String, Object> serviceIn = UtilMisc.toMap("partyId", partyId,
"roleTypeId", "PLACING_CUSTOMER",
"orderTypeId", "SALES_ORDER",
"statusId", "ORDER_COMPLETED",
"fromDate", fromDate,