本文整理汇总了Java中org.kuali.rice.core.api.util.type.KualiDecimal.subtract方法的典型用法代码示例。如果您正苦于以下问题:Java KualiDecimal.subtract方法的具体用法?Java KualiDecimal.subtract怎么用?Java KualiDecimal.subtract使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.core.api.util.type.KualiDecimal
的用法示例。
在下文中一共展示了KualiDecimal.subtract方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addNewBCSF
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
public void addNewBCSF(BudgetConstructionCalculatedSalaryFoundationTracker bCSF, KualiDecimal amountFromCSFToSet) {
// lop off the pennies--go down to the nearest whole dollar
KualiInteger wholeDollarsCSFAmount = new KualiInteger(amountFromCSFToSet, RoundingMode.FLOOR);
// store the whole dollar amount in the budget construction CSF object
bCSF.setCsfAmount(wholeDollarsCSFAmount);
// find the pennies that were shaved off
KualiDecimal penniesFromCSFAmount = amountFromCSFToSet;
// BigDecimal values are immutable. So, we have to reset the pointer after the subtract
penniesFromCSFAmount = penniesFromCSFAmount.subtract(wholeDollarsCSFAmount.kualiDecimalValue());
// just round negative amounts and return.
// this is only a safety measure. negative salaries are illegal in budget construction.
if (wholeDollarsCSFAmount.isNegative()) {
return;
}
// save the difference. (KualiDecimal values are immutable, so we need to redirect the diffAmount pointer to a new one.)
diffAmount = diffAmount.add(penniesFromCSFAmount);
// store the budget construction CSF row with the truncated amount for possible adjustment later
candidateBCSFRows.add(bCSF);
}
示例2: generateEntriesForAdvances
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* @see org.kuali.kfs.module.tem.document.service.TravelReimbursementService#generateEntriesForAdvances(org.kuali.kfs.module.tem.document.TravelReimbursementDocument)
*/
@Override
public void generateEntriesForAdvances(TravelReimbursementDocument trDocument, GeneralLedgerPendingEntrySequenceHelper sequenceHelper) {
final Map<AccountsReceivableCustomerInvoice, KualiDecimal> openInvoiceMap = getInvoicesOpenAmountMapFor (trDocument.getTraveler().getCustomerNumber(), trDocument.getTravelDocumentIdentifier());
KualiDecimal remainingReimbursableTotal = trDocument.getReimbursableTotal();
for (AccountsReceivableCustomerInvoice invoice : orderInvoices(openInvoiceMap.keySet())) {
final KualiDecimal invoicePayment = rollReimbursementForInvoiceAmount(invoice, remainingReimbursableTotal);
if (invoicePayment.isGreaterThan(KualiDecimal.ZERO)) {
final TravelAdvance advance = getAdvanceForInvoice(invoice);
if (advance != null) {
generatePendingEntriesForAdvanceClearing(trDocument, invoicePayment, sequenceHelper);
generatePendingEntriesForAdvanceCrediting(trDocument, advance, invoicePayment, sequenceHelper);
}
}
remainingReimbursableTotal = remainingReimbursableTotal.subtract(invoicePayment);
}
}
示例3: getAvailableUnappliedAmount
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* Gets the availableUnappliedAmount attribute.
* @return Returns the availableUnappliedAmount.
*/
public KualiDecimal getAvailableUnappliedAmount() {
// start with the original unapplied amount
KualiDecimal amount = financialDocumentLineAmount;
// subtract any non-invoiced distributions made against it
for (NonInvoicedDistribution nonInvoicedDistribution : nonInvoicedDistributions) {
amount = amount.subtract(nonInvoicedDistribution.getFinancialDocumentLineAmount());
}
// subtract any non-applied distributions made against it
for (NonAppliedDistribution nonAppliedDistribution : nonAppliedDistributions) {
amount = amount.subtract(nonAppliedDistribution.getFinancialDocumentLineAmount());
}
return amount;
}
示例4: addEntryIntoUnit
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* add the given origin entry as a member of the working unit
*
* @param laborOriginEntry the given origin entry
* @return true if the given origin entry is successfully added into the current unit of work; otherwise, false
*/
public boolean addEntryIntoUnit(LaborOriginEntry laborOriginEntry) {
if (this.hasSameKey(laborOriginEntry)) {
KualiDecimal unitAmount = workingEntry.getTransactionLedgerEntryAmount();
KualiDecimal entryAmount = laborOriginEntry.getTransactionLedgerEntryAmount();
// if the input entry has a "credit" code , then subtract its amount from the unit total amount
boolean creditIndicator = KFSConstants.GL_CREDIT_CODE.equals(laborOriginEntry.getTransactionDebitCreditCode());
unitAmount = creditIndicator ? unitAmount.subtract(entryAmount) : unitAmount.add(entryAmount);
workingEntry.setTransactionLedgerEntryAmount(unitAmount);
numOfMember++;
return true;
}
return false;
}
示例5: getAmountOpen
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
public KualiDecimal getAmountOpen() {
// if the parent isnt saved, or if its saved but not approved, we
// need to include the discounts. If its both saved AND approved,
// we do not include the discounts.
boolean includeDiscounts = !(isParentSaved() && isParentApproved());
KualiDecimal amount = getAmount();
KualiDecimal applied = getAmountApplied();
KualiDecimal a = amount.subtract(applied);
if (includeDiscounts) {
CustomerInvoiceDetail discount = getDiscountCustomerInvoiceDetail();
if (ObjectUtils.isNotNull(discount)) {
a = a.add(discount.getAmount());
}
}
return a;
}
示例6: updateDetailAmounts
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* Sets null amount fields to 0
*
* @param paymentDetail <code>PaymentDetail</code> to update
*/
protected void updateDetailAmounts(PaymentDetail paymentDetail) {
KualiDecimal zero = KualiDecimal.ZERO;
if (paymentDetail.getInvTotDiscountAmount() == null) {
paymentDetail.setInvTotDiscountAmount(zero);
}
if (paymentDetail.getInvTotShipAmount() == null) {
paymentDetail.setInvTotShipAmount(zero);
}
if (paymentDetail.getInvTotOtherDebitAmount() == null) {
paymentDetail.setInvTotOtherDebitAmount(zero);
}
if (paymentDetail.getInvTotOtherCreditAmount() == null) {
paymentDetail.setInvTotOtherCreditAmount(zero);
}
// update the total payment amount with the amount from the accounts if null
if (paymentDetail.getNetPaymentAmount() == null) {
paymentDetail.setNetPaymentAmount(paymentDetail.getAccountTotal());
}
if (paymentDetail.getOrigInvoiceAmount() == null) {
KualiDecimal amt = paymentDetail.getNetPaymentAmount();
amt = amt.add(paymentDetail.getInvTotDiscountAmount());
amt = amt.subtract(paymentDetail.getInvTotShipAmount());
amt = amt.subtract(paymentDetail.getInvTotOtherDebitAmount());
amt = amt.add(paymentDetail.getInvTotOtherCreditAmount());
paymentDetail.setOrigInvoiceAmount(amt);
}
}
示例7: generateTransactionsBySymbol
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* Wrapper function to allow for internal iterations on ICR account distribution collection if determined to use ICR from account
*
* @param et
* @param icrRateDetail
* @param generatedTransactionAmount
* @param runDate
* @param group
* @param icrGenerationMetadata
*/
private void generateTransactionsBySymbol(ExpenditureTransaction et, IndirectCostRecoveryRateDetail icrRateDetail, KualiDecimal generatedTransactionAmount, Date runDate, PrintStream group, IndirectCostRecoveryGenerationMetadata icrGenerationMetadata) {
KualiDecimal icrTransactionAmount;
KualiDecimal unappliedTransactionAmount = new KualiDecimal(generatedTransactionAmount.bigDecimalValue());
//if symbol is denoted to use ICR from account
if (GeneralLedgerConstants.PosterService.SYMBOL_USE_ICR_FROM_ACCOUNT.equals(icrRateDetail.getAccountNumber())) {
int icrCount = icrGenerationMetadata.getAccountLists().size();
for (IndirectCostRecoveryAccountDistributionMetadata meta : icrGenerationMetadata.getAccountLists()){
//set a new icr meta data for transaction processing
IndirectCostRecoveryGenerationMetadata icrMeta = new IndirectCostRecoveryGenerationMetadata(icrGenerationMetadata.getIndirectCostRecoveryTypeCode(),
icrGenerationMetadata.getFinancialIcrSeriesIdentifier());
icrMeta.setIndirectCostRcvyFinCoaCode(meta.getIndirectCostRecoveryFinCoaCode());
icrMeta.setIndirectCostRecoveryAcctNbr(meta.getIndirectCostRecoveryAccountNumber());
//change the transaction amount base on ICR percentage
if (icrCount-- == 1) {
// Deplete the rest of un-applied transaction amount
icrTransactionAmount = unappliedTransactionAmount;
}
else {
// Normal transaction amount is calculated by icr account line percentage
icrTransactionAmount = getPercentage(generatedTransactionAmount, meta.getAccountLinePercent());
unappliedTransactionAmount = unappliedTransactionAmount.subtract(icrTransactionAmount);
}
//perform the actual transaction generation
generateTransactions(et, icrRateDetail, icrTransactionAmount, runDate, group, icrMeta);
}
}else{
//non-ICR; process as usual
generateTransactions(et, icrRateDetail, generatedTransactionAmount, runDate, group, icrGenerationMetadata);
}
}
示例8: getTotalPendingAmount
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* Returns the pending expense amount after summing up detail rows expense amount
*
* @see org.kuali.kfs.module.tem.document.TravelDocument#getTotalPendingAmount(java.util.List, java.lang.Long)
*/
@Override
@Transient
public KualiDecimal getTotalPendingAmount(ActualExpense actualExpense){
KualiDecimal expenseAmount = actualExpense.getExpenseAmount();
return expenseAmount.subtract(actualExpense.getTotalDetailExpenseAmount());
}
示例9: calculateAdvanceAccountingLineTotal
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* Using the debit determination service, calculates the total of the advance accounting lines
* @param document the travel authorization or child document to calculate the amount of
* @return the total of the accounting lines
*/
protected KualiDecimal calculateAdvanceAccountingLineTotal(TravelAuthorizationDocument document) {
KualiDecimal accountingLineTotal = KualiDecimal.ZERO;
for (TemSourceAccountingLine advanceAccountingLine : document.getAdvanceAccountingLines()) {
if (document.isDebit(advanceAccountingLine)) {
accountingLineTotal = accountingLineTotal.add(advanceAccountingLine.getAmount()); // negate the debit, because the accounting lines are offsetting the actual advance
}
else {
accountingLineTotal = accountingLineTotal.subtract(advanceAccountingLine.getAmount());
}
}
return accountingLineTotal;
}
示例10: 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();
}
示例11: getAccountingLineAmountToFillIn
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
@Override
protected KualiDecimal getAccountingLineAmountToFillIn(TravelFormBase travelFormBase) {
TravelAuthorizationForm travelAuthForm = (TravelAuthorizationForm) travelFormBase;
KualiDecimal amount = new KualiDecimal(0);
KualiDecimal encTotal = travelAuthForm.getTravelAuthorizationDocument().getEncumbranceTotal();
KualiDecimal expenseTotal = travelAuthForm.getTravelAuthorizationDocument().getExpenseLimit();
List<SourceAccountingLine> accountingLines = travelAuthForm.getTravelAuthorizationDocument().getSourceAccountingLines();
KualiDecimal accountingTotal = new KualiDecimal(0);
for (SourceAccountingLine accountingLine : accountingLines) {
accountingTotal = accountingTotal.add(accountingLine.getAmount());
}
if (ObjectUtils.isNull(expenseTotal)) {
amount = encTotal.subtract(accountingTotal);
}
else if (expenseTotal.isLessThan(encTotal)) {
amount = expenseTotal.subtract(accountingTotal);
}
else {
amount = encTotal.subtract(accountingTotal);
}
return amount;
}
示例12: activateCabPOLines
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* Activates PO Lines
*
* @param documentNumber String
*/
protected void activateCabPOLines(String documentNumber) {
Map<String, String> fieldValues = new HashMap<String, String>();
fieldValues.put(CabPropertyConstants.PurchasingAccountsPayableItemAsset.CAMS_DOCUMENT_NUMBER, documentNumber);
Collection<PurchasingAccountsPayableItemAsset> matchingPoAssets = businessObjectService.findMatching(PurchasingAccountsPayableItemAsset.class, fieldValues);
if (matchingPoAssets != null && !matchingPoAssets.isEmpty()) {
for (PurchasingAccountsPayableItemAsset itemAsset : matchingPoAssets) {
PurchasingAccountsPayableDocument purapDocument = itemAsset.getPurchasingAccountsPayableDocument();
purapDocument.setActivityStatusCode(CabConstants.ActivityStatusCode.MODIFIED);
businessObjectService.save(purapDocument);
itemAsset.setActivityStatusCode(CabConstants.ActivityStatusCode.MODIFIED);
businessObjectService.save(itemAsset);
List<PurchasingAccountsPayableLineAssetAccount> lineAssetAccounts = itemAsset.getPurchasingAccountsPayableLineAssetAccounts();
for (PurchasingAccountsPayableLineAssetAccount assetAccount : lineAssetAccounts) {
assetAccount.setActivityStatusCode(CabConstants.ActivityStatusCode.MODIFIED);
businessObjectService.save(assetAccount);
GeneralLedgerEntry generalLedgerEntry = assetAccount.getGeneralLedgerEntry();
KualiDecimal submitAmount = generalLedgerEntry.getTransactionLedgerSubmitAmount();
if (submitAmount == null) {
submitAmount = KualiDecimal.ZERO;
}
submitAmount = submitAmount.subtract(assetAccount.getItemAccountTotalAmount());
generalLedgerEntry.setTransactionLedgerSubmitAmount(submitAmount);
generalLedgerEntry.setActivityStatusCode(CabConstants.ActivityStatusCode.MODIFIED);
businessObjectService.save(generalLedgerEntry);
}
}
}
}
示例13: 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.ole.sys.document.AccountingDocument#getSourceTotal()
*/
@Override
public KualiDecimal getSourceTotal() {
KualiDecimal total = KualiDecimal.ZERO;
AccountingLineBase al = null;
if (ObjectUtils.isNull(getSourceAccountingLines()) || getSourceAccountingLines().isEmpty()) {
refreshReferenceObject(OLEPropertyConstants.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;
}
示例14: getCalculatedPaymentAmount
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
public KualiDecimal getCalculatedPaymentAmount() {
KualiDecimal orig_invoice_amt = origInvoiceAmount == null ? zero : origInvoiceAmount;
KualiDecimal invoice_tot_discount_amt = invTotDiscountAmount == null ? zero : invTotDiscountAmount;
KualiDecimal invoice_tot_ship_amt = invTotShipAmount == null ? zero : invTotShipAmount;
KualiDecimal invoice_tot_other_debits = invTotOtherDebitAmount == null ? zero : invTotOtherDebitAmount;
KualiDecimal invoice_tot_other_credits = invTotOtherCreditAmount == null ? zero : invTotOtherCreditAmount;
KualiDecimal t = orig_invoice_amt.subtract(invoice_tot_discount_amt);
t = t.add(invoice_tot_ship_amt);
t = t.add(invoice_tot_other_debits);
t = t.subtract(invoice_tot_other_credits);
return t;
}
示例15: getOutstandingQuantity
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
public KualiDecimal getOutstandingQuantity() {
KualiDecimal outstandingQuantity = (this.getItemQuantity() != null) ? this.getItemQuantity() : KualiDecimal.ZERO;
KualiDecimal invoicedQuantity = (this.getItemInvoicedTotalQuantity() != null) ? this.getItemInvoicedTotalQuantity() : KualiDecimal.ZERO;
return outstandingQuantity.subtract(invoicedQuantity);
}