Search in sources :

Example 1 with PaymentRequestDocument

use of org.kuali.kfs.module.purap.document.PaymentRequestDocument in project cu-kfs by CU-CommunityApps.

the class CuPurchasingAccountsPayableModuleServiceImpl method handlePurchasingBatchCancels.

/**
 * @see org.kuali.kfs.integration.pdp.service.PurchasingAccountsPayableModuleService#handlePurchasingBatchCancels(java.lang.String)
 */
public void handlePurchasingBatchCancels(String documentNumber, String documentTypeCode, boolean primaryCancel, boolean disbursedPayment, boolean crCancel) {
    ParameterService parameterService = SpringContext.getBean(ParameterService.class);
    PaymentRequestService paymentRequestService = SpringContext.getBean(PaymentRequestService.class);
    CreditMemoService creditMemoService = SpringContext.getBean(CreditMemoService.class);
    String preqCancelNote = parameterService.getParameterValueAsString(PaymentRequestDocument.class, PurapParameterConstants.PURAP_PDP_PREQ_CANCEL_NOTE);
    String preqResetNote = parameterService.getParameterValueAsString(PaymentRequestDocument.class, PurapParameterConstants.PURAP_PDP_PREQ_RESET_NOTE);
    String cmCancelNote = parameterService.getParameterValueAsString(VendorCreditMemoDocument.class, PurapParameterConstants.PURAP_PDP_CM_CANCEL_NOTE);
    String cmResetNote = parameterService.getParameterValueAsString(VendorCreditMemoDocument.class, PurapParameterConstants.PURAP_PDP_CM_RESET_NOTE);
    if (PurapConstants.PurapDocTypeCodes.PAYMENT_REQUEST_DOCUMENT.equals(documentTypeCode)) {
        PaymentRequestDocument pr = paymentRequestService.getPaymentRequestByDocumentNumber(documentNumber);
        if (pr != null) {
            if (disbursedPayment || primaryCancel || crCancel) {
                if (!crCancel) {
                    paymentRequestService.cancelExtractedPaymentRequest(pr, preqCancelNote);
                }
            } else {
                paymentRequestService.resetExtractedPaymentRequest(pr, preqResetNote);
            }
        } else {
            LOG.error("processPdpCancels() DOES NOT EXIST, CANNOT PROCESS - Payment Request with doc type of " + documentTypeCode + " with id " + documentNumber);
        }
    } else if (PurapConstants.PurapDocTypeCodes.CREDIT_MEMO_DOCUMENT.equals(documentTypeCode)) {
        VendorCreditMemoDocument cm = creditMemoService.getCreditMemoByDocumentNumber(documentNumber);
        if (cm != null) {
            if (disbursedPayment || primaryCancel || crCancel) {
                if (!crCancel) {
                    creditMemoService.cancelExtractedCreditMemo(cm, cmCancelNote);
                }
            } else {
                creditMemoService.resetExtractedCreditMemo(cm, cmResetNote);
            }
        } else {
            LOG.error("processPdpCancels() DOES NOT EXIST, CANNOT PROCESS - Credit Memo with doc type of " + documentTypeCode + " with id " + documentNumber);
        }
    }
}
Also used : VendorCreditMemoDocument(org.kuali.kfs.module.purap.document.VendorCreditMemoDocument) ParameterService(org.kuali.kfs.coreservice.framework.parameter.ParameterService) PaymentRequestService(org.kuali.kfs.module.purap.document.service.PaymentRequestService) PaymentRequestDocument(org.kuali.kfs.module.purap.document.PaymentRequestDocument) CreditMemoService(org.kuali.kfs.module.purap.document.service.CreditMemoService)

Example 2 with PaymentRequestDocument

use of org.kuali.kfs.module.purap.document.PaymentRequestDocument in project cu-kfs by CU-CommunityApps.

the class CuPaymentRequestAction method customCalculate.

@Override
protected void customCalculate(PurchasingAccountsPayableDocument apDoc) {
    super.customCalculate(apDoc);
    PaymentRequestDocument preqDoc = (PaymentRequestDocument) apDoc;
    // KFSPTS-2578
    if (PaymentRequestStatuses.APPDOC_PAYMENT_METHOD_REVIEW.equalsIgnoreCase(preqDoc.getApplicationDocumentStatus()) && StringUtils.isNotBlank(preqDoc.getTaxClassificationCode()) && !StringUtils.equalsIgnoreCase(preqDoc.getTaxClassificationCode(), "N")) {
        SpringContext.getBean(PaymentRequestService.class).calculateTaxArea(preqDoc);
        return;
    }
}
Also used : PaymentRequestService(org.kuali.kfs.module.purap.document.service.PaymentRequestService) PaymentRequestDocument(org.kuali.kfs.module.purap.document.PaymentRequestDocument)

Example 3 with PaymentRequestDocument

