Search in sources :

Example 11 with SubAccount

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

the class SubAccountGlobalDetail method getContractsAndGrantsAccountResponsibilityIdForRouting.

/**
 * Determines the contractsAndGrantsAccountResponsibilityId For Routing. If SubAccountTypeCode is CS then the ContractsAndGrantsAccountResponsibilityId on the sub account account is returned.
 * Otherwise null is returned. This ensures that document is only routed to CG if sub account type is CS.
 *
 * @return ContractsAndGrantsAccountResponsibilityId on account if sub account type is CS, null otherwise
 */
public Integer getContractsAndGrantsAccountResponsibilityIdForRouting() {
    this.refreshReferenceObject("subAccount");
    SubAccount subAccount = this.getSubAccount();
    if (subAccount.getA21SubAccount().getSubAccountTypeCode().equals(KFSConstants.SubAccountType.COST_SHARE)) {
        subAccount.refreshReferenceObject("account");
        contractsAndGrantsAccountResponsibilityIdForRouting = subAccount.getAccount().getContractsAndGrantsAccountResponsibilityId();
    }
    return contractsAndGrantsAccountResponsibilityIdForRouting;
}
Also used : SubAccount(org.kuali.kfs.coa.businessobject.SubAccount)

Example 12 with SubAccount

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

the class AmazonWebServicesBillingServiceImpl method updateTransactionDTOSubAccount.

private void updateTransactionDTOSubAccount(AmazonBillingDistributionOfIncomeTransactionDTO transactionDTO, AmazonBillingCostCenterDTO costCenterDTO, Account account) {
    if (StringUtils.isNotBlank(costCenterDTO.getSubAccountNumber())) {
        SubAccount subAccount = findSubAccountFromSubAccountNumber(account, costCenterDTO.getSubAccountNumber());
        if (ObjectUtils.isNotNull(subAccount)) {
            transactionDTO.setSubAccountNumber(subAccount.getSubAccountNumber());
        } else {
            LOG.info("updateTransactionDTOSubAccount() Invalid Sub Account.");
            transactionDTO.setTransactionInputError(true);
        }
    }
}
Also used : SubAccount(org.kuali.kfs.coa.businessobject.SubAccount)

Example 13 with SubAccount

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

the class AmazonWebServicesBillingServiceImpl method findSubAccountFromSubAccountNumber.

private SubAccount findSubAccountFromSubAccountNumber(Account account, String subAccountNumber) {
    SubAccount subAccount = null;
    if (ObjectUtils.isNotNull(account)) {
        subAccount = getSubAccountService().getByPrimaryId(account.getChartOfAccountsCode(), account.getAccountNumber(), subAccountNumber);
        if (ObjectUtils.isNull(subAccount) || !subAccount.isActive()) {
            LOG.info("findSubAccountFromSubAccountNumber() An invalid sub account number was provided: " + subAccountNumber);
            subAccount = null;
        }
    }
    return subAccount;
}
Also used : SubAccount(org.kuali.kfs.coa.businessobject.SubAccount)

Example 14 with SubAccount

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

the class MockSubAccountService method createSubAccount.

private SubAccount createSubAccount(String chartOfAccountsCode, String accountNumber, String subAccountNumber) {
    SubAccount subAccount = new SubAccount();
    subAccount.setChartOfAccountsCode(chartOfAccountsCode);
    subAccount.setAccountNumber(accountNumber);
    subAccount.setSubAccountNumber(subAccountNumber);
    return subAccount;
}
Also used : SubAccount(org.kuali.kfs.coa.businessobject.SubAccount)

Example 15 with SubAccount

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

the class CuSubAccountMaintainableImpl method hasCgIcrDataChanged.

// KFSPTS-1740 added
/**
 * Answers true for the following conditions:
 * a) New or Copy of SubAccount with data existing in any field on the Edit CG ICR tab of the Sub-Account
 *      maintenance document will enforce the route the Award split-node.
 * b) Edit of the SubAccount where any data change is detected on the Edit CG ICR tab of the Sub-Account
 *      maintenance document will enforce the route the Award split-node.
 *
 * @return true when conditions are met; otherwise return false
 */
