Exemplo n.º 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
Exemplo n.º 2
0
  @Override
  protected boolean beforeSave(boolean newRecord) {
    if (isDefault()) {
      // @Trifon - Ensure that only one tax rate is set as Default!
      // @Mckay - Allow edits to the Default tax rate
      String whereClause =
          MTax.COLUMNNAME_C_TaxCategory_ID
              + "=? AND "
              + MTax.COLUMNNAME_C_Tax_ID
              + "<>? AND "
              + "IsDefault='Y'";
      List<MTax> list =
          new Query(getCtx(), I_C_Tax.Table_Name, whereClause, get_TrxName())
              .setParameters(getC_TaxCategory_ID(), getC_Tax_ID())
              .setOnlyActiveRecords(true)
              .list();
      if (list.size() >= 1) {
        log.saveError(
            "Error",
            Msg.parseTranslation(
                getCtx(), Msg.getMsg(Env.getCtx(), "OnlyOneTaxPerCategoryMarkedDefault")));
        return false;
      }
    }
    if (getC_Country_ID() > 0 && getC_CountryGroupFrom_ID() > 0) {
      setC_Country_ID(0);
    }
    if (getTo_Country_ID() > 0 && getC_CountryGroupTo_ID() > 0) {
      setTo_Country_ID(0);
    }

    return super.beforeSave(newRecord);
  }
