Beispiel #1
0
        public FrmMain(string _rptName, string _rptPath, string _ConnStr, string _SqlStr)
        {
            InitializeComponent();

            this.rptName = _rptName;
            this.rptPath = _rptPath;
            this.ConnStr = _ConnStr;
            this.SqlStr  = _SqlStr;

            Report.InsertDetailGrid();
            Report.DetailGrid.Recordset.ConnectionString = ConnStr; //"Provider=IBMDADB2.1;Password=db2inst2;Persist Security Info=True;User ID=db2inst2;Data Source=HIS;Location=192.168.10.60:50000;Mode=ReadWrite";
            Report.DetailGrid.Recordset.QuerySQL         = SqlStr;  //"select * from base_user";
            Report.SaveToFile(rptPath + rptName + ".grf");
            this.axGRDesigner1.Report = Report;
        }
Beispiel #2
0
        private void FrmReportDesign_Load(object sender, EventArgs e)
        {
            if (!Directory.Exists(System.Windows.Forms.Application.StartupPath + "\\report"))
            {
                Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath + "\\report");
            }
            if (!File.Exists(fileName))
            {
                Report.SaveToFile(fileName);
                Report.InsertReportHeader( );
                Report.InsertDetailGrid( );
                Report.InsertReportFooter();
                foreach (DataRow dr in dtColumns.Rows)
                {
                    string title_name = dr["TITLE_NAME"].ToString();
                    Report.DetailGrid.AddColumn(title_name, title_name, title_name, 2);
                    Report.DetailGrid.Recordset.AddField(title_name, GRFieldType.grftString);
                }

                Report.AddParameter("报表标题", GRParameterDataType.grptString);
                Report.AddParameter("统计时间", GRParameterDataType.grptString);
                Report.AddParameter("制表人", GRParameterDataType.grptString);
                Report.AddParameter("备注", GRParameterDataType.grptString);

                Report.SaveToFile(fileName);
            }
            lblInfo.Text = "报表保存在:" + fileName;
        }