private boolean hasCgIcrDataChanged() {
    String maintAction = super.getMaintenanceAction();
    boolean retval = false;
    if ((maintAction.equalsIgnoreCase(KRADConstants.MAINTENANCE_NEW_ACTION)) || (maintAction.equalsIgnoreCase(KRADConstants.MAINTENANCE_COPY_ACTION))) {
        // need "new" bo for data comparisons
        SubAccount subAccount = (SubAccount) super.getBusinessObject();
        if (subAccount.getA21SubAccount().getSubAccountTypeCode().equals(KFSConstants.SubAccountType.EXPENSE)) {
            // We need to route only when the ICR data the user is submitting does NOT match the ICR data on the account
            // "new" subAccount for data comparisons
            A21SubAccount newSubAccount = subAccount.getA21SubAccount();
            // "existing" data that would have pre-populated
            Account account = this.getAccountService().getByPrimaryIdWithCaching(subAccount.getChartOfAccountsCode(), subAccount.getAccountNumber());
            if (ObjectUtils.isNotNull(account) && ObjectUtils.isNotNull(newSubAccount)) {
                // compare each field in question
                boolean hasIcrIdChanged = !areFieldValuesTheSame(account.getFinancialIcrSeriesIdentifier(), newSubAccount.getFinancialIcrSeriesIdentifier());
                boolean hasIcrTypeCodeChanged = !areFieldValuesTheSame(account.getAcctIndirectCostRcvyTypeCd(), newSubAccount.getIndirectCostRecoveryTypeCode());
                boolean hasOffCampusIndChanged = newSubAccount.getOffCampusCode() != account.isAccountOffCampusIndicator();
                if (hasIcrIdChanged || hasIcrTypeCodeChanged || hasOffCampusIndChanged) {
                    // retrieve data we need for split-node route to work, contractsAndGrantsAccountResponsibilityId
                    // is not a sub-account attribute and we must populate the account attribute on sub-account
                    subAccount.setAccount(getAccountService().getByPrimaryIdWithCaching(subAccount.getChartOfAccountsCode(), subAccount.getAccountNumber()));
                    retval = true;
                }
            }
        }
    } else if (maintAction.equalsIgnoreCase(KRADConstants.MAINTENANCE_EDIT_ACTION)) {
        // need "new" bo for data comparisons
        SubAccount subAccount = (SubAccount) super.getBusinessObject();
        // "new" subAccount for data comparisons
        A21SubAccount newSubAccount = subAccount.getA21SubAccount();
        // "old" subAccount for data comparisons
        A21SubAccount oldSubAccount = this.getA21SubAccountService().getByPrimaryKey(subAccount.getChartOfAccountsCode(), subAccount.getAccountNumber(), subAccount.getSubAccountNumber());
        // compare each field in question
        boolean hasIcrIdChanged = isFieldValueChanged(newSubAccount.getFinancialIcrSeriesIdentifier(), oldSubAccount.getFinancialIcrSeriesIdentifier());
        boolean hasIcrTypeCodeChanged = isFieldValueChanged(newSubAccount.getIndirectCostRecoveryTypeCode(), oldSubAccount.getIndirectCostRecoveryTypeCode());
        boolean hasOffCampusIndChanged = newSubAccount.getOffCampusCode() != oldSubAccount.getOffCampusCode();
        if (hasIcrIdChanged || hasIcrTypeCodeChanged || hasOffCampusIndChanged) {
            // retrieve data we need for split-node route to work, contractsAndGrantsAccountResponsibilityId is
            // not a sub-account attribute and we must populate the account attribute on sub-account
            subAccount.setAccount(getAccountService().getByPrimaryIdWithCaching(subAccount.getChartOfAccountsCode(), subAccount.getAccountNumber()));
            retval = true;
        }
    }
    return retval;
}
Also used : A21IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.A21IndirectCostRecoveryAccount) SubAccount(org.kuali.kfs.coa.businessobject.SubAccount) A21SubAccount(org.kuali.kfs.coa.businessobject.A21SubAccount) IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount) Account(org.kuali.kfs.coa.businessobject.Account) SubAccount(org.kuali.kfs.coa.businessobject.SubAccount) A21SubAccount(org.kuali.kfs.coa.businessobject.A21SubAccount) A21SubAccount(org.kuali.kfs.coa.businessobject.A21SubAccount)

Aggregations

SubAccount (org.kuali.kfs.coa.businessobject.SubAccount)22 A21IndirectCostRecoveryAccount (org.kuali.kfs.coa.businessobject.A21IndirectCostRecoveryAccount)7 A21SubAccount (org.kuali.kfs.coa.businessobject.A21SubAccount)7 ArrayList (java.util.ArrayList)4 Account (org.kuali.kfs.coa.businessobject.Account)4 IndirectCostRecoveryAccount (org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount)3 SubAccountService (org.kuali.kfs.coa.service.SubAccountService)2 SubAccountGlobal (edu.cornell.kfs.coa.businessobject.SubAccountGlobal)1 SubAccountGlobalDetail (edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail)1 ValidationResult (edu.cornell.kfs.concur.businessobjects.ValidationResult)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Maintainable (org.kuali.kfs.kns.maintenance.Maintainable)1 DataDictionaryService (org.kuali.kfs.kns.service.DataDictionaryService)1 PersistableBusinessObject (org.kuali.kfs.krad.bo.PersistableBusinessObject)1 MaintenanceDocument (org.kuali.kfs.krad.maintenance.MaintenanceDocument)1 MaintenanceLock (org.kuali.kfs.krad.maintenance.MaintenanceLock)1 DocumentService (org.kuali.kfs.krad.service.DocumentService)1