Exemplo n.º 3
0
  /**
   * Standard Constructor
   *
   * @param frame frame
   * @param modal modal
   * @param WindowNo window no
   * @param M_Warehouse_ID warehouse
   * @param M_PriceList_ID price list
   * @param value Query Value or Name if enclosed in @
   * @param multiSelection multiple selections
   * @param whereClause where clause
   */
  public InfoProduct(
      Frame frame,
      boolean modal,
      int WindowNo,
      int M_Warehouse_ID,
      int M_PriceList_ID,
      String value,
      boolean multiSelection,
      String whereClause) {
    super(frame, modal, WindowNo, "p", "M_Product_ID", multiSelection, whereClause);
    log.info(
        value + ", Wh=" + M_Warehouse_ID + ", PL=" + M_PriceList_ID + ", WHERE=" + whereClause);
    setTitle(Msg.getMsg(Env.getCtx(), "InfoProduct"));
    //
    statInit();
    initInfo(value, M_Warehouse_ID, M_PriceList_ID);
    m_C_BPartner_ID = Env.getContextAsInt(Env.getCtx(), WindowNo, "C_BPartner_ID");

    //
    int no = p_table.getRowCount();
    setStatusLine(
        Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
    setStatusDB(Integer.toString(no));
    //	AutoQuery
    if (value != null && value.length() > 0) executeQuery();
    p_loadedOK = true;
    //	Focus
    fieldValue.requestFocus();

    // Begin - fer_luck @ centuryon
    mWindowNo = WindowNo;
    // End - fer_luck @ centuryon
    AEnv.positionCenterWindow(frame, this);
  } //	InfoProduct
Exemplo n.º 4
0
  public static ElementBean getMsg(Properties ctx, String text) {
    String language = Env.getContext(ctx, UdiConstants.LANGUAGE_CTX_PARAM);

    if (language == null || language.trim().length() == 0) {
      language = Language.AD_Language_en_US;
    }

    String msg = Msg.getElement(language, text, true);

    if (msg == null || msg == "") {
      msg = Msg.translate(language, text);
    }

    if (msg == null || msg == "") {
      msg = text;
    }

    int ind = msg.indexOf(Env.NL);
    if (ind != -1) msg = msg.substring(0, ind);

    ElementBean elementBean = new ElementBean();
    elementBean.setColumnName(text);
    elementBean.setDescription(msg);
    elementBean.setHelp(msg);
    elementBean.setName(msg);
    elementBean.setPrintName(msg);

    return elementBean;
  }
Exemplo n.º 5
0
 public ChangeVO updateRow(
     int windowNo,
     int AD_Tab_ID,
     int queryResultID,
     int relRowNo,
     Map<String, String> context,
     boolean force) {
   if (context == null || context.size() == 0)
     return new ChangeVO(true, Msg.translate(m_context, "NoContext"));
   ArrayList<String[]> data = m_results.get(queryResultID);
   if (data == null || data.size() == 0)
     return new ChangeVO(true, Msg.translate(m_context, "CachedDataNotFound"));
   UITab tab = getTab(AD_Tab_ID);
   if (tab == null) {
     log.config("Not found AD_Tab_ID=" + AD_Tab_ID);
     return new ChangeVO(true, Msg.translate(m_context, "@NotFound@ @AD_Tab_ID@=" + AD_Tab_ID));
   }
   CContext ctx = new CContext(m_context.entrySet());
   ctx.addWindow(windowNo, context);
   ChangeVO retValue;
   if (force) retValue = tab.saveRow(ctx, windowNo, false, null);
   else retValue = tab.saveRow(ctx, windowNo, false, data.get(relRowNo));
   if (retValue.hasError()) return retValue;
   // Update Results
   String[] dataRow = retValue.rowData.clone();
   data.set(relRowNo, dataRow);
   postProcessChangeVO(retValue, windowNo, context, dataRow, tab);
   retValue.trxInfo = GridTab.getTrxInfo(tab.getTableName(), ctx, windowNo, tab.getTabNo());
   if (retValue.isRefreshAll()) {}
   return retValue;
 }
Exemplo n.º 6
0
  @Override
  protected void afterAction() {

    super.afterAction();

    if (isIgnoreChange()) {

      SwingTool.setCursorsFromParent(window, false);
      return;
    }

    if (successful()) {

      ADialog.info(
          Env.getWindowNo(getWindow()),
          getWindow(),
          Msg.translate(Env.getCtx(), "Success"),
          getSuccessMsg());
    } else {

      ADialog.error(
          Env.getWindowNo(getWindow()),
          getWindow(),
          Msg.translate(Env.getCtx(), "Error"),
          getErrorMsg());
    }

    SwingTool.setCursorsFromParent(window, false);
  }
Exemplo n.º 7
0
 /**
  * Parse Variable
  *
  * @param variable variable
  * @param po po
  * @return translated variable or if not found the original tag
  */
 private String parseVariable(String variable, PO po) {
   int index = po.get_ColumnIndex(variable);
   if (index == -1) {
     StringBuilder msgreturn = new StringBuilder("@").append(variable).append("@");
     return msgreturn.toString(); // 	keep for next
   }
   //
   MColumn col = MColumn.get(Env.getCtx(), po.get_TableName(), variable);
   Object value = null;
   if (col != null && col.isSecure()) {
     value = "********";
   } else if (col.getAD_Reference_ID() == DisplayType.Date
       || col.getAD_Reference_ID() == DisplayType.DateTime
       || col.getAD_Reference_ID() == DisplayType.Time) {
     SimpleDateFormat sdf = DisplayType.getDateFormat(col.getAD_Reference_ID());
     value = sdf.format(po.get_Value(index));
   } else if (col.getAD_Reference_ID() == DisplayType.YesNo) {
     if (po.get_ValueAsBoolean(variable)) value = Msg.getMsg(Env.getCtx(), "Yes");
     else value = Msg.getMsg(Env.getCtx(), "No");
   } else {
     value = po.get_Value(index);
   }
   if (value == null) return "";
   return value.toString();
 } //	translate
  /** Dynamic Init. - Create GridController & Panel - AD_Column_ID from C_Order */
  public void dynInit() throws Exception {
    // Order Distribution
    MLookup orderL =
        MLookupFactory.get(
            Env.getCtx(),
            m_WindowNo,
            0,
            MColumn.getColumn_ID(MDDOrder.Table_Name, MDDOrder.COLUMNNAME_DD_Order_ID),
            DisplayType.Search);
    fOrder = new VLookup(MDDOrder.COLUMNNAME_DD_Order_ID, true, false, true, orderL);
    lOrder.setText(Msg.translate(Env.getCtx(), MDDOrder.COLUMNNAME_DD_Order_ID));
    fOrder.addVetoableChangeListener(this);
    lOrder.setVisible(false);
    fOrder.setVisible(false);

    MLookup llocator = MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, 53950, DisplayType.TableDir);
    fLocator = new VLookup(MLocator.COLUMNNAME_M_Locator_ID, true, false, true, llocator);
    lLocator.setText(Msg.translate(Env.getCtx(), "M_Locator_ID"));
    fLocator.addVetoableChangeListener(this);
    m_M_Locator_ID = fLocator.getValue();

    MLookup llocatorto =
        MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, 53949, DisplayType.TableDir);
    fLocatorTo = new VLookup("M_LocatorTo_ID", false, false, true, llocatorto);
    lLocatorTo.setText(Msg.translate(Env.getCtx(), "M_LocatorTo_ID"));
    fLocatorTo.addVetoableChangeListener(this);
    m_M_LocatorTo_ID = fLocatorTo.getValue();

    //	C_Order.C_BPartner_ID
    MLookup bpL = MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, 2762, DisplayType.Search);
    fBPartner = new VLookup("C_BPartner_ID", false, false, true, bpL);
    lBPartner.setText(Msg.translate(Env.getCtx(), "C_BPartner_ID"));
    fBPartner.addVetoableChangeListener(this);
    panel.getStatusBar().setStatusLine(Msg.getMsg(Env.getCtx(), "InventoryMoveGenerateSel"));
  } //	dynInit
