Exemplo n.º 1
0
        //public FileStream RptStream { get; set; }

        /// <summary>
        /// 加载报表
        /// </summary>
        /// <param name="RptFileName"></param>
        protected Report LoadReport(string RptFileName)
        {
            //Report rpt = new FastReport.Report();
            //if (RptStream == null)
            //{
            //    RptStream = System.IO.File.OpenRead(RptFileName);
            //}
            //rpt.Load(RptStream);//加载报表模板文件
            //return rpt;

            if (String.IsNullOrWhiteSpace(RptFileName))
            {
                throw new Exception("没有指定报表文件!");
            }

            Report rpt = new FastReport.Report();

            rpt.Load(RptFileName);//加载报表模板文件

            return(rpt);

            //string RptPath = GetFilePath(RptFileName);

            //_Report.Load(RptPath);//加载报表模板文件
        }
Exemplo n.º 2
0
        private void toolPrint_Click(object sender, EventArgs e)
        {
            DataSet   ds      = new DataSet();
            DataTable dtPrint = GetDgvToTable(dgList);

            dtPrint.TableName = "水表情况表";
            ds.Tables.Add(dtPrint);
            FastReport.Report report1 = new FastReport.Report();
            try
            {
                // load the existing report
                report1.Load(Application.StartupPath + @"\PRINTModel\业扩模板\水表库存模板.frx");
                // register the dataset
                report1.RegisterData(ds);
                report1.GetDataSource("水表情况表").Enabled = true;
                report1.Prepare();
                report1.PrintSettings.ShowDialog = false;
                report1.Print();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                // free resources used by report
                report1.Dispose();
            }
        }
Exemplo n.º 3
0
        private static void SetPrintSettings(FastReport.Report report, long lReportTemplateID)
        {
            DataRow   drReport         = null;
            DataTable dtReportTemplate = ReportHelper.GetReportTemplateByID(lReportTemplateID);

            if (dtReportTemplate.Rows.Count > 0)
            {
                drReport = dtReportTemplate.Rows[0];
            }
            //DataTable dtReportTemplate = ExecuteSQL.CallView(105, "", "ReportTemplateID=" + lReportTemplateID, "");
            if (drReport != null)
            {
                //DataRow drReport = dtReportTemplate.Rows[0];
                string strPrinterName    = drReport["PrinterName"].ToString().TrimEnd();
                string strPaperType      = drReport["PaperType"].ToString().TrimEnd();
                int    PaperSizeHeight   = LBConverter.ToInt32(drReport["PaperSizeHeight"]);
                int    PaperSizeWidth    = LBConverter.ToInt32(drReport["PaperSizeWidth"]);
                bool   IsManualPaperType = LBConverter.ToBoolean(drReport["IsManualPaperType"]); //自动识别纸张类型
                bool   IsManualPaperSize = LBConverter.ToBoolean(drReport["IsManualPaperSize"]); //自动识别纸张大小
                bool   IsPaperTransverse = LBConverter.ToBoolean(drReport["IsPaperTransverse"]); //是否纵向打印

                if (strPrinterName != "")
                {
                    report.PrintSettings.Printer = strPrinterName;
                }
            }
        }
Exemplo n.º 4
0
        public void SetPrintReport(FastReport.Report r1)
        {
            if (r1 != null)
            {
                printReport = r1;
            }
            string filter   = "*.frx";
            string FilePath = System.AppDomain.CurrentDomain.BaseDirectory;

            string[] getbarcodepath;
            getbarcodepath = Directory.GetFiles(FilePath, filter);
            if (Directory.GetFiles(FilePath, filter).Length == 0)
            {
                MessageBox.Show("条码文件不存在");
            }
            else
            {
                if (Directory.GetFiles(FilePath, filter).Length > 1)
                {
                    MessageBox.Show("多个条码文件,请点击条码查看选择");
                }
                if (Directory.GetFiles(FilePath, filter).Length == 1)
                {
                    printReport.Load(getbarcodepath[0]);
                }
            }
        }
Exemplo n.º 5
0
 public void SetReport(FastReport.Report fastReport)
 {
     ReportPage page = (ReportPage)fastReport.Pages[0];
     //page.PageHeader
     //page.Bands[0].ChildObjects
     //page.Bands[0].Objects
 }
Exemplo n.º 6
0
        /// <summary>
        /// 更新本地报表以及参数
        /// </summary>
        /// <param name="lReportTemplateID"></param>
        public static void ResetLocalReport(long lReportTemplateID, DataSet dsSource, DataRow drRecord)
        {
            DataTable dtReportTemplateConfig = ReportHelper.GetReportTemplateByID(lReportTemplateID);

            if (dtReportTemplateConfig.Rows.Count == 0)
            {
                return;
            }
            DataRow drReportTemplateConfig = dtReportTemplateConfig.Rows[0];

            byte[]   reportTempleData         = (byte[])drReportTemplateConfig["TemplateData"];
            long     lReportTypeID            = Convert.ToInt64(drReportTemplateConfig["ReportTypeID"]);
            DateTime dtTemplateFileTime       = DateTime.Parse(drReportTemplateConfig["TemplateFileTime"].ToString());
            string   strReportTemplateName    = drReportTemplateConfig["ReportTemplateName"].ToString().Trim();
            string   strReportTemplateNameExt = drReportTemplateConfig["ReportTemplateNameExt"].ToString().Trim();
            //检测本地是否存在报表文件,如果不存在或者与服务器比本地文件新时更新本地文件
            string strFileFullName = WriteReportWithCheck(lReportTemplateID, strReportTemplateName, dtTemplateFileTime, reportTempleData, strReportTemplateNameExt);

            ReportRequestArgs args = new ReportRequestArgs(lReportTemplateID, lReportTypeID, dsSource, drRecord);

            using (FastReport.Report report = new FastReport.Report())
            {
                report.Load(strFileFullName);
                BuildParmsAndData(args, report, enBuildParmsAndDataActionType.ReSet);
                report.Save(strFileFullName);
                File.SetLastWriteTime(strFileFullName, DateTime.Now);
            }
        }
        private void toolPrintPreview_Click(object sender, EventArgs e)
        {
            if (dtWaterMeterList.Rows.Count == 0)
            {
                toolPrint.Enabled        = false;
                toolPrintPreview.Enabled = false;
                return;
            }

            DataSet   ds      = new DataSet();
            DataTable dtPrint = GetDgvToTable(dgList);

            dtPrint.TableName = "收费明细表";
            ds.Tables.Add(dtPrint);
            FastReport.Report report1 = new FastReport.Report();
            try
            {
                // load the existing report
                report1.Load(Application.StartupPath + @"\PRINTModel\收费明细表.frx");
                // register the dataset
                report1.RegisterData(ds);
                report1.GetDataSource("收费明细表").Enabled = true;
                // run the report
                report1.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                // free resources used by report
                report1.Dispose();
            }
        }/// <summary>
