Search in sources :

Example 21 with ObjectCode

use of org.kuali.kfs.coa.businessobject.ObjectCode in project cu-kfs by CU-CommunityApps.

the class CuPosterServiceImpl method generateTransactions.

@Override
protected void generateTransactions(ExpenditureTransaction et, IndirectCostRecoveryRateDetail icrRateDetail, KualiDecimal generatedTransactionAmount, Date runDate, PrintStream group, IndirectCostRecoveryGenerationMetadata icrGenerationMetadata) {
    BigDecimal pct = new BigDecimal(icrRateDetail.getAwardIndrCostRcvyRatePct().toString());
    pct = pct.divide(BDONEHUNDRED);
    OriginEntryFull e = new OriginEntryFull();
    e.setTransactionLedgerEntrySequenceNumber(0);
    // means we use the ICR field from the account record, otherwise, use the field in the icrRateDetail
    if (GeneralLedgerConstants.PosterService.SYMBOL_USE_EXPENDITURE_ENTRY.equals(icrRateDetail.getFinancialObjectCode()) || GeneralLedgerConstants.PosterService.SYMBOL_USE_ICR_FROM_ACCOUNT.equals(icrRateDetail.getFinancialObjectCode())) {
        e.setFinancialObjectCode(et.getObjectCode());
        e.setFinancialSubObjectCode(et.getSubObjectCode());
    } else {
        e.setFinancialObjectCode(icrRateDetail.getFinancialObjectCode());
        e.setFinancialSubObjectCode(icrRateDetail.getFinancialSubObjectCode());
    }
    if (GeneralLedgerConstants.PosterService.SYMBOL_USE_EXPENDITURE_ENTRY.equals(icrRateDetail.getAccountNumber())) {
        e.setAccountNumber(et.getAccountNumber());
        e.setChartOfAccountsCode(et.getChartOfAccountsCode());
        e.setSubAccountNumber(et.getSubAccountNumber());
    } else if (GeneralLedgerConstants.PosterService.SYMBOL_USE_ICR_FROM_ACCOUNT.equals(icrRateDetail.getAccountNumber())) {
        e.setAccountNumber(icrGenerationMetadata.getIndirectCostRecoveryAcctNbr());
        e.setChartOfAccountsCode(icrGenerationMetadata.getIndirectCostRcvyFinCoaCode());
        e.setSubAccountNumber(KFSConstants.getDashSubAccountNumber());
    } else {
        e.setAccountNumber(icrRateDetail.getAccountNumber());
        e.setSubAccountNumber(icrRateDetail.getSubAccountNumber());
        e.setChartOfAccountsCode(icrRateDetail.getChartOfAccountsCode());
    // TODO Reporting thing line 1946
    }
    // take care of infinite recursive error case - do not generate entries
    if ((et.getAccountNumber().equals(e.getAccountNumber())) && (et.getChartOfAccountsCode().equals(e.getChartOfAccountsCode())) && (et.getSubAccountNumber().equals(e.getSubAccountNumber())) && (et.getObjectCode().equals(e.getFinancialObjectCode())) && (et.getSubObjectCode().equals(e.getFinancialSubObjectCode()))) {
        List<Message> warnings = new ArrayList<Message>();
        warnings.add(new Message("Infinite recursive encumbrance error " + et.getChartOfAccountsCode() + " " + et.getAccountNumber() + " " + et.getSubAccountNumber() + " " + et.getObjectCode() + " " + et.getSubObjectCode(), Message.TYPE_WARNING));
        reportWriterService.writeError(et, warnings);
        return;
    }
    e.setFinancialDocumentTypeCode(parameterService.getParameterValueAsString(PosterIndirectCostRecoveryEntriesStep.class, GL_INDIRECT_COST_RECOVERY));
    e.setFinancialSystemOriginationCode(parameterService.getParameterValueAsString(KfsParameterConstants.GENERAL_LEDGER_BATCH.class, GLParameterConstants.GL_ORIGINATION_CODE));
    SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_STRING, Locale.US);
    /*CUMod - start*/
    StringBuffer docNbr = new StringBuffer(ICR_EDOC_PREFIX);
    docNbr.append(sdf.format(runDate));
    e.setDocumentNumber(docNbr.toString());
    LOG.debug("CuPosterServiceImpl.generateTransactions: setDocumentNumber = '" + docNbr.toString() + "'");
    /*CUMod - stop*/
    if (KFSConstants.GL_DEBIT_CODE.equals(icrRateDetail.getTransactionDebitIndicator())) {
        e.setTransactionLedgerEntryDescription(getChargeDescription(pct, et.getObjectCode(), icrGenerationMetadata.getIndirectCostRecoveryTypeCode(), et.getAccountObjectDirectCostAmount().abs()));
    } else {
        e.setTransactionLedgerEntryDescription(getOffsetDescription(pct, et.getAccountObjectDirectCostAmount().abs(), et.getChartOfAccountsCode(), et.getAccountNumber()));
    }
    e.setTransactionDate(new java.sql.Date(runDate.getTime()));
    e.setTransactionDebitCreditCode(icrRateDetail.getTransactionDebitIndicator());
    e.setFinancialBalanceTypeCode(et.getBalanceTypeCode());
    e.setUniversityFiscalYear(et.getUniversityFiscalYear());
    e.setUniversityFiscalPeriodCode(et.getUniversityFiscalAccountingPeriod());
    ObjectCode oc = objectCodeService.getByPrimaryId(e.getUniversityFiscalYear(), e.getChartOfAccountsCode(), e.getFinancialObjectCode());
    if (oc == null) {
        LOG.warn(configurationService.getPropertyValueAsString(KFSKeyConstants.ERROR_OBJECT_CODE_NOT_FOUND_FOR) + e.getUniversityFiscalYear() + "," + e.getChartOfAccountsCode() + "," + e.getFinancialObjectCode());
        // this will be written out the ICR file. Then, when that file attempts to post, the transaction won't validate and will end up in the icr error file
        e.setFinancialObjectCode(icrRateDetail.getFinancialObjectCode());
    } else {
        e.setFinancialObjectTypeCode(oc.getFinancialObjectTypeCode());
    }
    if (generatedTransactionAmount.isNegative()) {
        if (KFSConstants.GL_DEBIT_CODE.equals(icrRateDetail.getTransactionDebitIndicator())) {
            e.setTransactionDebitCreditCode(KFSConstants.GL_CREDIT_CODE);
        } else {
            e.setTransactionDebitCreditCode(KFSConstants.GL_DEBIT_CODE);
        }
        e.setTransactionLedgerEntryAmount(generatedTransactionAmount.negated());
    } else {
        e.setTransactionLedgerEntryAmount(generatedTransactionAmount);
    }
    if (et.getBalanceTypeCode().equals(et.getOption().getExtrnlEncumFinBalanceTypCd()) || et.getBalanceTypeCode().equals(et.getOption().getIntrnlEncumFinBalanceTypCd()) || et.getBalanceTypeCode().equals(et.getOption().getPreencumbranceFinBalTypeCd()) || et.getBalanceTypeCode().equals(et.getOption().getCostShareEncumbranceBalanceTypeCd())) {
        e.setDocumentNumber(parameterService.getParameterValueAsString(PosterIndirectCostRecoveryEntriesStep.class, GL_INDIRECT_COST_RECOVERY));
    }
    e.setProjectCode(et.getProjectCode());
    if (GeneralLedgerConstants.getDashOrganizationReferenceId().equals(et.getOrganizationReferenceId())) {
        e.setOrganizationReferenceId(null);
    } else {
        e.setOrganizationReferenceId(et.getOrganizationReferenceId());
    }
    // TODO 2031-2039
    try {
        createOutputEntry(e, group);
    } catch (IOException ioe) {
        LOG.error("generateTransactions Stopped: " + ioe.getMessage());
        throw new RuntimeException("generateTransactions Stopped: " + ioe.getMessage(), ioe);
    }
    // Now generate Offset
    e = new OriginEntryFull(e);
    if (KFSConstants.GL_DEBIT_CODE.equals(e.getTransactionDebitCreditCode())) {
        e.setTransactionDebitCreditCode(KFSConstants.GL_CREDIT_CODE);
    } else {
        e.setTransactionDebitCreditCode(KFSConstants.GL_DEBIT_CODE);
    }
    e.setFinancialSubObjectCode(KFSConstants.getDashFinancialSubObjectCode());
    String offsetBalanceSheetObjectCodeNumber = determineIcrOffsetBalanceSheetObjectCodeNumber(e, et, icrRateDetail);
    e.setFinancialObjectCode(offsetBalanceSheetObjectCodeNumber);
    ObjectCode balSheetObjectCode = objectCodeService.getByPrimaryId(icrRateDetail.getUniversityFiscalYear(), e.getChartOfAccountsCode(), offsetBalanceSheetObjectCodeNumber);
    if (balSheetObjectCode == null) {
        List<Message> warnings = new ArrayList<Message>();
        warnings.add(new Message(configurationService.getPropertyValueAsString(KFSKeyConstants.ERROR_INVALID_OFFSET_OBJECT_CODE) + icrRateDetail.getUniversityFiscalYear() + "-" + e.getChartOfAccountsCode() + "-" + offsetBalanceSheetObjectCodeNumber, Message.TYPE_WARNING));
        reportWriterService.writeError(et, warnings);
    } else {
        e.setFinancialObjectTypeCode(balSheetObjectCode.getFinancialObjectTypeCode());
    }
    if (KFSConstants.GL_DEBIT_CODE.equals(icrRateDetail.getTransactionDebitIndicator())) {
        e.setTransactionLedgerEntryDescription(getChargeDescription(pct, et.getObjectCode(), icrGenerationMetadata.getIndirectCostRecoveryTypeCode(), et.getAccountObjectDirectCostAmount().abs()));
    } else {
        e.setTransactionLedgerEntryDescription(getOffsetDescription(pct, et.getAccountObjectDirectCostAmount().abs(), et.getChartOfAccountsCode(), et.getAccountNumber()));
    }
    try {
        flexibleOffsetAccountService.updateOffset(e);
    } catch (InvalidFlexibleOffsetException ex) {
        List<Message> warnings = new ArrayList<Message>();
        warnings.add(new Message("FAILED TO GENERATE FLEXIBLE OFFSETS " + ex.getMessage(), Message.TYPE_WARNING));
        reportWriterService.writeError(et, warnings);
        LOG.warn("FAILED TO GENERATE FLEXIBLE OFFSETS FOR EXPENDITURE TRANSACTION " + et.toString(), ex);
    }
    try {
        createOutputEntry(e, group);
    } catch (IOException ioe) {
        LOG.error("generateTransactions Stopped: " + ioe.getMessage());
        throw new RuntimeException("generateTransactions Stopped: " + ioe.getMessage(), ioe);
    }
}
Also used : PosterIndirectCostRecoveryEntriesStep(org.kuali.kfs.gl.batch.PosterIndirectCostRecoveryEntriesStep) Message(org.kuali.kfs.sys.Message) ArrayList(java.util.ArrayList) IOException(java.io.IOException) ObjectCode(org.kuali.kfs.coa.businessobject.ObjectCode) InvalidFlexibleOffsetException(org.kuali.kfs.sys.exception.InvalidFlexibleOffsetException) BigDecimal(java.math.BigDecimal) Date(java.sql.Date) ArrayList(java.util.ArrayList) List(java.util.List) SimpleDateFormat(java.text.SimpleDateFormat) OriginEntryFull(org.kuali.kfs.gl.businessobject.OriginEntryFull)

