Search in sources :

Example 6 with GlDetailBO

use of org.mifos.application.accounting.business.GlDetailBO in project head by mifos.

the class SingleGeneralLedgerAction method insertionSaveAndStage.

public void insertionSaveAndStage(SingleGeneralLedgerActionForm actionForm, HttpServletRequest request, int stage) {
    List<String> amountActionList = getAmountAction(actionForm);
    List<GlDetailBO> glDetailBOList = getGlDetailBOList(actionForm, amountActionList);
    GlMasterBO glMasterBO = new GlMasterBO();
    glMasterBO.setTransactionDate(DateUtils.getDate(actionForm.getTrxnDate()));
    glMasterBO.setTransactionType(actionForm.getTrxnType());
    glMasterBO.setFromOfficeLevel(new Integer(actionForm.getOfficeHierarchy()));
    glMasterBO.setFromOfficeId(actionForm.getOffice());
    glMasterBO.setToOfficeLevel(new Integer(actionForm.getOfficeHierarchy()));
    glMasterBO.setToOfficeId(actionForm.getOffice());
    glMasterBO.setMainAccount(actionForm.getMainAccount());
    glMasterBO.setTransactionAmount(new BigDecimal(actionForm.getAmount()));
    glMasterBO.setAmountAction(amountActionList.get(0));
    glMasterBO.setTransactionNarration(actionForm.getNotes());
    glMasterBO.setGlDetailBOList(glDetailBOList);
    // default value
    glMasterBO.setStatus("");
    // default value
    glMasterBO.setTransactionBy(0);
    glMasterBO.setStage(stage);
    glMasterBO.setMemberId(actionForm.getMemberId());
    glMasterBO.setCreatedBy(getUserContext(request).getId());
    glMasterBO.setCreatedDate(DateUtils.getCurrentDateWithoutTimeStamp());
    if (stage == 0) {
        accountingServiceFacade.savingStageAccountingTransactions(glMasterBO);
    } else {
        accountingServiceFacade.savingAccountingTransactions(glMasterBO);
    }
}
Also used : GlMasterBO(org.mifos.application.accounting.business.GlMasterBO) BigDecimal(java.math.BigDecimal) GlDetailBO(org.mifos.application.accounting.business.GlDetailBO)

Example 7 with GlDetailBO

use of org.mifos.application.accounting.business.GlDetailBO in project head by mifos.

the class SingleGeneralLedgerAction method getGlDetailBOList.

List<GlDetailBO> getGlDetailBOList(SingleGeneralLedgerActionForm actionForm, List<String> amountActionList) {
    List<GlDetailBO> glDetailBOList = new ArrayList<GlDetailBO>();
    glDetailBOList.add(new GlDetailBO(actionForm.getAccountHead(), new BigDecimal(actionForm.getAmount()), amountActionList.get(1), actionForm.getChequeNo(), DateUtils.getDate(actionForm.getChequeDate()), actionForm.getBankName(), actionForm.getBankBranch(), actionForm.getNotes()));
    return glDetailBOList;
}
Also used : ArrayList(java.util.ArrayList) BigDecimal(java.math.BigDecimal) GlDetailBO(org.mifos.application.accounting.business.GlDetailBO)

Example 8 with GlDetailBO

use of org.mifos.application.accounting.business.GlDetailBO 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 9 with GlDetailBO

use of org.mifos.application.accounting.business.GlDetailBO in project head by mifos.

the class ConsolidatedTransactionAction method getGlDetailBOList.

List<GlDetailBO> getGlDetailBOList(ConsolidatedTransactionActionForm actionForm, List<String> amountActionList, int transactionDetailID) {
    List<GlDetailBO> glDetailBOList = new ArrayList<GlDetailBO>();
    glDetailBOList.add(new GlDetailBO(transactionDetailID, actionForm.getStageAccountHead(), new BigDecimal(actionForm.getStageAmount()), amountActionList.get(1), actionForm.getStageChequeNo(), DateUtils.getDate(actionForm.getChequeDate()), actionForm.getStageBankName(), actionForm.getStageankBranch()));
    return glDetailBOList;
}
Also used : ArrayList(java.util.ArrayList) BigDecimal(java.math.BigDecimal) GlDetailBO(org.mifos.application.accounting.business.GlDetailBO)

Example 10 with GlDetailBO

use of org.mifos.application.accounting.business.GlDetailBO in project head by mifos.

the class InterOfficeTransferAction method submitSaveAndStage.

