public async Task <byte[]> GetReport(string Type, string basepath, CustomClearanceBIZSearchDTO arg)
        {
            var helper     = new ReportHelper();
            var datasource = new Telerik.Reporting.ObjectDataSource();

            arg.gmsDashboardSearchFilter.pageNo = 0;
            datasource.DataSource = helper.GetGMSReleaseReportData(arg);
            Telerik.Reporting.Report instanceReport;
            var settings = new System.Xml.XmlReaderSettings();

            settings.IgnoreWhitespace = true;
            var path = basepath + "/Report/GMSStatusReport.trdx";

            using (System.Xml.XmlReader xmlReader = System.Xml.XmlReader.Create(path, settings))
            {
                var xmlSerializer = new Telerik.Reporting.XmlSerialization.ReportXmlSerializer();
                instanceReport = (Telerik.Reporting.Report)xmlSerializer.Deserialize(xmlReader);
            }
            Telerik.Reporting.Table tbl = instanceReport.Items.Find("table1", true)[0] as Telerik.Reporting.Table;
            tbl.DataSource = datasource;
            DateTime frmdate;

            if (DateTime.TryParseExact(arg.gmsDashboardSearchFilter.fromDT,
                                       "yyyy-MM-dd HH:mm:ss",
                                       System.Globalization.CultureInfo.InvariantCulture,
                                       System.Globalization.DateTimeStyles.None,
                                       out frmdate))
            {
                instanceReport.ReportParameters["FromDate"].Value = frmdate.ToString("dd/MM/yyyy");
            }
            else
            {
                instanceReport.ReportParameters["FromDate"].Value = string.Empty;
            }

            DateTime todate;

            if (DateTime.TryParseExact(arg.gmsDashboardSearchFilter.toDT,
                                       "yyyy-MM-dd HH:mm:ss",
                                       System.Globalization.CultureInfo.InvariantCulture,
                                       System.Globalization.DateTimeStyles.None,
                                       out todate))
            {
                instanceReport.ReportParameters["ToDate"].Value = todate.ToString("dd/MM/yyyy");
            }
            else
            {
                instanceReport.ReportParameters["ToDate"].Value = string.Empty;
            }

            //instanceReport.ReportParameters.Add("ToDate", parameters[1]);
            Telerik.Reporting.Processing.ReportProcessor reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();
            Telerik.Reporting.Processing.RenderingResult result          = reportProcessor.RenderReport(Type, new InstanceReportSource {
                ReportDocument = instanceReport
            }, null);
            byte[] contents = result.DocumentBytes;
            return(contents);
        }
Esempio n. 2
0
        public PrintView(List <Test> lstT)
        {
            if (lstT.Count > 0)
            {
                InitializeComponent();
                this.rpvNav.CommandBarElement.Rows[0].Strips[0].ItemsLayout.Children[0].Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
                CommandBarButton btn = new CommandBarButton();
                btn.Click      += new EventHandler(btn_Click);
                btn.DrawText    = false;
                btn.Image       = (System.Drawing.Image)Properties.Resources.save;
                btn.ToolTipText = "Save PDF to a specified location";
                this.rpvNav.CommandBarElement.Rows[0].Strips[0].Items.Insert(0, btn);

                BatchReport          report      = new BatchReport();
                InstanceReportSource rptInstance = new InstanceReportSource();
                rptInstance.ReportDocument = report;

                Test t = new Test();
                t.PrepRun = lstT[0].PrepRun;
                t.DueDate = lstT.Where(te => te.DueDate != null).Select(te => te.DueDate).Min();

                report.DataSource      = t;
                report.DocumentMapText = "Prep Benchsheet";


                Telerik.Reporting.Table tableItem = report.Items.Find("table1", true)[0] as Telerik.Reporting.Table;
                tableItem.DataSource = lstT;

                //Render pdf
                Telerik.Reporting.Processing.ReportProcessor reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();
                System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
                deviceInfo["FontEmbedding"] = "None";
                result = reportProcessor.RenderReport("PDF", rptInstance, deviceInfo);
                MemoryStream msPDF = new MemoryStream(result.DocumentBytes);
                rpvMain.ViewerMode = FixedDocumentViewerMode.TextSelection;
                rpvMain.LoadDocument(msPDF);
                //msPDF.Dispose();
            }
        }
