コード例 #1
0
        }       //	setSatndardHeaderFooter

        public static MPrintFormat Copy(Ctx ctx, int from_AD_PrintFormat_ID,
                                        int to_AD_PrintFormat_ID, int to_Client_ID)
        {
            //_ctx = ctx;
            if (from_AD_PrintFormat_ID == 0)
            {
                throw new ArgumentException("From_AD_PrintFormat_ID is 0");
            }
            //
            MPrintFormat from = new MPrintFormat(ctx, from_AD_PrintFormat_ID, null);
            MPrintFormat to   = new MPrintFormat(ctx, to_AD_PrintFormat_ID, null);              //	could be 0

            MPrintFormat.CopyValues(from, to);
            //	New
            if (to_AD_PrintFormat_ID == 0)
            {
                if (to_Client_ID < 0)
                {
                    to_Client_ID = ctx.GetAD_Client_ID();
                }
                to.SetClientOrg(to_Client_ID, 0);
            }
            //	Set Name - Remove TEMPLATE - add copy

            to.SetName(Utility.Util.Replace(to.GetName(), "TEMPLATE", to_Client_ID.ToString()));
            to.SetName(to.GetName()
                       + " " + Msg.GetMsg(Env.GetContext(), "Copy", true)
                       + " " + to.HashCode());  //	unique name
            //
            to.Save();

            //	Copy Items
            to.SetItems(CopyItems(from, to));
            return(to);
        }       //	copyToClient
コード例 #2
0
ファイル: AReport.cs プロジェクト: vuongthai91/ERP-CMR-DMS
        }       //	launchReport

        /// <summary>
        /// Launch Report
        /// </summary>
        /// <param name="pf">PrintFormat Object</param>
        private void LaunchReport(MPrintFormat pf)
        {
            //Code to preload the format (not include as user can change setting at the last moment )
            int Record_ID = 0;

            if (_query.GetRestrictionCount() == 1 && (_query.GetCode(0)).GetType() == typeof(int))
            {
                Record_ID = ((int)_query.GetCode(0));
            }
            PrintInfo info = new PrintInfo(pf.GetName(), pf.GetAD_Table_ID(), Record_ID);

            info.SetDescription(_query.GetInfo());

            ReportEngine_N re = new ReportEngine_N(Env.GetContext(), pf, _query, info);
            //new Viewer(re);
            //new ReportDialog(pf,  _query);
        }       //	launchReport
コード例 #3
0
        }   //  prepare

        /// <summary>
        /// doit
        /// </summary>
        /// <returns>info</returns>
        protected override string DoIt()
        {
            if (_AD_Table_ID != null && int.Parse(_AD_Table_ID.ToString()) > 0)
            {
                MPrintFormat pf = MPrintFormat.CreateFromTable(GetCtx(), int.Parse(_AD_Table_ID.ToString()), GetRecord_ID());
                AddLog(Utility.Util.GetValueOfInt(_AD_Table_ID.ToString()), null, pf.GetItemCount(), pf.GetName());
                return(pf.GetName() + " #" + pf.GetItemCount());
            }
            else if (_AD_PrintFormat_ID != null && _AD_PrintFormat_ID > 0)
            {
                MPrintFormat pf = MPrintFormat.Copy(GetCtx(), Utility.Util.GetValueOfInt(_AD_PrintFormat_ID.ToString()), GetRecord_ID());
                AddLog(Utility.Util.GetValueOfInt(_AD_PrintFormat_ID.ToString()), null, pf.GetItemCount(), pf.GetName());
                return(pf.GetName() + " #" + pf.GetItemCount());
            }
            else
            {
                throw new Exception(msgInvalidArguments);
            }
        }