Search in sources :

Example 1 with ViewStageTransactionsDto

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

the class ConsolidatedTransactionAction method approveCPBPTransactions.

public void approveCPBPTransactions(ConsolidatedTransactionActionForm actionForm, String TransactioncpbpNoValue, HttpServletRequest request) {
    ViewStageTransactionsDto viewStageTransactionsDto = accountingServiceFacade.getstagedAccountingTransactions(TransactioncpbpNoValue);
    try {
        if (viewStageTransactionsDto.getTransactionDate().toString() != null)
            actionForm.setStageTrxnDate(changeDateFormat(viewStageTransactionsDto.getTransactionDate().toString()));
        //actionForm.setStageTrxnDate(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());
    } catch (Exception e) {
        e.printStackTrace();
    }
    GlDetailDto glDetailDto = accountingServiceFacade.getChequeDetails(TransactioncpbpNoValue);
    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();
    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();
    }
    actionForm.setTransactionDetailID(viewStageTransactionsDto.getTransactionID());
    actionForm.setStageMainAccount(viewStageTransactionsDto.getMainAccount());
    actionForm.setStageAccountHead(viewStageTransactionsDto.getSubAccount());
    actionForm.setStageNotes(viewStageTransactionsDto.getNarration());
    actionForm.setStageAmount(viewStageTransactionsDto.getTransactionAmount());
    String[] cpbpTransactionNO1 = actionForm.getTransactionCpBpNo();
    for (int j = 0; j < cpbpTransactionNO1.length; j++) {
        GlMasterBO glMasterBO = new GlMasterBO();
        int stage = 1;
        List<String> amountActionList = getAmountAction(actionForm);
        List<GlDetailBO> glDetailBOList = getGlDetailBOList(actionForm, amountActionList, Integer.parseInt(actionForm.getTransactionDetailID()));
        glMasterBO.setTransactionMasterId(Integer.parseInt(cpbpTransactionNO1[j]));
        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.setStage(stage);
        glMasterBO.setGlDetailBOList(glDetailBOList);
        // default value
        glMasterBO.setStatus("");
        // default value
        glMasterBO.setTransactionBy(0);
        glMasterBO.setCreatedBy(getUserContext(request).getId());
        glMasterBO.setCreatedDate(DateUtils.getCurrentDateWithoutTimeStamp());
        accountingServiceFacade.savingAccountingTransactions(glMasterBO);
    }
}
Also used : OfficeGlobalDto(org.mifos.dto.domain.OfficeGlobalDto) GLCodeDto(org.mifos.dto.domain.GLCodeDto) GlDetailDto(org.mifos.dto.domain.GlDetailDto) ViewStageTransactionsDto(org.mifos.dto.domain.ViewStageTransactionsDto) ParseException(java.text.ParseException) BigDecimal(java.math.BigDecimal) GlMasterBO(org.mifos.application.accounting.business.GlMasterBO) GlDetailBO(org.mifos.application.accounting.business.GlDetailBO)

Example 2 with ViewStageTransactionsDto

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

the class AccountingServiceFacadeWebTier method getstagedAccountingTransactions.

// Hugo Technologies Edit Stage Transactions
@Override
public ViewStageTransactionsDto getstagedAccountingTransactions(String transactionNo) {
    ViewStageTransactionsDto viewStageTransactionsDto = null;
    List<ViewStageTransactionsDto> stageAccountingTransactions = null;
    stageAccountingTransactions = accountingDao.findStagedAccountingTransactionOnId(transactionNo);
    if (stageAccountingTransactions.size() > 0) {
        viewStageTransactionsDto = stageAccountingTransactions.get(0);
    }
    return viewStageTransactionsDto;
}
Also used : ViewStageTransactionsDto(org.mifos.dto.domain.ViewStageTransactionsDto)

Example 3 with ViewStageTransactionsDto

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

the class ConsolidatedTransactionAction method approveCRBRTransactions.

public void approveCRBRTransactions(ConsolidatedTransactionActionForm actionForm, String Transactionno, HttpServletRequest request) {
    ViewStageTransactionsDto viewStageTransactionsDto = accountingServiceFacade.getstagedAccountingTransactions(Transactionno);
    try {
        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());
    } catch (Exception e) {
        e.printStackTrace();
    }
    GlDetailDto glDetailDto = accountingServiceFacade.getChequeDetails(Transactionno);
    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();
    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();
    }
    actionForm.setTransactionDetailID(viewStageTransactionsDto.getTransactionID());
    actionForm.setStageMainAccount(viewStageTransactionsDto.getMainAccount());
    actionForm.setStageAccountHead(viewStageTransactionsDto.getSubAccount());
    actionForm.setStageNotes(viewStageTransactionsDto.getNarration());
    actionForm.setStageAmount(viewStageTransactionsDto.getTransactionAmount());
    String[] Transactionno1 = actionForm.getTransactionNo();
    String[] cpbpTransactionNO1 = actionForm.getTransactionCpBpNo();
    for (int j = 0; j < Transactionno1.length; j++) {
        GlMasterBO glMasterBO = new GlMasterBO();
        int stage = 1;
        List<String> amountActionList = getAmountAction(actionForm);
        List<GlDetailBO> glDetailBOList = getGlDetailBOList(actionForm, amountActionList, Integer.parseInt(actionForm.getTransactionDetailID()));
        glMasterBO.setTransactionMasterId(Integer.parseInt(Transactionno1[j]));
        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.setStage(stage);
        glMasterBO.setGlDetailBOList(glDetailBOList);
        // default value
        glMasterBO.setStatus("");
        // default value
        glMasterBO.setTransactionBy(0);
        glMasterBO.setCreatedBy(getUserContext(request).getId());
        glMasterBO.setCreatedDate(DateUtils.getCurrentDateWithoutTimeStamp());
        accountingServiceFacade.savingAccountingTransactions(glMasterBO);
    }
}
Also used : OfficeGlobalDto(org.mifos.dto.domain.OfficeGlobalDto) GLCodeDto(org.mifos.dto.domain.GLCodeDto) GlDetailDto(org.mifos.dto.domain.GlDetailDto) ViewStageTransactionsDto(org.mifos.dto.domain.ViewStageTransactionsDto) ParseException(java.text.ParseException) BigDecimal(java.math.BigDecimal) GlMasterBO(org.mifos.application.accounting.business.GlMasterBO) GlDetailBO(org.mifos.application.accounting.business.GlDetailBO)

Example 4 with ViewStageTransactionsDto

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

Example 5 with ViewStageTransactionsDto

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

the class ViewStageTransactionAction method edit.

public ActionForward edit(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 (glDetailDto != null) {
        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();
    }
    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(String.format("%.2f", Double.parseDouble(viewStageTransactionsDto.getTransactionAmount())));
    storingSession(request, "ViewStageTransactionsDto", viewStageTransactionsDto);
    List<GLCodeDto> accountingGlDtos = null;
    accountingGlDtos = accountingServiceFacade.accountHead(actionForm.getStageMainAccount());
    storingSession(request, "AccountHeadGlCodes", accountingGlDtos);
    return mapping.findForward("edit_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

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