コード例 #1
0
  private boolean dynInit(WButtonEditor button) throws Exception {
    // 获取海外入库单产生的异常
    Vector<Vector> data = getBExceptionData();
    if (data.size() <= 0) {
      // 当卖家海外仓入库单内所有单品状态都变更为"海外仓上架完成"时,将卖家海外仓入库单状态更新为"海外仓入库完成"
      if (m_mTab.getAD_Table_ID() == MOrder.Table_ID) {
        MOrder order = new MOrder(Env.getCtx(), m_mTab.getRecord_ID(), null);
        order.setStatus(MOrder.STATUS_ForeignWarehouseInboundCompleted);
        order.saveEx();
      } else if (m_mTab.getAD_Table_ID() == MWorkOrder.Table_ID) {
        MWorkOrder order = new MWorkOrder(Env.getCtx(), m_mTab.getRecord_ID(), null);
        order.setStatus(MWorkOrder.STATUS_Completed);
        order.saveEx();
      }

      // 不显示业务异常提示窗口
      return false;
    }

    ColumnInfo[] layout =
        new ColumnInfo[] {
          new ColumnInfo(Msg.translate(Env.getCtx(), "WT_ExceptionType"), ".", String.class),
          new ColumnInfo(Msg.translate(Env.getCtx(), "WT_ExceptionID"), ".", String.class)
        };
    xTable.prepareTable(layout, "", "", false, "");
    xTable.loadTable(data);
    // 显示业务异常提示窗口
    return true;
  } // dynInit
コード例 #2
0
ファイル: WPOSQuery.java プロジェクト: dixon22ma/zkwebui
 /**
  * Mouse Clicked
  *
  * @param e event
  */
 public void mouseClicked(MouseEvent e) {
   //  Single click with selected row => exit
   if (e.getClickCount() > 0 && posTable.getSelectedRow() != -1) {
     select();
     close();
   }
 } //  mouseClicked
コード例 #3
0
ファイル: WPaySelect.java プロジェクト: kimhatrung/Adempiere
  /** Generate PaySelection */
  private void generatePaySelect() {
    if (miniTable.getRowCount() == 0) return;
    miniTable.setSelectedIndices(new int[] {0});
    calculateSelection();
    if (m_noSelected == 0) return;

    String msg =
        generatePaySelect(
            miniTable,
            (ValueNamePair) fieldPaymentRule.getSelectedItem().getValue(),
            new Timestamp(fieldPayDate.getComponent().getValue().getTime()),
            (BankInfo) fieldBankAccount.getSelectedItem().getValue());

    if (msg != null && msg.length() > 0) {
      FDialog.error(m_WindowNo, form, "SaveError", msg);
      return;
    }

    //  Ask to Post it
    if (!FDialog.ask(m_WindowNo, form, "VPaySelectGenerate?", "(" + m_ps.getName() + ")")) return;

    //  Prepare Process
    int AD_Proces_ID = 155; // 	C_PaySelection_CreatePayment

    //	Execute Process
    ProcessModalDialog dialog =
        new ProcessModalDialog(
            this,
            m_WindowNo,
            AD_Proces_ID,
            X_C_PaySelection.Table_ID,
            m_ps.getC_PaySelection_ID(),
            false);
    if (dialog.isValid()) {
      try {
        dialog.setWidth("500px");
        dialog.setVisible(true);
        dialog.setPage(form.getPage());
        dialog.doModal();
      } catch (SuspendNotAllowedException e) {
        log.log(Level.SEVERE, e.getLocalizedMessage(), e);
      } catch (InterruptedException e) {
        log.log(Level.SEVERE, e.getLocalizedMessage(), e);
      }
    }
  } //  generatePaySelect
コード例 #4
0
 private void zkInit() throws Exception {
   this.appendChild(mainPanel);
   mainPanel.appendChild(mainLayout);
   mainPanel.setStyle("width: 100%; height: 100%; padding: 0; margin: 0");
   mainLayout.setHeight("100%");
   mainLayout.setWidth("100%");
   Center center = new Center();
   mainLayout.appendChild(center);
   Panel p = new Panel();
   p.appendChild(xTable);
   xTable.setWidth("100%");
   xTable.setHeight("100%");
   p.setStyle("width: 100%; height: 100%; padding: 0; margin: 0");
   center.appendChild(p);
   //
   South south = new South();
   south.setStyle("border: none");
   mainLayout.appendChild(south);
   south.appendChild(confirmPanel);
   confirmPanel.addActionListener(this);
 } // jbInit
