Search in sources :

Example 16 with IndirectCostRecoveryAccount

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

the class SubAccountGlobal method getGlobalObjectDetailsAndIcrAccountsMap.

@Override
public Map<GlobalBusinessObjectDetailBase, List<IndirectCostRecoveryAccount>> getGlobalObjectDetailsAndIcrAccountsMap() {
    Map<GlobalBusinessObjectDetailBase, List<IndirectCostRecoveryAccount>> globalObjectDetailsAndIcrAccountsMap = new HashMap<GlobalBusinessObjectDetailBase, List<IndirectCostRecoveryAccount>>();
    List<SubAccountGlobalDetail> subAccountGlobalDetails = getSubAccountGlobalDetails();
    if (ObjectUtils.isNotNull(subAccountGlobalDetails) && !subAccountGlobalDetails.isEmpty()) {
        for (GlobalBusinessObjectDetailBase globalDetail : subAccountGlobalDetails) {
            List<IndirectCostRecoveryAccount> existingIcrAccounts = new ArrayList<IndirectCostRecoveryAccount>();
            SubAccountGlobalDetail subAccountGlobalDetail = (SubAccountGlobalDetail) globalDetail;
            subAccountGlobalDetail.refreshReferenceObject(KFSPropertyConstants.SUB_ACCOUNT);
            List<A21IndirectCostRecoveryAccount> a21IcrAccounts = subAccountGlobalDetail.getSubAccount().getA21SubAccount().getA21IndirectCostRecoveryAccounts();
            for (A21IndirectCostRecoveryAccount a21ICRAccount : a21IcrAccounts) {
                IndirectCostRecoveryAccount icrAcct = new IndirectCostRecoveryAccount();
                icrAcct.setChartOfAccountsCode(a21ICRAccount.getChartOfAccountsCode());
                icrAcct.setAccountNumber(a21ICRAccount.getAccountNumber());
                icrAcct.setIndirectCostRecoveryAccountNumber(a21ICRAccount.getIndirectCostRecoveryAccountNumber());
                icrAcct.setIndirectCostRecoveryFinCoaCode(a21ICRAccount.getIndirectCostRecoveryFinCoaCode());
                icrAcct.setAccountLinePercent(a21ICRAccount.getAccountLinePercent());
                icrAcct.setActive(a21ICRAccount.isActive());
                existingIcrAccounts.add(icrAcct);
            }
            globalObjectDetailsAndIcrAccountsMap.put(globalDetail, existingIcrAccounts);
        }
    }
    return globalObjectDetailsAndIcrAccountsMap;
}
Also used : A21IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.A21IndirectCostRecoveryAccount) HashMap(java.util.HashMap) A21IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.A21IndirectCostRecoveryAccount) IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) GlobalBusinessObjectDetailBase(org.kuali.kfs.krad.bo.GlobalBusinessObjectDetailBase)

Example 17 with IndirectCostRecoveryAccount

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

the class CuAccountGlobal method createIndirectCostRecoveryAccountFromChange.

@Override
public IndirectCostRecoveryAccount createIndirectCostRecoveryAccountFromChange(GlobalBusinessObjectDetailBase globalDetail, IndirectCostRecoveryAccountChange newICR) {
    AccountGlobalDetail accountGlobalDetail = (AccountGlobalDetail) globalDetail;
    String chart = accountGlobalDetail.getChartOfAccountsCode();
    String account = accountGlobalDetail.getAccountNumber();
    IndirectCostRecoveryAccount icrAccount = new IndirectCostRecoveryAccount();
    icrAccount.setAccountNumber(account);
    icrAccount.setChartOfAccountsCode(chart);
    icrAccount.setIndirectCostRecoveryAccountNumber(newICR.getIndirectCostRecoveryAccountNumber());
    icrAccount.setIndirectCostRecoveryFinCoaCode(newICR.getIndirectCostRecoveryFinCoaCode());
    icrAccount.setActive(newICR.isActive());
    icrAccount.setAccountLinePercent(newICR.getAccountLinePercent());
    return icrAccount;
}
Also used : IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount) AccountGlobalDetail(org.kuali.kfs.coa.businessobject.AccountGlobalDetail)

Example 18 with IndirectCostRecoveryAccount

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

the class CuAccountGlobal method getGlobalObjectDetailsAndIcrAccountsMap.

@Override
public Map<GlobalBusinessObjectDetailBase, List<IndirectCostRecoveryAccount>> getGlobalObjectDetailsAndIcrAccountsMap() {
    Map<GlobalBusinessObjectDetailBase, List<IndirectCostRecoveryAccount>> globalObjectDetailsAndIcrAccountsMap = new HashMap<GlobalBusinessObjectDetailBase, List<IndirectCostRecoveryAccount>>();
    List<AccountGlobalDetail> accountGlobalDetails = getAccountGlobalDetails();
    if (ObjectUtils.isNotNull(accountGlobalDetails) && !accountGlobalDetails.isEmpty()) {
        for (GlobalBusinessObjectDetailBase globalDetail : accountGlobalDetails) {
            AccountGlobalDetail accountGlobalDetail = (AccountGlobalDetail) globalDetail;
            accountGlobalDetail.refreshReferenceObject(KFSPropertyConstants.ACCOUNT);
            List<IndirectCostRecoveryAccount> icrAccounts = accountGlobalDetail.getAccount().getIndirectCostRecoveryAccounts();
            globalObjectDetailsAndIcrAccountsMap.put(globalDetail, icrAccounts);
        }
    }
    return globalObjectDetailsAndIcrAccountsMap;
}
Also used : HashMap(java.util.HashMap) IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount) ArrayList(java.util.ArrayList) List(java.util.List) GlobalBusinessObjectDetailBase(org.kuali.kfs.krad.bo.GlobalBusinessObjectDetailBase) AccountGlobalDetail(org.kuali.kfs.coa.businessobject.AccountGlobalDetail)