use of org.kuali.kfs.module.purap.document.PaymentRequestDocument 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);
}
Also used : PaymentRequestForm(org.kuali.kfs.module.purap.document.web.struts.PaymentRequestForm) PaymentRequestService(org.kuali.kfs.module.purap.document.service.PaymentRequestService) PaymentRequestDocument(org.kuali.kfs.module.purap.document.PaymentRequestDocument)

Example 4 with PaymentRequestDocument

use of org.kuali.kfs.module.purap.document.PaymentRequestDocument 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;
}
Also used : PaymentRequestForm(org.kuali.kfs.module.purap.document.web.struts.PaymentRequestForm) PaymentRequestItem(org.kuali.kfs.module.purap.businessobject.PaymentRequestItem) PaymentRequestDocument(org.kuali.kfs.module.purap.document.PaymentRequestDocument) ActionForward(org.apache.struts.action.ActionForward) Comparator(java.util.Comparator)

Example 5 with PaymentRequestDocument

use of org.kuali.kfs.module.purap.document.PaymentRequestDocument in project cu-kfs by CU-CommunityApps.

the class PaymentRequestForeignDraftValidation method validate.

/**
 * @see org.kuali.kfs.sys.document.validation.Validation#validate(org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent)
 */
public boolean validate(AttributedDocumentEvent event) {
    if (LOG.isDebugEnabled()) {
        LOG.debug("validate start");
    }
    boolean isValid = true;
    PaymentRequestDocument document = (PaymentRequestDocument) accountingDocumentForValidation;
    if (!PaymentMethod.PM_CODE_FOREIGN_DRAFT.equals(((CuPaymentRequestDocument) document).getPaymentMethodCode())) {
        return true;
    }
    MessageMap errors = GlobalVariables.getMessageMap();
    errors.addToErrorPath(KFSPropertyConstants.DOCUMENT);
    errors.addToErrorPath(CUPurapPropertyConstants.PREQ_WIRE_TRANSFER);
    /* currency type code required */
    if (StringUtils.isBlank(((CuPaymentRequestDocument) document).getPreqWireTransfer().getPreqForeignCurrencyTypeCode())) {
        errors.putError(CUPurapPropertyConstants.PREQ_FD_CURRENCY_TYPE_CODE, KFSKeyConstants.ERROR_PAYMENT_SOURCE_CURRENCY_TYPE_CODE);
        isValid = false;
    }
    /* currency type name required */
    if (StringUtils.isBlank(((CuPaymentRequestDocument) document).getPreqWireTransfer().getPreqForeignCurrencyTypeName())) {
        errors.putError(CUPurapPropertyConstants.PREQ_FD_CURRENCY_TYPE_NAME, KFSKeyConstants.ERROR_PAYMENT_SOURCE_CURRENCY_TYPE_NAME);
        isValid = false;
    }
    errors.removeFromErrorPath(CUPurapPropertyConstants.PREQ_WIRE_TRANSFER);
    errors.removeFromErrorPath(KFSPropertyConstants.DOCUMENT);
    return isValid;
}
Also used : CuPaymentRequestDocument(edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument) PaymentRequestDocument(org.kuali.kfs.module.purap.document.PaymentRequestDocument) CuPaymentRequestDocument(edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument) MessageMap(org.kuali.kfs.krad.util.MessageMap)

Aggregations

PaymentRequestDocument (org.kuali.kfs.module.purap.document.PaymentRequestDocument)36 CuPaymentRequestDocument (edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument)21 PurchaseOrderDocument (org.kuali.kfs.module.purap.document.PurchaseOrderDocument)15 DocumentService (org.kuali.kfs.krad.service.DocumentService)12 PaymentRequestItem (org.kuali.kfs.module.purap.businessobject.PaymentRequestItem)6 WorkflowException (org.kuali.rice.kew.api.exception.WorkflowException)5 VendorCreditMemoDocument (org.kuali.kfs.module.purap.document.VendorCreditMemoDocument)4 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)4 RemoteException (java.rmi.RemoteException)3 KualiRuleService (org.kuali.kfs.krad.service.KualiRuleService)3 PurApItem (org.kuali.kfs.module.purap.businessobject.PurApItem)3 PaymentRequestService (org.kuali.kfs.module.purap.document.service.PaymentRequestService)3 FileNotFoundException (java.io.FileNotFoundException)2 IOException (java.io.IOException)2 BigDecimal (java.math.BigDecimal)2 HashMap (java.util.HashMap)2 ActionForward (org.apache.struts.action.ActionForward)2 ValidationException (org.kuali.kfs.krad.exception.ValidationException)2 MessageMap (org.kuali.kfs.krad.util.MessageMap)2 WorkflowDocumentService (org.kuali.kfs.krad.workflow.service.WorkflowDocumentService)2