Example 22 with ObjectCode

use of org.kuali.kfs.coa.businessobject.ObjectCode in project cu-kfs by CU-CommunityApps.

the class ReversionProcessBase method generateCarryForwards.

public void generateCarryForwards(List<OriginEntryFull> originEntriesToWrite) throws FatalErrorException {
    int originEntriesWritten = 0;
    OriginEntryFull entry = getEntry();
    entry.setUniversityFiscalYear((Integer) jobParameters.get(KFSConstants.UNIV_FISCAL_YR) + 1);
    entry.setChartOfAccountsCode(unitOfWork.chartOfAccountsCode);
    entry.setAccountNumber(unitOfWork.accountNumber);
    entry.setSubAccountNumber(unitOfWork.subAccountNumber);
    entry.setFinancialObjectCode((String) jobParameters.get(KFSConstants.BEG_BUD_CASH_OBJECT_CD));
    entry.setFinancialSubObjectCode(KFSConstants.getDashFinancialSubObjectCode());
    entry.setFinancialBalanceTypeCode(KFSConstants.BALANCE_TYPE_CURRENT_BUDGET);
    getPersistenceService().retrieveReferenceObject(entry, KFSPropertyConstants.FINANCIAL_OBJECT);
    if (ObjectUtils.isNull(entry.getFinancialObject())) {
        throw new FatalErrorException("Object Code for Entry not found: " + entry);
    }
    ObjectCode objectCode = entry.getFinancialObject();
    entry.setFinancialObjectTypeCode(objectCode.getFinancialObjectTypeCode());
    entry.setUniversityFiscalPeriodCode(KFSConstants.MONTH1);
    entry.setFinancialDocumentTypeCode(DEFAULT_FINANCIAL_DOCUMENT_TYPE_CODE);
    entry.setFinancialSystemOriginationCode(DEFAULT_FINANCIAL_SYSTEM_ORIGINATION_CODE);
    entry.setDocumentNumber(DEFAULT_DOCUMENT_NUMBER_PREFIX + unitOfWork.accountNumber);
    entry.setTransactionLedgerEntrySequenceNumber(1);
    entry.setTransactionLedgerEntryDescription(FUND_CARRIED_MESSAGE + (Integer) jobParameters.get(KFSConstants.UNIV_FISCAL_YR));
    entry.setTransactionLedgerEntryAmount(unitOfWork.getTotalCarryForward());
    entry.setTransactionDate((Date) jobParameters.get(KFSConstants.TRANSACTION_DT));
    entry.setProjectCode(KFSConstants.getDashProjectCode());
    // 2995 MOVE TRN-LDGR-ENTR-AMT TO WS-AMT-W-PERIOD
    // 2996 WS-AMT-N.
    // 2997 MOVE WS-AMT-X TO TRN-AMT-RED-X.
    originEntriesToWrite.add(entry);
    entry = getEntry();
    entry.setUniversityFiscalYear((Integer) jobParameters.get(KFSConstants.UNIV_FISCAL_YR) + 1);
    entry.setChartOfAccountsCode(unitOfWork.chartOfAccountsCode);
    entry.setAccountNumber(unitOfWork.accountNumber);
    entry.setSubAccountNumber(unitOfWork.subAccountNumber);
    entry.setFinancialObjectCode((String) jobParameters.get(KFSConstants.UNALLOC_OBJECT_CD));
    getPersistenceService().retrieveReferenceObject(entry, KFSPropertyConstants.FINANCIAL_OBJECT);
    if (ObjectUtils.isNull(entry.getFinancialObject())) {
        throw new FatalErrorException("Object Code for Entry not found: " + entry);
    }
    objectCode = entry.getFinancialObject();
    entry.setFinancialObjectTypeCode(objectCode.getFinancialObjectTypeCode());
    entry.setFinancialSubObjectCode(KFSConstants.getDashFinancialSubObjectCode());
    entry.setFinancialBalanceTypeCode(KFSConstants.BALANCE_TYPE_CURRENT_BUDGET);
    entry.setUniversityFiscalPeriodCode(KFSConstants.MONTH1);
    entry.setDocumentNumber(DEFAULT_DOCUMENT_NUMBER_PREFIX + unitOfWork.accountNumber);
    entry.setTransactionLedgerEntryDescription(FUND_CARRIED_MESSAGE + (Integer) jobParameters.get(KFSConstants.UNIV_FISCAL_YR));
    entry.setTransactionLedgerEntryAmount(unitOfWork.getTotalCarryForward());
    // 3079 MOVE TRN-LDGR-ENTR-AMT TO WS-AMT-W-PERIOD
    // 3080 WS-AMT-N.
    // 3081 MOVE WS-AMT-X TO TRN-AMT-RED-X.
    originEntriesToWrite.add(entry);
}
Also used : FatalErrorException(org.kuali.kfs.gl.batch.service.impl.exception.FatalErrorException) ObjectCode(org.kuali.kfs.coa.businessobject.ObjectCode) OriginEntryFull(org.kuali.kfs.gl.businessobject.OriginEntryFull)

