本文整理汇总了Java中org.kuali.rice.core.api.util.type.KualiDecimal.isGreaterEqual方法的典型用法代码示例。如果您正苦于以下问题:Java KualiDecimal.isGreaterEqual方法的具体用法?Java KualiDecimal.isGreaterEqual怎么用?Java KualiDecimal.isGreaterEqual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.core.api.util.type.KualiDecimal
的用法示例。
在下文中一共展示了KualiDecimal.isGreaterEqual方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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
}
}
示例4: getAccountingLineAmountToFillIn
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
protected KualiDecimal getAccountingLineAmountToFillIn(TravelFormBase travelReqForm) {
KualiDecimal amount = KualiDecimal.ZERO;
TravelDocument travelDocument = travelReqForm.getTravelDocument();
KualiDecimal amountToBePaid = travelDocument.getTotalAccountLineAmount();
final List<TemSourceAccountingLine> accountingLines = travelDocument.getSourceAccountingLines();
KualiDecimal accountingTotal = KualiDecimal.ZERO;
for (TemSourceAccountingLine accountingLine : accountingLines) {
accountingTotal = accountingTotal.add(accountingLine.getAmount());
}
if (!ObjectUtils.isNull(amountToBePaid) && amountToBePaid.isGreaterEqual(accountingTotal)) {
amount = amountToBePaid.subtract(accountingTotal);
}
if (travelDocument.getExpenseLimit() != null && travelDocument.getExpenseLimit().isPositive()) {
if (accountingTotal.isGreaterEqual(travelDocument.getExpenseLimit())) {
return KualiDecimal.ZERO; // the accounting line total is greater than or equal to the expense limit, there's no more expense limit to spend
}
if (amount.isGreaterThan(travelDocument.getExpenseLimit())) {
return travelDocument.getExpenseLimit().subtract(accountingTotal); // the amount to be paid - accounting total is still greater than the expense limit; so the amount we can actually pay is the expense limit - the accounting total
}
// we're under the expense limit; let's just return amount
}
return amount;
}
示例5: validateNonCapitalAssetAmountBelowThreshold
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* Validate non-capital asset amount below the threshold.
*
* @param assetAmount
* @param capitalizationThresholdAmount
* @return
*/
protected boolean validateNonCapitalAssetAmountBelowThreshold(KualiDecimal assetAmount, String capitalizationThresholdAmount) {
boolean success = true;
if (assetAmount.isGreaterEqual(new KualiDecimal(capitalizationThresholdAmount))) {
putFieldError(CamsPropertyConstants.AssetGlobal.INVENTORY_STATUS_CODE, CamsKeyConstants.AssetGlobal.ERROR_NON_CAPITAL_ASSET_PAYMENT_AMOUNT_MAX, capitalizationThresholdAmount);
success &= false;
}
return success;
}
示例6: isNotAutomaticReimbursement
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
*
* @return
*/
private boolean isNotAutomaticReimbursement() {
boolean enabled = getParameterService().getParameterValueAsBoolean(TravelReimbursementDocument.class, TemConstants.TravelReimbursementParameters.AUTOMATIC_APPROVALS_IND);
if (!enabled) {
return true;
}
if (!ObjectUtils.isNull(getTraveler()) && !StringUtils.equals(getTraveler().getTravelerTypeCode(), TemConstants.EMP_TRAVELER_TYP_CD)) {
return true;
}
if (getActualExpenses() != null && getActualExpenses().size() > 0) {
for (ActualExpense expense : getActualExpenses()) {
if (expense.getExpenseTypeObjectCode() != null && expense.getExpenseTypeObjectCode().isReceiptRequired()
&& getTravelExpenseService().isTravelExpenseExceedReceiptRequirementThreshold(expense) ) {
return true;
}
}
}
final List<Document> authorizations = getTravelDocumentService().getDocumentsRelatedTo(this, TemConstants.TravelDocTypes.TRAVEL_AUTHORIZATION_DOCUMENT, TemConstants.TravelDocTypes.TRAVEL_AUTHORIZATION_AMEND_DOCUMENT);
if (authorizations != null && !authorizations.isEmpty()) {
for (Document doc : authorizations) {
TravelAuthorizationDocument auth = (TravelAuthorizationDocument)doc;
if (!ObjectUtils.isNull(auth.getTravelAdvance()) && auth.shouldProcessAdvanceForDocument() && (KFSConstants.PaymentSourceConstants.PAYMENT_METHOD_WIRE.equals(auth.getAdvanceTravelPayment().getPaymentMethodCode()) || KFSConstants.PaymentSourceConstants.PAYMENT_METHOD_DRAFT.equals(auth.getAdvanceTravelPayment().getPaymentMethodCode()))) {
return true;
}
}
}
KualiDecimal trTotal = KualiDecimal.ZERO;
List<AccountingLine> lines = getSourceAccountingLines();
for (AccountingLine line : lines) {
trTotal = trTotal.add(line.getAmount());
}
Map<String, String> fieldValues = new HashMap<String, String>();
fieldValues.put(KRADPropertyConstants.CODE, this.getTripTypeCode());
TripType tripType = SpringContext.getBean(BusinessObjectService.class).findByPrimaryKey(TripType.class, fieldValues);
KualiDecimal threshold = tripType.getAutoTravelReimbursementLimit();
if (trTotal.isGreaterEqual(threshold)) {
return true;
}
return false;
}
示例7: isPayrollAmountNonnegative
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* determine if the given payroll amount is greater than and equal to 0
*
* @param payrollAmount the given payroll amount
* @return true if the given payroll amount is greater than and equal to 0; otherwise, false
*/
public static boolean isPayrollAmountNonnegative(KualiDecimal payrollAmount) {
return payrollAmount.isGreaterEqual(KualiDecimal.ZERO);
}