Search in sources :

Example 11 with OriginEntryFull

use of org.kuali.kfs.gl.businessobject.OriginEntryFull in project cu-kfs by CU-CommunityApps.

the class ReversionProcessBase method getEntry.

protected OriginEntryFull getEntry() {
    OriginEntryFull entry = new OriginEntryFull();
    entry.setUniversityFiscalYear((Integer) jobParameters.get(KFSConstants.UNIV_FISCAL_YR));
    entry.setUniversityFiscalPeriodCode(KFSConstants.MONTH13);
    entry.setFinancialDocumentTypeCode(DEFAULT_FINANCIAL_DOCUMENT_TYPE_CODE);
    entry.setFinancialSystemOriginationCode(DEFAULT_FINANCIAL_SYSTEM_ORIGINATION_CODE);
    entry.setTransactionLedgerEntrySequenceNumber(1);
    entry.setTransactionDebitCreditCode(KFSConstants.GL_BUDGET_CODE);
    entry.setTransactionDate((Date) jobParameters.get(KFSConstants.TRANSACTION_DT));
    entry.setProjectCode(KFSConstants.getDashProjectCode());
    return entry;
}
Also used : OriginEntryFull(org.kuali.kfs.gl.businessobject.OriginEntryFull)

Example 12 with OriginEntryFull

use of org.kuali.kfs.gl.businessobject.OriginEntryFull 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 13 with OriginEntryFull

use of org.kuali.kfs.gl.businessobject.OriginEntryFull 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)

Example 14 with OriginEntryFull

use of org.kuali.kfs.gl.businessobject.OriginEntryFull in project cu-kfs by CU-CommunityApps.

the class ConcurDetailLineGroupForCollector method buildCorpCardPersonalExpenseOriginEntry.

protected OriginEntryFull buildCorpCardPersonalExpenseOriginEntry(ConcurStandardAccountingExtractDetailLine detailLine, String chartCode, String accountNumber, String subAccountNumber, String objectCode, String subObjectCode, KualiDecimal amount) {
    OriginEntryFull originEntry = buildOriginEntryWithoutAccountingIdentifiers(detailLine, amount);
    originEntry.setChartOfAccountsCode(chartCode);
    originEntry.setAccountNumber(accountNumber);
    originEntry.setSubAccountNumber(defaultToDashesIfBlank(subAccountNumber, KFSPropertyConstants.SUB_ACCOUNT_NUMBER));
    originEntry.setFinancialObjectCode(objectCode);
    originEntry.setFinancialSubObjectCode(defaultToDashesIfBlank(subObjectCode, KFSPropertyConstants.SUB_OBJECT_CODE));
    originEntry.setProjectCode(defaultToDashesIfBlank(detailLine.getReportProjectCode(), KFSPropertyConstants.PROJECT_CODE));
    originEntry.setOrganizationReferenceId(StringUtils.defaultIfBlank(detailLine.getReportOrgRefId(), StringUtils.EMPTY));
    return originEntry;
}
Also used : OriginEntryFull(org.kuali.kfs.gl.businessobject.OriginEntryFull)

Example 15 with OriginEntryFull

use of org.kuali.kfs.gl.businessobject.OriginEntryFull in project cu-kfs by CU-CommunityApps.

the class YearEndGeneralLedgerPendingEntriesServiceImpl method generateCGBalanceForwardPendingEntry.

/**
 * Generates the CG Balance Forward entry.
 *
 * @param document
 * @param postable
 * @param sequenceNumber
 * @param fiscalYear
 * @return The GL pending entry
 */
