Пример #1
0
  /** Query Info */
  public void executeQuery(KeyNamePair docTypeKNPair, IMiniTable miniTable) {
    log.info("");
    int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx());
    //  Create SQL

    String sql = "";

    if (docTypeKNPair.getKey() == MOrder.Table_ID) {
      sql = getOrderSQL();
    } else {
      sql = getRMASql();
    }

    //  reset table
    int row = 0;
    miniTable.setRowCount(row);
    //  Execute
    try {
      PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null);
      pstmt.setInt(1, AD_Client_ID);
      ResultSet rs = pstmt.executeQuery();
      //
      while (rs.next()) {
        //  extend table
        miniTable.setRowCount(row + 1);
        //  set values
        miniTable.setValueAt(new IDColumn(rs.getInt(1)), row, 0); //  C_Order_ID
        miniTable.setValueAt(rs.getString(2), row, 1); //  Org
        miniTable.setValueAt(rs.getString(3), row, 2); //  DocType
        miniTable.setValueAt(rs.getString(4), row, 3); //  Doc No
        miniTable.setValueAt(rs.getString(5), row, 4); //  BPartner
        miniTable.setValueAt(rs.getTimestamp(6), row, 5); //  DateOrdered
        miniTable.setValueAt(rs.getBigDecimal(7), row, 6); //  TotalLines
        //  prepare next
        row++;
      }
      rs.close();
      pstmt.close();
    } catch (SQLException e) {
      log.log(Level.SEVERE, sql.toString(), e);
    }
    //
    miniTable.autoSize();
    //	statusBar.setStatusDB(String.valueOf(miniTable.getRowCount()));
  } //  executeQuery