Exemplo n.º 9
0
  /**
   * Action Listener
   *
   * @param e event
   */
  public void actionPerformed(ActionEvent e) {
    log.info(e.toString());

    //	Add new Node
    if (e.getSource() == m_NewMenuNode) {
      log.info("Create New Node");
      String nameLabel = Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Name"));
      String name =
          JOptionPane.showInputDialog(
              this,
              nameLabel, //	message
              Msg.getMsg(Env.getCtx(), "CreateNewNode"), // 	title
              JOptionPane.QUESTION_MESSAGE);
      if (name != null && name.length() > 0) {
        int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx());
        MWFNode node = new MWFNode(m_wf, name, name);
        node.setClientOrg(AD_Client_ID, 0);
        node.save();
        m_parent.load(m_wf.getAD_Workflow_ID(), true);
      }
    }
    //	Add/Delete Line
    else if (e.getSource() instanceof WFPopupItem) {
      WFPopupItem item = (WFPopupItem) e.getSource();
      item.execute();
    }
  } //	actionPerformed
Exemplo n.º 10
0
  private void init() {
    CPanel panel = new CPanel();
    panel.setLayout(new MigLayout());
    getContentPane().add(panel);

    panel.add(new CLabel(Msg.translate(posPanel.getCtx(), "SalesRep_ID")));

    username =
        new PosTextField(
            Msg.translate(posPanel.getCtx(), "SalesRep_ID"),
            posPanel,
            posPanel.p_pos.getOSK_KeyLayout_ID());

    panel.add(username, "wrap");

    panel.add(new CLabel(Msg.translate(posPanel.getCtx(), "UserPIN")));

    pin =
        new PosTextField(
            Msg.translate(posPanel.getCtx(), "UserPIN"),
            posPanel,
            posPanel.p_pos.getOSNP_KeyLayout_ID());

    panel.add(pin, "");

    AppsAction act = new AppsAction("Ok", KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), false);
    act.setDelegate(this);
    bProcess = (CButton) act.getButton();
    bProcess.setFocusable(false);
    panel.add(bProcess, "h 50!, w 50!");

    pack();
  }
Exemplo n.º 11
0
 /**
  * Perform process.
  *
  * @return Message (clear text)
  * @throws Exception if not successful
  */
 protected String doIt() throws Exception {
   if (m_C_ProjectLine_ID == 0) throw new IllegalArgumentException("No Project Line");
   MProjectLine projectLine = new MProjectLine(getCtx(), m_C_ProjectLine_ID, get_TrxName());
   log.info("doIt - " + projectLine);
   if (projectLine.getM_Product_ID() == 0) throw new IllegalArgumentException("No Product");
   //
   MProject project = new MProject(getCtx(), projectLine.getC_Project_ID(), get_TrxName());
   if (project.getM_PriceList_ID() == 0) throw new IllegalArgumentException("No PriceList");
   //
   boolean isSOTrx = true;
   MProductPricing pp =
       new MProductPricing(
           projectLine.getM_Product_ID(),
           project.getC_BPartner_ID(),
           projectLine.getPlannedQty(),
           isSOTrx);
   pp.setM_PriceList_ID(project.getM_PriceList_ID());
   pp.setPriceDate(project.getDateContract());
   //
   projectLine.setPlannedPrice(pp.getPriceStd());
   projectLine.setPlannedMarginAmt(pp.getPriceStd().subtract(pp.getPriceLimit()));
   projectLine.saveEx();
   //
   String retValue =
       Msg.getElement(getCtx(), "PriceList")
           + pp.getPriceList()
           + " - "
           + Msg.getElement(getCtx(), "PriceStd")
           + pp.getPriceStd()
           + " - "
           + Msg.getElement(getCtx(), "PriceLimit")
           + pp.getPriceLimit();
   return retValue;
 } //	doIt
Exemplo n.º 12
0
  /**
   * Initialize Lookups
   *
   * @return true if OK
   */
  private boolean initLookups() {
    try {
      int AD_Column_ID = COLUMN_S_RESOURCE_S_RESOURCETYPE_ID; // 	S_Resource.S_ResourceType_ID

      fieldResourceType =
          new WSearchEditor(
              MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.TableDir),
              Msg.translate(Env.getCtx(), "S_ResourceType_ID"),
              "",
              false,
              false,
              true);

      AD_Column_ID =
          COLUMN_S_RESOURCEASSIGNMENT_S_RESOURCE_ID; //	S_ResourceAssignment.S_Resource_ID

      fieldResource =
          new WSearchEditor(
              MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.TableDir),
              Msg.translate(Env.getCtx(), "S_Resource_ID"),
              "",
              false,
              false,
              true);
    } catch (Exception e) {
      log.log(Level.SEVERE, "InfoAssignment.initLookup");
      return false;
    }

    bNew.setImage(ThemeManager.getThemeResource("images/New16.png"));

    return true;
  } // initLookups