public GeneralLedgerPendingEntry generateCGBalanceForwardPendingEntry(AccountingDocumentBase document, AccountingLine postable, Integer sequenceNumber, Integer fiscalYear) {
    /*
         * Much of the code below was copied from BalanceForwardRuleHelper.generateCumulativeForwardOriginEntry,
         * and adapted for generating a YEJV GL pending entry instead of a full origin entry.
         */
    GeneralLedgerPendingEntry entry = new GeneralLedgerPendingEntry();
    // Populate a temporary OriginEntryFull object so that we can use the FlexibleOffsetAccountService functionality.
    OriginEntryFull originEntry = new OriginEntryFull();
    originEntry.setUniversityFiscalYear(new Integer(fiscalYear + 1));
    originEntry.setChartOfAccountsCode(postable.getChartOfAccountsCode());
    originEntry.setAccountNumber(postable.getAccountNumber());
    originEntry.setSubAccountNumber(StringUtils.isBlank(postable.getSubAccountNumber()) ? KFSConstants.getDashSubAccountNumber() : postable.getSubAccountNumber());
    originEntry.setFinancialObjectCode(postable.getFinancialObjectCode());
    originEntry.setFinancialSubObjectCode(StringUtils.isBlank(postable.getFinancialSubObjectCode()) ? KFSConstants.getDashFinancialSubObjectCode() : postable.getFinancialSubObjectCode());
    originEntry.setFinancialBalanceTypeCode(postable.getBalanceTypeCode());
    originEntry.setFinancialObjectTypeCode(postable.getObjectCode().getFinancialObjectTypeCode());
    // Use the FlexibleOffsetAccountService to make updates as needed.
    try {
        getFlexibleOffsetAccountService().updateOffset(originEntry);
    } catch (InvalidFlexibleOffsetException e) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("generateCGBalanceForwardPendingEntry() Balance Forward Flexible Offset Error: " + e.getMessage());
        }
    }
    // Copy the potentially-changed data into the GL pending entry accordingly.
    entry.setUniversityFiscalYear(originEntry.getUniversityFiscalYear());
    entry.setChartOfAccountsCode(originEntry.getChartOfAccountsCode());
    entry.setAccountNumber(originEntry.getAccountNumber());
    entry.setSubAccountNumber(originEntry.getSubAccountNumber());
    entry.setFinancialObjectCode(originEntry.getFinancialObjectCode());
    entry.setFinancialSubObjectCode(originEntry.getFinancialSubObjectCode());
    entry.setFinancialBalanceTypeCode(originEntry.getFinancialBalanceTypeCode());
    entry.setFinancialObjectTypeCode(originEntry.getFinancialObjectTypeCode());
    // Continue with regular setup.
    entry.setUniversityFiscalPeriodCode(KFSConstants.PERIOD_CODE_CG_BEGINNING_BALANCE);
    entry.setFinancialDocumentTypeCode(document.getFinancialSystemDocumentHeader().getWorkflowDocument().getDocumentTypeName());
    entry.setFinancialSystemOriginationCode(homeOriginationService.getHomeOrigination().getFinSystemHomeOriginationCode());
    entry.setDocumentNumber(new StringBuilder(KFSConstants.BALANCE_TYPE_ACTUAL).append(postable.getAccountNumber()).toString());
    entry.setTransactionLedgerEntrySequenceNumber(sequenceNumber);
    entry.setTransactionLedgerEntryDescription(new StringBuilder("BEG C & G BAL BROUGHT FORWARD FROM ").append(fiscalYear).toString());
    entry.setTransactionLedgerEntryAmount(postable.getAmount());
    if (KFSConstants.BALANCE_TYPE_CURRENT_BUDGET.equals(postable.getBalanceTypeCode()) || KFSConstants.BALANCE_TYPE_BASE_BUDGET.equals(postable.getBalanceTypeCode())) {
        entry.setTransactionDebitCreditCode(null);
    } else {
        entry.setTransactionDebitCreditCode(postable.getDebitCreditCode());
    }
    Timestamp transactionTimestamp = new Timestamp(dateTimeService.getCurrentDate().getTime());
    entry.setTransactionDate(new java.sql.Date(transactionTimestamp.getTime()));
    entry.setOrganizationDocumentNumber(null);
    entry.setProjectCode(KFSConstants.getDashProjectCode());
    entry.setOrganizationReferenceId(null);
    entry.setReferenceFinancialDocumentNumber(null);
    entry.setReferenceFinancialSystemOriginationCode(null);
    entry.setReferenceFinancialDocumentNumber(null);
    entry.setFinancialDocumentReversalDate(null);
    String transactionEncumbranceUpdateCode = KFSConstants.ENCUMB_UPDT_NO_ENCUMBRANCE_CD;
    entry.setTransactionEncumbranceUpdateCode(transactionEncumbranceUpdateCode);
    if (KFSConstants.BALANCE_TYPE_AUDIT_TRAIL.equals(postable.getBalanceTypeCode())) {
        entry.setFinancialBalanceTypeCode(KFSConstants.BALANCE_TYPE_ACTUAL);
    }
    if (entry.getTransactionLedgerEntryAmount().isNegative()) {
        if (KFSConstants.BALANCE_TYPE_ACTUAL.equals(entry.getFinancialBalanceTypeCode())) {
            entry.setTransactionLedgerEntryAmount(entry.getTransactionLedgerEntryAmount().negated());
        }
    }
    return entry;
}
Also used : GeneralLedgerPendingEntry(org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry) InvalidFlexibleOffsetException(org.kuali.kfs.sys.exception.InvalidFlexibleOffsetException) Timestamp(java.sql.Timestamp) OriginEntryFull(org.kuali.kfs.gl.businessobject.OriginEntryFull)

Aggregations

OriginEntryFull (org.kuali.kfs.gl.businessobject.OriginEntryFull)20 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)6 FatalErrorException (org.kuali.kfs.gl.batch.service.impl.exception.FatalErrorException)5 ObjectCode (org.kuali.kfs.coa.businessobject.ObjectCode)4 ConcurStandardAccountingExtractDetailLine (edu.cornell.kfs.concur.batch.businessobject.ConcurStandardAccountingExtractDetailLine)3 List (java.util.List)3 InvalidFlexibleOffsetException (org.kuali.kfs.sys.exception.InvalidFlexibleOffsetException)3 IOException (java.io.IOException)2 Message (org.kuali.kfs.sys.Message)2 ReversionCategory (edu.cornell.kfs.coa.businessobject.ReversionCategory)1 ReversionCategoryInfo (edu.cornell.kfs.coa.businessobject.ReversionCategoryInfo)1 ReversionUnitOfWork (edu.cornell.kfs.gl.businessobject.ReversionUnitOfWork)1 ReversionUnitOfWorkCategoryAmount (edu.cornell.kfs.gl.businessobject.ReversionUnitOfWorkCategoryAmount)1 BigDecimal (java.math.BigDecimal)1 Date (java.sql.Date)1 Timestamp (java.sql.Timestamp)1 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 A21SubAccount (org.kuali.kfs.coa.businessobject.A21SubAccount)1