Exemplo n.º 8
0
 public CodeService(ReportWindow window)
 {
     this.window       = window;
     this.user_info    = window.user_info;
     this.user_name    = window.user_name;
     this.dic_machine  = window.dic_machine;
     this.process_name = window.process_name;
     this.report       = window.report;
 }
Exemplo n.º 9
0
        private void toolPrint_Click(object sender, EventArgs e)
        {
            if (dtWaterMeterList.Rows.Count == 0)
            {
                toolPrint.Enabled        = false;
                toolPrintPreview.Enabled = false;
                return;
            }

            DataSet   ds           = new DataSet();
            DataTable dtRecordTemp = dtWaterMeterList.Clone();

            dtRecordTemp.Columns["readMeterRecordYearAndMonth"].DataType = typeof(string);
            foreach (DataRow dr in dtWaterMeterList.Rows)
            {
                dtRecordTemp.ImportRow(dr);
            }
            for (int i = 0; i < dtRecordTemp.Rows.Count; i++)
            {
                object obj = dtRecordTemp.Rows[i]["readMeterRecordYearAndMonth"];
                if (Information.IsDate(obj))
                {
                    dtRecordTemp.Rows[i]["readMeterRecordYearAndMonth"] = Convert.ToDateTime(obj).ToString("yyyy-MM");
                }
                //object objWaterMeterNO = dtRecord.Rows[i]["waterMeterNo"];
                //if (objWaterMeterNO != null && objWaterMeterNO != DBNull.Value)
                //    if (objWaterMeterNO.ToString().Length > 7)
                //        dtRecord.Rows[i]["waterMeterNo"] = objWaterMeterNO.ToString().Substring(6, 2);
            }

            DataTable dtPrint = dtRecordTemp.Copy();

            dtPrint.TableName = "收费明细表";
            ds.Tables.Add(dtPrint);
            FastReport.Report report1 = new FastReport.Report();
            try
            {
                // load the existing report
                report1.Load(Application.StartupPath + @"\PRINTModel\实收明细表.frx");
                // register the dataset
                report1.RegisterData(ds);
                report1.GetDataSource("收费明细表").Enabled = true;
                report1.PrintSettings.ShowDialog       = false;
                report1.Prepare();
                report1.Print();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                // free resources used by report
                report1.Dispose();
            }
        }
Exemplo n.º 10
0
 /// <summary>
 /// 默认打印样式
 /// </summary>
 public void LoadDefaultStyle(FastReport.Design.StandardDesigner.DesignerControl designerReport)
 {
     FastReport.Report rep = DefaultReport();
     if (rep == null)
     {
         return;
     }
     designerReport.Report = rep;
     designerReport.RefreshLayout();
 }
Exemplo n.º 11
0
        public void showReport(FastReport.Report _report)
        {
            this.preview.Clear();
            if (null == _report)
            {
                return;
            }

            _report.Preview = this.preview;
            _report.Show();
        }
Exemplo n.º 12
0
 private static DataConnectionBase FindConnection(FastReport.Report report, string name)
 {
     foreach (DataConnectionBase item in report.Dictionary.Connections)
     {
         if (item.Name == name)
         {
             return(item);
         }
     }
     return(null);
 }
Exemplo n.º 13
0
        /// <summary>
        /// 新增报表
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void tsmAddReport_Click(object sender, EventArgs e)
        {
            report = new FastReport.Report();
            RegReportData();
            frmReportDesign rp = new frmReportDesign(report, 0);

            rp.ReportGUID = rpGUID;
            rp.ShowDialog();
            report.Dispose();
            //ClearListData();
            CreateMenu();
        }
Exemplo n.º 14
0
        private void SetReport(FastReport.Report rep, FastReport.Design.StandardDesigner.DesignerControl ctr)
        {
            Action <FastReport.Report> setReportAction = rep0 => { ctr.Report = rep0; ctr.RefreshLayout(); };//Action<T>本身就是delegate类型,省掉了delegate的定义

            if (ctr.InvokeRequired)
            {
                ctr.Invoke(setReportAction, rep);
            }
            else
            {
                setReportAction(rep);
            }
        }
        private void toolPrintPreview_Click(object sender, EventArgs e)
        {
            if (dtWaterMeterList.Rows.Count == 0)
            {
                toolPrint.Enabled        = false;
                toolPrintPreview.Enabled = false;
                return;
            }

            DataSet   ds      = new DataSet();
            DataTable dtPrint = GetDgvToTable(dgList);

            for (int i = 0; i < dtPrint.Rows.Count; i++)
            {
                string strTelNO = "", strPhoneNO = "";
                object objWaterPhone = dtPrint.Rows[i]["waterUserTelphoneNO"];
                if (objWaterPhone != null && objWaterPhone != DBNull.Value)
                {
                    strTelNO = objWaterPhone.ToString();
                }
                objWaterPhone = dtPrint.Rows[i]["waterPhone"];
                if (objWaterPhone != null && objWaterPhone != DBNull.Value)
                {
                    strPhoneNO = objWaterPhone.ToString();
                }
                dtPrint.Rows[i]["waterPhone"] = strTelNO == "" ? strPhoneNO : strTelNO + " " + strPhoneNO;
            }

            dtPrint.TableName = "未抄水表明细表";
            ds.Tables.Add(dtPrint);
            FastReport.Report report1 = new FastReport.Report();
            try
            {
                // load the existing report
                report1.Load(Application.StartupPath + @"\PRINTModel\未抄水表明细表.frx");
                // register the dataset
                report1.RegisterData(ds);
                report1.GetDataSource("未抄水表明细表").Enabled = true;
                // run the report
                report1.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                // free resources used by report
                report1.Dispose();
            }
        }/// <summary>
