Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="mf"></param>
        /// <param name="opp"></param>
        private void CreateMasterForecast(bool opp)
        {
            mFor = new X_C_MasterForecast(GetCtx(), 0, null);
            mFor.SetAD_Client_ID(mf.GetAD_Client_ID());
            mFor.SetAD_Org_ID(mf.GetAD_Org_ID());
            mFor.SetC_Period_ID(C_Period_ID);
            mFor.SetCurrentVersion(true);
            if (opp)
            {
                mFor.SetIsIncludeOpp(true);
            }
            else
            {
                mFor.SetIsIncludeOpp(false);
            }
            string name = mf.GetName().Substring(0, mf.GetName().IndexOf('_') + 1);
            string date = System.DateTime.Now.ToString("dd-MMM-yyyy");

            if (name == "")
            {
                mFor.SetName(mf.GetName() + "_" + date);
            }
            else
            {
                mFor.SetName(name + date);
            }
            if (!mFor.Save())
            {
                log.SaveError("MasterForecastNotSaved", "MasterForecastNotSaved");
            }
        }