예제 #1
0
 @Override
 public void prepare() {
   HibernateUtil.getCurrentSession().setDefaultReadOnly(true);
   HibernateUtil.getCurrentSession().setFlushMode(FlushMode.MANUAL);
   super.prepare();
   setupDropdownsInHeader();
 }
예제 #2
0
  /**
   * @param bankId
   * @return ChqPositions object
   * @throws TaskFailedException This method reads the data from master table to position the fields
   *     on the cheque for one specific Bank
   */
  public ChqPositions getChqPositions(String bankId) throws TaskFailedException {

    position = new ChqPositions();
    try {

      String getXYs =
          " Select cf.height, cfd.FIELD,cfd.XVALUE,cfd.YVALUE,cfd.LENGTH from eg_cheque_Format_detail cfd ,eg_cheque_Format cf  where cfd.headerid=cf.id and cf.bankid="
              + bankId
              + " order by cfd.id";
      rs = HibernateUtil.getCurrentSession().createSQLQuery(getXYs).list();
      for (Object[] element : rs) {
        ChqPosition pos = new ChqPosition();
        pos.setX(Float.parseFloat(element[2].toString()));
        pos.setY(Float.parseFloat(element[3].toString()));
        pos.setL(Float.parseFloat(element[4].toString()));
        if (element[1].toString().equalsIgnoreCase("date")) position.setDate(pos);
        else if (element[1].toString().equalsIgnoreCase("pay1")) position.setName1(pos);
        else if (element[1].toString().equalsIgnoreCase("pay2")) position.setName2(pos);
        else if (element[1].toString().equalsIgnoreCase("rupees1")) position.setAmount1(pos);
        else if (element[1].toString().equalsIgnoreCase("rupees2")) position.setAmount2(pos);
        else if (element[1].toString().equalsIgnoreCase("rs")) position.setRs(pos);
      }

    } catch (Exception e) {
      LOGGER.error("Exp in getChqPositions" + e.getMessage());
      throw new TaskFailedException(e.getMessage());
    }
    return position;
  }
예제 #3
0
  @SuppressWarnings("unchecked")
  private void prepareForView() {
    voucherHeader =
        (CVoucherHeader)
            HibernateUtil.getCurrentSession().load(CVoucherHeader.class, voucherHeader.getId());
    paymentheader =
        (Paymentheader)
            persistenceService.find("from Paymentheader where voucherheader=?", voucherHeader);
    advanceRequisition =
        (EgAdvanceRequisition)
            persistenceService.find(
                "from EgAdvanceRequisition where egAdvanceReqMises.voucherheader = ?",
                voucherHeader);
    advanceRequisitionId = advanceRequisition.getId();
    commonBean.setAmount(paymentheader.getPaymentAmount());
    commonBean.setAccountNumberId(paymentheader.getBankaccount().getId().toString());

    String bankBranchId =
        paymentheader.getBankaccount().getBankbranch().getBank().getId()
            + "-"
            + paymentheader.getBankaccount().getBankbranch().getId();
    commonBean.setBankId(bankBranchId);
    commonBean.setModeOfPayment(paymentheader.getType().toUpperCase());
    Miscbilldetail miscbillDetail =
        (Miscbilldetail)
            persistenceService.find(" from Miscbilldetail where payVoucherHeader=?", voucherHeader);

    commonBean.setPaidTo(miscbillDetail.getPaidto());
    loadAjaxedDropDowns();
    // find it last so that rest of the data loaded
    if (!"view".equalsIgnoreCase(showMode)) {
      validateUser("balancecheck");
    }
  }
예제 #4
0
  public Paymentheader getPayment() {
    String paymentid = null;
    if (parameters.get(PAYMENTID) == null) {
      Object obj = getSession().get(PAYMENTID);
      if (obj != null) {
        paymentid = (String) obj;
      }
    } else {
      paymentid = parameters.get(PAYMENTID)[0];
    }
    if (paymentheader == null && paymentid != null) {
      paymentheader =
          (Paymentheader)
              HibernateUtil.getCurrentSession().load(Paymentheader.class, Long.valueOf(paymentid));
    }
    if (paymentheader == null) {
      paymentheader = new Paymentheader();
    }

    return paymentheader;
  }
