コード例 #1
0
  public static RptCBpartnerData[] select(
      ConnectionProvider connectionProvider,
      String adLanguage,
      String cBpartnerId,
      int firstRegister,
      int numberRegisters)
      throws ServletException {
    String strSql = "";
    strSql =
        strSql
            + "        SELECT BP.C_BPARTNER_ID, BP.VALUE, AD_MESSAGE_GET2(BP.ISACTIVE, ?) AS ISACTIVE, TO_DATE(BP.CREATED) AS CREATED, TO_DATE(BP.UPDATED) AS UPDATED, "
            + "        BP.NAME, BP.NAME2, G.NAME AS GROUPNAME, BP.TAXID, '' AS ACCOUNTNO, AD_MESSAGE_GET2(BP.ISEMPLOYEE, ?) AS ISEMPLOYEE, AD_MESSAGE_GET2(BP.ISSALESREP, ?) AS ISSALESREP, "
            + "        ISCUSTOMER, ISVENDOR, '' AS SEQNO, '' AS CASCADE, '' AS DISCOUNT, '' AS QTY, '' AS CLASS_TREE"
            + "        FROM C_BPARTNER BP, C_BP_GROUP G"
            + "        WHERE BP.C_BP_GROUP_ID = G.C_BP_GROUP_ID";
    strSql =
        strSql
            + ((cBpartnerId == null || cBpartnerId.equals(""))
                ? ""
                : "           AND BP.C_BPARTNER_ID IN          " + cBpartnerId);

    ResultSet result;
    Vector<java.lang.Object> vector = new Vector<java.lang.Object>(0);
    PreparedStatement st = null;

    int iParameter = 0;
    try {
      st = connectionProvider.getPreparedStatement(strSql);
      iParameter++;
      UtilSql.setValue(st, iParameter, 12, null, adLanguage);
      iParameter++;
      UtilSql.setValue(st, iParameter, 12, null, adLanguage);
      iParameter++;
      UtilSql.setValue(st, iParameter, 12, null, adLanguage);
      if (cBpartnerId != null && !(cBpartnerId.equals(""))) {}

      result = st.executeQuery();
      long countRecord = 0;
      long countRecordSkip = 1;
      boolean continueResult = true;
      while (countRecordSkip < firstRegister && continueResult) {
        continueResult = result.next();
        countRecordSkip++;
      }
      while (continueResult && result.next()) {
        countRecord++;
        RptCBpartnerData objectRptCBpartnerData = new RptCBpartnerData();
        objectRptCBpartnerData.cBpartnerId = UtilSql.getValue(result, "c_bpartner_id");
        objectRptCBpartnerData.value = UtilSql.getValue(result, "value");
        objectRptCBpartnerData.isactive = UtilSql.getValue(result, "isactive");
        objectRptCBpartnerData.created = UtilSql.getDateValue(result, "created", "dd-MM-yyyy");
        objectRptCBpartnerData.updated = UtilSql.getDateValue(result, "updated", "dd-MM-yyyy");
        objectRptCBpartnerData.name = UtilSql.getValue(result, "name");
        objectRptCBpartnerData.name2 = UtilSql.getValue(result, "name2");
        objectRptCBpartnerData.groupname = UtilSql.getValue(result, "groupname");
        objectRptCBpartnerData.taxid = UtilSql.getValue(result, "taxid");
        objectRptCBpartnerData.accountno = UtilSql.getValue(result, "accountno");
        objectRptCBpartnerData.isemployee = UtilSql.getValue(result, "isemployee");
        objectRptCBpartnerData.issalesrep = UtilSql.getValue(result, "issalesrep");
        objectRptCBpartnerData.iscustomer = UtilSql.getValue(result, "iscustomer");
        objectRptCBpartnerData.isvendor = UtilSql.getValue(result, "isvendor");
        objectRptCBpartnerData.seqno = UtilSql.getValue(result, "seqno");
        objectRptCBpartnerData.cascade = UtilSql.getValue(result, "cascade");
        objectRptCBpartnerData.discount = UtilSql.getValue(result, "discount");
        objectRptCBpartnerData.qty = UtilSql.getValue(result, "qty");
        objectRptCBpartnerData.classTree = UtilSql.getValue(result, "class_tree");
        objectRptCBpartnerData.position = Long.toString(countRecord);
        objectRptCBpartnerData.InitRecordNumber = Integer.toString(firstRegister);
        vector.addElement(objectRptCBpartnerData);
        if (countRecord >= numberRegisters && numberRegisters != 0) {
          continueResult = false;
        }
      }
      result.close();
    } catch (SQLException e) {
      log4j.error("SQL error in query: " + strSql + "Exception:" + e);
      throw new ServletException(
          "@CODE=" + Integer.toString(e.getErrorCode()) + "@" + e.getMessage());
    } catch (Exception ex) {
      log4j.error("Exception in query: " + strSql + "Exception:" + ex);
      throw new ServletException("@CODE=@" + ex.getMessage());
    } finally {
      try {
        connectionProvider.releasePreparedStatement(st);
      } catch (Exception ignore) {
        ignore.printStackTrace();
      }
    }
    RptCBpartnerData objectRptCBpartnerData[] = new RptCBpartnerData[vector.size()];
    vector.copyInto(objectRptCBpartnerData);
    return (objectRptCBpartnerData);
  }