Exemplo n.º 16
0
        public static FastReport.Report GetReport(ReportRequestArgs e)
        {
            DataTable dtReportTemplateConfig = ReportHelper.GetReportTemplateByID(e.ReportTemplateID);

            if (dtReportTemplateConfig.Rows.Count == 0)
            {
                return(null);
            }
            DataRow drReportTemplateConfig = dtReportTemplateConfig.Rows[0];

            e.ReportTemplateConfig = drReportTemplateConfig;

            long lReportTemplateID = Convert.ToInt64(e.ReportTemplateConfig["ReportTemplateID"]);

            byte[]   reportTempleData         = (byte[])e.ReportTemplateConfig["TemplateData"];
            DateTime dtTemplateFileTime       = DateTime.Parse(e.ReportTemplateConfig["TemplateFileTime"].ToString());
            string   strReportTemplateName    = e.ReportTemplateConfig["ReportTemplateName"].ToString().Trim();
            string   strReportTemplateNameExt = e.ReportTemplateConfig["ReportTemplateNameExt"].ToString().Trim();
            //检测本地是否存在报表文件,如果不存在或者与服务器比本地文件新时更新本地文件
            string strFileFullName = WriteReportWithCheck(lReportTemplateID, strReportTemplateName, dtTemplateFileTime, reportTempleData, strReportTemplateNameExt);

            ProcessStep.AddStep("WriteReportWithCheck_End", DateTime.Now.ToString("MMdd HH:mm:ss ") + DateTime.Now.Millisecond);

            // 加载模板
            FastReport.Report report = null;

            //Form frm = null;
            try
            {
                //frm = new Form();
                report = new FastReport.Report();
                ProcessStep.AddStep("Report_New", DateTime.Now.ToString("MMdd HH:mm:ss ") + DateTime.Now.Millisecond);
                report.FinishReport += Report_FinishReport;
                report.Load(strFileFullName);
                ProcessStep.AddStep("Report_Load", DateTime.Now.ToString("MMdd HH:mm:ss ") + DateTime.Now.Millisecond);
                // 纸张设置
                //SetPaperAuto(report, iReportTemplateID);

                BuildParmsAndData(e, report, enBuildParmsAndDataActionType.SetValue);
                ProcessStep.AddStep("BuildParmsAndData", DateTime.Now.ToString("MMdd HH:mm:ss ") + DateTime.Now.Millisecond);
                //ReportPreviewer previewer = new Report.ReportPreviewer(report);

                SetPrintSettings(report, lReportTemplateID);
                ProcessStep.AddStep("SetPrintSettings", DateTime.Now.ToString("MMdd HH:mm:ss ") + DateTime.Now.Millisecond);
            }
            catch (Exception ex)
            {
            }
            return(report);
        }
Exemplo n.º 17
0
        private void button1_Click(object sender, EventArgs e)
        {
            FastReport.Report report1 = new FastReport.Report();
            try
            {
                // load the existing report
                // report1.Load("E:\\FsFile\\Untitled.frx");
                report1.Load("E:\\FsFile\\Test.frx");
                report1.SetParameterValue("aaa", "adbajdbjadbjadbabdadadad");
                report1.SetParameterValue("bbb", "uiyiyuiyy");
                report1.SetParameterValue("ccc", "1313131313");

                /*
                 * var lableTag = new LableTag();
                 * lableTag.ProdNo = "800-sdashd-a0-0";
                 * lableTag.Qty = "300";
                 * lableTags = new LableTag[] { lableTag };
                 *
                 *
                 *
                 * report1.RegisterData(lableTags, "lableTag");
                 * // report1.RegisterData("456", "two");
                 * //report.RegisterData(cdsPrints, "frCds_Print");
                 *
                 * //找到 DataBind  邦定数据  一定要先注册数据才可以邦定
                 *
                 * //DataBand data = report1.FindObject("Data1") as DataBand;
                 * // data.DataSource = report1.GetDataSource("one");
                 * // register the dataset
                 *
                 * // report1.RegisterData(FDataSet);
                 * // report1.GetDataSource("Items").Enabled = true;
                 * // run the report
                 * // report1.Show();
                 * //进行打印预览
                 */
                report1.Prepare();
                //report1.Variables.Add.Name:=' Yuan';
                report1.ShowPrepared();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                // free resources used by report
                report1.Dispose();
            }
        }
Exemplo n.º 18
0
        private void button2_Click(object sender, EventArgs e)
        {
            FastReport.Report report1 = new FastReport.Report();
            try
            {
                // load the existing report
                // report1.Load("E:\\FsFile\\Untitled.frx");
                report1.Load("E:\\FsFile\\Test.frx");

                /*
                 * //填充参数及对应的值
                 * Type typePrint = typeof(LableTag);
                 * System.Reflection.PropertyInfo[] pros = typePrint.GetProperties();
                 * foreach (System.Reflection.PropertyInfo pro in pros)
                 * {
                 *  object val = pro == null ? ""
                 *      : pro.GetValue(lableTags[0], null) == null ? ""
                 *      : pro.GetValue(lableTags[0], null).ToString();
                 *
                 *  if (val == null)
                 *  {
                 *      val = "";
                 *  }
                 *  string paraName = "lableTag." + pro.Name;
                 *  report1.SetParameterValue(paraName, val);
                 *
                 * }
                 * var lableTag = new LableTag();
                 * lableTag.ProdNo = "800-sdashd-a0-0";
                 * lableTag.Qty = "300";
                 * lableTags = new LableTag[] { lableTag };
                 *
                 * report1.RegisterData(lableTags, "lableTag");
                 */
                report1.SetParameterValue("aaa", "111");
                report1.SetParameterValue("bbb", "222");
                report1.SetParameterValue("ccc", "333");
                report1.Design();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                // free resources used by report
                report1.Dispose();
            }
        }
