use of edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedDetailEntry in project cu-kfs by CU-CommunityApps.
the class ConcurStandardAccountExtractPdpEntryServiceImplTest method cleanAccountingEntriesInDetailEntry_HandleOneCredit.
@Test
public void cleanAccountingEntriesInDetailEntry_HandleOneCredit() {
PdpFeedDetailEntry detailEntry = PdpFeedDetailEntryFixture.DETAIL_TWO_POSITIVE_1_NEGATIVE.toPdpFeedDetailEntry();
Map<DebitCreditTotal, KualiDecimal> totals = pdpEntryService.calculateTotals(detailEntry);
assertEquals("The number of accounting entries should be 3", 3, detailEntry.getAccounting().size());
assertTotals(totals, 15, -10);
pdpEntryService.cleanAccountingEntriesInDetailEntry(detailEntry);
totals = pdpEntryService.calculateTotals(detailEntry);
assertEquals("The number of accounting entries should be 1", 1, detailEntry.getAccounting().size());
assertTotals(totals, 5, 0);
}
use of edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedDetailEntry in project cu-kfs by CU-CommunityApps.
the class ConcurCashAdvancePdpFeedFileServiceImpl method buildPdpFeedBaseEntry.
private PdpFeedFileBaseEntry buildPdpFeedBaseEntry(ConcurRequestExtractFile requestExtractFile, ConcurRequestExtractBatchReportData reportData) {
int totalPdpDetailRecordsCount = 0;
KualiDecimal totalPdpDetailRecordsAmount = KualiDecimal.ZERO;
PdpFeedFileBaseEntry pdpBaseEntry = new PdpFeedFileBaseEntry();
pdpBaseEntry.setHeader(buildPdpFeedHeaderEntry(requestExtractFile.getBatchDate()));
List<PdpFeedGroupEntry> groupEntries = new ArrayList<PdpFeedGroupEntry>();
for (ConcurRequestExtractRequestDetailFileLine detailFileLine : requestExtractFile.getRequestDetails()) {
if (isDetailFileLineValidCashAdvanceRequest(detailFileLine)) {
PdpFeedDetailEntry pdpDetailEntry = buildPdpFeedDetailEntry(detailFileLine, buildPdpFeedAccountingEntry(detailFileLine));
List<PdpFeedDetailEntry> pdpDetailEntries = new ArrayList<PdpFeedDetailEntry>();
pdpDetailEntries.add(pdpDetailEntry);
groupEntries.add(buildPdpFeedGroupEntry(detailFileLine, buildPdpFeedPayeeIdEntry(detailFileLine), pdpDetailEntries));
recordCashAdvanceGenerationInDuplicateTrackingTable(detailFileLine, pdpDetailEntry.getSourceDocNbr(), requestExtractFile.getFileName());
totalPdpDetailRecordsCount++;
totalPdpDetailRecordsAmount = totalPdpDetailRecordsAmount.add(detailFileLine.getRequestAmount());
}
updateReportDataForDetailFileLineBeingProcessed(reportData, detailFileLine, totalPdpDetailRecordsCount, totalPdpDetailRecordsAmount);
}
pdpBaseEntry.setGroup(groupEntries);
pdpBaseEntry.setTrailer(buildPdpFeedTrailerEntry(totalPdpDetailRecordsCount, totalPdpDetailRecordsAmount));
pdpBaseEntry.setVersion(ConcurConstants.FEED_FILE_ENTRY_HEADER_VERSION);
return pdpBaseEntry;
}
use of edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedDetailEntry in project cu-kfs by CU-CommunityApps.
the class ConcurStandardAccountingExtractServiceImpl method buildAndUpdateAccountingEntryFromLine.
private void buildAndUpdateAccountingEntryFromLine(PdpFeedFileBaseEntry pdpFeedFileBaseEntry, ConcurStandardAccountingExtractDetailLine line, ConcurStandardAccountingExtractFile concurStandardAccountingExtractFile) {
PdpFeedGroupEntry currentGroup = getGroupEntryForLine(pdpFeedFileBaseEntry, line);
PdpFeedDetailEntry currentDetail = getDetailEntryForLine(currentGroup, line);
PdpFeedAccountingEntry currentAccounting = getAccountingEntryForLine(currentDetail, line, concurStandardAccountingExtractFile);
KualiDecimal newAmount = line.getJournalAmount().add(currentAccounting.getAmount());
currentAccounting.setAmount(newAmount);
}
use of edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedDetailEntry in project cu-kfs by CU-CommunityApps.
the class ConcurStandardAccountingExtractServiceImpl method getDetailEntryForLine.
private PdpFeedDetailEntry getDetailEntryForLine(PdpFeedGroupEntry groupEntry, ConcurStandardAccountingExtractDetailLine line) {
for (PdpFeedDetailEntry detailEntry : groupEntry.getDetail()) {
if (StringUtils.equalsIgnoreCase(detailEntry.getSourceDocNbr(), getConcurStandardAccountExtractPdpEntryService().buildSourceDocumentNumber(line.getReportId()))) {
return detailEntry;
}
}
PdpFeedDetailEntry detailEntry = getConcurStandardAccountExtractPdpEntryService().buildPdpFeedDetailEntry(line);
groupEntry.getDetail().add(detailEntry);
return detailEntry;
}
use of edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedDetailEntry in project cu-kfs by CU-CommunityApps.
the class ConcurStandardAccountExtractPdpEntryServiceImplTest method cleanAccountingEntriesInDetailEntry_HandleTwoCredits.
@Test
public void cleanAccountingEntriesInDetailEntry_HandleTwoCredits() {
PdpFeedDetailEntry detailEntry = PdpFeedDetailEntryFixture.DETAIL_TWO_POSITIVE_2_NEGATIVE.toPdpFeedDetailEntry();
Map<DebitCreditTotal, KualiDecimal> totals = pdpEntryService.calculateTotals(detailEntry);
assertEquals("The number of accounting entries should be 4", 4, detailEntry.getAccounting().size());
assertTotals(totals, 15, -11);
pdpEntryService.cleanAccountingEntriesInDetailEntry(detailEntry);
totals = pdpEntryService.calculateTotals(detailEntry);
assertEquals("The number of accounting entries should be 1", 1, detailEntry.getAccounting().size());
assertTotals(totals, 4, 0);
}
Aggregations