Example 19 with IndirectCostRecoveryAccount

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

the class GlobalIndirectCostRecoveryAccountsRuleTest method testSubAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate_Fail.

@Test
public void testSubAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate_Fail() {
    LOG.debug("enter testSubAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate_Fail");
    SubAccountGlobal subAccountGlobal = (SubAccountGlobal) SubAccountGlobalFixture.SUB_ACCT_GLOBAL_1111111_2222222_98_2.getSubAccountGlobal();
    SubAccountGlobalDetail subAccountGlobalDetail = SubAccountGlobalDetailFixture.SUB_ACCOUNT_GLOBAL_DETAIL_3333333_100_INACTIVATE.getSubAccountGlobalDetail();
    List<IndirectCostRecoveryAccount> existingIcrAccountsOnDetail = new ArrayList<IndirectCostRecoveryAccount>();
    existingIcrAccountsOnDetail.addAll(subAccountGlobalDetail.getSubAccount().getA21SubAccount().getA21IndirectCostRecoveryAccounts());
    LOG.debug("updates");
    List<IndirectCostRecoveryAccountChange> updates = subAccountGlobal.getIndirectCostRecoveryAccounts();
    logDetailsForIcrAccountChanges(updates);
    LOG.debug("existing");
    logDetailsForIcrAccounts(existingIcrAccountsOnDetail);
    boolean result = globalIndirectCostRecoveryAccountsRule.checkICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate(updates, existingIcrAccountsOnDetail, subAccountGlobalDetail, subAccountGlobal);
    assertFalse("Updated Sub Account Global ICR account distribution should NOT have been 100%", result);
}
Also used : SubAccountGlobal(edu.cornell.kfs.coa.businessobject.SubAccountGlobal) SubAccountGlobalDetail(edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail) IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount) IndirectCostRecoveryAccountChange(edu.cornell.kfs.coa.businessobject.IndirectCostRecoveryAccountChange) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 20 with IndirectCostRecoveryAccount

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

the class GlobalIndirectCostRecoveryAccountsRuleTest method testAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate_Pass.

@Test
public void testAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate_Pass() {
    LOG.debug("enter testAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate_Pass");
    CuAccountGlobal accountGlobal = (CuAccountGlobal) AccountGlobalFixture.ACCT_GLOBAL_3333333_100_ACTIVE_1111111_2222222_98_2_INACTIVE.getAccountGlobal();
    AccountGlobalDetail accountGlobalDetail = AccountGlobalDetailFixture.ACCOUNT_GLOBAL_DETAIL_1111111_2222222_98_2.getAccountGlobalDetail();
    LOG.debug("updates");
    List<IndirectCostRecoveryAccountChange> updates = accountGlobal.getIndirectCostRecoveryAccounts();
    logDetailsForIcrAccountChanges(updates);
    LOG.debug("existing");
    List<IndirectCostRecoveryAccount> existing = accountGlobalDetail.getAccount().getIndirectCostRecoveryAccounts();
    logDetailsForIcrAccounts(existing);
    boolean result = globalIndirectCostRecoveryAccountsRule.checkICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate(updates, existing, accountGlobalDetail, accountGlobal);
    assertTrue("Updated Account Global ICR account distribution should have been 100%", result);
}
Also used : IndirectCostRecoveryAccountChange(edu.cornell.kfs.coa.businessobject.IndirectCostRecoveryAccountChange) IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount) SubAccountGlobalDetail(edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail) AccountGlobalDetail(org.kuali.kfs.coa.businessobject.AccountGlobalDetail) CuAccountGlobal(edu.cornell.kfs.coa.businessobject.CuAccountGlobal) Test(org.junit.Test)

Aggregations

IndirectCostRecoveryAccount (org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount)20 ArrayList (java.util.ArrayList)11 IndirectCostRecoveryAccountChange (edu.cornell.kfs.coa.businessobject.IndirectCostRecoveryAccountChange)8 AccountGlobalDetail (org.kuali.kfs.coa.businessobject.AccountGlobalDetail)7 SubAccountGlobalDetail (edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail)6 Test (org.junit.Test)6 A21IndirectCostRecoveryAccount (org.kuali.kfs.coa.businessobject.A21IndirectCostRecoveryAccount)5 CuAccountGlobal (edu.cornell.kfs.coa.businessobject.CuAccountGlobal)3 SubAccountGlobal (edu.cornell.kfs.coa.businessobject.SubAccountGlobal)3 HashMap (java.util.HashMap)3 List (java.util.List)3 Account (org.kuali.kfs.coa.businessobject.Account)3 A21SubAccount (org.kuali.kfs.coa.businessobject.A21SubAccount)2 SubAccount (org.kuali.kfs.coa.businessobject.SubAccount)2 GlobalBusinessObjectDetailBase (org.kuali.kfs.krad.bo.GlobalBusinessObjectDetailBase)2 AppropriationAccount (edu.cornell.kfs.coa.businessobject.AppropriationAccount)1 GlobalObjectWithIndirectCostRecoveryAccountsService (edu.cornell.kfs.coa.service.GlobalObjectWithIndirectCostRecoveryAccountsService)1 BigDecimal (java.math.BigDecimal)1 MaintenanceDocumentRestrictions (org.kuali.kfs.kns.document.authorization.MaintenanceDocumentRestrictions)1 BusinessObjectAuthorizationService (org.kuali.kfs.kns.service.BusinessObjectAuthorizationService)1