use of org.kuali.kfs.module.purap.document.web.struts.PaymentRequestForm in project cu-kfs by CU-CommunityApps.
the class CuPaymentRequestAction method clearTaxInfo.
/**
* Calls service to clear tax info.
*/
public ActionForward clearTaxInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
PaymentRequestForm prForm = (PaymentRequestForm) form;
PaymentRequestDocument document = (PaymentRequestDocument) prForm.getDocument();
PaymentRequestService taxService = SpringContext.getBean(PaymentRequestService.class);
/* call service to clear previous lines */
taxService.clearTax(document);
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
use of org.kuali.kfs.module.purap.document.web.struts.PaymentRequestForm in project cu-kfs by CU-CommunityApps.
the class CuPaymentRequestAction method docHandler.
@Override
public ActionForward docHandler(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
ActionForward forward = super.docHandler(mapping, form, request, response);
PaymentRequestForm preqForm = (PaymentRequestForm) form;
PaymentRequestDocument document = (PaymentRequestDocument) preqForm.getDocument();
if (CollectionUtils.isNotEmpty(document.getItems())) {
Collections.sort(document.getItems(), new Comparator() {
public int compare(Object o1, Object o2) {
PaymentRequestItem item1 = (PaymentRequestItem) o1;
PaymentRequestItem item2 = (PaymentRequestItem) o2;
Integer inv1 = ((CuPaymentRequestItemExtension) item1.getExtension()).getInvLineNumber();
Integer inv2 = ((CuPaymentRequestItemExtension) item2.getExtension()).getInvLineNumber();
if (inv1 == null) {
if (inv2 == null) {
return -1;
} else {
return 1;
}
} else {
if (inv2 == null) {
return -1;
} else {
return inv1.compareTo(inv2);
}
}
}
});
}
return forward;
}
use of org.kuali.kfs.module.purap.document.web.struts.PaymentRequestForm in project cu-kfs by CU-CommunityApps.
the class CuPaymentRequestAction method approve.
@Override
public ActionForward approve(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
PaymentRequestDocument preq = ((PaymentRequestForm) form).getPaymentRequestDocument();
SpringContext.getBean(PurapService.class).prorateForTradeInAndFullOrderDiscount(preq);
// if tax is required but not yet calculated, return and prompt user to calculate
if (requiresCalculateTax((PaymentRequestForm) form)) {
GlobalVariables.getMessageMap().putError(KFSConstants.DOCUMENT_ERRORS, PurapKeyConstants.ERROR_APPROVE_REQUIRES_CALCULATE);
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
// and thus system wouldn't know it's not re-calculated after tax data are changed
if (SpringContext.getBean(KualiRuleService.class).applyRules(new AttributedPreCalculateAccountsPayableEvent(preq))) {
ActionForward forward = super.approve(mapping, form, request, response);
// TODO : this preqacctrevision is new. need to validate with existing system to see if '0' is normal ?
if (StringUtils.equals(preq.getApplicationDocumentStatus(), PaymentRequestStatuses.APPDOC_PAYMENT_METHOD_REVIEW) || StringUtils.equals(preq.getApplicationDocumentStatus(), PaymentRequestStatuses.APPDOC_AWAITING_TAX_REVIEW)) {
SpringContext.getBean(PurapAccountRevisionService.class).savePaymentRequestAccountRevisions(preq.getItems(), preq.getPostingYearFromPendingGLEntries(), preq.getPostingPeriodCodeFromPendingGLEntries());
}
return forward;
} else {
// pre-calculation rules fail, go back to same page with error messages
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
}
Aggregations