Exemplo n.º 13
0
  /** Reload/Load file */
  private void cmd_reloadFile() {
    if (m_file_istream == null) return;

    m_data.clear();
    rawData.setText("");

    try {
      //  see NaturalAccountMap

      ListItem listitem = fCharset.getSelectedItem();
      Charset charset = null;

      if (listitem == null) return;

      charset = (Charset) listitem.getValue();
      BufferedReader in = new BufferedReader(new InputStreamReader(m_file_istream, charset), 10240);

      //	not safe see p108 Network pgm
      String s = null;
      String concat = "";

      while ((s = in.readLine()) != null) {
        m_data.add(s);

        concat += s;
        concat += "\n";

        if (m_data.size() < MAX_LOADED_LINES) {
          rawData.setValue(concat);
        }
      }
      in.close();
    } catch (Exception e) {
      log.log(Level.SEVERE, "", e);
      bFile.setLabel(Msg.getMsg(Env.getCtx(), "FileImportFile"));
    }

    int index = 1; // 	second line as first may be heading

    if (m_data.size() == 1) index = 0;

    int length = 0;

    if (m_data.size() > 0) length = m_data.get(index).toString().length();

    info.setValue(
        Msg.getMsg(Env.getCtx(), "Records")
            + "="
            + m_data.size()
            + ", "
            + Msg.getMsg(Env.getCtx(), "Length")
            + "="
            + length
            + "   ");

    // setCursor (Cursor.getDefaultCursor());

    log.config("Records=" + m_data.size() + ", Length=" + length);
  } //	cmd_loadFile
Exemplo n.º 14
0
  @Override
  protected boolean beforeSave(boolean newRecord) {
    //	Check Storage
    if (!newRecord
        && //
        ((is_ValueChanged("IsActive") && !isActive()) // 	now not active
            || (is_ValueChanged("IsStocked") && !isStocked()) // 	now not stocked
            || (is_ValueChanged("ProductType") // 	from Item
                && PRODUCTTYPE_Item.equals(get_ValueOld("ProductType"))))) {
      MStorage[] storages = MStorage.getOfProduct(getCtx(), get_ID(), get_TrxName());
      BigDecimal OnHand = Env.ZERO;
      BigDecimal Ordered = Env.ZERO;
      BigDecimal Reserved = Env.ZERO;
      for (int i = 0; i < storages.length; i++) {
        OnHand = OnHand.add(storages[i].getQtyOnHand());
        Ordered = Ordered.add(storages[i].getQtyOrdered());
        Reserved = Reserved.add(storages[i].getQtyReserved());
      }
      String errMsg = "";
      if (OnHand.signum() != 0) errMsg = "@QtyOnHand@ = " + OnHand;
      if (Ordered.signum() != 0) errMsg += " - @QtyOrdered@ = " + Ordered;
      if (Reserved.signum() != 0) errMsg += " - @QtyReserved@" + Reserved;
      if (errMsg.length() > 0) {
        log.saveError("Error", Msg.parseTranslation(getCtx(), errMsg));
        return false;
      }
    } //	storage

    // it checks if UOM has been changed , if so disallow the change if the condition is true.
    if ((!newRecord) && is_ValueChanged("C_UOM_ID") && hasInventoryOrCost()) {
      log.saveError("Error", Msg.getMsg(getCtx(), "SaveUomError"));
      return false;
    }

    //	Reset Stocked if not Item
    // AZ Goodwill: Bug Fix isStocked always return false
    // if (isStocked() && !PRODUCTTYPE_Item.equals(getProductType()))
    if (!PRODUCTTYPE_Item.equals(getProductType())) setIsStocked(false);

    //	UOM reset
    if (m_precision != null && is_ValueChanged("C_UOM_ID")) m_precision = null;

    // AttributeSetInstance reset
    if (is_ValueChanged(COLUMNNAME_M_AttributeSet_ID)) {
      MAttributeSetInstance asi =
          new MAttributeSetInstance(getCtx(), getM_AttributeSetInstance_ID(), get_TrxName());
      setM_AttributeSetInstance_ID(0);
      // Delete the old m_attributesetinstance
      try {
        asi.deleteEx(true, get_TrxName());
      } catch (AdempiereException ex) {
        log.saveError("Error", "Error deleting the AttributeSetInstance");
        return false;
      }
    }

    return true;
  } //	beforeSave
  /** import record using X_I_ProductPlanning table */
  private void importRecords() {
    for (X_I_ProductPlanning ipp : getRecords(false, p_IsImportOnlyNoErrors)) {
      if (ipp.getM_Product_ID() > 0 && ipp.getS_Resource_ID() > 0 && ipp.getM_Warehouse_ID() > 0) {
        importProductPlanning(ipp);
      } else if (ipp.getForecastValue() == null || ipp.getM_Forecast_ID() == 0) {
        String error = "";
        if (ipp.getM_Product_ID() == 0) {
          error = error + " @M_Product_ID@ @NotFound@ ,";
        }
        if (ipp.getS_Resource_ID() == 0) {
          error = error + " @S_Resource_ID@ @NotFound@ ,";
        }
        if (ipp.getM_Warehouse_ID() == 0) {
          error = error + " @M_Waehouse_ID@ @NotFound@";
        }
        ipp.setI_ErrorMsg(Msg.parseTranslation(getCtx(), error));
        isImported = false;
        ipp.saveEx();
        return;
      }

      if (ipp.getForecastValue() == null) {
        isImported = true;

      } else if (ipp.getM_Forecast_ID() > 0
          && ipp.getM_Warehouse_ID() > 0
          && ipp.getM_Product_ID() > 0
          && ipp.getQty().signum() > 0) {
        importForecast(ipp);
      } else {
        String error = "";
        if (ipp.getM_Forecast_ID() == 0) {
          error = error + " @M_Forecast_ID@ @NotFound@ ,";
        }
        if (ipp.getM_Warehouse_ID() == 0) {
          error = error + " @M_Warehouse_ID@ @NotFound@ ,";
        }
        if (ipp.getQty().signum() <= 0) {
          error = error + " @Qty@ @Error@";
        }
        ipp.setI_ErrorMsg(Msg.parseTranslation(getCtx(), error));
        isImported = false;
        ipp.saveEx();
        return;
      }

      if (isImported) {
        ipp.setI_IsImported(true);
        ipp.setProcessed(true);
        ipp.saveEx();
      }
    }
  }
  private void jbInit() {
    setLayout(new BorderLayout(10, 10));

    JTabbedPane tabbedPane = new JTabbedPane();

    tabbedPane.addTab(
        Msg.translate(Env.getCtx(), "Installed Plugins"), generateInstalledSoftPanel());
    tabbedPane.addTab(
        Msg.translate(Env.getCtx(), "Install new Plugins"), generateRepositoriesPanel());

    add(tabbedPane);
  }
  /**
   * Static Init.
   *
   * <pre>
   *  mainPanel
   *      northPanel
   *      centerPanel
   *          xMatched
   *          xPanel
   *          xMathedTo
   *      southPanel
   *  </pre>
   *
   * @throws Exception
   */
  private void jbInit() throws Exception {
    mainPanel.setLayout(mainLayout);
    northPanel.setLayout(northLayout);

    southPanel.setLayout(southLayout);
    generate.setText(Msg.translate(Env.getCtx(), "XX_PrintSelectedLabels"));
    generate.setEnabled(true);

    markall.setText(Msg.translate(Env.getCtx(), "XX_CheckAll"));
    markall.setEnabled(true);

    centerPanel.setLayout(centerLayout);
    xProductScrollPane.setBorder(xProductBorder);
    xProductScrollPane.setPreferredSize(new Dimension(1024, 350));

    xPanel.setLayout(xLayout);

    mainPanel.add(northPanel, BorderLayout.NORTH);
    mainPanel.add(southPanel, BorderLayout.SOUTH);
    mainPanel.add(centerPanel, BorderLayout.CENTER);
    centerPanel.add(xProductScrollPane, BorderLayout.CENTER);
    xProductScrollPane.getViewport().add(xProductTable, null);

    southPanel.add(
        markall,
        new GridBagConstraints(
            6,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 12, 5, 12),
            0,
            0));
    southPanel.add(
        generate,
        new GridBagConstraints(
            8,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 12, 5, 12),
            0,
            0));
  } //  jbInit*/
