Search in sources :

Example 11 with ViewStageTransactionActionForm

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

the class ViewStageTransactionAction method loadAccountHeads.

public ActionForward loadAccountHeads(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    ViewStageTransactionActionForm actionForm = (ViewStageTransactionActionForm) form;
    List<GLCodeDto> accountingDtos = null;
    accountingDtos = accountingServiceFacade.accountHead(actionForm.getStageMainAccount());
    storingSession(request, "AccountHeadGlCodes", accountingDtos);
    return mapping.findForward("load_stage_success");
}
Also used : GLCodeDto(org.mifos.dto.domain.GLCodeDto) ViewStageTransactionActionForm(org.mifos.accounting.struts.actionform.ViewStageTransactionActionForm)

Example 12 with ViewStageTransactionActionForm

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

the class ViewStageTransactionAction method preview.

public ActionForward preview(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    ViewStageTransactionActionForm actionForm = (ViewStageTransactionActionForm) form;
    if (actionForm.getStageTrxnType().equals("CP") || actionForm.getStageTrxnType().equals("CR") || actionForm.getStageTrxnType().equals("JV")) {
        actionForm.setChequeDate(null);
        actionForm.setStageChequeNo(null);
        actionForm.setStageBankName(null);
        actionForm.setStageankBranch(null);
    }
    storingSession(request, "viewtransactionstageactionform", actionForm);
    return mapping.findForward("preview_success");
}
Also used : ViewStageTransactionActionForm(org.mifos.accounting.struts.actionform.ViewStageTransactionActionForm)

Example 13 with ViewStageTransactionActionForm

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

the class ViewStageTransactionAction method submit.

public ActionForward submit(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    HttpSession session = request.getSession(true);
    ViewStageTransactionActionForm actionForm = (ViewStageTransactionActionForm) form;
    GlMasterBO glMasterBO = new GlMasterBO();
    List<String> amountActionList = getAmountAction(actionForm);
    List<GlDetailBO> glDetailBOList = getGlDetailBOList(actionForm, amountActionList, Integer.parseInt(actionForm.getTransactionDetailID()));
    glMasterBO.setTransactionMasterId(Integer.parseInt(actionForm.getStageTransactionNo()));
    glMasterBO.setTransactionDate(DateUtils.getDate(actionForm.getStageTrxnDate()));
    glMasterBO.setTransactionType(actionForm.getStageTrxnType());
    glMasterBO.setFromOfficeLevel(new Integer(actionForm.getStageOfficeHierarchy()));
    glMasterBO.setFromOfficeId(actionForm.getStageOffice());
    glMasterBO.setToOfficeLevel(new Integer(actionForm.getStageOfficeHierarchy()));
    glMasterBO.setToOfficeId(actionForm.getStageOffice());
    glMasterBO.setMainAccount(actionForm.getStageMainAccount());
    glMasterBO.setTransactionAmount(new BigDecimal(actionForm.getStageAmount()));
    glMasterBO.setAmountAction(amountActionList.get(0));
    glMasterBO.setTransactionNarration(actionForm.getStageNotes());
    glMasterBO.setGlDetailBOList(glDetailBOList);
    // default value
    glMasterBO.setStatus("");
    // default value
    glMasterBO.setTransactionBy(0);
    glMasterBO.setCreatedBy(getUserContext(request).getId());
    glMasterBO.setCreatedDate(DateUtils.getCurrentDateWithoutTimeStamp());
    accountingServiceFacade.savingStageAccountingTransactions(glMasterBO);
    return mapping.findForward("submit_success");
}
Also used : HttpSession(javax.servlet.http.HttpSession) GlMasterBO(org.mifos.application.accounting.business.GlMasterBO) ViewStageTransactionActionForm(org.mifos.accounting.struts.actionform.ViewStageTransactionActionForm) BigDecimal(java.math.BigDecimal) GlDetailBO(org.mifos.application.accounting.business.GlDetailBO)

Example 14 with ViewStageTransactionActionForm

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

the class ViewStageTransactionAction method load.

