Example #1
0
 protected virtual bool WfExecReport(Stimulsoft.Report.StiReport pReport)
 {
     try
     {
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public MainPage()
        {
            if (StiOptions.Silverlight.Themes.CurrentTheme == null)
            {
                StiOptions.Silverlight.Themes.CurrentTheme = (StiSilverlightThemes)StiSettings.Get("StimulsoftApplication", "Theme", StiSilverlightThemes.Office2010Silver);
            }
            StiThemesHelper.LoadTheme();

            InitializeComponent();
            stiReport1 = new Stimulsoft.Report.StiReport();
        }
Example #3
0
 /// <summary>
 /// 報表額外參數要放在這才會有做用
 /// </summary>
 /// <param name="pReport"></param>
 /// <returns></returns>
 protected virtual bool WfExecReportEnd(Stimulsoft.Report.StiReport pReport)
 {
     try
     {
         //pReport["type1Title"] = "XXXXXX";
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #4
0
        public static StiReport CreateReport(Stream stream, String repName)
        {
            var r = new Stimulsoft.Report.StiReport();

            r.Load(stream);
            r.AddReferencedAssemblies();
            r.SubstDataSources();
            if (!String.IsNullOrEmpty(repName))
            {
                r.ReportName = repName;
            }
            return(r);
        }
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            Report = new Stimulsoft.Report.StiReport();
            var stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("CustomViewer.BarCodes.mrt");
            Report.Load(stream);

            stream.Close();
            stream.Dispose();
            stream = null;

            btRefresh_Click(null, null);
            PreviewControl.Report = Report;
            Init();
        }
Example #6
0
        async private void BlankPage_Loaded(object sender, RoutedEventArgs e)
        {
            byte[] buffer = Convert.FromBase64String(reportStr);
            stiReport1 = new StiReport();
            await stiReport1.LoadAsync(buffer);

            await stiReport1.RenderAsync();

            StiComponentsCollection comps = stiReport1.RenderedPages[0].GetComponents();

            chart = comps["Chart1"] as StiChart;

            viewerCotnrol.Report = stiReport1;
            timer.Start();
        }
 /// <summary>
 /// 
 /// </summary>
 /// <returns></returns>
 public virtual ActionResult StiReport()
 {
     System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo("fa-IR");
     
     // List of persons: 
     // you can change the following list to list of persons that get from database.
     var persons = new List<Models.Person>()
     {
         new Person() {Id = 0, FirstName = "sadar", LastName = "marvati", Gender = true}
         , new Person() {Id = 1, FirstName = "omid", LastName = "nasri", Gender = true}
          , new Person() {Id = 2, FirstName = "hana", LastName = "akbari", Gender = false}
           , new Person() {Id = 3, FirstName = "ali", LastName = "jahani", Gender = true }
            , new Person() {Id = 4, FirstName = "sara", LastName = "sabori", Gender = false }
     };
     var mainReport = new Stimulsoft.Report.StiReport();
     mainReport.Load(Server.MapPath("~/Files/Report.mrt"));
     mainReport.Compile();
     mainReport["DateTimeNow"] = DateTime.UtcNow;
     mainReport.RegBusinessObject("persons_business", persons);
     return Stimulsoft.Report.Mvc.StiMvcViewer.GetReportSnapshotResult(mainReport);
 }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public virtual ActionResult StiReport()
        {
            System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo("fa-IR");

            // List of persons:
            // you can change the following list to list of persons that get from database.
            var persons = new List <Models.Person>()
            {
                new Person()
                {
                    Id = 0, FirstName = "sadar", LastName = "marvati", Gender = true
                }
                , new Person()
                {
                    Id = 1, FirstName = "omid", LastName = "nasri", Gender = true
                }
                , new Person()
                {
                    Id = 2, FirstName = "hana", LastName = "akbari", Gender = false
                }
                , new Person()
                {
                    Id = 3, FirstName = "ali", LastName = "jahani", Gender = true
                }
                , new Person()
                {
                    Id = 4, FirstName = "sara", LastName = "sabori", Gender = false
                }
            };
            var mainReport = new Stimulsoft.Report.StiReport();

            mainReport.Load(Server.MapPath("~/Files/Report.mrt"));
            mainReport.Compile();
            mainReport["DateTimeNow"] = DateTime.UtcNow;
            mainReport.RegBusinessObject("persons_business", persons);
            return(Stimulsoft.Report.Mvc.StiMvcViewer.GetReportSnapshotResult(mainReport));
        }
Example #9
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
     this.tbName     = new System.Windows.Forms.TextBox();
     this.tbSurname  = new System.Windows.Forms.TextBox();
     this.tbEmail    = new System.Windows.Forms.TextBox();
     this.label1     = new System.Windows.Forms.Label();
     this.label2     = new System.Windows.Forms.Label();
     this.label3     = new System.Windows.Forms.Label();
     this.label5     = new System.Windows.Forms.Label();
     this.tbAddress  = new System.Windows.Forms.TextBox();
     this.button1    = new System.Windows.Forms.Button();
     this.button2    = new System.Windows.Forms.Button();
     this.stiReport1 = new Stimulsoft.Report.StiReport();
     this.label4     = new System.Windows.Forms.Label();
     this.dtBirthDay = new System.Windows.Forms.DateTimePicker();
     this.label6     = new System.Windows.Forms.Label();
     this.rbMale     = new System.Windows.Forms.RadioButton();
     this.rbFemale   = new System.Windows.Forms.RadioButton();
     this.groupBox1  = new System.Windows.Forms.GroupBox();
     this.button3    = new System.Windows.Forms.Button();
     this.groupBox1.SuspendLayout();
     this.SuspendLayout();
     //
     // tbName
     //
     this.tbName.Location = new System.Drawing.Point(84, 19);
     this.tbName.Name     = "tbName";
     this.tbName.Size     = new System.Drawing.Size(182, 20);
     this.tbName.TabIndex = 0;
     this.tbName.Text     = "Name";
     //
     // tbSurname
     //
     this.tbSurname.Location = new System.Drawing.Point(84, 43);
     this.tbSurname.Name     = "tbSurname";
     this.tbSurname.Size     = new System.Drawing.Size(182, 20);
     this.tbSurname.TabIndex = 1;
     this.tbSurname.Text     = "Surname";
     //
     // tbEmail
     //
     this.tbEmail.Location = new System.Drawing.Point(84, 67);
     this.tbEmail.Name     = "tbEmail";
     this.tbEmail.Size     = new System.Drawing.Size(182, 20);
     this.tbEmail.TabIndex = 2;
     this.tbEmail.Text     = "*****@*****.**";
     //
     // label1
     //
     this.label1.Location  = new System.Drawing.Point(5, 19);
     this.label1.Name      = "label1";
     this.label1.Size      = new System.Drawing.Size(71, 20);
     this.label1.TabIndex  = 4;
     this.label1.Text      = "Name";
     this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
     //
     // label2
     //
     this.label2.Location  = new System.Drawing.Point(5, 43);
     this.label2.Name      = "label2";
     this.label2.Size      = new System.Drawing.Size(71, 20);
     this.label2.TabIndex  = 5;
     this.label2.Text      = "Surname";
     this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
     //
     // label3
     //
     this.label3.Location  = new System.Drawing.Point(5, 67);
     this.label3.Name      = "label3";
     this.label3.Size      = new System.Drawing.Size(71, 20);
     this.label3.TabIndex  = 6;
     this.label3.Text      = "E-mail";
     this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
     //
     // label5
     //
     this.label5.Location  = new System.Drawing.Point(5, 91);
     this.label5.Name      = "label5";
     this.label5.Size      = new System.Drawing.Size(71, 20);
     this.label5.TabIndex  = 8;
     this.label5.Text      = "Address";
     this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
     //
     // tbAddress
     //
     this.tbAddress.Location = new System.Drawing.Point(84, 91);
     this.tbAddress.Name     = "tbAddress";
     this.tbAddress.Size     = new System.Drawing.Size(182, 20);
     this.tbAddress.TabIndex = 3;
     this.tbAddress.Text     = "Address";
     //
     // button1
     //
     this.button1.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.button1.Location = new System.Drawing.Point(51, 202);
     this.button1.Name     = "button1";
     this.button1.Size     = new System.Drawing.Size(75, 26);
     this.button1.TabIndex = 1;
     this.button1.Text     = "Design";
     this.button1.Click   += new System.EventHandler(this.button1_Click);
     //
     // button2
     //
     this.button2.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.button2.Location = new System.Drawing.Point(133, 202);
     this.button2.Name     = "button2";
     this.button2.Size     = new System.Drawing.Size(75, 26);
     this.button2.TabIndex = 2;
     this.button2.Text     = "Preview";
     this.button2.Click   += new System.EventHandler(this.button2_Click);
     //
     // stiReport1
     //
     this.stiReport1.CookieContainer      = null;
     this.stiReport1.EngineVersion        = Stimulsoft.Report.Engine.StiEngineVersion.EngineV2;
     this.stiReport1.ReferencedAssemblies = new string[] {
         "System.Dll",
         "System.Drawing.Dll",
         "System.Windows.Forms.Dll",
         "System.Data.Dll",
         "System.Xml.Dll",
         "Stimulsoft.Controls.Dll",
         "Stimulsoft.Base.Dll",
         "Stimulsoft.Report.Dll"
     };
     this.stiReport1.ReportAlias         = "Report";
     this.stiReport1.ReportGuid          = "daed7215d2c44878b86b5a0c6b25631c";
     this.stiReport1.ReportImage         = null;
     this.stiReport1.ReportName          = "Report";
     this.stiReport1.ReportSource        = null;
     this.stiReport1.ReportUnit          = Stimulsoft.Report.StiReportUnitType.Centimeters;
     this.stiReport1.ScriptLanguage      = Stimulsoft.Report.StiReportLanguageType.CSharp;
     this.stiReport1.UseProgressInThread = false;
     //
     // label4
     //
     this.label4.Location  = new System.Drawing.Point(5, 115);
     this.label4.Name      = "label4";
     this.label4.Size      = new System.Drawing.Size(71, 20);
     this.label4.TabIndex  = 13;
     this.label4.Text      = "Sex";
     this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
     //
     // dtBirthDay
     //
     this.dtBirthDay.Location = new System.Drawing.Point(84, 139);
     this.dtBirthDay.Name     = "dtBirthDay";
     this.dtBirthDay.Size     = new System.Drawing.Size(182, 20);
     this.dtBirthDay.TabIndex = 6;
     //
     // label6
     //
     this.label6.Location  = new System.Drawing.Point(5, 139);
     this.label6.Name      = "label6";
     this.label6.Size      = new System.Drawing.Size(71, 20);
     this.label6.TabIndex  = 15;
     this.label6.Text      = "Birth Day";
     this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
     //
     // rbMale
     //
     this.rbMale.Checked  = true;
     this.rbMale.Location = new System.Drawing.Point(84, 115);
     this.rbMale.Name     = "rbMale";
     this.rbMale.Size     = new System.Drawing.Size(48, 24);
     this.rbMale.TabIndex = 4;
     this.rbMale.TabStop  = true;
     this.rbMale.Text     = "Male";
     //
     // rbFemale
     //
     this.rbFemale.Location = new System.Drawing.Point(140, 115);
     this.rbFemale.Name     = "rbFemale";
     this.rbFemale.Size     = new System.Drawing.Size(104, 24);
     this.rbFemale.TabIndex = 5;
     this.rbFemale.Text     = "Female";
     //
     // groupBox1
     //
     this.groupBox1.Controls.Add(this.label2);
     this.groupBox1.Controls.Add(this.rbMale);
     this.groupBox1.Controls.Add(this.label1);
     this.groupBox1.Controls.Add(this.tbName);
     this.groupBox1.Controls.Add(this.rbFemale);
     this.groupBox1.Controls.Add(this.tbEmail);
     this.groupBox1.Controls.Add(this.tbAddress);
     this.groupBox1.Controls.Add(this.tbSurname);
     this.groupBox1.Controls.Add(this.label5);
     this.groupBox1.Controls.Add(this.dtBirthDay);
     this.groupBox1.Controls.Add(this.label3);
     this.groupBox1.Controls.Add(this.label4);
     this.groupBox1.Controls.Add(this.label6);
     this.groupBox1.Location = new System.Drawing.Point(8, 8);
     this.groupBox1.Name     = "groupBox1";
     this.groupBox1.Size     = new System.Drawing.Size(281, 184);
     this.groupBox1.TabIndex = 0;
     this.groupBox1.TabStop  = false;
     this.groupBox1.Text     = "Settings";
     //
     // button3
     //
     this.button3.Anchor       = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.button3.DialogResult = System.Windows.Forms.DialogResult.Cancel;
     this.button3.Location     = new System.Drawing.Point(215, 202);
     this.button3.Name         = "button3";
     this.button3.Size         = new System.Drawing.Size(75, 26);
     this.button3.TabIndex     = 3;
     this.button3.Text         = "Close";
     this.button3.Click       += new System.EventHandler(this.button3_Click);
     //
     // Form1
     //
     this.AcceptButton      = this.button2;
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.CancelButton      = this.button3;
     this.ClientSize        = new System.Drawing.Size(297, 235);
     this.Controls.Add(this.button3);
     this.Controls.Add(this.groupBox1);
     this.Controls.Add(this.button2);
     this.Controls.Add(this.button1);
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
     this.Icon            = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.MaximizeBox     = false;
     this.MinimizeBox     = false;
     this.Name            = "Form1";
     this.StartPosition   = System.Windows.Forms.FormStartPosition.CenterScreen;
     this.Text            = "Using Report Variables";
     this.groupBox1.ResumeLayout(false);
     this.groupBox1.PerformLayout();
     this.ResumeLayout(false);
 }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
     this.panel1     = new Stimulsoft.Report.Viewer.StiViewerControl();
     this.stiReport1 = new Stimulsoft.Report.StiReport();
     this.dataSet1   = new System.Data.DataSet();
     ((System.ComponentModel.ISupportInitialize)(this.dataSet1)).BeginInit();
     this.SuspendLayout();
     //
     // panel1
     //
     this.panel1.AllowDrop   = true;
     this.panel1.Dock        = System.Windows.Forms.DockStyle.Fill;
     this.panel1.Location    = new System.Drawing.Point(0, 0);
     this.panel1.Name        = "panel1";
     this.panel1.Report      = this.stiReport1;
     this.panel1.RightToLeft = System.Windows.Forms.RightToLeft.No;
     this.panel1.ShowZoom    = true;
     this.panel1.Size        = new System.Drawing.Size(688, 493);
     this.panel1.TabIndex    = 0;
     this.panel1.Close      += new System.EventHandler(this.panel1_Close);
     //
     // stiReport1
     //
     this.stiReport1.CookieContainer      = null;
     this.stiReport1.EngineVersion        = Stimulsoft.Report.Engine.StiEngineVersion.EngineV2;
     this.stiReport1.ReferencedAssemblies = new string[] {
         "System.Dll",
         "System.Drawing.Dll",
         "System.Windows.Forms.Dll",
         "System.Data.Dll",
         "System.Xml.Dll",
         "Stimulsoft.Controls.Dll",
         "Stimulsoft.Base.Dll",
         "Stimulsoft.Report.Dll"
     };
     this.stiReport1.ReportAlias         = "Report";
     this.stiReport1.ReportGuid          = "41599dc0625e4d03b314014f8926ee17";
     this.stiReport1.ReportImage         = null;
     this.stiReport1.ReportName          = "Report";
     this.stiReport1.ReportSource        = null;
     this.stiReport1.ReportUnit          = Stimulsoft.Report.StiReportUnitType.Centimeters;
     this.stiReport1.ScriptLanguage      = Stimulsoft.Report.StiReportLanguageType.CSharp;
     this.stiReport1.UseProgressInThread = false;
     //
     // dataSet1
     //
     this.dataSet1.DataSetName = "NewDataSet";
     this.dataSet1.Locale      = new System.Globalization.CultureInfo("ru-RU");
     //
     // Form1
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize        = new System.Drawing.Size(688, 493);
     this.Controls.Add(this.panel1);
     this.Icon          = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.Name          = "Form1";
     this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
     this.Text          = "Reports Viewer in Right-To-Left";
     this.WindowState   = System.Windows.Forms.FormWindowState.Maximized;
     this.Load         += new System.EventHandler(this.Form1_Load);
     ((System.ComponentModel.ISupportInitialize)(this.dataSet1)).EndInit();
     this.ResumeLayout(false);
 }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
     this.button3    = new System.Windows.Forms.Button();
     this.groupBox1  = new System.Windows.Forms.GroupBox();
     this.textBox1   = new System.Windows.Forms.TextBox();
     this.button2    = new System.Windows.Forms.Button();
     this.button1    = new System.Windows.Forms.Button();
     this.stiReport1 = new Stimulsoft.Report.StiReport();
     this.groupBox1.SuspendLayout();
     this.SuspendLayout();
     //
     // button3
     //
     this.button3.Anchor       = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.button3.DialogResult = System.Windows.Forms.DialogResult.Cancel;
     this.button3.Location     = new System.Drawing.Point(474, 381);
     this.button3.Name         = "button3";
     this.button3.Size         = new System.Drawing.Size(150, 48);
     this.button3.TabIndex     = 7;
     this.button3.Text         = "Close";
     this.button3.Click       += new System.EventHandler(this.button3_Click);
     //
     // groupBox1
     //
     this.groupBox1.Controls.Add(this.textBox1);
     this.groupBox1.Location = new System.Drawing.Point(16, 15);
     this.groupBox1.Name     = "groupBox1";
     this.groupBox1.Size     = new System.Drawing.Size(608, 349);
     this.groupBox1.TabIndex = 4;
     this.groupBox1.TabStop  = false;
     this.groupBox1.Text     = "Type Text";
     //
     // textBox1
     //
     this.textBox1.Location  = new System.Drawing.Point(16, 30);
     this.textBox1.Multiline = true;
     this.textBox1.Name      = "textBox1";
     this.textBox1.Size      = new System.Drawing.Size(576, 300);
     this.textBox1.TabIndex  = 0;
     this.textBox1.Text      = "Sample Text";
     //
     // button2
     //
     this.button2.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.button2.Location = new System.Drawing.Point(308, 381);
     this.button2.Name     = "button2";
     this.button2.Size     = new System.Drawing.Size(150, 48);
     this.button2.TabIndex = 6;
     this.button2.Text     = "Preview";
     this.button2.Click   += new System.EventHandler(this.button2_Click);
     //
     // button1
     //
     this.button1.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.button1.Location = new System.Drawing.Point(142, 381);
     this.button1.Name     = "button1";
     this.button1.Size     = new System.Drawing.Size(150, 48);
     this.button1.TabIndex = 5;
     this.button1.Text     = "Design";
     this.button1.Click   += new System.EventHandler(this.button1_Click);
     //
     // stiReport1
     //
     this.stiReport1.CookieContainer      = null;
     this.stiReport1.EngineVersion        = Stimulsoft.Report.Engine.StiEngineVersion.EngineV2;
     this.stiReport1.Key                  = "1251f444a62b4be883f2b39088f9d32c";
     this.stiReport1.ReferencedAssemblies = new string[] {
         "System.Dll",
         "System.Drawing.Dll",
         "System.Windows.Forms.Dll",
         "System.Data.Dll",
         "System.Xml.Dll",
         "Stimulsoft.Controls.Dll",
         "Stimulsoft.Base.Dll",
         "Stimulsoft.Report.Dll"
     };
     this.stiReport1.ReportAlias            = "Report";
     this.stiReport1.ReportGuid             = "40db48e618a74c2ba7cc94a6b54a1efd";
     this.stiReport1.ReportName             = "Report";
     this.stiReport1.ReportSource           = null;
     this.stiReport1.ReportUnit             = Stimulsoft.Report.StiReportUnitType.Centimeters;
     this.stiReport1.ScriptLanguage         = Stimulsoft.Report.StiReportLanguageType.CSharp;
     this.stiReport1.StoreImagesInResources = true;
     this.stiReport1.UseProgressInThread    = false;
     //
     // Form1
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 25F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize          = new System.Drawing.Size(638, 445);
     this.Controls.Add(this.button3);
     this.Controls.Add(this.groupBox1);
     this.Controls.Add(this.button2);
     this.Controls.Add(this.button1);
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
     this.Icon            = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.MaximizeBox     = false;
     this.MinimizeBox     = false;
     this.Name            = "Form1";
     this.StartPosition   = System.Windows.Forms.FormStartPosition.CenterScreen;
     this.Text            = "Work with Report Components";
     this.groupBox1.ResumeLayout(false);
     this.groupBox1.PerformLayout();
     this.ResumeLayout(false);
 }