Example 23 with ObjectCode

use of org.kuali.kfs.coa.businessobject.ObjectCode in project cu-kfs by CU-CommunityApps.

the class ReversionProcessBase method generateMany.

public void generateMany(List<OriginEntryFull> originEntriesToWrite) throws FatalErrorException {
    int originEntriesCreated = 0;
    for (Iterator<ReversionCategory> iter = categoryList.iterator(); iter.hasNext(); ) {
        ReversionCategory cat = iter.next();
        ReversionCategoryInfo detail = cfReversionProcessInfo.getReversionDetail(cat.getReversionCategoryCode());
        ReversionUnitOfWorkCategoryAmount amount = unitOfWork.amounts.get(cat.getReversionCategoryCode());
        if (!amount.getCarryForward().isZero()) {
            KualiDecimal commonAmount = amount.getCarryForward();
            String commonObject = detail.getReversionObjectCode();
            OriginEntryFull entry = getEntry();
            entry.setUniversityFiscalYear((Integer) jobParameters.get(KFSConstants.UNIV_FISCAL_YR) + 1);
            entry.setChartOfAccountsCode(unitOfWork.chartOfAccountsCode);
            entry.setAccountNumber(unitOfWork.accountNumber);
            entry.setSubAccountNumber(unitOfWork.subAccountNumber);
            entry.setFinancialObjectCode((String) jobParameters.get(KFSConstants.BEG_BUD_CASH_OBJECT_CD));
            entry.setFinancialSubObjectCode(KFSConstants.getDashFinancialSubObjectCode());
            entry.setFinancialBalanceTypeCode(KFSConstants.BALANCE_TYPE_CURRENT_BUDGET);
            getPersistenceService().retrieveReferenceObject(entry, KFSPropertyConstants.FINANCIAL_OBJECT);
            if (ObjectUtils.isNull(entry.getFinancialObject())) {
                throw new FatalErrorException("Object Code for Entry not found: " + entry);
            }
            ObjectCode objectCode = entry.getFinancialObject();
            entry.setFinancialObjectTypeCode(objectCode.getFinancialObjectTypeCode());
            entry.setUniversityFiscalPeriodCode(KFSConstants.MONTH1);
            entry.setDocumentNumber(DEFAULT_DOCUMENT_NUMBER_PREFIX + unitOfWork.accountNumber);
            entry.setTransactionLedgerEntryDescription(FUND_CARRIED_MESSAGE + (Integer) jobParameters.get(KFSConstants.UNIV_FISCAL_YR));
            entry.setTransactionLedgerEntryAmount(commonAmount);
            // 3259 MOVE TRN-LDGR-ENTR-AMT TO WS-AMT-W-PERIOD
            // 3260 WS-AMT-N.
            // 3261 MOVE WS-AMT-X TO TRN-AMT-RED-X.
            originEntriesToWrite.add(entry);
            entry = getEntry();
            entry.setUniversityFiscalYear((Integer) jobParameters.get(KFSConstants.UNIV_FISCAL_YR) + 1);
            entry.setChartOfAccountsCode(unitOfWork.chartOfAccountsCode);
            entry.setAccountNumber(unitOfWork.accountNumber);
            entry.setSubAccountNumber(unitOfWork.subAccountNumber);
            entry.setFinancialObjectCode(commonObject);
            entry.setFinancialSubObjectCode(KFSConstants.getDashFinancialSubObjectCode());
            entry.setFinancialBalanceTypeCode(KFSConstants.BALANCE_TYPE_CURRENT_BUDGET);
            getPersistenceService().retrieveReferenceObject(entry, KFSPropertyConstants.FINANCIAL_OBJECT);
            if (ObjectUtils.isNull(entry.getFinancialObject())) {
                throw new FatalErrorException("Object Code for Entry not found: " + entry);
            }
            objectCode = entry.getFinancialObject();
            entry.setFinancialObjectTypeCode(objectCode.getFinancialObjectTypeCode());
            entry.setUniversityFiscalPeriodCode(KFSConstants.MONTH1);
            entry.setDocumentNumber(DEFAULT_DOCUMENT_NUMBER_PREFIX + unitOfWork.accountNumber);
            entry.setTransactionLedgerEntryDescription(FUND_CARRIED_MESSAGE + (Integer) jobParameters.get(KFSConstants.UNIV_FISCAL_YR));
            entry.setTransactionLedgerEntryAmount(commonAmount);
            // 3343 MOVE TRN-LDGR-ENTR-AMT TO WS-AMT-W-PERIOD
            // 3344 WS-AMT-N.
            // 3345 MOVE WS-AMT-X TO TRN-AMT-RED-X.
            originEntriesToWrite.add(entry);
        }
    }
}
Also used : ReversionUnitOfWorkCategoryAmount(edu.cornell.kfs.gl.businessobject.ReversionUnitOfWorkCategoryAmount) KualiDecimal(org.kuali.kfs.core.api.util.type.KualiDecimal) ReversionCategory(edu.cornell.kfs.coa.businessobject.ReversionCategory) FatalErrorException(org.kuali.kfs.gl.batch.service.impl.exception.FatalErrorException) ObjectCode(org.kuali.kfs.coa.businessobject.ObjectCode) ReversionCategoryInfo(edu.cornell.kfs.coa.businessobject.ReversionCategoryInfo) OriginEntryFull(org.kuali.kfs.gl.businessobject.OriginEntryFull)

