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;
}
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;
}
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;
}
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();
}
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;
}
Aggregations