Search in sources :

Example 1 with ConsolidatedTransactionActionForm

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

the class ConsolidatedTransactionAction method load.

public ActionForward load(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    logger.debug("start Load method of loan Product Action");
    ConsolidatedTransactionActionForm actionForm = (ConsolidatedTransactionActionForm) form;
    java.util.Date trxnDate = DateUtils.getCurrentDateWithoutTimeStamp();
    List<OfficeGlobalDto> officeDetailsDtos = null;
    UserContext context = getUserContext(request);
    actionForm.setOfficeLevelId(String.valueOf(context.getOfficeLevelId()));
    List<OfficesList> offices = new ArrayList<OfficesList>();
    short branches = 5;
    officeDetailsDtos = accountingServiceFacade.loadOfficesForLevel(branches);
    List<GLCodeDto> accountingDtos = accountingServiceFacade.coaBranchAccountHead();
    storingSession(request, "viewStageTransactionsDtoCRBRListValues", null);
    storingSession(request, "viewStageTransactionsDtoCPBPListValues", null);
    storingSession(request, "viewStageTransactionsDtoCRMisListValues", null);
    storingSession(request, "viewStageTransactionsDtoCPMisListValues", null);
    storingSession(request, "viewStageTransactionsDtoInterOfficeList", null);
    storingSession(request, "OfficesOnHierarchy", null);
    actionForm.setTransactiondate("");
    actionForm.setCptotal("0");
    actionForm.setCrtotal("0");
    actionForm.setBranch("");
    storingSession(request, "OfficesOnHierarchy", officeDetailsDtos);
    return mapping.findForward(ActionForwards.load_success.toString());
}
Also used : OfficeGlobalDto(org.mifos.dto.domain.OfficeGlobalDto) GLCodeDto(org.mifos.dto.domain.GLCodeDto) OfficesList(org.mifos.dto.domain.OfficesList) Date(java.util.Date) UserContext(org.mifos.security.util.UserContext) ArrayList(java.util.ArrayList) ConsolidatedTransactionActionForm(org.mifos.accounting.struts.actionform.ConsolidatedTransactionActionForm)

Example 2 with ConsolidatedTransactionActionForm

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

the class ConsolidatedTransactionAction method reject.

public ActionForward reject(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    ConsolidatedTransactionActionForm actionForm = (ConsolidatedTransactionActionForm) form;
    String[] Transactionno = actionForm.getTransactionNo();
    if (Transactionno != null) {
        for (int i = 0; i < Transactionno.length; i++) {
            int transactioncrbrNoValue = Integer.parseInt(Transactionno[i]);
            accountingServiceFacade.approveStageAccountingTransactions(transactioncrbrNoValue, ConsolidatedTransactionActionForm.rejectStage);
        }
    }
    String[] cpbpTransactionNO = actionForm.getTransactionCpBpNo();
    if (cpbpTransactionNO != null) {
        for (int i = 0; i < cpbpTransactionNO.length; i++) {
            int transactioncpbpNoValue = Integer.parseInt(cpbpTransactionNO[i]);
            accountingServiceFacade.approveStageAccountingTransactions(transactioncpbpNoValue, ConsolidatedTransactionActionForm.rejectStage);
        }
    }
    return mapping.findForward("submit_success");
}
Also used : ConsolidatedTransactionActionForm(org.mifos.accounting.struts.actionform.ConsolidatedTransactionActionForm)

Example 3 with ConsolidatedTransactionActionForm

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

the class ConsolidatedTransactionAction method approve.

public ActionForward approve(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    ConsolidatedTransactionActionForm actionForm = (ConsolidatedTransactionActionForm) form;
    String[] Transactionno = actionForm.getTransactionNo();
    if (Transactionno != null) {
        for (int i = 0; i < Transactionno.length; i++) {
            String transactionNoValue = Transactionno[i];
            approveCRBRTransactions(actionForm, transactionNoValue, request);
        }
    }
    String[] cpbpTransactionNO = actionForm.getTransactionCpBpNo();
    if (cpbpTransactionNO != null) {
        for (int i = 0; i < cpbpTransactionNO.length; i++) {
            String transactioncpbpNoValue = cpbpTransactionNO[i];
            approveCPBPTransactions(actionForm, transactioncpbpNoValue, request);
        }
    }
    return mapping.findForward("submit_success");
}
Also used : ConsolidatedTransactionActionForm(org.mifos.accounting.struts.actionform.ConsolidatedTransactionActionForm)

Example 4 with ConsolidatedTransactionActionForm

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

the class ConsolidatedTransactionAction method loadConsolidatedTransaction.

