use of org.kuali.rice.core.api.util.type.KualiDecimal in project cu-kfs by CU-CommunityApps.
the class ConcurDetailLineGroupForCollector method buildOriginEntryForCorporateCardOffset.
protected Optional<OriginEntryFull> buildOriginEntryForCorporateCardOffset(OriginEntryFull corporateCardEntry, List<ConcurStandardAccountingExtractDetailLine> corporateCardLines) {
KualiDecimal corporateCardAmount = getSignedAmountFromOriginEntry(corporateCardEntry);
OriginEntryFull offsetEntry = buildOffsetOriginEntry(corporateCardEntry, corporateCardAmount);
offsetEntry.setChartOfAccountsCode(collectorHelper.getPrepaidOffsetChartCode());
offsetEntry.setAccountNumber(collectorHelper.getPrepaidOffsetAccountNumber());
offsetEntry.setSubAccountNumber(collectorHelper.getDashOnlyPropertyValue(KFSPropertyConstants.SUB_ACCOUNT_NUMBER));
offsetEntry.setFinancialObjectCode(collectorHelper.getPrepaidOffsetObjectCode());
offsetEntry.setFinancialSubObjectCode(collectorHelper.getDashOnlyPropertyValue(KFSPropertyConstants.SUB_OBJECT_CODE));
return Optional.of(offsetEntry);
}
use of org.kuali.rice.core.api.util.type.KualiDecimal in project cu-kfs by CU-CommunityApps.
the class ConcurDetailLineGroupForCollector method addOriginEntriesForCorpCardPersonalExpenseDebitLines.
protected void addOriginEntriesForCorpCardPersonalExpenseDebitLines(Consumer<OriginEntryFull> entryConsumer) {
if (getLineMapOfType(ConcurSAECollectorLineType.CORP_CARD_PERSONAL_DEBIT).isEmpty()) {
return;
}
KualiDecimal netCashAmount = calculateTotalCashAmountNotOffsetByCashAdvances();
KualiDecimal currentReimbursableCashAmount = netCashAmount;
for (List<ConcurStandardAccountingExtractDetailLine> corpCardPersonalDebits : getSubGroupsOfType(ConcurSAECollectorLineType.CORP_CARD_PERSONAL_DEBIT)) {
KualiDecimal totalSubGroupAmount = calculateTotalAmountForLines(corpCardPersonalDebits);
if (totalSubGroupAmount.isZero()) {
continue;
}
KualiDecimal newReimbursableCashAmount = currentReimbursableCashAmount.subtract(totalSubGroupAmount);
KualiDecimal paymentOffsetAdjustment = calculatePaymentOffsetAdjustmentForCorpCardPersonalExpenseSubGroup(totalSubGroupAmount, currentReimbursableCashAmount, newReimbursableCashAmount);
KualiDecimal personalOffsetAdjustment = calculatePersonalOffsetAdjustmentForCorpCardPersonalExpenseSubGroup(totalSubGroupAmount, currentReimbursableCashAmount, newReimbursableCashAmount);
addOriginEntriesForCorpCardPersonalExpenseDebitLinesIfNecessary(entryConsumer, corpCardPersonalDebits, paymentOffsetAdjustment, personalOffsetAdjustment);
currentReimbursableCashAmount = newReimbursableCashAmount;
}
}
use of org.kuali.rice.core.api.util.type.KualiDecimal in project cu-kfs by CU-CommunityApps.
the class ConcurDetailLineGroupForCollector method buildOffsetOriginEntry.
protected OriginEntryFull buildOffsetOriginEntry(OriginEntryFull baseEntry, KualiDecimal amountToOffset) {
OriginEntryFull offsetEntry = new OriginEntryFull(baseEntry);
KualiDecimal offsetAmount = amountToOffset.negated();
setTransactionSequenceNumberToNextAvailableValue(offsetEntry);
configureAmountAndDebitCreditCodeOnOriginEntry(offsetEntry, offsetAmount);
return offsetEntry;
}
use of org.kuali.rice.core.api.util.type.KualiDecimal in project cu-kfs by CU-CommunityApps.
the class ConcurDetailLineGroupForCollector method addOriginEntriesForCorpCardPersonalExpenseCreditLines.
protected void addOriginEntriesForCorpCardPersonalExpenseCreditLines(Consumer<OriginEntryFull> entryConsumer) {
if (getLineMapOfType(ConcurSAECollectorLineType.CORP_CARD_PERSONAL_CREDIT).isEmpty()) {
return;
}
for (List<ConcurStandardAccountingExtractDetailLine> corpCardPersonalCredits : getSubGroupsOfType(ConcurSAECollectorLineType.CORP_CARD_PERSONAL_CREDIT)) {
KualiDecimal totalSubGroupAmount = calculateTotalAmountForLines(corpCardPersonalCredits);
if (totalSubGroupAmount.isNonZero()) {
ConcurStandardAccountingExtractDetailLine firstCreditLine = corpCardPersonalCredits.get(0);
addOriginEntryForCorpCardPersonalExpense(entryConsumer, firstCreditLine, collectorHelper.getPrepaidOffsetChartCode(), collectorHelper.getPrepaidOffsetAccountNumber(), StringUtils.EMPTY, collectorHelper.getPrepaidOffsetObjectCode(), totalSubGroupAmount);
}
}
}
use of org.kuali.rice.core.api.util.type.KualiDecimal in project cu-kfs by CU-CommunityApps.
the class ConcurRequestExtractFileValidationServiceImpl method calculateFileTotalApprovedAmountAggregatedByRequestId.
private KualiDecimal calculateFileTotalApprovedAmountAggregatedByRequestId(ConcurRequestExtractFile requestExtractFile) {
KualiDecimal detailLinesTotalApprovedAmountSum = KualiDecimal.ZERO;
if (CollectionUtils.isEmpty(requestExtractFile.getRequestDetails())) {
return detailLinesTotalApprovedAmountSum;
} else {
List<ConcurRequestExtractRequestDetailFileLine> requestDetailLines = requestExtractFile.getRequestDetails();
List<String> uniqueRequestIds = findAllUniqueRequestIds(requestDetailLines);
for (String uniqueRequestId : uniqueRequestIds) {
boolean approvedAmountForRequestIdNotFound = true;
ListIterator<ConcurRequestExtractRequestDetailFileLine> requestDetailFileLineIterator = requestDetailLines.listIterator();
while (requestDetailFileLineIterator.hasNext() && approvedAmountForRequestIdNotFound) {
ConcurRequestExtractRequestDetailFileLine detailLine = requestDetailFileLineIterator.next();
if (StringUtils.equals(detailLine.getRequestId(), uniqueRequestId)) {
approvedAmountForRequestIdNotFound = false;
detailLinesTotalApprovedAmountSum = detailLinesTotalApprovedAmountSum.add(detailLine.getTotalApprovedAmount());
}
}
}
return detailLinesTotalApprovedAmountSum;
}
}
Aggregations