Search in sources :

Example 11 with ConcurStandardAccountingExtractDetailLine

use of edu.cornell.kfs.concur.batch.businessobject.ConcurStandardAccountingExtractDetailLine in project cu-kfs by CU-CommunityApps.

the class ConcurStandardAccountingExtractCashAdvanceServiceImplTest method validateFindAccountingInfoForCashAdvanceLine.

@Test
public void validateFindAccountingInfoForCashAdvanceLine() {
    List<ConcurStandardAccountingExtractDetailLine> saeLines = buildSAELines();
    ConcurStandardAccountingExtractDetailLine line = ConcurSAEDetailLineFixture.PDP_TEST_CASH_ADVANCE_500.toDetailLine();
    ConcurAccountInfo info = concurStandardAccountingExtractCashAdvanceService.findAccountingInfoForCashAdvanceLine(line, saeLines);
    assertEquals("Charts should match", ParameterTestValues.COLLECTOR_CHART_CODE, info.getChart());
    assertEquals("Accounts should match", ConcurTestConstants.ACCT_1234321, info.getAccountNumber());
}
Also used : ConcurAccountInfo(edu.cornell.kfs.concur.businessobjects.ConcurAccountInfo) ConcurStandardAccountingExtractDetailLine(edu.cornell.kfs.concur.batch.businessobject.ConcurStandardAccountingExtractDetailLine) Test(org.junit.Test)

Example 12 with ConcurStandardAccountingExtractDetailLine

use of edu.cornell.kfs.concur.batch.businessobject.ConcurStandardAccountingExtractDetailLine in project cu-kfs by CU-CommunityApps.

the class ConcurStandardAccountingExtractCashAdvanceServiceImplTest method validateIsCashAdvanceFalse.

@Test
public void validateIsCashAdvanceFalse() {
    ConcurStandardAccountingExtractDetailLine line = ConcurSAEDetailLineFixture.PDP_TEST_DEBIT_1_50.toDetailLine();
    assertFalse("Should NOT be a cash advance line", concurStandardAccountingExtractCashAdvanceService.isCashAdvanceLine(line));
}
Also used : ConcurStandardAccountingExtractDetailLine(edu.cornell.kfs.concur.batch.businessobject.ConcurStandardAccountingExtractDetailLine) Test(org.junit.Test)

Example 13 with ConcurStandardAccountingExtractDetailLine

use of edu.cornell.kfs.concur.batch.businessobject.ConcurStandardAccountingExtractDetailLine in project cu-kfs by CU-CommunityApps.

the class ConcurStandardAccountingExtractCollectorBatchBuilder method groupLines.

protected void groupLines(List<ConcurStandardAccountingExtractDetailLine> saeLines) {
    for (ConcurStandardAccountingExtractDetailLine saeLine : saeLines) {
        if (concurStandardAccountingExtractCashAdvanceService.isCashAdvanceLine(saeLine)) {
            reportCashAdvance(saeLine);
        }
        if (shouldProcessLine(saeLine) && concurSAEValidationService.validateConcurStandardAccountingExtractDetailLineForCollector(saeLine, reportData)) {
            if (Boolean.TRUE.equals(saeLine.getJournalAccountCodeOverridden())) {
                reportPendingClientLine(saeLine);
            }
            ConcurDetailLineGroupForCollector lineGroup = lineGroups.computeIfAbsent(saeLine.getReportId(), (reportId) -> new ConcurDetailLineGroupForCollector(reportId, collectorHelper));
            lineGroup.addDetailLine(saeLine);
        }
    }
}
Also used : ConcurStandardAccountingExtractDetailLine(edu.cornell.kfs.concur.batch.businessobject.ConcurStandardAccountingExtractDetailLine)

Example 14 with ConcurStandardAccountingExtractDetailLine

use of edu.cornell.kfs.concur.batch.businessobject.ConcurStandardAccountingExtractDetailLine in project cu-kfs by CU-CommunityApps.

the class ConcurDetailLineGroupForCollector method buildOriginEntryForUnusedAtmAmountOffset.