Exemplo n.º 18
0
 /**
  * Get Measure Display Text
  *
  * @return Measure Display Text
  */
 public String getXAxisText() {
   MMeasure measure = getMeasure();
   if (measure != null
       && X_PA_Measure.MEASUREDATATYPE_StatusQtyAmount.equals(measure.getMeasureDataType())) {
     if (X_PA_Measure.MEASURETYPE_Request.equals(measure.getMeasureType()))
       return Msg.getElement(getCtx(), "R_Status_ID");
     if (X_PA_Measure.MEASURETYPE_Project.equals(measure.getMeasureType()))
       return Msg.getElement(getCtx(), "C_Phase_ID");
   }
   String value = getMeasureDisplay();
   String display = MRefList.getListName(getCtx(), X_Ref_PA_Goal_Scope.AD_Reference_ID, value);
   return display == null ? value : display;
 } //	getMeasureDisplayText
Exemplo n.º 19
0
 /**
  * Get individual Change HTML
  *
  * @param sb string to append to
  * @param columnName column name
  */
 private void getChangeHTML(StringBuffer sb, String columnName) {
   if (get_Value(columnName) != null) {
     if (sb.length() > 0) sb.append("<br>");
     sb.append(Msg.getElement(getCtx(), columnName))
         .append(": ")
         .append(get_DisplayValue(columnName, true));
   } else {
     String nc = getNullColumns();
     if (nc != null && nc.indexOf(columnName) != -1) {
       if (sb.length() > 0) sb.append("<br>");
       sb.append("(").append(Msg.getElement(getCtx(), columnName)).append(")");
     }
   }
 } //	getChangeHTML
