Search in sources :

Example 1 with ViewGlTransactionsActionForm

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

the class ViewGlTransactionsAction method load.

public ActionForward load(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    ViewGlTransactionsActionForm actionForm = (ViewGlTransactionsActionForm) form;
    java.util.Date trxnDate = DateUtils.getCurrentDateWithoutTimeStamp();
    actionForm.setToTrxnDate(trxnDate);
    return mapping.findForward(ActionForwards.load_success.toString());
}
Also used : ViewGlTransactionsActionForm(org.mifos.accounting.struts.actionform.ViewGlTransactionsActionForm)

Example 2 with ViewGlTransactionsActionForm

use of org.mifos.accounting.struts.actionform.ViewGlTransactionsActionForm 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)

Aggregations

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