Search in sources :

Example 6 with VoucherBranchMappingActionForm

use of org.mifos.accounting.struts.actionform.VoucherBranchMappingActionForm in project head by mifos.

the class VoucherBranchMappingAction method preview.

public ActionForward preview(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;
    double total = 0;
    coaNameslist = new ArrayList<GLCodeDto>();
    for (int i = 0; i < coanames.length; i++) {
        total = total + Double.parseDouble(amounts[i]);
        GLCodeDto GLcodedto = new GLCodeDto();
        GLcodedto.setSno(sno);
        sno++;
        GLcodedto.setCoaName(coanames[i]);
        GLcodedto.setTrannotes(notes[i]);
        GLcodedto.setAmounts(amounts[i]);
        coaNameslist.add(GLcodedto);
    }
    actionForm.setTotal(String.format("%.2f", total));
    storingSession(request, "coaNamesList", coaNameslist);
    storingSession(request, "VoucherBranchMappingActionForm", actionForm);
    return mapping.findForward(ActionForwards.preview_success.toString());
}
Also used : GLCodeDto(org.mifos.dto.domain.GLCodeDto) VoucherBranchMappingActionForm(org.mifos.accounting.struts.actionform.VoucherBranchMappingActionForm)

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