Exemplo n.º 20
0
 /**
  * Static component init.
  *
  * <pre>
  *  - panel
  *      - northPanel
  *          - parameterPanel
  *          - toolBar
  *      - gridController
  *      - confirmPanel
  *  - statusBar
  *  </pre>
  *
  * @throws Exception
  */
 void jbInit() throws Exception {
   // [ 1707303 ] Account Combination Form(VAccountDialog) translation issue
   titledBorder =
       new TitledBorder(
           BorderFactory.createEtchedBorder(Color.white, new Color(134, 134, 134)),
           Msg.getMsg(Env.getCtx(), "Parameter"));
   //
   panelLayout.setHgap(5);
   panelLayout.setVgap(5);
   northLayout.setHgap(5);
   northLayout.setVgap(5);
   //
   parameterPanel.setLayout(parameterLayout);
   parameterPanel.setBorder(titledBorder);
   northPanel.setLayout(northLayout);
   toolBar.setOrientation(JToolBar.VERTICAL);
   toolBar.setBorder(null);
   toolBar.setRequestFocusEnabled(false);
   toolBar.setBorderPainted(false);
   toolBar.setMargin(new Insets(5, 5, 5, 5));
   bSave.setIcon(new ImageIcon(ResourceFinder.getResource("images/Save24.gif")));
   bSave.setMargin(new Insets(2, 2, 2, 2));
   bSave.setToolTipText(Msg.getMsg(Env.getCtx(), "AccountNewUpdate"));
   bSave.addActionListener(this);
   bRefresh.setIcon(new ImageIcon(ResourceFinder.getResource("images/Refresh24.gif")));
   bRefresh.setMargin(new Insets(2, 2, 2, 2));
   bRefresh.setToolTipText(Msg.getMsg(Env.getCtx(), "Refresh"));
   bRefresh.addActionListener(this);
   bIgnore.setIcon(new ImageIcon(ResourceFinder.getResource("images/Ignore24.gif")));
   bIgnore.setMargin(new Insets(2, 2, 2, 2));
   bIgnore.setToolTipText(Msg.getMsg(Env.getCtx(), "Ignore"));
   bIgnore.addActionListener(this);
   //
   toolBar.addSeparator();
   toolBar.add(bRefresh, null);
   toolBar.add(bIgnore, null);
   toolBar.add(bSave, null);
   //
   getContentPane().add(panel);
   panel.setLayout(panelLayout);
   panel.add(confirmPanel, BorderLayout.SOUTH);
   panel.add(northPanel, BorderLayout.NORTH);
   northPanel.add(parameterPanel, BorderLayout.CENTER);
   northPanel.add(toolBar, BorderLayout.EAST);
   //
   this.getContentPane().add(statusBar, BorderLayout.SOUTH);
   confirmPanel.addActionListener(this);
 } //	jbInit
  /**
   * Import Forecast Record using X_I_ProductPlanning table
   *
   * @param ipp X_I_ProductPlanning
   */
  private void importForecast(X_I_ProductPlanning ipp) {

    if (ipp.getForecastValue() == null && ipp.getM_Forecast_ID() == 0) {
      ipp.setI_ErrorMsg(Msg.getMsg(getCtx(), "@M_Forecast_ID@ @NotFound@"));
      ipp.saveEx();
      isImported = false;
      return;
    }

    MForecast forecast = new MForecast(getCtx(), ipp.getM_Forecast_ID(), get_TrxName());

    final StringBuffer whereClause = new StringBuffer();
    whereClause
        .append(X_M_ForecastLine.COLUMNNAME_M_Forecast_ID)
        .append("=? AND ")
        .append(X_M_ForecastLine.COLUMNNAME_M_Product_ID)
        .append("=? AND ")
        .append(X_M_ForecastLine.COLUMNNAME_M_Warehouse_ID)
        .append("=? AND ")
        .append(X_M_ForecastLine.COLUMNNAME_DatePromised)
        .append("=? AND ")
        .append(X_M_ForecastLine.COLUMNNAME_SalesRep_ID)
        .append("=?");

    X_M_ForecastLine forecastLine = null;
    if (ipp.getM_ForecastLine_ID() > 0) {
      forecastLine = new X_M_ForecastLine(getCtx(), ipp.getM_ForecastLine_ID(), get_TrxName());
    } else {
      forecastLine =
          new Query(getCtx(), X_M_ForecastLine.Table_Name, whereClause.toString(), get_TrxName())
              .setClient_ID()
              .setParameters(
                  new Object[] {
                    ipp.getM_Forecast_ID(),
                    ipp.getM_Product_ID(),
                    ipp.getM_Warehouse_ID(),
                    ipp.getDatePromised(),
                    ipp.getSalesRep_ID()
                  })
              .first();
    }

    if (forecastLine == null) {
      forecastLine = new X_M_ForecastLine(getCtx(), 0, get_TrxName());
    }

    forecastLine.setM_Forecast_ID(ipp.getM_Forecast_ID());
    forecastLine.setAD_Org_ID(ipp.getAD_Org_ID());
    forecastLine.setM_Product_ID(ipp.getM_Product_ID());
    forecastLine.setM_Warehouse_ID(ipp.getM_Warehouse_ID());
    forecastLine.setC_Period_ID(
        MPeriod.getC_Period_ID(getCtx(), ipp.getDatePromised(), ipp.getAD_Org_ID()));
    forecastLine.setDatePromised(ipp.getDatePromised());
    forecastLine.setSalesRep_ID(ipp.getSalesRep_ID());
    forecastLine.setQty(ipp.getQty());
    forecastLine.saveEx();
    ipp.setM_ForecastLine_ID(forecastLine.getM_ForecastLine_ID());
    ipp.saveEx();
    isImported = true;
  }
