Search in sources :

Example 1 with VoucherBranchMappingActionForm

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());
}
Also used : OfficeGlobalDto(org.mifos.dto.domain.OfficeGlobalDto) GLCodeDto(org.mifos.dto.domain.GLCodeDto) OfficesList(org.mifos.dto.domain.OfficesList) Date(java.util.Date) UserContext(org.mifos.security.util.UserContext) ArrayList(java.util.ArrayList) VoucherBranchMappingActionForm(org.mifos.accounting.struts.actionform.VoucherBranchMappingActionForm)

Example 2 with VoucherBranchMappingActionForm

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());
}
Also used : GLCodeDto(org.mifos.dto.domain.GLCodeDto) VoucherBranchMappingActionForm(org.mifos.accounting.struts.actionform.VoucherBranchMappingActionForm)

Example 3 with VoucherBranchMappingActionForm

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());
}
Also used : GLCodeDto(org.mifos.dto.domain.GLCodeDto) VoucherBranchMappingActionForm(org.mifos.accounting.struts.actionform.VoucherBranchMappingActionForm)

Example 4 with VoucherBranchMappingActionForm

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());
}
Also used : GlMasterBO(org.mifos.application.accounting.business.GlMasterBO) VoucherBranchMappingActionForm(org.mifos.accounting.struts.actionform.VoucherBranchMappingActionForm) BigDecimal(java.math.BigDecimal) GlDetailBO(org.mifos.application.accounting.business.GlDetailBO)

Example 5 with VoucherBranchMappingActionForm

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());
}
Also used : GLCodeDto(org.mifos.dto.domain.GLCodeDto) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) ParseException(java.text.ParseException) VoucherBranchMappingActionForm(org.mifos.accounting.struts.actionform.VoucherBranchMappingActionForm) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) LocalDate(org.joda.time.LocalDate)

Aggregations

VoucherBranchMappingActionForm (org.mifos.accounting.struts.actionform.VoucherBranchMappingActionForm)6 GLCodeDto (org.mifos.dto.domain.GLCodeDto)5 Date (java.util.Date)2 BigDecimal (java.math.BigDecimal)1 DateFormat (java.text.DateFormat)1 ParseException (java.text.ParseException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1 LocalDate (org.joda.time.LocalDate)1 GlDetailBO (org.mifos.application.accounting.business.GlDetailBO)1 GlMasterBO (org.mifos.application.accounting.business.GlMasterBO)1 OfficeGlobalDto (org.mifos.dto.domain.OfficeGlobalDto)1 OfficesList (org.mifos.dto.domain.OfficesList)1 UserContext (org.mifos.security.util.UserContext)1