public ActionForward loadConsolidatedTransaction(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    logger.debug("start Load method of loan Product Action");
    ConsolidatedTransactionActionForm actionForm = (ConsolidatedTransactionActionForm) form;
    String[] s = null;
    actionForm.setTransactionCpBpNo(s);
    actionForm.setTransactionNo(s);
    String lastupdatedateStringvalue = accountingServiceFacade.getLastProcessUpdatedDate(actionForm.getBranch());
    //LocalDate localDate=new LocalDate(lastupdatedateStringvalue).plusDays(1);
    //Date date=localDate.toDateMidnight().toDate();
    DateFormat df = new SimpleDateFormat("dd/mm/yyyy");
    String date1 = "01/01/2012";
    Date startDate;
    try {
        startDate = df.parse(lastupdatedateStringvalue);
        startDate.setDate(startDate.getDate() + 1);
        String newDateString = df.format(startDate);
        Date date2 = df.parse(date1);
        if (date1.equalsIgnoreCase(lastupdatedateStringvalue)) {
            actionForm.setLastProcessDate(accountingServiceFacade.getLastProcessUpdatedDate(actionForm.getBranch()));
            actionForm.setTransactiondate(accountingServiceFacade.getLastProcessUpdatedDate(actionForm.getBranch()));
        } else {
            actionForm.setLastProcessDate(newDateString);
            actionForm.setTransactiondate(newDateString);
        }
    } catch (ParseException e) {
        e.printStackTrace();
    }
    List<ViewStageTransactionsDto> viewStageTransactionsDtos = accountingServiceFacade.getConsolidatedTransactions(actionForm.getBranch());
    List<ViewStageTransactionsDto> viewStageTransactionsDtoCRBRList = new ArrayList<ViewStageTransactionsDto>();
    List<ViewStageTransactionsDto> viewStageTransactionsDtoCPBPList = new ArrayList<ViewStageTransactionsDto>();
    List<ViewStageTransactionsDto> viewStageTransactionsDtoCPMisList = new ArrayList<ViewStageTransactionsDto>();
    List<ViewStageTransactionsDto> viewStageTransactionsDtoCRMisList = new ArrayList<ViewStageTransactionsDto>();
    List<ViewStageTransactionsDto> viewStageTransactionsDtoInterOfficeList = new ArrayList<ViewStageTransactionsDto>();
    //Cash Payment
    double crbrTotal = 0;
    double cpbpTotal = 0;
    for (ViewStageTransactionsDto viewStageTransactionsDtosvalues : viewStageTransactionsDtos) {
        if (viewStageTransactionsDtosvalues.getTransactionType().equalsIgnoreCase("Cash Receipt")) {
            if (viewStageTransactionsDtosvalues.getNarration().equalsIgnoreCase("Mis Processing")) {
                crbrTotal = crbrTotal + Double.parseDouble(viewStageTransactionsDtosvalues.getTransactionAmount());
                viewStageTransactionsDtoCRMisList.add(viewStageTransactionsDtosvalues);
            }
        } else if (viewStageTransactionsDtosvalues.getTransactionType().equalsIgnoreCase("Cash Payment")) {
            if (viewStageTransactionsDtosvalues.getNarration().equalsIgnoreCase("Mis Processing")) {
                cpbpTotal = cpbpTotal + Double.parseDouble(viewStageTransactionsDtosvalues.getTransactionAmount());
                viewStageTransactionsDtoCPMisList.add(viewStageTransactionsDtosvalues);
            }
        } else if (viewStageTransactionsDtosvalues.getMainAccount().equalsIgnoreCase("Inter office Transfers")) {
            crbrTotal = crbrTotal + Double.parseDouble(viewStageTransactionsDtosvalues.getTransactionAmount());
            viewStageTransactionsDtoInterOfficeList.add(viewStageTransactionsDtosvalues);
        }
    }
    for (ViewStageTransactionsDto viewStageTransactionsDtosvalues : viewStageTransactionsDtos) {
        if (viewStageTransactionsDtosvalues.getTransactionType().equalsIgnoreCase("Cash Receipt") || viewStageTransactionsDtosvalues.getTransactionType().equalsIgnoreCase("Bank Receipt")) {
            if (!viewStageTransactionsDtosvalues.getNarration().equalsIgnoreCase("Mis Processing")) {
                crbrTotal = crbrTotal + Double.parseDouble(viewStageTransactionsDtosvalues.getTransactionAmount());
                viewStageTransactionsDtoCRBRList.add(viewStageTransactionsDtosvalues);
            }
        } else if (viewStageTransactionsDtosvalues.getTransactionType().equalsIgnoreCase("Bank Payment") || viewStageTransactionsDtosvalues.getTransactionType().equalsIgnoreCase("Cash Payment")) {
            if (!viewStageTransactionsDtosvalues.getNarration().equalsIgnoreCase("Mis Processing")) {
                cpbpTotal = cpbpTotal + Double.parseDouble(viewStageTransactionsDtosvalues.getTransactionAmount());
                viewStageTransactionsDtoCPBPList.add(viewStageTransactionsDtosvalues);
            }
        }
    }
    actionForm.setCrtotal(Double.toString(crbrTotal));
    actionForm.setCptotal(Double.toString(cpbpTotal));
    storingSession(request, "ConsolidatedTransactionActionForm", actionForm);
    storingSession(request, "viewStageTransactionsDtoCRBRListValues", viewStageTransactionsDtoCRBRList);
    storingSession(request, "viewStageTransactionsDtoCPBPListValues", viewStageTransactionsDtoCPBPList);
    storingSession(request, "viewStageTransactionsDtoCRMisListValues", viewStageTransactionsDtoCRMisList);
    storingSession(request, "viewStageTransactionsDtoCPMisListValues", viewStageTransactionsDtoCPMisList);
    storingSession(request, "viewStageTransactionsDtoInterOfficeList", viewStageTransactionsDtoInterOfficeList);
    return mapping.findForward(ActionForwards.load_success.toString());
}
Also used : SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) ArrayList(java.util.ArrayList) ConsolidatedTransactionActionForm(org.mifos.accounting.struts.actionform.ConsolidatedTransactionActionForm) ViewStageTransactionsDto(org.mifos.dto.domain.ViewStageTransactionsDto) ParseException(java.text.ParseException) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Aggregations

ConsolidatedTransactionActionForm (org.mifos.accounting.struts.actionform.ConsolidatedTransactionActionForm)4 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 DateFormat (java.text.DateFormat)1 ParseException (java.text.ParseException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 GLCodeDto (org.mifos.dto.domain.GLCodeDto)1 OfficeGlobalDto (org.mifos.dto.domain.OfficeGlobalDto)1 OfficesList (org.mifos.dto.domain.OfficesList)1 ViewStageTransactionsDto (org.mifos.dto.domain.ViewStageTransactionsDto)1 UserContext (org.mifos.security.util.UserContext)1