Exemplo n.º 19
0
        private static void SetPrintSettings(FastReport.Report report, long lReportTemplateID)
        {
            DataTable dtReportTemplate = ExecuteSQL.CallView(105, "", "ReportTemplateID=" + lReportTemplateID, "");

            if (dtReportTemplate.Rows.Count > 0)
            {
                DataRow drReport = dtReportTemplate.Rows[0];

                string strPrinterName    = drReport["PrinterName"].ToString().TrimEnd();
                string strPaperType      = drReport["PaperType"].ToString().TrimEnd();
                int    PaperSizeHeight   = LBConverter.ToInt32(drReport["PaperSizeHeight"]);
                int    PaperSizeWidth    = LBConverter.ToInt32(drReport["PaperSizeWidth"]);
                bool   IsManualPaperType = LBConverter.ToBoolean(drReport["IsManualPaperType"]); //自动识别纸张类型
                bool   IsManualPaperSize = LBConverter.ToBoolean(drReport["IsManualPaperSize"]); //自动识别纸张大小
                bool   IsPaperTransverse = LBConverter.ToBoolean(drReport["IsPaperTransverse"]); //是否纵向打印

                if (strPrinterName != "")
                {
                    report.PrintSettings.Printer = strPrinterName;

                    /*if (IsManualPaperType)
                     * {
                     *  System.Drawing.Printing.PrinterSettings mSelectedPrinter = new System.Drawing.Printing.PrinterSettings();
                     *  int iIndex = 0;
                     *  foreach (System.Drawing.Printing.PaperSize pageSize in mSelectedPrinter.PaperSizes)
                     *  {
                     *      if (pageSize.PaperName.Equals(strPaperType))
                     *      {
                     *          //report.PrintSettings.PaperSource = Convert.ToInt32(pageSize.Kind);
                     *          break;
                     *      }
                     *      iIndex++;
                     *  }
                     *
                     *  report.PrintSettings.PaperSource = iIndex;
                     * }
                     *
                     * if (IsManualPaperSize)
                     * {
                     *  report.PrintSettings.PrintOnSheetHeight = PaperSizeHeight;
                     *  report.PrintSettings.PrintOnSheetWidth = PaperSizeWidth;
                     * }
                     *
                     * report.PrintSettings.Duplex = IsPaperTransverse ? System.Drawing.Printing.Duplex.Vertical :
                     *   System.Drawing.Printing.Duplex.Horizontal;
                     */
                }
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// 导出
        /// </summary>
        /// <param name="oddNum"></param>
        /// <param name="table"></param>
        protected void Export(DataTable[] table, string nameOfPrint)
        {
            FastReport.Report report = new FastReport.Report();
            DataSet           ds     = new DataSet();

            foreach (DataTable dt in table)
            {
                ds.Tables.Add(dt.Copy());
            }
            report.Load(Application.StartupPath + nameOfPrint);
            report.RegisterData(ds.Copy());
            report.Prepare();
            XMLExport exprots = new XMLExport();

            exprots.Export(report);
        }
Exemplo n.º 21
0
 /// <summary>
 /// 打印预览
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void tsmPreviewReport_Click(object sender, EventArgs e)
 {
     if (tsmChooseReport.HasDropDownItems)
     {
         report = new FastReport.Report();
         if (!report.IsRunning)
         {
             GetData(tsmChooseDetail[iDefaultChecked].Name);
             report.Load(new MemoryStream(bt));
             RegReportData();
         }
         frmReportPreview rp = new frmReportPreview(report);
         rp.ShowDialog();
         report.Dispose();
     }
 }
Exemplo n.º 22
0
        private void toolPrintPreview_Click(object sender, EventArgs e)
        {
            if (dgList.Rows.Count == 0)
            {
                toolPrint.Enabled        = false;
                toolPrintPreview.Enabled = false;
                return;
            }

            DataSet ds = new DataSet();

            //DataTable dt = (DataTable)dgList.DataSource;
            DataTable dt      = GetDgvToTable(dgList);
            DataTable dtPrint = dt.Copy();

            dtPrint.TableName = strStaticsName;
            ds.Tables.Add(dtPrint);
            FastReport.Report report1 = new FastReport.Report();
            try
            {
                // load the existing report
                report1.Load(Application.StartupPath + @"\PRINTModel\预存统计模板\" + strStaticsName + ".frx");

                if (strStaticsName == "预存统计(按收费员)")
                {
                    (report1.FindObject("txtTitle") as FastReport.TextObject).Text = "大厅收费统计(按收费员)";
                }
                else if (strStaticsName == "预存统计(按用户)")
                {
                    (report1.FindObject("txtTitle") as FastReport.TextObject).Text = "大厅收费统计(按用户)";
                }
                // register the dataset
                report1.RegisterData(ds);
                report1.GetDataSource(strStaticsName).Enabled = true;
                // run the report
                report1.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                // free resources used by report
                report1.Dispose();
            }
        }/// <summary>
Exemplo n.º 23
0
        public static void BuildParmsAndData(ReportRequestArgs e, FastReport.Report report, enBuildParmsAndDataActionType actionType)
        {
            if (actionType == enBuildParmsAndDataActionType.SetValue)  // 对模板已有参数赋值
            {
                foreach (FastReport.Data.Parameter parm in report.Parameters)
                {
                    // 参数值是从 fastParms.ReportParameters 中传入的
                    foreach (DataColumn dc in e.RecordDR.Table.Columns)
                    {
                        if (parm.Name.Equals(dc.ColumnName, StringComparison.CurrentCultureIgnoreCase))
                        {
                            parm.Value = e.RecordDR[dc.ColumnName];
                            break;
                        }
                    }
                }
            }
            else    // 添加新的参数至模板
            {
                if (e.RecordDR != null)
                {
                    report.Parameters.Clear();
                    foreach (DataColumn dc in e.RecordDR.Table.Columns)
                    {
                        FastReport.Data.Parameter parm = new FastReport.Data.Parameter(dc.ColumnName);
                        parm.DataType = dc.DataType;
                        parm.Value    = e.RecordDR[dc.ColumnName];
                        report.Parameters.Add(parm);
                    }
                }
            }

            if (e.DSDataSource != null)
            {
                for (int i = 0, j = e.DSDataSource.Tables.Count; i < j; i++)
                {
                    DataTable table = e.DSDataSource.Tables[i];
                    string    description;
                    string    strTableName = table.TableName;
                    report.RegisterData(table, strTableName);
                    //report.RegisterData(e.DSDataSource);
                    //report.ReportInfo.Description = table.TableName;
                    DataSourceBase dataSource = report.GetDataSource(strTableName);
                    dataSource.Enabled = true;
                }
            }
        }
Exemplo n.º 24
0
 /// <summary>
 /// 打印
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void tsmPrintReport_Click(object sender, EventArgs e)
 {
     if (tsmChooseReport.HasDropDownItems)
     {
         report = new FastReport.Report();
         if (!report.IsPrinting)
         {
             GetData(tsmChooseDetail[iDefaultChecked].Name);
             report.Load(new MemoryStream(bt));
             RegReportData();
         }
         //是否显示打印机选择对话框
         report.PrintSettings.ShowDialog = ShowPrintDialog;
         report.Print();
         report.Dispose();
     }
 }
Exemplo n.º 25
0
        //选择预览样式
        private void cboPrintStyle_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (dt == null || dt.Rows.Count == 0)
            {
                return;
            }
            string printStyle = CommonCtrl.IsNullToString(cboPrintStyle.SelectedValue);

            FastReport.Report rep;
            //下载打印样式
            string fileName = FileOperation.DownLoadFileByFile(Path.GetFileName(printStyle), "Report");

            //如果没找到,则用默认样式
            if (string.IsNullOrEmpty(fileName))
            {
                reportEx.styleObject = styleObject;
                reportEx.dt          = dt;
                reportEx.dicSpanRows = dicSpanRows;
                reportEx.styleTitle  = styleTitle;
                rep = reportEx.DefaultReport();
                if (rep == null)
                {
                    return;
                }
            }
            else
            {
                rep = new FastReport.Report();
                rep.Load(fileName);
                if (dt != null && dt.Rows.Count > 0)
                {
                    rep.RegisterData(dt, styleObject);
                }
                if (paperSize != null && rep.Pages.Count > 0)
                {
                    ReportPage page = (ReportPage)rep.Pages[0];
                    page.PaperWidth  = paperSize.Width;
                    page.PaperHeight = paperSize.Height;
                }
            }

            rep.Preview = previewReport;
            rep.Prepare();
            rep.ShowPrepared();
        }
Exemplo n.º 26
0
 /// <summary>
 /// 加载打印样式
 /// </summary>
 /// <param name="fileName"></param>
 public void LoadPrintStyle(string fileName, FastReport.Design.StandardDesigner.DesignerControl designerReport)
 {
     FastReport.Report rep = new FastReport.Report();
     rep.Load(fileName);
     if (dt != null && dt.Rows.Count > 0)
     {
         rep.RegisterData(dt, styleObject);
     }
     if (paperSize != null && rep.Pages.Count > 0)
     {
         ReportPage page = (ReportPage)rep.Pages[0];
         page.PaperWidth  = paperSize.Width;
         page.PaperHeight = paperSize.Height;
     }
     //designerReport.Report = rep;
     //designerReport.RefreshLayout();
     SetReport(rep, designerReport);
 }
Exemplo n.º 27
0
        void BindReport(DataTable dt)
        {
            FastReport.Report report = new FastReport.Report();
            //判断有报表数据,则注册数据
            if (dt != null && dt.Rows.Count > 0)
            {
                report.RegisterData(dt, "v_repair_vehicle_number_report");
            }
            else
            {
                return;
            }

            report.GetDataSource("v_repair_vehicle_number_report").Enabled = true;
            report.Load("Report/repair_vehicle_number_report.frx");
            report.Preview = pcReport;
            report.Prepare();
            report.ShowPrepared();
        }
        private void Frm_Report_Load(object sender, EventArgs e)
        {
            if (m_hookHelper == null)
            {
                return;
            }
            map = m_hookHelper.FocusMap;
            if (map == null)
            {
                return;
            }

            FReport         = new FastReport.Report();
            FReport.Preview = PreviewReport;

            GetLayers(map);

            DefaultCustomization();
        }
Exemplo n.º 29
0
 /// <summary>
 /// 设计报表
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void tsmDesginReport_Click(object sender, EventArgs e)
 {
     if (tsmChooseReport.HasDropDownItems)
     {
         report = new FastReport.Report();
         if (!report.IsDesigning)
         {
             GetData(tsmChooseDetail[iDefaultChecked].Name);
             report.Load(new MemoryStream(bt));
             RegReportData();
         }
         frmReportDesign rp = new frmReportDesign(report, Convert.ToInt32(tsmChooseDetail[iDefaultChecked].Name));
         rp.ReportGUID = rpGUID;
         rp.ShowDialog();
         report.Dispose();
         //刷新菜单
         CreateMenu();
     }
 }
Exemplo n.º 30
0
        private void toolPrintPreview_Click(object sender, EventArgs e)
        {
            if (dgList.Rows.Count == 0)
            {
                toolPrint.Enabled        = false;
                toolPrintPreview.Enabled = false;
                return;
            }

            DataSet ds = new DataSet();

            //DataTable dt = (DataTable)dgList.DataSource;
            DataTable dt = GetDgvToTable(dgList);
            //DataTable dtPrint = dt.Copy();
            DataTable dtPrint = dt.DefaultView.ToTable(true, "CHARGEID", "CANCELWORKERNAME", "CANCELDATETIME", "CANCELMEMO", "WATERTOTALCHARGECHARGE",
                                                       "EXTRATOTALCHARGECHARGE", "OVERDUEMONEYCHARGE", "TOTALCHARGECHARGE", "CHARGEBCYS", "CHARGEBCSS", "CHARGEDATETIME", "CHARGEWORKERNAME", "waterUserNO",
                                                       "waterUserName", "waterPhone", "waterUserAddress", "INVOICEBATCHNAME", "INVOICENO");

            dtPrint.TableName = "收费冲减明细表";
            ds.Tables.Add(dtPrint);
            FastReport.Report report1 = new FastReport.Report();
            try
            {
                // load the existing report
                report1.Load(Application.StartupPath + @"\PRINTModel\收费冲减明细表.frx");
                // register the dataset
                report1.RegisterData(ds);
                report1.GetDataSource("收费冲减明细表").Enabled = true;
                // run the report
                report1.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                // free resources used by report
                report1.Dispose();
            }
        }
Exemplo n.º 31
0
        //选择预览样式
        private void cboPrintStyle_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (dt == null || dt.Rows.Count == 0)
            {
                return;
            }
            string printStyle = CommonCtrl.IsNullToString(cboPrintStyle.SelectedValue);
            FastReport.Report rep;
            //下载打印样式
            string fileName = FileOperation.DownLoadFileByFile(Path.GetFileName(printStyle), "Report");
            //如果没找到,则用默认样式
            if (string.IsNullOrEmpty(fileName))
            {
                reportEx.styleObject = styleObject;
                reportEx.dt = dt;
                reportEx.dicSpanRows = dicSpanRows;
                reportEx.styleTitle = styleTitle;
                rep = reportEx.DefaultReport();
                if (rep == null)
                {
                    return;
                }
            }
            else
            {
                rep = new FastReport.Report();
                rep.Load(fileName);
                if (dt != null && dt.Rows.Count > 0)
                {
                    rep.RegisterData(dt, styleObject);
                }
                if (paperSize != null && rep.Pages.Count > 0)
                {
                    ReportPage page = (ReportPage)rep.Pages[0];
                    page.PaperWidth = paperSize.Width;
                    page.PaperHeight = paperSize.Height;
                }
            }

            rep.Preview = previewReport;
            rep.Prepare();
            rep.ShowPrepared();

        }
Exemplo n.º 32
0
        private void btnImprimirSugerido_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.dgvDatos.DataSource == null)
                    return;

                //(System.Collections.Generic.List<pauParteBusquedaEnTraspasos_Result>)
                var lista = new List<pauParteBusquedaEnTraspasos_Result>();
                foreach (DataGridViewRow fila in this.dgvDatos.Rows)
                {
                    var cb = (DataGridViewCheckBoxCell)fila.Cells["X"];
                    if (cb.Value != null)
                    {
                        if (Util.Logico(cb.Value))
                        {
                            var sugerido = new pauParteBusquedaEnTraspasos_Result()
                            {
                                ParteID = Util.Entero(fila.Cells["ParteID"].Value),
                                NumeroParte = Util.Cadena(fila.Cells["NumeroParte"].Value),
                                NombreParte = Util.Cadena(fila.Cells["NombreParte"].Value),
                                MarcaParteID = Util.Entero(fila.Cells["MarcaParteID"].Value),
                                LineaID = Util.Entero(fila.Cells["LineaID"].Value),
                                SistemaID = Util.Entero(fila.Cells["SistemaID"].Value),
                                SubsistemaID = Util.Entero(fila.Cells["SubsistemaID"].Value),
                                SucursalID = Util.Entero(fila.Cells["SucursalID"].Value),
                                Existencia = Util.Decimal(fila.Cells["Existencia"].Value),
                                Maximo = Util.Decimal(fila.Cells["Maximo"].Value),
                                Minimo = Util.Decimal(fila.Cells["Minimo"].Value),
                                SucursalDestinoID = Util.Entero(fila.Cells["SucursalDestinoID"].Value),
                                DestinoExistencia = Util.Decimal(fila.Cells["DestinoExistencia"].Value),
                                DestinoMaximo = Util.Decimal(fila.Cells["DestinoMaximo"].Value),
                                DestinoMinimo = Util.Decimal(fila.Cells["DestinoMinimo"].Value),
                                Sugerencia = Util.Decimal(fila.Cells["Sugerencia"].Value)
                            };
                            lista.Add(sugerido);
                        }
                    }
                }
                IEnumerable<pauParteBusquedaEnTraspasos_Result> listaE = lista;

                using (FastReport.Report report = new FastReport.Report())
                {
                    report.Load(string.Format("{0}{1}", GlobalClass.ConfiguracionGlobal.pathReportes, "ReporteSugeridoTraspaso.frx"));
                    report.SetParameterValue("Origen", this.cboUbicacionOrigen.Text);
                    report.SetParameterValue("Destino", this.cboUbicacionDestino.Text);
                    report.SetParameterValue("FechaHora", DateTime.Now);
                    report.RegisterData(listaE, "sugerido", 3);
                    report.GetDataSource("sugerido").Enabled = true;
                    report.Show(true);
                }
            }
            catch (Exception ex)
            {
                Util.MensajeError(ex.Message, GlobalClass.NombreApp);
            }
        }
