Beispiel #1
0
 public static Integer getOrgParentID(Properties ctx, Integer orgID, String trxName) {
   return DB.getSQLValue(
       trxName,
       "select getnodepadre(?, ?, '" + X_AD_Tree.TREETYPE_Organization + "')",
       Env.getAD_Client_ID(ctx),
       orgID);
 }
Beispiel #2
0
  /**
   * Get Linked BPartner
   *
   * @return C_BPartner_ID
   */
  public int getLinkedC_BPartner_ID() {

    if (m_linkedBPartner == null) {

      int C_BPartner_ID =
          DB.getSQLValue(
              null,
              "SELECT C_BPartner_ID FROM C_BPartner WHERE AD_OrgBP_ID=?",
              Integer.toString(getAD_Org_ID()));

      if (C_BPartner_ID < 0) { // not found = -1
        C_BPartner_ID = 0;
      }

      m_linkedBPartner = new Integer(C_BPartner_ID);
    }

    return m_linkedBPartner.intValue();
  } // getLinkedC_BPartner_ID
 /**
  * Get the next Line No
  *
  * @return next line no
  */
 private int getNextLine() {
   return DB.getSQLValue(
       "MPC_ProfileBOMLine",
       "SELECT COALESCE(MAX(Line),0)+10 FROM MPC_ProfileBOMLine WHERE MPC_ProfileBOM_ID=?",
       getMPC_ProfileBOM_ID());
 } // getLineFromProject
 private Integer getVisualOptionReferenceID() {
   return DB.getSQLValue(
       null,
       "SELECT ad_reference_id FROM ad_reference WHERE ad_componentobjectuid = 'CORE-AD_Reference-1010236'");
 }
Beispiel #5
0
  /** Descripción de Método */
  private void cmd_find() {
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

    int AD_Table_ID = m_reportEngine.getPrintFormat().getAD_Table_ID();
    String title = null;
    String tableName = null;

    // Get Find Tab Info

    String sql =
        "SELECT t.AD_Tab_ID "

            // ,w.Name, t.Name, w.IsDefault, t.SeqNo, ABS (tt.AD_Window_ID-t.AD_Window_ID)

            + "FROM AD_Tab t"
            + " INNER JOIN AD_Window w ON (t.AD_Window_ID=w.AD_Window_ID)"
            + " INNER JOIN AD_Table tt ON (t.AD_Table_ID=tt.AD_Table_ID) "
            + "WHERE t.AD_Table_ID=? "
            + "ORDER BY w.IsDefault DESC, t.SeqNo, ABS (tt.AD_Window_ID-t.AD_Window_ID)";
    int AD_Tab_ID = DB.getSQLValue(null, sql, AD_Table_ID);

    //

    sql = "SELECT Name, TableName FROM AD_Tab_v WHERE AD_Tab_ID=?";

    if (!Env.isBaseLanguage(Env.getCtx(), "AD_Tab")) {
      sql =
          "SELECT Name, TableName FROM AD_Tab_vt WHERE AD_Tab_ID=?"
              + " AND AD_Language='"
              + Env.getAD_Language(Env.getCtx())
              + "'";
    }

    try {
      PreparedStatement pstmt = DB.prepareStatement(sql);

      pstmt.setInt(1, AD_Tab_ID);

      ResultSet rs = pstmt.executeQuery();

      //

      if (rs.next()) {
        title = rs.getString(1);
        tableName = rs.getString(2);
      }

      //

      rs.close();
      pstmt.close();
    } catch (SQLException e) {
      log.log(Level.SEVERE, "MTabVO.create(1)", e);
    }

    MField[] findFields = null;

    if (tableName != null) {
      findFields = MField.createFields(m_ctx, m_WindowNo, 0, AD_Tab_ID);
    }

    if (findFields == null) { // No Tab for Table exists
      bFind.setEnabled(false);
    } else {
      Find find = new Find(this, m_WindowNo, title, AD_Table_ID, tableName, "", findFields, 1);

      m_reportEngine.setQuery(find.getQuery());
      revalidate();
    }

    cmd_drill(); // setCursor
  } // cmd_find