Exemple #1
0
        /// <summary>
        /// Create Main Panel.
        /// Called when changing Product
        /// </summary>
        public List <BOMLines> CreateMainPanel(Ctx ctx, int productID)
        {
            String title = Msg.GetMsg(ctx, "SelectProduct");

            _product = new MProduct(ctx, productID, null);
            if (_product != null && _product.Get_ID() > 0)
            {
                title = _product.GetName();
                if (_product.GetDescription() != null && _product.GetDescription().Length > 0)
                {
                    //this.setToolTipText(_product.getDescription());
                }
                _bomLine = 0;
                BomLines(ctx, _product, _qty);
            }
            return(lstBOMLines);
        }
        /// <summary>
        /// Is this an Item Product (vs. not a Service, a charge)
        /// </summary>
        /// <returns>true if product</returns>
        public bool IsItem()
        {
            if (_isItem != null)
            {
                return(Utility.Util.GetValueOfBool(_isItem));//.booleanValue();
            }

            _isItem = false;
            if (GetM_Product_ID() != 0)
            {
                MProduct product = MProduct.Get(_po.GetCtx(), GetM_Product_ID());
                if (product.Get_ID() == GetM_Product_ID() && product.IsItem())
                {
                    _isItem = true;
                }
            }
            return(Utility.Util.GetValueOfBool(_isItem));//.booleanValue();
        }
        /// <summary>
        /// Perform Process.
        /// </summary>
        /// <returns>Message (text with variables)</returns>
        protected override String DoIt()
        {
            log.Info("M_Product_ID=" + _M_Product_ID);
            if (_M_Product_ID == 0)
            {
                throw new Exception("@NotFound@: @M_Product_ID@ = " + _M_Product_ID);
            }
            MProduct product = MProduct.Get(GetCtx(), _M_Product_ID);

            if (product.Get_ID() != _M_Product_ID)
            {
                throw new Exception("@NotFound@: @M_Product_ID@ = " + _M_Product_ID);
            }
            //
            if (MCostDetail.ProcessProduct(product, Get_Trx()))
            {
                return("@OK@");
            }
            return("@Error@");
        }