Esempio n. 3
0
        /// case 1:
        /// | 0.0 | 0.1 |
        /// -------------
        /// | 1.0 | 1.1 |
        ///
        private void CreateTable2x2Test()
        {
            var table1      = new Telerik.Reporting.Table();
            var colGroup1   = new Telerik.Reporting.TableGroup();
            var colGroup2   = new Telerik.Reporting.TableGroup();
            var colGroup3   = new Telerik.Reporting.TableGroup();
            var colGroup4   = new Telerik.Reporting.TableGroup();
            var detailGroup = new Telerik.Reporting.TableGroup();
            var rowGroup1   = new Telerik.Reporting.TableGroup();

            var txtBox00 = new Telerik.Reporting.TextBox();
            var txtBox01 = new Telerik.Reporting.TextBox();
            var txtBox10 = new Telerik.Reporting.TextBox();
            var txtBox11 = new Telerik.Reporting.TextBox();

            this.detail.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
                table1
            });

            table1.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(Telerik.Reporting.Drawing.Unit.Cm(3D)));
            table1.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(Telerik.Reporting.Drawing.Unit.Cm(3D)));
            table1.Body.Rows.Add(new Telerik.Reporting.TableBodyRow(Telerik.Reporting.Drawing.Unit.Cm(0.5D)));

            table1.Body.SetCellContent(0, 0, txtBox10);
            table1.Body.SetCellContent(0, 1, txtBox11);

            table1.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
                txtBox00, txtBox01, txtBox10, txtBox11
            });

            colGroup2.Name = "colgroup-02";
            colGroup1.ChildGroups.Add(colGroup2);
            colGroup1.Name       = "colgroup-01";
            colGroup1.ReportItem = txtBox00;

            colGroup4.Name = "colgroup-04";
            colGroup3.ChildGroups.Add(colGroup4);
            colGroup3.Name       = "colgroup-03";
            colGroup3.ReportItem = txtBox01;

            table1.ColumnGroups.Add(colGroup1);
            table1.ColumnGroups.Add(colGroup3);

            rowGroup1.Name = "rowgroup-01";
            detailGroup.ChildGroups.Add(rowGroup1);
            detailGroup.Groupings.Add(new Telerik.Reporting.Grouping(null));
            detailGroup.Name = "detailgroup";

            table1.RowGroups.Add(detailGroup);

            table1.Size     = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Cm(6D), Telerik.Reporting.Drawing.Unit.Cm(1D));
            table1.Location = new Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Cm(1.5D), Telerik.Reporting.Drawing.Unit.Cm(1.5D));
            table1.Name     = "table1";

            //
            // txtBox00
            //
            txtBox00.Name      = "txtBox00";
            txtBox00.Size      = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Cm(3D), Telerik.Reporting.Drawing.Unit.Cm(0.5D));
            txtBox00.StyleName = "";
            txtBox00.Value     = "0.0";
            //
            // txtBox01
            //
            txtBox01.Name      = "txtBox01";
            txtBox01.Size      = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Cm(3D), Telerik.Reporting.Drawing.Unit.Cm(0.5D));
            txtBox01.StyleName = "";
            txtBox01.Value     = "0.1";
            //
            // txtBox10
            //
            txtBox10.Name      = "txtBox10";
            txtBox10.Size      = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Cm(3D), Telerik.Reporting.Drawing.Unit.Cm(0.5D));
            txtBox10.StyleName = "";
            txtBox10.Value     = "1.0";
            //
            // txtBox11
            //
            txtBox11.Name      = "txtBox11";
            txtBox11.Size      = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Cm(3D), Telerik.Reporting.Drawing.Unit.Cm(0.5D));
            txtBox11.StyleName = "";
            txtBox11.Value     = "1.1";
        }