Search in sources :

Example 16 with Account

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

the class AccountGlobalSearchDaoOjb method getAccountsByOrgHierarchy.

public Collection getAccountsByOrgHierarchy(String chartOfAccountsCode, String organizationCode, Map<String, String> parameters) {
    Criteria criteria = new Criteria();
    Criteria orgCriteria = new Criteria();
    orgCriteria.addEqualTo(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, chartOfAccountsCode);
    orgCriteria.addEqualTo(KFSPropertyConstants.ORGANIZATION_CODE, organizationCode);
    criteria.addOrCriteria(orgCriteria);
    List<Organization> reportingOrgs = getReportingOrgs(chartOfAccountsCode, organizationCode, new HashSet<Organization>());
    for (Organization reportingOrg : reportingOrgs) {
        orgCriteria = new Criteria();
        orgCriteria.addEqualTo(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, reportingOrg.getChartOfAccountsCode());
        orgCriteria.addEqualTo(KFSPropertyConstants.ORGANIZATION_CODE, reportingOrg.getOrganizationCode());
        criteria.addOrCriteria(orgCriteria);
    }
    // Add the rest of the criteria for the lookup
    parameters.remove(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE);
    parameters.remove(KFSPropertyConstants.ORGANIZATION_CODE);
    criteria.addAndCriteria(lookupDao.getCollectionCriteriaFromMap(new Account(), parameters));
    return getPersistenceBrokerTemplate().getCollectionByQuery(QueryFactory.newQuery(Account.class, criteria));
}
Also used : Account(org.kuali.kfs.coa.businessobject.Account) Organization(org.kuali.kfs.coa.businessobject.Organization) Criteria(org.apache.ojb.broker.query.Criteria)

Example 17 with Account

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

the class AmazonWebServicesBillingServiceImpl method buildFromAccountLine.

private SourceAccountingLine buildFromAccountLine(String diDocumentNumber, KualiDecimal amount) {
    SourceAccountingLine line = new SourceAccountingLine();
    Account fromAccount = findAccountFromAccountNumber(getTransactionFromAccountNumber());
    line.setDocumentNumber(diDocumentNumber);
    line.setAccountNumber(fromAccount.getAccountNumber());
    line.setChartOfAccountsCode(fromAccount.getChartOfAccountsCode());
    line.setFinancialObjectCode(getTransactionObjectCode());
    line.setAmount(amount);
    line.setFinancialDocumentLineDescription(buildAccountingLineDescription());
    line.setSequenceNumber(new Integer(1));
    return line;
}
Also used : SubAccount(org.kuali.kfs.coa.businessobject.SubAccount) Account(org.kuali.kfs.coa.businessobject.Account) SourceAccountingLine(org.kuali.kfs.sys.businessobject.SourceAccountingLine)

Example 18 with Account

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

the class AmazonWebServicesBillingServiceImpl method updateTransactionDTOChartAccountSubAccount.

private void updateTransactionDTOChartAccountSubAccount(AmazonBillingDistributionOfIncomeTransactionDTO transactionDTO, AmazonBillingCostCenterDTO costCenterDTO, String amazonDetailKFSAccount) {
    Account account = retrieveAccount(costCenterDTO.getAccountNumber(), amazonDetailKFSAccount);
    if (validAccount(account)) {
        transactionDTO.setAccountNumber(account.getAccountNumber());
        updateTansactionDTOChart(transactionDTO, costCenterDTO, account);
        updateTransactionDTOSubAccount(transactionDTO, costCenterDTO, account);
    } else {
        LOG.info("updateTransactionDTOChartAccountSubAccount() Invalid account.");
        transactionDTO.setTransactionInputError(true);
    }
}
Also used : SubAccount(org.kuali.kfs.coa.businessobject.SubAccount) Account(org.kuali.kfs.coa.businessobject.Account)

Example 19 with Account

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

the class CuPosterServiceImpl method getAccountWithPotentialContinuation.

/**
 * Overridden so that the errors list will not be updated when a continuation account gets used,
 * thus allowing the ICR continuation to be processed properly by the Poster.
 *
 * @see org.kuali.kfs.gl.batch.service.impl.PosterServiceImpl#getAccountWithPotentialContinuation(
 * org.kuali.kfs.gl.businessobject.Transaction, java.util.List)
 */