コード例 #5
0
ファイル: WPaySelect.java プロジェクト: kimhatrung/Adempiere
  /** Query and create TableInfo */
  private void loadTableInfo() {
    Timestamp payDate = (Timestamp) fieldPayDate.getValue();
    miniTable.setColorCompare(payDate);
    log.config("PayDate=" + payDate);

    BankInfo bi = (BankInfo) fieldBankAccount.getSelectedItem().getValue();

    ValueNamePair paymentRule = (ValueNamePair) fieldPaymentRule.getSelectedItem().getValue();
    KeyNamePair bpartner = (KeyNamePair) fieldBPartner.getSelectedItem().getValue();
    KeyNamePair docType = (KeyNamePair) fieldDtype.getSelectedItem().getValue();

    loadTableInfo(bi, payDate, paymentRule, onlyDue.isSelected(), bpartner, docType, miniTable);

    calculateSelection();
  } //  loadTableInfo
コード例 #6
0
ファイル: WWFActivity.java プロジェクト: makezjdq/adempiere-1
  public void onEvent(Event event) throws Exception {
    Component comp = event.getTarget();
    String eventName = event.getName();

    if (eventName.equals(Events.ON_CLICK)) {
      if (comp == bZoom) cmd_zoom();
      else if (comp == bOK) {
        Clients.showBusy(Msg.getMsg(Env.getCtx(), "Processing"), true);
        Events.echoEvent("onOK", this, null);
      } else if (comp == fAnswerButton) cmd_button();
    } else if (Events.ON_SELECT.equals(eventName) && comp == listbox) {
      m_index = listbox.getSelectedIndex();
      if (m_index >= 0) display(m_index);
    }
  }
コード例 #7
0
ファイル: WPaySelect.java プロジェクト: kimhatrung/Adempiere
  /** Dynamic Init. - Load Bank Info - Load BPartner - Init Table */
  private void dynInit() {
    ArrayList<BankInfo> bankAccountData = getBankAccountData();
    for (BankInfo bi : bankAccountData) fieldBankAccount.appendItem(bi.toString(), bi);

    if (fieldBankAccount.getItemCount() == 0) FDialog.error(m_WindowNo, form, "VPaySelectNoBank");
    else fieldBankAccount.setSelectedIndex(0);

    ArrayList<KeyNamePair> bpartnerData = getBPartnerData();
    for (KeyNamePair pp : bpartnerData) fieldBPartner.appendItem(pp.getName(), pp);
    fieldBPartner.setSelectedIndex(0);

    ArrayList<KeyNamePair> docTypeData = getDocTypeData();
    for (KeyNamePair pp : docTypeData) fieldDtype.appendItem(pp.getName(), pp);

    prepareTable(miniTable);

    miniTable.getModel().addTableModelListener(this);
    //
    fieldPayDate.setMandatory(true);
    fieldPayDate.setValue(new Timestamp(System.currentTimeMillis()));
  } //  dynInit
コード例 #8
0
  /** Dynamic Init for Price Tab */
  private boolean dynInit() {
    //	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(), "C_Currency_ID"));
    columnNames.add(Msg.translate(Env.getCtx(), "QtyInvoiced"));
    columnNames.add(Msg.translate(Env.getCtx(), "Discount"));
    columnNames.add(Msg.translate(Env.getCtx(), "DocumentNo"));
    columnNames.add(Msg.translate(Env.getCtx(), "DateInvoiced"));
    columnNames.add(Msg.translate(Env.getCtx(), "AD_Org_ID"));

    //	Fill Data
    Vector<Vector<Object>> data = null;
    if (m_C_BPartner_ID == 0) data = queryBPartner(); // 	BPartner of Product
    else data = queryProduct(); // 	Product of BPartner

    //  Table
    m_modelPrice = new ListModelTable(data);
    m_tablePrice.setData(m_modelPrice, columnNames);
    //
    m_tablePrice.setColumnClass(0, String.class, true); //  Product/Partner
    m_tablePrice.setColumnClass(1, Double.class, true); //  Price
    m_tablePrice.setColumnClass(2, String.class, true); //  Currency
    m_tablePrice.setColumnClass(3, Double.class, true); //  Quantity
    m_tablePrice.setColumnClass(4, BigDecimal.class, true); //  Discount (%) to limit precision
    m_tablePrice.setColumnClass(5, String.class, true); //  DocNo
    m_tablePrice.setColumnClass(6, Timestamp.class, true); //  Date
    m_tablePrice.setColumnClass(7, String.class, true); //  Org
    //
    m_tablePrice.autoSize();
    //

    return data.size() != 0;
  } //	dynInit