Example 24 with ObjectCode

use of org.kuali.kfs.coa.businessobject.ObjectCode in project cu-kfs by CU-CommunityApps.

the class ReversionProcessBase method generateReversions.

public void generateReversions(List<OriginEntryFull> originEntriesToWrite) throws FatalErrorException {
    int originEntriesWritten = 0;
    OriginEntryFull entry = getEntry();
    entry.setChartOfAccountsCode(unitOfWork.chartOfAccountsCode);
    entry.setAccountNumber(unitOfWork.accountNumber);
    entry.setSubAccountNumber(unitOfWork.subAccountNumber);
    entry.setFinancialObjectCode((String) jobParameters.get(KFSConstants.UNALLOC_OBJECT_CD));
    entry.setFinancialSubObjectCode(KFSConstants.getDashFinancialSubObjectCode());
    entry.setFinancialBalanceTypeCode(DEFAULT_FINANCIAL_BALANCE_TYPE_CODE_YEAR_END);
    getPersistenceService().retrieveReferenceObject(entry, KFSPropertyConstants.FINANCIAL_OBJECT);
    if (ObjectUtils.isNull(entry.getFinancialObject())) {
        throw new FatalErrorException("Object Code for Entry not found: " + entry);
    }
    ObjectCode objectCode = entry.getFinancialObject();
    entry.setFinancialObjectTypeCode(objectCode.getFinancialObjectTypeCode());
    entry.setUniversityFiscalPeriodCode(KFSConstants.MONTH13);
    entry.setDocumentNumber(DEFAULT_DOCUMENT_NUMBER_PREFIX + entry.getAccountNumber());
    entry.setTransactionLedgerEntryDescription(FUND_REVERTED_TO_MESSAGE + cfReversionProcessInfo.getBudgetReversionAccountNumber());
    entry.setTransactionLedgerEntryAmount(unitOfWork.getTotalReversion().negated());
    originEntriesToWrite.add(entry);
    entry = getEntry();
    entry.setChartOfAccountsCode(cfReversionProcessInfo.getBudgetReversionChartOfAccountsCode());
    entry.setAccountNumber(cfReversionProcessInfo.getBudgetReversionAccountNumber());
    entry.setSubAccountNumber(KFSConstants.getDashSubAccountNumber());
    entry.setFinancialObjectCode((String) jobParameters.get(KFSConstants.UNALLOC_OBJECT_CD));
    entry.setFinancialSubObjectCode(KFSConstants.getDashFinancialSubObjectCode());
    entry.setFinancialBalanceTypeCode(DEFAULT_FINANCIAL_BALANCE_TYPE_CODE_YEAR_END);
    entry.setFinancialObjectTypeCode(objectCode.getFinancialObjectTypeCode());
    entry.setUniversityFiscalPeriodCode(KFSConstants.MONTH13);
    entry.setDocumentNumber(DEFAULT_DOCUMENT_NUMBER_PREFIX + unitOfWork.accountNumber);
    if (unitOfWork.accountNumber.equals(KFSConstants.getDashSubAccountNumber())) {
        entry.setTransactionLedgerEntryDescription(FUND_REVERTED_FROM_MESSAGE + unitOfWork.accountNumber);
    } else {
        entry.setTransactionLedgerEntryDescription(FUND_REVERTED_FROM_MESSAGE + unitOfWork.accountNumber + " " + unitOfWork.subAccountNumber);
    }
    entry.setTransactionLedgerEntryAmount(unitOfWork.getTotalReversion());
    // 2899 MOVE TRN-LDGR-ENTR-AMT TO WS-AMT-W-PERIOD
    // 2900 WS-AMT-N.
    // 2901 MOVE WS-AMT-X TO TRN-AMT-RED-X.
    originEntriesToWrite.add(entry);
}
Also used : FatalErrorException(org.kuali.kfs.gl.batch.service.impl.exception.FatalErrorException) ObjectCode(org.kuali.kfs.coa.businessobject.ObjectCode) OriginEntryFull(org.kuali.kfs.gl.businessobject.OriginEntryFull)