Exemplo n.º 33
0
 /// <summary>
 /// 加载打印样式
 /// </summary>
 /// <param name="fileName"></param>
 public void LoadPrintStyle(string fileName, FastReport.Design.StandardDesigner.DesignerControl designerReport)
 {
     FastReport.Report rep = new FastReport.Report();
     rep.Load(fileName);
     if (dt != null && dt.Rows.Count > 0)
     {
         rep.RegisterData(dt, styleObject);
     }
     if (paperSize != null && rep.Pages.Count>0)
     {
         ReportPage page = (ReportPage)rep.Pages[0];
         page.PaperWidth = paperSize.Width;
         page.PaperHeight = paperSize.Height;
     }
     //designerReport.Report = rep;
     //designerReport.RefreshLayout();
     SetReport(rep, designerReport);
 }
Exemplo n.º 34
0
 /// <summary>
 /// 打印
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void tsmPrintReport_Click(object sender, EventArgs e)
 {
     if (tsmChooseReport.HasDropDownItems)
     {
         report = new FastReport.Report();
         if (!report.IsPrinting)
         {
             GetData(tsmChooseDetail[iDefaultChecked].Name);
             report.Load(new MemoryStream(bt));
             RegReportData();
         }
         //是否显示打印机选择对话框
         report.PrintSettings.ShowDialog = ShowPrintDialog;
         report.Print();
         report.Dispose();
     }
 }
