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);
}
Aggregations