Search in sources :

Example 1 with PdpFeedFileBaseEntry

use of edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedFileBaseEntry in project cu-kfs by CU-CommunityApps.

the class ConcurStandardAccountExtractPdpEntryServiceImpl method createPdpFileBaseEntryThatDoesNotContainNonReimbursableSections.

@Override
public PdpFeedFileBaseEntry createPdpFileBaseEntryThatDoesNotContainNonReimbursableSections(PdpFeedFileBaseEntry pdpFeedFileBaseEntry, ConcurStandardAccountingExtractBatchReportData reportData) {
    LOG.debug("Entering createPdpFileBaseEntryThatDoesNotContainNonReimbursableSections");
    PdpFeedFileBaseEntry newBaseEntry = new PdpFeedFileBaseEntry();
    newBaseEntry.setHeader(copyHeaderEntry(pdpFeedFileBaseEntry.getHeader()));
    newBaseEntry.setVersion(pdpFeedFileBaseEntry.getVersion());
    addGroupEntriesToNewBaseEntry(newBaseEntry, pdpFeedFileBaseEntry);
    newBaseEntry.setTrailer(buildPdpFeedTrailerEntry(newBaseEntry, reportData));
    return newBaseEntry;
}
Also used : PdpFeedFileBaseEntry(edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedFileBaseEntry)

Example 2 with PdpFeedFileBaseEntry

use of edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedFileBaseEntry in project cu-kfs by CU-CommunityApps.

the class ConcurStandardAccountingExtractServiceImpl method buildPdpFeedFileBaseEntry.

private PdpFeedFileBaseEntry buildPdpFeedFileBaseEntry(ConcurStandardAccountingExtractFile concurStandardAccountingExtractFile, ConcurStandardAccountingExtractBatchReportData reportData) {
    PdpFeedFileBaseEntry pdpFeedFileBaseEntry = new PdpFeedFileBaseEntry();
    pdpFeedFileBaseEntry.setVersion(ConcurConstants.FEED_FILE_ENTRY_HEADER_VERSION);
    pdpFeedFileBaseEntry.setHeader(getConcurStandardAccountExtractPdpEntryService().buildPdpFeedHeaderEntry(concurStandardAccountingExtractFile.getBatchDate()));
    int totalReimbursementLineCount = 0;
    KualiDecimal totalReimbursementDollarAmount = KualiDecimal.ZERO;
    for (ConcurStandardAccountingExtractDetailLine line : concurStandardAccountingExtractFile.getConcurStandardAccountingExtractDetailLines()) {
        if (shouldProcessSAELineToPDP(line)) {
            if (shouldLineTotalsBeAddedToReimbursementReportTotals(line)) {
                totalReimbursementLineCount++;
                totalReimbursementDollarAmount = totalReimbursementDollarAmount.add(line.getJournalAmount());
            }
            logJournalAccountCodeOverridden(line, reportData);
            String overriddenObjectCode = getParameterService().getParameterValueAsString(CUKFSConstants.ParameterNamespaces.CONCUR, CUKFSParameterKeyConstants.ALL_COMPONENTS, ConcurParameterConstants.CONCUR_SAE_PDP_DEFAULT_OBJECT_CODE);
            String overriddenSubObjectCode = StringUtils.EMPTY;
            if (getConcurStandardAccountingExtractValidationService().validateConcurStandardAccountingExtractDetailLineWithObjectCodeOverrideForPdp(line, reportData, overriddenObjectCode, overriddenSubObjectCode)) {
                buildAndUpdateAccountingEntryFromLine(pdpFeedFileBaseEntry, line, concurStandardAccountingExtractFile);
            }
        }
    }
    reportData.getReimbursementsInExpenseReport().setRecordCount(totalReimbursementLineCount);
    reportData.getReimbursementsInExpenseReport().setDollarAmount(totalReimbursementDollarAmount);
    pdpFeedFileBaseEntry.setTrailer(getConcurStandardAccountExtractPdpEntryService().buildPdpFeedTrailerEntry(pdpFeedFileBaseEntry, reportData));
    return pdpFeedFileBaseEntry;
}
Also used : PdpFeedFileBaseEntry(edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedFileBaseEntry) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) ConcurStandardAccountingExtractDetailLine(edu.cornell.kfs.concur.batch.businessobject.ConcurStandardAccountingExtractDetailLine)

Example 3 with PdpFeedFileBaseEntry

use of edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedFileBaseEntry in project cu-kfs by CU-CommunityApps.