Example #12
0
        protected override bool WfExecReport(Stimulsoft.Report.StiReport pReport)
        {
            vw_glar300       glar300Model;
            StringBuilder    sbSql      = null;
            string           sqlBody    = "";
            string           sqlOrderBy = "";
            DataTable        dtMaster;
            List <Master>    masterList;
            List <QueryInfo> queryInfoList;
            QueryInfo        queryModel;
            string           strQueryRange, strWhere;
            StringBuilder    sbQuerySingle = null;
            decimal          maxPageRows   = 5;    //每頁限定筆數
            List <Master>    addMasterList = null; //用來增加空白筆數的集合

            List <SqlParameter> sqlParmList;

            try
            {
                if (Vw_Galr300 != null) //他窗引用時
                {
                    glar300Model = Vw_Galr300;
                }
                else
                {
                    glar300Model = DrMaster.ToItem <vw_glar300>();
                }

                queryInfoList = new List <QueryInfo>();
                #region range 處理
                if (!GlobalFn.varIsNull(glar300Model.gfa01))
                {
                    queryModel            = new QueryInfo();
                    queryModel.TableName  = "gfa_tb";
                    queryModel.ColumnName = "gfa01";
                    queryModel.ColumnType = TabMaster.DtSource.Columns["gfa01"].DataType.Name;
                    queryModel.Value      = glar300Model.gfa01;
                    queryInfoList.Add(queryModel);
                }
                sqlParmList   = new List <SqlParameter>();
                strQueryRange = BoMaster.WfGetQueryString(queryInfoList, out sqlParmList);
                #endregion

                #region single 處理
                sbQuerySingle = new StringBuilder();
                //他窗引用時,僅查詢單號
                if (Vw_Galr300 == null)
                {
                    if (!GlobalFn.varIsNull(glar300Model.gfa02_s))
                    {
                        sbQuerySingle.AppendLine("AND gfa02>=@gfa02_s");
                        sqlParmList.Add(new SqlParameter("@gfa02_s", glar300Model.gfa02_s));
                    }
                    if (!GlobalFn.varIsNull(glar300Model.gfa02_e))
                    {
                        sbQuerySingle.AppendLine("AND gfa02<=@gfa02_e");
                        sqlParmList.Add(new SqlParameter("@gfa02_e", glar300Model.gfa02_e));
                    }

                    //過帳否
                    if (glar300Model.gfapost == "1")
                    {
                        sbQuerySingle.AppendLine("AND gfapost='N'");
                    }
                    else if (glar300Model.gfapost == "2")
                    {
                        sbQuerySingle.AppendLine("AND gfapost='Y'");
                    }

                    //有效否
                    if (glar300Model.gfaconf == "1")
                    {
                        sbQuerySingle.AppendLine("AND gfaconf <>'X' ");
                    }
                    else if (glar300Model.gfaconf == "2")
                    {
                        sbQuerySingle.AppendLine("AND gfapost='X' ");
                    }

                    //列印否
                    if (glar300Model.gfaprno == 1)
                    {
                        sbQuerySingle.AppendLine("AND gfaprno =0");
                    }
                    else if (glar300Model.gfapost == "2")
                    {
                        sbQuerySingle.AppendLine("AND gfaprno >0 ");
                    }
                }
                #endregion

                strWhere = strQueryRange + " " + sbQuerySingle.ToString();
                var strSecurity = WfGetSecurityString();        //取得權限字串
                if (!GlobalFn.varIsNull(strSecurity))
                {
                    strWhere += strSecurity;
                }

                //取得單頭
                sqlBody            = @"SELECT 
	                            gfa01,gfa02,gfa03,gfa04,gfa05,
	                            gfa06,gfa07,gfa08,gfa09,
	                            gfaprno,gfaconf,gfacond,gfaconu,
	                            gfapost,gfaposd,gfaposu,
                                gac02 as gfa01_c,
	                            gfb02,gfb03,gfb04,gfb05,
	                            gfb06,gfb07,gfb08,gfb09,gfb10,
	                            gba02 AS gfb03_c,
	                            beb03 AS gfb05_c,
	                            bek04,
	                            gba05
                            FROM gfa_tb                                
                                LEFT JOIN gfb_tb ON gfa01=gfb01
	                            LEFT JOIN baa_tb ON 1=1	
	                            LEFT JOIN gac_tb ON substring(gfa01,1,baa06)=gac01
	                            LEFT JOIN gba_tb ON gfb03=gba01
	                            LEFT JOIN bek_tb ON gfb08=bek01
	                            LEFT JOIN beb_tb ON gfb05=beb01
                            WHERE 1=1       
                           ";
                sqlOrderBy         = " ORDER BY gfa01,gfa02";
                dtMaster           = BoMaster.OfGetDataTable(string.Concat(sqlBody, strWhere, sqlOrderBy), sqlParmList.ToArray());
                dtMaster.TableName = "Master";

                if (dtMaster == null || dtMaster.Rows.Count == 0)
                {
                    WfShowErrorMsg("查無資料,請重新過濾條件!");
                    return(false);
                }
                masterList = dtMaster.ToList <Master>(true);
                //取得本幣資料
                var baaModel = BoBas.OfGetBaaModel();
                if (baaModel == null)
                {
                    WfShowErrorMsg("未設定基本參數,請先設定!");
                    return(false);
                }
                var baa04      = baaModel.baa04;
                var bekUsModel = BoBas.OfGetBekModel(baa04);
                if (bekUsModel == null)
                {
                    WfShowErrorMsg("查無本幣資料,請先設定!");
                    return(false);
                }

                //依群組來處理
                var gfa01GroupList = from o in masterList
                                     group o by o.gfa01 into g
                                     select g.First()
                ;

                addMasterList = new List <Master>();
                foreach (Master groupModel in gfa01GroupList)
                {
                    var gfa01           = groupModel.gfa01;
                    var groupList       = masterList.Where(p => p.gfa01 == gfa01).ToList();
                    int groupTotalRecs  = groupList.Count();
                    int groupTotalPages = Convert.ToInt16(Math.Ceiling(Convert.ToDecimal(groupTotalRecs / maxPageRows)));

                    for (int i = 0; i < groupList.Count(); i++)
                    {
                        var masterModel = groupList[i];
                        masterModel.gfa03_str = string.Format("{0:N" + bekUsModel.bek04 + "}", masterModel.gfa03);
                        masterModel.gfa04_str = string.Format("{0:N" + bekUsModel.bek04 + "}", masterModel.gfa04);
                        if (masterModel.gfb06 == "1")
                        {
                            masterModel.gfb07d_str = string.Format("{0:N" + bekUsModel.bek04 + "}", masterModel.gfb07);
                            masterModel.gfb10d_str = string.Format("{0:N" + masterModel.bek04 + "}", masterModel.gfb10);
                        }
                        else
                        {
                            masterModel.gfb07c_str = string.Format("{0:N" + bekUsModel.bek04 + "}", masterModel.gfb07);
                            masterModel.gfb10c_str = string.Format("{0:N" + masterModel.bek04 + "}", masterModel.gfb10);
                        }

                        masterModel.groupPageNo     = Convert.ToInt32(Math.Ceiling(Convert.ToDecimal((i + 1) / maxPageRows)));
                        masterModel.groupSeqNo      = i + 1;
                        masterModel.groupTotalPages = groupTotalPages;
                        if (masterModel.groupTotalPages != masterModel.groupPageNo)
                        {
                            masterModel.isPageEnd = false;
                        }
                        else
                        {
                            masterModel.isPageEnd = true;
                        }
                        if (i == groupTotalRecs - 1)
                        {
                            //處理要新增的空白筆數
                            var mod = groupTotalRecs % maxPageRows;
                            if (mod != 0)
                            {
                                var addRecs = maxPageRows - mod;
                                if (addRecs > 0)
                                {
                                    for (int j = 0; j < addRecs; j++)
                                    {
                                        var addMasterModel = new Master();
                                        addMasterModel.gfa01           = masterModel.gfa01;
                                        addMasterModel.gfa02           = masterModel.gfa02;
                                        addMasterModel.gfa03           = masterModel.gfa03;
                                        addMasterModel.gfa04           = masterModel.gfa04;
                                        addMasterModel.gfa05           = masterModel.gfa05;
                                        addMasterModel.gfa06           = masterModel.gfa06;
                                        addMasterModel.gfa07           = masterModel.gfa07;
                                        addMasterModel.gfa08           = masterModel.gfa08;
                                        addMasterModel.gfa09           = masterModel.gfa09;
                                        addMasterModel.gfaprno         = masterModel.gfaprno;
                                        addMasterModel.gfaconf         = masterModel.gfaconf;
                                        addMasterModel.gfacond         = masterModel.gfacond;
                                        addMasterModel.gfaconu         = masterModel.gfaconu;
                                        addMasterModel.gfapost         = masterModel.gfapost;
                                        addMasterModel.gfaposd         = masterModel.gfaposd;
                                        addMasterModel.gfaposu         = masterModel.gfaposu;
                                        addMasterModel.gfa01_c         = masterModel.gfa01_c;
                                        addMasterModel.gfb02           = 0;
                                        addMasterModel.gfb03           = "";
                                        addMasterModel.gfb04           = "";
                                        addMasterModel.gfb05           = "";
                                        addMasterModel.gfb06           = "";
                                        addMasterModel.gfb07           = 0;
                                        addMasterModel.gfb08           = "";
                                        addMasterModel.gfb09           = 0;
                                        addMasterModel.gfb10           = 0;
                                        addMasterModel.gfb03_c         = "";
                                        addMasterModel.gfb05_c         = "";
                                        addMasterModel.bek04           = 0;
                                        addMasterModel.gba05           = "";
                                        addMasterModel.gfa03_str       = masterModel.gfa03_str;
                                        addMasterModel.gfa04_str       = masterModel.gfa04_str;
                                        addMasterModel.gfb07c_str      = "";
                                        addMasterModel.gfb07d_str      = "";
                                        addMasterModel.gfb10c_str      = "";
                                        addMasterModel.gfb10d_str      = "";
                                        addMasterModel.groupPageNo     = masterModel.groupPageNo;
                                        addMasterModel.groupTotalPages = masterModel.groupTotalPages;
                                        addMasterModel.groupSeqNo      = i + j + 2;
                                        addMasterModel.isPageEnd       = masterModel.isPageEnd;

                                        addMasterList.Add(addMasterModel);
                                    }
                                }
                            }
                        }
                    }
                }

                if (addMasterList != null && addMasterList.Count > 0)
                {
                    masterList.AddRange(addMasterList);
                }

                pReport.RegData("Master", masterList);
                pReport.CacheAllData = true;
                ////處理跳頁
                //StiGroupFooterBand footerBand1 = (StiGroupFooterBand)pReport.GetComponents()["GroupFooterBand1"];
                //if (glar300Model.jump_yn.ToUpper() == "Y")
                //{
                //    footerBand1.NewPageAfter = true;
                //    footerBand1.ResetPageNumber = true;
                //}
                //else
                //{
                //    footerBand1.NewPageAfter = false;
                //    footerBand1.ResetPageNumber = false;
                //}

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #13
0
 public FrmReportDisplayBase(StiReport report)
 {
     InitializeComponent();
     this.stiReport = report;
     this.stiViewerControl1.Report = stiReport;
 }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
     this.button3      = new System.Windows.Forms.Button();
     this.button2      = new System.Windows.Forms.Button();
     this.button1      = new System.Windows.Forms.Button();
     this.stiUserData1 = new Stimulsoft.Report.Dictionary.StiUserData();
     this.stiReport1   = new Stimulsoft.Report.StiReport();
     this.SuspendLayout();
     //
     // button3
     //
     this.button3.Anchor       = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.button3.DialogResult = System.Windows.Forms.DialogResult.Cancel;
     this.button3.Location     = new System.Drawing.Point(218, 42);
     this.button3.Name         = "button3";
     this.button3.Size         = new System.Drawing.Size(85, 26);
     this.button3.TabIndex     = 11;
     this.button3.Text         = "Close";
     this.button3.Click       += new System.EventHandler(this.button3_Click);
     //
     // button2
     //
     this.button2.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.button2.Location = new System.Drawing.Point(126, 42);
     this.button2.Name     = "button2";
     this.button2.Size     = new System.Drawing.Size(85, 26);
     this.button2.TabIndex = 10;
     this.button2.Text     = "Preview";
     this.button2.Click   += new System.EventHandler(this.button2_Click);
     //
     // button1
     //
     this.button1.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.button1.Location = new System.Drawing.Point(34, 42);
     this.button1.Name     = "button1";
     this.button1.Size     = new System.Drawing.Size(85, 26);
     this.button1.TabIndex = 9;
     this.button1.Text     = "Design";
     this.button1.Click   += new System.EventHandler(this.button1_Click);
     //
     // stiUserData1
     //
     this.stiUserData1.Columns.AddRange(new Stimulsoft.Report.Dictionary.StiDataColumn[] {
         new Stimulsoft.Report.Dictionary.StiDataColumn("Name", "Name", "Name", typeof(object), null),
         new Stimulsoft.Report.Dictionary.StiDataColumn("ReturnType", "ReturnType", "ReturnType", typeof(object), null),
         new Stimulsoft.Report.Dictionary.StiDataColumn("IsStatic", "IsStatic", "IsStatic", typeof(object), null),
         new Stimulsoft.Report.Dictionary.StiDataColumn("Parameters", "Parameters", "Parameters", typeof(object), null)
     });
     this.stiUserData1.Count    = 10;
     this.stiUserData1.GetData += new Stimulsoft.Report.Dictionary.StiUserGetDataEventHandler(this.stiUserData1_GetData);
     //
     // stiReport1
     //
     this.stiReport1.CookieContainer      = null;
     this.stiReport1.EngineVersion        = Stimulsoft.Report.Engine.StiEngineVersion.EngineV2;
     this.stiReport1.ReferencedAssemblies = new string[] {
         "System.Dll",
         "System.Drawing.Dll",
         "System.Windows.Forms.Dll",
         "System.Data.Dll",
         "System.Xml.Dll",
         "Stimulsoft.Controls.Dll",
         "Stimulsoft.Base.Dll",
         "Stimulsoft.Report.Dll"
     };
     this.stiReport1.ReportAlias         = "Report";
     this.stiReport1.ReportGuid          = "9004eb010eec44b0925867c926808ffa";
     this.stiReport1.ReportImage         = null;
     this.stiReport1.ReportName          = "Report";
     this.stiReport1.ReportSource        = null;
     this.stiReport1.ReportUnit          = Stimulsoft.Report.StiReportUnitType.Centimeters;
     this.stiReport1.ScriptLanguage      = Stimulsoft.Report.StiReportLanguageType.CSharp;
     this.stiReport1.UseProgressInThread = false;
     //
     // Form1
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize        = new System.Drawing.Size(334, 111);
     this.Controls.Add(this.button3);
     this.Controls.Add(this.button2);
     this.Controls.Add(this.button1);
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
     this.Icon            = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.MaximizeBox     = false;
     this.Name            = "Form1";
     this.StartPosition   = System.Windows.Forms.FormStartPosition.CenterScreen;
     this.Text            = "User Data in Reports";
     this.ResumeLayout(false);
 }
Example #15
0
        /// <summary>
        /// 報表額外參數要放在這才會有做用
        /// </summary>
        /// <param name="pReport"></param>
        /// <returns></returns>
        protected override bool WfExecReportEnd(Stimulsoft.Report.StiReport pReport)
        {
            vw_glar311 glar311Model = null;

            try
            {
                glar311Model = DrMaster.ToItem <vw_glar311>();
                if (!GlobalFn.varIsNull(glar311Model.order1))
                {
                    pReport["order1"] = glar311Model.order1;

                    switch (glar311Model.order1)
                    {
                    case "1":
                        pReport["order1_c"] = "傳票編號";
                        break;

                    case "2":
                        pReport["order1_c"] = "傳票日期";
                        break;

                    case "3":
                        pReport["order1_c"] = "科目編號";
                        break;

                    case "4":
                        pReport["order1_c"] = "部門編號";
                        break;

                    case "5":
                        pReport["order1_c"] = "傳票項次";
                        break;

                    case "6":
                        pReport["order1_c"] = "借貸方";
                        break;
                    }
                }
                if (!GlobalFn.varIsNull(glar311Model.order2))
                {
                    pReport["order2"] = glar311Model.order2;

                    switch (glar311Model.order2)
                    {
                    case "1":
                        pReport["order2_c"] = "傳票編號";
                        break;

                    case "2":
                        pReport["order2_c"] = "傳票日期";
                        break;

                    case "3":
                        pReport["order2_c"] = "科目編號";
                        break;

                    case "4":
                        pReport["order2_c"] = "部門編號";
                        break;

                    case "5":
                        pReport["order2_c"] = "傳票項次";
                        break;

                    case "6":
                        pReport["order2_c"] = "借貸方";
                        break;
                    }
                }
                if (!GlobalFn.varIsNull(glar311Model.order3))
                {
                    pReport["order3"] = glar311Model.order3;

                    switch (glar311Model.order3)
                    {
                    case "1":
                        pReport["order3"] = "傳票編號";
                        break;

                    case "2":
                        pReport["order3"] = "傳票日期";
                        break;

                    case "3":
                        pReport["order3"] = "科目編號";
                        break;

                    case "4":
                        pReport["order3"] = "部門編號";
                        break;

                    case "5":
                        pReport["order3"] = "傳票項次";
                        break;

                    case "6":
                        pReport["order3"] = "借貸方";
                        break;
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #16
0
        protected override bool WfExecReport(Stimulsoft.Report.StiReport pReport)
        {
            vw_glar301       glar301Model;
            StringBuilder    sbSql      = null;
            string           sqlBody    = "";
            string           sqlOrderBy = "";
            DataTable        dtMaster;
            List <Master>    masterList;
            List <QueryInfo> queryInfoList;
            QueryInfo        queryModel;
            string           strQueryRange, strWhere;
            StringBuilder    sbQuerySingle = null;

            List <SqlParameter> sqlParmList;

            try
            {
                if (Vw_Galr301 != null) //他窗引用時
                {
                    glar301Model = Vw_Galr301;
                }
                else
                {
                    glar301Model = DrMaster.ToItem <vw_glar301>();
                }

                queryInfoList = new List <QueryInfo>();
                #region range 處理
                if (!GlobalFn.varIsNull(glar301Model.gfa01))
                {
                    queryModel            = new QueryInfo();
                    queryModel.TableName  = "gfa_tb";
                    queryModel.ColumnName = "gfa01";
                    queryModel.ColumnType = TabMaster.DtSource.Columns["gfa01"].DataType.Name;
                    queryModel.Value      = glar301Model.gfa01;
                    queryInfoList.Add(queryModel);
                }
                sqlParmList   = new List <SqlParameter>();
                strQueryRange = BoMaster.WfGetQueryString(queryInfoList, out sqlParmList);
                #endregion

                #region single 處理
                sbQuerySingle = new StringBuilder();
                if (Vw_Galr301 == null)
                {
                    if (!GlobalFn.varIsNull(glar301Model.gfa02_s))
                    {
                        sbQuerySingle.AppendLine("AND gfa02>=@gfa02_s");
                        sqlParmList.Add(new SqlParameter("@gfa02_s", glar301Model.gfa02_s));
                    }
                    if (!GlobalFn.varIsNull(glar301Model.gfa02_e))
                    {
                        sbQuerySingle.AppendLine("AND gfa02<=@gfa02_e");
                        sqlParmList.Add(new SqlParameter("@gfa02_e", glar301Model.gfa02_e));
                    }

                    //過帳否
                    if (glar301Model.gfapost == "1")
                    {
                        sbQuerySingle.AppendLine("AND gfapost='N'");
                    }
                    else if (glar301Model.gfapost == "2")
                    {
                        sbQuerySingle.AppendLine("AND gfapost='Y'");
                    }

                    //有效否
                    if (glar301Model.gfaconf == "1")
                    {
                        sbQuerySingle.AppendLine("AND gfaconf <>'X' ");
                    }
                    else if (glar301Model.gfaconf == "2")
                    {
                        sbQuerySingle.AppendLine("AND gfapost='X' ");
                    }

                    //列印否
                    if (glar301Model.gfaprno == 1)
                    {
                        sbQuerySingle.AppendLine("AND gfaprno =0");
                    }
                    else if (glar301Model.gfapost == "2")
                    {
                        sbQuerySingle.AppendLine("AND gfaprno >0 ");
                    }
                }
                #endregion

                strWhere = strQueryRange + " " + sbQuerySingle.ToString();
                var strSecurity = WfGetSecurityString();        //取得權限字串
                if (!GlobalFn.varIsNull(strSecurity))
                {
                    strWhere += strSecurity;
                }

                //取得單頭
                sqlBody            = @"SELECT 
	                            gfa01,gfa02,gfa03,gfa04,gfa05,
	                            gfa06,gfa07,gfa08,gfa09,
	                            gfaprno,gfaconf,gfacond,gfaconu,
	                            gfapost,gfaposd,gfaposu,
                                gfacreu,gfacred,
                                gac02 as gfa01_c,
	                            gfb02,gfb03,gfb04,gfb05,
	                            gfb06,gfb07,gfb08,gfb09,gfb10,
	                            gba02 AS gfb03_c,
	                            beb03 AS gfb05_c,
	                            bek04,
	                            gba05
                            FROM gfa_tb                                
                                LEFT JOIN gfb_tb ON gfa01=gfb01
	                            LEFT JOIN baa_tb ON 1=1	
	                            LEFT JOIN gac_tb ON substring(gfa01,1,baa06)=gac01
	                            LEFT JOIN gba_tb ON gfb03=gba01
	                            LEFT JOIN bek_tb ON gfb08=bek01
	                            LEFT JOIN beb_tb ON gfb05=beb01
                            WHERE 1=1       
                           ";
                sqlOrderBy         = " ORDER BY gfa01,gfa02";
                dtMaster           = BoMaster.OfGetDataTable(string.Concat(sqlBody, strWhere, sqlOrderBy), sqlParmList.ToArray());
                dtMaster.TableName = "Master";

                if (dtMaster == null || dtMaster.Rows.Count == 0)
                {
                    WfShowErrorMsg("查無資料,請重新過濾條件!");
                    return(false);
                }
                masterList = dtMaster.ToList <Master>(true);
                //取得本幣資料
                var baaModel = BoBas.OfGetBaaModel();
                if (baaModel == null)
                {
                    WfShowErrorMsg("未設定基本參數,請先設定!");
                    return(false);
                }
                var baa04      = baaModel.baa04;
                var bekUsModel = BoBas.OfGetBekModel(baa04);
                if (bekUsModel == null)
                {
                    WfShowErrorMsg("查無本幣資料,請先設定!");
                    return(false);
                }
                masterList = dtMaster.ToList <Master>(true);

                foreach (Master masterModel in masterList)
                {
                    masterModel.gfa03_str = string.Format("{0:N" + bekUsModel.bek04 + "}", masterModel.gfa03);
                    masterModel.gfa04_str = string.Format("{0:N" + bekUsModel.bek04 + "}", masterModel.gfa04);
                    masterModel.gfb07_str = string.Format("{0:N" + bekUsModel.bek04 + "}", masterModel.gfb07);
                    masterModel.gfb10_str = string.Format("{0:N" + masterModel.bek04 + "}", masterModel.gfb10);
                }

                pReport.RegData("Master", masterList);
                pReport.CacheAllData = true;
                ////處理跳頁
                //StiGroupFooterBand footerBand1 = (StiGroupFooterBand)pReport.GetComponents()["GroupFooterBand1"];
                //if (glar300Model.jump_yn.ToUpper() == "Y")
                //{
                //    footerBand1.NewPageAfter = true;
                //    footerBand1.ResetPageNumber = true;
                //}
                //else
                //{
                //    footerBand1.NewPageAfter = false;
                //    footerBand1.ResetPageNumber = false;
                //}

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #17
0
        protected override bool WfExecReport(Stimulsoft.Report.StiReport pReport)
        {
            vw_glar321       glar321Model;
            string           sqlBody    = "";
            string           sqlOrderBy = "";
            DataTable        dtMaster;
            List <Master>    masterList;
            List <QueryInfo> queryInfoList;
            QueryInfo        queryModel;
            string           strQueryRange, strWhere;
            StringBuilder    sbQuerySingle = null;

            List <SqlParameter> sqlParmList;
            string    sqlDistinct = "";//取得會科
            DataTable dtDistinct  = null;

            try
            {
                glar321Model = DrMaster.ToItem <vw_glar321>();

                queryInfoList = new List <QueryInfo>();
                sqlParmList   = new List <SqlParameter>();
                #region range 處理
                if (!GlobalFn.varIsNull(glar321Model.gfb03))
                {
                    queryModel            = new QueryInfo();
                    queryModel.TableName  = "gba_tb";
                    queryModel.ColumnName = "gba01";
                    queryModel.ColumnType = TabMaster.DtSource.Columns["gba01"].DataType.Name;
                    queryModel.Value      = glar321Model.gfb03;
                    queryInfoList.Add(queryModel);
                }
                strQueryRange = BoMaster.WfGetQueryString(queryInfoList, out sqlParmList);
                #endregion

                //strWhere = strQueryRange + " " + sbQuerySingle.ToString();
                //var strSecurity = WfGetSecurityString();        //取得權限字串
                //if (!GlobalFn.varIsNull(strSecurity))
                //    strWhere += strSecurity;
                //無異動科目列印時,以會計科目來處理
                if (glar321Model.c1 == "Y")
                {
                    sqlDistinct = @"SELECT gba01
                                      FROM gba_tb
                                      WHERE gba06 in ('1','3')
                                ";
                    strWhere    = string.Concat(sbQuerySingle.ToString());
                }
                else //以期間內的傳票資料做為處理來源
                {
                    sqlDistinct = @"SELECT gba01
                                      FROM gfa_tb 
                                        INNER JOIN gfb_tb ON gfa01=gfb01
                                        INNER JOIN gba_tb on gfb03=gba01
                                      WHERE gba06 in ('1','3')
                                ";
                    #region single 處理
                    sbQuerySingle = new StringBuilder();
                    if (!GlobalFn.varIsNull(glar321Model.gfa02_s))
                    {
                        sbQuerySingle.AppendLine("AND gfa02>=@gfa02_s");
                        sqlParmList.Add(new SqlParameter("@gfa02_s", glar321Model.gfa02_s));
                    }
                    if (!GlobalFn.varIsNull(glar321Model.gfa02_e))
                    {
                        sbQuerySingle.AppendLine("AND gfa02<=@gfa02_e");
                        sqlParmList.Add(new SqlParameter("@gfa02_e", glar321Model.gfa02_e));
                    }
                    #endregion
                    strWhere = string.Concat(sbQuerySingle.ToString(), strQueryRange);
                }
                sqlOrderBy = " ORDER BY gba01";
                dtDistinct = BoMaster.OfGetDataTable(string.Concat(sqlDistinct, strWhere, sqlOrderBy), sqlParmList.ToArray());
                if (dtDistinct == null || dtDistinct.Rows.Count == 0)
                {
                    WfShowErrorMsg("查無資料!");
                    return(false);
                }

                foreach (DataRow drDistinct in dtDistinct.Rows)
                {
                    var gba01 = drDistinct[0].ToString();
                }


                //處理排序
                //switch (glar321Model.order_by)
                //{
                //    case "1"://1.依借出日期
                //        sqlOrderBy = " ORDER BY ila02";
                //        break;
                //    case "2"://2.依客戶
                //        sqlOrderBy = " ORDER BY ila03";
                //        break;
                //}
                //dtMaster.TableName = "Master";

                //if (dtMaster == null || dtMaster.Rows.Count == 0)
                //{
                //    WfShowErrorMsg("查無資料,請重新過濾條件!");
                //    return false;
                //}
                //masterList = dtMaster.ToList<Master>(true);
                //foreach (Master masterModel in masterList)
                //{
                //    masterModel.ilb05_str = string.Format("{0:N" + masterModel.bej03 + "}", masterModel.ilb05);//數量

                //}

                //pReport.RegData("Master", masterList);
                //pReport.CacheAllData = true;
                //////處理跳頁
                //StiGroupFooterBand footerBand1 = (StiGroupFooterBand)pReport.GetComponents()["GroupFooterBand1"];
                //if (invr401Model.jump_yn.ToUpper() == "Y")
                //{
                //    footerBand1.NewPageAfter = true;
                //    footerBand1.ResetPageNumber = true;
                //}
                //else
                //{
                //    footerBand1.NewPageAfter = false;
                //    footerBand1.ResetPageNumber = false;
                //}

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
     this.button1            = new System.Windows.Forms.Button();
     this.stiReport1         = new Stimulsoft.Report.StiReport();
     this.lbCountries        = new System.Windows.Forms.ListBox();
     this.stiPreviewControl1 = new Stimulsoft.Report.Viewer.StiViewerControl();
     this.SuspendLayout();
     //
     // button1
     //
     this.button1.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.button1.Location = new System.Drawing.Point(492, 409);
     this.button1.Name     = "button1";
     this.button1.Size     = new System.Drawing.Size(75, 26);
     this.button1.TabIndex = 1;
     this.button1.Text     = "Design";
     this.button1.Click   += new System.EventHandler(this.button1_Click);
     //
     // stiReport1
     //
     this.stiReport1.CookieContainer      = null;
     this.stiReport1.EngineVersion        = Stimulsoft.Report.Engine.StiEngineVersion.EngineV2;
     this.stiReport1.ReferencedAssemblies = new string[] {
         "System.Dll",
         "System.Drawing.Dll",
         "System.Windows.Forms.Dll",
         "System.Data.Dll",
         "System.Xml.Dll",
         "Stimulsoft.Base.Dll",
         "Stimulsoft.Report.Dll"
     };
     this.stiReport1.ReportAlias         = "Report";
     this.stiReport1.ReportAuthor        = null;
     this.stiReport1.ReportDescription   = null;
     this.stiReport1.ReportGuid          = "4533be36b343412b94379b945c0209fe";
     this.stiReport1.ReportImage         = null;
     this.stiReport1.ReportName          = "Report";
     this.stiReport1.ReportSource        = resources.GetString("stiReport1.ReportSource");
     this.stiReport1.ReportUnit          = Stimulsoft.Report.StiReportUnitType.Centimeters;
     this.stiReport1.ScriptLanguage      = Stimulsoft.Report.StiReportLanguageType.CSharp;
     this.stiReport1.UseProgressInThread = false;
     //
     // lbCountries
     //
     this.lbCountries.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                     | System.Windows.Forms.AnchorStyles.Left)));
     this.lbCountries.IntegralHeight = false;
     this.lbCountries.Items.AddRange(new object[] {
         "Brazil",
         "Canada",
         "Denmark",
         "Finland",
         "France",
         "Germany",
         "Ireland",
         "Italy",
         "Mexico",
         "Norway",
         "Poland",
         "Portugal",
         "Spain",
         "Sweden",
         "Switzerland",
         "UK",
         "USA",
         "Venezuela"
     });
     this.lbCountries.Location              = new System.Drawing.Point(8, 8);
     this.lbCountries.Name                  = "lbCountries";
     this.lbCountries.Size                  = new System.Drawing.Size(232, 392);
     this.lbCountries.TabIndex              = 0;
     this.lbCountries.SelectedIndexChanged += new System.EventHandler(this.lbCountries_SelectedIndexChanged);
     //
     // stiPreviewControl1
     //
     this.stiPreviewControl1.AllowDrop = true;
     this.stiPreviewControl1.Anchor    = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                                | System.Windows.Forms.AnchorStyles.Left)
                                                                               | System.Windows.Forms.AnchorStyles.Right)));
     this.stiPreviewControl1.Location                  = new System.Drawing.Point(240, 8);
     this.stiPreviewControl1.Name                      = "stiPreviewControl1";
     this.stiPreviewControl1.Report                    = null;
     this.stiPreviewControl1.RightToLeft               = System.Windows.Forms.RightToLeft.No;
     this.stiPreviewControl1.ShowBookmarksPanel        = false;
     this.stiPreviewControl1.ShowCloseButton           = false;
     this.stiPreviewControl1.ShowContextMenu           = false;
     this.stiPreviewControl1.ShowEditor                = false;
     this.stiPreviewControl1.ShowExport                = false;
     this.stiPreviewControl1.ShowFind                  = false;
     this.stiPreviewControl1.ShowHorScrollBar          = false;
     this.stiPreviewControl1.ShowOpen                  = false;
     this.stiPreviewControl1.ShowPageControl           = false;
     this.stiPreviewControl1.ShowPageDelete            = false;
     this.stiPreviewControl1.ShowPageDesign            = false;
     this.stiPreviewControl1.ShowPageNew               = false;
     this.stiPreviewControl1.ShowPageSize              = false;
     this.stiPreviewControl1.ShowPageViewMode          = false;
     this.stiPreviewControl1.ShowPrint                 = false;
     this.stiPreviewControl1.ShowSave                  = false;
     this.stiPreviewControl1.ShowSendEMail             = false;
     this.stiPreviewControl1.ShowStatusBar             = false;
     this.stiPreviewControl1.ShowThumbsPanel           = false;
     this.stiPreviewControl1.ShowToolbar               = false;
     this.stiPreviewControl1.ShowVertScrollBar         = false;
     this.stiPreviewControl1.ShowViewModeContinuous    = false;
     this.stiPreviewControl1.ShowViewModeMultiplePages = false;
     this.stiPreviewControl1.ShowViewModeSinglePage    = false;
     this.stiPreviewControl1.ShowZoom                  = false;
     this.stiPreviewControl1.ShowZoomMultiplePages     = false;
     this.stiPreviewControl1.ShowZoomOnePage           = false;
     this.stiPreviewControl1.ShowZoomPageWidth         = false;
     this.stiPreviewControl1.ShowZoomTwoPages          = false;
     this.stiPreviewControl1.Size                      = new System.Drawing.Size(328, 392);
     this.stiPreviewControl1.TabIndex                  = 3;
     this.stiPreviewControl1.ThumbsPanelEnabled        = false;
     //
     // Form1
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize        = new System.Drawing.Size(576, 445);
     this.Controls.Add(this.stiPreviewControl1);
     this.Controls.Add(this.button1);
     this.Controls.Add(this.lbCountries);
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
     this.Icon            = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.Name            = "Form1";
     this.StartPosition   = System.Windows.Forms.FormStartPosition.CenterScreen;
     this.Text            = "Reports with SQL Parameters";
     this.WindowState     = System.Windows.Forms.FormWindowState.Maximized;
     this.ResumeLayout(false);
 }
Example #19
0
        protected virtual Boolean WfToolbarExecute()
        {
            BindingMaster.EndEdit();
            string filePath = "";

            try
            {
                this.errorProvider.Clear();
                if (!TabMaster.IsAutoExecuted)  //不做條件檢查   --主要由他窗引用
                {
                    if (this.WfFormCheck() == false)
                    {
                        //WfRollback();
                        return(false);
                    }

                    if (this.WfAfterFormCheck() == false)
                    {
                        //WfRollback();
                        return(false);
                    }
                }

                if (GlobalFn.varIsNull(TabMaster.ReportName))
                {
                    WfShowErrorMsg("未設定來源報表");
                }
                filePath = Application.StartupPath + @"\reports\" + TabMaster.ReportName;
                if (!File.Exists(filePath))
                {
                    WfShowErrorMsg("無此來源報表路徑!");
                }

                Stimulsoft.Report.StiReport rpt = new Stimulsoft.Report.StiReport();
                rpt.Load(filePath);
                rpt.ReportName = this.AdoModel.ado10;

                //產生資料來源
                if (this.WfExecReport(rpt) == false)
                {
                    //WfRollback();
                    return(false);
                }

                rpt.Compile();
                rpt["ReportId"]  = this.StrFormID;
                rpt["CompNo"]    = this.LoginInfo.CompNo;
                rpt["CompNameA"] = this.LoginInfo.CompNameA;
                rpt["DeptNo"]    = this.LoginInfo.DeptNo;
                rpt["DeptName"]  = this.LoginInfo.DeptName;
                rpt["UserNo"]    = this.LoginInfo.UserNo;
                rpt["UserName"]  = this.LoginInfo.UserName;

                if (WfExecReportEnd(rpt) == false)
                {
                    return(false);
                }


                FrmReportDisplayBase rptDisplayBase = new FrmReportDisplayBase(rpt);
                //rptDisplayBase.stiViewerControl1.ClickPrintButton += stiViewerControl1_ClickPrintButton;
                //rptDisplayBase.stiViewerControl1.ClickPrintButton += new System.EventHandler(this.stiViewerControl1_ClickPrintButton);
                rptDisplayBase.stiViewerControl1.Report.CompiledReport.Printed += new EventHandler(report_Print);

                rptDisplayBase.Show();

                if (TabMaster.IsCloseAfterExecuted)
                {
                    this.Close();
                }

                //if (TabMaster.IsCloseAfterExecuted)
                //    this.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                //this.Cursor = Cursors.Default; //改到工具列處理
            }

            return(true);
        }
Example #20
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
     this.button2    = new System.Windows.Forms.Button();
     this.button3    = new System.Windows.Forms.Button();
     this.button1    = new System.Windows.Forms.Button();
     this.stiReport1 = new Stimulsoft.Report.StiReport();
     this.SuspendLayout();
     //
     // button2
     //
     this.button2.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.button2.Location = new System.Drawing.Point(125, 43);
     this.button2.Name     = "button2";
     this.button2.Size     = new System.Drawing.Size(75, 26);
     this.button2.TabIndex = 6;
     this.button2.Text     = "Preview";
     this.button2.Click   += new System.EventHandler(this.button2_Click);
     //
     // button3
     //
     this.button3.Anchor       = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.button3.DialogResult = System.Windows.Forms.DialogResult.Cancel;
     this.button3.Location     = new System.Drawing.Point(208, 43);
     this.button3.Name         = "button3";
     this.button3.Size         = new System.Drawing.Size(75, 26);
     this.button3.TabIndex     = 7;
     this.button3.Text         = "Close";
     this.button3.Click       += new System.EventHandler(this.button3_Click);
     //
     // button1
     //
     this.button1.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.button1.Location = new System.Drawing.Point(42, 43);
     this.button1.Name     = "button1";
     this.button1.Size     = new System.Drawing.Size(75, 26);
     this.button1.TabIndex = 5;
     this.button1.Text     = "Design";
     this.button1.Click   += new System.EventHandler(this.button1_Click);
     //
     // stiReport1
     //
     this.stiReport1.CookieContainer      = null;
     this.stiReport1.EngineVersion        = Stimulsoft.Report.Engine.StiEngineVersion.EngineV2;
     this.stiReport1.ReferencedAssemblies = new string[] {
         "System.Dll",
         "System.Drawing.Dll",
         "System.Windows.Forms.Dll",
         "System.Data.Dll",
         "System.Xml.Dll",
         "Stimulsoft.Controls.Dll",
         "Stimulsoft.Base.Dll",
         "Stimulsoft.Report.Dll"
     };
     this.stiReport1.ReportAlias         = "Report";
     this.stiReport1.ReportGuid          = "e35ed5d9964044c8933aaf59baa965c0";
     this.stiReport1.ReportImage         = null;
     this.stiReport1.ReportName          = "Report";
     this.stiReport1.ReportSource        = null;
     this.stiReport1.ReportUnit          = Stimulsoft.Report.StiReportUnitType.Centimeters;
     this.stiReport1.ScriptLanguage      = Stimulsoft.Report.StiReportLanguageType.CSharp;
     this.stiReport1.UseProgressInThread = false;
     //
     // Form1
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize        = new System.Drawing.Size(320, 117);
     this.Controls.Add(this.button2);
     this.Controls.Add(this.button3);
     this.Controls.Add(this.button1);
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
     this.Icon            = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.MaximizeBox     = false;
     this.Name            = "Form1";
     this.StartPosition   = System.Windows.Forms.FormStartPosition.CenterScreen;
     this.Text            = "Live Reports";
     this.ResumeLayout(false);
 }
