Exemplo n.º 1
0
        private void ReadGroupFooterBand(XtraReportBase xtraReport, GroupFooterBand xtraBand, StiPage page)
        {
            StiGroupFooterBand band = new StiGroupFooterBand();

            page.Components.Add(band);

            ReadBand(xtraBand, band);
        }
Exemplo n.º 2
0
        private void ReadGroupFooterBand(XmlNode node, StiPage page)
        {
            StiGroupFooterBand band = new StiGroupFooterBand();

            page.Components.Add(band);

            ReadBand(node, band);
        }
Exemplo n.º 3
0
        public IReportBuilder WithGroupFooterBand(List <string> titles, double[] sizes, List <TextAlign> aligns = null, double height = 0.3)
        {
            CurrentGroupFooter = new StiGroupFooterBand(MakeRectangle(0, 0, 0, height));
            Page.Components.Add(CurrentGroupFooter);

            var x = 0.0;

            for (var i = 0; i < titles.Count; i++)
            {
                var align = TextAlign.Right;
                if (aligns != null)
                {
                    align = aligns[i];
                }

                var stiText = _textBuilder.New(titles[i]).WithPosition(x).WithSize(sizes[i])
                              .WithAlign((StiTextHorAlignment)align).WithFont(FontStyle.Bold).Then();
                x += sizes[i];
                CurrentGroupFooter.Components.Add(stiText);
            }
            return(this);
        }
Exemplo n.º 4
0
        protected override bool WfExecReport(Stimulsoft.Report.StiReport pReport)
        {
            vw_invr401       invr401Model;
            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_Invr401 != null) //他窗引用時
                {
                    invr401Model = Vw_Invr401;
                }
                else
                {
                    invr401Model = DrMaster.ToItem <vw_invr401>();
                }

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

                #region single 處理
                sbQuerySingle = new StringBuilder();
                if (!GlobalFn.varIsNull(invr401Model.ila02_s))
                {
                    sbQuerySingle.AppendLine("AND ila02>=@ila02_s");
                    sqlParmList.Add(new SqlParameter("@ila02_s", invr401Model.ila02_s));
                }
                if (!GlobalFn.varIsNull(invr401Model.ila02_e))
                {
                    sbQuerySingle.AppendLine("AND ila02<=@ila02_e");
                    sqlParmList.Add(new SqlParameter("@ila02_e", invr401Model.ila02_e));
                }
                #endregion

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

                //取得單頭
                sqlBody = @"SELECT ila_tb.*,
                                sca02 as ila03_c,
                                bec02 as ila04_c,
                                beb02 as ila05_c,
                                bab02 as ila01_c,
                                bel02 as ila14_c,
                                sbg1.sbg02 as ila15_c,
                                sbg2.sbg02 as ila16_c,
                                ilb02,ilb03,ilb04,ilb05,ilb06,
                                ilb11,ilb13,
                                bej03
                            FROM ila_tb                                
                                LEFT JOIN ilb_tb ON ila01=ilb01
	                            LEFT JOIN sca_tb ON ila03=sca01	--客戶
	                            LEFT JOIN bec_tb ON ila04=bec01	--員工
	                            LEFT JOIN beb_tb ON ila05=beb01	--部門
	                            LEFT JOIN baa_tb ON 1=1	
	                            LEFT JOIN bab_tb ON substring(ila01,1,baa06)=bab01
                                LEFT JOIN ica_tb ON ilb03=ica01
                                LEFT JOIN bej_tb ON ilb03=bej01
	                            LEFT JOIN bel_tb ON ila14=bel01	--貨運方式
	                            LEFT JOIN sbg_tb sbg1 ON ila15=sbg1.sbg01	--運送起點
	                            LEFT JOIN sbg_tb sbg2 ON ila16=sbg2.sbg01	--運送終點
                            WHERE 1=1 
                                AND ilaconf='Y'
                           ";
                //處理排序
                switch (invr401Model.order_by)
                {
                case "1":    //1.依借出日期
                    sqlOrderBy = " ORDER BY ila02";
                    break;

                case "2":    //2.依客戶
                    sqlOrderBy = " ORDER BY ila03";
                    break;
                }
                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);
                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;
            }
        }
