private void assignProduct(ProductInfoExt prod) {

    if (jproduct.isEnabled()) {
      if (prod == null) {
        productid = null;
        productref = null;
        productcode = null;
        productname = null;
        attsetid = null;
        attsetinstid = null;
        attsetinstdesc = null;
        jproduct.setText(null);
        m_jcodebar.setText(null);
        m_jreference.setText(null);
        jattributes.setText(null);
      } else {
        productid = prod.getID();
        productref = prod.getReference();
        productcode = prod.getCode();
        productname = prod.toString();
        attsetid = prod.getAttributeSetID();
        attsetinstid = null;
        attsetinstdesc = null;
        jproduct.setText(productname);
        m_jcodebar.setText(productcode);
        m_jreference.setText(productref);
        jattributes.setText(null);

        // calculo el precio sugerido para la entrada.
        MovementReason reason = (MovementReason) m_ReasonModel.getSelectedItem();
        Double dPrice = reason.getPrice(prod.getPriceBuy(), prod.getPriceSell());
        m_jprice.setText(Formats.CURRENCY.formatValue(dPrice));
      }
    }
  }
 /** @param prod */
 protected void fireSelectedProduct(ProductInfoExt prod) {
   EventListener[] l = listeners.getListeners(ActionListener.class);
   ActionEvent e = null;
   for (EventListener l1 : l) {
     if (e == null) {
       e = new ActionEvent(prod, ActionEvent.ACTION_PERFORMED, prod.getID());
     }
     ((ActionListener) l1).actionPerformed(e);
   }
 }
예제 #3
0
 public List<ProductInfoExt> getProductCatalog(String category) throws BasicException {
   return new PreparedSentence(
           s,
           "SELECT P.ID, P.REFERENCE, P.CODE, P.NAME, P.ISCOM, P.ISSCALE, P.PRICEBUY, P.PRICESELL, P.TAXCAT, P.CATEGORY, P.ATTRIBUTESET_ID, P.IMAGE, P.ATTRIBUTES "
               + "FROM PRODUCTS P, PRODUCTS_CAT O WHERE P.ID = O.PRODUCT AND P.CATEGORY = ? "
               + "ORDER BY O.CATORDER, P.CODE",
           SerializerWriteString.INSTANCE,
           ProductInfoExt.getSerializerRead())
       .list(category);
 }
예제 #4
0
 public final ProductInfoExt getProductInfoByReference(String sReference) throws BasicException {
   return (ProductInfoExt)
       new PreparedSentence(
               s,
               "SELECT ID, REFERENCE, CODE, NAME, ISCOM, ISSCALE, PRICEBUY, PRICESELL, TAXCAT, CATEGORY, ATTRIBUTESET_ID, IMAGE, ATTRIBUTES "
                   + "FROM PRODUCTS WHERE REFERENCE = ?",
               SerializerWriteString.INSTANCE,
               ProductInfoExt.getSerializerRead())
           .find(sReference);
 }
  private void showProductPanel(String id) {
    ProductInfoExt product = m_productsset.get(id);
    if (product == null) {
      if (m_productsset.containsKey(id)) {
      } else {
        try {
          java.util.List<ProductInfoExt> products = m_dlSales.getProductComments(id);

          if (products.isEmpty()) {
            m_productsset.put(id, null);
          } else {
            product = m_dlSales.getProductInfo(id);
            m_productsset.put(id, product);

            JCatalogTab jcurrTab = new JCatalogTab();
            jcurrTab.applyComponentOrientation(getComponentOrientation());
            m_jProducts.add(jcurrTab, "PRODUCT." + id);

            // Add products
            for (ProductInfoExt prod : products) {
              jcurrTab.addButton(
                  new ImageIcon(tnbbutton.getThumbNailText(prod.getImage(), getProductLabel(prod))),
                  new SelectedAction(prod),
                  prod.getTextTip(),
                  "");
            }
            CardLayout cl = (CardLayout) (m_jProducts.getLayout());
            cl.show(m_jProducts, "PRODUCT." + id);
          }
        } catch (BasicException eb) {
          m_productsset.put(id, null);
        }
      }
    } else {

      CardLayout cl = (CardLayout) (m_jProducts.getLayout());
      cl.show(m_jProducts, "PRODUCT." + id);
    }
  }
예제 #6
0
 public List<ProductInfoExt> getProductComments(String id) throws BasicException {
   return new PreparedSentence(
           s,
           "SELECT P.ID, P.REFERENCE, P.CODE, P.NAME, P.ISCOM, P.ISSCALE, P.PRICEBUY, P.PRICESELL, P.TAXCAT, P.CATEGORY, P.ATTRIBUTESET_ID, P.IMAGE, P.ATTRIBUTES "
               + "FROM PRODUCTS P, PRODUCTS_CAT O, PRODUCTS_COM M WHERE P.ID = O.PRODUCT AND P.ID = M.PRODUCT2 AND M.PRODUCT = ? "
               + "AND P.ISCOM = "
               + s.DB.TRUE()
               + " "
               + "ORDER BY O.CATORDER, P.NAME",
           SerializerWriteString.INSTANCE,
           ProductInfoExt.getSerializerRead())
       .list(id);
 }
 private void buildProductPanel() {
   try {
     JCatalogTab jcurrTab = new JCatalogTab();
     m_jProducts.add(jcurrTab, "");
     java.util.List<ProductInfoExt> prods = m_dlSales.getAllProductCatalog();
     for (ProductInfoExt prod : prods) {
       newColour = m_dlSales.getCategoryColour(prod.getCategoryID());
       String sColour = (String) newColour;
       if (sColour == null) {
         sColour = "";
       }
       jcurrTab.addButton(
           new ImageIcon(tnbbutton.getThumbNailText(prod.getImage(), getProductLabel(prod))),
           new SelectedAction(prod),
           prod.getTextTip(),
           sColour);
     }
   } catch (BasicException e) {
     JMessageDialog.showMessage(
         this,
         new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.notactive"), e));
   }
 }
 private String getProductLabel(ProductInfoExt product) {
   if (pricevisible) {
     if (taxesincluded) {
       TaxInfo tax = taxeslogic.getTaxInfo(product.getTaxCategoryID());
       return "<html><center>" + product.getName() + "<br>" + product.printPriceSellTax(tax);
     } else {
       return "<html><center>" + product.getDisplay() + "<br>" + product.printPriceSell();
     }
   } else {
     return product.getDisplay();
   }
 }
예제 #9
0
 // Products list
 public final SentenceList getProductList() {
   return new StaticSentence(
       s,
       new QBFBuilder(
           "SELECT ID, REFERENCE, CODE, NAME, ISCOM, ISSCALE, PRICEBUY, PRICESELL, TAXCAT, CATEGORY, ATTRIBUTESET_ID, IMAGE, ATTRIBUTES "
               + "FROM PRODUCTS WHERE ?(QBF_FILTER) ORDER BY REFERENCE",
           new String[] {"NAME", "PRICEBUY", "PRICESELL", "CATEGORY", "CODE"}),
       new SerializerWriteBasic(
           new Datas[] {
             Datas.OBJECT,
             Datas.STRING,
             Datas.OBJECT,
             Datas.DOUBLE,
             Datas.OBJECT,
             Datas.DOUBLE,
             Datas.OBJECT,
             Datas.STRING,
             Datas.OBJECT,
             Datas.STRING
           }),
       ProductInfoExt.getSerializerRead());
 }