Search in sources :

Example 6 with PdpFeedAccountingEntry

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

Example 7 with PdpFeedAccountingEntry

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

Example 8 with PdpFeedAccountingEntry

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

Example 9 with PdpFeedAccountingEntry

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);
}
Also used : ArrayList(java.util.ArrayList) PdpFeedAccountingEntry(edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedAccountingEntry)

Example 10 with PdpFeedAccountingEntry

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;
}
Also used : PdpFeedDetailEntry(edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedDetailEntry) ArrayList(java.util.ArrayList) PdpFeedAccountingEntry(edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedAccountingEntry)

Aggregations

PdpFeedAccountingEntry (edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedAccountingEntry)11 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)5 PdpFeedDetailEntry (edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedDetailEntry)4 PdpFeedGroupEntry (edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedGroupEntry)2 ArrayList (java.util.ArrayList)2 PdpFeedTrailerEntry (edu.cornell.kfs.concur.batch.xmlObjects.PdpFeedTrailerEntry)1 ConcurAccountInfo (edu.cornell.kfs.concur.businessobjects.ConcurAccountInfo)1 EnumMap (java.util.EnumMap)1