Beispiel #1
0
 /// <summary>
 /// Create New Client level Costing Record
 /// </summary>
 /// <param name="product">product</param>
 /// <param name="?">acct schema</param>
 /// <returns>true if created</returns>
 private bool CreateNew(MProduct product, MAcctSchema as1)
 {
     VAdvantage.Model.MCost cost = VAdvantage.Model.MCost.Get(product, 0, as1, 0, _ce.GetM_CostElement_ID());
     if (cost.Is_New())
     {
         return(cost.Save());
     }
     return(false);
 }
Beispiel #2
0
        /// <summary>
        /// Update Cost Records
        /// </summary>
        /// <param name="cost">cost</param>
        /// <returns>true if updated</returns>
        private bool Update(VAdvantage.Model.MCost cost)
        {
            bool updated = false;

            if (_SetFutureCostTo.Equals(_SetStandardCostTo))
            {
                Decimal costs = Util.GetValueOfDecimal(GetCosts(cost, _SetFutureCostTo));
                if (costs != null && Env.Signum(costs) != 0)
                {
                    cost.SetFutureCostPrice(costs);
                    cost.SetCurrentCostPrice(costs);
                    updated = true;
                }
            }
            else
            {
                if (_SetStandardCostTo.Length > 0)
                {
                    Decimal costs = Util.GetValueOfDecimal(GetCosts(cost, _SetStandardCostTo));
                    if (costs != null && Env.Signum(costs) != 0)
                    {
                        cost.SetCurrentCostPrice(costs);
                        updated = true;
                    }
                }
                if (_SetFutureCostTo.Length > 0)
                {
                    Decimal costs = Util.GetValueOfDecimal(GetCosts(cost, _SetFutureCostTo));
                    if (costs != null && Env.Signum(costs) != 0)
                    {
                        cost.SetFutureCostPrice(costs);
                        updated = true;
                    }
                }
            }
            if (updated)
            {
                updated = cost.Save();
            }
            return(updated);
        }