Exemplo n.º 22
0
 /**
  * Reset Display
  *
  * @param selIndex select index
  * @return selected activity
  */
 private MWFActivity resetDisplay(int selIndex) {
   fAnswerText.setVisible(false);
   fAnswerList.setVisible(false);
   fAnswerButton.setVisible(false);
   fAnswerButton.setImage("/images/mWindow.png");
   fTextMsg.setReadonly(!(selIndex >= 0));
   bZoom.setEnabled(selIndex >= 0);
   bOK.setEnabled(selIndex >= 0);
   fForward.setValue(null);
   fForward.setReadWrite(selIndex >= 0);
   //
   statusBar.setStatusDB(String.valueOf(selIndex + 1) + "/" + m_activities.length);
   m_activity = null;
   m_column = null;
   if (m_activities.length > 0) {
     if (selIndex >= 0 && selIndex < m_activities.length) m_activity = m_activities[selIndex];
   }
   //	Nothing to show
   if (m_activity == null) {
     fNode.setText("");
     fDescription.setText("");
     fHelp.setText("");
     fHistory.setContent(HISTORY_DIV_START_TAG + "&nbsp;</div>");
     statusBar.setStatusDB("0/0");
     statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "WFNoActivities"));
   }
   return m_activity;
 } //	resetDisplay
Exemplo n.º 23
0
 /**
  * Execute Task and wait
  *
  * @return execution info
  */
 public String execute() {
   String cmd = Msg.parseTranslation(Env.getCtx(), getOS_Command()).trim();
   if (cmd == null || cmd.equals("")) return "Cannot execute '" + getOS_Command() + "'";
   //
   if (isServerProcess()) return executeRemote(cmd);
   return executeLocal(cmd);
 } //	execute
Exemplo n.º 24
0
  /**
   * Get and calculate Product Pricing
   *
   * @param M_PriceList_ID id
   * @param M_PriceList_Version_ID
   * @return product pricing
   */
  private MProductPricing getProductPricing(int M_PriceList_ID, int M_PriceList_Version_ID) {
    final I_M_PriceList_Version plv =
        InterfaceWrapperHelper.create(
            getCtx(), M_PriceList_Version_ID, I_M_PriceList_Version.class, get_TrxName());
    if (M_PriceList_Version_ID > 0) {
      // If we have a pricelist version, make sure it belongs to the pricelist
      Check.assume(
          M_PriceList_ID == plv.getM_PriceList_ID(),
          Msg.getMsg(getCtx(), MSG_PriceListVersionInvalid));
    }

    m_productPrice =
        new MProductPricing(getM_Product_ID(), getC_BPartner_ID(), getQtyOrdered(), m_IsSOTrx);

    m_productPrice.setReferencedObject(
        this); // 03152: setting the 'ol' to allow the subscription system to compute the right
               // price
    m_productPrice.setPriceDate(
        getDatePromised()); // important: need to use the data when the service will be provided, so
                            // we make sure that we get the right PLV
    m_productPrice.setM_PriceList_ID(M_PriceList_ID);
    m_productPrice.setPriceDate(getDateOrdered());
    m_productPrice.setM_PriceList_Version_ID(M_PriceList_Version_ID);
    //
    m_productPrice.calculatePrice();
    return m_productPrice;
  } // getProductPrice
Exemplo n.º 25
0
 /**
  * Set Log of Process.
  *
  * <pre>
  *  - Translated Process Message
  *  - List of log entries
  *      Date - Number - Msg
  *  </pre>
  *
  * @param html if true with HTML markup
  * @return Log Info
  */
 public String getLogInfo(boolean html) {
   if (m_logs == null) return "";
   //
   StringBuilder sb = new StringBuilder();
   SimpleDateFormat dateFormat = DisplayType.getDateFormat(DisplayType.Date);
   if (html) sb.append("<table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"2\">");
   //
   for (int i = 0; i < m_logs.size(); i++) {
     if (html) sb.append("<tr>");
     else if (i > 0) sb.append("\n");
     //
     ProcessInfoLog log = m_logs.get(i);
     /**
      * if (log.getP_ID() != 0) sb.append(html ? "<td>" : "") .append(log.getP_ID()) .append(html ?
      * "</td>" : " \t"); *
      */
     //
     if (log.getP_Date() != null)
       sb.append(html ? "<td>" : "")
           .append(dateFormat.format(log.getP_Date()))
           .append(html ? "</td>" : " \t");
     //
     if (log.getP_Number() != null)
       sb.append(html ? "<td>" : "").append(log.getP_Number()).append(html ? "</td>" : " \t");
     //
     if (log.getP_Msg() != null)
       sb.append(html ? "<td>" : "")
           .append(Msg.parseTranslation(Env.getCtx(), log.getP_Msg()))
           .append(html ? "</td>" : "");
     //
     if (html) sb.append("</tr>");
   }
   if (html) sb.append("</table>");
   return sb.toString();
 } //	getLogInfo