コード例 #9
0
  /** Query ATP */
  private void initAtpTab() {
    //	Done already
    if (m_modelAtp != null) return;

    //	Header
    Vector<String> columnNames = new Vector<String>();
    columnNames.add(Msg.translate(Env.getCtx(), "Date"));
    columnNames.add(Msg.translate(Env.getCtx(), "QtyOnHand"));
    columnNames.add(Msg.translate(Env.getCtx(), "C_BPartner_ID"));
    columnNames.add(Msg.translate(Env.getCtx(), "QtyOrdered"));
    columnNames.add(Msg.translate(Env.getCtx(), "QtyReserved"));
    columnNames.add(Msg.translate(Env.getCtx(), "M_Locator_ID"));
    columnNames.add(Msg.translate(Env.getCtx(), "M_AttributeSetInstance_ID"));
    columnNames.add(Msg.translate(Env.getCtx(), "DocumentNo"));
    columnNames.add(Msg.translate(Env.getCtx(), "M_Warehouse_ID"));

    //	Fill Storage Data
    String sql =
        "SELECT s.QtyOnHand, s.QtyReserved, s.QtyOrdered,"
            + " productAttribute(s.M_AttributeSetInstance_ID), s.M_AttributeSetInstance_ID,";
    if (!showDetailATP)
      sql =
          "SELECT SUM(s.QtyOnHand), SUM(s.QtyReserved), SUM(s.QtyOrdered),"
              + " productAttribute(s.M_AttributeSetInstance_ID), 0,";
    sql +=
        " w.Name, l.Value "
            + "FROM M_Storage s"
            + " INNER JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID)"
            + " LEFT JOIN M_LocatorType lt ON (l.M_LocatorType_ID=lt.M_LocatorType_ID)"
            + " INNER JOIN M_Warehouse w ON (l.M_Warehouse_ID=w.M_Warehouse_ID) "
            + "WHERE M_Product_ID=?";
    if (m_M_Warehouse_ID != 0) sql += " AND l.M_Warehouse_ID=?";
    if (m_M_AttributeSetInstance_ID > 0) sql += " AND s.M_AttributeSetInstance_ID=?";
    sql += " AND (s.QtyOnHand<>0 OR s.QtyReserved<>0 OR s.QtyOrdered<>0)";
    sql += " AND COALESCE(lt.IsAvailableForReservation,'Y')='Y'";
    if (!showDetailATP)
      sql += " GROUP BY productAttribute(s.M_AttributeSetInstance_ID), w.Name, l.Value";
    sql += " ORDER BY l.Value";

    Vector<Vector<Object>> data = new Vector<Vector<Object>>();
    double qty = 0;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
      pstmt = DB.prepareStatement(sql, null);
      pstmt.setInt(1, m_M_Product_ID);
      if (m_M_Warehouse_ID != 0) pstmt.setInt(2, m_M_Warehouse_ID);
      if (m_M_AttributeSetInstance_ID > 0) pstmt.setInt(3, m_M_AttributeSetInstance_ID);
      rs = pstmt.executeQuery();
      while (rs.next()) {
        Vector<Object> line = new Vector<Object>(9);
        line.add(null); //  Date
        double qtyOnHand = rs.getDouble(1);
        qty += qtyOnHand;
        line.add(new Double(qtyOnHand)); //  Qty
        line.add(null); //  BPartner
        line.add(new Double(rs.getDouble(3))); //  QtyOrdered
        line.add(new Double(rs.getDouble(2))); //  QtyReserved
        line.add(rs.getString(7)); //  Locator
        String asi = rs.getString(4);
        if (showDetailATP && (asi == null || asi.length() == 0)) asi = "{" + rs.getInt(5) + "}";
        line.add(asi); //  ASI
        line.add(null); //  DocumentNo
        line.add(rs.getString(6)); // 	Warehouse
        data.add(line);
      }
    } catch (SQLException e) {
      log.log(Level.SEVERE, sql, e);
    } finally {
      DB.close(rs, pstmt);
      rs = null;
      pstmt = null;
    }

    //	Orders
    sql =
        "SELECT o.DatePromised, ol.QtyReserved,"
            + " productAttribute(ol.M_AttributeSetInstance_ID), ol.M_AttributeSetInstance_ID,"
            + " dt.DocBaseType, bp.Name,"
            + " dt.PrintName || ' ' || o.DocumentNo As DocumentNo, w.Name "
            + "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=?";
    if (m_M_Warehouse_ID != 0) sql += " AND ol.M_Warehouse_ID=?";
    if (m_M_AttributeSetInstance_ID > 0) sql += " AND ol.M_AttributeSetInstance_ID=?";
    sql += " ORDER BY o.DatePromised";
    try {
      pstmt = DB.prepareStatement(sql, null);
      pstmt.setInt(1, m_M_Product_ID);
      if (m_M_Warehouse_ID != 0) pstmt.setInt(2, m_M_Warehouse_ID);
      if (m_M_AttributeSetInstance_ID > 0) pstmt.setInt(3, m_M_AttributeSetInstance_ID);
      rs = pstmt.executeQuery();
      while (rs.next()) {
        Vector<Object> line = new Vector<Object>(9);
        line.add(rs.getTimestamp(1)); //  Date
        double oq = rs.getDouble(2);
        String DocBaseType = rs.getString(5);
        Double qtyReserved = null;
        Double qtyOrdered = null;
        if (MDocType.DOCBASETYPE_PurchaseOrder.equals(DocBaseType)) {
          qtyOrdered = new Double(oq);
          qty += oq;
        } else {
          qtyReserved = new Double(oq);
          qty -= oq;
        }
        line.add(new Double(qty)); //  Qty
        line.add(rs.getString(6)); //  BPartner
        line.add(qtyOrdered); //  QtyOrdered
        line.add(qtyReserved); //  QtyReserved
        line.add(null); //  Locator
        String asi = rs.getString(3);
        if (showDetailATP && (asi == null || asi.length() == 0)) asi = "{" + rs.getInt(4) + "}";
        line.add(asi); //  ASI
        line.add(rs.getString(7)); //  DocumentNo
        line.add(rs.getString(8)); // 	Warehouse
        data.add(line);
      }
    } catch (SQLException e) {
      log.log(Level.SEVERE, sql, e);
    } finally {
      DB.close(rs, pstmt);
      rs = null;
      pstmt = null;
    }

    //  Table
    m_modelAtp = new ListModelTable(data);
    m_tableAtp.setData(m_modelAtp, columnNames);
    //
    m_tableAtp.setColumnClass(0, Timestamp.class, true); //  Date
    m_tableAtp.setColumnClass(1, Double.class, true); //  Quantity
    m_tableAtp.setColumnClass(2, String.class, true); //  Partner
    m_tableAtp.setColumnClass(3, Double.class, true); //  Quantity
    m_tableAtp.setColumnClass(4, Double.class, true); //  Quantity
    m_tableAtp.setColumnClass(5, String.class, true); //  Locator
    m_tableAtp.setColumnClass(6, String.class, true); //  ASI
    m_tableAtp.setColumnClass(7, String.class, true); //  DocNo
    m_tableAtp.setColumnClass(8, String.class, true); //  Warehouse
    //
    m_tableAtp.autoSize();
  } //	initAtpTab
