Пример #1
0
  /**
   * Set Product - Callout
   *
   * @param oldM_Product_ID old value
   * @param newM_Product_ID new value
   * @param windowNo window
   * @throws Exception
   */
  @UICallout
  public void setM_Product_ID(String oldM_Product_ID, String newM_Product_ID, int windowNo)
      throws Exception {
    if (newM_Product_ID == null || newM_Product_ID.length() == 0) return;
    int M_Product_ID = Integer.parseInt(newM_Product_ID);

    super.setM_Product_ID(M_Product_ID);
    if (M_Product_ID == 0) return;

    //	Employee
    MTimeExpense hdr = new MTimeExpense(getCtx(), getS_TimeExpense_ID(), null);
    int C_BPartner_ID = hdr.getC_BPartner_ID();
    BigDecimal Qty = getQty();
    boolean IsSOTrx = true;
    MProductPricing pp =
        new MProductPricing(
            getAD_Client_ID(), getAD_Org_ID(), M_Product_ID, C_BPartner_ID, Qty, IsSOTrx);
    //
    int M_PriceList_ID = hdr.getM_PriceList_ID();
    pp.setM_PriceList_ID(M_PriceList_ID);
    Timestamp orderDate = getDateExpense();
    pp.setPriceDate(orderDate);
    //
    setExpenseAmt(pp.getPriceStd());
    setC_Currency_ID(pp.getC_Currency_ID());
    setAmt(windowNo, "M_Product_ID");
    setC_UOM_ID(pp.getC_UOM_ID()); // Setting UOM for the Selected product
  } //	setM_Product_ID
Пример #2
0
 /**
  * Set ExpenseAmt - Callout
  *
  * @param oldExpenseAmt old value
  * @param newExpenseAmt new value
  * @param windowNo window
  * @throws Exception
  */
 @UICallout
 public void setExpenseAmt(String oldExpenseAmt, String newExpenseAmt, int windowNo)
     throws Exception {
   if (newExpenseAmt == null || newExpenseAmt.length() == 0) return;
   BigDecimal ExpenseAmt = new BigDecimal(newExpenseAmt);
   super.setExpenseAmt(ExpenseAmt);
   setAmt(windowNo, "ExpenseAmt");
 } //	setExpenseAmt
Пример #3
0
 /**
  * Set Currency - Callout
  *
  * @param oldC_Currency_ID old value
  * @param newC_Currency_ID new value
  * @param windowNo window
  * @throws Exception
  */
 @UICallout
 public void setC_Currency_ID(String oldC_Currency_ID, String newC_Currency_ID, int windowNo)
     throws Exception {
   if (newC_Currency_ID == null || newC_Currency_ID.length() == 0) return;
   int C_Currency_ID = Integer.parseInt(newC_Currency_ID);
   super.setC_Currency_ID(C_Currency_ID);
   setAmt(windowNo, "C_Currency_ID");
 } //	setC_Currency_ID
Пример #4
0
  /**
   * Set Resource Assignment - Callout
   *
   * @param oldS_ResourceAssignment_ID old value
   * @param newS_ResourceAssignment_ID new value
   * @param windowNo window
   * @throws Exception
   */
  @UICallout
  public void setS_ResourceAssignment_ID(
      String oldS_ResourceAssignment_ID, String newS_ResourceAssignment_ID, int windowNo)
      throws Exception {
    if (newS_ResourceAssignment_ID == null || newS_ResourceAssignment_ID.length() == 0) return;
    int S_ResourceAssignment_ID = Integer.parseInt(newS_ResourceAssignment_ID);
    if (S_ResourceAssignment_ID == 0) return;
    //
    super.setS_ResourceAssignment_ID(S_ResourceAssignment_ID);

    int M_Product_ID = 0;
    String Name = null;
    String Description = null;
    BigDecimal Qty = null;
    String sql =
        "SELECT p.M_Product_ID, ra.Name, ra.Description, ra.Qty "
            + "FROM S_ResourceAssignment ra"
            + " INNER JOIN M_Product p ON (p.S_Resource_ID=ra.S_Resource_ID) "
            + "WHERE ra.S_ResourceAssignment_ID=?";
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
      pstmt = DB.prepareStatement(sql, get_Trx());
      pstmt.setInt(1, S_ResourceAssignment_ID);
      rs = pstmt.executeQuery();
      if (rs.next()) {
        M_Product_ID = rs.getInt(1);
        Name = rs.getString(2);
        Description = rs.getString(3);
        Qty = rs.getBigDecimal(4);
      }
    } catch (SQLException e) {
      log.log(Level.SEVERE, sql, e);
    } finally {
      DB.closeResultSet(rs);
      DB.closeStatement(pstmt);
    }
    log.fine(
        "S_ResourceAssignment_ID=" + S_ResourceAssignment_ID + " - M_Product_ID=" + M_Product_ID);
    if (M_Product_ID != 0) {
      setM_Product_ID(M_Product_ID);
      if (Description != null) Name += " (" + Description + ")";
      if (!".".equals(Name)) setDescription(Name);
      if (Qty != null) setQty(Qty);
    }
  } //	setS_ResourceAssignment_ID