Exemplo n.º 35
0
 /// <summary>
 /// 打印预览
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void tsmPreviewReport_Click(object sender, EventArgs e)
 {
     if (tsmChooseReport.HasDropDownItems)
     {
         report = new FastReport.Report();
         if (!report.IsRunning)
         {
             GetData(tsmChooseDetail[iDefaultChecked].Name);
             report.Load(new MemoryStream(bt));
             RegReportData();
         }
         frmReportPreview rp = new frmReportPreview(report);
         rp.ShowDialog();
         report.Dispose();
     }
 }
Exemplo n.º 36
0
 /// <summary>
 /// 设计报表
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void tsmDesginReport_Click(object sender, EventArgs e)
 {
     if (tsmChooseReport.HasDropDownItems)
     {
         report = new FastReport.Report();
         if (!report.IsDesigning)
         {
             GetData(tsmChooseDetail[iDefaultChecked].Name);
             report.Load(new MemoryStream(bt));
             RegReportData();
         }
         frmReportDesign rp = new frmReportDesign(report, Convert.ToInt32(tsmChooseDetail[iDefaultChecked].Name));
         rp.ReportGUID = rpGUID;
         rp.ShowDialog();
         report.Dispose();
         //刷新菜单
         CreateMenu();
     }
 }
Exemplo n.º 37
0
 /// <summary>
 /// 新增报表
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void tsmAddReport_Click(object sender, EventArgs e)
 {
     report = new FastReport.Report();
     RegReportData();
     frmReportDesign rp = new frmReportDesign(report,0);
     rp.ReportGUID = rpGUID;
     rp.ShowDialog();
     report.Dispose();
     //ClearListData();
     CreateMenu();
 }
