/** 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
public void configureMiniTable(IMiniTable miniTable) { // create Columns miniTable.addColumn("C_Order_ID"); miniTable.addColumn("AD_Org_ID"); miniTable.addColumn("C_DocType_ID"); miniTable.addColumn("DocumentNo"); miniTable.addColumn("C_BPartner_ID"); miniTable.addColumn("DateOrdered"); miniTable.addColumn("TotalLines"); // miniTable.setMultiSelection(true); // set details miniTable.setColumnClass(0, IDColumn.class, false, " "); miniTable.setColumnClass(1, String.class, true, Msg.translate(Env.getCtx(), "AD_Org_ID")); miniTable.setColumnClass(2, String.class, true, Msg.translate(Env.getCtx(), "C_DocType_ID")); miniTable.setColumnClass(3, String.class, true, Msg.translate(Env.getCtx(), "DocumentNo")); miniTable.setColumnClass(4, String.class, true, Msg.translate(Env.getCtx(), "C_BPartner_ID")); miniTable.setColumnClass(5, Timestamp.class, true, Msg.translate(Env.getCtx(), "DateOrdered")); miniTable.setColumnClass(6, BigDecimal.class, true, Msg.translate(Env.getCtx(), "TotalLines")); // miniTable.autoSize(); }