protected OriginEntryFull buildOriginEntryForUnusedAtmAmountOffset(List<ConcurStandardAccountingExtractDetailLine> unusedAtmAmountLines, KualiDecimal amountToOffset) {
    if (unusedAtmAmountLines.isEmpty()) {
        throw new IllegalArgumentException("unusedAtmAmountLines list cannot be empty; this should NEVER happen!");
    }
    ConcurStandardAccountingExtractDetailLine firstUnusedAmountLine = unusedAtmAmountLines.get(0);
    OriginEntryFull regularEntry = buildOriginEntryWithoutAccountingIdentifiers(firstUnusedAmountLine, amountToOffset);
    configureOriginEntryFromDetailLineForAtmCashAdvance(regularEntry, firstUnusedAmountLine);
    resetTransactionSequenceNumberCounterToPreviousValue();
    OriginEntryFull offsetEntry = buildOffsetOriginEntry(regularEntry, amountToOffset);
    offsetEntry.setChartOfAccountsCode(firstUnusedAmountLine.getReportChartOfAccountsCode());
    offsetEntry.setAccountNumber(firstUnusedAmountLine.getReportAccountNumber());
    offsetEntry.setSubAccountNumber(defaultToDashesIfBlank(firstUnusedAmountLine.getReportSubAccountNumber(), KFSPropertyConstants.SUB_ACCOUNT_NUMBER));
    offsetEntry.setFinancialObjectCode(collectorHelper.getAtmUnusedAmountOffsetObjectCode());
    offsetEntry.setFinancialSubObjectCode(collectorHelper.getDashOnlyPropertyValue(KFSPropertyConstants.SUB_OBJECT_CODE));
    return offsetEntry;
}
Also used : OriginEntryFull(org.kuali.kfs.gl.businessobject.OriginEntryFull) ConcurStandardAccountingExtractDetailLine(edu.cornell.kfs.concur.batch.businessobject.ConcurStandardAccountingExtractDetailLine)

Example 15 with ConcurStandardAccountingExtractDetailLine

use of edu.cornell.kfs.concur.batch.businessobject.ConcurStandardAccountingExtractDetailLine in project cu-kfs by CU-CommunityApps.

the class ConcurDetailLineGroupForCollector method addOriginEntriesForLines.

/**
 * @param entryConsumer The Consumer to add the generated origin entries to; won't be called if detailLines is empty or has zero-sum lines.
 * @param detailLines The SAE lines to generate a single origin entry from; may be empty.
 * @param offsetGenerator A BiFunction that may create an offset entry using the generated regular entry and the detailLines List.
 */
protected void addOriginEntriesForLines(Consumer<OriginEntryFull> entryConsumer, List<ConcurStandardAccountingExtractDetailLine> detailLines, BiFunction<OriginEntryFull, List<ConcurStandardAccountingExtractDetailLine>, Optional<OriginEntryFull>> offsetGenerator) {
    if (CollectionUtils.isEmpty(detailLines)) {
        return;
    }
    KualiDecimal totalAmount = calculateTotalAmountForLines(detailLines);
    if (totalAmount.isNonZero()) {
        ConcurStandardAccountingExtractDetailLine firstDetailLine = detailLines.get(0);
        OriginEntryFull originEntry = buildOriginEntry(firstDetailLine, totalAmount);
        entryConsumer.accept(originEntry);
        Optional<OriginEntryFull> optionalOffsetEntry = offsetGenerator.apply(originEntry, detailLines);
        if (optionalOffsetEntry.isPresent()) {
            entryConsumer.accept(optionalOffsetEntry.get());
        }
    }
}
Also used : KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) OriginEntryFull(org.kuali.kfs.gl.businessobject.OriginEntryFull) ConcurStandardAccountingExtractDetailLine(edu.cornell.kfs.concur.batch.businessobject.ConcurStandardAccountingExtractDetailLine)

Aggregations

ConcurStandardAccountingExtractDetailLine (edu.cornell.kfs.concur.batch.businessobject.ConcurStandardAccountingExtractDetailLine)19 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)8 Test (org.junit.Test)3 OriginEntryFull (org.kuali.kfs.gl.businessobject.OriginEntryFull)3 ConcurAccountInfo (edu.cornell.kfs.concur.businessobjects.ConcurAccountInfo)2 ConcurSAEDetailLineFixture (edu.cornell.kfs.concur.batch.fixture.ConcurSAEDetailLineFixture)1 ConcurBatchReportLineValidationErrorItem (edu.cornell.kfs.concur.batch.report.ConcurBatchReportLineValidationErrorItem)1 PdpFeedFileBaseEntry (edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedFileBaseEntry)1 ArrayList (java.util.ArrayList)1