Search in sources :

Example 36 with Account

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

the class AwsAccountingXmlDocumentAccountingLineServiceImplTest method createMockAccount.

private static Account createMockAccount(AwsAccountFixture accountFixture) {
    Account account = mock(Account.class);
    when(account.isClosed()).thenReturn(!accountFixture.active);
    when(account.isExpired()).thenReturn(accountFixture.expired);
    return account;
}
Also used : SubAccount(org.kuali.kfs.coa.businessobject.SubAccount) Account(org.kuali.kfs.coa.businessobject.Account)

Example 37 with Account

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

the class CuRequisitionDocument method getAccountsForAwardRouting.

public List<Account> getAccountsForAwardRouting() {
    List<Account> accounts = new ArrayList<Account>();
    ParameterService parameterService = SpringContext.getBean(ParameterService.class);
    for (PurApItem item : (List<PurApItem>) this.getItems()) {
        for (PurApAccountingLine accountingLine : item.getSourceAccountingLines()) {
            if (isObjectCodeAllowedForAwardRouting(accountingLine, parameterService)) {
                if (ObjectUtils.isNull(accountingLine.getAccount())) {
                    accountingLine.refreshReferenceObject("account");
                }
                if (accountingLine.getAccount() != null && !accounts.contains(accountingLine.getAccount())) {
                    accounts.add(accountingLine.getAccount());
                }
            }
        }
    }
    return accounts;
}
Also used : RequisitionAccount(org.kuali.kfs.module.purap.businessobject.RequisitionAccount) Account(org.kuali.kfs.coa.businessobject.Account) ParameterService(org.kuali.kfs.coreservice.framework.parameter.ParameterService) PurApItem(org.kuali.kfs.module.purap.businessobject.PurApItem) PurApAccountingLine(org.kuali.kfs.module.purap.businessobject.PurApAccountingLine) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList)

Example 38 with Account

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

the class CuScrubberProcessImpl method setupEntryWithPotentialContinuation.

/**
 * Helper method for configuring the chart, account and sub-account on the cost-share-source-account entry,
 * using the cost share account's continuation account or descendant (up to a depth of 10) in the
 * event of a closed cost share account.
 *
 * @param costShareSourceAccountEntry The origin entry to configure.
 * @param scrubbedEntryA21SubAccount The A21 sub-account from the original scrubbed origin entry.
 * @return A ScrubberProcessTransactionError if a valid cost share or continuation account could not be found, null otherwise.
 */
protected ScrubberProcessTransactionError setupEntryWithPotentialContinuation(OriginEntryFull costShareSourceAccountEntry, A21SubAccount scrubbedEntryA21SubAccount) {
    Account costShareAccount = accountingCycleCachingService.getAccount(scrubbedEntryA21SubAccount.getCostShareChartOfAccountCode(), scrubbedEntryA21SubAccount.getCostShareSourceAccountNumber());
    if (ObjectUtils.isNotNull(costShareAccount) && costShareAccount.isClosed()) {
        // Cost share source account is closed; check for a valid continuation account.
        Account continuationAccount = costShareAccount;
        for (int i = 0; i < CONTINUATION_ACCOUNT_DEPTH_LIMIT && ObjectUtils.isNotNull(continuationAccount) && continuationAccount.isClosed(); i++) {
            continuationAccount = accountingCycleCachingService.getAccount(continuationAccount.getContinuationFinChrtOfAcctCd(), continuationAccount.getContinuationAccountNumber());
        }
        if (ObjectUtils.isNull(continuationAccount) || costShareAccount == continuationAccount || continuationAccount.isClosed()) {
            // Could not find a valid Cost Share continuation account; return an error.
            return new ScrubberProcessTransactionError(costShareSourceAccountEntry, new Message(MessageFormat.format(configurationService.getPropertyValueAsString(CUKFSKeyConstants.ERROR_CSACCOUNT_CONTINUATION_ACCOUNT_CLOSED), scrubbedEntryA21SubAccount.getCostShareChartOfAccountCode(), scrubbedEntryA21SubAccount.getCostShareSourceAccountNumber()), Message.TYPE_FATAL));
        } else {
            // Found a valid Cost Share continuation account, so use it.
            LOG.warn(MessageFormat.format(configurationService.getPropertyValueAsString(CUKFSKeyConstants.WARNING_CSACCOUNT_CONTINUATION_ACCOUNT_USED), scrubbedEntryA21SubAccount.getCostShareChartOfAccountCode(), scrubbedEntryA21SubAccount.getCostShareSourceAccountNumber(), continuationAccount.getChartOfAccountsCode(), continuationAccount.getAccountNumber()));
            costShareSourceAccountEntry.setChartOfAccountsCode(continuationAccount.getChartOfAccountsCode());
            costShareSourceAccountEntry.setAccountNumber(continuationAccount.getAccountNumber());
            costShareSourceAccountEntry.setSubAccountNumber(KFSConstants.getDashSubAccountNumber());
        }
    } else {
        // Cost Share source account is still open, so use it.
        costShareSourceAccountEntry.setChartOfAccountsCode(scrubbedEntryA21SubAccount.getCostShareChartOfAccountCode());
        costShareSourceAccountEntry.setAccountNumber(scrubbedEntryA21SubAccount.getCostShareSourceAccountNumber());
        costShareSourceAccountEntry.setSubAccountNumber(scrubbedEntryA21SubAccount.getCostShareSourceSubAccountNumber());
    }
    return null;
}
Also used : Account(org.kuali.kfs.coa.businessobject.Account) A21SubAccount(org.kuali.kfs.coa.businessobject.A21SubAccount) Message(org.kuali.kfs.sys.Message) ScrubberProcessTransactionError(org.kuali.kfs.gl.businessobject.ScrubberProcessTransactionError)

Aggregations

Account (org.kuali.kfs.coa.businessobject.Account)38 IndirectCostRecoveryAccount (org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount)14 SubAccount (org.kuali.kfs.coa.businessobject.SubAccount)11 AppropriationAccount (edu.cornell.kfs.coa.businessobject.AppropriationAccount)9 HashMap (java.util.HashMap)6 A21SubAccount (org.kuali.kfs.coa.businessobject.A21SubAccount)6 ArrayList (java.util.ArrayList)5 BusinessObjectService (org.kuali.kfs.krad.service.BusinessObjectService)5 List (java.util.List)4 A21IndirectCostRecoveryAccount (org.kuali.kfs.coa.businessobject.A21IndirectCostRecoveryAccount)4 Message (org.kuali.kfs.sys.Message)4 ParameterService (org.kuali.kfs.coreservice.framework.parameter.ParameterService)3 AccountExtendedAttribute (edu.cornell.kfs.coa.businessobject.AccountExtendedAttribute)2 SubFundProgram (edu.cornell.kfs.coa.businessobject.SubFundProgram)2 Date (java.sql.Date)2 AccountGlobalDetail (org.kuali.kfs.coa.businessobject.AccountGlobalDetail)2 AccountService (org.kuali.kfs.coa.service.AccountService)2 SubAccountService (org.kuali.kfs.coa.service.SubAccountService)2 MaintenanceDocument (org.kuali.kfs.kns.document.MaintenanceDocument)2 DocumentService (org.kuali.kfs.krad.service.DocumentService)2