/// <summary>
        /// 打印甘肃报表
        /// </summary>
        private void PrintGS()
        {
            Global.GSType = string.Empty;
            clsReportGS record;

            try
            {
                if (dataGridGS.SelectedItems.Count > 0)
                {
                    record = (clsReportGS)dataGridGS.SelectedItems[0];
                    clsReportGS report = null;
                    if (record != null)
                    {
                        report                       = new clsReportGS();
                        report.Title                 = record.Title;
                        report.FoodName              = record.FoodName;
                        report.FoodType              = record.FoodType;
                        report.ProductionDate        = record.ProductionDate;
                        report.CheckedCompanyName    = record.CheckedCompanyName;
                        report.CheckedCompanyAddress = record.CheckedCompanyAddress;
                        report.CheckedCompanyPhone   = record.CheckedCompanyPhone;
                        report.LabelProducerName     = record.LabelProducerName;
                        report.LabelProducerAddress  = record.LabelProducerAddress;
                        report.LabelProducerPhone    = record.LabelProducerPhone;
                        report.SamplingData          = record.SamplingData;
                        report.SamplingPerson        = record.SamplingPerson;
                        report.SampleNum             = record.SampleNum;
                        report.SamplingBase          = record.SamplingBase;
                        report.SamplingAddress       = record.SamplingAddress;
                        report.SamplingOrderCode     = record.SamplingOrderCode;
                        report.Standard              = record.Standard;
                        report.InspectionConclusion  = record.InspectionConclusion;
                        report.Notes                 = record.Notes;
                        report.Surveyor              = record.Surveyor;

                        //根据主表ID查询子表样品信息集合
                        DataTable dt = _resultTable.GetReportDetailGS(record.ID);
                        if (dt != null && dt.Rows.Count > 0)
                        {
                            List <clsReportGSDetail> ItemNames = (List <clsReportGSDetail>)IListDataSet.DataTableToIList <clsReportGSDetail>(dt, 1);
                            for (int i = 0; i < ItemNames.Count; i++)
                            {
                                clsReportGS.ReportDetail reportDetail = new clsReportGS.ReportDetail();
                                reportDetail.ProjectName        = ItemNames[i].ProjectName;
                                reportDetail.Unit               = ItemNames[i].Unit;
                                reportDetail.InspectionStandard = ItemNames[i].InspectionStandard;
                                reportDetail.IndividualResults  = ItemNames[i].IndividualResults;
                                reportDetail.IndividualDecision = ItemNames[i].IndividualDecision;
                                report.reportDetailList.Add(reportDetail);
                            }
                        }
                    }
                    //甘肃打印模板
                    PrintPreviewWindow print = new PrintPreviewWindow("xaml\\Print\\PrintModel\\GSDocument.xaml", report, new OrderDocumentRenderer());
                    print._resultGS     = record;
                    print.Owner         = this;
                    print.ShowInTaskbar = false;
                    print.ShowDialog();
                }
                else
                {
                    MessageBox.Show("请选择打印条目!", "操作提示");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("异常(Print):\n" + ex.Message);
            }
        }
        /// <summary>
        /// 打印原始报表
        /// </summary>
        private void Print()
        {
            clsReport record;

            try
            {
                if (DataGridRecord.SelectedItems.Count > 0)
                {
                    record = (clsReport)DataGridRecord.SelectedItems[0];
                    ReportClass report = null;
                    if (record != null)
                    {
                        report                        = new ReportClass();
                        report.r_Title                = record.Title;
                        report.r_CheckUnitName        = record.CheckUnitName;
                        report.r_Trademark            = record.Trademark;
                        report.r_Specifications       = record.Specifications;
                        report.r_ProductionDate       = record.ProductionDate;
                        report.r_QualityGrade         = record.QualityGrade;
                        report.r_CheckedCompanyName   = record.CheckedCompanyName;
                        report.r_CheckedCompanyPhone  = record.CheckedCompanyPhone;
                        report.r_ProductionUnitsName  = record.ProductionUnitsName;
                        report.r_ProductionUnitsPhone = record.ProductionUnitsPhone;
                        report.r_TaskSource           = record.TaskSource;
                        report.r_Standard             = record.Standard;
                        report.r_SamplingData         = record.SamplingData;
                        report.r_SampleNum            = record.SampleNum;
                        report.r_SamplingCode         = record.SamplingCode;
                        report.r_SampleArrivalData    = record.SampleArrivalData;
                        report.r_Note                 = record.Notes;

                        //根据主表ID查询子表样品信息集合
                        DataTable dt = _resultTable.GetReportDetail(record.ID);
                        if (dt != null && dt.Rows.Count > 0)
                        {
                            List <clsReportDetail> ItemNames = (List <clsReportDetail>)IListDataSet.DataTableToIList <clsReportDetail>(dt, 1);
                            for (int i = 0; i < ItemNames.Count; i++)
                            {
                                ReportClass.ReportDetail reportDetail = new ReportClass.ReportDetail();
                                reportDetail.FoodName    = ItemNames[i].FoodName;
                                reportDetail.ProjectName = ItemNames[i].ProjectName;
                                reportDetail.Unit        = ItemNames[i].Unit;
                                reportDetail.CheckData   = ItemNames[i].CheckData;
                                report.r_reportList.Add(reportDetail);
                            }
                        }
                    }
                    //原始打印模板
                    PrintPreviewWindow print = new PrintPreviewWindow("xaml\\Print\\PrintModel\\OrderDocument.xaml", report, new OrderDocumentRenderer());
                    print._result       = record;
                    print.Owner         = this;
                    print.ShowInTaskbar = false;
                    print.ShowDialog();
                }
                else
                {
                    MessageBox.Show("请选择打印条目!", "操作提示");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("异常(Print):\n" + ex.Message);
            }
        }
        /// <summary>
        /// 打印甘肃回执
        /// </summary>
        private void PrintGSHZ()
        {
            Global.GSType = "HZ";
            clsReportGS record;

            try
            {
                if (dataGridGS.SelectedItems.Count > 0)
                {
                    IDictionary <string, string> dicItems  = new Dictionary <string, string>();
                    IDictionary <string, string> dicSample = new Dictionary <string, string>();
                    record = (clsReportGS)dataGridGS.SelectedItems[0];
                    clsReportGS report = null;
                    if (record != null)
                    {
                        report                       = new clsReportGS();
                        report.Title                 = record.Title;
                        report.FoodName              = record.FoodName;
                        report.FoodType              = record.FoodType;
                        report.ProductionDate        = record.ProductionDate;
                        report.CheckedCompanyName    = record.CheckedCompanyName == null ? "______" : record.CheckedCompanyName;
                        report.CheckedCompanyAddress = record.CheckedCompanyAddress == null ? "______" : record.CheckedCompanyAddress;
                        report.CheckedCompanyPhone   = record.CheckedCompanyPhone;
                        report.LabelProducerName     = record.LabelProducerName;
                        report.LabelProducerAddress  = record.LabelProducerAddress == null ? "______" : record.LabelProducerAddress;
                        report.LabelProducerPhone    = record.LabelProducerPhone;
                        if (record.SamplingData != null)
                        {
                            report.SamplingData = record.SamplingData == null ? "____年__月__日" : record.SamplingData;
                            string   str = record.SamplingData;
                            string[] s   = str.Split(new char[] { '-' });
                            report.SamplingData = s[0] + "年" + s[1] + "月" + s[2] + "日";
                        }
                        else
                        {
                            report.SamplingData = "____年__月__日";
                        }
                        report.SamplingPerson       = record.SamplingPerson;
                        report.SampleNum            = record.SampleNum;
                        report.SamplingBase         = record.SamplingBase;
                        report.SamplingAddress      = record.SamplingAddress;
                        report.SamplingOrderCode    = record.SamplingOrderCode;
                        report.Standard             = record.Standard;
                        report.InspectionConclusion = record.InspectionConclusion;
                        report.Notes     = record.Notes;
                        report.Surveyor  = record.Surveyor;
                        report.ItemsList = report.UnqualifiedItemsList = report.SampleList = string.Empty;
                        //根据主表ID查询子表样品信息集合
                        DataTable dt = _resultTable.GetReportDetailGS(record.ID);
                        if (dt != null && dt.Rows.Count > 0)
                        {
                            List <clsReportGSDetail> ItemNames = (List <clsReportGSDetail>)IListDataSet.DataTableToIList <clsReportGSDetail>(dt, 1);
                            for (int i = 0; i < ItemNames.Count; i++)
                            {
                                clsReportGS.ReportDetail reportDetail = new clsReportGS.ReportDetail();
                                reportDetail.ProjectName        = ItemNames[i].ProjectName;
                                reportDetail.Unit               = ItemNames[i].Unit;
                                reportDetail.InspectionStandard = ItemNames[i].InspectionStandard;
                                reportDetail.IndividualResults  = ItemNames[i].IndividualResults;
                                reportDetail.IndividualDecision = ItemNames[i].IndividualDecision;
                                report.reportDetailList.Add(reportDetail);
                                if (!dicItems.ContainsKey(ItemNames[i].ProjectName))
                                {
                                    if (i + 1 < ItemNames.Count)
                                    {
                                        report.ItemsList += ItemNames[i].ProjectName + ",";
                                    }
                                    else
                                    {
                                        report.ItemsList += ItemNames[i].ProjectName;
                                    }
                                    dicItems.Add(ItemNames[i].ProjectName, ItemNames[i].ProjectName);
                                }
                                if (!dicSample.ContainsKey(ItemNames[i].ProjectName))
                                {
                                    if (ItemNames[i].IndividualDecision.Equals("不合格"))
                                    {
                                        if (i + 1 < ItemNames.Count)
                                        {
                                            report.UnqualifiedItemsList += ItemNames[i].ProjectName + ",";
                                        }
                                        else
                                        {
                                            report.UnqualifiedItemsList += ItemNames[i].ProjectName;
                                        }
                                        dicSample.Add(ItemNames[i].ProjectName, ItemNames[i].ProjectName);
                                    }
                                }
                            }
                            if (report.UnqualifiedItemsList.Equals(string.Empty))
                            {
                                report.UnqualifiedItemsList = "____________________";
                            }
                            if (report.ItemsList.Equals(string.Empty))
                            {
                                report.ItemsList = "____________________";
                            }
                        }
                    }
                    //甘肃打印回执
                    PrintPreviewWindow print = new PrintPreviewWindow("xaml\\Print\\PrintModel\\GSHZDocument.xaml", report, new OrderDocumentRenderer());
                    print._resultGS     = record;
                    print.Owner         = this;
                    print.ShowInTaskbar = false;
                    print.ShowDialog();
                }
                else
                {
                    MessageBox.Show("请选择打印条目!", "操作提示");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("异常(Print):\n" + ex.Message);
            }
        }