use of edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedAccountingEntry in project cu-kfs by CU-CommunityApps.
the class ConcurStandardAccountExtractPdpEntryServiceImpl method deductCreditAmountsFromDebitTransactions.
private void deductCreditAmountsFromDebitTransactions(PdpFeedDetailEntry newDetailEntry, KualiDecimal originalCreditTotal) {
KualiDecimal totalDeductionsLeft = originalCreditTotal;
for (PdpFeedAccountingEntry accountingEntry : newDetailEntry.getAccounting()) {
if (accountingEntry.getAmount().isPositive() && totalDeductionsLeft.isNegative()) {
KualiDecimal newTransactionAmount = accountingEntry.getAmount().add(totalDeductionsLeft);
if (newTransactionAmount.isNegative()) {
totalDeductionsLeft = newTransactionAmount;
newTransactionAmount = KualiDecimal.ZERO;
} else {
totalDeductionsLeft = KualiDecimal.ZERO;
}
LOG.info("deductCreditAmountsFromDebitTransactions, Editing transction " + accountingEntry.toString() + ". changing the amount to " + newTransactionAmount);
accountingEntry.setAmount(newTransactionAmount);
}
}
}
use of edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedAccountingEntry in project cu-kfs by CU-CommunityApps.
the class ConcurStandardAccountExtractPdpEntryServiceImpl method calculateTotals.
protected EnumMap<DebitCreditTotal, KualiDecimal> calculateTotals(PdpFeedDetailEntry detailEntry) {
KualiDecimal debitTotal = KualiDecimal.ZERO;
KualiDecimal creditTotal = KualiDecimal.ZERO;
for (PdpFeedAccountingEntry accountingEntry : detailEntry.getAccounting()) {
if (accountingEntry.getAmount().isPositive()) {
debitTotal = debitTotal.add(accountingEntry.getAmount());
} else {
creditTotal = creditTotal.add(accountingEntry.getAmount());
}
}
LOG.info("calculateTotals, debitTotal: " + debitTotal + " creditTotal: " + creditTotal);
EnumMap<DebitCreditTotal, KualiDecimal> totals = new EnumMap<DebitCreditTotal, KualiDecimal>(DebitCreditTotal.class);
totals.put(DebitCreditTotal.CREDIT, creditTotal);
totals.put(DebitCreditTotal.DEBIT, debitTotal);
return totals;
}
use of edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedAccountingEntry in project cu-kfs by CU-CommunityApps.
the class ConcurStandardAccountExtractPdpEntryServiceImpl method addDetailEntriesToNewGroupEntry.
private void addDetailEntriesToNewGroupEntry(PdpFeedGroupEntry newGroupEntry, PdpFeedGroupEntry originalGroupEntry) {
for (PdpFeedDetailEntry originalDetailEntry : originalGroupEntry.getDetail()) {
PdpFeedDetailEntry newDetailEntry = copyDetailEntry(originalDetailEntry);
KualiDecimal originalDetailTransactionTotal = KualiDecimal.ZERO;
for (PdpFeedAccountingEntry originalAccountingEntry : originalDetailEntry.getAccounting()) {
originalDetailTransactionTotal = originalDetailTransactionTotal.add(originalAccountingEntry.getAmount());
newDetailEntry.getAccounting().add(copyAccountingEntry(originalAccountingEntry));
}
cleanAccountingEntriesInDetailEntry(newDetailEntry);
addNewPaymentDetailToGroupIfTotalIsPositive(newGroupEntry, newDetailEntry, originalDetailTransactionTotal);
}
}
use of edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedAccountingEntry in project cu-kfs by CU-CommunityApps.
the class ConcurStandardAccountExtractPdpEntryServiceImpl method removeNonPositiveAccountingEntriesFromDetailEntry.
private void removeNonPositiveAccountingEntriesFromDetailEntry(PdpFeedDetailEntry newDetailEntry) {
List<PdpFeedAccountingEntry> newAccountingEntries = new ArrayList<PdpFeedAccountingEntry>();
for (PdpFeedAccountingEntry accountingEntry : newDetailEntry.getAccounting()) {
if (accountingEntry.getAmount().isPositive()) {
newAccountingEntries.add(accountingEntry);
} else {
LOG.info("removeNonPositiveAccountingEntriesFromDetailEntry, removing " + accountingEntry.toString());
}
}
newDetailEntry.setAccounting(newAccountingEntries);
}
use of edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedAccountingEntry in project cu-kfs by CU-CommunityApps.
the class ConcurCashAdvancePdpFeedFileServiceImpl method buildPdpFeedDetailEntry.
private PdpFeedDetailEntry buildPdpFeedDetailEntry(ConcurRequestExtractRequestDetailFileLine detailFileLine, PdpFeedAccountingEntry pdpAccountingEntry) {
PdpFeedDetailEntry pdpDetailEntry = new PdpFeedDetailEntry();
pdpDetailEntry.setSourceDocNbr(getConcurBatchUtilityService().formatSourceDocumentNumber(getConcurBatchUtilityService().getConcurParameterValue(ConcurParameterConstants.CONCUR_REQUEST_EXTRACT_PDP_DOCUMENT_TYPE), detailFileLine.getRequestId()));
pdpDetailEntry.setInvoiceNbr(getConcurBatchUtilityService().getConcurParameterValue(ConcurParameterConstants.CONCUR_PDP_DEFAULT_INVOICE_NUMBER));
pdpDetailEntry.setPoNbr(StringUtils.EMPTY);
pdpDetailEntry.setInvoiceDate(getConcurBatchUtilityService().formatDate_MMddyyyy(detailFileLine.getBatchDate()));
pdpDetailEntry.setNetPaymentAmt(detailFileLine.getRequestAmount());
pdpDetailEntry.setFsOriginCd(getConcurBatchUtilityService().getConcurParameterValue(ConcurParameterConstants.CONCUR_AP_PDP_ORIGINATION_CODE));
pdpDetailEntry.setFdocTypCd(getConcurBatchUtilityService().getConcurParameterValue(ConcurParameterConstants.CONCUR_REQUEST_EXTRACT_PDP_DOCUMENT_TYPE));
List<String> paymentTexts = new ArrayList<String>();
paymentTexts.add(detailFileLine.getRequestEntryDescription());
pdpDetailEntry.setPaymentText(paymentTexts);
List<PdpFeedAccountingEntry> accountingLines = new ArrayList<PdpFeedAccountingEntry>();
accountingLines.add(pdpAccountingEntry);
pdpDetailEntry.setAccounting(accountingLines);
return pdpDetailEntry;
}
Aggregations