Search in sources :

Example 1 with FinancialYearBO

use of org.mifos.application.accounting.business.FinancialYearBO in project head by mifos.

the class AccountingDaoHibernate method findFinancialYear.

@Override
public List<FinancialYearBO> findFinancialYear() {
    Query query = createdNamedQuery("getStartDateByStatus");
    List<FinancialYearBO> list = query.list();
    return list;
}
Also used : Query(org.hibernate.Query) FinancialYearBO(org.mifos.application.accounting.business.FinancialYearBO)

Example 2 with FinancialYearBO

use of org.mifos.application.accounting.business.FinancialYearBO in project head by mifos.

the class AccountingServiceFacadeWebTier method updateFinancialYear.

@Override
public FinancialYearBO updateFinancialYear(FinancialYearBO oldFinancialYearBO, UserContext context) {
    FinancialYearBO newFinancialYearBO = null;
    //updating current financial year as Inactive
    accountingDao.savingFinancialYearBO(oldFinancialYearBO);
    this.hibernateTransactionHelper.flushSession();
    //creating new Finincial year
    Calendar calendar = new GregorianCalendar();
    newFinancialYearBO = new FinancialYearBO();
    newFinancialYearBO.setFinancialYearStartDate(nextYear(oldFinancialYearBO.getFinancialYearStartDate(), calendar));
    newFinancialYearBO.setFinancialYearEndDate(nextYear(oldFinancialYearBO.getFinancialYearEndDate(), calendar));
    try {
        newFinancialYearBO.setCreatedDate(DateUtils.getLocaleDate(context.getPreferredLocale(), DateUtils.getCurrentDate(context.getPreferredLocale())));
    } catch (InvalidDateException e) {
        throw new MifosRuntimeException(e);
    }
    newFinancialYearBO.setCreatedBy(context.getId());
    newFinancialYearBO.setStatus(SimpleAccountingConstants.ACTIVE);
    calendar.setTime(newFinancialYearBO.getFinancialYearStartDate());
    newFinancialYearBO.setFinancialYearId(Integer.parseInt(calendar.get(calendar.YEAR) + "" + calendar.get(calendar.YEAR)));
    newFinancialYearBO = accountingDao.savingFinancialYearBO(newFinancialYearBO);
    this.hibernateTransactionHelper.flushSession();
    return newFinancialYearBO;
}
Also used : InvalidDateException(org.mifos.application.admin.servicefacade.InvalidDateException) Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) GregorianCalendar(java.util.GregorianCalendar) FinancialYearBO(org.mifos.application.accounting.business.FinancialYearBO) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 3 with FinancialYearBO

use of org.mifos.application.accounting.business.FinancialYearBO in project head by mifos.

the class AccountingServiceFacadeWebTier method getFinancialYear.

@Override
public FinancialYearBO getFinancialYear() {
    FinancialYearBO financialYearBO = null;
    List<FinancialYearBO> financialYearList = null;
    financialYearList = accountingDao.findFinancialYear();
    if (financialYearList.size() > 0) {
        financialYearBO = financialYearList.get(0);
    }
    return financialYearBO;
}
Also used : FinancialYearBO(org.mifos.application.accounting.business.FinancialYearBO)

Example 4 with FinancialYearBO

use of org.mifos.application.accounting.business.FinancialYearBO in project head by mifos.

the class AccountingServiceFacadeWebTier method processYearEndBalances.

public void processYearEndBalances(UserContext userContext, FinancialYearBO oldFinancialYearBO) {
    this.hibernateTransactionHelper.startTransaction();
    FinancialYearBO newFinancialYearBO = processingFinancialYear(userContext, oldFinancialYearBO);
    savingYearEndBalances(oldFinancialYearBO, newFinancialYearBO);
    this.hibernateTransactionHelper.commitTransaction();
}
Also used : FinancialYearBO(org.mifos.application.accounting.business.FinancialYearBO)

Example 5 with FinancialYearBO

use of org.mifos.application.accounting.business.FinancialYearBO in project head by mifos.

the class AccountingServiceFacadeWebTier method updateGlBalancesBO.

public boolean updateGlBalancesBO(String accountglCode, String action, GlMasterBO bo) {
    boolean flag = false;
    GlBalancesBO balancesBOTemp = new GlBalancesBO();
    balancesBOTemp.setOfficeId(bo.getFromOfficeId());
    balancesBOTemp.setOfficeLevel(bo.getFromOfficeLevel());
    balancesBOTemp.setCreatedBy(bo.getCreatedBy());
    balancesBOTemp.setCreatedDate(bo.getCreatedDate());
    FinancialYearBO financialYearBO = getFinancialYear();
    if (financialYearBO != null)
        balancesBOTemp.setFinancialYearBO(financialYearBO);
    else
        throw new MifosRuntimeException("no financial year defined");
    balancesBOTemp.setGlCodeValue(accountglCode);
    //
    GlBalancesBO balancesBO = null;
    List<GlBalancesBO> balancesBOs = accountingDao.getResultantGlBalancesBO(balancesBOTemp);
    if (balancesBOs.size() > 0) {
        // to check whether the row is existed or
        // not
        balancesBO = balancesBOs.get(0);
        balancesBO = getResultantGlBalancesBOForAccountingTransactions(balancesBO, bo.getTransactionAmount(), action);
    } else {
        balancesBO = balancesBOTemp;
        balancesBO = getResultantGlBalancesBOForAccountingTransactions(balancesBO, bo.getTransactionAmount(), action);
    }
    this.hibernateTransactionHelper.flushAndClearSession();
    flag = accountingDao.savingOpenBalancesTransaction(balancesBO);
    return flag;
}
Also used : GlBalancesBO(org.mifos.application.accounting.business.GlBalancesBO) FinancialYearBO(org.mifos.application.accounting.business.FinancialYearBO) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Aggregations

FinancialYearBO (org.mifos.application.accounting.business.FinancialYearBO)9 Query (org.hibernate.Query)2 MifosRuntimeException (org.mifos.core.MifosRuntimeException)2 BigDecimal (java.math.BigDecimal)1 Calendar (java.util.Calendar)1 GregorianCalendar (java.util.GregorianCalendar)1 OpenBalanceActionForm (org.mifos.accounting.struts.actionform.OpenBalanceActionForm)1 GlBalancesBO (org.mifos.application.accounting.business.GlBalancesBO)1 InvalidDateException (org.mifos.application.admin.servicefacade.InvalidDateException)1 GLCodeDto (org.mifos.dto.domain.GLCodeDto)1