public ActionForward load(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    ViewStageTransactionActionForm actionForm = (ViewStageTransactionActionForm) form;
    // Number of records show on per page
    int noOfRecordsPerPage = 10;
    // Number of pages index shown
    int noOfPagesIndex = 10;
    /*
		 * this program displays the pagination concept as view page displaying
		 * limited number of page links(number of page links value carrying with
		 * noOfPagesIndex)
		 */
    int totalNoOfRowsForPagination = nullIntconv(request.getParameter("totalNoOfRowsForPagination"));
    int iTotalPages = nullIntconv(request.getParameter("iTotalPages"));
    int iPageNo = nullIntconv(request.getParameter("iPageNo"));
    int cPageNo = nullIntconv(request.getParameter("cPageNo"));
    int startRecordCurrentPage = 0;
    int endRecordCurrentPage = 0;
    if (iPageNo == 0) {
        iPageNo = 0;
    } else {
        iPageNo = Math.abs((iPageNo - 1) * noOfRecordsPerPage);
    }
    List<ViewStageTransactionsDto> viewStageTransactionsDtos = accountingServiceFacade.getStageAccountingTransactions(null, iPageNo, noOfRecordsPerPage);
    storingSession(request, "ViewStageTransactionsDtos", viewStageTransactionsDtos);
    // this will count total number of rows
    totalNoOfRowsForPagination = accountingServiceFacade.getNumberOfStageTransactions();
    // // calculate next record start record and end record
    if (totalNoOfRowsForPagination < (iPageNo + noOfRecordsPerPage)) {
        endRecordCurrentPage = totalNoOfRowsForPagination;
    } else {
        endRecordCurrentPage = (iPageNo + noOfRecordsPerPage);
    }
    startRecordCurrentPage = (iPageNo + 1);
    iTotalPages = ((int) (Math.ceil((double) totalNoOfRowsForPagination / noOfRecordsPerPage)));
    // // index of pages
    int cPage = 0;
    cPage = ((int) (Math.ceil((double) endRecordCurrentPage / (noOfPagesIndex * noOfRecordsPerPage))));
    int prePageNo = (cPage * noOfPagesIndex) - // we can say it as
    ((noOfPagesIndex - 1) + noOfPagesIndex);
    // pre cPage
    int i = (cPage * noOfPagesIndex) + 1;
    ViewGlTransactionPaginaitonVariablesDto dto = new ViewGlTransactionPaginaitonVariablesDto();
    dto.setcPageNo(cPageNo);
    dto.setI(i);
    dto.setcPage(cPage);
    dto.setPrePageNo(prePageNo);
    dto.setNoOfPagesIndex(noOfPagesIndex);
    dto.setiPageNo(iPageNo);
    dto.setNoOfRecordsPerPage(noOfRecordsPerPage);
    dto.setiTotalPages(iTotalPages);
    dto.setStartRecordCurrentPage(startRecordCurrentPage);
    dto.setEndRecordCurrentPage(endRecordCurrentPage);
    dto.setTotalNoOfRowsForPagination(totalNoOfRowsForPagination);
    storingSession(request, "ViewGlTransactionPaginaitonVariablesDto", dto);
    return mapping.findForward("load_success");
}
Also used : ViewStageTransactionActionForm(org.mifos.accounting.struts.actionform.ViewStageTransactionActionForm) ViewStageTransactionsDto(org.mifos.dto.domain.ViewStageTransactionsDto) ViewGlTransactionPaginaitonVariablesDto(org.mifos.dto.domain.ViewGlTransactionPaginaitonVariablesDto)

Example 15 with ViewStageTransactionActionForm

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

the class ApproveTransactions method approve.

