Search in sources :

Example 6 with ViewStageTransactionsDto

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

use of org.mifos.dto.domain.ViewStageTransactionsDto 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)

Example 8 with ViewStageTransactionsDto

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

the class AuditTransactionAction method audit.

public ActionForward audit(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());
    short s = new Integer(actionForm.getStageOfficeHierarchy()).shortValue();
    GlDetailDto glDetailDto = accountingServiceFacade.getChequeDetails(stageTransactionNo);
    if (!actionForm.getStageTrxnType().equals("CP") || !actionForm.getStageTrxnType().equals("CR")) {
        actionForm.setStageChequeNo(glDetailDto.getChequeNo());
        if (glDetailDto.getChequeDate() != null) {
            actionForm.setChequeDate(changeDateFormat(glDetailDto.getChequeDate().toString()));
        }
        actionForm.setStageBankName(glDetailDto.getBankName());
        actionForm.setStageankBranch(glDetailDto.getBankBranch());
    }
    // 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();
    }
    // else if (actionForm.getStageTrxnType().equals("BR")
    // || actionForm.getStageTrxnType().equals("BP")) {
    // accountingDtos = accountingServiceFacade.mainAccountForBank();
    //
    // }else if (actionForm.getStageTrxnType().equals("JV")){
    // accountingDtos = accountingServiceFacade.mainAccountForCash();
    // }
    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("audit_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)

Example 9 with ViewStageTransactionsDto

use of org.mifos.dto.domain.ViewStageTransactionsDto 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

ViewStageTransactionsDto (org.mifos.dto.domain.ViewStageTransactionsDto)9 ViewStageTransactionActionForm (org.mifos.accounting.struts.actionform.ViewStageTransactionActionForm)5 GLCodeDto (org.mifos.dto.domain.GLCodeDto)5 GlDetailDto (org.mifos.dto.domain.GlDetailDto)5 OfficeGlobalDto (org.mifos.dto.domain.OfficeGlobalDto)5 ParseException (java.text.ParseException)3 BigDecimal (java.math.BigDecimal)2 GlDetailBO (org.mifos.application.accounting.business.GlDetailBO)2 GlMasterBO (org.mifos.application.accounting.business.GlMasterBO)2 ViewGlTransactionPaginaitonVariablesDto (org.mifos.dto.domain.ViewGlTransactionPaginaitonVariablesDto)2 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 ConsolidatedTransactionActionForm (org.mifos.accounting.struts.actionform.ConsolidatedTransactionActionForm)1