コード例 #2
0
  public static RptCBpartnerData[] selectTemplateDetail(
      ConnectionProvider connectionProvider,
      String cBpartnerId,
      String typeTemplate,
      int firstRegister,
      int numberRegisters)
      throws ServletException {
    String strSql = "";
    strSql =
        strSql
            + "        SELECT P.NAME, PT.QTY"
            + "        FROM M_PRODUCT_TEMPLATE PT, M_PRODUCT P"
            + "        WHERE PT.M_PRODUCT_ID = P.M_PRODUCT_ID"
            + "        AND PT.C_BPARTNER_ID = ?"
            + "        AND PT.TYPE_TEMPLATE = ?"
            + "        ORDER BY P.NAME";

    ResultSet result;
    Vector<java.lang.Object> vector = new Vector<java.lang.Object>(0);
    PreparedStatement st = null;

    int iParameter = 0;
    try {
      st = connectionProvider.getPreparedStatement(strSql);
      iParameter++;
      UtilSql.setValue(st, iParameter, 12, null, cBpartnerId);
      iParameter++;
      UtilSql.setValue(st, iParameter, 12, null, typeTemplate);

      result = st.executeQuery();
      long countRecord = 0;
      long countRecordSkip = 1;
      boolean continueResult = true;
      while (countRecordSkip < firstRegister && continueResult) {
        continueResult = result.next();
        countRecordSkip++;
      }
      while (continueResult && result.next()) {
        countRecord++;
        RptCBpartnerData objectRptCBpartnerData = new RptCBpartnerData();
        objectRptCBpartnerData.name = UtilSql.getValue(result, "name");
        objectRptCBpartnerData.qty = UtilSql.getValue(result, "qty");
        objectRptCBpartnerData.position = Long.toString(countRecord);
        objectRptCBpartnerData.InitRecordNumber = Integer.toString(firstRegister);
        vector.addElement(objectRptCBpartnerData);
        if (countRecord >= numberRegisters && numberRegisters != 0) {
          continueResult = false;
        }
      }
      result.close();
    } catch (SQLException e) {
      log4j.error("SQL error in query: " + strSql + "Exception:" + e);
      throw new ServletException(
          "@CODE=" + Integer.toString(e.getErrorCode()) + "@" + e.getMessage());
    } catch (Exception ex) {
      log4j.error("Exception in query: " + strSql + "Exception:" + ex);
      throw new ServletException("@CODE=@" + ex.getMessage());
    } finally {
      try {
        connectionProvider.releasePreparedStatement(st);
      } catch (Exception ignore) {
        ignore.printStackTrace();
      }
    }
    RptCBpartnerData objectRptCBpartnerData[] = new RptCBpartnerData[vector.size()];
    vector.copyInto(objectRptCBpartnerData);
    return (objectRptCBpartnerData);
  }
