use of org.kuali.kfs.core.api.util.type.KualiDecimal in project cu-kfs by CU-CommunityApps.
the class CapitalAssetInformationActionBase method accountingLinesAmountDistributed.
/**
* @param capitalAccountingLines
* @param existingCapitalAsset
* @return true if accounting line amount equals to capital asset amount, else false.
*/
protected boolean accountingLinesAmountDistributed(List<CapitalAccountingLines> capitalAccountingLines, CapitalAssetInformation existingCapitalAsset) {
KualiDecimal accountingLineAmount = KualiDecimal.ZERO;
for (CapitalAccountingLines capitalAccountingLine : capitalAccountingLines) {
accountingLineAmount = accountingLineAmount.add(capitalAccountingLine.getAmount().abs());
}
KualiDecimal capitalAssetsAmount = existingCapitalAsset.getCapitalAssetLineAmount();
return accountingLineAmount.equals(capitalAssetsAmount);
}
use of org.kuali.kfs.core.api.util.type.KualiDecimal in project cu-kfs by CU-CommunityApps.
the class BalanceInquiryLookupAction method getSelectedObjectIds.
/**
* put all entities into select object map. This implementation 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
*/
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<>();
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(), ",", "");
// Cornell Customization If there is a negative value, we need to convert it from (##.##) to -##.##
if (StringUtils.contains(propertyValue, "(")) {
propertyValue = StringUtils.replace(propertyValue, "(", "-");
propertyValue = StringUtils.replace(propertyValue, ")", "");
}
KualiDecimal amount = new KualiDecimal(propertyValue);
if (amount.isNonZero()) {
String objectId = row.getObjectId() + "." + propertyName + "." + KRADUtils.convertDecimalIntoInteger(amount);
selectedObjectIds.put(objectId, objectId);
}
}
}
}
return selectedObjectIds;
}
use of org.kuali.kfs.core.api.util.type.KualiDecimal in project cu-kfs by CU-CommunityApps.
the class CustomerInvoiceDetail method getAmountOpen.
// ---- BEGIN OPEN AMOUNTS
public KualiDecimal getAmountOpen() {
// if the parent isn't 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;
}
use of org.kuali.kfs.core.api.util.type.KualiDecimal in project cu-kfs by CU-CommunityApps.
the class CustomerInvoiceDetail method getAmountDiscounted.
/**
* Retrieves the discounted amount. This is the amount minutes any discounts that might exist. If no discount
* exists, then it just returns the amount.
* <p>
* NOTE this does not subtract PaidApplieds, only discounts.
*
* @return
*/
// PAYAPP
public KualiDecimal getAmountDiscounted() {
KualiDecimal a = getAmount();
CustomerInvoiceDetail discount = getDiscountCustomerInvoiceDetail();
if (ObjectUtils.isNotNull(discount)) {
KualiDecimal d = discount.getAmount();
a = a.add(d);
}
return a;
}
use of org.kuali.kfs.core.api.util.type.KualiDecimal in project cu-kfs by CU-CommunityApps.
the class PaymentApplicationAdjustmentDocument method getTotalDollarAmount.
/**
* @return The total available to be applied on this document.
* back-port FINP 7310
*/
@Override
public KualiDecimal getTotalDollarAmount() {
PaymentApplicationAdjustableDocument adjusteeDocument = (PaymentApplicationAdjustableDocument) getAdjusteeDocument();
KualiDecimal cumulativeAdjusteeNonArTotal = KualiDecimal.ZERO;
if (anAppaIsBeingAdjusted(adjusteeDocument)) {
while (adjusteeDocument instanceof PaymentApplicationAdjustmentDocument) {
cumulativeAdjusteeNonArTotal = cumulativeAdjusteeNonArTotal.add(adjusteeDocument.getNonArTotal());
adjusteeDocument = (PaymentApplicationAdjustableDocument) ((PaymentApplicationAdjustmentDocument) adjusteeDocument).getAdjusteeDocument();
}
} else {
// An APP is being adjusted
cumulativeAdjusteeNonArTotal = cumulativeAdjusteeNonArTotal.add(adjusteeDocument.getNonArTotal());
}
final PaymentApplicationDocument rootAdjusteeDocument = getRootAdjusteeDocument();
final KualiDecimal rootAdjusteeTotalFromControl = rootAdjusteeDocument.getTotalFromControl();
final KualiDecimal totalDollarAmount = rootAdjusteeTotalFromControl.subtract(cumulativeAdjusteeNonArTotal);
LOG.debug("getTotalDollarAmount() - Exit : totalDollarAmount={}", totalDollarAmount);
return totalDollarAmount;
}
Aggregations