本文整理汇总了Java中org.kuali.rice.core.api.util.type.KualiDecimal.isNegative方法的典型用法代码示例。如果您正苦于以下问题:Java KualiDecimal.isNegative方法的具体用法?Java KualiDecimal.isNegative怎么用?Java KualiDecimal.isNegative使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.core.api.util.type.KualiDecimal
的用法示例。
在下文中一共展示了KualiDecimal.isNegative方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validate
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* Accounting lines for Auxiliary Vouchers can only be positive non-zero numbers
* @see org.kuali.ole.sys.document.validation.Validation#validate(org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent)
*/
public boolean validate(AttributedDocumentEvent event) {
boolean retval = true;
KualiDecimal amount = accountingLineForValidation.getAmount();
// check for negative or zero amounts
if (KualiDecimal.ZERO.equals(amount)) { // if 0
GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(buildMessageMapKeyPathForDebitCreditAmount(true), ERROR_ZERO_OR_NEGATIVE_AMOUNT, "an accounting line");
GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(buildMessageMapKeyPathForDebitCreditAmount(false), ERROR_ZERO_OR_NEGATIVE_AMOUNT, "an accounting line");
retval = false;
}
else if (amount.isNegative()) { // entered a negative number
String debitCreditCode = accountingLineForValidation.getDebitCreditCode();
if (StringUtils.isNotBlank(debitCreditCode) && GL_DEBIT_CODE.equals(debitCreditCode)) {
GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(buildMessageMapKeyPathForDebitCreditAmount(true), ERROR_ZERO_OR_NEGATIVE_AMOUNT, "an accounting line");
}
else {
GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(buildMessageMapKeyPathForDebitCreditAmount(false), ERROR_ZERO_OR_NEGATIVE_AMOUNT, "an accounting line");
}
retval = false;
}
return retval;
}
示例2: validate
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* Accounting lines for Auxiliary Vouchers can only be positive non-zero numbers
* @see org.kuali.kfs.sys.document.validation.Validation#validate(org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent)
*/
public boolean validate(AttributedDocumentEvent event) {
boolean retval = true;
KualiDecimal amount = accountingLineForValidation.getAmount();
// check for negative or zero amounts
if (KualiDecimal.ZERO.equals(amount)) { // if 0
GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(buildMessageMapKeyPathForDebitCreditAmount(true), ERROR_ZERO_OR_NEGATIVE_AMOUNT, "an accounting line");
GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(buildMessageMapKeyPathForDebitCreditAmount(false), ERROR_ZERO_OR_NEGATIVE_AMOUNT, "an accounting line");
retval = false;
}
else if (amount.isNegative()) { // entered a negative number
String debitCreditCode = accountingLineForValidation.getDebitCreditCode();
if (StringUtils.isNotBlank(debitCreditCode) && GL_DEBIT_CODE.equals(debitCreditCode)) {
GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(buildMessageMapKeyPathForDebitCreditAmount(true), ERROR_ZERO_OR_NEGATIVE_AMOUNT, "an accounting line");
}
else {
GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(buildMessageMapKeyPathForDebitCreditAmount(false), ERROR_ZERO_OR_NEGATIVE_AMOUNT, "an accounting line");
}
retval = false;
}
return retval;
}
示例3: createSourceAccountingLine
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* @param docNum
* @param coaCode
* @param acctNum
* @param obCode
* @param totalAmount
* @param seqNum
* @return
*/
protected CustomerInvoiceDetail createSourceAccountingLine(String docNum, String coaCode, String acctNum, String obCode, KualiDecimal totalAmount, Integer seqNum) {
CustomerInvoiceDetail cid = new CustomerInvoiceDetail();
cid.setDocumentNumber(docNum);
cid.setAccountNumber(acctNum);
cid.setChartOfAccountsCode(coaCode);
cid.setFinancialObjectCode(obCode);
cid.setSequenceNumber(seqNum);
cid.setInvoiceItemQuantity(BigDecimal.ONE);
cid.setInvoiceItemUnitOfMeasureCode(ArConstants.CUSTOMER_INVOICE_DETAIL_UOM_DEFAULT);
cid.setInvoiceItemUnitPrice(totalAmount);
cid.setAmount(totalAmount);
if (totalAmount.isNegative()) {
cid.setInvoiceItemDiscountLineNumber(seqNum);
}
// To get AR Object codes for the GLPEs .... as it is not being called implicitly..
cid.setAccountsReceivableObjectCode(getAccountsReceivablePendingEntryService().getAccountsReceivableObjectCode(cid));
return cid;
}
示例4: adjustValues
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* This method will adjust the last accounting line to make the amounts sum up to the total.
*
* @param sourceAccountingList
* @param total
* @return
*/
protected List<TemSourceAccountingLine> adjustValues(List<TemSourceAccountingLine> sourceAccountingList, KualiDecimal total) {
KualiDecimal totalAmount = KualiDecimal.ZERO;
for (TemSourceAccountingLine newLine : sourceAccountingList) {
totalAmount = totalAmount.add(newLine.getAmount());
}
TemSourceAccountingLine line = sourceAccountingList.get(sourceAccountingList.size() - 1);
KualiDecimal remainderAmount = total.subtract(totalAmount);
if (remainderAmount.isPositive()) {
line.setAmount(line.getAmount().subtract(remainderAmount));
}
else if (remainderAmount.isNegative()) {
line.setAmount(line.getAmount().add(remainderAmount));
}
return sourceAccountingList;
}
示例5: breakDown
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* @see org.kuali.kfs.module.tem.batch.businessobject.MealBreakDownStrategy#breakDown(org.kuali.kfs.module.tem.businessobject.PerDiem,
* org.kuali.rice.kns.util.KualiDecimal)
*/
@Override
public void breakDown(PerDiem perDiem, KualiDecimal mealsAndIncidentals) {
if (ObjectUtils.isNull(mealsAndIncidentals) || mealsAndIncidentals.isNegative()) {
throw new RuntimeException("The given mealsAndIncidentals cannot be null or negative.");
}
KualiDecimal breakfastPercent = this.getMealPercentByMealCode(MEAL_CODE.BREAKFAST.mealCode);
KualiDecimal breakfast = mealsAndIncidentals.multiply(breakfastPercent).divide(new KualiDecimal(100));
perDiem.setBreakfast(breakfast);
KualiDecimal lunchPercent = this.getMealPercentByMealCode(MEAL_CODE.LUNCH.mealCode);
KualiDecimal lunch = mealsAndIncidentals.multiply(lunchPercent).divide(new KualiDecimal(100));
perDiem.setLunch(lunch);
KualiDecimal dinnerPercent = this.getMealPercentByMealCode(MEAL_CODE.DINNER.mealCode);
KualiDecimal dinner = mealsAndIncidentals.multiply(dinnerPercent).divide(new KualiDecimal(100));
perDiem.setDinner(dinner);
KualiDecimal meals = breakfast.add(lunch).add(dinner);
KualiDecimal incidentals = mealsAndIncidentals.subtract(meals);
perDiem.setIncidentals(incidentals);
}
示例6: canNegtiveAmountBeTransferred
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* Determines whether a negtive amount can be transferred from one account to another
*
* @param accountingLineGroupMap the givenaccountingLineGroupMap
* @return true if a negtive amount can be transferred from one account to another; otherwise, false
*/
protected boolean canNegtiveAmountBeTransferred(Map<String, ExpenseTransferAccountingLine> accountingLineGroupMap) {
for (String key : accountingLineGroupMap.keySet()) {
ExpenseTransferAccountingLine accountingLine = accountingLineGroupMap.get(key);
Map<String, Object> fieldValues = this.buildFieldValueMap(accountingLine);
KualiDecimal balanceAmount = getBalanceAmount(fieldValues, accountingLine.getPayrollEndDateFiscalPeriodCode());
KualiDecimal transferAmount = accountingLine.getAmount();
// a negtive amount cannot be transferred if the balance amount is positive
if (transferAmount.isNegative() && balanceAmount.isPositive()) {
return false;
}
}
return true;
}
示例7: getItemReceivedToBeQuantity
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
public KualiDecimal getItemReceivedToBeQuantity() {
// lazy loaded
KualiDecimal toBeQuantity = this.getItemOrderedQuantity().subtract(getItemReceivedPriorQuantity());
if (toBeQuantity.isNegative()) {
toBeQuantity = KualiDecimal.ZERO;
}
setItemReceivedToBeQuantity(toBeQuantity);
return itemReceivedToBeQuantity;
}
示例8: isDebit
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
public boolean isDebit(GeneralLedgerPendingEntrySourceDetail postable) {
boolean debit = false;
AssetGlpeSourceDetail assetPostable = (AssetGlpeSourceDetail)postable;
KualiDecimal amount = assetPostable.getAmount();
if((assetPostable.isCapitalization() && amount.isNegative()) || (assetPostable.isAccumulatedDepreciation() && amount.isPositive()) || (assetPostable.isCapitalizationOffset() && amount.isPositive())) {
debit = true;
}
return debit;
}
示例9: checkAmountSign
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* Helper method to check if an amount is negative and add an error if not.
*
* @param amount to check
* @param propertyName to add error under
* @param label for error
* @return boolean indicating if the value has the requested sign
*/
protected boolean checkAmountSign(KualiDecimal amount, String propertyName, String label) {
boolean correctSign = true;
if (amount.isNegative()) {
GlobalVariables.getMessageMap().putError(propertyName, OLEKeyConstants.ERROR_BA_AMOUNT_NEGATIVE, label);
correctSign = false;
}
return correctSign;
}
示例10: removeConfirmedCheck
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* This method removes a confirmed check from the list and updates the total appropriately.
*
* @param index
*/
public void removeConfirmedCheck(int index) {
Check check = (Check) confirmedChecks.remove(index);
KualiDecimal newTotalCheckAmount = getTotalConfirmedCheckAmount().subtract(check.getAmount());
// if the totalCheckAmount goes negative, bring back to zero.
if (newTotalCheckAmount.isNegative()) {
newTotalCheckAmount = KualiDecimal.ZERO;
}
setTotalConfirmedCheckAmount(newTotalCheckAmount);
}
示例11: checkAmountSign
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* Helper method to check if an amount is negative and add an error if not.
*
* @param amount to check
* @param propertyName to add error under
* @param label for error
* @return boolean indicating if the value has the requested sign
*/
protected boolean checkAmountSign(KualiDecimal amount, String propertyName, String label) {
boolean correctSign = true;
if (amount.isNegative()) {
GlobalVariables.getMessageMap().putError(propertyName, KFSKeyConstants.ERROR_BA_AMOUNT_NEGATIVE, label);
correctSign = false;
}
return correctSign;
}
示例12: removeCheck
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* This method removes a check from the list and updates the total appropriately.
*
* @param index
*/
public void removeCheck(int index) {
Check check = (Check) moneyInChecks.remove(index);
KualiDecimal newTotalCheckAmount = getTotalCheckAmount().subtract(check.getAmount());
// if the totalCheckAmount goes negative, bring back to zero.
if (newTotalCheckAmount.isNegative()) {
newTotalCheckAmount = KualiDecimal.ZERO;
}
}
示例13: isDebit
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
public boolean isDebit(GeneralLedgerPendingEntrySourceDetail postable) {
boolean debit = false;
AssetGlpeSourceDetail assetPostable = (AssetGlpeSourceDetail)postable;
KualiDecimal amount = assetPostable.getAmount();
if((assetPostable.isCapitalization() && amount.isPositive()) || (assetPostable.isCapitalizationOffset() && amount.isNegative()) || (assetPostable.isPayment() && amount.isPositive()) || (assetPostable.isPaymentOffset() && amount.isNegative())) {
debit = true;
}
return debit;
}
示例14: validateAmount
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* Validates that the amount is non-null and non-negative (zero values are allowed)
*
* @param amount
* @return
*/
protected boolean validateAmount(KualiDecimal amount, String property) {
if (ObjectUtils.isNull(amount)) {
return false;
}
else if (amount.isNegative()) {
putFieldError(property, TemKeyConstants.ERROR_PER_DIEM_MIB_INVALID_AMOUNTS_MUST_BE_POSITIVE);
return false;
}
return true;
}
示例15: removeCheck
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* This method removes a check from the list and updates the total appropriately.
*
* @param index
*/
public void removeCheck(int index) {
Check check = checks.remove(index);
KualiDecimal newTotalCheckAmount = getTotalCheckAmount().subtract(check.getAmount());
// if the totalCheckAmount goes negative, bring back to zero.
if (newTotalCheckAmount.isNegative()) {
newTotalCheckAmount = KualiDecimal.ZERO;
}
setTotalCheckAmount(newTotalCheckAmount);
}