当前位置: 首页>>代码示例>>Java>>正文


Java KualiDecimal.isLessEqual方法代码示例

本文整理汇总了Java中org.kuali.rice.core.api.util.type.KualiDecimal.isLessEqual方法的典型用法代码示例。如果您正苦于以下问题:Java KualiDecimal.isLessEqual方法的具体用法?Java KualiDecimal.isLessEqual怎么用?Java KualiDecimal.isLessEqual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kuali.rice.core.api.util.type.KualiDecimal的用法示例。


在下文中一共展示了KualiDecimal.isLessEqual方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkForValidCopiesAndPartsForSubmit

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
 * This method validates whether total copies and total parts are lessThan or equal to quantity to be received and parts to be
 * received
 *
 * @param receivingDocument
 * @return boolean
 */
private boolean checkForValidCopiesAndPartsForSubmit(OleLineItemReceivingDocument receivingDocument) {
    LOG.debug("Inside checkForValidCopiesAndPartsForSubmit of OleLineItemReceivingDocumentRule");
    boolean isValid = true;
    for (OleLineItemReceivingItem item : (List<OleLineItemReceivingItem>) receivingDocument.getItems()) {
        if (null != item.getPurchaseOrderIdentifier()) {
            KualiDecimal itemTotalQuantity = item.getItemReceivedTotalQuantity();
            KualiDecimal itemTotalParts = item.getItemReceivedTotalParts();
            KualiDecimal itemQuantityToBeReceived = item.getItemReceivedToBeQuantity();
            KualiDecimal itemPartsToBeReceived = item.getItemReceivedToBeParts();
            if (!(itemTotalQuantity.isLessEqual(itemQuantityToBeReceived))
                    && !(itemTotalParts.isLessEqual(itemPartsToBeReceived))) {
                GlobalVariables
                        .getMessageMap()
                        .putError(
                                PurapConstants.ITEM_TAB_ERROR_PROPERTY,
                                OLEKeyConstants.ERROR_TOTAL_COPIES_TOTAL_PARTS_SHOULDBE_LESSTHAN_OR_EQUALTO_QUANTITY_TOBE_RECEIVED_AND_PARTS_TOBE_RECEIVED);
                return false;
            }
        }
    }
    return isValid;
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:30,代码来源:OleLineItemReceivingDocumentRule.java

示例2: validate

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
public boolean validate(AttributedDocumentEvent event) {

        BigDecimal quantity = customerCreditMemoDetail.getCreditMemoItemQuantity();
        KualiDecimal invoiceOpenItemAmount = customerCreditMemoDetail.getInvoiceOpenItemAmount();
        KualiDecimal creditMemoItemAmount = customerCreditMemoDetail.getCreditMemoItemTotalAmount();
        boolean isValid;

        if (ObjectUtils.isNotNull(creditMemoItemAmount) && ObjectUtils.isNull(quantity)) {
            
            // customer credit memo total amount must be greater than zero
            isValid = creditMemoItemAmount.isPositive();
            if (!isValid) {
                GlobalVariables.getMessageMap().putError(DOCUMENT_ERROR_PREFIX + ArPropertyConstants.CustomerCreditMemoDocumentFields.CREDIT_MEMO_ITEM_TOTAL_AMOUNT, ArKeyConstants.ERROR_CUSTOMER_CREDIT_MEMO_DETAIL_ITEM_AMOUNT_LESS_THAN_OR_EQUAL_TO_ZERO);
                return false;
            }

            // customer credit memo total amount must not be greater than invoice open item total amount
            isValid = creditMemoItemAmount.isLessEqual(invoiceOpenItemAmount);
            if (!isValid) {
                GlobalVariables.getMessageMap().putError(DOCUMENT_ERROR_PREFIX + ArPropertyConstants.CustomerCreditMemoDocumentFields.CREDIT_MEMO_ITEM_TOTAL_AMOUNT, ArKeyConstants.ERROR_CUSTOMER_CREDIT_MEMO_DETAIL_ITEM_AMOUNT_GREATER_THAN_INVOICE_ITEM_AMOUNT);
                return false;
            }
        }
        return true;
    }
 
开发者ID:kuali,项目名称:kfs,代码行数:26,代码来源:CustomerCreditMemoDetailAmountValidation.java

示例3: getDistributionRemainingAmount

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
@Override
public KualiDecimal getDistributionRemainingAmount(boolean selectedDistributions) {
    KualiDecimal total = KualiDecimal.ZERO;
    KualiDecimal distributedTotal = KualiDecimal.ZERO;
    for (AccountingDistribution accountDistribution : distribution) {
        if ((selectedDistributions && accountDistribution.getSelected()) || !selectedDistributions) {
            total = total.add(accountDistribution.getRemainingAmount());
            distributedTotal = distributedTotal.add(accountDistribution.getSubTotal().subtract(accountDistribution.getRemainingAmount()));
        }
    }
    if (getTravelDocument().getExpenseLimit() != null && getTravelDocument().getExpenseLimit().isPositive()) {
        if (distributedTotal.isGreaterEqual(getTravelDocument().getExpenseLimit())) {
            return KualiDecimal.ZERO; // we're over our expense limit
        } else if (total.isLessEqual(getTravelDocument().getExpenseLimit())) {
            return total;
        } else {
            return getTravelDocument().getExpenseLimit().subtract(distributedTotal); // return the remaining of our expense limit
        }
    }
    return total;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:22,代码来源:TravelFormBase.java

示例4: requiresAccountingReviewRouting

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
 *
 * @return
 */
private boolean requiresAccountingReviewRouting() {
    // start with getting the TA encumbrance amount
    String percent = getParameterService().getParameterValueAsString(TravelReimbursementDocument.class, TravelReimbursementParameters.REIMBURSEMENT_PERCENT_OVER_ENCUMBRANCE_AMOUNT);

    KualiDecimal taTotal = getTravelDocumentService().getTotalAuthorizedEncumbrance(this);
    if (taTotal.isLessEqual(KualiDecimal.ZERO)) {
        return false;
    }

    KualiDecimal trTotal = getTravelDocumentService().getTotalCumulativeReimbursements(this);
    if (trTotal.isLessEqual(KualiDecimal.ZERO)) {
        return false;
    }

    if (trTotal.isGreaterThan(taTotal)) {
        KualiDecimal subAmount = trTotal.subtract(taTotal);
        KualiDecimal percentOver = (subAmount.divide(taTotal)).multiply(new KualiDecimal(100));
        return (percentOver.isGreaterThan(new KualiDecimal(percent)));
    }
    return false;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:26,代码来源:TravelReimbursementDocument.java

示例5: checkSplitQty

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
 * Check user input splitQty. It must be required and can't be zero or greater than current quantity.
 * 
 * @param itemAsset
 * @param errorPath
 */
protected void checkSplitQty(PurchasingAccountsPayableItemAsset itemAsset, String errorPath) {
    if (itemAsset.getSplitQty() == null)
        itemAsset.setSplitQty(KualiDecimal.ZERO);

    if (itemAsset.getAccountsPayableItemQuantity() == null)
        itemAsset.setAccountsPayableItemQuantity(KualiDecimal.ZERO);

    KualiDecimal splitQty = itemAsset.getSplitQty();
    KualiDecimal oldQty = itemAsset.getAccountsPayableItemQuantity();
    KualiDecimal maxAllowQty = oldQty.subtract(new KualiDecimal(0.1));

    if (splitQty == null) {
        GlobalVariables.getMessageMap().putError(CabPropertyConstants.PurchasingAccountsPayableItemAsset.SPLIT_QTY, CabKeyConstants.ERROR_SPLIT_QTY_REQUIRED);
    }
    else if (splitQty.isLessEqual(KualiDecimal.ZERO) || splitQty.isGreaterEqual(oldQty)) {
        GlobalVariables.getMessageMap().putError(CabPropertyConstants.PurchasingAccountsPayableItemAsset.SPLIT_QTY, CabKeyConstants.ERROR_SPLIT_QTY_INVALID, maxAllowQty.toString());
    }
    return;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:26,代码来源:PurApLineAction.java

示例6: validateDepositAccount

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
public boolean validateDepositAccount(OleInvoiceDocument oleInvoiceDocument) {
    boolean valid = true;
    if (getPaymentMethodType(oleInvoiceDocument.getPaymentMethodIdentifier()).equals(OLEConstants.DEPOSIT)) {
        for (OleInvoiceItem item : (List<OleInvoiceItem>) oleInvoiceDocument.getItems()) {
            KualiDecimal invoiceAmount = new KualiDecimal(item.getInvoiceListPrice());
            if (invoiceAmount.isLessEqual(KualiDecimal.ZERO) && item.getItemTypeCode().equals("ITEM")) {
                return false;
            }
        }
    }
    return valid;
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:13,代码来源:OleInvoiceServiceImpl.java

示例7: totalAmountMatchForCapitalAccountingLinesAndCapitalAssets

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
protected boolean totalAmountMatchForCapitalAccountingLinesAndCapitalAssets(List<CapitalAccountingLines> capitalAccountingLines, List<CapitalAssetInformation> capitalAssets) {
    boolean totalAmountMatched = true;
    
    KualiDecimal capitalAccountingLinesTotals = KualiDecimal.ZERO;
    KualiDecimal capitalAAssetTotals = KualiDecimal.ZERO;
    
    for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
        capitalAccountingLinesTotals = capitalAccountingLinesTotals.add(capitalAccountingLine.getAmount());
    }

    for (CapitalAssetInformation capitalAsset : capitalAssets) {
        capitalAAssetTotals = capitalAAssetTotals.add(capitalAsset.getCapitalAssetLineAmount());
    }
    
    if (capitalAccountingLinesTotals.isGreaterThan(capitalAAssetTotals)) {
        //not all the accounting lines amounts have been distributed to capital assets
        GlobalVariables.getMessageMap().putError(OLEConstants.EDIT_ACCOUNTING_LINES_FOR_CAPITALIZATION_ERRORS, OLEKeyConstants.ERROR_DOCUMENT_ACCOUNTING_LINES_NOT_ALL_TOTALS_DISTRIBUTED_TO_CAPITAL_ASSETS);
        return false;
    }
    
    if (capitalAccountingLinesTotals.isLessEqual(capitalAAssetTotals)) {
        //not all the accounting lines amounts have been distributed to capital assets
        GlobalVariables.getMessageMap().putError(OLEConstants.EDIT_ACCOUNTING_LINES_FOR_CAPITALIZATION_ERRORS, OLEKeyConstants.ERROR_DOCUMENT_ACCOUNTING_LINE_FOR_CAPITALIZATION_HAS_NO_CAPITAL_ASSET);
        return false;
    }
    
    return totalAmountMatched;
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:29,代码来源:CapitalAccountingLinesValidations.java

示例8: validateAmountAppliedToCustomerInvoiceDetailByPaymentApplicationDocument

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
 * @param customerInvoiceDetail
 * @param paymentApplicationDocument
 * @return
 */
public static boolean validateAmountAppliedToCustomerInvoiceDetailByPaymentApplicationDocument(CustomerInvoiceDetail customerInvoiceDetail, PaymentApplicationDocument paymentApplicationDocument, KualiDecimal totalFromControl) throws WorkflowException {

    boolean isValid = true;

    // This let's us highlight a specific invoice detail line
    String propertyName = MessageFormat.format(ArPropertyConstants.PaymentApplicationDocumentFields.AMOUNT_TO_BE_APPLIED_LINE_N, customerInvoiceDetail.getSequenceNumber().toString());

    KualiDecimal amountAppliedByAllOtherDocuments = customerInvoiceDetail.getAmountAppliedExcludingAnyAmountAppliedBy(paymentApplicationDocument.getDocumentNumber());
    KualiDecimal amountAppliedByThisDocument = customerInvoiceDetail.getAmountAppliedBy(paymentApplicationDocument.getDocumentNumber());
    KualiDecimal totalAppliedAmount = amountAppliedByAllOtherDocuments.add(amountAppliedByThisDocument);

    // Can't apply more than the total amount of the detail
    if (!totalAppliedAmount.isLessEqual(totalFromControl)) {
        isValid = false;
        GlobalVariables.getMessageMap().putError(propertyName, ArKeyConstants.PaymentApplicationDocumentErrors.AMOUNT_TO_BE_APPLIED_EXCEEDS_AMOUNT_OUTSTANDING);
    }

    // Can't apply a negative amount.
    if (KualiDecimal.ZERO.isGreaterThan(amountAppliedByThisDocument)) {
        isValid = false;
        GlobalVariables.getMessageMap().putError(propertyName, ArKeyConstants.PaymentApplicationDocumentErrors.AMOUNT_TO_BE_APPLIED_MUST_BE_GREATER_THAN_ZERO);
    }

    // Can't apply more than the total amount outstanding on the cash control document.
    CashControlDocument cashControlDocument = paymentApplicationDocument.getCashControlDocument();
    if (ObjectUtils.isNotNull(cashControlDocument)) {
        if (cashControlDocument.getCashControlTotalAmount().isLessThan(amountAppliedByThisDocument)) {
            isValid = false;
            GlobalVariables.getMessageMap().putError(propertyName, ArKeyConstants.PaymentApplicationDocumentErrors.CANNOT_APPLY_MORE_THAN_BALANCE_TO_BE_APPLIED);
        }
    }

    return isValid;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:40,代码来源:PaymentApplicationDocumentRuleUtil.java

示例9: isCustomerCreditMemoItemAmountLessThanEqualToInvoiceOpenItemAmount

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
public boolean isCustomerCreditMemoItemAmountLessThanEqualToInvoiceOpenItemAmount(CustomerCreditMemoDocument customerCreditMemoDocument, CustomerCreditMemoDetail customerCreditMemoDetail) {

        KualiDecimal invoiceOpenItemAmount = customerCreditMemoDetail.getInvoiceOpenItemAmount();
        KualiDecimal creditMemoItemAmount = customerCreditMemoDetail.getCreditMemoItemTotalAmount();

        boolean validItemAmount = creditMemoItemAmount.isLessEqual(invoiceOpenItemAmount);
        if (!validItemAmount) {
            GlobalVariables.getMessageMap().putError(ArPropertyConstants.CustomerCreditMemoDocumentFields.CREDIT_MEMO_ITEM_TOTAL_AMOUNT, ArKeyConstants.ERROR_CUSTOMER_CREDIT_MEMO_DETAIL_ITEM_AMOUNT_GREATER_THAN_INVOICE_ITEM_AMOUNT);
        }

        return validItemAmount;
    }
 
开发者ID:kuali,项目名称:kfs,代码行数:13,代码来源:CustomerCreditMemoDocumentRule.java

示例10: totalAmountMatchForCapitalAccountingLinesAndCapitalAssets

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
protected boolean totalAmountMatchForCapitalAccountingLinesAndCapitalAssets(List<CapitalAccountingLines> capitalAccountingLines, List<CapitalAssetInformation> capitalAssets) {
    boolean totalAmountMatched = true;
    
    KualiDecimal capitalAccountingLinesTotals = KualiDecimal.ZERO;
    KualiDecimal capitalAAssetTotals = KualiDecimal.ZERO;
    
    for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
        capitalAccountingLinesTotals = capitalAccountingLinesTotals.add(capitalAccountingLine.getAmount());
    }

    for (CapitalAssetInformation capitalAsset : capitalAssets) {
        capitalAAssetTotals = capitalAAssetTotals.add(capitalAsset.getCapitalAssetLineAmount());
    }
    
    if (capitalAccountingLinesTotals.isGreaterThan(capitalAAssetTotals)) {
        //not all the accounting lines amounts have been distributed to capital assets
        GlobalVariables.getMessageMap().putError(KFSConstants.EDIT_ACCOUNTING_LINES_FOR_CAPITALIZATION_ERRORS, KFSKeyConstants.ERROR_DOCUMENT_ACCOUNTING_LINES_NOT_ALL_TOTALS_DISTRIBUTED_TO_CAPITAL_ASSETS);
        return false;
    }
    
    if (capitalAccountingLinesTotals.isLessEqual(capitalAAssetTotals)) {
        //not all the accounting lines amounts have been distributed to capital assets
        GlobalVariables.getMessageMap().putError(KFSConstants.EDIT_ACCOUNTING_LINES_FOR_CAPITALIZATION_ERRORS, KFSKeyConstants.ERROR_DOCUMENT_ACCOUNTING_LINE_FOR_CAPITALIZATION_HAS_NO_CAPITAL_ASSET);
        return false;
    }
    
    return totalAmountMatched;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:29,代码来源:CapitalAccountingLinesValidations.java

示例11: validateSeparateSourceAmount

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
 * Validates the separate source amount.
 *
 * @param uniqueLocationDetails
 * @return boolean
 */
protected boolean validateSeparateSourceAmount(AssetGlobalDetail uniqueLocationDetail, MaintenanceDocument document) {
    boolean success = true;
    KualiDecimal separateSourceAmount = uniqueLocationDetail.getSeparateSourceAmount();
    if (separateSourceAmount == null || separateSourceAmount.isLessEqual(KualiDecimal.ZERO)) {
        GlobalVariables.getMessageMap().putError(CamsPropertyConstants.AssetGlobalDetail.SEPARATE_SOURCE_AMOUNT, CamsKeyConstants.AssetSeparate.ERROR_TOTAL_SEPARATE_SOURCE_AMOUNT_REQUIRED);
        success &= false;
    }
    else {
        // for capital asset separate, validate the minimal separate source amount above the threshold
        success &= validateSeparateSourceAmountAboveThreshold(document, uniqueLocationDetail);
    }
    return success;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:20,代码来源:AssetGlobalRule.java

示例12: validateInvoicePaidApplied

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
 * This method checks that an invoice paid applied is for a valid amount.
 *
 * @param invoicePaidApplied
 * @return
 */
public static boolean validateInvoicePaidApplied(InvoicePaidApplied invoicePaidApplied, String fieldName, PaymentApplicationDocument document) {
    boolean isValid = true;

    invoicePaidApplied.refreshReferenceObject("invoiceDetail");
    if(ObjectUtils.isNull(invoicePaidApplied) || ObjectUtils.isNull(invoicePaidApplied.getInvoiceDetail())) { return true; }
    KualiDecimal amountOwed = invoicePaidApplied.getInvoiceDetail().getAmountOpen();
    KualiDecimal amountPaid = invoicePaidApplied.getInvoiceItemAppliedAmount();

    if (ObjectUtils.isNull(amountOwed)) {
        amountOwed = KualiDecimal.ZERO;
    }
    if (ObjectUtils.isNull(amountPaid)) {
        amountPaid = KualiDecimal.ZERO;
    }

    // Can't pay more than you owe.
    if (!amountPaid.isLessEqual(amountOwed)) {
        isValid = false;
        LOG.debug("InvoicePaidApplied is not valid. Amount to be applied exceeds amount outstanding.");
        GlobalVariables.getMessageMap().putError(
            fieldName, ArKeyConstants.PaymentApplicationDocumentErrors.AMOUNT_TO_BE_APPLIED_EXCEEDS_AMOUNT_OUTSTANDING);
    }

    // Can't apply more than the amount received via the related CashControlDocument
    if (amountPaid.isGreaterThan(document.getTotalFromControl())) {
        isValid = false;
        LOG.debug("InvoicePaidApplied is not valid. Cannot apply more than cash control total amount.");
        GlobalVariables.getMessageMap().putError(
            fieldName,ArKeyConstants.PaymentApplicationDocumentErrors.CANNOT_APPLY_MORE_THAN_CASH_CONTROL_TOTAL_AMOUNT);
    }

    //  cant apply negative amounts
    if (amountPaid.isNegative() && !document.hasCashControlDocument()) {
        isValid = false;
        LOG.debug("InvoicePaidApplied is not valid. Amount to be applied must be positive.");
        GlobalVariables.getMessageMap().putError(
                fieldName,ArKeyConstants.PaymentApplicationDocumentErrors.AMOUNT_TO_BE_APPLIED_MUST_BE_POSTIIVE);
    }
    return isValid;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:47,代码来源:PaymentApplicationDocumentRuleUtil.java

示例13: createDistributions

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
public void createDistributions() {

        // if there are non nonApplieds, then we have nothing to do
        if (nonAppliedHoldingsForCustomer == null || nonAppliedHoldingsForCustomer.isEmpty()) {
            return;
        }

        Collection<InvoicePaidApplied> invoicePaidAppliedsForCurrentDoc = this.getInvoicePaidApplieds();
        Collection<NonInvoiced> nonInvoicedsForCurrentDoc = this.getNonInvoiceds();

        for (NonAppliedHolding nonAppliedHoldings : this.getNonAppliedHoldingsForCustomer()) {

            // check if payment has been applied to Invoices
            // create Unapplied Distribution for each PaidApplied
            KualiDecimal remainingUnappliedForDistribution = nonAppliedHoldings.getAvailableUnappliedAmount();
            for (InvoicePaidApplied invoicePaidAppliedForCurrentDoc : invoicePaidAppliedsForCurrentDoc) {
                KualiDecimal paidAppliedDistributionAmount = invoicePaidAppliedForCurrentDoc.getPaidAppiedDistributionAmount();
                KualiDecimal remainingPaidAppliedForDistribution = invoicePaidAppliedForCurrentDoc.getInvoiceItemAppliedAmount().subtract(paidAppliedDistributionAmount);
                if (remainingPaidAppliedForDistribution.equals(KualiDecimal.ZERO) || remainingUnappliedForDistribution.equals(KualiDecimal.ZERO)) {
                    continue;
                }

                // set NonAppliedDistributions for the current document
                NonAppliedDistribution nonAppliedDistribution = new NonAppliedDistribution();
                nonAppliedDistribution.setDocumentNumber(invoicePaidAppliedForCurrentDoc.getDocumentNumber());
                nonAppliedDistribution.setPaidAppliedItemNumber(invoicePaidAppliedForCurrentDoc.getPaidAppliedItemNumber());
                nonAppliedDistribution.setReferenceFinancialDocumentNumber(nonAppliedHoldings.getReferenceFinancialDocumentNumber());
                if (remainingPaidAppliedForDistribution.isLessEqual(remainingUnappliedForDistribution)) {
                    nonAppliedDistribution.setFinancialDocumentLineAmount(remainingPaidAppliedForDistribution);
                    remainingUnappliedForDistribution = remainingUnappliedForDistribution.subtract(remainingPaidAppliedForDistribution);
                    invoicePaidAppliedForCurrentDoc.setPaidAppiedDistributionAmount(paidAppliedDistributionAmount.add(remainingPaidAppliedForDistribution));
                }
                else {
                    nonAppliedDistribution.setFinancialDocumentLineAmount(remainingUnappliedForDistribution);
                    invoicePaidAppliedForCurrentDoc.setPaidAppiedDistributionAmount(paidAppliedDistributionAmount.add(remainingUnappliedForDistribution));
                    remainingUnappliedForDistribution = KualiDecimal.ZERO;
                }
                this.nonAppliedDistributions.add(nonAppliedDistribution);
            }

            // check if payment has been applied to NonAR
            // create NonAR distribution for each NonAR Applied row
            for (NonInvoiced nonInvoicedForCurrentDoc : nonInvoicedsForCurrentDoc) {
                KualiDecimal nonInvoicedDistributionAmount = nonInvoicedForCurrentDoc.getNonInvoicedDistributionAmount();
                KualiDecimal remainingNonInvoicedForDistribution = nonInvoicedForCurrentDoc.getFinancialDocumentLineAmount().subtract(nonInvoicedDistributionAmount);
                if (remainingNonInvoicedForDistribution.equals(KualiDecimal.ZERO) || remainingUnappliedForDistribution.equals(KualiDecimal.ZERO)) {
                    continue;
                }

                // set NonAppliedDistributions for the current document
                NonInvoicedDistribution nonInvoicedDistribution = new NonInvoicedDistribution();
                nonInvoicedDistribution.setDocumentNumber(nonInvoicedForCurrentDoc.getDocumentNumber());
                nonInvoicedDistribution.setFinancialDocumentLineNumber(nonInvoicedForCurrentDoc.getFinancialDocumentLineNumber());
                nonInvoicedDistribution.setReferenceFinancialDocumentNumber(nonAppliedHoldings.getReferenceFinancialDocumentNumber());
                if (remainingNonInvoicedForDistribution.isLessEqual(remainingUnappliedForDistribution)) {
                    nonInvoicedDistribution.setFinancialDocumentLineAmount(remainingNonInvoicedForDistribution);
                    remainingUnappliedForDistribution = remainingUnappliedForDistribution.subtract(remainingNonInvoicedForDistribution);
                    nonInvoicedForCurrentDoc.setNonInvoicedDistributionAmount(nonInvoicedDistributionAmount.add(remainingNonInvoicedForDistribution));
                }
                else {
                    nonInvoicedDistribution.setFinancialDocumentLineAmount(remainingUnappliedForDistribution);
                    nonInvoicedForCurrentDoc.setNonInvoicedDistributionAmount(nonInvoicedDistributionAmount.add(remainingUnappliedForDistribution));
                    remainingUnappliedForDistribution = KualiDecimal.ZERO;
                }
                this.nonInvoicedDistributions.add(nonInvoicedDistribution);
            }
        }
    }
 
开发者ID:kuali,项目名称:kfs,代码行数:69,代码来源:PaymentApplicationDocument.java

示例14: isTravelAdvanceValid

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
private boolean isTravelAdvanceValid(TravelAuthorizationDocument document, TravelAdvance advance) {
    boolean success = true;

    GlobalVariables.getMessageMap().addToErrorPath(KRADPropertyConstants.DOCUMENT+"."+TravelAuthorizationFields.TRVL_ADV + ".");

    if(advance.getTravelAdvanceRequested() != null) {
        KualiDecimal advReq = advance.getTravelAdvanceRequested();
        if(advReq.isLessEqual(KualiDecimal.ZERO)) {
            success = false;
        }
    }
    else{
        success = false;
    }

    if(!success) {
        GlobalVariables.getMessageMap().putError(TravelAuthorizationFields.TRVL_ADV_REQUESTED, ERROR_TA_TRVL_REQ_GRTR_THAN_ZERO);
    }

    if (canCurrentUserEditDocument(document)) {
        success = success && validateDueDate(advance, document.getTripEnd());
    }

    String travelerID = document.getTraveler().getPrincipalId();
    Boolean checkPolicy = Boolean.FALSE;
    if (travelerID != null){
        //traveler must accept policy, if initiator is arranger, the traveler will have to accept later.
        checkPolicy = GlobalVariables.getUserSession().getPrincipalId().equals(travelerID);
    }
    else{ //Non-kim traveler, arranger accepts policy
        checkPolicy = Boolean.TRUE;
    }

    if (checkPolicy){
        if (!advance.getTravelAdvancePolicy()){
            success = false;
            GlobalVariables.getMessageMap().putError(TravelAuthorizationFields.TRVL_ADV_POLICY, TemKeyConstants.ERROR_TA_TRVL_ADV_POLICY);
        }
    }

    boolean testCards = getParameterService().getParameterValueAsBoolean(TravelAuthorizationDocument.class, TravelAuthorizationParameters.CASH_ADVANCE_WARNING_IND);
    if (testCards){
        Collection<String> cardTypes = getParameterService().getParameterValuesAsString(TravelAuthorizationDocument.class, TravelAuthorizationParameters.CASH_ADVANCE_CREDIT_CARD_TYPES);
        Map<String,String> cardTypeMap = new HashMap<String, String>();
        for (String cardType : cardTypes){
            cardTypeMap.put(cardType.toUpperCase(), cardType.toUpperCase());
        }

        TemProfile temProfile = document.getTemProfile();
        if (temProfile == null && travelerID != null){
            temProfile = temProfileService.findTemProfileByPrincipalId(travelerID);
        }

        if (temProfile != null && temProfile.getAccounts() != null && temProfile.getAccounts().size() > 0){
            for (TemProfileAccount account  : temProfile.getAccounts()){
                if (cardTypeMap.containsKey(account.getName().toUpperCase())){
                    if (StringUtils.isBlank(advance.getAdditionalJustification())){
                        success = false;

                        GlobalVariables.getMessageMap().putError(TravelAuthorizationFields.TRVL_ADV_ADD_JUST, TemKeyConstants.ERROR_TA_TRVL_ADV_ADD_JUST);
                    }
                }
            }
        }
    }

    GlobalVariables.getMessageMap().removeFromErrorPath(KRADPropertyConstants.DOCUMENT+"."+TravelAuthorizationFields.TRVL_ADV + ".");

    return success;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:71,代码来源:TravelAuthTravelAdvanceValidation.java

示例15: update

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
@SuppressWarnings("null")
@Override
public void update(Observable arg0, Object arg1) {
    if (!(arg1 instanceof Object[])) {
        return;
    }
    final Object[] args = (Object[]) arg1;
    LOG.debug(args[WRAPPER_ARG_IDX]);
    if (!(args[WRAPPER_ARG_IDX] instanceof TravelMvcWrapperBean)) {
        return;
    }
    final TravelMvcWrapperBean wrapper = (TravelMvcWrapperBean) args[WRAPPER_ARG_IDX];

    final TravelDocument document = wrapper.getTravelDocument();
    final Integer index = (Integer) args[SELECTED_LINE_ARG_IDX];

    final ActualExpense newActualExpenseLine = wrapper.getNewActualExpenseLines().get(index);
    ActualExpense line = document.getActualExpenses().get(index);

    if(newActualExpenseLine != null){
        if (StringUtils.isBlank(newActualExpenseLine.getExpenseTypeCode())) {
            newActualExpenseLine.setExpenseTypeCode(line.getExpenseTypeCode());
        }

        newActualExpenseLine.refreshReferenceObject(TemPropertyConstants.EXPENSE_TYPE_OBJECT_CODE);
        if (ObjectUtils.isNull(newActualExpenseLine.getExpenseTypeObjectCode())) {
            if (StringUtils.isBlank(newActualExpenseLine.getExpenseTypeCode())) {
                newActualExpenseLine.setExpenseTypeCode(line.getExpenseTypeCode());
            }
            if (!StringUtils.isBlank(document.getTripTypeCode()) && !ObjectUtils.isNull(document.getTraveler()) && !StringUtils.isBlank(document.getTraveler().getTravelerTypeCode())) {
                final ExpenseTypeObjectCode expenseTypeObjectCode = SpringContext.getBean(TravelExpenseService.class).getExpenseType(newActualExpenseLine.getExpenseTypeCode(), document.getDocumentTypeName(), document.getTripTypeCode(), document.getTraveler().getTravelerTypeCode());
                newActualExpenseLine.setExpenseTypeObjectCode(expenseTypeObjectCode);
                newActualExpenseLine.setExpenseTypeObjectCodeId(expenseTypeObjectCode.getExpenseTypeObjectCodeId());
            }
        }
    }

    boolean rulePassed = true;

    // check any business rules
    rulePassed &= getRuleService().applyRules(new AddActualExpenseDetailLineEvent<ActualExpense>(NEW_ACTUAL_EXPENSE_LINES + "["+index + "]", document, line, newActualExpenseLine));

    if (rulePassed){
        if(newActualExpenseLine != null && line != null){
            newActualExpenseLine.setExpenseLineTypeCode(null);
            if (newActualExpenseLine.getExpenseTypeObjectCodeId() == null || newActualExpenseLine.getExpenseTypeObjectCodeId().equals(new Long(0L))) {
                newActualExpenseLine.setExpenseTypeObjectCode(null); // there's no vaule but the jsp layer does not handle the null-wrapping proxy that well
            }
            document.addExpenseDetail(newActualExpenseLine, index);
            newActualExpenseLine.setExpenseDetails(null);
        }

        KualiDecimal detailTotal = line.getTotalDetailExpenseAmount();

        ActualExpense newExpense = getTravelExpenseService().createNewDetailForActualExpense(line);
        if (detailTotal.isLessEqual(line.getExpenseAmount())){
            KualiDecimal remainderExpense = line.getExpenseAmount().subtract(detailTotal);
            KualiDecimal remainderConverted = line.getConvertedAmount().subtract(new KualiDecimal(detailTotal.bigDecimalValue().multiply(line.getCurrencyRate())));
            newExpense.setExpenseAmount(remainderExpense);
            newExpense.setConvertedAmount(remainderConverted);
        }
        else{
            newExpense.setExpenseAmount(KualiDecimal.ZERO);
        }
        wrapper.getNewActualExpenseLines().add(index,newExpense);
        wrapper.getNewActualExpenseLines().remove(index+1);

        ExpenseUtils.calculateMileage(document, document.getActualExpenses());

        wrapper.setDistribution(getAccountingDistributionService().buildDistributionFrom(document));
    }

}
 
开发者ID:kuali,项目名称:kfs,代码行数:74,代码来源:AddActualExpenseDetailEvent.java


注:本文中的org.kuali.rice.core.api.util.type.KualiDecimal.isLessEqual方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。