Search in sources :

Example 11 with KualiDecimal

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);
}
Also used : KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) OriginEntryFull(org.kuali.kfs.gl.businessobject.OriginEntryFull)

Example 12 with KualiDecimal

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;
    }
}
Also used : KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) ConcurStandardAccountingExtractDetailLine(edu.cornell.kfs.concur.batch.businessobject.ConcurStandardAccountingExtractDetailLine)

Example 13 with KualiDecimal

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;
}
Also used : KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) OriginEntryFull(org.kuali.kfs.gl.businessobject.OriginEntryFull)

Example 14 with KualiDecimal

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);
        }
    }
}
Also used : KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) ConcurStandardAccountingExtractDetailLine(edu.cornell.kfs.concur.batch.businessobject.ConcurStandardAccountingExtractDetailLine)

Example 15 with KualiDecimal

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;
    }
}
Also used : ConcurRequestExtractRequestDetailFileLine(edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractRequestDetailFileLine) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal)

Aggregations

KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)209 ArrayList (java.util.ArrayList)37 HashMap (java.util.HashMap)19 Test (org.junit.Test)19 List (java.util.List)15 SourceAccountingLine (org.kuali.kfs.sys.businessobject.SourceAccountingLine)15 CapitalAssetInformation (org.kuali.kfs.fp.businessobject.CapitalAssetInformation)14 BigDecimal (java.math.BigDecimal)13 Date (java.sql.Date)13 Iterator (java.util.Iterator)12 PurchaseOrderDocument (org.kuali.kfs.module.purap.document.PurchaseOrderDocument)12 KualiInteger (org.kuali.rice.core.api.util.type.KualiInteger)12 PaymentRequestItem (org.kuali.kfs.module.purap.businessobject.PaymentRequestItem)11 IOException (java.io.IOException)10 ParameterService (org.kuali.kfs.coreservice.framework.parameter.ParameterService)10 Map (java.util.Map)9 CapitalAccountingLines (org.kuali.kfs.fp.businessobject.CapitalAccountingLines)9 PurchaseOrderItem (org.kuali.kfs.module.purap.businessobject.PurchaseOrderItem)9 PaymentGroup (org.kuali.kfs.pdp.businessobject.PaymentGroup)9 RequisitionDocument (org.kuali.kfs.module.purap.document.RequisitionDocument)8