use of org.mifos.application.accounting.business.GlBalancesBO in project head by mifos.
the class OpenBalanceAction method loadOpenBalance.
public ActionForward loadOpenBalance(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
OpenBalanceActionForm actionForm = (OpenBalanceActionForm) form;
GlBalancesBO balancesBO = accountingServiceFacade.loadExistedGlBalancesBO(new Integer(actionForm.getOfficeHierarchy()), actionForm.getOffice(), actionForm.getCoaName(), new Integer(actionForm.getFinancialYearId()));
if (balancesBO != null) {
BigDecimal openBalance = balancesBO.getOpeningBalance();
if (openBalance.compareTo(new BigDecimal(0.0)) < 0)
actionForm.setAmountAction("-");
else
actionForm.setAmountAction("+");
actionForm.setOpenBalance(openBalance.abs().toString());
}
return mapping.findForward(ActionForwards.load_success.toString());
}
use of org.mifos.application.accounting.business.GlBalancesBO in project head by mifos.
the class OpenBalanceAction method submit.
public ActionForward submit(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
OpenBalanceActionForm actionForm = (OpenBalanceActionForm) form;
UserContext context = getUserContext(request);
//
GlBalancesBO glBalancesBO = new GlBalancesBO();
String finacialYearId = (String) (actionForm.getFinancialYearId() == "" ? "0" : actionForm.getFinancialYearId());
glBalancesBO.setFinancialYearBO(accountingServiceFacade.getFinancialYearBO(new Integer(finacialYearId)));
glBalancesBO.setCreatedBy(context.getId());
glBalancesBO.setCreatedDate(DateUtils.getCurrentDateWithoutTimeStamp());
glBalancesBO.setOfficeLevel(new Integer(actionForm.getOfficeHierarchy()));
glBalancesBO.setOfficeId(actionForm.getOffice());
glBalancesBO.setGlCodeValue(actionForm.getCoaName());
glBalancesBO.setOpeningBalance(new BigDecimal(actionForm.getAmountAction() + actionForm.getOpenBalance()));
glBalancesBO.setClosingBalance(new BigDecimal(actionForm.getAmountAction() + actionForm.getOpenBalance()));
glBalancesBO.setTransactionDebitSum(new BigDecimal(0.0));
glBalancesBO.setTransactionCreditSum(new BigDecimal(0.0));
accountingServiceFacade.savingOpeningBalances(glBalancesBO);
return mapping.findForward("submit_success");
}
use of org.mifos.application.accounting.business.GlBalancesBO in project head by mifos.
the class AccountingDaoHibernate method findExistedGlBalacesBOs.
public List<GlBalancesBO> findExistedGlBalacesBOs(Integer officeLevelId, String officeId, String glCodeValue, Integer financialYearId) {
List<GlBalancesBO> balancesBOs = null;
Query query = createdNamedQuery("getExistedGlBalancesBO");
query.setInteger("OFFICE_LEVEL", officeLevelId);
query.setString("OFFICE_ID", officeId);
query.setString("GLCODEVALUE", glCodeValue);
query.setInteger("FINANCIALYEARID", financialYearId);
balancesBOs = query.list();
return balancesBOs;
}
use of org.mifos.application.accounting.business.GlBalancesBO in project head by mifos.
the class AccountingServiceFacadeWebTier method savingOpeningBalances.
@Override
public boolean savingOpeningBalances(GlBalancesBO bo) throws MifosRuntimeException {
boolean flag = false;
List<GlBalancesBO> balancesBOs = accountingDao.getResultantGlBalancesBO(bo);
GlBalancesBO balancesBO = null;
if (balancesBOs.size() > 0) {
balancesBO = balancesBOs.get(0);
balancesBO = getResultantGlBalancesBO(balancesBO, bo);
} else {
balancesBO = bo;
}
this.hibernateTransactionHelper.startTransaction();
flag = accountingDao.savingOpenBalancesTransaction(balancesBO);
this.hibernateTransactionHelper.flushSession();
return flag;
}
use of org.mifos.application.accounting.business.GlBalancesBO 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