Search in sources :

Example 1 with ViewGlTransactionPaginaitonVariablesDto

use of org.mifos.dto.domain.ViewGlTransactionPaginaitonVariablesDto in project head by mifos.

the class ViewGlTransactionsAction method submit.

public ActionForward submit(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    ViewGlTransactionsActionForm actionForm = (ViewGlTransactionsActionForm) 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<ViewTransactionsDto> viewTransactionsDtos = accountingServiceFacade.getAccountingTransactions(DateUtils.getDate(actionForm.getToTrxnDate()), DateUtils.getDate(actionForm.getFromTrxnDate()), iPageNo, noOfRecordsPerPage);
    storingSession(request, "ViewTransactionsDtos", viewTransactionsDtos);
    // // this will count total number of rows
    totalNoOfRowsForPagination = accountingServiceFacade.getNumberOfTransactions(DateUtils.getDate(actionForm.getToTrxnDate()), DateUtils.getDate(actionForm.getFromTrxnDate()));
    // // 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("submit_success");
}
Also used : ViewGlTransactionsActionForm(org.mifos.accounting.struts.actionform.ViewGlTransactionsActionForm) ViewTransactionsDto(org.mifos.dto.domain.ViewTransactionsDto) ViewGlTransactionPaginaitonVariablesDto(org.mifos.dto.domain.ViewGlTransactionPaginaitonVariablesDto)

Example 2 with ViewGlTransactionPaginaitonVariablesDto

use of org.mifos.dto.domain.ViewGlTransactionPaginaitonVariablesDto 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 3 with ViewGlTransactionPaginaitonVariablesDto

use of org.mifos.dto.domain.ViewGlTransactionPaginaitonVariablesDto in project head by mifos.

the class AuditTransactionAction method pickDate.

public ActionForward pickDate(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);
    }
    actionForm.getToTrxnDate();
    actionForm.getFromTrxnDate();
    List<ViewStageTransactionsDto> viewStageTransactionsDtos = accountingServiceFacade.getStageAccountingTransactions(DateUtils.getDate(actionForm.getFromTrxnDate()), DateUtils.getDate(actionForm.getToTrxnDate()), iPageNo, noOfRecordsPerPage);
    storingSession(request, "ViewStageTransactionsDtos", viewStageTransactionsDtos);
    // this will count total number of rows
    totalNoOfRowsForPagination = accountingServiceFacade.getNumberOfStageTransactions(DateUtils.getDate(actionForm.getFromTrxnDate()), DateUtils.getDate(actionForm.getToTrxnDate()));
    // // 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)

Aggregations

ViewGlTransactionPaginaitonVariablesDto (org.mifos.dto.domain.ViewGlTransactionPaginaitonVariablesDto)3 ViewStageTransactionActionForm (org.mifos.accounting.struts.actionform.ViewStageTransactionActionForm)2 ViewStageTransactionsDto (org.mifos.dto.domain.ViewStageTransactionsDto)2 ViewGlTransactionsActionForm (org.mifos.accounting.struts.actionform.ViewGlTransactionsActionForm)1 ViewTransactionsDto (org.mifos.dto.domain.ViewTransactionsDto)1