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


Java KualiDecimal.isZero方法代码示例

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


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

示例1: validate

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
 * Asset payment amount should be a non-zero value
 *
 * @see org.kuali.kfs.sys.document.validation.Validation#validate(org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent)
 */
@Override
public boolean validate(AttributedDocumentEvent event) {
    // skip check if accounting line is from CAB
    AssetPaymentDocument assetPaymentDocument = (AssetPaymentDocument) event.getDocument();
    if (assetPaymentDocument.isCapitalAssetBuilderOriginIndicator()) {
        return true;
    }

    KualiDecimal amount = accountingLineForValidation.getAmount();
    if(ObjectUtils.isNull(amount)) {
        GlobalVariables.getMessageMap().putError(AMOUNT_PROPERTY_NAME,ERROR_BLANK_AMOUNT,"");
        return false;
    }
    else if (amount.isZero()) {
        GlobalVariables.getMessageMap().putError(AMOUNT_PROPERTY_NAME, ERROR_ZERO_AMOUNT, "an accounting line");
        return false;
    }
    return true;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:25,代码来源:AssetPaymentZeroAmountValidation.java

示例2: calculateFringeBenefit

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
 * @see org.kuali.kfs.module.ld.service.LaborBenefitsCalculationService#calculateFringeBenefit(org.kuali.kfs.module.ld.businessobject.LaborObject,
 *      org.kuali.rice.core.api.util.type.KualiDecimal)
 */