Example 25 with ObjectCode

use of org.kuali.kfs.coa.businessobject.ObjectCode in project cu-kfs by CU-CommunityApps.

the class ObjectCodeServiceImpl method getByPrimaryIdForLatestValidYear.

@Override
public ObjectCode getByPrimaryIdForLatestValidYear(String chartOfAccountsCode, String financialObjectCode) {
    ObjectCode objectCode = getByPrimaryIdForCurrentYear(chartOfAccountsCode, financialObjectCode);
    if (ObjectUtils.isNull(objectCode)) {
        List<Integer> years = getYearList(chartOfAccountsCode, financialObjectCode);
        // sort the years in descending order so we start with the most recent years
        Collections.sort(years, Collections.reverseOrder());
        objectCode = years.stream().map(year -> getByPrimaryId(year, chartOfAccountsCode, financialObjectCode)).filter(ObjectUtils::isNotNull).findFirst().get();
    }
    return objectCode;
}
Also used : ObjectCode(org.kuali.kfs.coa.businessobject.ObjectCode)

Aggregations

ObjectCode (org.kuali.kfs.coa.businessobject.ObjectCode)30 SubObjectCode (org.kuali.kfs.coa.businessobject.SubObjectCode)9 KualiDecimal (org.kuali.kfs.core.api.util.type.KualiDecimal)5 ArrayList (java.util.ArrayList)4 OriginEntryFull (org.kuali.kfs.gl.businessobject.OriginEntryFull)4 HashMap (java.util.HashMap)3 ObjectCodeService (org.kuali.kfs.coa.service.ObjectCodeService)3 FatalErrorException (org.kuali.kfs.gl.batch.service.impl.exception.FatalErrorException)3 AssetObjectCode (org.kuali.kfs.module.cam.businessobject.AssetObjectCode)3 GeneralLedgerPendingEntry (org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry)3 PaymentMethodChart (edu.cornell.kfs.fp.businessobject.PaymentMethodChart)2 Date (java.sql.Date)2 Timestamp (java.sql.Timestamp)2 Account (org.kuali.kfs.coa.businessobject.Account)2 ObjectType (org.kuali.kfs.coa.businessobject.ObjectType)2 OffsetDefinition (org.kuali.kfs.coa.businessobject.OffsetDefinition)2 SubAccount (org.kuali.kfs.coa.businessobject.SubAccount)2 SubObjectCodeService (org.kuali.kfs.coa.service.SubObjectCodeService)2 BusinessObjectService (org.kuali.kfs.krad.service.BusinessObjectService)2 AccountingLineOverride (org.kuali.kfs.sys.businessobject.AccountingLineOverride)2