Пример #1
0
        string ReturnQueryString(int _reportid)
        {
            string qry = "";

            qry = "Select * from MISReport Where ReportId =" + _reportid;
            DataTable ltbl = DbFun.ExecDtblRtrn(qry);

            foreach (DataRow dr in ltbl.Rows)
            {
                mQry         = dr["Qry"].ToString();
                mReportTitle = dr["ReportTitle"].ToString();
                return(mQry);
            }

            return("");
        }
Пример #2
0
        private void FrmReportGrid_Shown(object sender, EventArgs e)
        {
            if (mReportId == 0)
            {
                return;
            }
            DataTable ldts = DbFun.ExecDtblRtrn(ReturnQueryString(mReportId));

            xList.DataSource = ldts;

            xListDetail.BestFitColumns();
            foreach (DataColumn dcols in ldts.Columns)
            {
                string dttype = dcols.DataType.ToString();
                if (dttype == "System.Int32" | dttype == "System.Decimal" | dttype == "System.Double" | dttype == "System.Int16" | dttype == "System.Int64")
                {
                    xListDetail.Columns[dcols.ColumnName].Summary.Add(DevExpress.Data.SummaryItemType.Sum, dcols.ColumnName);
                    //xListDetail.Columns[ (dcols.ColumnName).Summary.Add(DevExpress.Data.SummaryItemType.Sum, dcols.ColumnName);
                    GridGroupSummaryItem item1 = new GridGroupSummaryItem();
                    item1.FieldName   = dcols.ColumnName;
                    item1.SummaryType = DevExpress.Data.SummaryItemType.Sum;
                    //item1.DisplayFormat = "Total {0:c2}"
                    item1.ShowInGroupColumnFooter = xListDetail.Columns[dcols.ColumnName];
                    xListDetail.GroupSummary.Add(item1);
                }
            }

            this.Text = "Report > " + mReportTitle;

            if (System.IO.File.Exists(Application.StartupPath + @"\Layout\" + mReportTitle))
            {
                xList.ForceInitialize();
                xList.MainView.RestoreLayoutFromXml(Application.StartupPath + @"\Layout\" + mReportTitle);
            }
            //PreviewPrintableComponent(xList,xList.LookAndFeel);
        }