コード例 #1
0
 /// <summary>
 /// Parent Constructor
 /// </summary>
 /// <param name="rfq">rfq</param>
 /// <param name="partner">web response</param>
 public MRfQResponse(MRfQ rfq, MBPartner partner)
     : this(rfq, null,
            partner.GetC_BPartner_ID(),
            partner.GetPrimaryC_BPartner_Location_ID(),
            partner.GetPrimaryAD_User_ID())
 {
 }
コード例 #2
0
 /// <summary>
 /// Parent Constructor
 /// </summary>
 /// <param name="rfq"></param>
 /// <param name="subscriber"></param>
 public MRfQResponse(MRfQ rfq, MRfQTopicSubscriber subscriber)
     : this(rfq, subscriber,
            subscriber.GetC_BPartner_ID(),
            subscriber.GetC_BPartner_Location_ID(),
            subscriber.GetAD_User_ID())
 {
 }
コード例 #3
0
 /// <summary>
 ///     Get RfQ
 /// </summary>
 /// <returns>rfq</returns>
 public MRfQ GetRfQ()
 {
     if (_rfq == null)
     {
         _rfq = MRfQ.Get(GetCtx(), GetC_RfQ_ID(), Get_TrxName());
     }
     return(_rfq);
 }
コード例 #4
0
        /// <summary>
        /// Get MRfQ from Cache
        /// </summary>
        /// <param name="ctx">context</param>
        /// <param name="C_RfQ_ID">ID</param>
        /// <param name="trxName">transction</param>
        /// <returns>MRFQ</returns>
        public static MRfQ Get(Ctx ctx, int C_RfQ_ID, Trx trxName)
        {
            int  key      = C_RfQ_ID;
            MRfQ retValue = (MRfQ)s_cache[key];

            if (retValue != null)
            {
                return(retValue);
            }
            retValue = new MRfQ(ctx, C_RfQ_ID, trxName);
            if (retValue.Get_ID() != 0)
            {
                s_cache.Add(key, retValue);
            }
            return(retValue);
        }
コード例 #5
0
        /// <summary>
        /// Parent Constructor.
        /// Automatically saved if lines were created
        /// Saved automatically
        /// @param rfq
        /// </summary>
        /// <param name="rfq">rfq</param>
        /// <param name="subscriber">optional subscriber</param>
        /// <param name="C_BPartner_ID">bpartner</param>
        /// <param name="C_BPartner_Location_ID">bpartner location</param>
        /// <param name="AD_User_ID">bpartner user</param>
        public MRfQResponse(MRfQ rfq, MRfQTopicSubscriber subscriber,
                            int C_BPartner_ID, int C_BPartner_Location_ID, int AD_User_ID)
            : this(rfq.GetCtx(), 0, rfq.Get_TrxName())
        {
            SetClientOrg(rfq);
            SetC_RfQ_ID(rfq.GetC_RfQ_ID());
            SetC_Currency_ID(rfq.GetC_Currency_ID());
            SetName(rfq.GetName());
            _rfq = rfq;
            //	Subscriber info
            SetC_BPartner_ID(C_BPartner_ID);
            SetC_BPartner_Location_ID(C_BPartner_Location_ID);
            SetAD_User_ID(AD_User_ID);

            //	Create Lines
            MRfQLine[] lines = rfq.GetLines();
            for (int i = 0; i < lines.Length; i++)
            {
                if (!lines[i].IsActive())
                {
                    continue;
                }

                //	Product on "Only" list
                if (subscriber != null &&
                    !subscriber.IsIncluded(lines[i].GetM_Product_ID()))
                {
                    continue;
                }
                //
                if (Get_ID() == 0)      //	save Response
                {
                    Save();
                }

                MRfQResponseLine line = new MRfQResponseLine(this, lines[i]);
                //	line is not saved (dumped) if there are no Qtys
            }
        }
コード例 #6
0
 /// <summary>
 /// Parent Constructor
 /// </summary>
 /// <param name="rfq">RFQ</param>
 public MRfQLine(MRfQ rfq)
     : this(rfq.GetCtx(), 0, rfq.Get_TrxName())
 {
     SetClientOrg(rfq);
     SetC_RfQ_ID(rfq.GetC_RfQ_ID());
 }
コード例 #7
0
        /// <summary>
        /// Check if Response is Complete
        /// </summary>
        /// <returns>null if complere - error message otherwise</returns>
        public String CheckComplete()
        {
            if (IsComplete())
            {
                SetIsComplete(false);
            }
            MRfQ rfq = GetRfQ();

            //	Is RfQ Total valid
            String error = rfq.CheckQuoteTotalAmtOnly();

            if (error != null && error.Length > 0)
            {
                return(error);
            }

            //	Do we have Total Amount ?
            if (rfq.IsQuoteTotalAmt() || rfq.IsQuoteTotalAmtOnly())
            {
                Decimal amt = GetPrice();
                if (Env.ZERO.CompareTo(amt) >= 0)
                {
                    return("No Total Amount");
                }
            }

            //	Do we have an amount/qty for all lines
            if (rfq.IsQuoteAllLines())
            {
                MRfQResponseLine[] lines = GetLines(false);
                for (int i = 0; i < lines.Length; i++)
                {
                    MRfQResponseLine line = lines[i];
                    if (!line.IsActive())
                    {
                        return("Line " + line.GetRfQLine().GetLine()
                               + ": Not Active");
                    }
                    bool validAmt = false;
                    MRfQResponseLineQty[] qtys = line.GetQtys(false);
                    for (int j = 0; j < qtys.Length; j++)
                    {
                        MRfQResponseLineQty qty = qtys[j];
                        if (!qty.IsActive())
                        {
                            continue;
                        }
                        Decimal?amt = qty.GetNetAmt();
                        if (Env.ZERO.CompareTo(amt) < 0)
                        {
                            validAmt = true;
                            break;
                        }
                    }
                    if (!validAmt)
                    {
                        return("Line " + line.GetRfQLine().GetLine()
                               + ": No Amount");
                    }
                }
            }

            //	Do we have an amount for all line qtys
            if (rfq.IsQuoteAllQty())
            {
                MRfQResponseLine[] lines = GetLines(false);
                for (int i = 0; i < lines.Length; i++)
                {
                    MRfQResponseLine      line = lines[i];
                    MRfQResponseLineQty[] qtys = line.GetQtys(false);
                    for (int j = 0; j < qtys.Length; j++)
                    {
                        MRfQResponseLineQty qty = qtys[j];
                        if (!qty.IsActive())
                        {
                            return("Line " + line.GetRfQLine().GetLine()
                                   + " Qty=" + qty.GetRfQLineQty().GetQty()
                                   + ": Not Active");
                        }
                        Decimal?amt = qty.GetNetAmt();
                        if (amt == null || Env.ZERO.CompareTo(amt) >= 0)
                        {
                            return("Line " + line.GetRfQLine().GetLine()
                                   + " Qty=" + qty.GetRfQLineQty().GetQty()
                                   + ": No Amount");
                        }
                    }
                }
            }

            SetIsComplete(true);
            return(null);
        }