Search in sources :

Example 16 with ObjectCode

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

the class AwsAccountingXmlDocumentAccountingLineServiceImplTest method buildMockObjectCodeService.

private ObjectCodeService buildMockObjectCodeService() {
    ObjectCodeService objectCodeService = mock(ObjectCodeService.class);
    ObjectCode mockedObjectCode = createMockObjectCode(ObjectCodeFixture.OC_IT_6600);
    when(objectCodeService.getByPrimaryIdForCurrentYear(CuFPTestConstants.TEST_AWS_BILLING_DEFAULT_CHART_CODE, CuFPTestConstants.TEST_AWS_DEFAULT_OBJ_CODE)).thenReturn(mockedObjectCode);
    mockedObjectCode = createMockObjectCode(ObjectCodeFixture.OC_IT_4020);
    when(objectCodeService.getByPrimaryIdForCurrentYear(CuFPTestConstants.TEST_AWS_BILLING_DEFAULT_CHART_CODE, CuFPTestConstants.TEST_OBJ_CODE_4020)).thenReturn(mockedObjectCode);
    mockedObjectCode = createMockObjectCode(ObjectCodeFixture.OC_IT_1000);
    when(objectCodeService.getByPrimaryIdForCurrentYear(CuFPTestConstants.TEST_AWS_BILLING_DEFAULT_CHART_CODE, CuFPTestConstants.TEST_OBJ_CODE_1000)).thenReturn(mockedObjectCode);
    mockedObjectCode = createMockObjectCode(ObjectCodeFixture.OC_CS_6600);
    when(objectCodeService.getByPrimaryIdForCurrentYear(CuFPTestConstants.TEST_AWS_BILLING_CHART_CODE_CS, CuFPTestConstants.TEST_AWS_DEFAULT_OBJ_CODE)).thenReturn(mockedObjectCode);
    return objectCodeService;
}
Also used : SubObjectCodeService(org.kuali.kfs.coa.service.SubObjectCodeService) ObjectCodeService(org.kuali.kfs.coa.service.ObjectCodeService) ObjectCode(org.kuali.kfs.coa.businessobject.ObjectCode) SubObjectCode(org.kuali.kfs.coa.businessobject.SubObjectCode)

Example 17 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, KFSConstants.SystemGroupParameterNames.GL_INDIRECT_COST_RECOVERY));
    e.setFinancialSystemOriginationCode(parameterService.getParameterValueAsString(KfsParameterConstants.GENERAL_LEDGER_BATCH.class, KFSConstants.SystemGroupParameterNames.GL_ORIGINATION_CODE));
    SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_STRING);
    /*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, KFSConstants.SystemGroupParameterNames.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 18 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 19 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.rice.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 20 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)

Aggregations

ObjectCode (org.kuali.kfs.coa.businessobject.ObjectCode)20 SubObjectCode (org.kuali.kfs.coa.businessobject.SubObjectCode)7 OriginEntryFull (org.kuali.kfs.gl.businessobject.OriginEntryFull)4 ObjectCodeService (org.kuali.kfs.coa.service.ObjectCodeService)3 FatalErrorException (org.kuali.kfs.gl.batch.service.impl.exception.FatalErrorException)3 GeneralLedgerPendingEntry (org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry)3 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)3 PaymentMethodChart (edu.cornell.kfs.fp.businessobject.PaymentMethodChart)2 HashMap (java.util.HashMap)2 ObjectType (org.kuali.kfs.coa.businessobject.ObjectType)2 SubObjectCodeService (org.kuali.kfs.coa.service.SubObjectCodeService)2 ContractGrantReportingCode (edu.cornell.kfs.coa.businessobject.ContractGrantReportingCode)1 ObjectCodeExtendedAttribute (edu.cornell.kfs.coa.businessobject.ObjectCodeExtendedAttribute)1 ReversionCategory (edu.cornell.kfs.coa.businessobject.ReversionCategory)1 ReversionCategoryInfo (edu.cornell.kfs.coa.businessobject.ReversionCategoryInfo)1 ReversionUnitOfWorkCategoryAmount (edu.cornell.kfs.gl.businessobject.ReversionUnitOfWorkCategoryAmount)1 IOException (java.io.IOException)1 BigDecimal (java.math.BigDecimal)1 Date (java.sql.Date)1 Timestamp (java.sql.Timestamp)1