Exemplo n.º 5
0
        protected override bool WfExecReport(Stimulsoft.Report.StiReport pReport)
        {
            vw_invr302       invr302Model;
            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_Invr302 != null) //他窗引用時
                {
                    invr302Model = Vw_Invr302;
                }
                else
                {
                    invr302Model = DrMaster.ToItem <vw_invr302>();
                }

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

                #region single 處理
                sbQuerySingle = new StringBuilder();
                if (!GlobalFn.varIsNull(invr302Model.iga02_s))
                {
                    sbQuerySingle.AppendLine("AND iga02>=@iga02_s");
                    sqlParmList.Add(new SqlParameter("@iga02_s", invr302Model.iga02_s));
                }
                if (!GlobalFn.varIsNull(invr302Model.iga02_e))
                {
                    sbQuerySingle.AppendLine("AND iga02<=@iga02_e");
                    sqlParmList.Add(new SqlParameter("@iga02_e", invr302Model.iga02_e));
                }
                #endregion

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

                //取得單頭
                sqlBody            = @"SELECT iga_tb.*,
                                bec02 as iga03_c,
                                beb02 as iga04_c,
                                bab02 as iga01_c,
                                igb02,igb03,igb04,igb05,igb06,
                                igb09,igb10,
                                ica03
                            FROM iga_tb                                
                                LEFT JOIN igb_tb ON iga01=igb01
	                            LEFT JOIN bec_tb ON iga03=bec01	--員工
	                            LEFT JOIN beb_tb ON iga04=beb01	--部門
	                            LEFT JOIN baa_tb ON 1=1	
	                            LEFT JOIN bab_tb ON substring(iga01,1,baa06)=bab01
                                LEFT JOIN ica_tb ON igb03=ica01
                            WHERE 1=1 
                                AND igaconf='Y'
                                AND iga00='2'
                           ";
                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);
                foreach (Master masterModel in masterList)
                {
                    var bejModel = BoBas.OfGetBejModel(masterModel.igb06);
                    if (bejModel != null)
                    {
                        masterModel.igb05_str = string.Format("{0:N" + bejModel.bej03 + "}", masterModel.igb05);//數量
                    }
                    else
                    {
                        masterModel.igb05_str = masterModel.igb05.ToString();
                    }
                }

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

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 6
0
        protected override bool WfExecReport(Stimulsoft.Report.StiReport pReport)
        {
            //DataSet ds;
            vw_invr522 invr522Model;
            string sqlBody = "";
            DataTable dtIlaTb;
            List<QueryInfo> queryInfoList;
            QueryInfo queryModel;
            string strQueryRange, strWhere, strOrderBy;
            StringBuilder sbQuerySingle = null;
            List<SqlParameter> sqlParmList;
            List<Master> resultList = null;
            try
            {
                invr522Model = DrMaster.ToItem<vw_invr522>();
                resultList = new List<Master>();
                queryInfoList = new List<QueryInfo>();
                #region range 處理
                if (!GlobalFn.varIsNull(invr522Model.ipa01))
                {
                    queryModel = new QueryInfo();
                    queryModel.TableName = "ipa_tb";
                    queryModel.ColumnName = "ipa01";
                    queryModel.ColumnType = TabMaster.DtSource.Columns["ipa01"].DataType.Name;
                    queryModel.Value = invr522Model.ipa01;
                    queryInfoList.Add(queryModel);
                }
                if (!GlobalFn.varIsNull(invr522Model.ipacreu))
                {
                    queryModel = new QueryInfo();
                    queryModel.TableName = "ipa_tb";
                    queryModel.ColumnName = "ipacreu";
                    queryModel.ColumnType = TabMaster.DtSource.Columns["ipacreu"].DataType.Name;
                    queryModel.Value = invr522Model.ipacreu;
                    queryInfoList.Add(queryModel);
                }
                if (!GlobalFn.varIsNull(invr522Model.ipacreg))
                {
                    queryModel = new QueryInfo();
                    queryModel.TableName = "ipa_tb";
                    queryModel.ColumnName = "ipacreg";
                    queryModel.ColumnType = TabMaster.DtSource.Columns["ipacreg"].DataType.Name;
                    queryModel.Value = invr522Model.ipacreg;
                    queryInfoList.Add(queryModel);
                }
                sqlParmList = new List<SqlParameter>();
                strQueryRange = BoMaster.WfGetQueryString(queryInfoList, out sqlParmList);
                #endregion

                #region single 處理
                sbQuerySingle = new StringBuilder();
                if (!GlobalFn.varIsNull(invr522Model.ipa03_s))
                {
                    sbQuerySingle.AppendLine("AND ipa03>=@ipa03_s");
                    sqlParmList.Add(new SqlParameter("@ila02_s", invr522Model.ipa03_s));
                }
                if (!GlobalFn.varIsNull(invr522Model.ipa03_e))
                {
                    sbQuerySingle.AppendLine("AND ipa03<=@ipa03_e");
                    sqlParmList.Add(new SqlParameter("@ipa03_e", invr522Model.ipa03_e));
                }
                #endregion

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

                //取得單頭
                sqlBody = @"
                            SELECT 
	                            ipa01,ipb02,ipb03,ipb04,ipb05,
	                            ipb06,ipb07,ipb30,ipb40,ipb50,
                                ica02,ica03,
                                bej03,
	                            CONVERT(DECIMAL,0) AS qty1,
	                            CONVERT(DECIMAL,0) AS qty2,
	                            CONVERT(DECIMAL,0) AS dif_qty,
	                            CONVERT(NVARCHAR(20),0) AS qty1_str,
	                            CONVERT(NVARCHAR(20),0) AS qty2_str,
	                            CONVERT(NVARCHAR(20),0) AS dif_qty_str
                            FROM ipa_tb
	                            INNER JOIN ipb_tb ON ipa01=ipb01
                                LEFT JOIN ica_tb ON ipb03=ica01
                                LEFT JOIN bej_tb ON ipb07=bej01
                            WHERE
	                            ipa05='Y'
                                ";
                strOrderBy = " ORDER BY ipa01,ipb02";
                dtIlaTb = BoMaster.OfGetDataTable(string.Concat(sqlBody, strWhere, strOrderBy), sqlParmList.ToArray());
                dtIlaTb.TableName = "Master";
                if (dtIlaTb != null)
                {
                    resultList.AddRange(dtIlaTb.ToList<Master>());
                }

                if (resultList == null || resultList.Count == 0)
                {
                    WfShowErrorMsg("查無資料,請重新過濾條件!");
                    return false;
                }

                foreach (Master masterModel in resultList)
                {
                    switch (invr522Model.type1)
                    {
                        case "1":
                            masterModel.qty1 = masterModel.ipb30;
                            break;
                        case "2":
                            masterModel.qty1 = masterModel.ipb40;
                            break;
                        case "3":
                            masterModel.qty1 = masterModel.ipb50;
                            break;
                        case "4":
                            masterModel.qty1 = masterModel.ipb06;
                            break;
                    }
                    switch (invr522Model.type2)
                    {
                        case "1":
                            masterModel.qty2 = masterModel.ipb30;
                            break;
                        case "2":
                            masterModel.qty2 = masterModel.ipb40;
                            break;
                        case "3":
                            masterModel.qty2 = masterModel.ipb50;
                            break;
                        case "4":
                            masterModel.qty2 = masterModel.ipb06;
                            break;
                    }
                    masterModel.dif_qty = masterModel.qty2 - masterModel.qty1;

                    masterModel.qty1_str = string.Format("{0:N" + masterModel.bej03 + "}", masterModel.qty1);
                    masterModel.qty2_str = string.Format("{0:N" + masterModel.bej03 + "}", masterModel.qty2);
                    masterModel.dif_qty_str = string.Format("{0:N" + masterModel.bej03 + "}", masterModel.dif_qty);
                }
                
                if (invr522Model.dif_yn == "Y")//只顯示差異
                {
                    if (resultList.Where(x => x.dif_qty != 0).Count() == 0)
                    {
                        WfShowErrorMsg("查無資料,請重新過濾條件!");
                        return false;
                    }
                    pReport.RegData("master", resultList.Where(x => x.dif_qty != 0));
                }
                else
                {
                    pReport.RegData("master", resultList);                    
                }

                pReport.CacheAllData = true;
                StiGroupFooterBand footerBand1 = (StiGroupFooterBand)pReport.GetComponents()["GroupFooterBand1"];
                footerBand1.NewPageAfter = true;
                footerBand1.ResetPageNumber = true;
                pReport.Compile();
                return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 7
0
 private void InitializeComponent()
 {
     VW_SalesOrderHeader = new VW_SalesOrderHeaderDataSource();
     Dictionary.Variables.Add(new StiVariable("", "MyCompanyName", "MyCompanyName", typeof(string), "", false, false));
     Dictionary.Variables.Add(new StiVariable("", "MyCompanyTaxCode", "MyCompanyTaxCode", typeof(string), "", false, false));
     Dictionary.Variables.Add(new StiVariable("", "MyCompanyDirectorName", "MyCompanyDirectorName", typeof(string), "", false, false));
     Dictionary.Variables.Add(new StiVariable("", "MyCompanyCountryCode", "MyCompanyCountryCode", typeof(string), "", false, false));
     Dictionary.Variables.Add(new StiVariable("", "MyCompanyCountryName", "MyCompanyCountryName", typeof(string), "", false, false));
     Dictionary.Variables.Add(new StiVariable("", "MyCompanyCity", "MyCompanyCity", typeof(string), "", false, false));
     Dictionary.Variables.Add(new StiVariable("", "MyCompanyPostalCode", "MyCompanyPostalCode", typeof(string), "", false, false));
     Dictionary.Variables.Add(new StiVariable("", "MyCompanyAddress", "MyCompanyAddress", typeof(string), "", false, false));
     Dictionary.Variables.Add(new StiVariable("", "MyCompanyPhone", "MyCompanyPhone", typeof(string), "", false, false));
     Dictionary.Variables.Add(new StiVariable("", "MyCompanyFax", "MyCompanyFax", typeof(string), "", false, false));
     Dictionary.Variables.Add(new StiVariable("", "MyCompanyBankName", "MyCompanyBankName", typeof(string), "", false, false));
     Dictionary.Variables.Add(new StiVariable("", "MyCompanyBankCode", "MyCompanyBankCode", typeof(string), "", false, false));
     Dictionary.Variables.Add(new StiVariable("", "MyCompanyBankAccountNumber", "MyCompanyBankAccountNumber", typeof(string), "", false, false));
     NeedsCompiling    = false;
     Text1_Sum         = new StiSumDecimalFunctionService();
     FooterText1_Count = new StiCountFunctionService();
     // Variables init
     // Variables init
     MyCompanyName              = "";
     MyCompanyTaxCode           = "";
     MyCompanyDirectorName      = "";
     MyCompanyCountryCode       = "";
     MyCompanyCountryName       = "";
     MyCompanyCity              = "";
     MyCompanyPostalCode        = "";
     MyCompanyAddress           = "";
     MyCompanyPhone             = "";
     MyCompanyFax               = "";
     MyCompanyBankName          = "";
     MyCompanyBankCode          = "";
     MyCompanyBankAccountNumber = "";
     EngineVersion              = StiEngineVersion.EngineV2;
     ReferencedAssemblies       = new[] {
         "System.Dll",
         "System.Drawing.Dll",
         "System.Windows.Forms.Dll",
         "System.Data.Dll",
         "System.Xml.Dll",
         "Stimulsoft.Controls.Dll",
         "Stimulsoft.Base.Dll",
         "Stimulsoft.Report.Dll"
     };
     ReportAlias  = "Rpt Sales Order Header";
     ReportAuthor = "Programmer.GE";
     //
     // ReportChanged
     //
     ReportChanged = new DateTime(2009, 6, 17, 11, 6, 30, 0);
     //
     // ReportCreated
     //
     ReportCreated     = new DateTime(2009, 2, 8, 17, 26, 28, 0);
     ReportDescription = "გაყიდვების რეპორტი";
     ReportGuid        = "2f64cd76b33a4817bb677636d7597eee";
     ReportName        = "RptSalesOrderHeader";
     ReportUnit        = StiReportUnitType.Centimeters;
     ScriptLanguage    = StiReportLanguageType.CSharp;
     //
     // Page1
     //
     Page1            = new StiPage();
     Page1.Guid       = "08a406f7186b4a67b5f7a96a78aa664a";
     Page1.Name       = "Page1";
     Page1.PageHeight = 29.7;
     Page1.PageWidth  = 21;
     Page1.Border     = new StiBorder(StiBorderSides.None, Color.Black, 2, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black));
     Page1.Brush      = new StiSolidBrush(Color.Transparent);
     //
     // ReportTitle
     //
     ReportTitle = new StiReportTitleBand();
     ReportTitle.ClientRectangle = new RectangleD(0, 0.4, 19, 0.8);
     ReportTitle.Name            = "ReportTitle";
     ReportTitle.Border          = new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black));
     ReportTitle.Brush           = new StiSolidBrush(Color.Transparent);
     //
     // ReportTitleText
     //
     ReportTitleText = new StiText();
     ReportTitleText.ClientRectangle = new RectangleD(0, 0, 19, 0.8);
     ReportTitleText.HorAlignment    = StiTextHorAlignment.Center;
     ReportTitleText.Name            = "ReportTitleText";
     ReportTitleText.GetValue       += new StiGetValueEventHandler(ReportTitleText__GetValue);
     ReportTitleText.Type            = StiSystemTextType.Expression;
     ReportTitleText.VertAlignment   = StiVertAlignment.Center;
     ReportTitleText.Border          = new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black));
     ReportTitleText.Brush           = new StiSolidBrush(Color.Transparent);
     ReportTitleText.Font            = new Font("BPG Glaho Arial", 12F, FontStyle.Bold);
     ReportTitleText.Guid            = null;
     ReportTitleText.Interaction     = null;
     ReportTitleText.Margins         = new StiMargins(0, 0, 0, 0);
     ReportTitleText.TextBrush       = new StiSolidBrush(Color.Black);
     ReportTitleText.TextOptions     = new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None);
     ReportTitle.Guid        = null;
     ReportTitle.Interaction = null;
     //
     // Header
     //
     Header = new StiHeaderBand();
     Header.ClientRectangle = new RectangleD(0, 2, 19, 0.8);
     Header.Name            = "Header";
     Header.Border          = new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black));
     Header.Brush           = new StiSolidBrush(Color.Transparent);
     //
     // HeaderText1
     //
     HeaderText1                 = new StiText();
     HeaderText1.CanGrow         = true;
     HeaderText1.ClientRectangle = new RectangleD(0, 0, 2.8, 0.8);
     HeaderText1.HorAlignment    = StiTextHorAlignment.Center;
     HeaderText1.Name            = "HeaderText1";
     HeaderText1.GetValue       += new StiGetValueEventHandler(HeaderText1__GetValue);
     HeaderText1.Type            = StiSystemTextType.Expression;
     HeaderText1.VertAlignment   = StiVertAlignment.Center;
     HeaderText1.Border          = new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black));
     HeaderText1.Brush           = new StiSolidBrush(Color.Transparent);
     HeaderText1.Font            = new Font("BPG Glaho Arial", 10F, FontStyle.Bold);
     HeaderText1.Guid            = null;
     HeaderText1.Interaction     = null;
     HeaderText1.Margins         = new StiMargins(0, 0, 0, 0);
     HeaderText1.TextBrush       = new StiSolidBrush(Color.Black);
     HeaderText1.TextOptions     = new StiTextOptions(false, false, true, 0F, HotkeyPrefix.None, StringTrimming.None);
     //
     // HeaderText2
     //
     HeaderText2                 = new StiText();
     HeaderText2.CanGrow         = true;
     HeaderText2.ClientRectangle = new RectangleD(2.8, 0, 2, 0.8);
     HeaderText2.HorAlignment    = StiTextHorAlignment.Center;
     HeaderText2.Name            = "HeaderText2";
     HeaderText2.GetValue       += new StiGetValueEventHandler(HeaderText2__GetValue);
     HeaderText2.Type            = StiSystemTextType.Expression;
     HeaderText2.VertAlignment   = StiVertAlignment.Center;
     HeaderText2.Border          = new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black));
     HeaderText2.Brush           = new StiSolidBrush(Color.Transparent);
     HeaderText2.Font            = new Font("BPG Glaho Arial", 10F, FontStyle.Bold);
     HeaderText2.Guid            = null;
     HeaderText2.Interaction     = null;
     HeaderText2.Margins         = new StiMargins(0, 0, 0, 0);
     HeaderText2.TextBrush       = new StiSolidBrush(Color.Black);
     HeaderText2.TextOptions     = new StiTextOptions(false, false, true, 0F, HotkeyPrefix.None, StringTrimming.None);
     //
     // HeaderText3
     //
     HeaderText3                 = new StiText();
     HeaderText3.CanGrow         = true;
     HeaderText3.ClientRectangle = new RectangleD(4.8, 0, 6.4, 0.8);
     HeaderText3.HorAlignment    = StiTextHorAlignment.Center;
     HeaderText3.Name            = "HeaderText3";
     HeaderText3.GetValue       += new StiGetValueEventHandler(HeaderText3__GetValue);
     HeaderText3.Type            = StiSystemTextType.Expression;
     HeaderText3.VertAlignment   = StiVertAlignment.Center;
     HeaderText3.Border          = new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black));
     HeaderText3.Brush           = new StiSolidBrush(Color.Transparent);
     HeaderText3.Font            = new Font("BPG Glaho Arial", 10F, FontStyle.Bold);
     HeaderText3.Guid            = null;
     HeaderText3.Interaction     = null;
     HeaderText3.Margins         = new StiMargins(0, 0, 0, 0);
     HeaderText3.TextBrush       = new StiSolidBrush(Color.Black);
     HeaderText3.TextOptions     = new StiTextOptions(false, false, true, 0F, HotkeyPrefix.None, StringTrimming.None);
     //
     // HeaderText4
     //
     HeaderText4                 = new StiText();
     HeaderText4.CanGrow         = true;
     HeaderText4.ClientRectangle = new RectangleD(11.2, 0, 2.8, 0.8);
     HeaderText4.HorAlignment    = StiTextHorAlignment.Center;
     HeaderText4.Name            = "HeaderText4";
     HeaderText4.GetValue       += new StiGetValueEventHandler(HeaderText4__GetValue);
     HeaderText4.Type            = StiSystemTextType.Expression;
     HeaderText4.VertAlignment   = StiVertAlignment.Center;
     HeaderText4.Border          = new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black));
     HeaderText4.Brush           = new StiSolidBrush(Color.Transparent);
     HeaderText4.Font            = new Font("BPG Glaho Arial", 10F, FontStyle.Bold);
     HeaderText4.Guid            = null;
     HeaderText4.Interaction     = null;
     HeaderText4.Margins         = new StiMargins(0, 0, 0, 0);
     HeaderText4.TextBrush       = new StiSolidBrush(Color.Black);
     HeaderText4.TextOptions     = new StiTextOptions(false, false, true, 0F, HotkeyPrefix.None, StringTrimming.None);
     //
     // HeaderText5
     //
     HeaderText5                 = new StiText();
     HeaderText5.CanGrow         = true;
     HeaderText5.ClientRectangle = new RectangleD(14, 0, 1.6, 0.8);
     HeaderText5.HorAlignment    = StiTextHorAlignment.Center;
     HeaderText5.Name            = "HeaderText5";
     HeaderText5.GetValue       += new StiGetValueEventHandler(HeaderText5__GetValue);
     HeaderText5.Type            = StiSystemTextType.Expression;
     HeaderText5.VertAlignment   = StiVertAlignment.Center;
     HeaderText5.Border          = new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black));
     HeaderText5.Brush           = new StiSolidBrush(Color.Transparent);
     HeaderText5.Font            = new Font("BPG Glaho Arial", 10F, FontStyle.Bold);
     HeaderText5.Guid            = null;
     HeaderText5.Interaction     = null;
     HeaderText5.Margins         = new StiMargins(0, 0, 0, 0);
     HeaderText5.TextBrush       = new StiSolidBrush(Color.Black);
     HeaderText5.TextOptions     = new StiTextOptions(false, false, true, 0F, HotkeyPrefix.None, StringTrimming.None);
     //
     // HeaderText6
     //
     HeaderText6                 = new StiText();
     HeaderText6.CanGrow         = true;
     HeaderText6.ClientRectangle = new RectangleD(15.6, 0, 3.4, 0.8);
     HeaderText6.HorAlignment    = StiTextHorAlignment.Center;
     HeaderText6.Name            = "HeaderText6";
     HeaderText6.GetValue       += new StiGetValueEventHandler(HeaderText6__GetValue);
     HeaderText6.Type            = StiSystemTextType.Expression;
     HeaderText6.VertAlignment   = StiVertAlignment.Center;
     HeaderText6.Border          = new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black));
     HeaderText6.Brush           = new StiSolidBrush(Color.Transparent);
     HeaderText6.Font            = new Font("BPG Glaho Arial", 10F, FontStyle.Bold);
     HeaderText6.Guid            = null;
     HeaderText6.Interaction     = null;
     HeaderText6.Margins         = new StiMargins(0, 0, 0, 0);
     HeaderText6.TextBrush       = new StiSolidBrush(Color.Black);
     HeaderText6.TextOptions     = new StiTextOptions(false, false, true, 0F, HotkeyPrefix.None, StringTrimming.None);
     Header.Guid                 = null;
     Header.Interaction          = null;
     //
     // GroupHeader0
     //
     GroupHeader0 = new StiGroupHeaderBand();
     GroupHeader0.ClientRectangle = new RectangleD(0, 3.6, 19, 0.8);
     GroupHeader0.GetValue       += new StiValueEventHandler(GroupHeader0__GetValue);
     GroupHeader0.Name            = "GroupHeader0";
     GroupHeader0.Border          = new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black));
     GroupHeader0.Brush           = new StiSolidBrush(Color.Transparent);
     //
     // GroupHeaderText0
     //
     GroupHeaderText0                 = new StiText();
     GroupHeaderText0.CanGrow         = true;
     GroupHeaderText0.ClientRectangle = new RectangleD(0, 0, 19, 0.8);
     GroupHeaderText0.Name            = "GroupHeaderText0";
     GroupHeaderText0.GetValue       += new StiGetValueEventHandler(GroupHeaderText0__GetValue);
     GroupHeaderText0.VertAlignment   = StiVertAlignment.Center;
     GroupHeaderText0.Border          = new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black));
     GroupHeaderText0.Brush           = new StiSolidBrush(Color.Transparent);
     GroupHeaderText0.Font            = new Font("BPG Glaho Arial", 10F, FontStyle.Bold);
     GroupHeaderText0.Guid            = null;
     GroupHeaderText0.Interaction     = null;
     GroupHeaderText0.Margins         = new StiMargins(0, 0, 0, 0);
     GroupHeaderText0.TextBrush       = new StiSolidBrush(Color.Black);
     GroupHeaderText0.TextOptions     = new StiTextOptions(false, false, true, 0F, HotkeyPrefix.None, StringTrimming.None);
     GroupHeader0.Guid                = null;
     GroupHeader0.Interaction         = null;
     //
     // Data
     //
     Data = new StiDataBand();
     Data.ClientRectangle = new RectangleD(0, 5.2, 19, 0.6);
     Data.DataSourceName  = "VW_SalesOrderHeader";
     Data.Name            = "Data";
     Data.Sort            = new[] {
         "ASC",
         "BranchName",
         "ASC",
         "OrderDate"
     };
     Data.Border = new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black));
     Data.Brush  = new StiSolidBrush(Color.Transparent);
     //
     // DataText1
     //
     DataText1 = new StiText();
     DataText1.ClientRectangle = new RectangleD(0, 0, 2.2, 0.6);
     DataText1.Name            = "DataText1";
     DataText1.GetValue       += new StiGetValueEventHandler(DataText1__GetValue);
     DataText1.VertAlignment   = StiVertAlignment.Center;
     DataText1.Border          = new StiBorder(StiBorderSides.All, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black));
     DataText1.Brush           = new StiSolidBrush(Color.Transparent);
     DataText1.Font            = new Font("BPG Glaho Arial", 10F);
     DataText1.Guid            = null;
     DataText1.Interaction     = null;
     DataText1.Margins         = new StiMargins(0, 0, 0, 0);
     DataText1.TextBrush       = new StiSolidBrush(Color.Black);
     DataText1.TextOptions     = new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None);
     //
     // DataText2
     //
     DataText2 = new StiText();
     DataText2.ClientRectangle = new RectangleD(2.2, 0, 3.2, 0.6);
     DataText2.Name            = "DataText2";
     DataText2.GetValue       += new StiGetValueEventHandler(DataText2__GetValue);
     DataText2.VertAlignment   = StiVertAlignment.Center;
     DataText2.Border          = new StiBorder(StiBorderSides.All, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black));
     DataText2.Brush           = new StiSolidBrush(Color.Transparent);
     DataText2.Font            = new Font("BPG Glaho Arial", 10F);
     DataText2.Guid            = null;
     DataText2.Interaction     = null;
     DataText2.Margins         = new StiMargins(0, 0, 0, 0);
     DataText2.TextBrush       = new StiSolidBrush(Color.Black);
     DataText2.TextFormat      = new StiCustomFormatService("G");
     DataText2.TextOptions     = new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None);
     //
     // DataText3
     //
     DataText3 = new StiText();
     DataText3.ClientRectangle = new RectangleD(5.4, 0, 5.8, 0.6);
     DataText3.Name            = "DataText3";
     DataText3.GetValue       += new StiGetValueEventHandler(DataText3__GetValue);
     DataText3.Type            = StiSystemTextType.Expression;
     DataText3.VertAlignment   = StiVertAlignment.Center;
     DataText3.Border          = new StiBorder(StiBorderSides.All, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black));
     DataText3.Brush           = new StiSolidBrush(Color.Transparent);
     DataText3.Font            = new Font("BPG Glaho Arial", 10F);
     DataText3.Guid            = null;
     DataText3.Interaction     = null;
     DataText3.Margins         = new StiMargins(0, 0, 0, 0);
     DataText3.TextBrush       = new StiSolidBrush(Color.Black);
     DataText3.TextOptions     = new StiTextOptions(false, false, true, 0F, HotkeyPrefix.None, StringTrimming.None);
     //
     // DataText4
     //
     DataText4 = new StiText();
     DataText4.ClientRectangle = new RectangleD(11.2, 0, 2.8, 0.6);
     DataText4.HorAlignment    = StiTextHorAlignment.Right;
     DataText4.Name            = "DataText4";
     DataText4.GetValue       += new StiGetValueEventHandler(DataText4__GetValue);
     DataText4.VertAlignment   = StiVertAlignment.Center;
     DataText4.Border          = new StiBorder(StiBorderSides.All, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black));
     DataText4.Brush           = new StiSolidBrush(Color.Transparent);
     DataText4.Font            = new Font("BPG Glaho Arial", 10F);
     DataText4.Guid            = null;
     DataText4.Interaction     = null;
     DataText4.Margins         = new StiMargins(0, 0, 0, 0);
     DataText4.TextBrush       = new StiSolidBrush(Color.Black);
     DataText4.TextFormat      = new StiNumberFormatService(1, ",", 2, " ", 3, true, true, " ");
     DataText4.TextOptions     = new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None);
     //
     // DataText5
     //
     DataText5 = new StiText();
     DataText5.ClientRectangle = new RectangleD(14, 0, 1.6, 0.6);
     DataText5.HorAlignment    = StiTextHorAlignment.Center;
     DataText5.Name            = "DataText5";
     DataText5.GetValue       += new StiGetValueEventHandler(DataText5__GetValue);
     DataText5.VertAlignment   = StiVertAlignment.Center;
     DataText5.Border          = new StiBorder(StiBorderSides.All, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black));
     DataText5.Brush           = new StiSolidBrush(Color.Transparent);
     DataText5.Font            = new Font("BPG Glaho Arial", 10F);
     DataText5.Guid            = null;
     DataText5.Interaction     = null;
     DataText5.Margins         = new StiMargins(0, 0, 0, 0);
     DataText5.TextBrush       = new StiSolidBrush(Color.Black);
     DataText5.TextOptions     = new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None);
     //
     // DataText6
     //
     DataText6 = new StiText();
     DataText6.ClientRectangle = new RectangleD(15.6, 0, 3.4, 0.6);
     DataText6.Name            = "DataText6";
     DataText6.GetValue       += new StiGetValueEventHandler(DataText6__GetValue);
     DataText6.VertAlignment   = StiVertAlignment.Center;
     DataText6.Border          = new StiBorder(StiBorderSides.All, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black));
     DataText6.Brush           = new StiSolidBrush(Color.Transparent);
     DataText6.Font            = new Font("BPG Glaho Arial", 10F);
     DataText6.Guid            = null;
     DataText6.Interaction     = null;
     DataText6.Margins         = new StiMargins(0, 0, 0, 0);
     DataText6.TextBrush       = new StiSolidBrush(Color.Black);
     DataText6.TextOptions     = new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None);
     Data.Guid            = null;
     Data.Interaction     = null;
     Data.MasterComponent = null;
     //
     // GroupFooter0
     //
     GroupFooter0 = new StiGroupFooterBand();
     GroupFooter0.ClientRectangle = new RectangleD(0, 6.6, 19, 0.4);
     GroupFooter0.Name            = "GroupFooter0";
     GroupFooter0.Border          = new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black));
     GroupFooter0.Brush           = new StiSolidBrush(Color.Transparent);
     GroupFooter0.Guid            = null;
     GroupFooter0.Interaction     = null;
     //
     // Footer
     //
     Footer = new StiFooterBand();
     Footer.ClientRectangle = new RectangleD(0, 7.8, 19, 0.6);
     Footer.Name            = "Footer";
     Footer.Border          = new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black));
     Footer.Brush           = new StiSolidBrush(Color.Transparent);
     //
     // FooterText1
     //
     FooterText1                 = new StiText();
     FooterText1.CanGrow         = true;
     FooterText1.ClientRectangle = new RectangleD(0, 0, 2.2, 0.6);
     FooterText1.HorAlignment    = StiTextHorAlignment.Center;
     FooterText1.Name            = "FooterText1";
     //
     // FooterText1_Count
     //
     FooterText1.GetValue     += new StiGetValueEventHandler(FooterText1__GetValue);
     FooterText1.Type          = StiSystemTextType.Expression;
     FooterText1.VertAlignment = StiVertAlignment.Center;
     FooterText1.Border        = new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black));
     FooterText1.Brush         = new StiSolidBrush(Color.Transparent);
     FooterText1.Font          = new Font("BPG Glaho Arial", 10F, FontStyle.Bold);
     FooterText1.Guid          = null;
     FooterText1.Interaction   = null;
     FooterText1.Margins       = new StiMargins(0, 0, 0, 0);
     FooterText1.TextBrush     = new StiSolidBrush(Color.Black);
     FooterText1.TextOptions   = new StiTextOptions(false, false, true, 0F, HotkeyPrefix.None, StringTrimming.None);
     //
     // Text1
     //
     Text1 = new StiText();
     Text1.ClientRectangle = new RectangleD(11.2, 0, 2.8, 0.6);
     Text1.HorAlignment    = StiTextHorAlignment.Right;
     Text1.Name            = "Text1";
     //
     // Text1_Sum
     //
     Text1.GetValue                     += new StiGetValueEventHandler(Text1__GetValue);
     Text1.Type                          = StiSystemTextType.Totals;
     Text1.Border                        = new StiBorder(StiBorderSides.None, Color.Black, 1, StiPenStyle.Solid, false, 4, new StiSolidBrush(Color.Black));
     Text1.Brush                         = new StiSolidBrush(Color.Transparent);
     Text1.Font                          = new Font("BPG Glaho Arial", 10F, FontStyle.Bold);
     Text1.Guid                          = null;
     Text1.Interaction                   = null;
     Text1.Margins                       = new StiMargins(0, 0, 0, 0);
     Text1.TextBrush                     = new StiSolidBrush(Color.Black);
     Text1.TextFormat                    = new StiNumberFormatService(1, ",", 2, " ", 3, true, true, " ");
     Text1.TextOptions                   = new StiTextOptions(false, false, false, 0F, HotkeyPrefix.None, StringTrimming.None);
     Footer.Guid                         = null;
     Footer.Interaction                  = null;
     Page1.ExcelSheetValue               = null;
     Page1.Interaction                   = null;
     Page1.Margins                       = new StiMargins(1, 1, 1, 1);
     Page1_Watermark                     = new StiWatermark();
     Page1_Watermark.Font                = new Font("Arial", 100F);
     Page1_Watermark.Image               = null;
     Page1_Watermark.TextBrush           = new StiSolidBrush(Color.FromArgb(50, 0, 0, 0));
     RptSalesOrderHeader_PrinterSettings = new StiPrinterSettings();
     PrinterSettings                     = RptSalesOrderHeader_PrinterSettings;
     Page1.Page                          = Page1;
     Page1.Report                        = this;
     Page1.Watermark                     = Page1_Watermark;
     ReportTitle.Page                    = Page1;
     ReportTitle.Parent                  = Page1;
     ReportTitleText.Page                = Page1;
     ReportTitleText.Parent              = ReportTitle;
     Header.Page                         = Page1;
     Header.Parent                       = Page1;
     HeaderText1.Page                    = Page1;
     HeaderText1.Parent                  = Header;
     HeaderText2.Page                    = Page1;
     HeaderText2.Parent                  = Header;
     HeaderText3.Page                    = Page1;
     HeaderText3.Parent                  = Header;
     HeaderText4.Page                    = Page1;
     HeaderText4.Parent                  = Header;
     HeaderText5.Page                    = Page1;
     HeaderText5.Parent                  = Header;
     HeaderText6.Page                    = Page1;
     HeaderText6.Parent                  = Header;
     GroupHeader0.Page                   = Page1;
     GroupHeader0.Parent                 = Page1;
     GroupHeaderText0.Page               = Page1;
     GroupHeaderText0.Parent             = GroupHeader0;
     Data.Page           = Page1;
     Data.Parent         = Page1;
     DataText1.Page      = Page1;
     DataText1.Parent    = Data;
     DataText2.Page      = Page1;
     DataText2.Parent    = Data;
     DataText3.Page      = Page1;
     DataText3.Parent    = Data;
     DataText4.Page      = Page1;
     DataText4.Parent    = Data;
     DataText5.Page      = Page1;
     DataText5.Parent    = Data;
     DataText6.Page      = Page1;
     DataText6.Parent    = Data;
     GroupFooter0.Page   = Page1;
     GroupFooter0.Parent = Page1;
     Footer.Page         = Page1;
     Footer.Parent       = Page1;
     FooterText1.Page    = Page1;
     FooterText1.Parent  = Footer;
     Text1.Page          = Page1;
     Text1.Parent        = Footer;
     Data.BeginRender   += new EventHandler(Data__BeginRender);
     Data.EndRender     += new EventHandler(Data__EndRender);
     Data.Rendering     += new EventHandler(Data__Rendering);
     AggregateFunctions  = new object[] {
         FooterText1_Count,
         Text1_Sum
     };
     //
     // Add to ReportTitle.Components
     //
     ReportTitle.Components.Clear();
     ReportTitle.Components.AddRange(new StiComponent[] {
         ReportTitleText
     });
     //
     // Add to Header.Components
     //
     Header.Components.Clear();
     Header.Components.AddRange(new StiComponent[] {
         HeaderText1,
         HeaderText2,
         HeaderText3,
         HeaderText4,
         HeaderText5,
         HeaderText6
     });
     //
     // Add to GroupHeader0.Components
     //
     GroupHeader0.Components.Clear();
     GroupHeader0.Components.AddRange(new StiComponent[] {
         GroupHeaderText0
     });
     //
     // Add to Data.Components
     //
     Data.Components.Clear();
     Data.Components.AddRange(new StiComponent[] {
         DataText1,
         DataText2,
         DataText3,
         DataText4,
         DataText5,
         DataText6
     });
     //
     // Add to Footer.Components
     //
     Footer.Components.Clear();
     Footer.Components.AddRange(new StiComponent[] {
         FooterText1,
         Text1
     });
     //
     // Add to Page1.Components
     //
     Page1.Components.Clear();
     Page1.Components.AddRange(new StiComponent[] {
         ReportTitle,
         Header,
         GroupHeader0,
         Data,
         GroupFooter0,
         Footer
     });
     //
     // Add to Pages
     //
     Pages.Clear();
     Pages.AddRange(new[] {
         Page1
     });
     VW_SalesOrderHeader.Columns.AddRange(new[] {
         new StiDataColumn("SalesOrderID", "SalesOrderID", "SalesOrderID", typeof(int)),
         new StiDataColumn("BranchID", "BranchID", "BranchID", typeof(int)),
         new StiDataColumn("BranchName", "BranchName", "BranchName", typeof(string)),
         new StiDataColumn("OrderDate", "OrderDate", "OrderDate", typeof(DateTime)),
         new StiDataColumn("OverheadNumber", "OverheadNumber", "OverheadNumber", typeof(string)),
         new StiDataColumn("CustomerID", "CustomerID", "CustomerID", typeof(int)),
         new StiDataColumn("CustomerName", "CustomerName", "CustomerName", typeof(string)),
         new StiDataColumn("SubTotal", "SubTotal", "SubTotal", typeof(decimal)),
         new StiDataColumn("TaxAmt", "TaxAmt", "TaxAmt", typeof(decimal)),
         new StiDataColumn("Freight", "Freight", "Freight", typeof(decimal)),
         new StiDataColumn("TotalDue", "TotalDue", "TotalDue", typeof(decimal)),
         new StiDataColumn("CurrencyCode", "CurrencyCode", "CurrencyCode", typeof(string)),
         new StiDataColumn("CurrencyRateID", "CurrencyRateID", "CurrencyRateID", typeof(int)),
         new StiDataColumn("PaymentMethodID", "PaymentMethodID", "PaymentMethodID", typeof(int)),
         new StiDataColumn("PaymentMethodName", "PaymentMethodName", "PaymentMethodName", typeof(string)),
         new StiDataColumn("RevisionNumber", "RevisionNumber", "RevisionNumber", typeof(byte)),
         new StiDataColumn("Status", "Status", "Status", typeof(byte)),
         new StiDataColumn("ModifiedUserID", "ModifiedUserID", "ModifiedUserID", typeof(int)),
         new StiDataColumn("Modifier", "Modifier", "Modifier", typeof(string)),
         new StiDataColumn("ModifiedDate", "ModifiedDate", "ModifiedDate", typeof(DateTime)),
         new StiDataColumn("ApproverUserID", "ApproverUserID", "ApproverUserID", typeof(int)),
         new StiDataColumn("Approver", "Approver", "Approver", typeof(string))
     });
     DataSources.Add(VW_SalesOrderHeader);
 }