@Override
protected Account getAccountWithPotentialContinuation(Transaction tran, List<Message> errors) {
    Account account = accountingCycleCachingService.getAccount(tran.getChartOfAccountsCode(), tran.getAccountNumber());
    if (ObjectUtils.isNotNull(account) && account.isClosed()) {
        Account contAccount = account;
        for (int i = 0; i < CONTINUATION_ACCOUNT_DEPTH_LIMIT && ObjectUtils.isNotNull(contAccount) && contAccount.isClosed(); i++) {
            contAccount = accountingCycleCachingService.getAccount(contAccount.getContinuationFinChrtOfAcctCd(), contAccount.getContinuationAccountNumber());
        }
        if (ObjectUtils.isNull(contAccount) || contAccount == account || contAccount.isClosed()) {
            errors.add(new Message(MessageFormat.format(configurationService.getPropertyValueAsString(KFSKeyConstants.ERROR_ICRACCOUNT_CONTINUATION_ACCOUNT_CLOSED), tran.getChartOfAccountsCode(), tran.getAccountNumber(), CONTINUATION_ACCOUNT_DEPTH_LIMIT), Message.TYPE_WARNING));
        } else {
            final String formattedErrorMessage = MessageFormat.format(configurationService.getPropertyValueAsString(KFSKeyConstants.WARNING_ICRACCOUNT_CONTINUATION_ACCOUNT_USED), tran.getChartOfAccountsCode(), tran.getAccountNumber(), contAccount.getChartOfAccountsCode(), contAccount.getAccountNumber());
            LOG.warn(formattedErrorMessage);
            account = contAccount;
            ((OriginEntryInformation) tran).setChartOfAccountsCode(contAccount.getChartOfAccountsCode());
            ((OriginEntryInformation) tran).setAccountNumber(contAccount.getAccountNumber());
        }
    }
    return account;
}
Also used : Account(org.kuali.kfs.coa.businessobject.Account) Message(org.kuali.kfs.sys.Message) OriginEntryInformation(org.kuali.kfs.gl.businessobject.OriginEntryInformation)

Example 20 with Account

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

the class AwsAccountingXmlDocumentAccountingLineServiceImplTest method buildMockAccountService.

private AccountService buildMockAccountService() {
    AccountService accountService = mock(AccountService.class);
    Account mockedAccount = createMockAccount(AwsAccountFixture.ACCOUNT_1658328);
    when(accountService.getByPrimaryId(CuFPTestConstants.TEST_AWS_BILLING_DEFAULT_CHART_CODE, CuFPTestConstants.TEST_ACCOUNT_NUMBER_1658328)).thenReturn(mockedAccount);
    when(accountService.getByPrimaryId(CuFPTestConstants.TEST_AWS_BILLING_DEFAULT_CHART_CODE, CuFPTestConstants.TEST_ACCOUNT_NUMBER_165833X)).thenReturn(null);
    mockedAccount = createMockAccount(AwsAccountFixture.ACCOUNT_R583805);
    when(accountService.getByPrimaryId(CuFPTestConstants.TEST_AWS_BILLING_DEFAULT_CHART_CODE, CuFPTestConstants.TEST_ACCOUNT_NUMBER_R583805)).thenReturn(mockedAccount);
    mockedAccount = createMockAccount(AwsAccountFixture.ACCOUNT_R589966);
    when(accountService.getByPrimaryId(CuFPTestConstants.TEST_AWS_BILLING_DEFAULT_CHART_CODE, CuFPTestConstants.TEST_ACCOUNT_NUMBER_R589966)).thenReturn(mockedAccount);
    mockedAccount = createMockAccount(AwsAccountFixture.ACCOUNT_R589966);
    when(accountService.getByPrimaryId(CuFPTestConstants.TEST_AWS_BILLING_DEFAULT_CHART_CODE, CuFPTestConstants.TEST_ACCOUNT_NUMBER_1023715)).thenReturn(mockedAccount);
    mockedAccount = createMockAccount(AwsAccountFixture.ACCOUNT_CS_J801000);
    when(accountService.getByPrimaryId(CuFPTestConstants.TEST_AWS_BILLING_CHART_CODE_CS, CuFPTestConstants.TEST_ACCOUNT_NUMBER_J801000)).thenReturn(mockedAccount);
    when(accountService.getByPrimaryId(CuFPTestConstants.TEST_AWS_BILLING_DEFAULT_CHART_CODE, CuFPTestConstants.TEST_ACCOUNT_NUMBER_J80100X)).thenReturn(null);
    when(accountService.getByPrimaryId(CuFPTestConstants.TEST_AWS_BILLING_DEFAULT_CHART_CODE, CuFPTestConstants.TEST_INVALID_STAR_ACCOUNT_STRING)).thenReturn(null);
    return accountService;
}
Also used : SubAccount(org.kuali.kfs.coa.businessobject.SubAccount) Account(org.kuali.kfs.coa.businessobject.Account) AccountService(org.kuali.kfs.coa.service.AccountService) SubAccountService(org.kuali.kfs.coa.service.SubAccountService)

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