Search in sources :

Example 6 with MiniTable

use of org.compiere.minigrid.MiniTable in project adempiere by adempiere.

the class InvoiceHistory method initReservedOrderedTab.

//	stateChanged
/**
	 *	Query Reserved/Ordered
	 *	@param reserved po/so
	 */
private void initReservedOrderedTab(boolean reserved) {
    //	Done already
    if (reserved && m_modelReserved != null)
        return;
    if (!reserved && m_modelOrdered != null)
        return;
    //	Header
    Vector<String> columnNames = new Vector<String>();
    columnNames.add(Msg.translate(Env.getCtx(), m_C_BPartner_ID == 0 ? "C_BPartner_ID" : "M_Product_ID"));
    columnNames.add(Msg.translate(Env.getCtx(), "PriceActual"));
    columnNames.add(Msg.translate(Env.getCtx(), reserved ? "QtyReserved" : "QtyOrdered"));
    columnNames.add(Msg.translate(Env.getCtx(), "Discount"));
    columnNames.add(Msg.translate(Env.getCtx(), "DocumentNo"));
    columnNames.add(Msg.translate(Env.getCtx(), "DateOrdered"));
    columnNames.add(Msg.translate(Env.getCtx(), "M_Warehouse_ID"));
    //	Fill Data
    Vector<Vector<Object>> data = null;
    if (m_C_BPartner_ID == 0) {
        String sql = "SELECT bp.Name, ol.PriceActual,ol.PriceList,ol.QtyReserved," + "o.DateOrdered,dt.PrintName || ' ' || o.DocumentNo As DocumentNo, " + "w.Name," + // 8,9=M_PriceList_ID
        "ol.Discount, 0 " + "FROM C_Order o" + " INNER JOIN C_OrderLine ol ON (o.C_Order_ID=ol.C_Order_ID)" + " INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID)" + " INNER JOIN M_Warehouse w ON (ol.M_Warehouse_ID=w.M_Warehouse_ID)" + " INNER JOIN C_BPartner bp  ON (o.C_BPartner_ID=bp.C_BPartner_ID) " + "WHERE ol.QtyReserved<>0" + " AND ol.M_Product_ID=?" + " AND o.IsSOTrx=" + (reserved ? "'Y'" : "'N'") + " ORDER BY o.DateOrdered";
        //	Product By BPartner
        data = fillTable(sql, m_M_Product_ID);
    } else {
        String sql = "SELECT p.Name, ol.PriceActual,ol.PriceList,ol.QtyReserved," + "o.DateOrdered,dt.PrintName || ' ' || o.DocumentNo As DocumentNo, " + "w.Name," + // 8,9=M_PriceList_ID
        "ol.Discount, 0 " + "FROM C_Order o" + " INNER JOIN C_OrderLine ol ON (o.C_Order_ID=ol.C_Order_ID)" + " INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID)" + " INNER JOIN M_Warehouse w ON (ol.M_Warehouse_ID=w.M_Warehouse_ID)" + " INNER JOIN M_Product p  ON (ol.M_Product_ID=p.M_Product_ID) " + "WHERE ol.QtyReserved<>0" + " AND o.C_BPartner_ID=?" + " AND o.IsSOTrx=" + (reserved ? "'Y'" : "'N'") + " ORDER BY o.DateOrdered";
        //	Product of BP
        data = fillTable(sql, m_C_BPartner_ID);
    }
    //  Table
    MiniTable table = null;
    if (reserved) {
        m_modelReserved = new DefaultTableModel(data, columnNames);
        m_tableReserved.setModel(m_modelReserved);
        table = m_tableReserved;
    } else {
        m_modelOrdered = new DefaultTableModel(data, columnNames);
        m_tableOrdered.setModel(m_modelOrdered);
        table = m_tableOrdered;
    }
    //
    //  Product/Partner
    table.setColumnClass(0, String.class, true);
    //  Price
    table.setColumnClass(1, BigDecimal.class, true);
    //  Quantity
    table.setColumnClass(2, Double.class, true);
    //  Discount (%)
    table.setColumnClass(3, BigDecimal.class, true);
    //  DocNo
    table.setColumnClass(4, String.class, true);
    //  Date
    table.setColumnClass(5, Timestamp.class, true);
    //  Warehouse
    table.setColumnClass(6, String.class, true);
    //
    table.autoSize();
}
Also used : DefaultTableModel(javax.swing.table.DefaultTableModel) Vector(java.util.Vector) MiniTable(org.compiere.minigrid.MiniTable)

Example 7 with MiniTable

use of org.compiere.minigrid.MiniTable in project adempiere by adempiere.

the class InfoProduct method initAtpTab.

//	stateChanged
/**
	 *	Query ATP
	 */
private void initAtpTab() {
    //  Table
    m_tableAtp = new MiniTable();
    m_tableAtp.setRowSelectionAllowed(true);
    m_tableAtp.setMultiSelection(false);
    m_tableAtp.addMouseListener(this);
    m_tableAtp.setShowTotals(false);
    //	Header
    ArrayList<Info_Column> list = new ArrayList<Info_Column>();
    list.add(new Info_Column(" ", "M_Product_ID", IDColumn.class));
    list.add(new Info_Column(Msg.translate(Env.getCtx(), "M_Warehouse_ID"), "Warehouse", String.class));
    list.add(new Info_Column(Msg.translate(Env.getCtx(), "M_Locator_ID"), "Locator", String.class));
    list.add(new Info_Column(Msg.getMsg(Env.getCtx(), "Date", true), "Date", Timestamp.class));
    list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class, true, true, null));
    list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class));
    list.add(new Info_Column(Msg.getMsg(Env.getCtx(), "ExpectedChange", true), "DeltaQty", Double.class));
    list.add(new Info_Column(Msg.translate(Env.getCtx(), "C_BPartner_ID"), "BP_Name", String.class));
    list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyOrdered"), "QtyOrdered", Double.class));
    list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class));
    list.add(new Info_Column(Msg.translate(Env.getCtx(), "M_AttributeSetInstance_ID"), "PASI", String.class));
    list.add(new Info_Column(Msg.translate(Env.getCtx(), "DocumentNo"), "DocumentNo", String.class));
    m_layoutATP = new Info_Column[list.size()];
    list.toArray(m_layoutATP);
}
Also used : IDColumn(org.compiere.minigrid.IDColumn) ArrayList(java.util.ArrayList) Timestamp(java.sql.Timestamp) MiniTable(org.compiere.minigrid.MiniTable)

Aggregations

MiniTable (org.compiere.minigrid.MiniTable)7 Vector (java.util.Vector)3 DefaultTableModel (javax.swing.table.DefaultTableModel)3 PreparedStatement (java.sql.PreparedStatement)2 ResultSet (java.sql.ResultSet)2 SQLException (java.sql.SQLException)2 Timestamp (java.sql.Timestamp)2 ArrayList (java.util.ArrayList)1 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)1 TableColumn (javax.swing.table.TableColumn)1 VComboBox (org.compiere.grid.ed.VComboBox)1 VLookup (org.compiere.grid.ed.VLookup)1 IDColumn (org.compiere.minigrid.IDColumn)1 IMiniTable (org.compiere.minigrid.IMiniTable)1