コード例 #10
0
  /** Query Unconfirmed */
  private void initUnconfirmedTab() {
    //	Done already
    if (m_modelUnconfirmed != 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(), "MovementQty"));
    columnNames.add(Msg.translate(Env.getCtx(), "MovementDate"));
    columnNames.add(Msg.translate(Env.getCtx(), "IsSOTrx"));
    columnNames.add(Msg.translate(Env.getCtx(), "DocumentNo"));
    columnNames.add(Msg.translate(Env.getCtx(), "M_Warehouse_ID"));

    //	Fill Data
    String sql = null;
    int parameter = 0;
    if (m_C_BPartner_ID == 0) {
      sql =
          "SELECT bp.Name,"
              + " CASE WHEN io.IsSOTrx='Y' THEN iol.MovementQty*-1 ELSE iol.MovementQty END AS MovementQty,"
              + " io.MovementDate,io.IsSOTrx,"
              + " dt.PrintName || ' ' || io.DocumentNo As DocumentNo,"
              + " w.Name "
              + "FROM M_InOutLine iol"
              + " INNER JOIN M_InOut io ON (iol.M_InOut_ID=io.M_InOut_ID)"
              + " INNER JOIN C_BPartner bp  ON (io.C_BPartner_ID=bp.C_BPartner_ID)"
              + " INNER JOIN C_DocType dt ON (io.C_DocType_ID=dt.C_DocType_ID)"
              + " INNER JOIN M_Warehouse w ON (io.M_Warehouse_ID=w.M_Warehouse_ID)"
              + " INNER JOIN M_InOutLineConfirm lc ON (iol.M_InOutLine_ID=lc.M_InOutLine_ID) "
              + "WHERE iol.M_Product_ID=?"
              + " AND lc.Processed='N' "
              + "ORDER BY io.MovementDate,io.IsSOTrx";
      parameter = m_M_Product_ID;
    } else {
      sql =
          "SELECT p.Name,"
              + " CASE WHEN io.IsSOTrx='Y' THEN iol.MovementQty*-1 ELSE iol.MovementQty END AS MovementQty,"
              + " io.MovementDate,io.IsSOTrx,"
              + " dt.PrintName || ' ' || io.DocumentNo As DocumentNo,"
              + " w.Name "
              + "FROM M_InOutLine iol"
              + " INNER JOIN M_InOut io ON (iol.M_InOut_ID=io.M_InOut_ID)"
              + " INNER JOIN M_Product p  ON (iol.M_Product_ID=p.M_Product_ID)"
              + " INNER JOIN C_DocType dt ON (io.C_DocType_ID=dt.C_DocType_ID)"
              + " INNER JOIN M_Warehouse w ON (io.M_Warehouse_ID=w.M_Warehouse_ID)"
              + " INNER JOIN M_InOutLineConfirm lc ON (iol.M_InOutLine_ID=lc.M_InOutLine_ID) "
              + "WHERE io.C_BPartner_ID=?"
              + " AND lc.Processed='N' "
              + "ORDER BY io.MovementDate,io.IsSOTrx";
      parameter = m_C_BPartner_ID;
    }
    Vector<Vector<Object>> data = new Vector<Vector<Object>>();
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
      pstmt = DB.prepareStatement(sql, null);
      pstmt.setInt(1, parameter);
      rs = pstmt.executeQuery();
      while (rs.next()) {
        Vector<Object> line = new Vector<Object>(6);
        //	1-Name, 2-MovementQty, 3-MovementDate, 4-IsSOTrx, 5-DocumentNo
        line.add(rs.getString(1)); //  Name
        line.add(new Double(rs.getDouble(2))); //  Qty
        line.add(rs.getTimestamp(3)); //  Date
        line.add(new Boolean("Y".equals(rs.getString(4)))); //  IsSOTrx
        line.add(rs.getString(5)); //  DocNo
        line.add(rs.getString(6)); //  Warehouse
        data.add(line);
      }
    } catch (SQLException e) {
      log.log(Level.SEVERE, sql, e);
    } finally {
      DB.close(rs, pstmt);
      rs = null;
      pstmt = null;
    }
    if (log.isLoggable(Level.FINE)) log.fine("#" + data.size());

    //  Table
    m_modelUnconfirmed = new ListModelTable(data);
    m_tableUnconfirmed.setData(m_modelUnconfirmed, columnNames);
    //
    m_tableUnconfirmed.setColumnClass(0, String.class, true); //  Product/Partner
    m_tableUnconfirmed.setColumnClass(1, Double.class, true); //  MovementQty
    m_tableUnconfirmed.setColumnClass(2, Timestamp.class, true); //  MovementDate
    m_tableUnconfirmed.setColumnClass(3, Boolean.class, true); //  IsSOTrx
    m_tableUnconfirmed.setColumnClass(4, String.class, true); //  DocNo
    //
    m_tableUnconfirmed.autoSize();
  } //	initUnconfirmedTab