@Override
public KualiDecimal calculateFringeBenefit(LaborLedgerObject laborLedgerObject, KualiDecimal salaryAmount, String accountNumber, String subAccountNumber) {
    KualiDecimal fringeBenefit = KualiDecimal.ZERO;

    if (salaryAmount == null || salaryAmount.isZero() || ObjectUtils.isNull(laborLedgerObject)) {
        return fringeBenefit;
    }

    String FringeOrSalaryCode = laborLedgerObject.getFinancialObjectFringeOrSalaryCode();
    if (!LaborConstants.SalaryExpenseTransfer.LABOR_LEDGER_SALARY_CODE.equals(FringeOrSalaryCode)) {
        return fringeBenefit;
    }

    Integer fiscalYear = laborLedgerObject.getUniversityFiscalYear();
    String chartOfAccountsCode = laborLedgerObject.getChartOfAccountsCode();
    String objectCode = laborLedgerObject.getFinancialObjectCode();

    Collection<PositionObjectBenefit> positionObjectBenefits = laborPositionObjectBenefitService.getActivePositionObjectBenefits(fiscalYear, chartOfAccountsCode, objectCode);
    for (PositionObjectBenefit positionObjectBenefit : positionObjectBenefits) {
            KualiDecimal benefitAmount = this.calculateFringeBenefit(positionObjectBenefit, salaryAmount, accountNumber, subAccountNumber);
            fringeBenefit = fringeBenefit.add(benefitAmount);
    }

    return fringeBenefit;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:30,代码来源:LaborBenefitsCalculationServiceImpl.java

示例3: calculatePayrollPercent

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
 * calculate the payroll percentage based on the given information in payroll amount holder
 * 
 * @param payrollAmountHolder the given payroll amount holder containing relating information
 */
public static void calculatePayrollPercent(PayrollAmountHolder payrollAmountHolder) {
    KualiDecimal totalAmount = payrollAmountHolder.getTotalAmount();
    if (totalAmount.isZero()) {
        return;
    }

    KualiDecimal payrollAmount = payrollAmountHolder.getPayrollAmount();
    KualiDecimal accumulatedAmount = payrollAmountHolder.getAccumulatedAmount();
    accumulatedAmount = accumulatedAmount.add(payrollAmount);

    int accumulatedPercent = payrollAmountHolder.getAccumulatedPercent();
    int quotientOne = Math.round(payrollAmount.multiply(HUNDRED_DOLLAR_AMOUNT).divide(totalAmount).floatValue());
    accumulatedPercent = accumulatedPercent + quotientOne;

    int quotientTwo = Math.round(accumulatedAmount.multiply(HUNDRED_DOLLAR_AMOUNT).divide(totalAmount).floatValue());
    quotientTwo = quotientTwo - accumulatedPercent;

    payrollAmountHolder.setAccumulatedAmount(accumulatedAmount);
    payrollAmountHolder.setAccumulatedPercent(accumulatedPercent + quotientTwo);
    payrollAmountHolder.setPayrollPercent(quotientOne + quotientTwo);
}
 
开发者ID:kuali,项目名称:kfs,代码行数:27,代码来源:PayrollAmountHolder.java

示例4: isNullOrZero

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
protected boolean isNullOrZero(KualiDecimal value) {

        if (ObjectUtils.isNull(value) || value.isZero()) {
            return true;
        } else {
            return false;
        }
    }
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:9,代码来源:ElectronicInvoiceHelperServiceImpl.java

示例5: isTotalInvalid

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
 * Returns true if total is invalid and puts an error message in the error map for that property if the amount is negative
 * 
 * @param cashReceiptDocument
 * @param totalAmount
 * @param documentEntryName
 * @param propertyName
 * @return true if the totalAmount is an invalid value
 */
private static boolean isTotalInvalid(CreditCardReceiptDocument ccrDocument, KualiDecimal totalAmount, String documentEntryName, String propertyName) {
    boolean isInvalid = false;
    String errorProperty = CREDIT_CARD_RECEIPT_PREFIX + propertyName;

    // treating null totalAmount as if it were a zero
    DataDictionaryService dds = SpringContext.getBean(DataDictionaryService.class);
    String errorLabel = dds.getAttributeLabel(documentEntryName, propertyName);
    if ((totalAmount == null) || totalAmount.isZero()) {
        GlobalVariables.getMessageMap().putError(errorProperty, CashReceipt.ERROR_ZERO_TOTAL, errorLabel);

        isInvalid = true;
    }
    else {
        int precount = GlobalVariables.getMessageMap().getNumberOfPropertiesWithErrors();

        DictionaryValidationService dvs = SpringContext.getBean(DictionaryValidationService.class);
        dvs.validateDocumentAttribute(ccrDocument, propertyName, DOCUMENT_ERROR_PREFIX);

        // replace generic error message, if any, with something more readable
        GlobalVariables.getMessageMap().replaceError(errorProperty, KFSKeyConstants.ERROR_MAX_LENGTH, CashReceipt.ERROR_EXCESSIVE_TOTAL, errorLabel);

        int postcount = GlobalVariables.getMessageMap().getNumberOfPropertiesWithErrors();
        isInvalid = (postcount > precount);
    }

    return isInvalid;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:37,代码来源:CreditCardReceiptDocumentRuleUtil.java

示例6: createGLPostables

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
 * @see org.kuali.kfs.module.cam.document.service.AssetGlobalService#createGLPostables(org.kuali.module.cams.document.AssetGlobal)
 */
@Override
public void createGLPostables(AssetGlobal assetGlobal, CamsGeneralLedgerPendingEntrySourceBase assetGlobalGlPoster) {
    List<AssetPaymentDetail> assetPaymentDetails = assetGlobal.getAssetPaymentDetails();

    for (AssetPaymentDetail assetPaymentDetail : assetPaymentDetails) {
        if (isPaymentFinancialObjectActive(assetPaymentDetail)) {
            KualiDecimal accountChargeAmount = assetPaymentDetail.getAmount();
            if (accountChargeAmount != null && !accountChargeAmount.isZero()) {
                assetGlobalGlPoster.getGeneralLedgerPendingEntrySourceDetails().add(createAssetGlpePostable(assetGlobal, assetPaymentDetail, AmountCategory.PAYMENT));
                assetGlobalGlPoster.getGeneralLedgerPendingEntrySourceDetails().add(createAssetGlpePostable(assetGlobal, assetPaymentDetail, AmountCategory.PAYMENT_OFFSET));
            }
        }
    }
}
 
开发者ID:kuali,项目名称:kfs,代码行数:18,代码来源:AssetGlobalServiceImpl.java

示例7: validate

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
 * @see org.kuali.ole.sys.document.validation.Validation#validate(org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent)
 */
public boolean validate(AttributedDocumentEvent event) {
    CreditCardReceiptDocument ccrDocument = getAccountingDocumentForValidation();
    KualiDecimal totalAmount = ccrDocument.getTotalDollarAmount();
    String propertyName = OLEPropertyConstants.CREDIT_CARD_RECEIPTS_TOTAL;
    String documentEntryName = ccrDocument.getDocumentHeader().getWorkflowDocument().getDocumentTypeName();
    
    boolean isValid = true;
    String errorProperty = CREDIT_CARD_RECEIPT_PREFIX + propertyName;

    // treating null totalAmount as if it were a zero
    DataDictionaryService dds = SpringContext.getBean(DataDictionaryService.class);
    String errorLabel = dds.getAttributeLabel(documentEntryName, propertyName);
    if ((totalAmount == null) || totalAmount.isZero()) {
        GlobalVariables.getMessageMap().putError(errorProperty, CashReceipt.ERROR_ZERO_TOTAL, errorLabel);

        isValid = false;
    }
    else {
        int precount = GlobalVariables.getMessageMap().getNumberOfPropertiesWithErrors();

        DictionaryValidationService dvs = SpringContext.getBean(DictionaryValidationService.class);
        dvs.validateDocumentAttribute(ccrDocument, propertyName, DOCUMENT_ERROR_PREFIX);

        // replace generic error message, if any, with something more readable
        GlobalVariables.getMessageMap().replaceError(errorProperty, OLEKeyConstants.ERROR_MAX_LENGTH, CashReceipt.ERROR_EXCESSIVE_TOTAL, errorLabel);

        int postcount = GlobalVariables.getMessageMap().getNumberOfPropertiesWithErrors();
        isValid = (postcount == precount);
    }

    return isValid;
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:36,代码来源:CreditCardReceiptCashTotalsValidation.java

示例8: redistributeEqualAmountsOnLastCapitalAsset

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
 * redistributes the amounts to the capital asset and its related group accounting lines.
 * Adjusts any variance to the last capital asset accounting line.
 *
 * @param selectedCapitalAccountingLines
 * @param capitalAsset
 * @param capitalAssetInformation
 * @param actionTypeCode
 */
protected void redistributeEqualAmountsOnLastCapitalAsset(List<CapitalAccountingLines> selectedCapitalAccountingLines, CapitalAssetInformation lastCapitalAsset, List<CapitalAssetInformation> capitalAssetInformation, String actionTypeCode) {
    for (CapitalAccountingLines capitalAccountingLine : selectedCapitalAccountingLines ) {
        KualiDecimal lineAmount = capitalAccountingLine.getAmount();
        KualiDecimal distributedAmount = getAccountingLinesDistributedAmount(capitalAccountingLine, capitalAssetInformation, actionTypeCode);
        KualiDecimal difference = lineAmount.subtract(distributedAmount);
        if (!difference.isZero()) {
            adjustAccountingLineAmountOnLastCapitalAsset(capitalAccountingLine, lastCapitalAsset, difference);
        }
    }
        }
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:20,代码来源:CapitalAssetInformationActionBase.java

示例9: validateTransactionAmount

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
 * Validates the entry's transaction amount
 *
 * @param originEntry the origin entry being scrubbed
 * @param workingEntry the scrubbed version of the origin entry
 * @return a Message if an error was encountered, otherwise null
 */
protected Message validateTransactionAmount(OriginEntryInformation originEntry, OriginEntryInformation workingEntry, AccountingCycleCachingService accountingCycleCachingService) {
    LOG.debug("validateTransactionAmount() started");

    KualiDecimal amount = originEntry.getTransactionLedgerEntryAmount();
    BalanceType originEntryBalanceType = accountingCycleCachingService.getBalanceType(originEntry.getFinancialBalanceTypeCode());

    if (originEntryBalanceType == null) {
        // We can't validate the amount without a balance type code
        return null;
    }

    if (originEntryBalanceType.isFinancialOffsetGenerationIndicator()) {
        if (amount.isPositive() || amount.isZero()) {
            workingEntry.setTransactionLedgerEntryAmount(originEntry.getTransactionLedgerEntryAmount());
        }
        else {
            return MessageBuilder.buildMessage(OLEKeyConstants.ERROR_NEGATIVE_AMOUNT, amount.toString(), Message.TYPE_FATAL);
        }
        if (StringHelper.isEmpty(originEntry.getTransactionDebitCreditCode())) {
            return MessageBuilder.buildMessage(OLEKeyConstants.ERROR_DEBIT_CREDIT_INDICATOR_NEITHER_D_NOR_C, originEntry.getTransactionDebitCreditCode(), Message.TYPE_FATAL);
        }
        if ( debitOrCredit.contains(originEntry.getTransactionDebitCreditCode()) ) {
            workingEntry.setTransactionDebitCreditCode(originEntry.getTransactionDebitCreditCode());
        }
        else {
            return MessageBuilder.buildMessage(OLEKeyConstants.ERROR_DEBIT_CREDIT_INDICATOR_NEITHER_D_NOR_C, originEntry.getTransactionDebitCreditCode(), Message.TYPE_FATAL);
        }
    }
    else {
        if ((originEntry.getTransactionDebitCreditCode() == null) || (" ".equals(originEntry.getTransactionDebitCreditCode())) || ("".equals(originEntry.getTransactionDebitCreditCode()))) {
            workingEntry.setTransactionDebitCreditCode(OLEConstants.GL_BUDGET_CODE);
        }
        else {
            return MessageBuilder.buildMessage(OLEKeyConstants.ERROR_DEBIT_CREDIT_INDICATOR_MUST_BE_SPACE, originEntry.getTransactionDebitCreditCode(), Message.TYPE_FATAL);
        }
    }
    return null;
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:46,代码来源:ScrubberValidatorImpl.java

示例10: validateNonInvoicedLineAmount

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
 * @param nonInvoiced
 * @param paymentApplicationDocument
 * @param totalFromControl
 * @return
 */
protected static boolean validateNonInvoicedLineAmount(NonInvoiced nonInvoiced, PaymentApplicationDocument paymentApplicationDocument, KualiDecimal totalFromControl) {
    MessageMap errorMap = GlobalVariables.getMessageMap();
    KualiDecimal nonArLineAmount = nonInvoiced.getFinancialDocumentLineAmount();
    // check that dollar amount is not zero before continuing
    if (ObjectUtils.isNull(nonArLineAmount)) {
        errorMap.putError(ArPropertyConstants.PaymentApplicationDocumentFields.NON_INVOICED_LINE_AMOUNT, ArKeyConstants.PaymentApplicationDocumentErrors.NON_AR_AMOUNT_REQUIRED);
        return false;
    }
    else {
        KualiDecimal cashControlBalanceToBeApplied = totalFromControl;
        cashControlBalanceToBeApplied = cashControlBalanceToBeApplied.add(paymentApplicationDocument.getTotalFromControl());
        cashControlBalanceToBeApplied.subtract(paymentApplicationDocument.getTotalApplied());
        cashControlBalanceToBeApplied.subtract(paymentApplicationDocument.getNonAppliedHoldingAmount());

        if (nonArLineAmount.isZero()) {
            errorMap.putError(ArPropertyConstants.PaymentApplicationDocumentFields.NON_INVOICED_LINE_AMOUNT, ArKeyConstants.PaymentApplicationDocumentErrors.AMOUNT_TO_BE_APPLIED_CANNOT_BE_ZERO);
            return false;
        }
        else if (nonArLineAmount.isNegative()) {
            errorMap.putError(ArPropertyConstants.PaymentApplicationDocumentFields.NON_INVOICED_LINE_AMOUNT, ArKeyConstants.PaymentApplicationDocumentErrors.AMOUNT_TO_BE_APPLIED_MUST_BE_POSTIIVE);
            return false;
        }
        // check that we're not trying to apply more funds to the invoice than the invoice has balance (ie, over-applying)
        else if (KualiDecimal.ZERO.isGreaterThan(cashControlBalanceToBeApplied.subtract(nonArLineAmount))) {
            errorMap.putError(ArPropertyConstants.PaymentApplicationDocumentFields.NON_INVOICED_LINE_AMOUNT, ArKeyConstants.PaymentApplicationDocumentErrors.NON_AR_AMOUNT_EXCEEDS_BALANCE_TO_BE_APPLIED);
            return false;
        }

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

示例11: reimbursementIsGreaterThanAuthorizationByOverage

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
 * Parses all the passed in values and determines if the difference between the reimbursement amount and the authorization amount should trigger a match
 * @param reimbursementAmountAsString the unparsed reimbursement amount
 * @param authorizationAmountAsString the unparsed authorization amount
 * @param reimbursementOveragePercentageAsString the unparsed reimbursement overage percentage amount
 * @return true if:
 * <ol>
 * <li>the reimbursement overage percentage is blank or 0</li>
 * <li>the reimbursement was larger than the authorization and the difference between the two was greater than or equal to the reimbursementOveragePercentage</li>
 * </ol>
 * and false otherwise
 */
protected boolean reimbursementIsGreaterThanAuthorizationByOverage(String reimbursementAmountAsString, String authorizationAmountAsString, String reimbursementOveragePercentageAsString) {
    if (StringUtils.isBlank(reimbursementOveragePercentageAsString)) {
        return true;
    }

    final KualiDecimal reimbursementOveragePercentage = new KualiDecimal(reimbursementOveragePercentageAsString);
    if (reimbursementOveragePercentage.isZero()) {
        return true;
    }

    try {
        final KualiDecimal reimbursementAmount = new KualiDecimal(reimbursementAmountAsString);
        final KualiDecimal authorizationAmount = new KualiDecimal(authorizationAmountAsString);

        if (KualiDecimal.ZERO.isGreaterEqual(reimbursementAmount) || KualiDecimal.ZERO.isGreaterEqual(authorizationAmount)) {
            return false; // reimbursement total or authorization total are equal to or less than 0; let's not trigger a match
        }

        if (authorizationAmount.isGreaterThan(reimbursementAmount)) {
            return false; // authorization is more than reimbursement?  Then there's no overage....
        }

        final KualiDecimal oneHundred = new KualiDecimal(100); // multiply by 100 so we get some scale without having to revert to BigDecimals
        final KualiDecimal diff = reimbursementAmount.subtract(authorizationAmount).multiply(oneHundred);
        final KualiDecimal diffPercentage = diff.divide(authorizationAmount.multiply(oneHundred)).multiply(oneHundred); // mult authorizationAmount by 100 to get some scale; mult 100 by result to correctly compare to percentage

        return diffPercentage.isGreaterEqual(reimbursementOveragePercentage);
    } catch (NumberFormatException nfe) {
        return false; // we either couldn't parse reimbursement amount or authorization amount.  That's weird, but whatever...we shall not match
    }
}
 
开发者ID:kuali,项目名称:kfs,代码行数:44,代码来源:ReimbursementOverageOrganizationHierarchyRoleTypeServiceImpl.java

示例12: isAmountValid

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
 * determine whether the amount in the account is not zero.
 * 
 * @param accountingDocument the given accounting line
 * @return true if the amount is not zero; otherwise, false
 */

public boolean isAmountValid(AccountingDocument document, AccountingLine accountingLine) {
    KualiDecimal amount = accountingLine.getAmount();

    // Check for zero amount
    if (amount.isZero()) {
        GlobalVariables.getMessageMap().putError(KFSPropertyConstants.AMOUNT, KFSKeyConstants.ERROR_ZERO_AMOUNT, "an accounting line");
        return false;
    }
    return true;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:18,代码来源:LaborExpenseTransfeAmountValidValidation.java

示例13: redistributeEqualAmountsOnLastCapitalAsset

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
 * redistributes the amounts to the capital asset and its related group accounting lines.
 * Adjusts any variance to the last capital asset accounting line.
 *
 * @param selectedCapitalAccountingLines
 * @param capitalAsset
 * @param capitalAssetInformation
 * @param actionTypeCode
 */
protected void redistributeEqualAmountsOnLastCapitalAsset(List<CapitalAccountingLines> selectedCapitalAccountingLines, CapitalAssetInformation lastCapitalAsset, List<CapitalAssetInformation> capitalAssetInformation, String actionTypeCode) {
    for (CapitalAccountingLines capitalAccountingLine : selectedCapitalAccountingLines ) {
        KualiDecimal lineAmount = capitalAccountingLine.getAmount();
        KualiDecimal distributedAmount = getAccountingLinesDistributedAmount(capitalAccountingLine, capitalAssetInformation, actionTypeCode);
        KualiDecimal difference = lineAmount.subtract(distributedAmount);
        if (!difference.isZero()) {
            adjustAccountingLineAmountOnLastCapitalAsset(capitalAccountingLine, lastCapitalAsset, difference);
        }
    }
}
 
开发者ID:kuali,项目名称:kfs,代码行数:20,代码来源:CapitalAssetInformationActionBase.java

示例14: isNonZeroAmountBalanceWithinReportPeriod

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
 * determine if the total amount within the specified periods of the given ledger balance is ZERO
 *
 * @param ledgerBalance the given ledger balance
 * @param reportPeriods the specified periods
 * @return null the total amount within the specified periods of the given ledger balance is NOT ZERO; otherwise, a message
 *         message
 */
public static Message isNonZeroAmountBalanceWithinReportPeriod(LaborLedgerBalance ledgerBalance, Map<Integer, Set<String>> reportPeriods) {
    KualiDecimal totalAmount = LedgerBalanceConsolidationHelper.calculateTotalAmountWithinReportPeriod(ledgerBalance, reportPeriods);

    if (totalAmount.isZero()) {
        return MessageBuilder.buildMessage(EffortKeyConstants.ERROR_ZERO_PAYROLL_AMOUNT, Message.TYPE_FATAL);
    }
    return null;
}
 
开发者ID:kuali,项目名称:kfs,代码行数:17,代码来源:LedgerBalanceFieldValidator.java

示例15: validateProrationType

import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
protected boolean validateProrationType(InvoiceDocument invoiceDocument) {
    boolean isValid = true;
    OleInvoiceDocument document = (OleInvoiceDocument) invoiceDocument;
    List<OleInvoiceItem> items = document.getItems();
    boolean additionalItemPresent = false;
    boolean canProrate = false;
    KualiDecimal additionalCharge = KualiDecimal.ZERO;
    KualiDecimal totalAmt = document.getInvoicedItemTotal() != null ?
            new KualiDecimal(document.getInvoicedItemTotal()) : KualiDecimal.ZERO;
    for (OleInvoiceItem invoiceItem : items) {
        if (invoiceItem.getItemType().isAdditionalChargeIndicator() && invoiceItem.getExtendedPrice() != null &&
                !invoiceItem.getExtendedPrice().isZero()) {
            additionalCharge = additionalCharge.add(invoiceItem.getExtendedPrice());
            additionalItemPresent  = true;
        }
        if (invoiceItem.getItemType().isQuantityBasedGeneralLedgerIndicator() && invoiceItem.getItemUnitPrice().compareTo(BigDecimal.ZERO) != 0 ) {
            canProrate = true;
        }
    }
    if (additionalItemPresent && ((document.getProrateBy() == null) ||
            (!document.isProrateDollar() && !document.isProrateManual() && !document.isProrateQty() && !document.isNoProrate()))) {
        GlobalVariables.getMessageMap().putErrorForSectionId(OleSelectConstant.INVOICE_ADDITIONAL_ITEM_SECTION_ID,
                OLEKeyConstants.ERROR_REQUIRED, PurapConstants.PRQSDocumentsStrings.PRORATION_TYPE);
        isValid &= false;

    }
    if ((totalAmt.isZero() || !canProrate) && document.isProrateDollar() ) {
        GlobalVariables.getMessageMap().putError(OleSelectConstant.INVOICE_ADDITIONAL_CHARGE_SECTION_ID,
                OLEKeyConstants.ERROR_PRORATE_DOLLAR_ZERO_ITEM_TOTAL);
    }
    if (document.getVendorCustomerNumber() != null && !document.getVendorCustomerNumber().equalsIgnoreCase("")) {
        Map<String, String> map = new HashMap<String, String>();
        if (document.getVendorCustomerNumber() != null && !document.getVendorCustomerNumber().equalsIgnoreCase("")) {
            map.put(OLEConstants.VENDOR_CUSTOMER_NUMBER, document.getVendorCustomerNumber());
        }
        if (document.getVendorHeaderGeneratedIdentifier() != null && !document.getVendorHeaderGeneratedIdentifier().toString().equalsIgnoreCase("")) {
            map.put(OLEConstants.VENDOR_HEADER_IDENTIFIER, document.getVendorHeaderGeneratedIdentifier().toString());
        }
        if (document.getVendorDetailAssignedIdentifier() != null && !document.getVendorDetailAssignedIdentifier().toString().equalsIgnoreCase("")) {
            map.put(OLEConstants.VENDOR_DETAIL_IDENTIFIER, document.getVendorDetailAssignedIdentifier().toString());
        }
        List<VendorCustomerNumber> vendorCustomerNumbers = (List<VendorCustomerNumber>) KRADServiceLocator.getBusinessObjectService().findMatching(VendorCustomerNumber.class, map);
        if (!(vendorCustomerNumbers != null && vendorCustomerNumbers.size() > 0)) {
            isValid &= false;
            GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, OLEConstants.INVALID_ACQUISITION_NUMBER);
        }
    }
   /* if (totalAmt != null && totalAmt.isZero() && !additionalCharge.isZero() && document.isProrateDollar() ) {
        GlobalVariables.getMessageMap().putError(OleSelectConstant.INVOICE_ADDITIONAL_CHARGE_SECTION_ID,
                OLEKeyConstants.ERROR_PRORATE_DOLLAR_ZERO_ITEM_TOTAL);
        isValid &= false;
    }*/
    return isValid;
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:55,代码来源:InvoiceProcessItemValidation.java


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