public void submitSaveAndStage(InterOfficeTransferActionForm actionForm, HttpServletRequest request, int stage) {
    List<String> amountActionList = getAmountAction(actionForm);
    List<GlDetailBO> glDetailBOList = getGlDetailBOList(actionForm, amountActionList);
    GlMasterBO glMasterBO = new GlMasterBO();
    glMasterBO.setTransactionDate(DateUtils.getDate(actionForm.getTrxnDate()));
    glMasterBO.setTransactionType(actionForm.getTrxnType());
    glMasterBO.setFromOfficeLevel(new Integer(actionForm.getFromOfficeHierarchy()));
    glMasterBO.setFromOfficeId(actionForm.getFromOffice());
    glMasterBO.setToOfficeLevel(new Integer(actionForm.getToOfficeHierarchy()));
    glMasterBO.setToOfficeId(actionForm.getFromOffice());
    glMasterBO.setMainAccount(actionForm.getDebitAccountHead());
    glMasterBO.setTransactionAmount(new BigDecimal(actionForm.getAmount()));
    glMasterBO.setAmountAction(amountActionList.get(0));
    glMasterBO.setTransactionNarration(actionForm.getNotes());
    glMasterBO.setGlDetailBOList(glDetailBOList);
    // default value
    glMasterBO.setStatus("");
    // default value
    glMasterBO.setTransactionBy(0);
    glMasterBO.setCreatedBy(getUserContext(request).getId());
    glMasterBO.setCreatedDate(DateUtils.getCurrentDateWithoutTimeStamp());
    conditionForSaving(glMasterBO, stage);
    List<GlDetailBO> interOfficeGLDetailBOList = getInterOfficeGlDetailBOList(actionForm, amountActionList);
    GlMasterBO interOfficeGlMasterBO = new GlMasterBO();
    interOfficeGlMasterBO.setTransactionDate(DateUtils.getDate(actionForm.getTrxnDate()));
    interOfficeGlMasterBO.setTransactionType(actionForm.getTrxnType());
    interOfficeGlMasterBO.setFromOfficeLevel(new Integer(actionForm.getToOfficeHierarchy()));
    interOfficeGlMasterBO.setFromOfficeId(actionForm.getToOffice());
    interOfficeGlMasterBO.setToOfficeLevel(new Integer(actionForm.getFromOfficeHierarchy()));
    interOfficeGlMasterBO.setToOfficeId(actionForm.getToOffice());
    interOfficeGlMasterBO.setMainAccount("11301");
    interOfficeGlMasterBO.setTransactionAmount(new BigDecimal(actionForm.getAmount()));
    interOfficeGlMasterBO.setAmountAction(amountActionList.get(0));
    interOfficeGlMasterBO.setTransactionNarration(actionForm.getNotes());
    interOfficeGlMasterBO.setGlDetailBOList(interOfficeGLDetailBOList);
    // default value
    interOfficeGlMasterBO.setStatus("");
    // default value
    interOfficeGlMasterBO.setTransactionBy(0);
    interOfficeGlMasterBO.setCreatedBy(getUserContext(request).getId());
    interOfficeGlMasterBO.setCreatedDate(DateUtils.getCurrentDateWithoutTimeStamp());
    conditionForSaving(interOfficeGlMasterBO, stage);
}
Also used : GlMasterBO(org.mifos.application.accounting.business.GlMasterBO) BigDecimal(java.math.BigDecimal) GlDetailBO(org.mifos.application.accounting.business.GlDetailBO)

Aggregations

GlDetailBO (org.mifos.application.accounting.business.GlDetailBO)22 BigDecimal (java.math.BigDecimal)21 ArrayList (java.util.ArrayList)12 GlMasterBO (org.mifos.application.accounting.business.GlMasterBO)11 GLCodeDto (org.mifos.dto.domain.GLCodeDto)3 ParseException (java.text.ParseException)2 HttpSession (javax.servlet.http.HttpSession)2 ViewStageTransactionActionForm (org.mifos.accounting.struts.actionform.ViewStageTransactionActionForm)2 CoaNamesDto (org.mifos.dto.domain.CoaNamesDto)2 GlDetailDto (org.mifos.dto.domain.GlDetailDto)2 OfficeGlobalDto (org.mifos.dto.domain.OfficeGlobalDto)2 ViewStageTransactionsDto (org.mifos.dto.domain.ViewStageTransactionsDto)2 VoucherBranchMappingActionForm (org.mifos.accounting.struts.actionform.VoucherBranchMappingActionForm)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1