Search in sources :

Example 16 with VendorCreditMemoDocument

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

the class CUVendorCreditMemoTotalMatchesVendorAmountValidation method validate.

public boolean validate(AttributedDocumentEvent event) {
    boolean valid = true;
    VendorCreditMemoDocument cmDocument = (VendorCreditMemoDocument) event.getDocument();
    GlobalVariables.getMessageMap().clearErrorPath();
    GlobalVariables.getMessageMap().addToErrorPath(KFSPropertyConstants.DOCUMENT);
    if (cmDocument.getGrandTotal().compareTo(cmDocument.getCreditMemoAmount()) != 0 && !cmDocument.isUnmatchedOverride()) {
        GlobalVariables.getMessageMap().putError(PurapPropertyConstants.GRAND_TOTAL, PurapKeyConstants.ERROR_CREDIT_MEMO_INVOICE_AMOUNT_NONMATCH);
        valid = false;
    }
    GlobalVariables.getMessageMap().clearErrorPath();
    return valid;
}
Also used : VendorCreditMemoDocument(org.kuali.kfs.module.purap.document.VendorCreditMemoDocument)

Example 17 with VendorCreditMemoDocument

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

the class CuAccountsPayableBankCodeValidation method validate.

@Override
public boolean validate(AttributedDocumentEvent event) {
    AccountsPayableDocumentBase apDocument = (AccountsPayableDocumentBase) getAccountingDocumentForValidation();
    // check if one of the extended UA documents, if so, take the payment method into account, otherwise, revert to baseline behavior
    boolean isValid = true;
    if (apDocument instanceof PaymentRequestDocument) {
        if (StringUtils.isNotBlank(apDocument.getBankCode())) {
            // PREQ bank code is not required
            isValid = CuBankCodeValidation.validate(apDocument.getBankCode(), "document." + PurapPropertyConstants.BANK_CODE, ((CuPaymentRequestDocument) apDocument).getPaymentMethodCode(), false, true);
            if (isValid) {
                if (!(event instanceof AttributedRouteDocumentEvent) && StringUtils.isNotBlank(apDocument.getBankCode()) && !CuBankCodeValidation.doesBankCodeNeedToBePopulated(((CuPaymentRequestDocument) apDocument).getPaymentMethodCode())) {
                    apDocument.setBank(null);
                    apDocument.setBankCode(null);
                }
            }
        }
    } else if (apDocument instanceof VendorCreditMemoDocument) {
        if (StringUtils.isNotBlank(apDocument.getBankCode())) {
            isValid = CuBankCodeValidation.validate(apDocument.getBankCode(), "document." + PurapPropertyConstants.BANK_CODE, ((CuVendorCreditMemoDocument) apDocument).getPaymentMethodCode(), false, true);
            if (isValid) {
                // clear out the bank code on the document if not needed (per the message set by the call above)
                if (StringUtils.isNotBlank(apDocument.getBankCode()) && !CuBankCodeValidation.doesBankCodeNeedToBePopulated(((CuVendorCreditMemoDocument) apDocument).getPaymentMethodCode())) {
                    apDocument.setBank(null);
                    apDocument.setBankCode(null);
                }
            }
        }
    } else {
        isValid = CuBankCodeValidation.validate(apDocument.getBankCode(), "document." + PurapPropertyConstants.BANK_CODE, false, true);
    }
    return isValid;
}
Also used : AccountsPayableDocumentBase(org.kuali.kfs.module.purap.document.AccountsPayableDocumentBase) CuVendorCreditMemoDocument(edu.cornell.kfs.module.purap.document.CuVendorCreditMemoDocument) VendorCreditMemoDocument(org.kuali.kfs.module.purap.document.VendorCreditMemoDocument) AttributedRouteDocumentEvent(org.kuali.kfs.sys.document.validation.event.AttributedRouteDocumentEvent) CuVendorCreditMemoDocument(edu.cornell.kfs.module.purap.document.CuVendorCreditMemoDocument) CuPaymentRequestDocument(edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument) PaymentRequestDocument(org.kuali.kfs.module.purap.document.PaymentRequestDocument) CuPaymentRequestDocument(edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument)

Example 18 with VendorCreditMemoDocument

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

the class CuVendorCreditMemoForm method getExtraButtons.

@Override
public List<ExtraButton> getExtraButtons() {
    List<ExtraButton> extraButtons = super.getExtraButtons();
    VendorCreditMemoDocument cmDocument = (VendorCreditMemoDocument) getDocument();
    String appExternalImageURL = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(KFSConstants.EXTERNALIZABLE_IMAGES_URL_KEY);
    if (!getEditingMode().containsKey(CreditMemoEditMode.DISPLAY_INIT_TAB)) {
        if (!(SpringContext.getBean(PurapService.class).isFullDocumentEntryCompleted(cmDocument) == false && documentActions.containsKey(KRADConstants.KUALI_ACTION_CAN_EDIT))) {
            if (getEditingMode().containsKey(CUPaymentRequestEditMode.WAIVE_WIRE_FEE_EDITABLE)) {
                addExtraButton("methodToCall.calculate", appExternalImageURL + "buttonsmall_calculate.gif", "Calculate");
            }
        }
    }
    return extraButtons;
}
Also used : VendorCreditMemoDocument(org.kuali.kfs.module.purap.document.VendorCreditMemoDocument) PurapService(org.kuali.kfs.module.purap.document.service.PurapService) ConfigurationService(org.kuali.rice.core.api.config.property.ConfigurationService) ExtraButton(org.kuali.kfs.kns.web.ui.ExtraButton)

Aggregations

VendorCreditMemoDocument (org.kuali.kfs.module.purap.document.VendorCreditMemoDocument)18 CuVendorCreditMemoDocument (edu.cornell.kfs.module.purap.document.CuVendorCreditMemoDocument)7 PaymentRequestDocument (org.kuali.kfs.module.purap.document.PaymentRequestDocument)5 Note (org.kuali.kfs.krad.bo.Note)3 LinkedHashMap (java.util.LinkedHashMap)2 ParameterService (org.kuali.kfs.coreservice.framework.parameter.ParameterService)2 Document (org.kuali.kfs.krad.document.Document)2 MessageMap (org.kuali.kfs.krad.util.MessageMap)2 PurApAccountingLine (org.kuali.kfs.module.purap.businessobject.PurApAccountingLine)2 PurApItem (org.kuali.kfs.module.purap.businessobject.PurApItem)2 PurchaseOrderDocument (org.kuali.kfs.module.purap.document.PurchaseOrderDocument)2 CreditMemoWireTransfer (edu.cornell.kfs.module.purap.businessobject.CreditMemoWireTransfer)1 CuPaymentRequestDocument (edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument)1 BigDecimal (java.math.BigDecimal)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1 DisbursementVoucherDocument (org.kuali.kfs.fp.document.DisbursementVoucherDocument)1 Entry (org.kuali.kfs.gl.businessobject.Entry)1 ExtraButton (org.kuali.kfs.kns.web.ui.ExtraButton)1