예제 #5
0
  @Action(value = "/deduction/autoRemittance-manualSchedule")
  public String manualSchedule() {
    try {
      coaMap = new LinkedHashMap<String, String>();
      List<Recovery> allActiveAutoRemitTds = tdsDAO.getAllActiveAutoRemitTds();

      for (Recovery r : allActiveAutoRemitTds) {
        coaMap.put(
            r.getChartofaccounts().getGlcode(),
            r.getChartofaccounts().getGlcode() + "-" + r.getChartofaccounts().getName());
      }

      addDropdownData("departmentList", masterCache.get("egi-department"));
      deptDOList =
          persistenceService.findAllBy("from DepartmentDOMapping where department is not null  ");

      List<Object[]> list =
          HibernateUtil.getCurrentSession()
              .createSQLQuery(
                  "select glcode, to_char(max(lastrundate),'dd/mm/yyyy') from egf_remittance_scheduler where glcode is not null and sch_type='A' "
                      + " GROUP by glcode order by glcode")
              .list();
      lastRunDateMap = new HashMap<String, String>();
      for (Object[] ob : list) {
        lastRunDateMap.put((String) ob[0], (String) ob[1]);
      }
    } catch (ApplicationRuntimeException e) {
      addActionError("failed");
    } catch (HibernateException e) {
      addActionError("failed");
    } catch (Exception e) {
      addActionError("failed");
    }

    return "manual";
  }
예제 #6
0
  private CVoucherHeader createVoucherAndledger() {
    try {
      final HashMap<String, Object> headerDetails = createHeaderAndMisDetails();
      headerDetails.put(
          VoucherConstant.SOURCEPATH, "/EGF/payment/advancePayment!view.action?voucherHeader.id=");
      HashMap<String, Object> detailMap = null;
      HashMap<String, Object> subledgertDetailMap = null;
      final List<HashMap<String, Object>> accountdetails = new ArrayList<HashMap<String, Object>>();
      final List<HashMap<String, Object>> subledgerDetails =
          new ArrayList<HashMap<String, Object>>();

      detailMap = new HashMap<String, Object>();
      detailMap.put(VoucherConstant.CREDITAMOUNT, advanceRequisition.getAdvanceRequisitionAmount());
      detailMap.put(VoucherConstant.DEBITAMOUNT, ZERO);
      Bankaccount account =
          (Bankaccount)
              HibernateUtil.getCurrentSession()
                  .load(Bankaccount.class, Integer.valueOf(commonBean.getAccountNumberId()));
      detailMap.put(VoucherConstant.GLCODE, account.getChartofaccounts().getGlcode());
      accountdetails.add(detailMap);
      Map<String, Object> glcodeMap = new HashMap<String, Object>();
      detailMap = new HashMap<String, Object>();

      detailMap.put(VoucherConstant.DEBITAMOUNT, advanceRequisition.getAdvanceRequisitionAmount());
      detailMap.put(VoucherConstant.CREDITAMOUNT, ZERO);
      for (EgAdvanceRequisitionDetails advanceRequisitionDetails :
          advanceRequisition.getEgAdvanceReqDetailses()) {
        detailMap.put(
            VoucherConstant.GLCODE, advanceRequisitionDetails.getChartofaccounts().getGlcode());
      }
      accountdetails.add(detailMap);
      glcodeMap.put(detailMap.get(VoucherConstant.GLCODE).toString(), VoucherConstant.DEBIT);

      subledgertDetailMap = new HashMap<String, Object>();
      for (EgAdvanceRequisitionDetails advanceDetail :
          advanceRequisition.getEgAdvanceReqDetailses()) {
        for (EgAdvanceReqPayeeDetails payeeDetail : advanceDetail.getEgAdvanceReqpayeeDetailses()) {
          subledgertDetailMap = new HashMap<String, Object>();
          subledgertDetailMap.put(VoucherConstant.DEBITAMOUNT, payeeDetail.getDebitAmount());
          subledgertDetailMap.put(VoucherConstant.CREDITAMOUNT, payeeDetail.getCreditAmount());
          subledgertDetailMap.put(
              VoucherConstant.DETAILTYPEID, payeeDetail.getAccountDetailType().getId());
          subledgertDetailMap.put(VoucherConstant.DETAILKEYID, payeeDetail.getAccountdetailKeyId());
          subledgertDetailMap.put(
              VoucherConstant.GLCODE, advanceDetail.getChartofaccounts().getGlcode());
          subledgerDetails.add(subledgertDetailMap);
        }
      }

      final CreateVoucher cv = new CreateVoucher();
      voucherHeader = cv.createPreApprovedVoucher(headerDetails, accountdetails, subledgerDetails);

    } catch (final HibernateException e) {
      LOGGER.error(e.getMessage(), e);
      throw new ValidationException(
          Arrays.asList(new ValidationError(EXCEPTION_WHILE_SAVING_DATA, FAILED)));
    } catch (final ApplicationRuntimeException e) {
      LOGGER.error(e.getMessage(), e);
      throw new ValidationException(
          Arrays.asList(new ValidationError(e.getMessage(), e.getMessage())));
    } catch (final ValidationException e) {
      LOGGER.error(e.getMessage(), e);
      throw e;
    } catch (final Exception e) {
      // handle engine exception
      LOGGER.error(e.getMessage(), e);
      throw new ValidationException(
          Arrays.asList(new ValidationError(e.getMessage(), e.getMessage())));
    }
    if (LOGGER.isDebugEnabled()) LOGGER.debug("Posted to Ledger " + voucherHeader.getId());
    return voucherHeader;
  }