コード例 #11
0
  /**
   * 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(), "C_Currency_ID"));
    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,c.Iso_Code,ol.PriceList,ol.QtyReserved,"
              + "o.DateOrdered,dt.PrintName || ' ' || o.DocumentNo As DocumentNo, "
              + "w.Name,"
              + "ol.Discount, 0 " // 8,9=M_PriceList_ID
              + "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) "
              + " INNER JOIN C_Currency c ON (o.C_Currency_ID=c.C_Currency_ID) "
              + "WHERE ol.QtyReserved<>0"
              + " AND ol.M_Product_ID=?"
              + " AND o.IsSOTrx="
              + (reserved ? "'Y'" : "'N'")
              + " ORDER BY o.DateOrdered";
      data = fillTable(sql, m_M_Product_ID); // 	Product By BPartner
    } else {
      String sql =
          "SELECT p.Name, ol.PriceActual,c.Iso_Code,ol.PriceList,ol.QtyReserved,"
              + "o.DateOrdered,dt.PrintName || ' ' || o.DocumentNo As DocumentNo, "
              + "w.Name,"
              + "ol.Discount, 0 " // 8,9=M_PriceList_ID
              + "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) "
              + " INNER JOIN C_Currency c ON (o.C_Currency_ID=c.C_Currency_ID) "
              + "WHERE ol.QtyReserved<>0"
              + " AND o.C_BPartner_ID=?"
              + " AND o.IsSOTrx="
              + (reserved ? "'Y'" : "'N'")
              + " ORDER BY o.DateOrdered";
      data = fillTable(sql, m_C_BPartner_ID); // 	Product of BP
    }

    //  Table
    if (reserved) {
      m_modelReserved = new ListModelTable(data);
      m_tableReserved.setData(m_modelReserved, columnNames);
      //
      m_tableReserved.setColumnClass(0, String.class, true); //  Product/Partner
      m_tableReserved.setColumnClass(1, BigDecimal.class, true); //  Price
      m_tableReserved.setColumnClass(2, String.class, true); //  Currency
      m_tableReserved.setColumnClass(3, Double.class, true); //  Quantity
      m_tableReserved.setColumnClass(4, BigDecimal.class, true); //  Discount (%)
      m_tableReserved.setColumnClass(5, String.class, true); //  DocNo
      m_tableReserved.setColumnClass(6, Timestamp.class, true); //  Date
      m_tableReserved.setColumnClass(7, String.class, true); //  Warehouse
      //
      m_tableReserved.autoSize();
    } else {
      m_modelOrdered = new ListModelTable(data);
      m_tableOrdered.setData(m_modelOrdered, columnNames);
      //
      m_tableOrdered.setColumnClass(0, String.class, true); //  Product/Partner
      m_tableOrdered.setColumnClass(1, BigDecimal.class, true); //  Price
      m_tableOrdered.setColumnClass(2, String.class, true); //  Currency
      m_tableOrdered.setColumnClass(3, Double.class, true); //  Quantity
      m_tableOrdered.setColumnClass(4, BigDecimal.class, true); //  Discount (%)
      m_tableOrdered.setColumnClass(5, String.class, true); //  DocNo
      m_tableOrdered.setColumnClass(6, Timestamp.class, true); //  Date
      m_tableOrdered.setColumnClass(7, String.class, true); //  Warehouse
      //
      m_tableOrdered.autoSize();
    }
  } //	initReservedOrderedTab
コード例 #12
0
ファイル: WWFActivity.java プロジェクト: makezjdq/adempiere-1
  /**
   * Load Activities
   *
   * @return int
   */
  public int loadActivities() {
    long start = System.currentTimeMillis();

    int MAX_ACTIVITIES_IN_LIST =
        MSysConfig.getIntValue("MAX_ACTIVITIES_IN_LIST", 200, Env.getAD_Client_ID(Env.getCtx()));

    model = new ListModelTable();

    ArrayList<MWFActivity> list = new ArrayList<MWFActivity>();
    String sql =
        "SELECT * FROM AD_WF_Activity a "
            + "WHERE a.Processed='N' AND a.WFState='OS' AND ("
            //	Owner of Activity
            + " a.AD_User_ID=?" //	#1
            //	Invoker (if no invoker = all)
            + " OR EXISTS (SELECT * FROM AD_WF_Responsible r WHERE a.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID"
            + " AND COALESCE(r.AD_User_ID,0)=0 AND COALESCE(r.AD_Role_ID,0)=0 AND (a.AD_User_ID=? OR a.AD_User_ID IS NULL))" //	#2
            // Responsible User
            + " OR EXISTS (SELECT * FROM AD_WF_Responsible r WHERE a.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID"
            + " AND r.AD_User_ID=?)" //	#3
            //	Responsible Role
            + " OR EXISTS (SELECT * FROM AD_WF_Responsible r INNER JOIN AD_User_Roles ur ON (r.AD_Role_ID=ur.AD_Role_ID)"
            + " WHERE a.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID AND ur.AD_User_ID=?)" //	#4
            //
            + ") ORDER BY a.Priority DESC, Created";
    int AD_User_ID = Env.getAD_User_ID(Env.getCtx());
    MRole role = MRole.get(Env.getCtx(), Env.getAD_Role_ID(Env.getCtx()));
    sql = role.addAccessSQL(sql, "a", true, false);
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
      pstmt = DB.prepareStatement(sql, null);
      pstmt.setInt(1, AD_User_ID);
      pstmt.setInt(2, AD_User_ID);
      pstmt.setInt(3, AD_User_ID);
      pstmt.setInt(4, AD_User_ID);
      rs = pstmt.executeQuery();
      while (rs.next()) {
        MWFActivity activity = new MWFActivity(Env.getCtx(), rs, null);
        list.add(activity);
        List<Object> rowData = new ArrayList<Object>();
        rowData.add(activity.getPriority());
        rowData.add(activity.getNodeName());
        rowData.add(activity.getSummary());
        model.add(rowData);
        if (list.size() > MAX_ACTIVITIES_IN_LIST && MAX_ACTIVITIES_IN_LIST > 0) {
          log.warning("More then 200 Activities - ignored");
          break;
        }
      }
    } catch (Exception e) {
      log.log(Level.SEVERE, sql, e);
    } finally {
      DB.close(rs, pstmt);
      rs = null;
      pstmt = null;
    }
    m_activities = new MWFActivity[list.size()];
    list.toArray(m_activities);
    //
    log.fine("#" + m_activities.length + "(" + (System.currentTimeMillis() - start) + "ms)");
    m_index = 0;

    String[] columns =
        new String[] {
          Msg.translate(Env.getCtx(), "Priority"),
          Msg.translate(Env.getCtx(), "AD_WF_Node_ID"),
          Msg.translate(Env.getCtx(), "Summary")
        };

    WListItemRenderer renderer = new WListItemRenderer(Arrays.asList(columns));
    ListHeader header = new ListHeader();
    header.setWidth("30px");
    renderer.setListHeader(0, header);
    renderer.addTableValueChangeListener(listbox);
    model.setNoColumns(columns.length);
    listbox.setModel(model);
    listbox.setItemRenderer(renderer);
    listbox.repaint();
    listbox.setFixedLayout(true);

    return m_activities.length;
  } //	loadActivities