the class ConcurStandardAccountExtractPdpEntryServiceImplTest method createPdpFileBaseEntryThatDoesNotContainNonReimbursableSections_OneTransaction.

@Test
public void createPdpFileBaseEntryThatDoesNotContainNonReimbursableSections_OneTransaction() {
    PdpFeedFileBaseEntry pdpFeedFileBaseEntry = PdpFeedFileBaseEntryFixture.FEED_ONE_TRANS_ZER_ONE_TRANS_POSITIVE.toPdpFeedFileBaseEntry();
    assertEquals("Should have 1 group", 1, pdpFeedFileBaseEntry.getGroup().size());
    assertEquals("Should have 2 transactions", 2, pdpFeedFileBaseEntry.getGroup().get(0).getDetail().get(0).getAccounting().size());
    PdpFeedFileBaseEntry cleaned = pdpEntryService.createPdpFileBaseEntryThatDoesNotContainNonReimbursableSections(pdpFeedFileBaseEntry, reportData);
    assertEquals("Should have 1 group", 1, cleaned.getGroup().size());
    assertEquals("Should have 1 detail", 1, cleaned.getGroup().get(0).getDetail().size());
    assertEquals("Should have 1 transaction", 1, cleaned.getGroup().get(0).getDetail().get(0).getAccounting().size());
}
Also used : PdpFeedFileBaseEntry(edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedFileBaseEntry) Test(org.junit.Test)

Example 4 with PdpFeedFileBaseEntry

use of edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedFileBaseEntry in project cu-kfs by CU-CommunityApps.

the class ConcurStandardAccountExtractPdpEntryServiceImplTest method createPdpFileBaseEntryThatDoesNotContainNonReimbursableSections_MultipleGroups.

@Test
public void createPdpFileBaseEntryThatDoesNotContainNonReimbursableSections_MultipleGroups() {
    PdpFeedFileBaseEntry pdpFeedFileBaseEntry = PdpFeedFileBaseEntryFixture.FEED_TWO_GROUPS_ONE_ZERO.toPdpFeedFileBaseEntry();
    assertEquals("Should have 2 group in original feed file", 2, pdpFeedFileBaseEntry.getGroup().size());
    PdpFeedFileBaseEntry cleaned = pdpEntryService.createPdpFileBaseEntryThatDoesNotContainNonReimbursableSections(pdpFeedFileBaseEntry, reportData);
    assertEquals("Should have 1 group in cleaned feed file", 1, cleaned.getGroup().size());
}
Also used : PdpFeedFileBaseEntry(edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedFileBaseEntry) Test(org.junit.Test)

Example 5 with PdpFeedFileBaseEntry

use of edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedFileBaseEntry in project cu-kfs by CU-CommunityApps.

the class ConcurStandardAccountExtractPdpEntryServiceImplTest method createPdpFileBaseEntryThatDoesNotContainNonReimbursableSections_TransSumToNegative.

@Test
public void createPdpFileBaseEntryThatDoesNotContainNonReimbursableSections_TransSumToNegative() {
    PdpFeedFileBaseEntry pdpFeedFileBaseEntry = PdpFeedFileBaseEntryFixture.FEED_TWO_TRANS_SUM_TO_NEGATIVE.toPdpFeedFileBaseEntry();
    assertEquals("Should have 1 group", 1, pdpFeedFileBaseEntry.getGroup().size());
    PdpFeedFileBaseEntry cleaned = pdpEntryService.createPdpFileBaseEntryThatDoesNotContainNonReimbursableSections(pdpFeedFileBaseEntry, reportData);
    assertEquals("Should have no groups", 0, cleaned.getGroup().size());
}
Also used : PdpFeedFileBaseEntry(edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedFileBaseEntry) Test(org.junit.Test)

Aggregations

PdpFeedFileBaseEntry (edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedFileBaseEntry)12 Test (org.junit.Test)7 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)2 ConcurRequestExtractRequestDetailFileLine (edu.cornell.kfs.concur.batch.businessobject.ConcurRequestExtractRequestDetailFileLine)1 ConcurStandardAccountingExtractDetailLine (edu.cornell.kfs.concur.batch.businessobject.ConcurStandardAccountingExtractDetailLine)1 PdpFeedDetailEntry (edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedDetailEntry)1 PdpFeedGroupEntry (edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedGroupEntry)1 ArrayList (java.util.ArrayList)1 Transactional (org.springframework.transaction.annotation.Transactional)1