/**
         *  Create new Project by copying
         *  @param ctx context
         *	@param C_Project_ID project
         *  @param dateDoc date of the document date
         *	@param trxName transaction
         *	@return Project
         */
        public static MProject CopyFrom(Ctx ctx, int C_Project_ID, DateTime?dateDoc, Trx trxName)
        {
            MProject from = new MProject(ctx, C_Project_ID, trxName);

            if (from.GetC_Project_ID() == 0)
            {
                throw new ArgumentException("From Project not found C_Project_ID=" + C_Project_ID);
            }
            //
            MProject to = new MProject(ctx, 0, trxName);

            PO.CopyValues(from, to, from.GetAD_Client_ID(), from.GetAD_Org_ID());
            to.Set_ValueNoCheck("C_Project_ID", I_ZERO);
            //	Set Value with Time
            String Value  = to.GetValue() + " ";
            String Time   = dateDoc.ToString();
            int    length = Value.Length + Time.Length;

            if (length <= 40)
            {
                Value += Time;
            }
            else
            {
                Value += Time.Substring(length - 40 - 1);
            }
            to.SetValue(Value);
            to.SetInvoicedAmt(Env.ZERO);
            to.SetProjectBalanceAmt(Env.ZERO);
            to.SetProcessed(false);
            //
            if (!to.Save())
            {
                throw new Exception("Could not create Project");
            }

            if (to.CopyDetailsFrom(from) == 0)
            {
                throw new Exception("Could not create Project Details");
            }

            return(to);
        }