コード例 #13
0
ファイル: WWFActivity.java プロジェクト: makezjdq/adempiere-1
  private void init() {
    Grid grid = new Grid();
    grid.setWidth("100%");
    grid.setHeight("100%");
    grid.setStyle("margin:0; padding:0; position: absolute; align: center; valign: center;");
    grid.makeNoStrip();
    grid.setOddRowSclass("even");

    Rows rows = new Rows();
    grid.appendChild(rows);

    Row row = new Row();
    rows.appendChild(row);
    Div div = new Div();
    div.setAlign("right");
    div.appendChild(lNode);
    row.appendChild(div);
    row.appendChild(fNode);
    fNode.setWidth("100%");
    fNode.setReadonly(true);

    row = new Row();
    rows.appendChild(row);
    row.setValign("top");
    div = new Div();
    div.setAlign("right");
    div.appendChild(lDesctiption);
    row.appendChild(div);
    row.appendChild(fDescription);
    fDescription.setMultiline(true);
    fDescription.setWidth("100%");
    fDescription.setReadonly(true);

    row = new Row();
    rows.appendChild(row);
    div = new Div();
    div.setAlign("right");
    div.appendChild(lHelp);
    row.appendChild(div);
    row.appendChild(fHelp);
    fHelp.setMultiline(true);
    fHelp.setWidth("100%");
    fHelp.setReadonly(true);
    fHelp.setRows(3);
    row.appendChild(new Label());

    row = new Row();
    rows.appendChild(row);
    div = new Div();
    div.setAlign("right");
    div.appendChild(lHistory);
    row.appendChild(div);
    row.appendChild(fHistory);
    row.appendChild(new Label());

    row = new Row();
    rows.appendChild(row);
    div = new Div();
    div.setAlign("right");
    div.appendChild(lAnswer);
    row.appendChild(div);
    Hbox hbox = new Hbox();
    hbox.appendChild(fAnswerText);
    hbox.appendChild(fAnswerList);
    hbox.appendChild(fAnswerButton);
    fAnswerButton.addEventListener(Events.ON_CLICK, this);
    row.appendChild(hbox);
    row.appendChild(bZoom);
    bZoom.addEventListener(Events.ON_CLICK, this);

    row = new Row();
    rows.appendChild(row);
    div = new Div();
    div.setAlign("right");
    div.appendChild(lTextMsg);
    row.appendChild(div);
    row.appendChild(fTextMsg);
    fTextMsg.setMultiline(true);
    fTextMsg.setWidth("100%");
    row.appendChild(new Label());

    row = new Row();
    rows.appendChild(row);
    div = new Div();
    div.setAlign("right");
    div.appendChild(lForward);
    row.appendChild(div);
    hbox = new Hbox();
    hbox.appendChild(fForward.getComponent());
    hbox.appendChild(lOptional);
    row.appendChild(hbox);
    row.appendChild(bOK);
    bOK.addEventListener(Events.ON_CLICK, this);

    Borderlayout layout = new Borderlayout();
    layout.setWidth("100%");
    layout.setHeight("100%");
    layout.setStyle("background-color: transparent; position: absolute;");

    North north = new North();
    north.appendChild(listbox);
    north.setSplittable(true);
    north.setFlex(true);
    north.setHeight("50%");
    layout.appendChild(north);
    north.setStyle("background-color: transparent");
    listbox.addEventListener(Events.ON_SELECT, this);

    Center center = new Center();
    center.appendChild(grid);
    layout.appendChild(center);
    center.setStyle("background-color: transparent");
    center.setFlex(true);

    South south = new South();
    south.appendChild(statusBar);
    layout.appendChild(south);
    south.setStyle("background-color: transparent");

    this.appendChild(layout);
    this.setStyle("height: 100%; width: 100%; position: absolute;");
  }
