本文整理汇总了Java中org.kuali.rice.core.api.util.type.KualiDecimal.isNonZero方法的典型用法代码示例。如果您正苦于以下问题:Java KualiDecimal.isNonZero方法的具体用法?Java KualiDecimal.isNonZero怎么用?Java KualiDecimal.isNonZero使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.core.api.util.type.KualiDecimal
的用法示例。
在下文中一共展示了KualiDecimal.isNonZero方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cosolidateLedgerBalances
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* consolidate the given labor ledger balances and determine whether they are qualified for effort reporting
*
* @param ledgerBalances the given labor ledger balances
* @param reportDefinition the specified report definition
* @return a collection of ledger balances if they are qualified; otherwise, return null
*/
protected List<LaborLedgerBalance> cosolidateLedgerBalances(List<LaborLedgerBalance> ledgerBalances, EffortCertificationReportDefinition reportDefinition) {
List<LaborLedgerBalance> cosolidatedLedgerBalances = new ArrayList<LaborLedgerBalance>();
Map<Integer, Set<String>> reportPeriods = reportDefinition.getReportPeriods();
Map<String, LaborLedgerBalance> ledgerBalanceMap = new HashMap<String, LaborLedgerBalance>();
LedgerBalanceConsolidationHelper.consolidateLedgerBalances(ledgerBalanceMap, ledgerBalances, this.getConsolidationKeys());
for (String key : ledgerBalanceMap.keySet()) {
LaborLedgerBalance ledgerBalance = ledgerBalanceMap.get(key);
KualiDecimal totalAmount = LedgerBalanceConsolidationHelper.calculateTotalAmountWithinReportPeriod(ledgerBalance, reportPeriods);
if (totalAmount.isNonZero()) {
cosolidatedLedgerBalances.add(ledgerBalance);
}
}
return cosolidatedLedgerBalances;
}
示例2: validateCreditAndDebitAmounts
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* This method checks to make sure that there isn't a value in both the credit and debit columns for a given accounting line.
*
* @param creditAmount
* @param debitAmount
* @param index if -1, it's a new line, if not -1, then its an existing line
* @return boolean False if both the credit and debit fields have a value, true otherwise.
*/
protected boolean validateCreditAndDebitAmounts(KualiDecimal debitAmount, KualiDecimal creditAmount, int index) {
boolean valid = false;
if (null != creditAmount && null != debitAmount) {
if (creditAmount.isNonZero() && debitAmount.isNonZero()) {
// there's a value in both fields
if (OLEConstants.NEGATIVE_ONE == index) { // it's a new line
GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(OLEConstants.DEBIT_AMOUNT_PROPERTY_NAME, OLEKeyConstants.ERROR_DOCUMENT_JV_AMOUNTS_IN_CREDIT_AND_DEBIT_FIELDS);
GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(OLEConstants.CREDIT_AMOUNT_PROPERTY_NAME, OLEKeyConstants.ERROR_DOCUMENT_JV_AMOUNTS_IN_CREDIT_AND_DEBIT_FIELDS);
}
else {
String errorKeyPath = OLEConstants.JOURNAL_LINE_HELPER_PROPERTY_NAME + OLEConstants.SQUARE_BRACKET_LEFT + Integer.toString(index) + OLEConstants.SQUARE_BRACKET_RIGHT;
GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(errorKeyPath + VOUCHER_LINE_HELPER_DEBIT_PROPERTY_NAME, OLEKeyConstants.ERROR_DOCUMENT_JV_AMOUNTS_IN_CREDIT_AND_DEBIT_FIELDS);
GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(errorKeyPath + VOUCHER_LINE_HELPER_CREDIT_PROPERTY_NAME, OLEKeyConstants.ERROR_DOCUMENT_JV_AMOUNTS_IN_CREDIT_AND_DEBIT_FIELDS);
}
}
else {
valid = true;
}
}
else {
valid = true;
}
return valid;
}
示例3: validateMaximumAmountRules
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* This method validates following rules 1.Validates user entered amount with max amount & max amount per configured in
* database(daily & occurrence).
*
* @param actualExpense
* @param document
* @return boolean
*/
public boolean validateMaximumAmountRules(ActualExpense actualExpense, TravelDocument document) {
boolean success = true;
ExpenseTypeObjectCode expenseTypeObjectCode = actualExpense.getExpenseTypeObjectCode();
KualiDecimal maxAmount = getMaximumAmount(actualExpense, document, expenseTypeObjectCode);
if (maxAmount.isNonZero()) {
if (expenseTypeObjectCode.isPerDaily()) {
if (maxAmount.isLessThan(actualExpense.getConvertedAmount())) { // per daily - check that just this actual expense is greater than max amount
success = false;
GlobalVariables.getMessageMap().putError(TemPropertyConstants.EXPENSE_AMOUNT, TemKeyConstants.ERROR_ACTUAL_EXPENSE_MAX_AMT_PER_DAILY, expenseTypeObjectCode.getMaximumAmount().toString());
}
}
else if (expenseTypeObjectCode.isPerOccurrence()) {
KualiDecimal totalPerExpenseType = getTotalDocumentAmountForExpenseType(document, actualExpense.getExpenseType());
if (!isCurrentExpenseInCollection()) {
totalPerExpenseType = totalPerExpenseType.add(actualExpense.getConvertedAmount());
}
if (maxAmount.isLessThan(totalPerExpenseType)) {
success = false;
GlobalVariables.getMessageMap().putError(TemPropertyConstants.EXPENSE_AMOUNT, TemKeyConstants.ERROR_ACTUAL_EXPENSE_MAX_AMT_PER_OCCU, expenseTypeObjectCode.getMaximumAmount().toString());
}
}
}
return success;
}
示例4: validate
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
public boolean validate(AttributedDocumentEvent event)
{
boolean valid = true;
PaymentRequestDocument document = (PaymentRequestDocument)event.getDocument();
GlobalVariables.getMessageMap().clearErrorPath();
GlobalVariables.getMessageMap().addToErrorPath(KFSPropertyConstants.DOCUMENT);
int i = 0;
for (PurApItem item : (List<PurApItem>)document.getItems()) {
KualiDecimal itemQuantity = item.getItemQuantity();
if (itemQuantity != null) {
if (!itemQuantity.isNonZero()) {
GlobalVariables.getMessageMap().putError("item[" + i + "].itemQuantity", PurapKeyConstants.ERROR_PAYMENT_REQUEST_LINE_ITEM_QUANTITY_ZERO);
GlobalVariables.getMessageMap().clearErrorPath();
valid = false;
break;
}
i++;
}
}
return valid;
}
示例5: getAssetPaymentDistributions
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* @see org.kuali.kfs.module.cam.util.distribution.AssetDistribution#getAssetPaymentDistributions()
*/
public Map<String, Map<AssetPaymentAssetDetail, KualiDecimal>> getAssetPaymentDistributions() {
distributionResult = new HashMap<String, Map<AssetPaymentAssetDetail, KualiDecimal>>();
KualiDecimal totalLineAmount = getTotalLineAmount();
for (AssetPaymentDetail line : getAssetPaymentDetailLines()) {
KualiDecimal lineAmount = line.getAmount();
KualiDecimal remainingAmount = lineAmount;
Map<AssetPaymentAssetDetail, KualiDecimal> apadMap = new HashMap<AssetPaymentAssetDetail, KualiDecimal>();
int size = doc.getAssetPaymentAssetDetail().size();
for (int i = 0; i < size; i++) {
AssetPaymentAssetDetail apad = doc.getAssetPaymentAssetDetail().get(i);
if (i < size - 1) {
BigDecimal allocationPercentage = apad.getAllocatedUserValuePct();
BigDecimal amount = BigDecimal.ZERO;
if (lineAmount.isNonZero()) {
amount = allocationPercentage.divide(new BigDecimal(100)).multiply(lineAmount.bigDecimalValue());
}
apadMap.put(apad, new KualiDecimal(amount));
remainingAmount = remainingAmount.subtract(new KualiDecimal(amount));
} else {
apadMap.put(apad, remainingAmount);
}
}
distributionResult.put(line.getAssetPaymentDetailKey(), apadMap);
}
return distributionResult;
}
示例6: getSelectedObjectIds
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* put all enties into select object map. This implmentation only deals with the money amount objects.
*
* @param multipleValueLookupForm the given struts form
* @param resultTable the given result table that holds all data being presented
* @return the map containing all entries available for selection
*
* KRAD Conversion: Performs customization of the results. Prepares
*
* There is no use of data dictionary for fields.
*/
private Map<String, String> getSelectedObjectIds(MultipleValueLookupForm multipleValueLookupForm, List<ResultRow> resultTable) {
String businessObjectClassName = multipleValueLookupForm.getBusinessObjectClassName();
SegmentedBusinessObject segmentedBusinessObject;
try {
segmentedBusinessObject = (SegmentedBusinessObject) Class.forName(multipleValueLookupForm.getBusinessObjectClassName()).newInstance();
}
catch (Exception e) {
throw new RuntimeException("Fail to create an object of " + businessObjectClassName + e);
}
Map<String, String> selectedObjectIds = new HashMap<String, String>();
Collection<String> segmentedPropertyNames = segmentedBusinessObject.getSegmentedPropertyNames();
for (ResultRow row : resultTable) {
for (Column column : row.getColumns()) {
String propertyName = column.getPropertyName();
if (segmentedPropertyNames.contains(propertyName)) {
String propertyValue = StringUtils.replace(column.getPropertyValue(), ",", "");
KualiDecimal amount = new KualiDecimal(propertyValue);
if (amount.isNonZero()) {
String objectId = row.getObjectId() + "." + propertyName + "." + KRADUtils.convertDecimalIntoInteger(amount);
selectedObjectIds.put(objectId, objectId);
}
}
}
}
return selectedObjectIds;
}
示例7: getFullDiscountTaxablePrice
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
public KualiDecimal getFullDiscountTaxablePrice(KualiDecimal extendedPrice, PurchasingAccountsPayableDocument purapDocument) {
KualiDecimal taxablePrice = KualiDecimal.ZERO;
KualiDecimal taxableLineItemPrice = KualiDecimal.ZERO;
KualiDecimal totalLineItemPrice = KualiDecimal.ZERO;
boolean useTaxIndicator = purapDocument.isUseTaxIndicator();
String deliveryState = getDeliveryState(purapDocument);
// iterate over items and calculate tax if taxable
for (PurApItem item : purapDocument.getItems()) {
if (item.getItemType().isLineItemIndicator()) {
//only when extended price exists
if (ObjectUtils.isNotNull(item.getExtendedPrice())) {
if (isTaxable(useTaxIndicator, deliveryState, item)) {
taxableLineItemPrice = taxableLineItemPrice.add(item.getExtendedPrice());
totalLineItemPrice = totalLineItemPrice.add(item.getExtendedPrice());
} else {
totalLineItemPrice = totalLineItemPrice.add(item.getExtendedPrice());
}
}
}
}
//check nonzero so no divide by zero errors, and make sure extended price is not null
if (totalLineItemPrice.isNonZero() && ObjectUtils.isNotNull(extendedPrice)) {
taxablePrice = taxableLineItemPrice.divide(totalLineItemPrice).multiply(extendedPrice);
}
return taxablePrice;
}
示例8: validate
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* Validates that the budget adjustment document is balanced, based on whether the source base amount equals the target base amount
* and that the income stream balance map has no non-zero values.
* @see org.kuali.ole.sys.document.validation.Validation#validate(org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent)
*/
public boolean validate(AttributedDocumentEvent event) {
MessageMap errors = GlobalVariables.getMessageMap();
boolean balanced = true;
// check base amounts are equal
//KFSMI-3036
KualiDecimal sourceBaseBudgetTotal = getAccountingDocumentForValidation().getSourceBaseBudgetIncomeTotal().subtract( getAccountingDocumentForValidation().getSourceBaseBudgetExpenseTotal());
KualiDecimal targetBaseBudgetTotal = getAccountingDocumentForValidation().getTargetBaseBudgetIncomeTotal().subtract( getAccountingDocumentForValidation().getTargetBaseBudgetExpenseTotal());
if (sourceBaseBudgetTotal.compareTo(targetBaseBudgetTotal) != 0) {
GlobalVariables.getMessageMap().putError(OLEConstants.ACCOUNTING_LINE_ERRORS, OLEKeyConstants.ERROR_DOCUMENT_BA_BASE_AMOUNTS_BALANCED);
balanced = false;
}
// check current amounts balance, income stream balance Map should add to 0
Map incomeStreamMap = getAccountingDocumentForValidation().buildIncomeStreamBalanceMapForDocumentBalance();
KualiDecimal totalCurrentAmount = new KualiDecimal(0);
for (Iterator iter = incomeStreamMap.values().iterator(); iter.hasNext();) {
KualiDecimal streamAmount = (KualiDecimal) iter.next();
totalCurrentAmount = totalCurrentAmount.add(streamAmount);
}
if (totalCurrentAmount.isNonZero()) {
GlobalVariables.getMessageMap().putError(OLEConstants.ACCOUNTING_LINE_ERRORS, OLEKeyConstants.ERROR_DOCUMENT_BA_CURRENT_AMOUNTS_BALANCED);
balanced = false;
}
return balanced;
}
示例9: validate
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* Validates the total of the monthly amount fields (if not 0) equals the current budget amount. If current budget is 0, then
* total of monthly fields must be 0.
*
* @see org.kuali.ole.sys.document.validation.Validation#validate(org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent)
*/
public boolean validate(AttributedDocumentEvent event) {
boolean validMonthlyLines = true;
KualiDecimal monthlyTotal = getAccountingLineForValidation().getMonthlyLinesTotal();
if (monthlyTotal.isNonZero() && monthlyTotal.compareTo(getAccountingLineForValidation().getCurrentBudgetAdjustmentAmount()) != 0) {
GlobalVariables.getMessageMap().putError(OLEPropertyConstants.CURRENT_BUDGET_ADJUSTMENT_AMOUNT, OLEKeyConstants.ERROR_DOCUMENT_BA_MONTH_TOTAL_NOT_EQUAL_CURRENT);
validMonthlyLines = false;
}
return validMonthlyLines;
}
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:18,代码来源:BudgetAdjustmentAccountingLineMonthlyLinesValidation.java
示例10: redistributeAmountsForAccountingsLineForModifyAssets
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
*
* @param accountingLine
* @param capitalAssetInformation
* @param remainingAmountToDistribute
*/
protected void redistributeAmountsForAccountingsLineForModifyAssets(List<CapitalAccountingLines> selectedCapitalAccountingLines, List<CapitalAssetInformation> capitalAssetInformation, KualiDecimal remainingAmountToDistribute) {
//get the total capital assets quantity
int totalQuantity = getNumberOfModifiedAssetsExist(selectedCapitalAccountingLines, capitalAssetInformation);
if (totalQuantity > 0) {
KualiDecimal equalModifyAssetAmount = remainingAmountToDistribute.divide(new KualiDecimal(totalQuantity), true);
int lastAssetIndex = 0;
CapitalAssetInformation lastCapitalAsset = new CapitalAssetInformation();
if (equalModifyAssetAmount.compareTo(KualiDecimal.ZERO) != 0) {
for (CapitalAssetInformation capitalAsset : capitalAssetInformation) {
if (OLEConstants.CapitalAssets.CAPITAL_ASSET_MODIFY_ACTION_INDICATOR.equals(capitalAsset.getCapitalAssetActionIndicator()) &&
(ObjectUtils.isNotNull(capitalAsset.getCapitalAssetNumber())) &&
(OLEConstants.CapitalAssets.DISTRIBUTE_COST_EQUALLY_CODE.equalsIgnoreCase(capitalAsset.getDistributionAmountCode()))) {
if (capitalAssetExists(selectedCapitalAccountingLines, capitalAsset, OLEConstants.CapitalAssets.CAPITAL_ASSET_MODIFY_ACTION_INDICATOR)) {
capitalAsset.setCapitalAssetQuantity(1);
redistributeEqualAmounts(selectedCapitalAccountingLines, capitalAsset, equalModifyAssetAmount, totalQuantity);
lastAssetIndex++;
//get a reference to the last capital create asset to fix any variances...
lastCapitalAsset = capitalAsset;
}
}
}
}
//apply any variance left to the last
KualiDecimal varianceForAssets = remainingAmountToDistribute.subtract(equalModifyAssetAmount.multiply(new KualiDecimal(lastAssetIndex)));
if (varianceForAssets.isNonZero()) {
lastCapitalAsset.setCapitalAssetLineAmount(lastCapitalAsset.getCapitalAssetLineAmount().add(varianceForAssets));
redistributeEqualAmountsOnLastCapitalAsset(selectedCapitalAccountingLines, lastCapitalAsset, capitalAssetInformation, OLEConstants.CapitalAssets.CAPITAL_ASSET_MODIFY_ACTION_INDICATOR);
}
}
}
示例11: redistributeEqualAmounts
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 amount
* @param totalQuantity
*/
protected void redistributeEqualAmounts(List<CapitalAccountingLines> selectedCapitalAccountingLines, CapitalAssetInformation capitalAsset, KualiDecimal amount, int totalQuantity) {
int assetQuantity = 0;
KualiDecimal totalCapitalAssetQuantity = new KualiDecimal(totalQuantity);
if (ObjectUtils.isNotNull(capitalAsset.getCapitalAssetQuantity())) {
assetQuantity = capitalAsset.getCapitalAssetQuantity();
}
capitalAsset.setCapitalAssetLineAmount(capitalAsset.getCapitalAssetLineAmount().add(amount.multiply(new KualiDecimal(assetQuantity))));
int lastAccountIndex = 0;
KualiDecimal appliedAccountingLinesTotal = KualiDecimal.ZERO;
CapitalAssetAccountsGroupDetails lastLine = new CapitalAssetAccountsGroupDetails();
List<CapitalAssetAccountsGroupDetails> groupAccountLines = capitalAsset.getCapitalAssetAccountsGroupDetails();
for (CapitalAssetAccountsGroupDetails groupAccountLine : groupAccountLines) {
KualiDecimal capitalAccountingLineAmount = getCapitalAssetAccountLineAmount(selectedCapitalAccountingLines, groupAccountLine, capitalAsset);
KualiDecimal calculatedLineAmount = capitalAccountingLineAmount.divide(totalCapitalAssetQuantity, true);
groupAccountLine.setAmount(calculatedLineAmount.multiply(new KualiDecimal(assetQuantity)));
appliedAccountingLinesTotal = appliedAccountingLinesTotal.add(groupAccountLine.getAmount());
lastAccountIndex++;
lastLine = groupAccountLine;
}
//apply any variance left to the last
KualiDecimal varianceForLines = capitalAsset.getCapitalAssetLineAmount().subtract(appliedAccountingLinesTotal);
if (varianceForLines.isNonZero()) {
lastLine.setAmount(lastLine.getAmount().add(varianceForLines));
}
}
示例12: isPayrollAmountChangedFromOriginal
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* determine if there is a change on the payroll amount of the given detail line comparing to its original payroll amount
*
* @param detailLine the given effort certification detail line
* @return true if there is a change on the payroll amount of the given detail line comparing to its original payroll amount
*/
public static boolean isPayrollAmountChangedFromOriginal(EffortCertificationDetail detailLine) {
KualiDecimal payrollAmount = detailLine.getEffortCertificationPayrollAmount();
KualiDecimal originalPayrollAmount = detailLine.getEffortCertificationOriginalPayrollAmount();
KualiDecimal difference = originalPayrollAmount.subtract(payrollAmount);
return difference.isNonZero();
}
示例13: redistributeEqualAmountsForAccountingLineForCreateAssets
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
*
* @param capitalAccountingLines
* @param capitalAssetInformation
* @param remainingAmountToDistribute
*/
protected void redistributeEqualAmountsForAccountingLineForCreateAssets(List<CapitalAccountingLines> selectedCapitalAccountingLines, List<CapitalAssetInformation> capitalAssetInformation, KualiDecimal remainingAmountToDistribute) {
//get the total capital assets quantity
int totalQuantity = getTotalQuantityOfCreateAssets(selectedCapitalAccountingLines, capitalAssetInformation);
if (totalQuantity > 0) {
KualiDecimal equalCreateAssetAmount = remainingAmountToDistribute.divide(new KualiDecimal(totalQuantity), true);
int lastAssetIndex = 0;
CapitalAssetInformation lastCapitalAsset = new CapitalAssetInformation();
if (equalCreateAssetAmount.compareTo(KualiDecimal.ZERO) != 0) {
for (CapitalAssetInformation capitalAsset : capitalAssetInformation) {
if (KFSConstants.CapitalAssets.CAPITAL_ASSET_CREATE_ACTION_INDICATOR.equals(capitalAsset.getCapitalAssetActionIndicator()) &&
(KFSConstants.CapitalAssets.DISTRIBUTE_COST_EQUALLY_CODE.equalsIgnoreCase(capitalAsset.getDistributionAmountCode()))) {
if (capitalAssetExists(selectedCapitalAccountingLines, capitalAsset, KFSConstants.CapitalAssets.CAPITAL_ASSET_CREATE_ACTION_INDICATOR)) {
redistributeEqualAmounts(selectedCapitalAccountingLines, capitalAsset, equalCreateAssetAmount, totalQuantity);
if (ObjectUtils.isNotNull(capitalAsset.getCapitalAssetQuantity())) {
lastAssetIndex = lastAssetIndex + capitalAsset.getCapitalAssetQuantity();
}
//get a reference to the last capital create asset to fix any variances...
lastCapitalAsset = capitalAsset;
}
}
}
}
//apply any variance left to the last
KualiDecimal varianceForAssets = remainingAmountToDistribute.subtract(equalCreateAssetAmount.multiply(new KualiDecimal(lastAssetIndex)));
if (varianceForAssets.isNonZero()) {
lastCapitalAsset.setCapitalAssetLineAmount(lastCapitalAsset.getCapitalAssetLineAmount().add(varianceForAssets));
redistributeEqualAmountsOnLastCapitalAsset(selectedCapitalAccountingLines, lastCapitalAsset, capitalAssetInformation, KFSConstants.CapitalAssets.CAPITAL_ASSET_CREATE_ACTION_INDICATOR);
}
}
}
示例14: validate
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* Validates the total of the monthly amount fields (if not 0) equals the current budget amount. If current budget is 0, then
* total of monthly fields must be 0.
*
* @see org.kuali.kfs.sys.document.validation.Validation#validate(org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent)
*/
public boolean validate(AttributedDocumentEvent event) {
boolean validMonthlyLines = true;
KualiDecimal monthlyTotal = getAccountingLineForValidation().getMonthlyLinesTotal();
if (monthlyTotal.isNonZero() && monthlyTotal.compareTo(getAccountingLineForValidation().getCurrentBudgetAdjustmentAmount()) != 0) {
GlobalVariables.getMessageMap().putError(KFSPropertyConstants.CURRENT_BUDGET_ADJUSTMENT_AMOUNT, KFSKeyConstants.ERROR_DOCUMENT_BA_MONTH_TOTAL_NOT_EQUAL_CURRENT);
validMonthlyLines = false;
}
return validMonthlyLines;
}
示例15: getSourceTotal
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* Total for a Cash Receipt according to the spec should be the sum of the amounts on accounting lines belonging to object codes
* having the 'income' object type, less the sum of the amounts on accounting lines belonging to object codes having the
* 'expense' object type.
*
* @see org.kuali.kfs.sys.document.AccountingDocument#getSourceTotal()
*/
@Override
public KualiDecimal getSourceTotal() {
KualiDecimal total = KualiDecimal.ZERO;
AccountingLineBase al = null;
if (ObjectUtils.isNull(getSourceAccountingLines()) || getSourceAccountingLines().isEmpty()) {
refreshReferenceObject(KFSPropertyConstants.SOURCE_ACCOUNTING_LINES);
}
Iterator iter = getSourceAccountingLines().iterator();
while (iter.hasNext()) {
al = (AccountingLineBase) iter.next();
try {
KualiDecimal amount = al.getAmount().abs();
if (amount != null && amount.isNonZero()) {
if (isDebit(al)) {
total = total.subtract(amount);
}
else { // in this context, if it's not a debit, it's a credit
total = total.add(amount);
}
}
}
catch (Exception e) {
// Possibly caused by accounting lines w/ bad data
LOG.error("Error occured trying to compute Cash receipt total, returning 0", e);
return KualiDecimal.ZERO;
}
}
return total;
}