Ejemplo n.º 1
0
        void LocalReport_SubreportProcessing(object sender, SubreportProcessingEventArgs e)
        {
            switch (e.ReportPath)
            {
            case "SI_Rg_Kunde":
            {
                var query = from s in db.projekt_si_rgkunden where s.id_projekt == pID select s;
                e.DataSources.Add(new ReportDataSource("dsRechnungen", query));
                break;
            }

            case "SI_Rg_Lief":
            {
                var query = from s in db.projekt_si_rglieferanten where s.id_projekt == pID select s;
                e.DataSources.Add(new ReportDataSource("dsRechnungLieferant", query));
                break;
            }

            case "SI_Gutschrift_Kunde":
            {
                var query = from s in db.projekt_si_gutschriftkunden where s.id_projekt == pID select s;
                e.DataSources.Add(new ReportDataSource("ds_Gutschrift_Kunde", query));
                break;
            }

            case "SI_Gutschrift_Lief":
            {
                var query = from s in db.projekt_si_gutschriftlieferanten where s.id_projekt == pID select s;
                e.DataSources.Add(new ReportDataSource("ds_Gutschrift_Lieferant", query));
                break;
            }


            case "aggregate":
            {
                var query = from s in db.vwAggregate where s.id_projekt == pID select s;
                e.DataSources.Add(new ReportDataSource("dsAggregate", query));
                break;
            }

            case "CompanyListBV":
            {
                var SubMerge = new Temp.MergeData_DataSorce();
                SubMerge.SetValue("Jets", 1);
                SubMerge.SetValue("Sperre", 2);

                e.DataSources.Add(new ReportDataSource("MergeData", SubMerge.MergedData));
                break;
            }

            case "CompanyListJE":
            {
                var SubMerge = new Temp.MergeData_DataSorce();
                SubMerge.SetValue("Jets", 1);
                SubMerge.SetValue("Sperre", 2);

                e.DataSources.Add(new ReportDataSource("MergeData", SubMerge.MergedData));
                break;
            }


            default:
                break;
            }

            //   RenderingExtension[] re = reportViewer.LocalReport.ListRenderingExtensions();
            //   string deviceInfo =
            //       "<DeviceInfo>" +
            //"  <OutputFormat>EMF</OutputFormat>" +
            //"  <PageWidth>8.5in</PageWidth>" +
            //"  <PageHeight>11in</PageHeight>" +
            //"  <MarginTop>0.25in</MarginTop>" +
            //"  <MarginLeft>0.25in</MarginLeft>" +
            //"  <MarginRight>0.25in</MarginRight>" +
            //"  <MarginBottom>0.25in</MarginBottom>" +
            //"</DeviceInfo>";

            //   reportViewer.ExportDialog(re[3], deviceInfo, "Test.doc");
        }
Ejemplo n.º 2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            string ReportName = string.Empty;

            db   = new SteinbachEntities();
            host = new WindowsFormsHost();


            var query = from p in db.projekte
                        where p.id == pID
                        select p;
            var Merge = new Temp.MergeData_DataSorce();

            var q = query.FirstOrDefault();

            //Merge.SetValue(String.Format("{0} - {1}", q.projektnummer, q.type.Substring(0, 1)), 0);
            Merge.SetValue(String.Format("{0} {1}", q.projektnummer, GetTypesString(q.projektnummer)), 0);

            if (q.lager == 0 || q.lager == null)
            {
                if (q.ersatzteilebestellt.HasValue)
                {
                    DateTime s1 = (DateTime)q.ersatzteilebestellt;
                    Merge.SetValue(s1.ToString("d"), 1);
                }

                if (q.ersatzteileerhalten.HasValue)
                {
                    DateTime s2 = (DateTime)q.ersatzteileerhalten;
                    Merge.SetValue(s2.ToString("d"), 2);
                }
            }
            else
            {
                Merge.SetValue("Lager", 1);
                Merge.SetValue("Lager", 2);
            }

            reportViewer = new Microsoft.Reporting.WinForms.ReportViewer();
            reportViewer.ProcessingMode = ProcessingMode.Local;
            reportViewer.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);

            switch (Firmennummer)
            {
            case 10177:
            {
                if (Type == "Ersatzteile" && bSI)
                {
                    ReportName = "ProjektDB.Reports.Jets.Jets_ETeile_SI.rdlc";
                    break;
                }
                if (bSI)
                {
                    ReportName = "ProjektDB.Reports.Jets.Jets_Auftrag_SI.rdlc";
                    break;
                }
                if (bAuftrag)
                {
                    ReportName = "ProjektDB.Reports.Jets.Jets_Auftrag.rdlc";
                    break;
                }

                ReportName = "ProjektDB.Reports.Jets.Jets_Angebot.rdlc";

                break;
            }

            case 10014:
            {
                //if (Type == "Service")
                //{
                //     ReportName = "ProjektDB.Reports.Alle_Angebot.rdlc";
                //     break;
                //}

                if (bSI)
                {
                    ReportName = "ProjektDB.Reports.Alle_Auftrag_SI.rdlc";
                    break;
                }

                if (bAuftrag)
                {
                    ReportName = "ProjektDB.Reports.Brunvoll.Brunvoll_Auftrag.rdlc";
                    break;
                }


                ReportName = "ProjektDB.Reports.Alle_Angebot.rdlc";

                break;
            }

            default:
            {
                if (bSI)
                {
                    ReportName = "ProjektDB.Reports.Alle_Auftrag_SI.rdlc";
                    break;
                }
                if (bAuftrag)
                {
                    ReportName = "ProjektDB.Reports.Alle_Angebot.rdlc";
                    break;
                }

                ReportName = "ProjektDB.Reports.Alle_Angebot.rdlc";

                break;
            }
            }
            reportViewer.LocalReport.ReportEmbeddedResource = ReportName;       //"ProjektDB.Reports.Jets_Auftrag_SI.rdlc";
            ReportDataSource ds  = new ReportDataSource("dsDeckblattTest", query);
            ReportDataSource MeD = new ReportDataSource("MergeData", Merge.MergedData);

            reportViewer.LocalReport.DataSources.Add(ds);
            reportViewer.LocalReport.DataSources.Add(MeD);



            reportViewer.RefreshReport();


            host.Child = reportViewer;
            this.GridDisplay.Children.Add(host);
        }