use of org.mifos.accounting.struts.actionform.VoucherBranchMappingActionForm in project head by mifos.
the class VoucherBranchMappingAction method load.
public ActionForward load(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
logger.debug("start Load method of loan Product Action");
VoucherBranchMappingActionForm actionForm = (VoucherBranchMappingActionForm) form;
java.util.Date trxnDate = DateUtils.getCurrentDateWithoutTimeStamp();
//actionForm.setTransactiondate(trxnDate);
List<OfficeGlobalDto> officeDetailsDtos = null;
UserContext context = getUserContext(request);
actionForm.setOfficeLevelId(String.valueOf(context.getOfficeLevelId()));
List<OfficesList> offices = new ArrayList<OfficesList>();
short branches = 5;
officeDetailsDtos = accountingServiceFacade.loadOfficesForLevel(branches);
List<GLCodeDto> accountingDtos = accountingServiceFacade.coaBranchAccountHead();
List<GLCodeDto> coaNameslist = new ArrayList<GLCodeDto>();
storingSession(request, "coaNamesList", coaNameslist);
storingSession(request, "MainAccountGlCodes", null);
actionForm.setBranch("");
actionForm.setTransactiondate("");
storingSession(request, "OfficesOnHierarchy", officeDetailsDtos);
return mapping.findForward(ActionForwards.load_success.toString());
}
use of org.mifos.accounting.struts.actionform.VoucherBranchMappingActionForm in project head by mifos.
the class VoucherBranchMappingAction method loadMainAccounts.
public ActionForward loadMainAccounts(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
VoucherBranchMappingActionForm actionForm = (VoucherBranchMappingActionForm) form;
List<GLCodeDto> accountingDtos = null;
if (actionForm.getTransactiontype().equals("CR") || actionForm.getTransactiontype().equals("CP")) {
accountingDtos = accountingServiceFacade.mainAccountForCash();
} else if (actionForm.getTransactiontype().equals("BR") || actionForm.getTransactiontype().equals("BP")) {
accountingDtos = accountingServiceFacade.mainAccountForBank();
}
storingSession(request, "MainAccountGlCodes", accountingDtos);
return mapping.findForward(ActionForwards.load_success.toString());
}
use of org.mifos.accounting.struts.actionform.VoucherBranchMappingActionForm in project head by mifos.
the class VoucherBranchMappingAction method previous.
public ActionForward previous(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
VoucherBranchMappingActionForm actionForm = (VoucherBranchMappingActionForm) form;
String[] coanames = actionForm.getCoaname();
String[] amounts = actionForm.getAmount();
String[] notes = actionForm.getTransactionnotes();
List<GLCodeDto> coaNameslist = null;
int sno = 1;
coaNameslist = new ArrayList<GLCodeDto>();
for (int i = 0; i < coanames.length; i++) {
GLCodeDto GLcodedto = new GLCodeDto();
GLcodedto.setSno(sno);
sno++;
GLcodedto.setCoaName(coanames[i]);
GLcodedto.setTrannotes(notes[i]);
GLcodedto.setAmounts(amounts[i]);
coaNameslist.add(GLcodedto);
}
storingSession(request, "coaNamesList", coaNameslist);
storingSession(request, "VoucherBranchMappingActionForm", actionForm);
return mapping.findForward(ActionForwards.previous_success.toString());
}
use of org.mifos.accounting.struts.actionform.VoucherBranchMappingActionForm in project head by mifos.
the class VoucherBranchMappingAction method submit.
public ActionForward submit(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
String totalAmount = "0";
String[] amounts;
VoucherBranchMappingActionForm actionForm = (VoucherBranchMappingActionForm) form;
//storingSession(request, "coaNamesList", coaNameslist);
List<String> amountActionList = getAmountAction(actionForm);
List<GlDetailBO> glDetailBOList = getGlDetailBOList(actionForm, amountActionList);
String[] amounts1 = actionForm.getAmount();
amounts = actionForm.getAmount();
double totalcheck = Double.parseDouble(actionForm.getTotal());
if (totalcheck != 0) {
GlMasterBO glMasterBO = new GlMasterBO();
glMasterBO.setTransactionDate(DateUtils.getDate(actionForm.getTransactiondate()));
glMasterBO.setTransactionType(actionForm.getTransactiontype());
glMasterBO.setFromOfficeLevel(new Integer("5"));
glMasterBO.setFromOfficeId(actionForm.getBranch());
glMasterBO.setToOfficeLevel(new Integer("5"));
glMasterBO.setToOfficeId(actionForm.getBranch());
glMasterBO.setMainAccount(actionForm.getMainAccount());
glMasterBO.setTransactionAmount(new BigDecimal(Double.parseDouble(actionForm.getTotal())));
glMasterBO.setAmountAction(amountActionList.get(0));
glMasterBO.setTransactionNarration("success");
glMasterBO.setGlDetailBOList(glDetailBOList);
// default value
glMasterBO.setStatus("");
glMasterBO.setStage(0);
// default value
glMasterBO.setTransactionBy(0);
glMasterBO.setCreatedBy(getUserContext(request).getId());
glMasterBO.setCreatedDate(DateUtils.getCurrentDateWithoutTimeStamp());
accountingServiceFacade.savingAccountingTransactions(glMasterBO);
actionForm.setTransactiontype(null);
}
return mapping.findForward(ActionForwards.submit_success.toString());
}
use of org.mifos.accounting.struts.actionform.VoucherBranchMappingActionForm in project head by mifos.
the class VoucherBranchMappingAction method loadCoaNames.
public ActionForward loadCoaNames(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
VoucherBranchMappingActionForm actionForm = (VoucherBranchMappingActionForm) form;
String lastupdatedateStringvalue = accountingServiceFacade.getLastProcessUpdatedDate(actionForm.getBranch());
DateFormat df = new SimpleDateFormat("dd/mm/yyyy");
String date1 = "01/01/2012";
Date startDate;
try {
startDate = df.parse(lastupdatedateStringvalue);
startDate.setDate(startDate.getDate() + 1);
String newDateString = df.format(startDate);
Date date2 = df.parse(date1);
if (date1.equalsIgnoreCase(lastupdatedateStringvalue)) {
actionForm.setLastProcessDate(accountingServiceFacade.getLastProcessUpdatedDate(actionForm.getBranch()));
actionForm.setTransactiondate(accountingServiceFacade.getLastProcessUpdatedDate(actionForm.getBranch()));
} else {
actionForm.setLastProcessDate(newDateString);
actionForm.setTransactiondate(newDateString);
}
} catch (ParseException e) {
e.printStackTrace();
}
//List<CoaNamesDto> coaNamesDtos=accountingServiceFacade.loadCoaNames(actionForm.getBranch());
List<GLCodeDto> coabranchvalues = accountingServiceFacade.loadCoaBranchNames(actionForm.getBranch());
List<GLCodeDto> coaNameslist = null;
coaNameslist = new ArrayList<GLCodeDto>();
int sno = 1;
for (GLCodeDto coanamesdto : coabranchvalues) {
GLCodeDto coanames = new GLCodeDto();
coanames.setSno(sno);
coanames.setCoaName(coanamesdto.getGlname());
coaNameslist.add(coanames);
sno++;
}
storingSession(request, "coaNamesList", coaNameslist);
return mapping.findForward(ActionForwards.load_success.toString());
}
Aggregations