コード例 #14
0
ファイル: WPOSQuery.java プロジェクト: dixon22ma/zkwebui
  /**
   * Init Main Panel
   *
   * @return void
   */
  private void initMainPanel() {
    //	Instance Panel
    //
    Panel buttonsPanel = new Panel();
    Rows rows = null;
    Row row = null;
    South north = new South();

    northPanel = new Panel();
    mainLayout = new Borderlayout();
    north.setStyle("border: none");
    mainLayout.appendChild(north);
    north.appendChild(northPanel);
    Grid productLayout = GridFactory.newGridLayout();
    northPanel.appendChild(productLayout);
    rows = productLayout.newRows();
    row = rows.newRow();
    buttonsPanel.setAlign("Center");
    row.setHeight("65px");
    row.setSpans("6");

    buttonNew = createButtonAction("New", KeyStroke.getKeyStroke(KeyEvent.VK_N, 0));
    buttonNew.setId("New");
    buttonsPanel.appendChild(buttonNew);
    buttonNew.addActionListener(this);

    buttonEdit = createButtonAction("Edit", KeyStroke.getKeyStroke(KeyEvent.VK_N, 0));
    buttonEdit.setId("Edit");
    buttonsPanel.appendChild(buttonEdit);
    buttonEdit.addActionListener(this);

    buttonReset = createButtonAction("Reset", KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0));
    buttonsPanel.appendChild(buttonReset);
    buttonReset.setId("Reset");
    buttonRefresh = createButtonAction("Refresh", KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0));
    buttonsPanel.appendChild(buttonRefresh);
    buttonRefresh.setId("Refresh");

    buttonOk = createButtonAction("Ok", KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0));
    buttonsPanel.appendChild(buttonOk);
    buttonOk.setId("Ok");
    buttonCancel = createButtonAction("Cancel", KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0));
    buttonsPanel.appendChild(buttonCancel);
    buttonCancel.setId("Cancel");
    buttonOk.setTooltiptext(Msg.translate(ctx, "Ok"));
    buttonCancel.setTooltiptext(Msg.translate(ctx, "Cancel"));
    buttonOk.setTooltiptext(Msg.translate(ctx, "Ok"));
    buttonCancel.setTooltiptext(Msg.translate(ctx, "Cancel"));
    buttonNew.setTooltiptext(Msg.translate(ctx, "New"));
    buttonEdit.setTooltiptext(Msg.translate(ctx, "Edit"));
    buttonRefresh.setTooltiptext(Msg.translate(ctx, "Refresh"));
    row.appendChild(buttonsPanel);
    //	Center
    posTable = new WListbox();

    posTable.addActionListener(this);
    //	Visible New
    buttonNew.setVisible(false);
    buttonEdit.setVisible(false);
    buttonEdit.setEnabled(false);
  }