Search in sources :

Example 6 with FatalErrorException

use of org.kuali.kfs.gl.batch.service.impl.exception.FatalErrorException 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

FatalErrorException (org.kuali.kfs.gl.batch.service.impl.exception.FatalErrorException)6 OriginEntryFull (org.kuali.kfs.gl.businessobject.OriginEntryFull)5 ObjectCode (org.kuali.kfs.coa.businessobject.ObjectCode)3 ReversionCategory (edu.cornell.kfs.coa.businessobject.ReversionCategory)2 ReversionCategoryInfo (edu.cornell.kfs.coa.businessobject.ReversionCategoryInfo)2 ReversionUnitOfWorkCategoryAmount (edu.cornell.kfs.gl.businessobject.ReversionUnitOfWorkCategoryAmount)2 ReversionCategoryLogic (edu.cornell.kfs.gl.batch.service.ReversionCategoryLogic)1 ReversionUnitOfWork (edu.cornell.kfs.gl.businessobject.ReversionUnitOfWork)1 List (java.util.List)1 KualiDecimal (org.kuali.kfs.core.api.util.type.KualiDecimal)1 Balance (org.kuali.kfs.gl.businessobject.Balance)1