Search in sources :

Example 1 with COABO

use of org.mifos.accounts.financial.business.COABO in project head by mifos.

the class LegacyAccountDao method getCategory.

/**
     * A "category" is a top-level general ledger account. Use this method to fetch a single, specific category from the
     * database.
     */
public COABO getCategory(GLCategoryType categoryType) {
    Query topLevelAccount = getSession().getNamedQuery(NamedQueryConstants.GET_TOP_LEVEL_ACCOUNT);
    topLevelAccount.setParameter("categoryType", categoryType.toString());
    return (COABO) topLevelAccount.uniqueResult();
}
Also used : Query(org.hibernate.Query) COABO(org.mifos.accounts.financial.business.COABO)

Example 2 with COABO

use of org.mifos.accounts.financial.business.COABO in project head by mifos.

the class LegacyAccountDao method addAccountSubcategories.

private void addAccountSubcategories(XMLConfiguration config, COABO coa, String path) {
    for (COABO subcat : coa.getSubCategoryCOABOs()) {
        config.addProperty(path + "(-1)[@code]", subcat.getAssociatedGlcode().getGlcode());
        config.addProperty(path + "[@name]", subcat.getAccountName());
        addAccountSubcategories(config, subcat, path + GL_ACCOUNT_TAG);
    }
}
Also used : COABO(org.mifos.accounts.financial.business.COABO)

Example 3 with COABO

use of org.mifos.accounts.financial.business.COABO in project head by mifos.

the class FinancialInitializer method cacheCOA.

/**
     * Reads chart of accounts from the database and caches in memory.
     */
@SuppressWarnings("unchecked")
public static void cacheCOA() {
    if (ChartOfAccountsCache.isInitialized()) {
        return;
    }
    Session session = StaticHibernateUtil.getSessionTL();
    Query query = session.getNamedQuery(NamedQueryConstants.GET_ALL_COA);
    List<COABO> coaBoList = query.list();
    for (COABO coabo : coaBoList) {
        ChartOfAccountsCache.add(hibernateInitalize(coabo));
    }
}
Also used : Query(org.hibernate.Query) COABO(org.mifos.accounts.financial.business.COABO) Session(org.hibernate.Session)

Example 4 with COABO

use of org.mifos.accounts.financial.business.COABO in project head by mifos.

the class GeneralLedgerDaoHibernate method retreiveGlCodesBy.

@Override
public List<GLCodeEntity> retreiveGlCodesBy(FinancialActionConstants financialTransactionType, FinancialConstants debitOrCredit) throws FinancialException {
    List<GLCodeEntity> glCodeList = new ArrayList<GLCodeEntity>();
    Set<COABO> applicableCategory = null;
    FinancialActionTypeEntity finActionFees = FinancialActionCache.getFinancialAction(financialTransactionType);
    if (debitOrCredit.equals(FinancialConstants.DEBIT)) {
        applicableCategory = finActionFees.getApplicableDebitCharts();
    } else if (debitOrCredit.equals(FinancialConstants.CREDIT)) {
        applicableCategory = finActionFees.getApplicableCreditCharts();
    }
    for (COABO chartOfAccounts : applicableCategory) {
        glCodeList.add(chartOfAccounts.getAssociatedGlcode());
    }
    return glCodeList;
}
Also used : FinancialActionTypeEntity(org.mifos.accounts.financial.business.FinancialActionTypeEntity) COABO(org.mifos.accounts.financial.business.COABO) ArrayList(java.util.ArrayList) GLCodeEntity(org.mifos.accounts.financial.business.GLCodeEntity)

Example 5 with COABO

use of org.mifos.accounts.financial.business.COABO in project head by mifos.

the class DisbursementAccountingEntry method applySpecificAccountActionEntry.

@Override
protected void applySpecificAccountActionEntry() throws FinancialException {
    LoanTrxnDetailEntity loanTrxn = (LoanTrxnDetailEntity) financialActivity.getAccountTrxn();
    FinancialActionTypeEntity finloanDibursal = getFinancialAction(FinancialActionConstants.DISBURSAL);
    // debit take form the prd offering
    GLCodeEntity glcodeDebit = ((LoanBO) loanTrxn.getAccount()).getLoanOffering().getPrincipalGLcode();
    addAccountEntryDetails(loanTrxn.getAmount(), finloanDibursal, glcodeDebit, FinancialConstants.DEBIT);
    Set<COABO> creditCharts = finloanDibursal.getApplicableCreditCharts();
    GLCodeEntity glcodeCredit = getGLcode(creditCharts);
    addAccountEntryDetails(loanTrxn.getAmount(), finloanDibursal, glcodeCredit, FinancialConstants.CREDIT);
}
Also used : FinancialActionTypeEntity(org.mifos.accounts.financial.business.FinancialActionTypeEntity) COABO(org.mifos.accounts.financial.business.COABO) GLCodeEntity(org.mifos.accounts.financial.business.GLCodeEntity) LoanTrxnDetailEntity(org.mifos.accounts.loan.business.LoanTrxnDetailEntity)

Aggregations

COABO (org.mifos.accounts.financial.business.COABO)28 GLCodeEntity (org.mifos.accounts.financial.business.GLCodeEntity)10 FinancialActionTypeEntity (org.mifos.accounts.financial.business.FinancialActionTypeEntity)6 Query (org.hibernate.Query)5 ArrayList (java.util.ArrayList)4 COAHierarchyEntity (org.mifos.accounts.financial.business.COAHierarchyEntity)4 MifosRuntimeException (org.mifos.core.MifosRuntimeException)4 PersistenceException (org.mifos.framework.exceptions.PersistenceException)4 Session (org.hibernate.Session)3 Test (org.junit.Test)3 FinancialActionConstants (org.mifos.accounts.financial.util.helpers.FinancialActionConstants)3 LegacyAccountDao (org.mifos.accounts.persistence.LegacyAccountDao)3 HashMap (java.util.HashMap)2 BeforeClass (org.junit.BeforeClass)2 FinancialException (org.mifos.accounts.financial.exceptions.FinancialException)2 ChartOfAccountsCache (org.mifos.accounts.financial.util.helpers.ChartOfAccountsCache)2 BusinessRuleException (org.mifos.service.BusinessRuleException)2 IOException (java.io.IOException)1 StringWriter (java.io.StringWriter)1 Iterator (java.util.Iterator)1