コード例 #3
0
  public static RptCBpartnerData[] selectDiscount(
      ConnectionProvider connectionProvider,
      String cBpartnerId,
      int firstRegister,
      int numberRegisters)
      throws ServletException {
    String strSql = "";
    strSql =
        strSql
            + "        SELECT (CASE BD.CASCADE WHEN 'Y' THEN 'Si' ELSE 'No' END) AS CASCADE, BD.LINE AS SEQNO, D.NAME, D.DISCOUNT"
            + "        FROM C_BPARTNER_DISCOUNT BD, C_DISCOUNT D"
            + "        WHERE BD.C_DISCOUNT_ID = D.C_DISCOUNT_ID";
    strSql =
        strSql
            + ((cBpartnerId == null || cBpartnerId.equals(""))
                ? ""
                : "           AND BD.C_BPARTNER_ID IN          " + cBpartnerId);
    strSql = strSql + "        ORDER BY SEQNO";

    ResultSet result;
    Vector<java.lang.Object> vector = new Vector<java.lang.Object>(0);
    PreparedStatement st = null;

    try {
      st = connectionProvider.getPreparedStatement(strSql);
      if (cBpartnerId != null && !(cBpartnerId.equals(""))) {}

      result = st.executeQuery();
      long countRecord = 0;
      long countRecordSkip = 1;
      boolean continueResult = true;
      while (countRecordSkip < firstRegister && continueResult) {
        continueResult = result.next();
        countRecordSkip++;
      }
      while (continueResult && result.next()) {
        countRecord++;
        RptCBpartnerData objectRptCBpartnerData = new RptCBpartnerData();
        objectRptCBpartnerData.cascade = UtilSql.getValue(result, "cascade");
        objectRptCBpartnerData.seqno = UtilSql.getValue(result, "seqno");
        objectRptCBpartnerData.name = UtilSql.getValue(result, "name");
        objectRptCBpartnerData.discount = UtilSql.getValue(result, "discount");
        objectRptCBpartnerData.position = Long.toString(countRecord);
        objectRptCBpartnerData.InitRecordNumber = Integer.toString(firstRegister);
        vector.addElement(objectRptCBpartnerData);
        if (countRecord >= numberRegisters && numberRegisters != 0) {
          continueResult = false;
        }
      }
      result.close();
    } catch (SQLException e) {
      log4j.error("SQL error in query: " + strSql + "Exception:" + e);
      throw new ServletException(
          "@CODE=" + Integer.toString(e.getErrorCode()) + "@" + e.getMessage());
    } catch (Exception ex) {
      log4j.error("Exception in query: " + strSql + "Exception:" + ex);
      throw new ServletException("@CODE=@" + ex.getMessage());
    } finally {
      try {
        connectionProvider.releasePreparedStatement(st);
      } catch (Exception ignore) {
        ignore.printStackTrace();
      }
    }
    RptCBpartnerData objectRptCBpartnerData[] = new RptCBpartnerData[vector.size()];
    vector.copyInto(objectRptCBpartnerData);
    return (objectRptCBpartnerData);
  }