Beispiel #3
0
        private void CreateReportTemplate(ReportInfo info, DataTable printTable)
        {
            GridppReport Report = new GridppReport();

            Report.InsertReportHeader();
            Report.InsertDetailGrid();
            foreach (DataColumn col in printTable.Columns)
            {
                GRFieldType grFieldType = ConvertToGRFieldType(col.DataType);

                Report.DetailGrid.Recordset.AddField(col.ColumnName, grFieldType);
                IGRColumn c = Report.DetailGrid.Columns.Add();
                c.Name                  = col.ColumnName;
                c.TitleCell.Text        = col.ColumnName;
                c.ContentCell.DataField = col.ColumnName;
            }
            if (info.ReportParameters != null)
            {
                for (int i = 0; i < info.ReportParameters.Length; i++)
                {
                    if (Report.Parameters.IndexByName(info.ReportParameters[i].Text) < 0)
                    {
                        IGRParameter p = Report.Parameters.Add();
                        p.Name     = info.ReportParameters[i].Text;
                        p.DataType = GRParameterDataType.grptString;
                    }
                }
            }
            Report.SaveToFile(info.TemplateFile);
        }
 private void toolStripButton3_Click(object sender, EventArgs e)
 {
     Report = null;
     Report.InsertDetailGrid();
     Report.DetailGrid.Recordset.ConnectionString = ConnStr;
     Report.DetailGrid.Recordset.QuerySQL         = SqlStr;
     this.axGRDesigner1.Report = Report;
 }
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            axGRDisplayViewer1.Stop();

            BaseReportTitle reportTitle = (BaseReportTitle)treeView1.SelectedNode.Tag;

            tPrintTable = (DataTable)InvokeController("ExecReportResult", reportTitle.TitleId, GetReportParamsValue());

            string Reportname = reportTitle.RptFileName.Trim() + ".grf";

            if (!System.IO.File.Exists(EFWCoreLib.CoreFrame.Init.AppGlobal.AppRootPath + @"Report\" + Reportname))
            {
                Report = new GridppReport();
                Report.InsertReportHeader();
                Report.InsertDetailGrid();
                Report.InsertReportFooter();
                Report.DetailGrid.IsCrossTab = true;

                IGRRecordset RecordSet = Report.DetailGrid.Recordset;
                foreach (DataColumn col in tPrintTable.Columns)
                {
                    if (col.DataType == typeof(Int32))
                    {
                        RecordSet.AddField(col.ColumnName, GRFieldType.grftInteger);
                    }
                    else if (col.DataType == typeof(Decimal) || col.DataType == typeof(Double))
                    {
                        RecordSet.AddField(col.ColumnName, GRFieldType.grftFloat);
                    }
                    else
                    {
                        RecordSet.AddField(col.ColumnName, GRFieldType.grftString);
                    }
                }

                Report.AddParameter("报表名称", GRParameterDataType.grptString);
                Report.AddParameter("打印时间", GRParameterDataType.grptString);
                Report.AddParameter("当前科室", GRParameterDataType.grptString);
                Report.AddParameter("当前人员", GRParameterDataType.grptString);
                Report.DetailGrid.IsCrossTab = false;
                Report.SaveToFile(EFWCoreLib.CoreFrame.Init.AppGlobal.AppRootPath + @"Report\" + Reportname);
            }


            Report = new GridppReport();
            Report.LoadFromFile(EFWCoreLib.CoreFrame.Init.AppGlobal.AppRootPath + @"Report\" + Reportname);

            Report.ParameterByName("报表名称").AsString = reportTitle.Name;
            Report.ParameterByName("打印时间").AsString = System.DateTime.Now.ToString();
            Report.ParameterByName("当前科室").AsString = "";
            Report.ParameterByName("当前人员").AsString = "";
            Report.FetchRecord       += new _IGridppReportEvents_FetchRecordEventHandler(reportPrinter_FetchRecord);
            axGRDisplayViewer1.Report = Report;
            axGRDisplayViewer1.Start();
        }
Beispiel #6
0
        private void UpdateReportTemplate(ReportInfo info, DataTable printTable)
        {
            if (!this.checkBox1.Checked)
            {
                return;
            }

            GridppReport Report   = new GridppReport();
            bool         bChanged = false;

            Report.LoadFromFile(ri.TemplateFile);
            if (ri.ReportParameters != null)
            {
                for (int i = 0; i < ri.ReportParameters.Length; i++)
                {
                    if (Report.Parameters.IndexByName(ri.ReportParameters[i].Text) < 0)
                    {
                        IGRParameter p = Report.Parameters.Add();
                        p.Name     = ri.ReportParameters[i].Text;
                        p.DataType = GRParameterDataType.grptString;
                        bChanged   = true;
                    }
                }
            }
            if (printTable != null)
            {
                if (Report.DetailGrid == null)
                {
                    Report.InsertDetailGrid();
                }

                foreach (DataColumn dtcol in printTable.Columns)
                {
                    GRFieldType grFieldType = ConvertToGRFieldType(dtcol.DataType);
                    if (Report.DetailGrid.Recordset.Fields.IndexByName(dtcol.ColumnName) < 0)
                    {
                        Report.DetailGrid.Recordset.AddField(dtcol.ColumnName, grFieldType);
                        IGRColumn c = Report.DetailGrid.Columns.Add();
                        c.Name                  = dtcol.ColumnName;
                        c.TitleCell.Text        = dtcol.ColumnName;
                        c.ContentCell.DataField = dtcol.ColumnName;
                        bChanged                = true;
                    }
                }
            }

            if (bChanged)
            {
                Report.SaveToFile(ri.TemplateFile);
            }
        }
Beispiel #7
0
        /// <summary>
        /// 创建报表文件
        /// </summary>
        /// <param name="ReportName">报表名</param>
        /// <param name="Columns">列信息</param>
        /// <returns></returns>
        private bool CreateReportFile(string ReportName, DataTable Columns)
        {
            try
            {
                GridppReport gridReport = new GridppReport();
                DataTable    dtColumns  = Columns;
                string       reportName = ReportName;
                string       fileName   = System.Windows.Forms.Application.StartupPath + "\\report\\" + reportName + ".grf";
                if (System.IO.File.Exists(fileName))
                {
                    if (MessageBox.Show("该报表已经存在是否重新设置?", "询问", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.OK)
                    {
                        System.IO.File.Delete(fileName);
                    }
                    else
                    {
                        return(false);
                    }
                }
                if (!Directory.Exists(System.Windows.Forms.Application.StartupPath + "\\report"))
                {
                    Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath + "\\report");
                }
                if (!File.Exists(fileName))
                {
                    gridReport.SaveToFile(fileName);
                    gridReport.InsertReportHeader();
                    gridReport.InsertDetailGrid();
                    gridReport.InsertReportFooter();
                    foreach (DataColumn dc in dtColumns.Columns)
                    {
                        string title_name = dc.ColumnName;
                        gridReport.DetailGrid.AddColumn(title_name, title_name, title_name, 2);
                        gridReport.DetailGrid.Recordset.AddField(title_name, GRFieldType.grftString);
                    }
                    gridReport.AddParameter("医院名称", GRParameterDataType.grptString);
                    gridReport.AddParameter("报表标题", GRParameterDataType.grptString);
                    gridReport.AddParameter("统计时间", GRParameterDataType.grptString);
                    gridReport.AddParameter("制表人", GRParameterDataType.grptString);
                    gridReport.AddParameter("备注", GRParameterDataType.grptString);

                    gridReport.SaveToFile(fileName);
                }
                return(true);
            }
            catch (Exception err)
            {
                return(false);
            }
        }
        /// <summary>
        /// 创建住院预交金个人交款表模板
        /// </summary>
        public static void CreateChargeAccountBookTemplate()
        {
            try
            {
                GridppReport reportPrinter = new GridppReport();

                if (!Directory.Exists(System.Windows.Forms.Application.StartupPath + "\\report"))
                {
                    Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath + "\\report");
                }

                if (File.Exists(accountbookTemplatePath))
                {
                    File.Delete(accountbookTemplatePath);
                }

                if (!File.Exists(accountbookTemplatePath))
                {
                    reportPrinter.InsertReportHeader();
                    reportPrinter.InsertDetailGrid();
                    reportPrinter.InsertReportFooter();


                    System.Reflection.PropertyInfo[] propertyinfos = typeof(AbstractChargeAccountRpt).GetProperties();
                    for (int i = 0; i < propertyinfos.Length; i++)
                    {
                        if (propertyinfos[i].PropertyType == typeof(String))
                        {
                            reportPrinter.AddParameter(propertyinfos[i].Name, GRParameterDataType.grptString);
                        }
                    }

                    System.Reflection.PropertyInfo[] propertyinfos1 = typeof(ZY_ChargeList).GetProperties();
                    for (int i = 0; i < propertyinfos1.Length; i++)
                    {
                        reportPrinter.DetailGrid.Recordset.AddField(propertyinfos1[i].Name, GRFieldType.grftString);
                    }

                    reportPrinter.SaveToFile(accountbookTemplatePath);
                }
            }
            catch
            {
                MessageBox.Show("创建住院个人预交金交款表模板发生错误!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
        /// <summary>
        /// 创建报表文件
        /// </summary>
        /// <param name="ReportName">报表名</param>
        /// <param name="Columns">列信息</param>
        /// <param name="filePath">文件路径</param>
        /// <returns></returns>
        private bool CreateReportFile(string ReportName, DataTable Columns, out string filePath)
        {
            filePath = "";
            try
            {
                GridppReport gridReport = new GridppReport();
                DataTable    dtColumns  = Columns;
                string       reportName = ReportName;
                string       fileName   = System.Windows.Forms.Application.StartupPath + "\\report\\" + reportName + ".grf";
                if (System.IO.File.Exists(fileName))
                {
                    System.IO.File.Delete(fileName);
                }

                if (!Directory.Exists(System.Windows.Forms.Application.StartupPath + "\\report"))
                {
                    Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath + "\\report");
                }
                if (!File.Exists(fileName))
                {
                    gridReport.SaveToFile(fileName);
                    gridReport.InsertReportHeader();
                    gridReport.InsertDetailGrid();
                    gridReport.InsertReportFooter();
                    foreach (DataRow dr in dtColumns.Rows)
                    {
                        string title_name = dr["TITLE_NAME"].ToString();
                        gridReport.DetailGrid.AddColumn(title_name, title_name, title_name, 2);
                        gridReport.DetailGrid.Recordset.AddField(title_name, GRFieldType.grftString);
                    }
                    gridReport.AddParameter("医院名称", GRParameterDataType.grptString);
                    gridReport.AddParameter("报表标题", GRParameterDataType.grptString);
                    gridReport.AddParameter("统计时间", GRParameterDataType.grptString);
                    gridReport.AddParameter("制表人", GRParameterDataType.grptString);
                    gridReport.AddParameter("备注", GRParameterDataType.grptString);

                    gridReport.SaveToFile(fileName);
                }
                filePath = fileName;
                return(true);
            }
            catch (Exception err)
            {
                return(false);
            }
        }
Beispiel #10
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (Pub.MessageBoxShowQuestion(Pub.GetResText(formCode, "Msg001", "")))
            {
                return;
            }
            bool          IsOk   = true;
            GridppReport  Report = new GridppReport();
            IGRMemoBox    memoBox;
            IGRStaticBox  staticBox;
            IGRGroup      group = null;
            GRFieldType   ft;
            IGRField      grField;
            IGRColumn     grCol;
            IGRFieldBox   fieldBox;
            IGRSummaryBox sumBox;
            GRSummaryFun  grSum;
            string        groupField     = "";
            string        fn             = "";
            string        fnEx           = "";
            string        fr             = "";
            string        FirstFieldName = "";
            bool          IsFirstField   = true;
            int           l         = 0;
            byte          DateFlag  = 0;
            string        DateField = "";

            if (radioButton3.Checked && (cbbTime2.SelectedIndex >= 0))
            {
                DateFlag  = 1;
                DateField = ((TCommonType)cbbTime2.Items[cbbTime2.SelectedIndex]).id;
            }
            else if (radioButton2.Checked && (cbbTime1.SelectedIndex >= 0))
            {
                DateFlag  = 2;
                DateField = ((TCommonType)cbbTime1.Items[cbbTime1.SelectedIndex]).id;
            }
            else if (radioButton4.Checked && (cbbTime3.SelectedIndex >= 0))
            {
                DateFlag  = 3;
                DateField = ((TCommonType)cbbTime3.Items[cbbTime3.SelectedIndex]).id;
            }
            try
            {
                Report.Clear();
                Report.Font.Point           = 9;
                Report.Printer.LeftMargin   = 0.5;
                Report.Printer.TopMargin    = 0.5;
                Report.Printer.RightMargin  = 0.5;
                Report.Printer.BottomMargin = 0.5;
                //页眉
                Report.InsertPageHeader();
                Report.PageHeader.Height = 0.8;
                staticBox           = Report.PageHeader.Controls.Add(GRControlType.grctStaticBox).AsStaticBox;
                staticBox.Dock      = GRDockStyle.grdsLeft;
                staticBox.Name      = "StaticBoxCommany";
                staticBox.TextAlign = GRTextAlign.grtaBottomLeft;
                staticBox.Width     = 9;
                memoBox             = Report.PageHeader.Controls.Add(GRControlType.grctMemoBox).AsMemoBox;
                memoBox.Dock        = GRDockStyle.grdsRight;
                memoBox.Text        = "[#SystemVar(CurrentDateTime)#] [#SystemVar(PageNumber)#]/[#SystemVar(PageCount)#]";
                memoBox.TextAlign   = GRTextAlign.grtaBottomRight;
                memoBox.Width       = 9;
                //页尾
                Report.InsertReportFooter();
                Report.get_ReportFooter(1).Height = 0;
                //报表头
                Report.InsertReportHeader();
                Report.get_ReportHeader(1).Height       = 0.8;
                Report.get_ReportHeader(1).RepeatOnPage = true;
                IGRLine line = Report.get_ReportHeader(1).Controls.Add(GRControlType.grctLine).AsLine;
                line.Dock            = GRDockStyle.grdsTop;
                staticBox            = Report.get_ReportHeader(1).Controls.Add(GRControlType.grctStaticBox).AsStaticBox;
                staticBox.Name       = "MainTitleBox";
                staticBox.Center     = GRCenterStyle.grcsHorizontal;
                staticBox.ForeColor  = Pub.ColorToOleColor(Color.Red);
                staticBox.TextAlign  = GRTextAlign.grtaBottomCenter;
                staticBox.Font.Bold  = true;
                staticBox.Font.Point = 16;
                staticBox.Text       = SelectReportName;
                staticBox.Height     = 0.71;
                staticBox.Dock       = GRDockStyle.grdsTop;
                staticBox            = Report.get_ReportHeader(1).Controls.Add(GRControlType.grctStaticBox).AsStaticBox;
                if (DateField != "")
                {
                    Report.get_ReportHeader(1).Height = 1.4;
                    staticBox.Name       = "StaticBoxDate";
                    staticBox.Center     = GRCenterStyle.grcsHorizontal;
                    staticBox.TextAlign  = GRTextAlign.grtaMiddleCenter;
                    staticBox.Font.Point = 9;
                    staticBox.Text       = SelectReportName;
                    staticBox.Height     = 0.5;
                    staticBox.Dock       = GRDockStyle.grdsBottom;
                }
                //明细网格
                Report.InsertDetailGrid();
                Report.DetailGrid.BorderColor             = Pub.ColorToOleColor(Color.FromArgb(192, 192, 192));
                Report.DetailGrid.ColLineColor            = Pub.ColorToOleColor(Color.FromArgb(192, 192, 192));
                Report.DetailGrid.RowLineColor            = Pub.ColorToOleColor(Color.FromArgb(192, 192, 192));
                Report.DetailGrid.ColumnTitle.Height      = 0.61;
                Report.DetailGrid.ColumnContent.Height    = 0.61;
                Report.DetailGrid.ColumnTitle.RepeatStyle = GRRepeatStyle.grrsOnPage;
                //分组
                if (GetGridCount(gpGrid) > 0)
                {
                    group = Report.DetailGrid.Groups.Add();
                    group.Header.Height = 0.61;
                    for (int i = 0; i < gpGrid.RowCount; i++)
                    {
                        if ((bool)gpGrid[0, i].EditedFormattedValue)
                        {
                            fn = gpGrid[2, i].Value.ToString();
                            if (fn == "")
                            {
                                fn = gpGrid[1, i].Value.ToString();
                            }
                            groupField = groupField + fn + ";";
                        }
                    }
                    groupField = groupField.Substring(0, groupField.Length - 1);
                }
                for (int i = 0; i < fdGrid.RowCount; i++)
                {
                    if ((bool)fdGrid[0, i].EditedFormattedValue)
                    {
                        fn = fdGrid[1, i].Value.ToString();
                        fr = "";
                        switch (fdGrid[3, i].Value.ToString().ToLower())
                        {
                        case "string":
                            ft = GRFieldType.grftString;
                            break;

                        case "datetime":
                            ft = GRFieldType.grftDateTime;
                            break;

                        case "byte":
                            ft = GRFieldType.grftInteger;
                            fr = "0;;#";
                            break;

                        case "double":
                            ft = GRFieldType.grftCurrency;
                            fr = "¥#,##0.00";
                            break;

                        default:
                            ft = GRFieldType.grftString;
                            break;
                        }
                        grField        = Report.DetailGrid.Recordset.AddField(fn, ft);
                        grField.Format = fr;
                        fnEx           = fdGrid[2, i].Value.ToString();
                        if (fnEx == "")
                        {
                            fnEx = fn;
                        }
                        grField.Name        = fnEx;
                        grField.DBFieldName = fn;
                        string tmp = groupField + ";";
                        if (tmp.IndexOf(fnEx + ";") == -1)
                        {
                            grCol = Report.DetailGrid.AddColumn(fnEx, fn, fnEx, 2);
                            grCol.TitleCell.Text      = fnEx;
                            grCol.TitleCell.BackColor = Pub.ColorToOleColor(Color.FromArgb(128, 255, 128));
                            grCol.TitleCell.TextAlign = GRTextAlign.grtaMiddleCenter;
                            if (IsFirstField)
                            {
                                FirstFieldName = fnEx;
                                IsFirstField   = false;
                            }
                        }
                    }
                }
                //分组
                if ((groupField != "") && (group != null))
                {
                    group.ByFields = groupField;
                    l = 0;
                    for (int i = 0; i < gpGrid.RowCount; i++)
                    {
                        if ((bool)gpGrid[0, i].EditedFormattedValue)
                        {
                            fn = gpGrid[2, i].Value.ToString();
                            if (fn == "")
                            {
                                fn = gpGrid[1, i].Value.ToString();
                            }
                            fieldBox           = group.Header.Controls.Add(GRControlType.grctFieldBox).AsFieldBox;
                            fieldBox.DataField = fn;
                            fieldBox.Left      = l;
                            fieldBox.Top       = 0;
                            fieldBox.Width     = 2;
                            fieldBox.Height    = 0.61;
                            fieldBox.ForeColor = Pub.ColorToOleColor(Color.FromArgb(0, 0, 128));
                            l += 2;
                        }
                    }
                }
                //合计
                if (GetGridCount(smGrid) > 0)
                {
                    Report.get_ReportFooter(1).Height = 0.61;
                    staticBox             = Report.get_ReportFooter(1).Controls.Add(GRControlType.grctStaticBox).AsStaticBox;
                    staticBox.Name        = "StaticBoxSum";
                    staticBox.Text        = Pub.GetResText(formCode, staticBox.Name, "");
                    staticBox.Font.Bold   = true;
                    staticBox.BorderColor = Pub.ColorToOleColor(Color.FromArgb(192, 192, 192));
                    staticBox.Left        = 0;
                    staticBox.Height      = 0.61;
                    staticBox.AlignColumn = FirstFieldName;
                    staticBox.Width       = 2;
                    if (groupField != "")
                    {
                        group.Footer.Height   = 0.61;
                        staticBox             = group.Footer.Controls.Add(GRControlType.grctStaticBox).AsStaticBox;
                        staticBox.Name        = "StaticBoxSumMin";
                        staticBox.Text        = Pub.GetResText(formCode, staticBox.Name, "");
                        staticBox.Font.Bold   = true;
                        staticBox.BorderColor = Pub.ColorToOleColor(Color.FromArgb(192, 192, 192));
                        staticBox.Left        = 0;
                        staticBox.Height      = 0.61;
                        staticBox.AlignColumn = FirstFieldName;
                        staticBox.Width       = 2;
                    }
                    for (int i = 0; i < smGrid.RowCount; i++)
                    {
                        if ((bool)smGrid[0, i].EditedFormattedValue)
                        {
                            fn = smGrid[2, i].Value.ToString();
                            if (fn == "")
                            {
                                fn = smGrid[1, i].Value.ToString();
                            }
                            sumBox = Report.get_ReportFooter(1).Controls.Add(GRControlType.grctSummaryBox).AsSummaryBox;
                            switch (smGrid[3, i].Value.ToString().ToLower())
                            {
                            case "byte":
                            case "double":
                                grSum = GRSummaryFun.grsfSum;
                                break;

                            default:
                                grSum = GRSummaryFun.grsfCount;
                                break;
                            }
                            sumBox.SummaryFun  = grSum;
                            sumBox.DataField   = fn;
                            sumBox.AlignColumn = fn;
                            if (groupField != "")
                            {
                                sumBox             = group.Footer.Controls.Add(GRControlType.grctSummaryBox).AsSummaryBox;
                                sumBox.SummaryFun  = grSum;
                                sumBox.DataField   = fn;
                                sumBox.AlignColumn = fn;
                            }
                        }
                    }
                }
                string OrderFields = "";
                for (int i = 0; i < orGrid.RowCount; i++)
                {
                    if ((bool)orGrid[0, i].EditedFormattedValue)
                    {
                        OrderFields = OrderFields + orGrid[1, i].Value.ToString() + ",";
                    }
                }
                if (OrderFields != "")
                {
                    OrderFields = OrderFields.Substring(0, OrderFields.Length - 1);
                }
                string sql = Pub.GetSQL(DBCode.DB_000001, new string[] { "603", ReportTable, SelectReportName,
                                                                         SelectTableName, OrderFields, DateFlag.ToString(), DateField });
                db.ExecSQL(sql);
                string reportData = Report.SaveToStr();
                db.UpdateTextData(Pub.GetSQL(DBCode.DB_000001, new string[] { "303", ReportTable,
                                                                              SelectReportName }), "ReportData", reportData);
                ReportName = SelectReportName;
            }
            catch (Exception E)
            {
                IsOk = false;
                Pub.ShowErrorMsg(E);
            }
            if (!IsOk)
            {
                return;
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Beispiel #11
0
        private void DefineDetailGrid()
        {
            Report.InsertDetailGrid();
            Report.DetailGrid.ColumnTitle.Height = 0.98;//标题行高度
            // Report.DetailGrid.ColumnTitle.TitleCells[3].WordWrap = true;

            Report.DetailGrid.ColumnContent.Height = 0.58;//内容行高度



            Report.DetailGrid.ColumnContent.AlternatingBackColor = 230 * 256 * 256 + 217 * 256 + 217; //内容行交替背景色
            Report.DetailGrid.ColumnTitle.BackColor = 217 * 256 * 256 + 217 * 256 + 217;              //标题行背景色

            //定义数据集的各个字段
            IGRRecordset RecordSet = Report.DetailGrid.Recordset;

            RecordSet.AddField("单据日期", GRFieldType.grftString).Format  = "#,##0.00";
            RecordSet.AddField("仓库编号", GRFieldType.grftString).Format  = "#,##0.00";
            RecordSet.AddField("物料类型", GRFieldType.grftString).Format  = "#,##0.00";
            RecordSet.AddField("单据名称", GRFieldType.grftString).Format  = "#,##0.00";
            RecordSet.AddField("单据编号", GRFieldType.grftString).Format  = "#,##0.00";
            RecordSet.AddField("发票号", GRFieldType.grftString).Format   = "#,##0.00";
            RecordSet.AddField("客户名称", GRFieldType.grftString).Format  = "#,##0.00";
            RecordSet.AddField("数量in", GRFieldType.grftString).Format  = "#,##0.00";
            RecordSet.AddField("成本in", GRFieldType.grftString).Format  = "#,##0.00";
            RecordSet.AddField("数量out", GRFieldType.grftString).Format = "#,##0.00";
            RecordSet.AddField("成本out", GRFieldType.grftString).Format = "#,##0.00";
            RecordSet.AddField("数量sum", GRFieldType.grftString).Format = "#,##0";
            RecordSet.AddField("成本sum", GRFieldType.grftString).Format = "#,##0.00";


            Report.DetailGrid.AddColumn("序号", "序号", "序号", 1.2).ContentCell.TextAlign = GRTextAlign.grtaMiddleCenter;

            Report.DetailGrid.AddColumn("单据日期", "单据日期", "单据日期", 2.1).ContentCell.TextAlign  = GRTextAlign.grtaMiddleLeft;
            Report.DetailGrid.AddColumn("仓库编号", "仓库编号", "仓库编号", 0.9).ContentCell.TextAlign  = GRTextAlign.grtaMiddleLeft;
            Report.DetailGrid.AddColumn("物料类型", "物料类型", "物料类型", 0.9).ContentCell.TextAlign  = GRTextAlign.grtaMiddleLeft;
            Report.DetailGrid.AddColumn("单据名称", "单据名称", "单据名称", 2.7).ContentCell.TextAlign  = GRTextAlign.grtaMiddleLeft;
            Report.DetailGrid.AddColumn("单据编号", "单据编号", "单据编号", 3.2).ContentCell.TextAlign  = GRTextAlign.grtaMiddleLeft;
            Report.DetailGrid.AddColumn("发票号", "发票号", "发票号", 2.1).ContentCell.TextAlign     = GRTextAlign.grtaMiddleLeft;
            Report.DetailGrid.AddColumn("客户名称", "客户名称", "客户名称", 7.0).ContentCell.TextAlign  = GRTextAlign.grtaMiddleLeft;
            Report.DetailGrid.AddColumn("数量in", "数量", "数量in", 1.9).ContentCell.TextAlign    = GRTextAlign.grtaBottomRight;
            Report.DetailGrid.AddColumn("成本in", "成本", "成本in", 2.3).ContentCell.TextAlign    = GRTextAlign.grtaBottomRight;
            Report.DetailGrid.AddColumn("数量out", "数量", "数量out", 1.9).ContentCell.TextAlign  = GRTextAlign.grtaBottomRight;
            Report.DetailGrid.AddColumn("成本out", "成本", "成本out", 2.3).ContentCell.TextAlign  = GRTextAlign.grtaBottomRight;
            Report.DetailGrid.AddColumn("数量sum", "数量", "数量sum", 2.28).ContentCell.TextAlign = GRTextAlign.grtaBottomRight;
            Report.DetailGrid.AddColumn("成本sum", "成本", "成本sum", 2.58).ContentCell.TextAlign = GRTextAlign.grtaBottomRight;

            //标题行绕行
            Report.DetailGrid.ColumnTitle.TitleCells[3].WordWrap     = true;
            Report.DetailGrid.ColumnTitle.TitleCells[4].WordWrap     = true;
            Report.DetailGrid.ColumnContent.ContentCells[6].WordWrap = true;

            //定义行号系统变量
            IGRColumn Column = Report.DetailGrid.Columns[1];

            Column.ContentCell.FreeCell = true;
            Column.ContentCell.Controls.RemoveAll();
            IGRSystemVarBox SystemVarBox = Column.ContentCell.Controls.Add(GRControlType.grctSystemVarBox).AsSystemVarBox;

            SystemVarBox.Dock      = GRDockStyle.grdsFill;
            SystemVarBox.SystemVar = GRSystemVarType.grsvRowNo;

            //定义双层表头
            //定义标题组
            IGRColumnTitleCell ColumnTitleCell1 = Report.DetailGrid.AddGroupTitle("收入", "收入");

            ColumnTitleCell1.TextAlign = GRTextAlign.grtaMiddleCenter;
            ColumnTitleCell1.EncloseColumn("数量in");
            ColumnTitleCell1.EncloseColumn("成本in");

            IGRColumnTitleCell ColumnTitleCell2 = Report.DetailGrid.AddGroupTitle("发出", "发出");

            ColumnTitleCell2.TextAlign = GRTextAlign.grtaMiddleCenter;
            ColumnTitleCell2.EncloseColumn("数量out");
            ColumnTitleCell2.EncloseColumn("成本out");

            IGRColumnTitleCell ColumnTitleCell3 = Report.DetailGrid.AddGroupTitle("库存", "库存");

            ColumnTitleCell3.TextAlign = GRTextAlign.grtaMiddleCenter;
            ColumnTitleCell3.EncloseColumn("数量sum");
            ColumnTitleCell3.EncloseColumn("成本sum");

            //定义分组
            IGRGroup Group = Report.DetailGrid.Groups.Add();

            // Group.ByFields = "OrderID";

            //<<定义分组头
            Group.Header.Height = 0.0;

            //<<定义分组尾
            Group.Footer.Height = 0.6;

            //定义分组尾的缺省字体为粗体,其拥有的部件框如没有显示定义字体,则将应用缺省字体
            //Group.Footer.Font.Bold = true;

            IGRStaticBox StaticBox = Group.Header.Controls.Add(GRControlType.grctStaticBox).AsStaticBox;

            StaticBox        = Group.Footer.Controls.Add(GRControlType.grctStaticBox).AsStaticBox;
            StaticBox.Text   = "合计";
            StaticBox.Left   = 0.1;
            StaticBox.Top    = 0.1;
            StaticBox.Width  = 2.59;
            StaticBox.Height = 0.5;

            IGRSummaryBox SummaryBox = Group.Footer.Controls.Add(GRControlType.grctSummaryBox).AsSummaryBox;

            SummaryBox.SummaryFun  = GRSummaryFun.grsfSum;
            SummaryBox.Format      = "#,##0";
            SummaryBox.DataField   = "数量in";
            SummaryBox.AlignColumn = "数量in"; //通过对齐到列确定部件框的左边位置与宽度
            SummaryBox.TextAlign   = GRTextAlign.grtaMiddleRight;
            SummaryBox.Top         = 0.19;
            SummaryBox.Height      = 0.40;

            SummaryBox             = Group.Footer.Controls.Add(GRControlType.grctSummaryBox).AsSummaryBox;
            SummaryBox.SummaryFun  = GRSummaryFun.grsfSum;
            SummaryBox.Format      = "#,##0.00";
            SummaryBox.DataField   = "成本in";
            SummaryBox.AlignColumn = "成本in"; //通过对齐到列确定部件框的左边位置与宽度
            SummaryBox.TextAlign   = GRTextAlign.grtaMiddleRight;
            SummaryBox.Top         = 0.19;
            SummaryBox.Height      = 0.40;

            SummaryBox             = Group.Footer.Controls.Add(GRControlType.grctSummaryBox).AsSummaryBox;
            SummaryBox.SummaryFun  = GRSummaryFun.grsfSum;
            SummaryBox.Format      = "#,##0";
            SummaryBox.DataField   = "数量out";
            SummaryBox.AlignColumn = "数量out"; //通过对齐到列确定部件框的左边位置与宽度
            SummaryBox.TextAlign   = GRTextAlign.grtaMiddleRight;
            SummaryBox.Top         = 0.19;
            SummaryBox.Height      = 0.40;

            SummaryBox             = Group.Footer.Controls.Add(GRControlType.grctSummaryBox).AsSummaryBox;
            SummaryBox.SummaryFun  = GRSummaryFun.grsfSum;
            SummaryBox.Format      = "#,##0.00";
            SummaryBox.DataField   = "成本out";
            SummaryBox.AlignColumn = "成本out"; //通过对齐到列确定部件框的左边位置与宽度
            SummaryBox.TextAlign   = GRTextAlign.grtaMiddleRight;
            SummaryBox.Top         = 0.19;
            SummaryBox.Height      = 0.40;

            SummaryBox             = Group.Footer.Controls.Add(GRControlType.grctSummaryBox).AsSummaryBox;
            SummaryBox.SummaryFun  = GRSummaryFun.grsfSum;
            SummaryBox.Format      = "#,##0";
            SummaryBox.DataField   = "数量sum";
            SummaryBox.AlignColumn = "数量sum"; //通过对齐到列确定部件框的左边位置与宽度
            SummaryBox.TextAlign   = GRTextAlign.grtaMiddleRight;
            SummaryBox.Top         = 0.19;
            SummaryBox.Height      = 0.40;

            SummaryBox             = Group.Footer.Controls.Add(GRControlType.grctSummaryBox).AsSummaryBox;
            SummaryBox.SummaryFun  = GRSummaryFun.grsfSum;
            SummaryBox.Format      = "#,##0.00";
            SummaryBox.DataField   = "成本sum";
            SummaryBox.AlignColumn = "成本sum"; //通过对齐到列确定部件框的左边位置与宽度
            SummaryBox.TextAlign   = GRTextAlign.grtaMiddleRight;
            SummaryBox.Top         = 0.19;
            SummaryBox.Height      = 0.40;
        }
Beispiel #12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnQuery_Click(object sender, EventArgs e)
        {
            if (_currentReport.REPORT_ID <= 0)
            {
                MessageBox.Show("请选择报表", "提示");
                return;
            }
            string Reportname = _currentReport.NAME.Trim() + ".grf";

            if (!System.IO.File.Exists(System.Windows.Forms.Application.StartupPath + "\\report\\newreport\\" + Reportname))
            {
                Report    = new GridppReport();
                Paramlist = _Paramprocess.getParaX(_currentReport.REPORT_ID);
                if (Paramlist == null)
                {
                    return;
                }
                Report.InsertReportHeader();
                Report.InsertDetailGrid();
                Report.InsertReportFooter();
                Report.DetailGrid.IsCrossTab = true;

                IGRRecordset RecordSet = Report.DetailGrid.Recordset;
                foreach (Paramater pp in Paramlist)
                {
                    if (pp.PARAMETER_TYPE == "表头表尾" || pp.PARAMETER_TYPE == "IN")
                    {
                        Report.AddParameter(pp.PARAMETER_CN, GRParameterDataType.grptString);
                    }
                    else if (pp.PARAMETER_TYPE == "明细")
                    {
                        if (pp.PARAMDATATYPE == 1)
                        {
                            RecordSet.AddField(pp.PARAMETER, GRFieldType.grftFloat);
                        }
                        else
                        {
                            RecordSet.AddField(pp.PARAMETER, GRFieldType.grftString);
                        }
                    }
                    else
                    {
                        continue;
                    }
                }
                Report.AddParameter("报表名称", GRParameterDataType.grptString);
                Report.AddParameter("打印时间", GRParameterDataType.grptString);
                Report.AddParameter("当前科室", GRParameterDataType.grptString);
                Report.AddParameter("当前人员", GRParameterDataType.grptString);
                Report.DetailGrid.IsCrossTab = false;
                Report.SaveToFile(System.Windows.Forms.Application.StartupPath + "\\report\\newreport\\" + Reportname);
            }

            FrmQueryControl query = new FrmQueryControl(_Paramprocess.getPara(_currentReport.REPORT_ID), _user.EmployeeID, _dept.DeptID);

            if (paramlistCopy != null && paramlistCopy.Count > 0)
            {
                query.setParamValue(paramlistCopy);
            }
            query.ShowDialog();
            if (!query.isok)
            {
                return;
            }
            Report        = new GridppReport();
            Paramlist     = query.GetParaValue();
            paramlistCopy = Paramlist;
            string filePath = System.Windows.Forms.Application.StartupPath + "\\report\\newreport\\" + Reportname;

            Report.LoadFromFile(filePath);
            foreach (Paramater pp in Paramlist)
            {
                if (pp.PARAMETER_TYPE == "OUT")
                {
                    continue;
                }
                if (pp.PARAMETER_TYPE != "明细")
                {
                    if (pp.objvalueCN != null)
                    {
                        try
                        {
                            Report.ParameterByName(pp.PARAMETER_CN).AsString = pp.objvalueCN.ToString();
                        }
                        catch
                        {
                            Report.AddParameter(pp.PARAMETER_CN, GRParameterDataType.grptString);
                            Report.SaveToFile(System.Windows.Forms.Application.StartupPath + "\\report\\newreport\\" + Reportname);
                        }
                        finally
                        {
                            Report.ParameterByName(pp.PARAMETER_CN).AsString = pp.objvalueCN.ToString();
                        }
                    }
                    else
                    {
                        try
                        {
                            Report.ParameterByName(pp.PARAMETER_CN).AsString = pp.objvalue.ToString();
                        }
                        catch
                        {
                            Report.AddParameter(pp.PARAMETER_CN, GRParameterDataType.grptString);
                            Report.SaveToFile(System.Windows.Forms.Application.StartupPath + "\\report\\newreport\\" + Reportname);
                        }
                        finally
                        {
                            Report.ParameterByName(pp.PARAMETER_CN).AsString = pp.objvalue.ToString();
                        }
                    }
                }
            }

            Report.ParameterByName("报表名称").AsString = HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.WorkName + _currentReport.NAME;
            Report.ParameterByName("打印时间").AsString = System.DateTime.Now.ToString();
            Report.ParameterByName("当前科室").AsString = _currentDeptidname;
            Report.ParameterByName("当前人员").AsString = _user.Name;
            DataTable dataoutPara = _reportProcess.getOutParamter(_currentReport, Paramlist); //获取报表数据

            if (_currentReport.REMARK != null && _currentReport.REMARK.ToString() == "1")     //add by heyan 按统计大类统计报表
            {
                for (int i = 0; i < dataoutPara.Rows.Count; i++)
                {
                    int columndex = 0;
                    try
                    {
                        Report.ParameterByName(dataoutPara.Rows[i][0].ToString()).AsString = dataoutPara.Rows[i][0].ToString();
                        for (columndex = 1; columndex < dataoutPara.Columns.Count; columndex++)
                        {
                            Report.ParameterByName(dataoutPara.Rows[i][0].ToString().Trim() + "_" + columndex).AsString = dataoutPara.Rows[i][columndex].ToString();
                        }
                    }
                    catch
                    {
                        Report.AddParameter(dataoutPara.Rows[i][0].ToString(), GRParameterDataType.grptString);
                        for (columndex = 1; columndex < dataoutPara.Columns.Count; columndex++)
                        {
                            Report.AddParameter(dataoutPara.Rows[i][0].ToString().Trim() + "_" + columndex, GRParameterDataType.grptString);
                        }
                        Report.SaveToFile(System.Windows.Forms.Application.StartupPath + "\\report\\newreport\\" + Reportname);
                    }
                    Report.ParameterByName(dataoutPara.Rows[i][0].ToString()).AsString = dataoutPara.Rows[i][0].ToString();
                    for (columndex = 1; columndex < dataoutPara.Columns.Count; columndex++)
                    {
                        Report.ParameterByName(dataoutPara.Rows[i][0].ToString().Trim() + "_" + columndex).AsString = dataoutPara.Rows[i][columndex].ToString();
                    }
                }

                decimal sum = 0;
                for (int i = 0; i < dataoutPara.Rows.Count; i++)
                {
                    sum += Convert.ToDecimal(HIS.SYSTEM.PubicBaseClasses.XcConvert.IsNull(dataoutPara.Rows[i][1], "0"));
                }
                try
                {
                    Report.ParameterByName("合计金额").AsString = sum.ToString();
                }
                catch
                {
                    Report.AddParameter("合计金额", GRParameterDataType.grptString);
                    Report.SaveToFile(System.Windows.Forms.Application.StartupPath + "\\report\\newreport\\" + Reportname);
                    Report.ParameterByName("合计金额").AsString = sum.ToString();
                }
            }

            else
            {
                try
                {
                    if (Report.DetailGrid.Recordset.Fields.Count == 0)
                    {
                        for (int i = 0; i < dataoutPara.Columns.Count; i++)
                        {
                            Report.DetailGrid.AddColumn(dataoutPara.Columns[i].ColumnName, dataoutPara.Columns[i].ColumnName, dataoutPara.Columns[i].ColumnName, 2);
                            Report.DetailGrid.Recordset.AddField(dataoutPara.Columns[i].ColumnName, GRFieldType.grftString);
                        }
                        Report.SaveToFile(System.Windows.Forms.Application.StartupPath + "\\report\\newreport\\" + Reportname);
                    }
                }
                catch
                { }
            }
            tPrintTable         = dataoutPara;
            Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(reportPrinter_FetchRecord);


            Frmtest foo = new Frmtest();

            foo.AttachReport(Report);
            foo.TopLevel        = false;
            foo.WindowState     = FormWindowState.Maximized;
            foo.FormBorderStyle = FormBorderStyle.None;
            panel12.Controls.Add(foo);
            foo.Dock = DockStyle.Fill;
            foo.Show();
        }
Beispiel #13
0
        private void DefineDetailGrid()
        {
            Report.InsertDetailGrid();
            Report.DetailGrid.ColumnTitle.Height = 0.98;//标题行高度
            // Report.DetailGrid.ColumnTitle.TitleCells[3].WordWrap = true;

            Report.DetailGrid.ColumnContent.Height = 0.58;                                            //内容行高度

            Report.DetailGrid.ColumnContent.AlternatingBackColor = 230 * 256 * 256 + 217 * 256 + 217; //内容行交替背景色
            Report.DetailGrid.ColumnTitle.BackColor = 217 * 256 * 256 + 217 * 256 + 217;              //标题行背景色

            //定义数据集的各个字段
            IGRRecordset RecordSet = Report.DetailGrid.Recordset;

            switch (this.selectedIndex)
            {
            case 0:
                RecordSet.AddField("单据类别", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("单据日期", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("仓库", GRFieldType.grftString).Format   = "#,##0.00";
                RecordSet.AddField("发票编号", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("客户名称", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("商品编号", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("商品名称", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("数量", GRFieldType.grftString).Format   = "#,##0.00";
                RecordSet.AddField("含税金额", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("核销金额", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("核销记录", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("操作员", GRFieldType.grftString).Format  = "#,##0";
                RecordSet.AddField("成本金额", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("凭证号", GRFieldType.grftString).Format  = "#,##0.00";
                RecordSet.AddField("备注", GRFieldType.grftString).Format   = "#,##0";
                RecordSet.AddField("备注1", GRFieldType.grftString).Format  = "#,##0.00";

                Report.DetailGrid.AddColumn("序号", "序号", "序号", 1.2).ContentCell.TextAlign        = GRTextAlign.grtaMiddleCenter;
                Report.DetailGrid.AddColumn("单据类别", "单据类别", "单据类别", 1.2).ContentCell.TextAlign  = GRTextAlign.grtaMiddleCenter;
                Report.DetailGrid.AddColumn("单据日期", "单据日期", "单据日期", 2.1).ContentCell.TextAlign  = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("仓库", "仓库", "仓库", 0.9).ContentCell.TextAlign        = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("发票编号", "发票编号", "发票编号", 0.9).ContentCell.TextAlign  = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("客户名称", "客户名称", "客户名称", 2.7).ContentCell.TextAlign  = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("商品编号", "商品编号", "商品编号", 3.2).ContentCell.TextAlign  = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("商品名称", "商品名称", "商品名称", 2.1).ContentCell.TextAlign  = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("数量", "数量", "数量", 1.9).ContentCell.TextAlign        = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("含税金额", "含税金额", "含税金额", 2.3).ContentCell.TextAlign  = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("核销金额", "核销金额", "核销金额", 1.9).ContentCell.TextAlign  = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("核销记录", "核销记录", "核销记录", 2.3).ContentCell.TextAlign  = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("操作员", "操作员", "操作员", 2.28).ContentCell.TextAlign    = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("成本金额", "成本金额", "成本金额", 2.58).ContentCell.TextAlign = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("凭证号", "凭证号", "凭证号", 2.3).ContentCell.TextAlign     = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("备注", "备注", "备注", 2.28).ContentCell.TextAlign       = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("备注1", "备注1", "备注1", 2.58).ContentCell.TextAlign    = GRTextAlign.grtaBottomRight;

                break;

            case 1:
                RecordSet.AddField("发票编号", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("单据日期", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("客户名称", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("商品编号", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("商品名称", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("数量", GRFieldType.grftString).Format   = "#,##0.00";
                RecordSet.AddField("含税金额", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("核销金额", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("余额", GRFieldType.grftString).Format   = "#,##0";
                RecordSet.AddField("核销日期", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("核销记录", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("凭证号", GRFieldType.grftString).Format  = "#,##0.00";
                RecordSet.AddField("备注", GRFieldType.grftString).Format   = "#,##0";
                RecordSet.AddField("备注1", GRFieldType.grftString).Format  = "#,##0.00";

                Report.DetailGrid.AddColumn("序号", "序号", "序号", 1.2).ContentCell.TextAlign       = GRTextAlign.grtaMiddleCenter;
                Report.DetailGrid.AddColumn("单据日期", "单据日期", "单据日期", 2.1).ContentCell.TextAlign = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("发票编号", "发票编号", "发票编号", 0.9).ContentCell.TextAlign = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("客户名称", "客户名称", "客户名称", 2.7).ContentCell.TextAlign = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("商品编号", "商品编号", "商品编号", 3.2).ContentCell.TextAlign = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("商品名称", "商品名称", "商品名称", 2.1).ContentCell.TextAlign = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("数量", "数量", "数量", 1.9).ContentCell.TextAlign       = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("含税金额", "含税金额", "含税金额", 2.3).ContentCell.TextAlign = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("核销金额", "核销金额", "核销金额", 1.9).ContentCell.TextAlign = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("余额", "余额", "余额", 1.9).ContentCell.TextAlign       = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("核销日期", "核销日期", "核销日期", 1.9).ContentCell.TextAlign = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("核销记录", "核销记录", "核销记录", 2.3).ContentCell.TextAlign = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("凭证号", "凭证号", "凭证号", 2.3).ContentCell.TextAlign    = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("备注", "备注", "备注", 2.28).ContentCell.TextAlign      = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("备注1", "备注1", "备注1", 2.58).ContentCell.TextAlign   = GRTextAlign.grtaBottomRight;

                break;

            case 2:
                RecordSet.AddField("工作年月", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("客户代码", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("客户名称", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("商品名称", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("核销金额", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("现金支票", GRFieldType.grftString).Format = "#,##0";
                RecordSet.AddField("核销记录", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("凭证号", GRFieldType.grftString).Format  = "#,##0.00";
                RecordSet.AddField("备注", GRFieldType.grftString).Format   = "#,##0";
                RecordSet.AddField("备注1", GRFieldType.grftString).Format  = "#,##0.00";

                Report.DetailGrid.AddColumn("序号", "序号", "序号", 1.2).ContentCell.TextAlign       = GRTextAlign.grtaMiddleCenter;
                Report.DetailGrid.AddColumn("工作年月", "工作年月", "工作年月", 2.1).ContentCell.TextAlign = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("客户代码", "客户代码", "客户代码", 0.9).ContentCell.TextAlign = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("客户名称", "客户名称", "客户名称", 2.7).ContentCell.TextAlign = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("商品名称", "商品名称", "商品名称", 2.1).ContentCell.TextAlign = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("核销金额", "核销金额", "核销金额", 1.9).ContentCell.TextAlign = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("现金支票", "现金支票", "现金支票", 1.9).ContentCell.TextAlign = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("核销记录", "核销记录", "核销记录", 2.3).ContentCell.TextAlign = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("凭证号", "凭证号", "凭证号", 2.3).ContentCell.TextAlign    = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("备注", "备注", "备注", 2.28).ContentCell.TextAlign      = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("备注1", "备注1", "备注1", 2.58).ContentCell.TextAlign   = GRTextAlign.grtaBottomRight;

                break;

            case 3:
                RecordSet.AddField("工作年月", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("核销记录", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("客户名称", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("核销金额", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("凭证号", GRFieldType.grftString).Format  = "#,##0.00";
                RecordSet.AddField("备注", GRFieldType.grftString).Format   = "#,##0";
                RecordSet.AddField("备注1", GRFieldType.grftString).Format  = "#,##0.00";

                Report.DetailGrid.AddColumn("序号", "序号", "序号", 1.2).ContentCell.TextAlign       = GRTextAlign.grtaMiddleCenter;
                Report.DetailGrid.AddColumn("工作年月", "工作年月", "工作年月", 2.1).ContentCell.TextAlign = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("核销记录", "核销记录", "核销记录", 2.3).ContentCell.TextAlign = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("客户名称", "客户名称", "客户名称", 2.7).ContentCell.TextAlign = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("核销金额", "核销金额", "核销金额", 1.9).ContentCell.TextAlign = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("凭证号", "凭证号", "凭证号", 2.3).ContentCell.TextAlign    = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("备注", "备注", "备注", 2.28).ContentCell.TextAlign      = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("备注1", "备注1", "备注1", 2.58).ContentCell.TextAlign   = GRTextAlign.grtaBottomRight;

                break;

            case 4:
                RecordSet.AddField("单据类别", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("单据日期", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("仓库", GRFieldType.grftString).Format   = "#,##0.00";
                RecordSet.AddField("发票编号", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("客户名称", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("商品编号", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("商品名称", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("数量", GRFieldType.grftString).Format   = "#,##0.00";
                RecordSet.AddField("含税金额", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("核销金额", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("核销记录", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("操作员", GRFieldType.grftString).Format  = "#,##0";
                RecordSet.AddField("成本金额", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("凭证号", GRFieldType.grftString).Format  = "#,##0.00";
                RecordSet.AddField("备注", GRFieldType.grftString).Format   = "#,##0";
                RecordSet.AddField("备注1", GRFieldType.grftString).Format  = "#,##0.00";

                Report.DetailGrid.AddColumn("序号", "序号", "序号", 1.2).ContentCell.TextAlign        = GRTextAlign.grtaMiddleCenter;
                Report.DetailGrid.AddColumn("单据类别", "单据类别", "单据类别", 1.2).ContentCell.TextAlign  = GRTextAlign.grtaMiddleCenter;
                Report.DetailGrid.AddColumn("单据日期", "单据日期", "单据日期", 2.1).ContentCell.TextAlign  = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("仓库", "仓库", "仓库", 0.9).ContentCell.TextAlign        = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("发票编号", "发票编号", "发票编号", 0.9).ContentCell.TextAlign  = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("客户名称", "客户名称", "客户名称", 2.7).ContentCell.TextAlign  = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("商品编号", "商品编号", "商品编号", 3.2).ContentCell.TextAlign  = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("商品名称", "商品名称", "商品名称", 2.1).ContentCell.TextAlign  = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("数量", "数量", "数量", 1.9).ContentCell.TextAlign        = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("含税金额", "含税金额", "含税金额", 2.3).ContentCell.TextAlign  = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("核销金额", "核销金额", "核销金额", 1.9).ContentCell.TextAlign  = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("核销记录", "核销记录", "核销记录", 2.3).ContentCell.TextAlign  = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("操作员", "操作员", "操作员", 2.28).ContentCell.TextAlign    = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("成本金额", "成本金额", "成本金额", 2.58).ContentCell.TextAlign = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("凭证号", "凭证号", "凭证号", 2.3).ContentCell.TextAlign     = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("备注", "备注", "备注", 2.28).ContentCell.TextAlign       = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("备注1", "备注1", "备注1", 2.58).ContentCell.TextAlign    = GRTextAlign.grtaBottomRight;

                break;

            case 5:
                RecordSet.AddField("发票编号", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("单据日期", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("客户名称", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("商品编号", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("商品名称", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("数量", GRFieldType.grftString).Format   = "#,##0.00";
                RecordSet.AddField("含税金额", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("核销金额", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("余额", GRFieldType.grftString).Format   = "#,##0";
                RecordSet.AddField("核销日期", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("核销记录", GRFieldType.grftString).Format = "#,##0.00";
                RecordSet.AddField("凭证号", GRFieldType.grftString).Format  = "#,##0.00";
                RecordSet.AddField("备注", GRFieldType.grftString).Format   = "#,##0";
                RecordSet.AddField("备注1", GRFieldType.grftString).Format  = "#,##0.00";

                Report.DetailGrid.AddColumn("序号", "序号", "序号", 1.2).ContentCell.TextAlign       = GRTextAlign.grtaMiddleCenter;
                Report.DetailGrid.AddColumn("单据日期", "单据日期", "单据日期", 2.1).ContentCell.TextAlign = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("发票编号", "发票编号", "发票编号", 0.9).ContentCell.TextAlign = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("客户名称", "客户名称", "客户名称", 2.7).ContentCell.TextAlign = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("商品编号", "商品编号", "商品编号", 3.2).ContentCell.TextAlign = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("商品名称", "商品名称", "商品名称", 2.1).ContentCell.TextAlign = GRTextAlign.grtaMiddleLeft;
                Report.DetailGrid.AddColumn("数量", "数量", "数量", 1.9).ContentCell.TextAlign       = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("含税金额", "含税金额", "含税金额", 2.3).ContentCell.TextAlign = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("核销金额", "核销金额", "核销金额", 1.9).ContentCell.TextAlign = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("余额", "余额", "余额", 1.9).ContentCell.TextAlign       = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("核销日期", "核销日期", "核销日期", 1.9).ContentCell.TextAlign = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("核销记录", "核销记录", "核销记录", 2.3).ContentCell.TextAlign = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("凭证号", "凭证号", "凭证号", 2.3).ContentCell.TextAlign    = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("备注", "备注", "备注", 2.28).ContentCell.TextAlign      = GRTextAlign.grtaBottomRight;
                Report.DetailGrid.AddColumn("备注1", "备注1", "备注1", 2.58).ContentCell.TextAlign   = GRTextAlign.grtaBottomRight;

                break;

            default: return;
            }



            //标题行绕行
            Report.DetailGrid.ColumnTitle.TitleCells[3].WordWrap     = true;
            Report.DetailGrid.ColumnTitle.TitleCells[4].WordWrap     = true;
            Report.DetailGrid.ColumnContent.ContentCells[6].WordWrap = true;

            //定义行号系统变量
            IGRColumn Column = Report.DetailGrid.Columns[1];

            Column.ContentCell.FreeCell = true;
            Column.ContentCell.Controls.RemoveAll();
            IGRSystemVarBox SystemVarBox = Column.ContentCell.Controls.Add(GRControlType.grctSystemVarBox).AsSystemVarBox;

            SystemVarBox.Dock      = GRDockStyle.grdsFill;
            SystemVarBox.SystemVar = GRSystemVarType.grsvRowNo;

            //定义分组
            IGRGroup Group = Report.DetailGrid.Groups.Add();

            // Group.ByFields = "OrderID";

            //<<定义分组头
            Group.Header.Height = 0.0;

            //<<定义分组尾
            Group.Footer.Height = 0.6;

            //定义分组尾的缺省字体为粗体,其拥有的部件框如没有显示定义字体,则将应用缺省字体
            //Group.Footer.Font.Bold = true;

            IGRStaticBox StaticBox = Group.Header.Controls.Add(GRControlType.grctStaticBox).AsStaticBox;

            StaticBox        = Group.Footer.Controls.Add(GRControlType.grctStaticBox).AsStaticBox;
            StaticBox.Text   = "合计";
            StaticBox.Left   = 0.1;
            StaticBox.Top    = 0.1;
            StaticBox.Width  = 2.59;
            StaticBox.Height = 0.5;

            IGRSummaryBox SummaryBox = Group.Footer.Controls.Add(GRControlType.grctSummaryBox).AsSummaryBox;

            SummaryBox.SummaryFun  = GRSummaryFun.grsfSum;
            SummaryBox.Format      = "#,##0";
            SummaryBox.DataField   = "数量in";
            SummaryBox.AlignColumn = "数量in"; //通过对齐到列确定部件框的左边位置与宽度
            SummaryBox.TextAlign   = GRTextAlign.grtaMiddleRight;
            SummaryBox.Top         = 0.19;
            SummaryBox.Height      = 0.40;

            SummaryBox             = Group.Footer.Controls.Add(GRControlType.grctSummaryBox).AsSummaryBox;
            SummaryBox.SummaryFun  = GRSummaryFun.grsfSum;
            SummaryBox.Format      = "#,##0.00";
            SummaryBox.DataField   = "成本in";
            SummaryBox.AlignColumn = "成本in"; //通过对齐到列确定部件框的左边位置与宽度
            SummaryBox.TextAlign   = GRTextAlign.grtaMiddleRight;
            SummaryBox.Top         = 0.19;
            SummaryBox.Height      = 0.40;

            SummaryBox             = Group.Footer.Controls.Add(GRControlType.grctSummaryBox).AsSummaryBox;
            SummaryBox.SummaryFun  = GRSummaryFun.grsfSum;
            SummaryBox.Format      = "#,##0";
            SummaryBox.DataField   = "数量out";
            SummaryBox.AlignColumn = "数量out"; //通过对齐到列确定部件框的左边位置与宽度
            SummaryBox.TextAlign   = GRTextAlign.grtaMiddleRight;
            SummaryBox.Top         = 0.19;
            SummaryBox.Height      = 0.40;

            SummaryBox             = Group.Footer.Controls.Add(GRControlType.grctSummaryBox).AsSummaryBox;
            SummaryBox.SummaryFun  = GRSummaryFun.grsfSum;
            SummaryBox.Format      = "#,##0.00";
            SummaryBox.DataField   = "成本out";
            SummaryBox.AlignColumn = "成本out"; //通过对齐到列确定部件框的左边位置与宽度
            SummaryBox.TextAlign   = GRTextAlign.grtaMiddleRight;
            SummaryBox.Top         = 0.19;
            SummaryBox.Height      = 0.40;

            SummaryBox             = Group.Footer.Controls.Add(GRControlType.grctSummaryBox).AsSummaryBox;
            SummaryBox.SummaryFun  = GRSummaryFun.grsfSum;
            SummaryBox.Format      = "#,##0";
            SummaryBox.DataField   = "数量sum";
            SummaryBox.AlignColumn = "数量sum"; //通过对齐到列确定部件框的左边位置与宽度
            SummaryBox.TextAlign   = GRTextAlign.grtaMiddleRight;
            SummaryBox.Top         = 0.19;
            SummaryBox.Height      = 0.40;

            SummaryBox             = Group.Footer.Controls.Add(GRControlType.grctSummaryBox).AsSummaryBox;
            SummaryBox.SummaryFun  = GRSummaryFun.grsfSum;
            SummaryBox.Format      = "#,##0.00";
            SummaryBox.DataField   = "成本sum";
            SummaryBox.AlignColumn = "成本sum"; //通过对齐到列确定部件框的左边位置与宽度
            SummaryBox.TextAlign   = GRTextAlign.grtaMiddleRight;
            SummaryBox.Top         = 0.19;
            SummaryBox.Height      = 0.40;
        }
        private void DefineDetailGrid()
        {
            Report.InsertDetailGrid();
            Report.DetailGrid.ColumnTitle.Height   = 0.68;
            Report.DetailGrid.ColumnContent.Height = 0.58;

            Report.DetailGrid.ColumnContent.AlternatingBackColor = 151 * 256 * 256 + 255 * 256 + 255; //内容行交替色
            Report.DetailGrid.ColumnTitle.BackColor = 217 * 256 * 256 + 217 * 256 + 217;              //标题行颜色

            //定义数据集的各个字段
            IGRRecordset RecordSet = Report.DetailGrid.Recordset;

            //RecordSet.AddField("序号", GRFieldType.grftString);
            RecordSet.AddField("卡片编号", GRFieldType.grftString).Format = "#,##0.00";
            RecordSet.AddField("卡片名称", GRFieldType.grftString).Format = "#,##0.00";
            RecordSet.AddField("仓库", GRFieldType.grftString).Format   = "#,##0.00";
            RecordSet.AddField("类型", GRFieldType.grftString).Format   = "#,##0.00";
            RecordSet.AddField("期初数量", GRFieldType.grftString).Format = "#,##0.00";
            RecordSet.AddField("收入数量", GRFieldType.grftString).Format = "#,##0.00";
            RecordSet.AddField("发出数量", GRFieldType.grftString).Format = "#,##0.00";
            RecordSet.AddField("结存数量", GRFieldType.grftString).Format = "#,##0.00";
            RecordSet.AddField("结存成本", GRFieldType.grftString).Format = "#,##0.00";



            Report.DetailGrid.AddColumn("序号", "序号", "序号", 1.0).ContentCell.TextAlign = GRTextAlign.grtaMiddleCenter;

            Report.DetailGrid.AddColumn("卡片编号", "卡片编号", "卡片编号", 2.3).ContentCell.TextAlign  = GRTextAlign.grtaMiddleLeft;
            Report.DetailGrid.AddColumn("卡片名称", "卡片名称", "卡片名称", 5.4).ContentCell.TextAlign  = GRTextAlign.grtaMiddleLeft;
            Report.DetailGrid.AddColumn("仓库", "仓库", "仓库", 0.9).ContentCell.TextAlign        = GRTextAlign.grtaMiddleLeft;
            Report.DetailGrid.AddColumn("类型", "类型", "类型", 0.9).ContentCell.TextAlign        = GRTextAlign.grtaMiddleLeft;
            Report.DetailGrid.AddColumn("期初数量", "期初数量", "期初数量", 2.2).ContentCell.TextAlign  = GRTextAlign.grtaMiddleRight;
            Report.DetailGrid.AddColumn("收入数量", "收入数量", "收入数量", 2.0).ContentCell.TextAlign  = GRTextAlign.grtaMiddleRight;
            Report.DetailGrid.AddColumn("发出数量", "发出数量", "发出数量", 1.8).ContentCell.TextAlign  = GRTextAlign.grtaMiddleRight;
            Report.DetailGrid.AddColumn("结存数量", "结存数量", "结存数量", 2.38).ContentCell.TextAlign = GRTextAlign.grtaMiddleRight;
            Report.DetailGrid.AddColumn("结存成本", "结存成本", "结存成本", 2.38).ContentCell.TextAlign = GRTextAlign.grtaMiddleRight;

            //定义列(定义明细网格) 后部分为明细显示的位置方法

            IGRColumn Column = Report.DetailGrid.Columns[1];

            Column.ContentCell.FreeCell = true;
            Column.ContentCell.Controls.RemoveAll();
            IGRSystemVarBox SystemVarBox = Column.ContentCell.Controls.Add(GRControlType.grctSystemVarBox).AsSystemVarBox;

            SystemVarBox.Dock      = GRDockStyle.grdsFill;
            SystemVarBox.SystemVar = GRSystemVarType.grsvRowNo;

            //定义分组
            IGRGroup Group = Report.DetailGrid.Groups.Add();

            // Group.ByFields = "OrderID";

            //<<定义分组头
            Group.Header.Height = 0.0;

            //<<定义分组尾
            Group.Footer.Height = 0.6;

            //定义分组尾的缺省字体为粗体,其拥有的部件框如没有显示定义字体,则将应用缺省字体
            Group.Footer.Font.Bold = true;

            IGRStaticBox StaticBox = Group.Header.Controls.Add(GRControlType.grctStaticBox).AsStaticBox;

            StaticBox        = Group.Footer.Controls.Add(GRControlType.grctStaticBox).AsStaticBox;
            StaticBox.Text   = "合计";
            StaticBox.Left   = 0.1;
            StaticBox.Top    = 0.1;
            StaticBox.Width  = 2.59;
            StaticBox.Height = 0.5;

            IGRSummaryBox SummaryBox = Group.Footer.Controls.Add(GRControlType.grctSummaryBox).AsSummaryBox;

            SummaryBox.SummaryFun  = GRSummaryFun.grsfSum;
            SummaryBox.Format      = "#,##0";
            SummaryBox.DataField   = "期初数量";
            SummaryBox.AlignColumn = "期初数量"; //通过对齐到列确定部件框的左边位置与宽度
            SummaryBox.TextAlign   = GRTextAlign.grtaMiddleRight;
            SummaryBox.Top         = 0.19;
            SummaryBox.Height      = 0.40;

            SummaryBox             = Group.Footer.Controls.Add(GRControlType.grctSummaryBox).AsSummaryBox;
            SummaryBox.SummaryFun  = GRSummaryFun.grsfSum;
            SummaryBox.Format      = "#,##0";
            SummaryBox.DataField   = "收入数量";
            SummaryBox.AlignColumn = "收入数量"; //通过对齐到列确定部件框的左边位置与宽度
            SummaryBox.TextAlign   = GRTextAlign.grtaMiddleRight;
            SummaryBox.Top         = 0.19;
            SummaryBox.Height      = 0.40;

            SummaryBox             = Group.Footer.Controls.Add(GRControlType.grctSummaryBox).AsSummaryBox;
            SummaryBox.SummaryFun  = GRSummaryFun.grsfSum;
            SummaryBox.Format      = "#,##0";
            SummaryBox.DataField   = "发出数量";
            SummaryBox.AlignColumn = "发出数量"; //通过对齐到列确定部件框的左边位置与宽度
            SummaryBox.TextAlign   = GRTextAlign.grtaMiddleRight;
            SummaryBox.Top         = 0.19;
            SummaryBox.Height      = 0.40;

            SummaryBox             = Group.Footer.Controls.Add(GRControlType.grctSummaryBox).AsSummaryBox;
            SummaryBox.SummaryFun  = GRSummaryFun.grsfSum;
            SummaryBox.Format      = "#,##0";
            SummaryBox.DataField   = "结存数量";
            SummaryBox.AlignColumn = "结存数量"; //通过对齐到列确定部件框的左边位置与宽度
            SummaryBox.TextAlign   = GRTextAlign.grtaMiddleRight;
            SummaryBox.Top         = 0.19;
            SummaryBox.Height      = 0.40;

            SummaryBox             = Group.Footer.Controls.Add(GRControlType.grctSummaryBox).AsSummaryBox;
            SummaryBox.SummaryFun  = GRSummaryFun.grsfSum;
            SummaryBox.Format      = "#,##0.00";
            SummaryBox.DataField   = "结存成本";
            SummaryBox.AlignColumn = "结存成本"; //通过对齐到列确定部件框的左边位置与宽度
            SummaryBox.TextAlign   = GRTextAlign.grtaMiddleRight;
            SummaryBox.Top         = 0.19;
            SummaryBox.Height      = 0.40;
        }