Search in sources :

Example 1 with MultipleGeneralLedgerActionForm

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

the class MultipleGeneralLedgerAction method multipleloadAccountHeads.

public ActionForward multipleloadAccountHeads(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    MultipleGeneralLedgerActionForm actionForm = (MultipleGeneralLedgerActionForm) form;
    List<GLCodeDto> snolist = null;
    List<GLCodeDto> storedList = (List<GLCodeDto>) request.getSession().getAttribute("SNoList");
    if (storedList != null) {
        if (storedList.size() == 1) {
            snolist = new ArrayList<GLCodeDto>();
            String sno = request.getParameter("Sno");
            int serno = Integer.parseInt(sno);
            GLCodeDto gLcodeDto = new GLCodeDto();
            gLcodeDto.setCoaName(actionForm.getAccountHead1()[0]);
            gLcodeDto.setGlcodeId(Short.parseShort(actionForm.getAmount1()[0]));
            gLcodeDto.setSno(serno);
            snolist.add(gLcodeDto);
            GLCodeDto gLcodeDto1 = new GLCodeDto();
            gLcodeDto1.setSno(serno + 1);
            snolist.add(gLcodeDto1);
        } else if (storedList.size() > 1) {
            for (int h = 2; h <= storedList.size(); h++) {
            }
        }
    }
    storingSession(request, "SNoList", snolist);
    //storingSession(request, "AccountHeadGlCodes", accountingDtos);
    return mapping.findForward(ActionForwards.load_success.toString());
}
Also used : GLCodeDto(org.mifos.dto.domain.GLCodeDto) ArrayList(java.util.ArrayList) OfficesList(org.mifos.dto.domain.OfficesList) List(java.util.List) MultipleGeneralLedgerActionForm(org.mifos.accounting.struts.actionform.MultipleGeneralLedgerActionForm)

Example 2 with MultipleGeneralLedgerActionForm

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

the class MultipleGeneralLedgerAction method preview.

public ActionForward preview(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    MultipleGeneralLedgerActionForm actionForm = (MultipleGeneralLedgerActionForm) form;
    String[] accounthead = actionForm.getAccountHead1();
    String[] amounts = actionForm.getAmount1();
    String[] trannotes = actionForm.getNotes1();
    // saveErrors(request, actionerrors);
    double total = 0;
    glcodelist = new ArrayList<GLCodeDto>();
    for (int i = 0; i < amounts.length; i++) {
        total = total + Double.parseDouble(amounts[i]);
        GLCodeDto gLcodeDto = new GLCodeDto();
        gLcodeDto.setAccountHead(accounthead[i]);
        gLcodeDto.setAmounts(amounts[i]);
        gLcodeDto.setTrannotes(trannotes[i]);
        glcodelist.add(gLcodeDto);
    }
    actionForm.setTotal((String.format("%.2f", total)));
    storingSession(request, "accounHeadValues", glcodelist);
    storingSession(request, "GeneralLedgerActionForm", actionForm);
    monthClosingServiceFacade.validateTransactionDate(DateUtils.getDate(actionForm.getTrxnDate()));
    return mapping.findForward(ActionForwards.preview_success.toString());
}
Also used : GLCodeDto(org.mifos.dto.domain.GLCodeDto) MultipleGeneralLedgerActionForm(org.mifos.accounting.struts.actionform.MultipleGeneralLedgerActionForm)

Example 3 with MultipleGeneralLedgerActionForm

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

the class MultipleGeneralLedgerAction method loadMainAccounts.

public ActionForward loadMainAccounts(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    MultipleGeneralLedgerActionForm actionForm = (MultipleGeneralLedgerActionForm) form;
    List<GLCodeDto> accountingDtos = null;
    if (actionForm.getTrxnType().equals("CR") || actionForm.getTrxnType().equals("CP")) {
        accountingDtos = accountingServiceFacade.mainAccountForCash();
    } else if (actionForm.getTrxnType().equals("BR") || actionForm.getTrxnType().equals("BP")) {
        accountingDtos = accountingServiceFacade.mainAccountForBank();
    }
    storingSession(request, "MainAccountGlCodes", accountingDtos);
    return mapping.findForward(ActionForwards.load_success.toString());
}
Also used : GLCodeDto(org.mifos.dto.domain.GLCodeDto) MultipleGeneralLedgerActionForm(org.mifos.accounting.struts.actionform.MultipleGeneralLedgerActionForm)

Example 4 with MultipleGeneralLedgerActionForm

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

the class MultipleGeneralLedgerAction method load.