コード例 #4
0
  public static RptCBpartnerData[] selectTemplate(
      ConnectionProvider connectionProvider,
      String adLanguage,
      String cBpartnerId,
      int firstRegister,
      int numberRegisters)
      throws ServletException {
    String strSql = "";
    strSql =
        strSql
            + "        SELECT AD_REF_LIST_V.VALUE AS VALUE, AD_REF_LIST_V.NAME AS NAME2, 'datawarehouseclose' AS CLASS_TREE"
            + "        FROM M_PRODUCT_TEMPLATE PT, AD_REF_LIST_V "
            + "        WHERE PT.TYPE_TEMPLATE = AD_REF_LIST_V.VALUE"
            + "        AND AD_REF_LIST_V.AD_LANGUAGE = ?"
            + "        AND AD_REF_LIST_V.AD_REFERENCE_ID = '800009'";
    strSql =
        strSql
            + ((cBpartnerId == null || cBpartnerId.equals(""))
                ? ""
                : "           AND PT.C_BPARTNER_ID IN          " + cBpartnerId);
    strSql = strSql + "        ORDER BY name2";

    ResultSet result;
    Vector<java.lang.Object> vector = new Vector<java.lang.Object>(0);
    PreparedStatement st = null;

    int iParameter = 0;
    try {
      st = connectionProvider.getPreparedStatement(strSql);
      iParameter++;
      UtilSql.setValue(st, iParameter, 12, null, adLanguage);
      if (cBpartnerId != null && !(cBpartnerId.equals(""))) {}

      result = st.executeQuery();
      long countRecord = 0;
      long countRecordSkip = 1;
      boolean continueResult = true;
      while (countRecordSkip < firstRegister && continueResult) {
        continueResult = result.next();
        countRecordSkip++;
      }
      while (continueResult && result.next()) {
        countRecord++;
        RptCBpartnerData objectRptCBpartnerData = new RptCBpartnerData();
        objectRptCBpartnerData.value = UtilSql.getValue(result, "value");
        objectRptCBpartnerData.name2 = UtilSql.getValue(result, "name2");
        objectRptCBpartnerData.classTree = UtilSql.getValue(result, "class_tree");
        objectRptCBpartnerData.position = Long.toString(countRecord);
        objectRptCBpartnerData.InitRecordNumber = Integer.toString(firstRegister);
        vector.addElement(objectRptCBpartnerData);
        if (countRecord >= numberRegisters && numberRegisters != 0) {
          continueResult = false;
        }
      }
      result.close();
    } catch (SQLException e) {
      log4j.error("SQL error in query: " + strSql + "Exception:" + e);
      throw new ServletException(
          "@CODE=" + Integer.toString(e.getErrorCode()) + "@" + e.getMessage());
    } catch (Exception ex) {
      log4j.error("Exception in query: " + strSql + "Exception:" + ex);
      throw new ServletException("@CODE=@" + ex.getMessage());
    } finally {
      try {
        connectionProvider.releasePreparedStatement(st);
      } catch (Exception ignore) {
        ignore.printStackTrace();
      }
    }
    RptCBpartnerData objectRptCBpartnerData[] = new RptCBpartnerData[vector.size()];
    vector.copyInto(objectRptCBpartnerData);
    return (objectRptCBpartnerData);
  }
コード例 #5
0
  public static RptCBpartnerData[] selectAccount(
      ConnectionProvider connectionProvider,
      String cBpartnerId,
      int firstRegister,
      int numberRegisters)
      throws ServletException {
    String strSql = "";
    strSql =
        strSql
            + "        SELECT A.ACCOUNTNO, A.BANK_NAME AS NAME"
            + "        FROM C_BP_BANKACCOUNT A";
    strSql =
        strSql
            + ((cBpartnerId == null || cBpartnerId.equals(""))
                ? ""
                : "           WHERE C_BPARTNER_ID IN          " + cBpartnerId);

    ResultSet result;
    Vector<java.lang.Object> vector = new Vector<java.lang.Object>(0);
    PreparedStatement st = null;

    try {
      st = connectionProvider.getPreparedStatement(strSql);
      if (cBpartnerId != null && !(cBpartnerId.equals(""))) {}

      result = st.executeQuery();
      long countRecord = 0;
      long countRecordSkip = 1;
      boolean continueResult = true;
      while (countRecordSkip < firstRegister && continueResult) {
        continueResult = result.next();
        countRecordSkip++;
      }
      while (continueResult && result.next()) {
        countRecord++;
        RptCBpartnerData objectRptCBpartnerData = new RptCBpartnerData();
        objectRptCBpartnerData.accountno = UtilSql.getValue(result, "accountno");
        objectRptCBpartnerData.name = UtilSql.getValue(result, "name");
        objectRptCBpartnerData.position = Long.toString(countRecord);
        objectRptCBpartnerData.InitRecordNumber = Integer.toString(firstRegister);
        vector.addElement(objectRptCBpartnerData);
        if (countRecord >= numberRegisters && numberRegisters != 0) {
          continueResult = false;
        }
      }
      result.close();
    } catch (SQLException e) {
      log4j.error("SQL error in query: " + strSql + "Exception:" + e);
      throw new ServletException(
          "@CODE=" + Integer.toString(e.getErrorCode()) + "@" + e.getMessage());
    } catch (Exception ex) {
      log4j.error("Exception in query: " + strSql + "Exception:" + ex);
      throw new ServletException("@CODE=@" + ex.getMessage());
    } finally {
      try {
        connectionProvider.releasePreparedStatement(st);
      } catch (Exception ignore) {
        ignore.printStackTrace();
      }
    }
    RptCBpartnerData objectRptCBpartnerData[] = new RptCBpartnerData[vector.size()];
    vector.copyInto(objectRptCBpartnerData);
    return (objectRptCBpartnerData);
  }