Exemplo n.º 26
0
  public boolean validateSql() {
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    String sql = getSql();
    try {
      String countSql = Msg.parseTranslation(Env.getCtx(), sql.toString()); // 	Variables
      countSql =
          MRole.getDefault()
              .addAccessSQL(
                  countSql,
                  MTable.getTableName(Env.getCtx(), getAD_Table_ID()), // getTableName(),
                  MRole.SQL_FULLYQUALIFIED,
                  MRole.SQL_RO);

      pstmt = DB.prepareStatement(countSql, null);
      //	pstmt.setString(1, p_tableName);
      rs = pstmt.executeQuery();
      while (rs.next()) {
        break;
      }
    } catch (SQLException e) {
      // ADialog.error(WindowNo, c, AD_Message)
      // Env.getUi().showError(0, null, sql.toString() + "<br> " + e.getMessage());
      log.log(Level.SEVERE, sql, e);
      // String error = e.toString();
      // show error to user and return: TODO
      return false;
    } finally {
      DB.close(rs, pstmt);
      rs = null;
      pstmt = null;
    }
    return true;
  } // validate sql
  private void install() {
    ArrayList<IUnitModel> iunits = new ArrayList<IUnitModel>();
    for (int i = 0; i < repoAppsList.size(); i++) {
      IUnitModel iunit = repoAppsList.get(i);
      if (iunit.isSelected()) {
        iunits.add(iunit);
      }
    }

    if (P2.get().install(iunits)) {
      ADialog.info(0, this, Msg.getMsg(Env.getAD_Language(ctx), "OK"));
    } else {
      ADialog.error(
          0, this, Msg.getMsg(Env.getAD_Language(ctx), "Updates are not correctly installed "));
    }
  }
Exemplo n.º 28
0
  /**
   * Show History
   *
   * @param C_BPartner_ID partner
   * @param M_Product_ID product
   * @param M_Warehouse_ID warehouse
   * @param M_AttributeSetInstance_ID ASI
   */
  public InvoiceHistory(
      Window parent,
      int C_BPartner_ID,
      int M_Product_ID,
      int M_Warehouse_ID,
      int M_AttributeSetInstance_ID) {
    super();
    setTitle(Msg.getMsg(Env.getCtx(), "PriceHistory"));
    if (log.isLoggable(Level.CONFIG))
      log.config(
          "C_BPartner_ID="
              + C_BPartner_ID
              + ", M_Product_ID="
              + M_Product_ID
              + ", M_Warehouse_ID="
              + M_Warehouse_ID
              + ", M_AttributeSetInstance_ID="
              + M_AttributeSetInstance_ID);
    m_C_BPartner_ID = C_BPartner_ID;
    m_M_Product_ID = M_Product_ID;
    m_M_Warehouse_ID = M_Warehouse_ID;
    m_M_AttributeSetInstance_ID = M_AttributeSetInstance_ID;
    try {
      jbInit();
      dynInit();
    } catch (Exception ex) {
      log.log(Level.SEVERE, "", ex);
    }

    this.setSclass("popup-dialog");
    AEnv.showCenterWindow(parent, this);
    if (parent instanceof InfoProductWindow)
      showDetailATP = ((InfoProductWindow) parent).isShowDetailATP();
  } //	InvoiceHistory
Exemplo n.º 29
0
 /**
  * Show WHO
  *
  * @param e event
  */
 void mouseClicked(MouseEvent e) {
   if (m_dse == null || m_dse.CreatedBy == null || !MRole.getDefault().isShowPreference()) return;
   //
   String title = Msg.getMsg(Env.getCtx(), "Who") + m_text;
   RecordInfo info = new RecordInfo(Env.getFrame(this), title, m_dse);
   AEnv.showCenterScreen(info);
 } //	addStatusComponent
Exemplo n.º 30
0
  /**
   * Before Save
   *
   * @param newRecord new
   * @return
   */
  @Override
  protected boolean beforeSave(boolean newRecord) {
    setName(get_ValueAsString("Name").toUpperCase());

    String SQL =
        "SELECT * FROM XX_VMR_LongCharacteristic "
            + "WHERE XX_VMR_Department_ID="
            + getXX_VMR_Department_ID()
            + " AND XX_VMR_Line_ID="
            + getXX_VMR_Line_ID()
            + " AND XX_VMR_Section_ID="
            + getXX_VMR_Section_ID()
            + " AND isactive='Y' AND name = '"
            + getName()
            + "'";

    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
      pstmt = DB.prepareStatement(SQL, null);
      rs = pstmt.executeQuery();

      if (rs.next()) {
        log.saveError("", Msg.getMsg(getCtx(), "XX_CharacteristicRepeated"));
        return false;
      }

    } catch (Exception e) {
      e.getMessage();
    }

    return true;
  } // beforeSave