public ActionForward load(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    List<RolesActivityDto> rolesactivitydto = null;
    MultipleGeneralLedgerActionForm actionForm = (MultipleGeneralLedgerActionForm) form;
    actionForm.setMemberId("");
    java.util.Date trxnDate = DateUtils.getCurrentDateWithoutTimeStamp();
    actionForm.setTrxnDate(trxnDate);
    rolesactivitydto = accountingServiceFacade.glloadRolesActivity();
    boolean generalledgersave = rolesactivitydto.isEmpty();
    UserContext context = getUserContext(request);
    actionForm.setOfficeLevelId(String.valueOf(context.getOfficeLevelId()));
    List listOfOfficeHierarchyObject = getOfficeLevels(actionForm);
    storingSession(request, "listOfOffices", listOfOfficeHierarchyObject);
    storingSession(request, "officeLevelId", actionForm.getOfficeLevelId());
    storingSession(request, "glsave", generalledgersave);
    storingSession(request, "OfficesOnHierarchy", null);
    storingSession(request, "MainAccountGlCodes", null);
    storingSession(request, "AccountHeadGlCodes", null);
    storingSession(request, "DynamicOfficesOnHierarchy", null);
    storingSession(request, "SNoList", null);
    return mapping.findForward(ActionForwards.load_success.toString());
}
Also used : UserContext(org.mifos.security.util.UserContext) ArrayList(java.util.ArrayList) OfficesList(org.mifos.dto.domain.OfficesList) List(java.util.List) RolesActivityDto(org.mifos.dto.domain.RolesActivityDto) MultipleGeneralLedgerActionForm(org.mifos.accounting.struts.actionform.MultipleGeneralLedgerActionForm)

Example 5 with MultipleGeneralLedgerActionForm

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

the class MultipleGeneralLedgerAction method loadOffices.

public ActionForward loadOffices(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    MultipleGeneralLedgerActionForm actionForm = (MultipleGeneralLedgerActionForm) form;
    UserContext userContext = getUserContext(request);
    //List<OfficeGlobalDto> officeDetailsDtos = null;
    List<OfficeGlobalDto> dynamicOfficeDetailsDtos = null;
    List<OfficesList> offices = new ArrayList<OfficesList>();
    // list of offices for a single parent office
    List<DynamicOfficeDto> listOfOffices = null;
    listOfOffices = accountingServiceFacade.getOfficeDetails(String.valueOf(userContext.getBranchId()), String.valueOf(userContext.getOfficeLevelId()));
    OfficesList officesList = null;
    for (DynamicOfficeDto officeDto : listOfOffices) {
        if (actionForm.getOfficeHierarchy().equals("")) {
            offices = null;
        // to recognise center and group
        } else if (actionForm.getOfficeHierarchy().equals("6") || actionForm.getOfficeHierarchy().equals("7")) {
            if (actionForm.getOfficeHierarchy().equals(String.valueOf(officeDto.getOfficeLevelId()))) {
                officesList = new OfficesList(officeDto.getCustomerId(), officeDto.getDisplayName(), officeDto.getCustomerLevelId(), officeDto.getGlobalCustomerNumber());
                offices.add(officesList);
            }
        //			officeDetailsDtos = accountingServiceFacade
        //					.loadCustomerForLevel(new Short("3"));
        //		} else if (actionForm.getOfficeHierarchy().equals("7")) { // to
        //																	// recognize
        //																	// group
        //			officeDetailsDtos = accountingServiceFacade
        //					.loadCustomerForLevel(new Short("2"));
        } else {
            if (actionForm.getOfficeHierarchy().equals(String.valueOf(officeDto.getOfficeLevelId()))) {
                officesList = new OfficesList(officeDto.getOfficeId(), officeDto.getDisplayName(), officeDto.getOfficeLevelId(), officeDto.getGlobalOfficeNumber());
                offices.add(officesList);
            }
        }
    }
    //		storingSession(request, "OfficesOnHierarchy", officeDetailsDtos);
    storingSession(request, "DynamicOfficesOnHierarchy", offices);
    return mapping.findForward(ActionForwards.load_success.toString());
}
Also used : OfficeGlobalDto(org.mifos.dto.domain.OfficeGlobalDto) OfficesList(org.mifos.dto.domain.OfficesList) UserContext(org.mifos.security.util.UserContext) ArrayList(java.util.ArrayList) DynamicOfficeDto(org.mifos.dto.domain.DynamicOfficeDto) MultipleGeneralLedgerActionForm(org.mifos.accounting.struts.actionform.MultipleGeneralLedgerActionForm)

Aggregations

MultipleGeneralLedgerActionForm (org.mifos.accounting.struts.actionform.MultipleGeneralLedgerActionForm)9 GLCodeDto (org.mifos.dto.domain.GLCodeDto)4 ArrayList (java.util.ArrayList)3 OfficesList (org.mifos.dto.domain.OfficesList)3 List (java.util.List)2 UserContext (org.mifos.security.util.UserContext)2 DynamicOfficeDto (org.mifos.dto.domain.DynamicOfficeDto)1 OfficeGlobalDto (org.mifos.dto.domain.OfficeGlobalDto)1 RolesActivityDto (org.mifos.dto.domain.RolesActivityDto)1