Exemplo n.º 38
0
        /// <summary>
        /// 生成默认报表
        /// </summary>
        /// <returns></returns>
        public FastReport.Report DefaultReport()
        {

            FastReport.Report report = new FastReport.Report();
            //判断有报表数据,则注册数据
            if (dt != null && dt.Rows.Count > 0)
            {
                report.RegisterData(dt, styleObject);
            }
            else
            {
                return null;
            }
            //查询报表设置
            DataTable dtReportSet = DBHelper.GetTable("", "tb_report_set", "*", string.Format("set_object='{0}' and set_user='******'", styleObject, GlobalStaticObj.UserID), "", "order by set_num");
            if (dtReportSet == null || dtReportSet.Rows.Count == 0)
            {
                return null;
            }
            // enable the "Employees" table to use it in the report
            report.GetDataSource(styleObject).Enabled = true;

            // add report page
            ReportPage page = new ReportPage();
            if (paperSize != null)
            {
                page.PaperWidth = paperSize.Width;
                page.PaperHeight = paperSize.Height;
            }
            report.Pages.Add(page);
            // always give names to objects you create. You can use CreateUniqueName method to do this;
            // call it after the object is added to a report.
            page.CreateUniqueName();

            // create title band
            page.ReportTitle = new ReportTitleBand();
            // native FastReport unit is screen pixel, use conversion 
            page.ReportTitle.Height = Units.Centimeters * 1;
            page.ReportTitle.CreateUniqueName();

            // create title text
            TextObject titleText = new TextObject();
            titleText.Parent = page.ReportTitle;
            titleText.CreateUniqueName();
            //titleText.Bounds = new RectangleF(Units.Centimeters * 5, 0, Units.Centimeters * 10, Units.Centimeters * 1);
            titleText.Bounds = new RectangleF(0, 0, Units.Millimeters * page.PaperWidth, Units.Centimeters * 1);
            titleText.Font = new Font("Arial", 14, FontStyle.Bold);
            titleText.Text = styleTitle;
            titleText.HorzAlign = HorzAlign.Center;
            titleText.VertAlign = VertAlign.Center;
            //内容行高
            float rowHeight = Units.Centimeters * 1F;
            //标题行高,如果有合并列,怎行高价高
            float rowHeaderHeight = rowHeight;
            if (dicSpanRows != null && dicSpanRows.Count > 0)
            {
                rowHeaderHeight = Units.Centimeters * 1.5f;
            }
            page.PageHeader = new PageHeaderBand();
            page.PageHeader.Height = rowHeaderHeight;
            page.PageHeader.CreateUniqueName();
            #region 生成报表内容
            // create data band
            DataBand dataBand = new DataBand();
            page.Bands.Add(dataBand);
            dataBand.CreateUniqueName();
            dataBand.DataSource = report.GetDataSource(styleObject);
            dataBand.Height = rowHeight;
            float x = 0F;//x坐标

            foreach (DataRow dr in dtReportSet.Rows)
            {
                //判断是否要打印
                if (CommonCtrl.IsNullToString(dr["is_print"]) != "1")
                {
                    continue;
                }
                //列宽
                float columnWidth = Units.Centimeters * 2;
                //标题
                string headerName = string.Empty;
                //获取设置的列宽和标题
                float.TryParse(dr["set_width"].ToString(), out columnWidth);
                //columnWidth = columnWidth * 0.9f;
                headerName = dr["set_name"].ToString();
                //生成标题
                TextObject txtHeader = new TextObject();
                txtHeader.Parent = page.PageHeader;
                txtHeader.CreateUniqueName();
                txtHeader.Text = headerName;
                txtHeader.HorzAlign = HorzAlign.Center;
                txtHeader.VertAlign = VertAlign.Center;
                //生成标题竖线
                LineObject lineHeaderVer = new LineObject();
                lineHeaderVer.Parent = page.PageHeader;
                //生成标题横线
                LineObject lineHeaderHor = new LineObject();
                lineHeaderHor.Parent = page.PageHeader;
                lineHeaderHor.Bounds = new RectangleF(x, 0, columnWidth, 1f);

                //数据源列名称
                string dataName = dr["set_data_name"].ToString();
                string spanName = IsContainDataColumn(dataName);
                //判断列是否是合并列
                if (spanName.Length > 0)
                {
                    #region 合并列标题
                    txtHeader.Bounds = new RectangleF(x, rowHeaderHeight / 2, columnWidth, rowHeaderHeight / 2);
                    lineHeaderVer.Bounds = new RectangleF(x, rowHeaderHeight / 2, 1F, rowHeaderHeight / 2);
                    //生成合并列的短竖线
                    LineObject lineHeaderHorSpan = new LineObject();
                    lineHeaderHorSpan.Parent = page.PageHeader;
                    lineHeaderHorSpan.Bounds = new RectangleF(x, rowHeaderHeight / 2, columnWidth, 1F);
                    //判断是否包含合并列头
                    if (dicSpanWidth.ContainsKey(spanName))
                    {
                        //增加合并列头的列宽
                        RectangleF rf = dicSpanWidth[spanName];
                        rf.Width += columnWidth;
                        dicSpanWidth[spanName] = rf;
                    }
                    else
                    {
                        //记录合并列头
                        RectangleF rf = new RectangleF();
                        rf.X = x;
                        rf.Y = 0;
                        rf.Width = columnWidth;
                        rf.Height = rowHeaderHeight / 2;
                        dicSpanWidth.Add(spanName, rf);
                    }
                    #endregion
                }
                else
                {
                    lineHeaderVer.Bounds = new RectangleF(x, 0, 1F, rowHeaderHeight);
                    txtHeader.Bounds = new RectangleF(x, 0, columnWidth, rowHeaderHeight);
                }
                // create two text objects with employee's name and birth date
                //生成内容
                TextObject empNameText = new TextObject();
                empNameText.Parent = dataBand;
                empNameText.CreateUniqueName();
                empNameText.Bounds = new RectangleF(x, 0, columnWidth, rowHeight);
                DataColumn dc = dt.Columns[dataName];
                empNameText.Text = string.Format("[{0}.{1}]", styleObject, dataName);
                //empNameText.HideZeros = true;
                if (dc != null && dc.DataType != typeof(string))
                {
                    empNameText.HorzAlign = HorzAlign.Right;
                }
                else
                {
                    empNameText.HorzAlign = HorzAlign.Center;
                }
                empNameText.VertAlign = VertAlign.Center;
                //生成内容列的竖线
                LineObject lineVertical = new LineObject();
                lineVertical.Parent = dataBand;
                lineVertical.Bounds = new RectangleF(x, 0, 1F, rowHeight);
                //生成内容列顶部的横线
                LineObject lineHorizontal = new LineObject();
                lineHorizontal.Parent = dataBand;
                lineHorizontal.Bounds = new RectangleF(x, 0, columnWidth, 1f);
                //生成内荣列底部的横线
                LineObject lineHorizontalD = new LineObject();
                lineHorizontalD.Parent = dataBand;
                lineHorizontalD.Bounds = new RectangleF(x, rowHeight, columnWidth, 1f);

                //x坐标增加当前列
                x += columnWidth;
            }

            //生成标题右边的竖线
            LineObject lineHeaderRightVer = new LineObject();
            lineHeaderRightVer.Parent = page.PageHeader;
            lineHeaderRightVer.Bounds = new RectangleF(x, 0, 1f, rowHeight);
            //生成内容右边的竖线
            LineObject lineRightVer = new LineObject();
            lineRightVer.Parent = dataBand;
            lineRightVer.Bounds = new RectangleF(x, 0, 1f, rowHeight);
            //生成合并列头
            foreach (string span in dicSpanWidth.Keys)
            {
                //合并列头
                TextObject txtSpan = new TextObject();
                txtSpan.Parent = page.PageHeader;
                txtSpan.CreateUniqueName();
                txtSpan.Bounds = dicSpanWidth[span];
                txtSpan.Text = span;
                txtSpan.HorzAlign = HorzAlign.Center;
                txtSpan.VertAlign = VertAlign.Center;
                //合并列头的竖线
                LineObject lineHeaderVer = new LineObject();
                lineHeaderVer.Parent = page.PageHeader;
                lineHeaderVer.Bounds = new RectangleF(txtSpan.Bounds.X, txtSpan.Bounds.Y, 1f, txtSpan.Bounds.Height);
            }
            #endregion
            #region 生成页脚
            page.PageFooter = new PageFooterBand();
            page.PageFooter.Height = rowHeaderHeight;
            page.PageHeader.CreateUniqueName();
            TextObject txtPageN = new TextObject();
            txtPageN.Parent = page.PageFooter;
            txtPageN.CreateUniqueName();
            txtPageN.Text = "[PageNofM]";
            txtPageN.Bounds = new RectangleF(100, 0, 200, rowHeaderHeight);

            //TextObject txtTotalPages = new TextObject();
            //txtTotalPages.Parent = page.PageFooter;
            //txtTotalPages.CreateUniqueName();
            //txtTotalPages.Text = "[TotalPages]";
            //txtTotalPages.Bounds = new RectangleF(350, 0, 200, rowHeaderHeight);
            #endregion
            return report;

        }