Exemplo n.º 8
0
        protected override bool WfExecReport(Stimulsoft.Report.StiReport pReport)
        {
            //DataSet ds;
            vw_manr311    manr311Model;
            StringBuilder sbSql   = null;
            string        sqlBody = "";
            DataTable     dtMaster;
            List <YR.ERP.DAL.YRModel.Reports.Man.Manr311.Master> masterList;
            List <QueryInfo> queryInfoList;
            QueryInfo        queryModel;
            string           strQueryRange, strWhere;
            StringBuilder    sbQuerySingle = null;

            List <SqlParameter> sqlParmList;

            try
            {
                if (Vw_Manr311 != null) //他窗引用時
                {
                    manr311Model = Vw_Manr311;
                }
                else
                {
                    manr311Model = DrMaster.ToItem <vw_manr311>();
                }

                queryInfoList = new List <QueryInfo>();
                #region range 處理
                if (!GlobalFn.varIsNull(manr311Model.mfa01))
                {
                    queryModel            = new QueryInfo();
                    queryModel.TableName  = "mfa_tb";
                    queryModel.ColumnName = "mfa01";
                    queryModel.ColumnType = TabMaster.DtSource.Columns["mfa01"].DataType.Name;
                    queryModel.Value      = manr311Model.mfa01;
                    queryInfoList.Add(queryModel);
                }
                if (!GlobalFn.varIsNull(manr311Model.mfa03))
                {
                    queryModel            = new QueryInfo();
                    queryModel.TableName  = "mfa_tb";
                    queryModel.ColumnName = "mfa03";
                    queryModel.ColumnType = TabMaster.DtSource.Columns["mfa03"].DataType.Name;
                    queryModel.Value      = manr311Model.mfa03;
                    queryInfoList.Add(queryModel);
                }
                sqlParmList = new List <SqlParameter>();

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

                #region single 處理
                sbQuerySingle = new StringBuilder();
                if (!GlobalFn.varIsNull(manr311Model.mfa02_s))
                {
                    sbQuerySingle.AppendLine("AND mfa02>=@mfa02_s");
                    sqlParmList.Add(new SqlParameter("@mfa02_s", manr311Model.mfa02_s));
                }
                if (!GlobalFn.varIsNull(manr311Model.mfa02_e))
                {
                    sbQuerySingle.AppendLine("AND mfa02<=@mfa02_e");
                    sqlParmList.Add(new SqlParameter("@mfa02_e", manr311Model.mfa02_e));
                }
                #endregion

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

                //取得單頭
                sqlBody            = @"SELECT 
	                            mfa00,mfa01,mfa02,mfa03,mfa04,mfa05,
	                            mfa06,mfa07,mfa08,
                                bab02 as mfa01_c,
                                pca02 as mfa03_c,
	                            bec02 as mfa04_c,beb02 as mfa05_c,
	                            mfb02,mfb03,mfb04,mfb05,mfb06,
	                            mfb07,mfb09,
                                ica.ica03 as ica03,
                                bej.bej03 as bej03,
                                '' as mfb05_str,
                                pcb03,pcb04,pcb06,pcb07
                            FROM mfa_tb   
                                LEFT JOIN mfb_tb On mfa01=mfb01
	                            LEFT JOIN baa_tb ON 1=1	
	                            LEFT JOIN bab_tb ON substring(mfa01,1,baa06)=bab01
	                            LEFT JOIN pca_tb ON mfa03=pca01	--廠商
	                            LEFT JOIN bec_tb ON mfa04=bec01	--員工
	                            LEFT JOIN beb_tb ON mfa05=beb01	--部門
                                LEFT JOIN ica_tb ica ON mfb03=ica.ica01
                                LEFT JOIN bej_tb bej ON mfb06=bej.bej01
                                LEFT JOIN pcb_tb ON mfa03=pcb01 and mfa07=pcb02
                            WHERE 1=1 
                                AND mfaconf='Y'
                                AND mfa00='2'
                           ";
                dtMaster           = BoMaster.OfGetDataTable(string.Concat(sqlBody, strWhere), sqlParmList.ToArray());
                dtMaster.TableName = "Master";

                if (dtMaster == null || dtMaster.Rows.Count == 0)
                {
                    WfShowErrorMsg("查無資料,請重新過濾條件!");
                    return(false);
                }

                masterList = dtMaster.ToList <Master>();
                foreach (Master masterModel in masterList)
                {
                    masterModel.mfb05_str = string.Format("{0:N" + masterModel.bej03 + "}", masterModel.mfb05);//子件數量
                }

                pReport.RegData(dtMaster);
                pReport.RegData("Master", masterList);
                pReport.CacheAllData = true;
                //處理排序
                StiDataBand stiDataBand1 = (StiDataBand)pReport.GetComponents()["DataBand1"];
                switch (manr311Model.order_by)
                {
                case "1":    //1.依出庫日期
                    stiDataBand1.Sort = new string[] { "ASC", "mfa02" };
                    break;

                case "2":    //2.依廠商
                    stiDataBand1.Sort = new string[] { "ASC", "mfa03" };
                    break;
                }
                //處理跳頁
                StiGroupFooterBand grouperBand1 = (StiGroupFooterBand)pReport.GetComponents()["GroupFooterBand1"];
                if (manr311Model.jump_yn.ToUpper() == "Y")
                {
                    grouperBand1.NewPageAfter    = true;
                    grouperBand1.ResetPageNumber = true;
                }
                else
                {
                    grouperBand1.NewPageAfter    = false;
                    grouperBand1.ResetPageNumber = false;
                }

                pReport.Compile();
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 9
0
        protected override bool WfExecReport(Stimulsoft.Report.StiReport pReport)
        {
            vw_purr500       purr500Model;
            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_Purr500 != null) //他窗引用時
                {
                    purr500Model = Vw_Purr500;
                }
                else
                {
                    purr500Model = DrMaster.ToItem <vw_purr500>();
                }

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

                #region single 處理
                sbQuerySingle = new StringBuilder();
                if (!GlobalFn.varIsNull(purr500Model.pha02_s))
                {
                    sbQuerySingle.AppendLine("AND pha02>=@pha02_s");
                    sqlParmList.Add(new SqlParameter("@pha02_s", purr500Model.pha02_s));
                }
                if (!GlobalFn.varIsNull(purr500Model.pha02_e))
                {
                    sbQuerySingle.AppendLine("AND pha02<=@pha02_e");
                    sqlParmList.Add(new SqlParameter("@pha02_e", purr500Model.pha02_e));
                }
                #endregion

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

                //取得單頭
                sqlBody = @"SELECT pha_tb.*,
                                pca02 as pha03_c,
                                bec02 as pha04_c,
                                beb02 as pha05_c,
                                bab02 as pha01_c,
                                bea03,bea04,bea05,
                                phb02,phb03,phb04,phb05,phb06,
                                phb09,phb10,phb10t,
                                phb16,
                                ica03,
                                bej03
                            FROM pha_tb                                
                                LEFT JOIN phb_tb ON pha01=phb01
	                            LEFT JOIN pca_tb ON pha03=pca01	--廠商
	                            LEFT JOIN bec_tb ON pha04=bec01	--員工
	                            LEFT JOIN beb_tb ON pha05=beb01	--部門
	                            LEFT JOIN baa_tb ON 1=1	
	                            LEFT JOIN bab_tb ON substring(pha01,1,baa06)=bab01
                                LEFT JOIN bea_tb ON phacomp=beacomp
                                LEFT JOIN ica_tb ON phb03=ica01
                                LEFT JOIN bej_tb ON phb03=bej01
                            WHERE 1=1 
                                AND phaconf='Y'
                           ";
                //處理排序
                switch (purr500Model.order_by)
                {
                case "1":    //1.依出貨日期
                    sqlOrderBy = " ORDER BY pha02";
                    break;

                case "2":    //2.依客戶
                    sqlOrderBy = " ORDER BY pha03";
                    break;
                }
                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);
                foreach (Master masterModel in masterList)
                {
                    //處理金額
                    if (!GlobalFn.varIsNull(masterModel.pha10))
                    {
                        var bekModel = BoBas.OfGetBekModel(masterModel.pha10);
                        if (bekModel != null)
                        {
                            //單頭
                            masterModel.pha13_str  = string.Format("{0:N" + bekModel.bek04 + "}", masterModel.pha13);
                            masterModel.pha13t_str = string.Format("{0:N" + bekModel.bek04 + "}", masterModel.pha13t);
                            masterModel.pha13g_str = string.Format("{0:N" + bekModel.bek04 + "}", masterModel.pha13g);
                            //單身
                            masterModel.phb09_str  = string.Format("{0:N" + bekModel.bek03 + "}", masterModel.phb09);
                            masterModel.phb10_str  = string.Format("{0:N" + bekModel.bek04 + "}", masterModel.phb10);
                            masterModel.phb10t_str = string.Format("{0:N" + bekModel.bek04 + "}", masterModel.phb10t);
                        }
                    }

                    masterModel.phb05_str = string.Format("{0:N" + masterModel.bej03 + "}", masterModel.phb05);//數量
                }

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

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 10
0
        protected override bool WfExecReport(Stimulsoft.Report.StiReport pReport)
        {
            //DataSet ds;
            vw_manr210    manr210Model;
            StringBuilder sbSql   = null;
            string        sqlBody = "";
            DataTable     dtMaster;
            List <YR.ERP.DAL.YRModel.Reports.Man.Manr210.Master> masterList;
            List <QueryInfo> queryInfoList;
            QueryInfo        queryModel;
            string           strQueryRange, strWhere;
            StringBuilder    sbQuerySingle = null;

            List <SqlParameter> sqlParmList;

            try
            {
                if (Vw_Manr210 != null) //他窗引用時
                {
                    manr210Model = Vw_Manr210;
                }
                else
                {
                    manr210Model = DrMaster.ToItem <vw_manr210>();
                }

                queryInfoList = new List <QueryInfo>();
                #region range 處理
                if (!GlobalFn.varIsNull(manr210Model.mea01))
                {
                    queryModel            = new QueryInfo();
                    queryModel.TableName  = "mea_tb";
                    queryModel.ColumnName = "mea01";
                    queryModel.ColumnType = TabMaster.DtSource.Columns["mea01"].DataType.Name;
                    queryModel.Value      = manr210Model.mea01;
                    queryInfoList.Add(queryModel);
                }
                if (!GlobalFn.varIsNull(manr210Model.mea03))
                {
                    queryModel            = new QueryInfo();
                    queryModel.TableName  = "mea_tb";
                    queryModel.ColumnName = "mea03";
                    queryModel.ColumnType = TabMaster.DtSource.Columns["mea03"].DataType.Name;
                    queryModel.Value      = manr210Model.mea03;
                    queryInfoList.Add(queryModel);
                }

                if (!GlobalFn.varIsNull(manr210Model.mea20))
                {
                    queryModel            = new QueryInfo();
                    queryModel.TableName  = "mea_tb";
                    queryModel.ColumnName = "mea20";
                    queryModel.ColumnType = TabMaster.DtSource.Columns["mea20"].DataType.Name;
                    queryModel.Value      = manr210Model.mea03;
                    queryInfoList.Add(queryModel);
                }
                sqlParmList   = new List <SqlParameter>();
                strQueryRange = BoMaster.WfGetQueryString(queryInfoList, out sqlParmList);
                #endregion

                #region single 處理
                sbQuerySingle = new StringBuilder();
                if (!GlobalFn.varIsNull(manr210Model.mea02_s))
                {
                    sbQuerySingle.AppendLine("AND mea02>=@mea02_s");
                    sqlParmList.Add(new SqlParameter("@mea02_s", manr210Model.mea02_s));
                }
                if (!GlobalFn.varIsNull(manr210Model.mea02_e))
                {
                    sbQuerySingle.AppendLine("AND mea02<=@mea02_e");
                    sqlParmList.Add(new SqlParameter("@mea02_e", manr210Model.mea02_e));
                }
                #endregion

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

                //取得單頭
                sqlBody            = @"SELECT 
                                mea00,mea01,mea02,mea03,mea04,mea05,
                                mea06,mea07,mea08,mea09,mea10,
                                mea11,mea12,mea13,mea14,mea14t,
                                mea15,mea16,mea17,mea18,mea19,
                                mea20,mea21,mea22,mea23,mea24,
                                mea25,mea26,mea27,mea28,mea29,
                                bab02 as mea01_c,
                                pca02 as mea03_c,
                                bec02 as  mea04_c,beb02 as mea05_c,
                                bef03 as mea11_c,pbb02 as mea12_c,
                                ica_main.ica03 as ica03_main,
                                '' as mea13_str,'' as mea14_str,'' as mea14t_str,
                                '' as mea22_str,
                                bej_main.bej03 as bej03_main,
                                meb02,meb03,meb04,meb05,meb06,
                                meb07,
                                ica_detail.ica03 as ica03_detail,
                                bej_detail.bej03 as bej03_detail,
                                '' as meb05_str
                            FROM mea_tb                                
                                LEFT JOIN meb_tb On mea01=meb01
	                            LEFT JOIN pca_tb ON mea03=pca01	--廠商
	                            LEFT JOIN bec_tb ON mea04=bec01	--員工
	                            LEFT JOIN beb_tb ON mea05=beb01	--部門
	                            LEFT JOIN bef_tb ON mea11=bef02 AND bef01='1'	--收付款條件
	                            LEFT JOIN pbb_tb ON mea12=pbb01	--採購取價原則
	                            LEFT JOIN baa_tb ON 1=1	
	                            LEFT JOIN bab_tb ON substring(mea01,1,baa06)=bab01
                                LEFT JOIN ica_tb ica_main ON mea20=ica_main.ica01
                                LEFT JOIN bej_tb bej_main ON mea23=bej_main.bej01
                                LEFT JOIN ica_tb ica_detail ON meb03=ica_detail.ica01
                                LEFT JOIN bej_tb bej_detail ON meb06=bej_detail.bej01
                            WHERE 1=1 
                                AND meaconf='Y'
                                AND mea00='2'
                           ";
                dtMaster           = BoMaster.OfGetDataTable(string.Concat(sqlBody, strWhere), sqlParmList.ToArray());
                dtMaster.TableName = "Master";

                if (dtMaster == null || dtMaster.Rows.Count == 0)
                {
                    WfShowErrorMsg("查無資料,請重新過濾條件!");
                    return(false);
                }

                masterList = dtMaster.ToList <Master>();
                foreach (Master masterModel in masterList)
                {
                    masterModel.mea22_str = string.Format("{0:N" + masterModel.bej03_main + "}", masterModel.mea22);   //主件數量
                    masterModel.meb05_str = string.Format("{0:N" + masterModel.bej03_detail + "}", masterModel.meb05); //子件數量

                    var bekModel = BoBas.OfGetBekModel(masterModel.mea10);
                    masterModel.mea13_str  = string.Format("{0:N" + bekModel.bek03 + "}", masterModel.mea13);
                    masterModel.mea14_str  = string.Format("{0:N" + bekModel.bek04 + "}", masterModel.mea14);
                    masterModel.mea14t_str = string.Format("{0:N" + bekModel.bek04 + "}", masterModel.mea14t);
                }

                pReport.RegData(dtMaster);
                pReport.RegData("Master", masterList);
                pReport.CacheAllData = true;
                //處理排序
                StiDataBand stiDataBand1 = (StiDataBand)pReport.GetComponents()["DataBand1"];
                switch (manr210Model.order_by)
                {
                case "1":    //1.依託工日期
                    stiDataBand1.Sort = new string[] { "ASC", "mea02" };
                    break;

                case "2":    //2.依廠商
                    stiDataBand1.Sort = new string[] { "ASC", "mea03" };
                    break;
                }
                //處理跳頁
                StiGroupFooterBand grouperBand1 = (StiGroupFooterBand)pReport.GetComponents()["GroupFooterBand1"];
                if (manr210Model.jump_yn.ToUpper() == "Y")
                {
                    grouperBand1.NewPageAfter    = true;
                    grouperBand1.ResetPageNumber = true;
                }
                else
                {
                    grouperBand1.NewPageAfter    = false;
                    grouperBand1.ResetPageNumber = false;
                }

                pReport.Compile();
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 11
0
        protected override bool WfExecReport(Stimulsoft.Report.StiReport pReport)
        {
            //DataSet ds;
            vw_stpr410       stpr410Model;
            StringBuilder    sbSql = null;
            string           sqlBody = "";
            DataTable        dtSgaTb, dtShaTb;
            List <QueryInfo> queryInfoList;
            QueryInfo        queryModel;
            string           strQueryRange, strWhere;
            StringBuilder    sbQuerySingle = null;

            List <SqlParameter> sqlParmList;
            List <MasterA>      resultList = null;

            try
            {
                stpr410Model = DrMaster.ToItem <vw_stpr410>();
                resultList   = new List <MasterA>();
                #region 處理銷售
                if (stpr410Model.sale_type == "0" || stpr410Model.sale_type == "1")
                {
                    queryInfoList = new List <QueryInfo>();
                    #region range 處理
                    if (!GlobalFn.varIsNull(stpr410Model.sga03))
                    {
                        queryModel            = new QueryInfo();
                        queryModel.TableName  = "sga_tb";
                        queryModel.ColumnName = "sga03";
                        queryModel.ColumnType = TabMaster.DtSource.Columns["sga03"].DataType.Name;
                        queryModel.Value      = stpr410Model.sga03;
                        queryInfoList.Add(queryModel);
                    }
                    if (!GlobalFn.varIsNull(stpr410Model.sga04))
                    {
                        queryModel            = new QueryInfo();
                        queryModel.TableName  = "sga_tb";
                        queryModel.ColumnName = "sga04";
                        queryModel.ColumnType = TabMaster.DtSource.Columns["sga04"].DataType.Name;
                        queryModel.Value      = stpr410Model.sga04;
                        queryInfoList.Add(queryModel);
                    }
                    if (!GlobalFn.varIsNull(stpr410Model.sga05))
                    {
                        queryModel            = new QueryInfo();
                        queryModel.TableName  = "sga_tb";
                        queryModel.ColumnName = "sga05";
                        queryModel.ColumnType = TabMaster.DtSource.Columns["sga05"].DataType.Name;
                        queryModel.Value      = stpr410Model.sga05;
                        queryInfoList.Add(queryModel);
                    }
                    sqlParmList   = new List <SqlParameter>();
                    strQueryRange = BoMaster.WfGetQueryString(queryInfoList, out sqlParmList);
                    #endregion

                    #region single 處理
                    sbQuerySingle = new StringBuilder();
                    if (!GlobalFn.varIsNull(stpr410Model.sga02_s))
                    {
                        sbQuerySingle.AppendLine("AND sga02>=@sga02_s");
                        sqlParmList.Add(new SqlParameter("@sga02_s", stpr410Model.sga02_s));
                    }
                    if (!GlobalFn.varIsNull(stpr410Model.sga02_e))
                    {
                        sbQuerySingle.AppendLine("AND sga02<=@sga02_e");
                        sqlParmList.Add(new SqlParameter("@sga02_e", stpr410Model.sga02_e));
                    }

                    if (stpr410Model.confirm_type == "1")
                    {
                        sbQuerySingle.AppendLine("AND sgaconf ='Y'");
                    }
                    else if (stpr410Model.confirm_type == "2")
                    {
                        sbQuerySingle.AppendLine("AND ISNULL(sgaconf,'') <>'Y'");
                    }
                    #endregion

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

                    //取得單頭
                    sqlBody = @"
                              SELECT 
                                '銷貨' AS sale_type,
                                sga01,sga02,sga03,sca03 as sga03_c ,
                                sgb02,sga04,bec02 AS sga04_c,sga05,beb03 AS sga05_c,
                                sga10,sga21,
                                sgb03,sgb04,sgb05,'' as sgb05_str,sgb06,
                                bej03,
                                0.0 as price,'' as price_string,
                                sgb10,'' as sgb10_string,
                                sgb10t,'' as sgb10t_string,
                                sgb16
                              FROM sga_tb
                                    LEFT JOIN sgb_tb ON sga01=sgb01
                                    LEFT JOIN sca_tb ON sga03=sca01
                                    LEFT JOIN bec_tb ON sga04=bec01
                                    LEFT JOIN beb_tb ON sga05=beb01
                                    LEFT JOIN bej_tb ON sgb06=bej01
                              WHERE  sgb01 IS NOT NULL
                                ";

                    dtSgaTb           = BoMaster.OfGetDataTable(string.Concat(sqlBody, strWhere), sqlParmList.ToArray());
                    dtSgaTb.TableName = "Master";
                    if (dtSgaTb != null)
                    {
                        resultList.AddRange(dtSgaTb.ToList <YR.ERP.DAL.YRModel.Reports.Stp.Stpr410.MasterA>());
                    }
                }
                #endregion

                #region 處理退貨/折讓
                if (stpr410Model.sale_type == "0" || stpr410Model.sale_type == "2")
                {
                    queryInfoList = new List <QueryInfo>();
                    #region range 處理
                    if (!GlobalFn.varIsNull(stpr410Model.sga03))
                    {
                        queryModel            = new QueryInfo();
                        queryModel.TableName  = "sha_tb";
                        queryModel.ColumnName = "sha03";
                        queryModel.ColumnType = TabMaster.DtSource.Columns["sga03"].DataType.Name;
                        queryModel.Value      = stpr410Model.sga03;
                        queryInfoList.Add(queryModel);
                    }
                    if (!GlobalFn.varIsNull(stpr410Model.sga04))
                    {
                        queryModel            = new QueryInfo();
                        queryModel.TableName  = "sha_tb";
                        queryModel.ColumnName = "sha04";
                        queryModel.ColumnType = TabMaster.DtSource.Columns["sga04"].DataType.Name;
                        queryModel.Value      = stpr410Model.sga04;
                        queryInfoList.Add(queryModel);
                    }
                    if (!GlobalFn.varIsNull(stpr410Model.sga05))
                    {
                        queryModel            = new QueryInfo();
                        queryModel.TableName  = "sha_tb";
                        queryModel.ColumnName = "sha05";
                        queryModel.ColumnType = TabMaster.DtSource.Columns["sga05"].DataType.Name;
                        queryModel.Value      = stpr410Model.sga05;
                        queryInfoList.Add(queryModel);
                    }
                    sqlParmList   = new List <SqlParameter>();
                    strQueryRange = BoMaster.WfGetQueryString(queryInfoList, out sqlParmList);
                    #endregion

                    #region single 處理
                    sbQuerySingle = new StringBuilder();
                    if (!GlobalFn.varIsNull(stpr410Model.sga02_s))
                    {
                        sbQuerySingle.AppendLine("AND sha02>=@sha02_s");
                        sqlParmList.Add(new SqlParameter("@sha02_s", stpr410Model.sga02_s));
                    }
                    if (!GlobalFn.varIsNull(stpr410Model.sga02_e))
                    {
                        sbQuerySingle.AppendLine("AND sha02<=@sha02_e");
                        sqlParmList.Add(new SqlParameter("@sha02_e", stpr410Model.sga02_e));
                    }

                    if (stpr410Model.confirm_type == "1")
                    {
                        sbQuerySingle.AppendLine("AND shaconf ='Y'");
                    }
                    else if (stpr410Model.confirm_type == "2")
                    {
                        sbQuerySingle.AppendLine("AND ISNULL(shaconf,'') <>'Y'");
                    }
                    #endregion

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

                    //取得單頭
                    sqlBody = @"
                              SELECT 
                                CASE WHEN shb17='1' THEN '銷退' ELSE '折讓' END AS sale_type,
                                sha01 AS sga01,sha02 AS sga02,sha03 AS sga03,sca03 as sga03_c ,
                                shb02 AS sgb02,sha04 AS sga04,bec02 AS sga04_c,sha05 AS sga05,beb03 AS sga05_c,
                                sha10 AS sga10,shb19 AS sga21,
                                shb03 AS sgb03,shb04 AS sgb04,shb05 AS sgb05,'' as sgb05_str,shb06 AS sgb06,
                                bej03,
                                0.0 as price,'' as price_string,
                                -1*shb10 AS sgb10,'' as sgb10_string,
                                -1*shb10t AS sgb10t,'' as sgb10t_string,
                                shb16 AS sgb16
                              FROM sha_tb
                                    LEFT JOIN shb_tb ON sha01=shb01
                                    LEFT JOIN sca_tb ON sha03=sca01
                                    LEFT JOIN bec_tb ON sha04=bec01
                                    LEFT JOIN beb_tb ON sha05=beb01
                                    LEFT JOIN bej_tb ON shb06=bej01
                              WHERE  shb01 IS NOT NULL
                                ";

                    dtSgaTb           = BoMaster.OfGetDataTable(string.Concat(sqlBody, strWhere), sqlParmList.ToArray());
                    dtSgaTb.TableName = "Master";
                    if (dtSgaTb != null)
                    {
                        resultList.AddRange(dtSgaTb.ToList <YR.ERP.DAL.YRModel.Reports.Stp.Stpr410.MasterA>());
                    }
                }
                #endregion

                if (resultList == null || resultList.Count == 0)
                {
                    WfShowErrorMsg("查無資料,請重新過濾條件!");
                    return(false);
                }

                foreach (MasterA masterModel in resultList)
                {
                    var bekModel = BoBas.OfGetBekModel(masterModel.sga10);
                    //處理單價
                    if (masterModel.sgb05 > 0)
                    {
                        masterModel.price = Math.Round((masterModel.sgb10 / masterModel.sgb05), Convert.ToInt16(bekModel.bek03), MidpointRounding.AwayFromZero);
                    }
                    else
                    {
                        masterModel.price = masterModel.sgb10;
                    }

                    masterModel.price_string  = string.Format("{0:N" + bekModel.bek03 + "}", masterModel.price);
                    masterModel.sgb10_string  = string.Format("{0:N" + bekModel.bek04 + "}", masterModel.sgb10);
                    masterModel.sgb10t_string = string.Format("{0:N" + bekModel.bek04 + "}", masterModel.sgb10t);
                    //數量處理
                    masterModel.sgb05_str = string.Format("{0:N" + masterModel.bej03 + "}", masterModel.sgb05);//數量
                }

                pReport.RegData("master", resultList);
                pReport.CacheAllData = true;
                //處理排序--這裡利用group來達到

                StiGroupHeaderBand stiGroupHeaderBand1 = (StiGroupHeaderBand)pReport.GetComponents()["GroupHeaderBand1"];
                StiDataBand        StiDataBand1        = (StiDataBand)pReport.GetComponents()["DataBand1"];
                switch (stpr410Model.order_by)
                {
                case "1":    //1.依出庫日期
                    stiGroupHeaderBand1.Condition.Value = "{Master.sga02}";
                    StiDataBand1.Sort = new string[6] {
                        "ASC",
                        "sga02",
                        "ASC",
                        "sga01",
                        "ASC",
                        "sgb02",
                    };
                    break;

                case "2":    //2.依客戶
                    stiGroupHeaderBand1.Condition.Value = "{Master.sga03}";
                    StiDataBand1.Sort = new string[6] {
                        "ASC",
                        "sga03",
                        "ASC",
                        "sga01",
                        "ASC",
                        "sgb02",
                    };
                    break;

                case "3":    //3.依部門
                    stiGroupHeaderBand1.Condition.Value = "{Master.sga05}";
                    StiDataBand1.Sort = new string[6] {
                        "ASC",
                        "sga05",
                        "ASC",
                        "sga01",
                        "ASC",
                        "sgb02",
                    };
                    break;

                case "4":    //4.依業務
                    stiGroupHeaderBand1.Condition.Value = "{Master.sga04}";
                    StiDataBand1.Sort = new string[6] {
                        "ASC",
                        "sga04",
                        "ASC",
                        "sga01",
                        "ASC",
                        "sgb02",
                    };
                    break;
                }
                //處理跳頁
                StiGroupFooterBand footerBand1 = (StiGroupFooterBand)pReport.GetComponents()["GroupFooterBand1"];
                if (stpr410Model.jump_yn.ToUpper() == "Y")
                {
                    footerBand1.NewPageAfter    = true;
                    footerBand1.ResetPageNumber = true;
                }
                else
                {
                    footerBand1.NewPageAfter    = false;
                    footerBand1.ResetPageNumber = false;
                }

                pReport.Compile();
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 12
0
        protected override bool WfExecReport(Stimulsoft.Report.StiReport pReport)
        {
            //DataSet ds;
            vw_invr520       invr520Model;
            StringBuilder    sbSql   = null;
            string           sqlBody = "";
            DataTable        dtIlaTb;
            List <QueryInfo> queryInfoList;
            QueryInfo        queryModel;
            string           strQueryRange, strWhere, strOrderBy;
            StringBuilder    sbQuerySingle = null;

            List <SqlParameter> sqlParmList;
            List <Master>       resultList = null;

            try
            {
                invr520Model  = DrMaster.ToItem <vw_invr520>();
                resultList    = new List <Master>();
                queryInfoList = new List <QueryInfo>();
                #region range 處理
                if (!GlobalFn.varIsNull(invr520Model.ipa01))
                {
                    queryModel            = new QueryInfo();
                    queryModel.TableName  = "ipa_tb";
                    queryModel.ColumnName = "ipa01";
                    queryModel.ColumnType = TabMaster.DtSource.Columns["ipa01"].DataType.Name;
                    queryModel.Value      = invr520Model.ipa01;
                    queryInfoList.Add(queryModel);
                }
                if (!GlobalFn.varIsNull(invr520Model.ipacreu))
                {
                    queryModel            = new QueryInfo();
                    queryModel.TableName  = "ipa_tb";
                    queryModel.ColumnName = "ipacreu";
                    queryModel.ColumnType = TabMaster.DtSource.Columns["ipacreu"].DataType.Name;
                    queryModel.Value      = invr520Model.ipacreu;
                    queryInfoList.Add(queryModel);
                }
                if (!GlobalFn.varIsNull(invr520Model.ipacreg))
                {
                    queryModel            = new QueryInfo();
                    queryModel.TableName  = "ipa_tb";
                    queryModel.ColumnName = "ipacreg";
                    queryModel.ColumnType = TabMaster.DtSource.Columns["ipacreg"].DataType.Name;
                    queryModel.Value      = invr520Model.ipacreg;
                    queryInfoList.Add(queryModel);
                }
                sqlParmList   = new List <SqlParameter>();
                strQueryRange = BoMaster.WfGetQueryString(queryInfoList, out sqlParmList);
                #endregion

                #region single 處理
                sbQuerySingle = new StringBuilder();
                if (!GlobalFn.varIsNull(invr520Model.ipa03_s))
                {
                    sbQuerySingle.AppendLine("AND ipa03>=@ipa03_s");
                    sqlParmList.Add(new SqlParameter("@ila02_s", invr520Model.ipa03_s));
                }
                if (!GlobalFn.varIsNull(invr520Model.ipa03_e))
                {
                    sbQuerySingle.AppendLine("AND ipa03<=@ipa03_e");
                    sqlParmList.Add(new SqlParameter("@ipa03_e", invr520Model.ipa03_e));
                }
                #endregion

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

                //取得單頭
                sqlBody           = @"
                              SELECT 
                                ipa01,ipa02,ipa03,ipa04,ipa05,
                                ipa06,ipa07,ipa08,
                                ipb02,ipb03,ipb04,ipb05,
                                ipb06,ipb07,
                                ica02,ica03
                              FROM ipa_tb
                                    LEFT JOIN ipb_tb ON ipa01=ipb01
                                    LEFT JOIN ica_tb ON ipb03=ica01
                              WHERE 1=1
                                ";
                strOrderBy        = " ORDER BY ipa01,ipb02";
                dtIlaTb           = BoMaster.OfGetDataTable(string.Concat(sqlBody, strWhere, strOrderBy), sqlParmList.ToArray());
                dtIlaTb.TableName = "Master";
                if (dtIlaTb != null)
                {
                    resultList.AddRange(dtIlaTb.ToList <Master>());
                }

                if (resultList == null || resultList.Count == 0)
                {
                    WfShowErrorMsg("查無資料,請重新過濾條件!");
                    return(false);
                }

                //foreach (Master masterModel in resultList)
                //{
                //    //數量處理
                //    masterModel.ilb05_str = string.Format("{0:N" + masterModel.bej03 + "}", masterModel.ilb05);//數量
                //    masterModel.ilb15_str = string.Format("{0:N" + masterModel.bej03 + "}", masterModel.ilb15);//數量
                //}

                pReport.RegData("master", resultList);
                pReport.CacheAllData = true;
                StiGroupFooterBand footerBand1 = (StiGroupFooterBand)pReport.GetComponents()["GroupFooterBand1"];
                footerBand1.NewPageAfter    = true;
                footerBand1.ResetPageNumber = true;
                pReport.Compile();
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 13
0
        protected override bool WfExecReport(Stimulsoft.Report.StiReport pReport)
        {
            //DataSet ds;
            vw_stpr501 stpr501Model;
            //StringBuilder sbSql = null;
            string           sqlBody;
            string           sqlOrderBy = "";
            DataTable        dtSeaTb;
            List <QueryInfo> queryInfoList;
            QueryInfo        queryModel;
            string           strQueryRange, strWhere;
            StringBuilder    sbQuerySingle = null;

            List <SqlParameter> sqlParmList;

            try
            {
                if (Vw_Stpr501 != null) //他窗引用時
                {
                    stpr501Model = Vw_Stpr501;
                }
                else
                {
                    stpr501Model = DrMaster.ToItem <vw_stpr501>();
                }

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

                #region single 處理
                sbQuerySingle = new StringBuilder();
                if (!GlobalFn.varIsNull(stpr501Model.sha02_s))
                {
                    sbQuerySingle.AppendLine("AND sha02>=@sha02_s");
                    sqlParmList.Add(new SqlParameter("@sha02_s", stpr501Model.sha02_s));
                }
                if (!GlobalFn.varIsNull(stpr501Model.sha02_e))
                {
                    sbQuerySingle.AppendLine("AND sha02<=@sha02_e");
                    sqlParmList.Add(new SqlParameter("@sha02_e", stpr501Model.sha02_e));
                }
                #endregion

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

                sqlBody = @"SELECT
                                sha01,sha02,sha03,sca02 as sha03_c,
                                sha06,sha09,
                                sha13,sha13t,sha13g,
                                '' as sha13_str,'' as sha13t_str,'' as sha13g_str,
                                bea01,bea03,bea04,bea05,bea06,
                                sca12,sca17,
                                bek03,bek04,
                                shb02,shb03,shb04,shb05,
                                shb09,shb10,shb10t,
                                shb17,shb19,shb20,
                                bej03,
                                '' as shb05_str,
                                '' as shb09_str,'' as shb10_str,'' as shb10g_str
                            FROM sha_tb 
                                LEFT JOIN shb_tb ON sha01=shb01
                                LEFT JOIN sca_tb ON sha03=sca01
                                LEFT JOIN baa_tb ON 1=1
                                LEFT JOIN bab_tb ON substring(sha01,1,baa06)=bab01
                                LEFT JOIN bea_tb ON beacomp=shacomp
                                LEFT JOIN bek_tb ON sha10=bek01
                                LEFT JOIN bej_tb ON shb06=bej01
                            WHERE 1=1    
                                AND shaconf='Y'
                            ";
                //處理排序
                switch (stpr501Model.order_by)
                {
                case "1":    //1.依出貨日期
                    sqlOrderBy = " ORDER BY sha02";
                    break;

                case "2":    //2.依客戶
                    sqlOrderBy = " ORDER BY sha03";
                    break;
                }

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

                if (dtSeaTb == null || dtSeaTb.Rows.Count == 0)
                {
                    WfShowErrorMsg("查無資料,請重新過濾條件!");
                    return(false);
                }
                var MasterList = dtSeaTb.ToList <YR.ERP.DAL.YRModel.Reports.Stp.Stpr501.Master>();
                foreach (YR.ERP.DAL.YRModel.Reports.Stp.Stpr501.Master masterModel in MasterList)
                {
                    //處理單頭金額
                    masterModel.sha13_str  = string.Format("{0:N" + masterModel.bek04 + "}", masterModel.sha13);
                    masterModel.sha13t_str = string.Format("{0:N" + masterModel.bek04 + "}", masterModel.sha13t);
                    masterModel.sha13g_str = string.Format("{0:N" + masterModel.bek04 + "}", masterModel.sha13g);
                    if (masterModel.shb17 == "1")
                    {
                        masterModel.shb05_str = string.Format("{0:N" + masterModel.bej03 + "}", masterModel.shb05); //數量
                        masterModel.shb09_str = string.Format("{0:N" + masterModel.bek03 + "}", masterModel.shb09); //單價
                    }
                    else//折讓
                    {
                        masterModel.shb05_str = "";
                        masterModel.shb09_str = "";
                    }
                    masterModel.shb10_str  = string.Format("{0:N" + masterModel.bek03 + "}", masterModel.shb10);                      //未稅
                    masterModel.shb10g_str = string.Format("{0:N" + masterModel.bek03 + "}", masterModel.shb10t - masterModel.shb10); //稅額
                }


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

                //pReport.Compile();
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 14
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;
            }
        }