Example #21
0
        protected override bool WfExecReport(Stimulsoft.Report.StiReport pReport)
        {
            vw_glar311       glar311Model;
            StringBuilder    sbSql      = null;
            string           sqlBody    = "";
            string           sqlOrderBy = "";
            DataTable        dtMaster;
            List <Master>    masterList;
            List <QueryInfo> queryInfoList;
            QueryInfo        queryModel;
            string           strQueryRange, strWhere;
            StringBuilder    sbQuerySingle = null;

            List <SqlParameter> sqlParmList;

            try
            {
                glar311Model = DrMaster.ToItem <vw_glar311>();

                queryInfoList = new List <QueryInfo>();
                #region range 處理
                if (!GlobalFn.varIsNull(glar311Model.gfa01))
                {
                    queryModel            = new QueryInfo();
                    queryModel.TableName  = "gfa_tb";
                    queryModel.ColumnName = "gfa01";
                    queryModel.ColumnType = TabMaster.DtSource.Columns["gfa01"].DataType.Name;
                    queryModel.Value      = glar311Model.gfa01;
                    queryInfoList.Add(queryModel);
                }
                sqlParmList   = new List <SqlParameter>();
                strQueryRange = BoMaster.WfGetQueryString(queryInfoList, out sqlParmList);
                #endregion

                #region single 處理
                sbQuerySingle = new StringBuilder();
                if (!GlobalFn.varIsNull(glar311Model.gfa02_s))
                {
                    sbQuerySingle.AppendLine("AND gfa02>=@gfa02_s");
                    sqlParmList.Add(new SqlParameter("@gfa02_s", glar311Model.gfa02_s));
                }
                if (!GlobalFn.varIsNull(glar311Model.gfa02_e))
                {
                    sbQuerySingle.AppendLine("AND gfa02<=@gfa02_e");
                    sqlParmList.Add(new SqlParameter("@gfa02_e", glar311Model.gfa02_e));
                }

                //過帳否
                if (glar311Model.gfapost == "1")
                {
                    sbQuerySingle.AppendLine("AND gfapost='N'");
                }
                else if (glar311Model.gfapost == "2")
                {
                    sbQuerySingle.AppendLine("AND gfapost='Y'");
                }

                //有效否
                if (glar311Model.gfaconf == "1")
                {
                    sbQuerySingle.AppendLine("AND gfaconf <>'X' ");
                }
                else if (glar311Model.gfaconf == "2")
                {
                    sbQuerySingle.AppendLine("AND gfapost='X' ");
                }
                #endregion

                strWhere = strQueryRange + " " + sbQuerySingle.ToString();
                var strSecurity = WfGetSecurityString();        //取得權限字串
                if (!GlobalFn.varIsNull(strSecurity))
                {
                    strWhere += strSecurity;
                }

                //取得單頭
                sqlBody = @"SELECT 
	                            gfa01,gfa02,gfa03,gfa04,gfa05,
	                            gfa06,gfa07,gfa08,gfa09,
	                            gfaprno,gfaconf,gfacond,gfaconu,
	                            gfapost,gfaposd,gfaposu,
                                gfacreu,gfacred,
                                gac02 as gfa01_c,
	                            gfb02,gfb03,gfb04,gfb05,
	                            gfb06,gfb07,gfb08,gfb09,gfb10,
	                            gba02 AS gfb03_c,
	                            beb03 AS gfb05_c,
	                            bek04,
	                            gba05
                            FROM gfa_tb                                
                                LEFT JOIN gfb_tb ON gfa01=gfb01
	                            LEFT JOIN baa_tb ON 1=1	
	                            LEFT JOIN gac_tb ON substring(gfa01,1,baa06)=gac01
	                            LEFT JOIN gba_tb ON gfb03=gba01
	                            LEFT JOIN bek_tb ON gfb08=bek01
	                            LEFT JOIN beb_tb ON gfb05=beb01
                            WHERE 1=1       
                           ";
                #region 排序處理
                if (!GlobalFn.varIsNull(glar311Model.order1))
                {
                    switch (glar311Model.order1)
                    {
                    case "1":
                        sqlOrderBy = "ORDER BY gfa01";
                        break;

                    case "2":
                        sqlOrderBy = "ORDER BY gfa02";
                        break;

                    case "3":
                        sqlOrderBy = "ORDER BY gfb03";
                        break;

                    case "4":
                        sqlOrderBy = "ORDER BY gfb05";
                        break;

                    case "5":
                        sqlOrderBy = "ORDER BY gfb02";
                        break;

                    case "6":
                        sqlOrderBy = "ORDER BY gfa06";
                        break;
                    }
                }
                if (!GlobalFn.varIsNull(glar311Model.order2))
                {
                    if (GlobalFn.varIsNull(sqlOrderBy))
                    {
                        switch (glar311Model.order2)
                        {
                        case "1":
                            sqlOrderBy = "ORDER BY gfa01";
                            break;

                        case "2":
                            sqlOrderBy = "ORDER BY gfa02";
                            break;

                        case "3":
                            sqlOrderBy = "ORDER BY gfb03";
                            break;

                        case "4":
                            sqlOrderBy = "ORDER BY gfb05";
                            break;

                        case "5":
                            sqlOrderBy = "ORDER BY gfb02";
                            break;

                        case "6":
                            sqlOrderBy = "ORDER BY gfa06";
                            break;
                        }
                    }
                    else
                    {
                        switch (glar311Model.order2)
                        {
                        case "1":
                            sqlOrderBy += ",gfa01";
                            break;

                        case "2":
                            sqlOrderBy += ",gfa02";
                            break;

                        case "3":
                            sqlOrderBy += ",gfb03";
                            break;

                        case "4":
                            sqlOrderBy += ",gfb05";
                            break;

                        case "5":
                            sqlOrderBy += ",gfb02";
                            break;

                        case "6":
                            sqlOrderBy += ",gfa06";
                            break;
                        }
                    }
                }
                if (!GlobalFn.varIsNull(glar311Model.order3))
                {
                    if (GlobalFn.varIsNull(sqlOrderBy))
                    {
                        switch (glar311Model.order3)
                        {
                        case "1":
                            sqlOrderBy = "ORDER BY gfa01";
                            break;

                        case "2":
                            sqlOrderBy = "ORDER BY gfa02";
                            break;

                        case "3":
                            sqlOrderBy = "ORDER BY gfb03";
                            break;

                        case "4":
                            sqlOrderBy = "ORDER BY gfb05";
                            break;

                        case "5":
                            sqlOrderBy = "ORDER BY gfb02";
                            break;

                        case "6":
                            sqlOrderBy = "ORDER BY gfa06";
                            break;
                        }
                    }
                    else
                    {
                        switch (glar311Model.order3)
                        {
                        case "1":
                            sqlOrderBy += ",gfa01";
                            break;

                        case "2":
                            sqlOrderBy += ",gfa02";
                            break;

                        case "3":
                            sqlOrderBy += ",gfb03";
                            break;

                        case "4":
                            sqlOrderBy += ",gfb05";
                            break;

                        case "5":
                            sqlOrderBy += ",gfb02";
                            break;

                        case "6":
                            sqlOrderBy += ",gfa06";
                            break;
                        }
                    }
                }
                #endregion

                dtMaster           = BoMaster.OfGetDataTable(string.Concat(sqlBody, strWhere, sqlOrderBy), sqlParmList.ToArray());
                dtMaster.TableName = "Master";

                if (dtMaster == null || dtMaster.Rows.Count == 0)
                {
                    WfShowErrorMsg("查無資料,請重新過濾條件!");
                    return(false);
                }
                masterList = dtMaster.ToList <Master>(true);
                //取得本幣資料
                var baaModel = BoBas.OfGetBaaModel();
                if (baaModel == null)
                {
                    WfShowErrorMsg("未設定基本參數,請先設定!");
                    return(false);
                }
                var baa04      = baaModel.baa04;
                var bekUsModel = BoBas.OfGetBekModel(baa04);
                if (bekUsModel == null)
                {
                    WfShowErrorMsg("查無本幣資料,請先設定!");
                    return(false);
                }
                masterList = dtMaster.ToList <Master>(true);

                foreach (Master masterModel in masterList)
                {
                    if (masterModel.gfb06 == "1")
                    {
                        masterModel.gfb07d     = masterModel.gfb07;
                        masterModel.gfb07d_str = string.Format("{0:N" + bekUsModel.bek04 + "}", masterModel.gfb07);
                        masterModel.gfb10d     = masterModel.gfb10;
                        masterModel.gfb10d_str = string.Format("{0:N" + masterModel.bek04 + "}", masterModel.gfb10);
                    }
                    else
                    {
                        masterModel.gfb07c     = masterModel.gfb07;
                        masterModel.gfb07c_str = string.Format("{0:N" + bekUsModel.bek04 + "}", masterModel.gfb07);
                        masterModel.gfb10c     = masterModel.gfb10;
                        masterModel.gfb10c_str = string.Format("{0:N" + masterModel.bek04 + "}", masterModel.gfb10);
                    }
                }

                pReport.RegData("Master", masterList);
                pReport.CacheAllData = true;

                #region 列印選項處理
                StiGroupHeaderBand headerBand1 = (StiGroupHeaderBand)pReport.GetComponents()["GroupHeaderBand1"];
                StiGroupFooterBand footerBand1 = (StiGroupFooterBand)pReport.GetComponents()["GroupFooterBand1"];
                StiGroupHeaderBand headerBand2 = (StiGroupHeaderBand)pReport.GetComponents()["GroupHeaderBand2"];
                StiGroupFooterBand footerBand2 = (StiGroupFooterBand)pReport.GetComponents()["GroupFooterBand2"];
                StiGroupHeaderBand headerBand3 = (StiGroupHeaderBand)pReport.GetComponents()["GroupHeaderBand3"];
                StiGroupFooterBand footerBand3 = (StiGroupFooterBand)pReport.GetComponents()["GroupFooterBand3"];
                if (!GlobalFn.varIsNull(glar311Model.order1) &&
                    (glar311Model.order1_jump_yn == "Y" || glar311Model.order1_sum_yn == "Y"))
                {
                    switch (glar311Model.order1)
                    {
                    case "1":
                        headerBand1.Condition.Value = "{Master.gfa01}";
                        break;

                    case "2":
                        headerBand1.Condition.Value = "{Master.gfa02}";
                        break;

                    case "3":
                        headerBand1.Condition.Value = "{Master.gfb03}";
                        break;

                    case "4":
                        headerBand1.Condition.Value = "{Master.gfb05}";
                        break;

                    case "5":
                        headerBand1.Condition.Value = "{Master.gfb02}";
                        break;

                    case "6":
                        headerBand1.Condition.Value = "{Master.gfa06}";
                        break;
                    }

                    //處理跳頁
                    if (glar311Model.order1_jump_yn == "Y")
                    {
                        headerBand1.NewPageBefore   = true;
                        headerBand1.ResetPageNumber = true;
                    }
                    else
                    {
                        headerBand1.NewPageBefore   = false;
                        headerBand1.ResetPageNumber = false;
                    }
                    //處理小計
                    if (glar311Model.order1_sum_yn.ToUpper() != "Y")
                    {
                        footerBand1.Enabled = false;
                    }
                }
                else
                {
                    footerBand1.Enabled = false;
                }

                if (!GlobalFn.varIsNull(glar311Model.order2) &&
                    (glar311Model.order2_jump_yn == "Y" || glar311Model.order2_sum_yn == "Y"))
                {
                    switch (glar311Model.order2)
                    {
                    case "1":
                        headerBand2.Condition.Value = "{Master.gfa01}";
                        break;

                    case "2":
                        headerBand2.Condition.Value = "{Master.gfa02}";
                        break;

                    case "3":
                        headerBand2.Condition.Value = "{Master.gfb03}";
                        break;

                    case "4":
                        headerBand2.Condition.Value = "{Master.gfb05}";
                        break;

                    case "5":
                        headerBand2.Condition.Value = "{Master.gfb02}";
                        break;

                    case "6":
                        headerBand2.Condition.Value = "{Master.gfa06}";
                        break;
                    }

                    //處理跳頁
                    if (glar311Model.order2_jump_yn.ToUpper() == "Y")
                    {
                        headerBand2.NewPageBefore   = true;
                        headerBand2.ResetPageNumber = true;
                    }
                    else
                    {
                        headerBand2.NewPageBefore   = false;
                        headerBand2.ResetPageNumber = false;
                    }
                    //處理小計
                    if (glar311Model.order2_sum_yn.ToUpper() != "Y")
                    {
                        footerBand2.Enabled = false;
                    }
                }
                else
                {
                    footerBand2.Enabled = false;
                }

                if (!GlobalFn.varIsNull(glar311Model.order3) &&
                    (glar311Model.order3_jump_yn == "Y" || glar311Model.order3_sum_yn == "Y"))
                {
                    switch (glar311Model.order3)
                    {
                    case "1":
                        headerBand3.Condition.Value = "{Master.gfa01}";
                        break;

                    case "2":
                        headerBand3.Condition.Value = "{Master.gfa02}";
                        break;

                    case "3":
                        headerBand3.Condition.Value = "{Master.gfb03}";
                        break;

                    case "4":
                        headerBand3.Condition.Value = "{Master.gfb05}";
                        break;

                    case "5":
                        headerBand3.Condition.Value = "{Master.gfb02}";
                        break;

                    case "6":
                        headerBand3.Condition.Value = "{Master.gfa06}";
                        break;
                    }

                    //處理跳頁
                    if (glar311Model.order3_jump_yn.ToUpper() == "Y")
                    {
                        headerBand3.NewPageBefore   = true;
                        headerBand3.ResetPageNumber = true;
                    }
                    else
                    {
                        headerBand3.NewPageBefore   = false;
                        headerBand3.ResetPageNumber = false;
                    }
                    //處理小計
                    if (glar311Model.order3_sum_yn.ToUpper() != "Y")
                    {
                        footerBand3.Enabled = false;
                    }
                }
                else
                {
                    footerBand3.Enabled = false;
                }
                #endregion
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }