Search in sources :

Example 11 with ReversionCategory

use of edu.cornell.kfs.coa.businessobject.ReversionCategory in project cu-kfs by CU-CommunityApps.

the class AccountReversionServiceImpl method isCategoryActiveByName.

/**
 * @see org.kuali.kfs.coa.service.OrganizationReversionService#isCategoryActiveByName(java.lang.String)
 */
public boolean isCategoryActiveByName(String categoryName) {
    Map<String, Object> fieldMap = new HashMap<String, Object>();
    fieldMap.put("reversionCategoryName", categoryName);
    final Collection categories = businessObjectService.findMatching(ReversionCategory.class, fieldMap);
    final Iterator categoriesIterator = categories.iterator();
    ReversionCategory category = null;
    while (categoriesIterator.hasNext()) {
        category = (ReversionCategory) categoriesIterator.next();
    }
    if (category == null)
        return false;
    return category.isActive();
}
Also used : HashMap(java.util.HashMap) Iterator(java.util.Iterator) Collection(java.util.Collection) ReversionCategory(edu.cornell.kfs.coa.businessobject.ReversionCategory) GenericReversionCategory(edu.cornell.kfs.gl.batch.service.impl.GenericReversionCategory)

Example 12 with ReversionCategory

use of edu.cornell.kfs.coa.businessobject.ReversionCategory in project cu-kfs by CU-CommunityApps.

the class ReversionCategoryValuesFinder method getKeyValues.

/**
 * Creates a list of {@link MandatoryTransferEliminationCode}s using their code as their key, and their name as the display
 * value
 *
 * @see org.kuali.kfs.kns.lookup.keyvalues.KeyValuesFinder#getKeyValues()
 */
public List getKeyValues() {
    Collection<ReversionCategory> codes = SpringContext.getBean(KeyValuesService.class).findAll(ReversionCategory.class);
    List<KeyValue> labels = new ArrayList<KeyValue>();
    labels.add(new ConcreteKeyValue("", ""));
    for (ReversionCategory reversionCategory : codes) {
        if (reversionCategory.isActive()) {
            labels.add(new ConcreteKeyValue(reversionCategory.getReversionCategoryCode(), reversionCategory.getReversionCategoryName()));
        }
    }
    return labels;
}
Also used : KeyValuesService(org.kuali.kfs.krad.service.KeyValuesService) ConcreteKeyValue(org.kuali.rice.core.api.util.ConcreteKeyValue) KeyValue(org.kuali.rice.core.api.util.KeyValue) ConcreteKeyValue(org.kuali.rice.core.api.util.ConcreteKeyValue) ArrayList(java.util.ArrayList) ReversionCategory(edu.cornell.kfs.coa.businessobject.ReversionCategory)

Example 13 with ReversionCategory

use of edu.cornell.kfs.coa.businessobject.ReversionCategory in project cu-kfs by CU-CommunityApps.

the class AccountReversionServiceImplTest method testGetCategories.

public void testGetCategories() {
    ReversionCategory goodReversionCategory = ReversionCategoryFixture.A1_CATEGORY.createReversionCategory();
    Map<String, ReversionCategoryLogic> results = accountReversionService.getCategories();
    assertTrue("categories should not be empty", results.size() > 0);
    assertTrue(results.containsKey(goodReversionCategory.getReversionCategoryCode()));
    assertEquals(goodReversionCategory.getReversionCategoryName(), results.get(goodReversionCategory.getReversionCategoryCode()).getName());
}
Also used : ReversionCategoryLogic(edu.cornell.kfs.gl.batch.service.ReversionCategoryLogic) ReversionCategory(edu.cornell.kfs.coa.businessobject.ReversionCategory)

Example 14 with ReversionCategory

use of edu.cornell.kfs.coa.businessobject.ReversionCategory 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 15 with ReversionCategory

use of edu.cornell.kfs.coa.businessobject.ReversionCategory in project cu-kfs by CU-CommunityApps.

the class ReversionProcessBase method clearCalculationTotals.

protected void clearCalculationTotals() {
    // Initialize all the amounts before applying the proper rule
    KualiDecimal totalAvailable = KualiDecimal.ZERO;
    for (ReversionCategory category : categoryList) {
        ReversionCategoryLogic logic = categories.get(category.getReversionCategoryCode());
        ReversionUnitOfWorkCategoryAmount amount = unitOfWork.amounts.get(category.getReversionCategoryCode());
        if (logic.isExpense()) {
            amount.setAvailable(amount.getBudget().subtract(amount.getActual()));
        } else {
            amount.setAvailable(amount.getActual().subtract(amount.getBudget()));
        }
        totalAvailable = totalAvailable.add(amount.getAvailable());
        amount.setCarryForward(KualiDecimal.ZERO);
    }
    unitOfWork.setTotalAvailable(totalAvailable);
    unitOfWork.setTotalReversion(totalAvailable);
    unitOfWork.setTotalCarryForward(KualiDecimal.ZERO);
}
Also used : ReversionUnitOfWorkCategoryAmount(edu.cornell.kfs.gl.businessobject.ReversionUnitOfWorkCategoryAmount) ReversionCategoryLogic(edu.cornell.kfs.gl.batch.service.ReversionCategoryLogic) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) ReversionCategory(edu.cornell.kfs.coa.businessobject.ReversionCategory)

Aggregations

ReversionCategory (edu.cornell.kfs.coa.businessobject.ReversionCategory)15 ReversionCategoryLogic (edu.cornell.kfs.gl.batch.service.ReversionCategoryLogic)4 HashMap (java.util.HashMap)4 AccountReversionService (edu.cornell.kfs.coa.service.AccountReversionService)3 GenericReversionCategory (edu.cornell.kfs.gl.batch.service.impl.GenericReversionCategory)3 ReversionUnitOfWorkCategoryAmount (edu.cornell.kfs.gl.businessobject.ReversionUnitOfWorkCategoryAmount)3 AccountReversion (edu.cornell.kfs.coa.businessobject.AccountReversion)2 AccountReversionDetail (edu.cornell.kfs.coa.businessobject.AccountReversionDetail)2 AccountReversionGlobal (edu.cornell.kfs.coa.businessobject.AccountReversionGlobal)2 AccountReversionGlobalDetail (edu.cornell.kfs.coa.businessobject.AccountReversionGlobalDetail)2 ReversionCategoryInfo (edu.cornell.kfs.coa.businessobject.ReversionCategoryInfo)2 Collection (java.util.Collection)2 Iterator (java.util.Iterator)2 FatalErrorException (org.kuali.kfs.gl.batch.service.impl.exception.FatalErrorException)2 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)2 ArrayList (java.util.ArrayList)1 ObjectCode (org.kuali.kfs.coa.businessobject.ObjectCode)1 OriginEntryFull (org.kuali.kfs.gl.businessobject.OriginEntryFull)1 KeyValuesService (org.kuali.kfs.krad.service.KeyValuesService)1 ConcreteKeyValue (org.kuali.rice.core.api.util.ConcreteKeyValue)1