public ActionForward approve(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    ViewStageTransactionActionForm actionForm = (ViewStageTransactionActionForm) form;
    String stageTransactionNo = request.getParameter("txnNo");
    ViewStageTransactionsDto viewStageTransactionsDto = accountingServiceFacade.getstagedAccountingTransactions(stageTransactionNo);
    actionForm.setStageTrxnDate(changeDateFormat(viewStageTransactionsDto.getTransactionDate().toString()));
    actionForm.setStageOfficeHierarchy(this.getOfficeHierarchy(viewStageTransactionsDto.getOfficeLevel()));
    actionForm.setStageTrxnType(getTranType(viewStageTransactionsDto.getTransactionType()));
    actionForm.setStageMainAccount(viewStageTransactionsDto.getMainAccount());
    viewStageTransactionsDto.getSubAccount();
    actionForm.setStageAccountHead(viewStageTransactionsDto.getSubAccount());
    actionForm.setStageOffice(viewStageTransactionsDto.getFromOfficeId());
    GlDetailDto glDetailDto = accountingServiceFacade.getChequeDetails(stageTransactionNo);
    if (glDetailDto != null) {
        actionForm.setStageChequeNo(glDetailDto.getChequeNo());
        if (glDetailDto.getChequeDate() != null) {
            actionForm.setChequeDate(changeDateFormat(glDetailDto.getChequeDate().toString()));
        }
        actionForm.setStageBankName(glDetailDto.getBankName());
        actionForm.setStageankBranch(glDetailDto.getBankBranch());
    }
    short s = new Integer(actionForm.getStageOfficeHierarchy()).shortValue();
    //load offices
    List<OfficeGlobalDto> officeDetailsDtos = null;
    if (actionForm.getStageOfficeHierarchy() == "0") {
        officeDetailsDtos = null;
    // To recognize center
    } else if (actionForm.getStageOfficeHierarchy() == "6") {
        officeDetailsDtos = accountingServiceFacade.loadCustomerForLevel(new Short("3"));
    // to recognize group
    } else if (actionForm.getStageOfficeHierarchy() == "7") {
        officeDetailsDtos = accountingServiceFacade.loadCustomerForLevel(new Short("2"));
    } else {
        officeDetailsDtos = accountingServiceFacade.loadOfficesForLevel(s);
    }
    storingSession(request, "OfficesOnHierarchy", officeDetailsDtos);
    // load main accounts
    List<GLCodeDto> accountingDtos = null;
    if (actionForm.getStageTrxnType().equals("CR") || actionForm.getStageTrxnType().equals("CP") || actionForm.getStageTrxnType().equals("BR") || actionForm.getStageTrxnType().equals("BP") || actionForm.getStageTrxnType().equals("JV")) {
        accountingDtos = accountingServiceFacade.auditAccountHeads();
    }
    //		if (actionForm.getStageTrxnType().equals("CR")
    //				|| actionForm.getStageTrxnType().equals("CP")) {
    //			accountingDtos = accountingServiceFacade.mainAccountForCash();
    //		} else if (actionForm.getStageTrxnType().equals("BR")
    //				|| actionForm.getStageTrxnType().equals("BP")) {
    //			accountingDtos = accountingServiceFacade.mainAccountForBank();
    //
    //		}else if (actionForm.getStageTrxnType()== null){
    //			return mapping.findForward("in_progress");
    //		}
    storingSession(request, "MainAccountGlCodes", accountingDtos);
    storingSession(request, "stageTransactionNo", stageTransactionNo);
    actionForm.setTransactionDetailID(new Integer(viewStageTransactionsDto.getTransactionID()).toString());
    actionForm.setStageMainAccount(viewStageTransactionsDto.getMainAccount());
    actionForm.setStageAccountHead(viewStageTransactionsDto.getSubAccount());
    actionForm.setStageNotes(viewStageTransactionsDto.getNarration());
    actionForm.setStageAmount(viewStageTransactionsDto.getTransactionAmount());
    storingSession(request, "ViewStageTransactionsDto", viewStageTransactionsDto);
    List<GLCodeDto> accountingGlDtos = null;
    accountingGlDtos = accountingServiceFacade.accountHead(actionForm.getStageMainAccount());
    storingSession(request, "AccountHeadGlCodes", accountingGlDtos);
    return mapping.findForward("approve_success");
}
Also used : OfficeGlobalDto(org.mifos.dto.domain.OfficeGlobalDto) GLCodeDto(org.mifos.dto.domain.GLCodeDto) ViewStageTransactionActionForm(org.mifos.accounting.struts.actionform.ViewStageTransactionActionForm) GlDetailDto(org.mifos.dto.domain.GlDetailDto) ViewStageTransactionsDto(org.mifos.dto.domain.ViewStageTransactionsDto)

Aggregations

ViewStageTransactionActionForm (org.mifos.accounting.struts.actionform.ViewStageTransactionActionForm)20 GLCodeDto (org.mifos.dto.domain.GLCodeDto)9 OfficeGlobalDto (org.mifos.dto.domain.OfficeGlobalDto)6 ViewStageTransactionsDto (org.mifos.dto.domain.ViewStageTransactionsDto)5 GlDetailDto (org.mifos.dto.domain.GlDetailDto)3 BigDecimal (java.math.BigDecimal)2 HttpSession (javax.servlet.http.HttpSession)2 GlDetailBO (org.mifos.application.accounting.business.GlDetailBO)2 GlMasterBO (org.mifos.application.accounting.business.GlMasterBO)2 ViewGlTransactionPaginaitonVariablesDto (org.mifos.dto.domain.ViewGlTransactionPaginaitonVariablesDto)2