Exemplo n.º 39
0
 public frmReportPreview(FastReport.Report rp)
 {
     InitializeComponent();
     PreRepot = rp;
 }
Exemplo n.º 40
-1
        void BindReport(DataTable dt)
        {
            FastReport.Report report = new FastReport.Report();
            //判断有报表数据,则注册数据
            if (dt != null && dt.Rows.Count > 0)
            {
                report.RegisterData(dt, "v_repair_vehicle_number_report");
            }
            else
            {
                return;
            }

            report.GetDataSource("v_repair_vehicle_number_report").Enabled = true;
            report.Load("Report/repair_vehicle_number_report.frx");
            report.Preview = pcReport;
            report.Prepare();
            report.ShowPrepared();
        }
Exemplo n.º 41
-1
        private void btnImprimirRpt_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.dgvReporteVentas.DataSource == null)
                    return;

                var lista = (System.Collections.Generic.List<pauVentasCancelaciones_Result>)this.dgvReporteVentas.DataSource;
                IEnumerable<pauVentasCancelaciones_Result> listaE = lista;

                using (FastReport.Report report = new FastReport.Report())
                {
                    report.Load(string.Format("{0}{1}", GlobalClass.ConfiguracionGlobal.pathReportes, "ReporteVentasCancelaciones.frx"));
                    report.SetParameterValue("Origen", this.cboSucursalRpt.Text);
                    report.SetParameterValue("Desde", this.dtpDesdeRpt.Value);
                    report.SetParameterValue("Hasta", this.dtpHastaRpt.Value);
                    report.RegisterData(listaE, "ventasCancelaciones", 3);
                    report.GetDataSource("ventasCancelaciones").Enabled = true;
                    report.Show(true);
                }
            }
            catch (Exception ex)
            {
                Util.MensajeError(ex.Message, GlobalClass.NombreApp);
            }
        }