Esempio n. 1
2
        public ReportResult(ReportFormat format, string outReportName, string reportPath, ReportDataSource [] ds, SubreportProcessingEventHandler[] subReportProcessing = null)
        {
            var local = new LocalReport();
            local.ReportPath = reportPath;

            if (ds != null)
            {
                for(int i = 0 ; i < ds.Count() ; i++ )
                    local.DataSources.Add(ds[i]);
            }
            // подключение обработчиков вложенных отчетов
            if (subReportProcessing != null)
            {
                for (int i = 0; i < subReportProcessing.Count(); i++ )
                    local.SubreportProcessing += subReportProcessing[i];
            }

            ReportType = format.ToString();
            DeviceInfo = String.Empty;
            ReportName = outReportName;

            RenderBytes = local.Render(ReportType, DeviceInfo
                , out this.MimiType
                , out this.Encoding
                , out this.FileExt
                , out this.Streams
                , out this.Warnings
                );
        }
Esempio n. 2
0
        public ReportRunner(
            ReportFormat reportFormat,
            string reportPath,
            string reportServerUrl,
            string username,
            string password,
            IEnumerable<KeyValuePair<string, object>> reportParameters,
            ProcessingMode mode = ProcessingMode.Remote,
            IDictionary<string, DataTable> localReportDataSources = null)
        {
            _reportFormat = reportFormat;

            _viewerParameters.ProcessingMode = mode;
            if (mode == ProcessingMode.Local && localReportDataSources != null)
            {
                _viewerParameters.LocalReportDataSources = localReportDataSources;
            }

            _viewerParameters.ReportPath = reportPath;
            _viewerParameters.ReportServerUrl = reportServerUrl ?? _viewerParameters.ReportServerUrl;
            if (username != null || password != null)
            {
                _viewerParameters.Username = username;
                _viewerParameters.Password = password;
            }

            ParseParameters(reportParameters);
        }
Esempio n. 3
0
 private ActionResult DownloadReport(ReportFormat format)
 {
     return this.Report(
         format,
         ReportName,
         new { Parameter1 = "Hello World!", Parameter2 = DateTime.Now, Parameter3 = 12345 });
 }
Esempio n. 4
0
        public static string GetFileNameWithoutExtension(string fileName, ReportFormat.ExportType exportFormat)
        {
            switch (exportFormat)
            {
                case ReportFormat.ExportType.Excel:
                    if (fileName.IndexOf(FileSuffix.ExcelFileSuffix, StringComparison.CurrentCultureIgnoreCase) == -1)
                    {
                        return fileName;
                    }
                    else
                    {
                        return fileName.Split('.')[0];
                    }
                case ReportFormat.ExportType.Pdf:
                    if (fileName.IndexOf(FileSuffix.Pdf, StringComparison.CurrentCultureIgnoreCase) == -1)
                    {
                        return fileName;
                    }
                    else
                    {
                        return fileName.Split('.')[0];
                    }
            }

            return String.Empty;
        }
Esempio n. 5
0
 public ReportRunner(
     ReportFormat reportFormat,
     string reportPath,
     IDictionary<string, object> reportParameters)
     : this(reportFormat, reportPath, null, null, null, reportParameters)
 {
 }
Esempio n. 6
0
 public ReportRunner(
     ReportFormat reportFormat,
     string reportPath,
     IEnumerable<KeyValuePair<string, object>> reportParameters)
     : this(reportFormat, reportPath, null, null, null, reportParameters)
 {
 }
 /// <summary>
 /// Creates a FileContentResult object by using Report Viewer Web Control.
 /// </summary>
 /// <param name="controller">The Controller instance that this method extends.</param>
 /// <param name="reportFormat">Report Viewer Web Control supported format (Excel, Word, PDF or Image)</param>
 /// <param name="reportPath">The path to the report on the server.</param>
 /// <returns>The file-content result object.</returns>
 public static FileStreamResult Report(
     this Controller controller, 
     ReportFormat reportFormat, 
     string reportPath)
 {
     var reportRunner = new ReportRunner(reportFormat, reportPath);
     return reportRunner.Run();
 }
Esempio n. 8
0
 static ReportFormat()
 {
     Html = new ReportFormat { Code = ReportFormats.Html, Instruction = "HTML4.0" };
     MHtml = new ReportFormat { Code = ReportFormats.MHtml, Instruction = "MHTML" };
     Pdf = new ReportFormat { Code = ReportFormats.Pdf, Instruction = "PDF" };
     Xlsx = new ReportFormat { Code = ReportFormats.Xlsx, Instruction = "EXCELOPENXML" };
     Docx = new ReportFormat { Code = ReportFormats.Docx, Instruction = "WORDOPENXML" };
 }
Esempio n. 9
0
 public ReportRunner(
     ReportFormat reportFormat,
     string reportPath,
     ProcessingMode mode = ProcessingMode.Remote,
     IDictionary<string, DataTable> localReportDataSources = null)
     : this(reportFormat, reportPath, null, null, null, null, mode, localReportDataSources)
 {
 }
Esempio n. 10
0
 public ReportRunner(
     ReportFormat reportFormat,
     string reportPath,
     IDictionary<string, object> reportParameters)
     : this(reportFormat, 
         reportPath, 
         reportParameters != null ? reportParameters.ToList() : null)
 {
 }
Esempio n. 11
0
 public ReportRunner(
     ReportFormat reportFormat,
     string reportPath,
     IEnumerable<KeyValuePair<string, object>> reportParameters,
     ProcessingMode mode = ProcessingMode.Remote,
     IDictionary<string, DataTable> localReportDataSources = null)
     : this(reportFormat, reportPath, null, null, null, reportParameters, mode, localReportDataSources)
 {
 }
 /// <summary>
 /// Creates a FileContentResult object by using Report Viewer Web Control.
 /// </summary>
 /// <param name="controller">The Controller instance that this method extends.</param>
 /// <param name="reportFormat">Report Viewer Web Control supported format (Excel, Word, PDF or Image)</param>
 /// <param name="reportPath">The path to the report on the server.</param>
 /// <param name="mode">Report processing mode: remote or local.</param>
 /// <param name="localReportDataSources">Local report data sources</param>
 /// <returns>The file-content result object.</returns>
 public static FileStreamResult Report(
     this Controller controller,
     ReportFormat reportFormat,
     string reportPath,
     ProcessingMode mode = ProcessingMode.Remote,
     IDictionary<string, DataTable> localReportDataSources = null)
 {
     var reportRunner = new ReportRunner(reportFormat, reportPath, mode, localReportDataSources);
     return reportRunner.Run();
 }
Esempio n. 13
0
 public ReportRunner(
     ReportFormat reportFormat,
     string reportPath,
     IDictionary<string, object> reportParameters,
     ProcessingMode mode = ProcessingMode.Remote,
     IDictionary<string, DataTable> localReportDataSources = null)
     : this(reportFormat, 
         reportPath, 
         reportParameters != null ? reportParameters.ToList() : null,
         mode,
         localReportDataSources)
 {
 }
        /// <summary>
        /// Creates a FileContentResult object by using Report Viewer Web Control.
        /// </summary>
        /// <param name="controller">The Controller instance that this method extends.</param>
        /// <param name="reportFormat">Report Viewer Web Control supported format (Excel, Word, PDF or Image)</param>
        /// <param name="reportPath">The path to the report on the server.</param>
        /// <param name="reportParameters">The report parameter properties for the report.</param>
        /// <returns>The file-content result object.</returns>
        public static FileStreamResult Report(
            this Controller controller,
            ReportFormat reportFormat,
            string reportPath,
            IEnumerable<KeyValuePair<string, object>> reportParameters)
        {
            var reportRunner = new ReportRunner(
                reportFormat,
                reportPath,
                reportParameters);

            return reportRunner.Run();
        }
        /// <summary>
        /// Creates a FileContentResult object by using Report Viewer Web Control.
        /// </summary>
        /// <param name="controller">The Controller instance that this method extends.</param>
        /// <param name="reportFormat">Report Viewer Web Control supported format (Excel, Word, PDF or Image)</param>
        /// <param name="reportPath">The path to the report on the server.</param>
        /// <param name="reportParameters">The report parameter properties for the report.</param>
        /// <returns>The file-content result object.</returns>
        public static FileStreamResult Report(
            this Controller controller,
            ReportFormat reportFormat,
            string reportPath,
            object reportParameters)
        {
            var reportRunner = new ReportRunner(
                reportFormat,
                reportPath,
                HtmlHelper.AnonymousObjectToHtmlAttributes(reportParameters));

            return reportRunner.Run();
        }
Esempio n. 16
0
 private ActionResult DownloadReportMultipleValues(ReportFormat format)
 {
     return this.Report(
         format,
         ReportName,
         new List<KeyValuePair<string, object>>
         {
             new KeyValuePair<string, object>("Parameter1", "Value 1"),
             new KeyValuePair<string, object>("Parameter1", "Value 2"),
             new KeyValuePair<string, object>("Parameter2", DateTime.Now),
             new KeyValuePair<string, object>("Parameter2", DateTime.Now.AddYears(10)),
             new KeyValuePair<string, object>("Parameter3", 12345)
         });
 }
Esempio n. 17
0
 public ReportRunner(
     ReportFormat reportFormat,
     string reportPath,
     string reportServerUrl,
     string username,
     string password,
     IDictionary<string, object> reportParameters)
     : this(reportFormat, 
         reportPath, 
         reportServerUrl, 
         username, 
         password, 
         reportParameters != null ? reportParameters.ToList() : null)
 {
 }
 /// <summary>
 /// Creates a FileContentResult object by using Report Viewer Web Control.
 /// </summary>
 /// <param name="controller">The Controller instance that this method extends.</param>
 /// <param name="reportFormat">Report Viewer Web Control supported format (Excel, Word, PDF or Image)</param>
 /// <param name="reportPath">The path to the report on the server.</param>
 /// <param name="mode">Report processing mode: remote or local.</param>
 /// <param name="localReportDataSources">Local report data sources</param>
 /// <returns>The file-content result object.</returns>
 public static FileStreamResult Report(
     this Controller controller,
     ReportFormat reportFormat,
     IReportLoader reportLoader,
     ProcessingMode mode,
     IEnumerable<IDataSource> reportDataSources = null,
     IEnumerable<ISubReportDataSource> subReportDataSources = null)
 {
     var reportRunner = new ReportRunner(
         reportFormat,
         reportLoader,
         mode,
         reportDataSources,
         subReportDataSources);
     return reportRunner.Run();
 }
Esempio n. 19
0
        public SizeInfo(IReport rpt, ReportFormat.PageType pageType)
        {
            this.report = rpt;
            double tempValue = 0;
            //PageSize
            switch (pageType)
            {
                case ReportFormat.PageType.A3:
                    this.pageWidth = 420;
                    this.pageHeight = 297;
                    break;
                case ReportFormat.PageType.A4:
                    this.pageWidth = 210;
                    this.pageHeight = 297;
                    break;
                case ReportFormat.PageType.B4:
                    this.pageWidth = 257;
                    this.pageHeight = 364;
                    break;
                case ReportFormat.PageType.B5:
                    this.pageWidth = 182;
                    this.pageHeight = 257;
                    break;
                case ReportFormat.PageType.Letter:
                    this.pageWidth = 176;
                    this.pageHeight = 125;
                    break;
            }

            if (rpt.Format.Orientation == Orientation.Horizontal)
            {
                tempValue = this.pageWidth;
                this.pageWidth = this.pageHeight;
                this.pageHeight = tempValue;
            }

            this.pageWidth = UnitConversion.MMToPound(this.pageWidth);
            this.pageHeight = UnitConversion.MMToPound(this.pageHeight);

            this.currentDetailHeight = 0;
            this.detailCaptionHeight = 0;
            this.detailRowHeight = 0;
            this.foldedRowCount = 1;
            this.sheetWidth = GetSheetWidth();
            this.fieldColumnCount = this.sheetWidth;
            //this.totalPageCount = GetTotalPageCount();
        }
Esempio n. 20
0
		public byte[] GetPropertyAppraisalReceiptReport(int orderId, string borrowerFirstName, string borrowerLastName, string creditCardType, string transactionId, string street, string zip, string state, string city, ReportFormat format)
		{
			var parameters = new ES.ParameterValue[]
			{
				new ES.ParameterValue { Label = "orderId", Name = "orderId", Value = orderId.ToString()},
			  new ES.ParameterValue { Label = "borrowerFirstName", Name = "borrowerFirstName", Value = borrowerFirstName},
				new ES.ParameterValue { Label = "borrowerLastName", Name = "borrowerLastName", Value = borrowerLastName},
				new ES.ParameterValue { Label = "creditCardType", Name = "creditCardType", Value = creditCardType},
				new ES.ParameterValue { Label = "transactionId", Name = "transactionId", Value = transactionId},
				new ES.ParameterValue { Label = "street", Name = "street", Value = street},
				new ES.ParameterValue { Label = "zip", Name = "zip", Value = zip},
				new ES.ParameterValue { Label = "state", Name = "state", Value = state},
				new ES.ParameterValue { Label = "city", Name = "city", Value = city}
			};

			return GetReportInternal(ReportType.PropertyAppraisalReceipt, format, parameters);
		}
        /// <summary>
        /// Creates a FileContentResult object by using Report Viewer Web Control.
        /// </summary>
        /// <param name="controller">The Controller instance that this method extends.</param>
        /// <param name="reportFormat">Report Viewer Web Control supported format (Excel, Word, PDF or Image)</param>
        /// <param name="reportPath">The path to the report on the server.</param>
        /// <param name="reportParameters">The report parameter properties for the report.</param>
        /// <param name="mode">Report processing mode: remote or local.</param>
        /// <param name="localReportDataSources">Local report data sources</param>
        /// <returns>The file-content result object.</returns>
        public static FileStreamResult Report(
            this Controller controller,
            ReportFormat reportFormat,
            string reportPath,
            IEnumerable<KeyValuePair<string, object>> reportParameters,
            ProcessingMode mode = ProcessingMode.Remote,
            IDictionary<string, DataTable> localReportDataSources = null)
        {
            var reportRunner = new ReportRunner(
                reportFormat,
                reportPath,
                reportParameters,
                mode,
                localReportDataSources);

            return reportRunner.Run();
        }
        /// <summary>
        /// Creates a FileContentResult object by using Report Viewer Web Control.
        /// </summary>
        /// <param name="controller">The Controller instance that this method extends.</param>
        /// <param name="reportFormat">Report Viewer Web Control supported format (Excel, Word, PDF or Image)</param>
        /// <param name="reportPath">The path to the report on the server.</param>
        /// <param name="reportParameters">The report parameter properties for the report.</param>
        /// <param name="mode">Report processing mode: remote or local.</param>
        /// <param name="localReportDataSources">Local report data sources</param>
        /// <returns>The file-content result object.</returns>
        public static FileStreamResult Report(
            this Controller controller,
            ReportFormat reportFormat,
            string reportPath,
            object reportParameters,
            ProcessingMode mode = ProcessingMode.Remote,
            IDictionary<string, DataTable> localReportDataSources = null)
        {
            var reportRunner = new ReportRunner(
                reportFormat,
                reportPath,
                HtmlHelper.AnonymousObjectToHtmlAttributes(reportParameters),
                mode,
                localReportDataSources);

            return reportRunner.Run();
        }
Esempio n. 23
0
        public ReportRunner(
            ReportFormat reportFormat,
            string reportPath,
            string reportServerUrl,
            string username,
            string password,
            IEnumerable<KeyValuePair<string, object>> reportParameters)
        {
            _reportFormat = reportFormat;
            _viewerParameters.ReportPath = reportPath;
            _viewerParameters.ReportServerUrl = reportServerUrl ?? _viewerParameters.ReportServerUrl;
            if (username != null || password != null)
            {
                _viewerParameters.Username = username;
                _viewerParameters.Password = password;
            }

            ParseParameters(reportParameters);
        }
        /// <summary>
        /// Creates a FileContentResult object by using Report Viewer Web Control.
        /// </summary>
        /// <param name="controller">The Controller instance that this method extends.</param>
        /// <param name="reportFormat">Report Viewer Web Control supported format (Excel, Word, PDF or Image)</param>
        /// <param name="reportPath">The path to the report on the server.</param>
        /// <param name="reportParameters">The report parameter properties for the report.</param>
        /// <param name="mode">Report processing mode: remote or local.</param>
        /// <param name="localReportDataSources">Local report data sources</param>
        /// <returns>The file-content result object.</returns>
        public static FileStreamResult Report(
            this Controller controller,
            ReportFormat reportFormat,
            IReportLoader reportLoader,
            IEnumerable<KeyValuePair<string, object>> reportParameters,
            ProcessingMode mode,
            IEnumerable<IDataSource> reportDataSources = null,
            IEnumerable<ISubReportDataSource> subReportDataSources = null)
        {
            var reportRunner = new ReportRunner(
                reportFormat,
                reportLoader,
                reportParameters,
                mode,
                reportDataSources,
                subReportDataSources);

            return reportRunner.Run();
        }
        /// <summary>
        /// Creates a FileContentResult object by using Report Viewer Web Control.
        /// </summary>
        /// <param name="controller">The Controller instance that this method extends.</param>
        /// <param name="reportFormat">Report Viewer Web Control supported format (Excel, Word, PDF or Image)</param>
        /// <param name="reportPath">The path to the report on the server.</param>
        /// <param name="reportServerUrl">The URL for the report server.</param>
        /// <param name="username">The report server username.</param>
        /// <param name="password">The report server password.</param>
        /// <param name="reportParameters">The report parameter properties for the report.</param>
        /// <returns>The file-content result object.</returns>
        public static FileStreamResult Report(
            this Controller controller,
            ReportFormat reportFormat,
            string reportPath,
            string reportServerUrl,
            string username = null,
            string password = null,
            object reportParameters = null)
        {
            var reportRunner = new ReportRunner(
                reportFormat,
                reportPath,
                reportServerUrl,
                username,
                password,
                HtmlHelper.AnonymousObjectToHtmlAttributes(reportParameters));

            return reportRunner.Run();
        }
        /// <summary>
        /// Creates a FileContentResult object by using Report Viewer Web Control.
        /// </summary>
        /// <param name="controller">The Controller instance that this method extends.</param>
        /// <param name="reportFormat">Report Viewer Web Control supported format (Excel, Word, PDF or Image)</param>
        /// <param name="reportPath">The path to the report on the server.</param>
        /// <param name="reportParameters">The report parameter properties for the report.</param>
        /// <param name="mode">Report processing mode: remote or local.</param>
        /// <param name="localReportDataSources">Local report data sources</param>
        /// <returns>The file-content result object.</returns>
        public static FileStreamResult Report(
            this Controller controller,
            ReportFormat reportFormat,
            IReportLoader reportLoader,
            object reportParameters,
            ProcessingMode mode,
            IEnumerable<IDataSource> reportDataSources = null,
            IEnumerable<ISubReportDataSource> subReportDataSources = null)
        {
            var reportRunner = new ReportRunner(
                reportFormat,
                reportLoader,
                HtmlHelper.AnonymousObjectToHtmlAttributes(reportParameters),
                mode,
                reportDataSources,
                subReportDataSources);

            return reportRunner.Run();
        }
Esempio n. 27
0
 public ReportRunner(
     ReportFormat reportFormat,
     string reportPath,
     string reportServerUrl,
     string username,
     string password,
     IDictionary<string, object> reportParameters,
     ProcessingMode mode = ProcessingMode.Remote,
     IDictionary<string, DataTable> localReportDataSources = null,
     string filename = null)
     : this(reportFormat, 
         reportPath, 
         reportServerUrl, 
         username, 
         password, 
         reportParameters?.ToList(),
         mode,
         localReportDataSources,
         filename)
 {
 }
Esempio n. 28
0
        private ActionResult DownloadReport(ReportFormat format, bool isLocalReport, string filename = null)
        {
            if (isLocalReport)
            {
                return this.Report(
                    format,
                    LocalReportName,
                    new { Parameter1 = "Test", Parameter2 = 123 },
                    ProcessingMode.Local,
                    new Dictionary<string, DataTable>
                    {
                        { "Products", LocalData.GetProducts() },
                        { "Cities", LocalData.GetCities() }
                    },
                    filename);
            }

            return this.Report(
                format,
                RemoteReportName,
                new { Parameter1 = "Hello World!", Parameter2 = DateTime.Now, Parameter3 = 12345, Parameter4 = (DateTime?)null },
                filename: filename);
        }
Esempio n. 29
0
        public static string GetFullFileName(string fileName, ReportFormat.ExportType exportFormat)
        {
            string filePrefix = String.Empty;

            if (fileName != String.Empty)
            {
                filePrefix = fileName.Split('.')[0];
            }
            else
            {
                filePrefix = fileName;
            }

            switch (exportFormat)
            {
                case ReportFormat.ExportType.Excel:
                    if (filePrefix.IndexOf(FileSuffix.ExcelFileSuffix, StringComparison.CurrentCultureIgnoreCase) == -1)
                    {
                        return filePrefix + FileSuffix.ExcelFileSuffix;
                    }
                    else
                    {
                        return fileName;
                    }
                case ReportFormat.ExportType.Pdf:
                    if (filePrefix.IndexOf(FileSuffix.Pdf, StringComparison.CurrentCultureIgnoreCase) == -1)
                    {
                        return filePrefix + FileSuffix.Pdf;
                    }
                    else
                    {
                        return fileName;
                    }
            }

            return String.Empty;
        }
Esempio n. 30
0
 string IReportBuilder.GetFilename(IReport report, ReportFormat reportFormat)
 {
     return(GetFilename(report, reportFormat));
 }
Esempio n. 31
0
            /// <summary>
            /// Parses the settings string into its configuration settings.
            /// </summary>
            /// <param name="settings"></param>
            private void ParseSettings(string settings)
            {
                XmlDocument doc = new XmlDocument();

                doc.LoadXml(settings);

                // Get whether reporting is enabled.
                enabled = Boolean.Parse(doc.DocumentElement.GetAttribute("enabled"));
                if (Enabled)
                {
                    // Get the frequency of the report generation.
                    XmlElement element = doc.DocumentElement.SelectSingleNode("generate") as XmlElement;
                    if (element != null)
                    {
                        string s = element.GetAttribute("frequency");
                        if (s != String.Empty)
                        {
                            frequency = ( ReportFrequency )Enum.Parse(
                                typeof(ReportFrequency),
                                s,
                                true);
                        }
                        else
                        {
                            log.Error("Invalid report settings format. No frequency attribute was specified.");
                        }
                    }
                    else
                    {
                        log.Error("Invalid report settings format. No generate element was specified.");
                    }


                    // All frequencies will have a time specified.
                    XmlElement child = element.SelectSingleNode("time") as XmlElement;
                    if (child != null)
                    {
                        DateTime dt = DateTime.Parse(child.InnerText);
                        timeOfDay = new TimeSpan(dt.Hour, dt.Minute, 0);
                    }
                    else
                    {
                        log.Error("Invalid report settings format. No time element was specified.");
                    }

                    // Depending on the frequency type, the time parameters will be different.
                    switch (frequency)
                    {
                    case ReportFrequency.Daily:
                        break;

                    case ReportFrequency.Weekly:
                        // Get the day of the week.
                        child = element.SelectSingleNode("dayofweek") as XmlElement;
                        if (child != null)
                        {
                            weekday = ( DayOfWeek )Enum.Parse(typeof(DayOfWeek), child.InnerText, true);
                        }
                        else
                        {
                            log.Error("Invalid report settings format. No day of week element was specified.");
                        }
                        break;

                    case ReportFrequency.Monthly:
                        // Get the day of the month.
                        child = element.SelectSingleNode("dayofmonth") as XmlElement;
                        if (child != null)
                        {
                            dayOfMonth = Convert.ToInt32(child.InnerText);
                        }
                        else
                        {
                            log.Error("Invalid report settings format. No day of month element was specified.");
                        }
                        break;
                    }

                    // Get the report location information.
                    element = doc.DocumentElement.SelectSingleNode("location") as XmlElement;
                    if (element != null)
                    {
                        isiFolder = (element.InnerText == "ifolder") ? true : false;
                    }
                    else
                    {
                        log.Error("Invalid report settings format. No location element was specified.");
                    }

                    // Get the report format.
                    element = doc.DocumentElement.SelectSingleNode("format") as XmlElement;
                    if (element != null)
                    {
                        format = ( ReportFormat )Enum.Parse(typeof(ReportFormat), element.InnerText, true);
                    }
                    else
                    {
                        log.Error("Invalid report settings format. No format element was specified.");
                    }
                }
            }
Esempio n. 32
0
 public ReportFormat UpdateReportFormat(ReportFormat reportFormat)
 {
     throw new NotSupportedException();
 }
Esempio n. 33
0
        private void FormatReport(MovimientosStockListPorExpedienteRpt rpt, ReportFilter filter, ReportFormat format)
        {
            switch (format.Vista)
            {
            case EReportVista.Detallado:
            {
                rpt.HeaderDetallado.SectionFormat.EnableSuppress      = false;
                rpt.HeaderResumido.SectionFormat.EnableSuppress       = true;
                rpt.FooterExpediente.SectionFormat.EnableNewPageAfter = true;

                rpt.Subreports["StocksSubReport"].ReportDefinition.Sections["HeaderDetallado"].SectionFormat.EnableSuppress = false;
                rpt.Subreports["StocksSubReport"].ReportDefinition.Sections["Detalle"].SectionFormat.EnableSuppress         = false;
                rpt.Subreports["StocksSubReport"].ReportDefinition.Sections["FooterDetallado"].SectionFormat.EnableSuppress = false;
                rpt.Subreports["StocksSubReport"].ReportDefinition.Sections["FooterResumido"].SectionFormat.EnableSuppress  = true;
            }
            break;

            case EReportVista.Resumido:
            {
                rpt.HeaderDetallado.SectionFormat.EnableSuppress      = true;
                rpt.HeaderResumido.SectionFormat.EnableSuppress       = false;
                rpt.FooterExpediente.SectionFormat.EnableNewPageAfter = false;

                rpt.Subreports["StocksSubReport"].ReportDefinition.Sections["HeaderDetallado"].SectionFormat.EnableSuppress = true;
                rpt.Subreports["StocksSubReport"].ReportDefinition.Sections["Detalle"].SectionFormat.EnableSuppress         = true;
                rpt.Subreports["StocksSubReport"].ReportDefinition.Sections["FooterDetallado"].SectionFormat.EnableSuppress = true;
                rpt.Subreports["StocksSubReport"].ReportDefinition.Sections["FooterResumido"].SectionFormat.EnableSuppress  = false;
            }
            break;
            }

            rpt.ReportDefinition.ReportObjects["FacturaLB"].ObjectFormat.EnableSuppress        = filter.SoloMermas;
            rpt.ReportDefinition.ReportObjects["AlbaranLB"].ObjectFormat.EnableSuppress        = filter.SoloMermas;
            rpt.ReportDefinition.ReportObjects["BultosActualesLB"].ObjectFormat.EnableSuppress = filter.SoloMermas;
            rpt.ReportDefinition.ReportObjects["KgActualesLB"].ObjectFormat.EnableSuppress     = filter.SoloMermas;
            rpt.Subreports["StocksSubReport"].ReportDefinition.ReportObjects["Albaran_TB"].ObjectFormat.EnableSuppress        = filter.SoloMermas;
            rpt.Subreports["StocksSubReport"].ReportDefinition.ReportObjects["Factura_TB"].ObjectFormat.EnableSuppress        = filter.SoloMermas;
            rpt.Subreports["StocksSubReport"].ReportDefinition.ReportObjects["BultosActuales_TB"].ObjectFormat.EnableSuppress = filter.SoloMermas;
            rpt.Subreports["StocksSubReport"].ReportDefinition.ReportObjects["KilosActuales_TB"].ObjectFormat.EnableSuppress  = filter.SoloMermas;
        }
Esempio n. 34
0
        public StockLineListRpt GetStockLineList(StockList list, ReportFilter filter, ReportFormat format)
        {
            StockLineListRpt doc = new StockLineListRpt();

            //Si no existen elementos no tiene sentido un informe detallado. Además, falla en Crystal Reports
            if (list.Count <= 0)
            {
                return(null);
            }

            List <StockPrint> print_list = new List <StockPrint>();

            foreach (StockInfo item in list)
            {
                print_list.Add(StockPrint.New(item));
            }

            doc.SetDataSource(print_list);

            FormatHeader(doc);
            FormatReport(doc, filter, format);

            return(doc);
        }
Esempio n. 35
0
 protected virtual string GetFilename(IReport report, ReportFormat reportFormat)
 {
     return(report.GetFilename(this.GetFileExtension(reportFormat)));
 }
Esempio n. 36
0
 /// <summary>
 /// Creates a report format.
 /// </summary>
 /// <param name="reportFormat">The report format to create.</param>
 /// <returns>Returns the created report format.</returns>
 public ReportFormat CreateReportFormat(ReportFormat reportFormat)
 {
     return(this.Client.Post <ReportFormat, ReportFormat>("format", reportFormat));
 }
 protected OrderQuickReportsViewModel(Order selectedOrder, ReportFormat format)
 {
     Format        = format;
     SelectedOrder = selectedOrder;
 }
Esempio n. 38
0
 string IReportBuilder.GetContentType(ReportFormat reportFormat)
 {
     return(GetContentType(reportFormat));
 }
Esempio n. 39
0
 byte[] IReportBuilder.Save(ReportFormat reportFormat)
 {
     return(Save(reportFormat));
 }
Esempio n. 40
0
 protected abstract string GetContentType(ReportFormat reportFormat);
Esempio n. 41
0
 /// <summary>
 /// Creates a report format.
 /// </summary>
 /// <param name="reportFormat">The report format to create.</param>
 /// <returns>Returns the created report format.</returns>
 public ReportFormat CreateReportFormat(ReportFormat reportFormat)
 {
     return(this.reportExecutor.CreateReportFormat(reportFormat));
 }
 public XslReportCreator(ReportFormat format)
 {
     _format = format;
 }
Esempio n. 43
0
        public MovimientosStockListPorExpedienteRpt GetMovimientosStockListAgrupado(ExpedienteList items,
                                                                                    ProductInfo producto,
                                                                                    SerieInfo serie,
                                                                                    ReportFilter filter,
                                                                                    ReportFormat format)
        {
            MovimientosStockListPorExpedienteRpt doc = new MovimientosStockListPorExpedienteRpt();
            List <ExpedientePrint> pList             = new List <ExpedientePrint>();
            List <StockPrint>      movs = new List <StockPrint>();
            StockList stocks            = null;

            int movsCount = 0;

            foreach (ExpedientInfo item in items)
            {
                if (filter.SoloStock)
                {
                    if ((item.StockKilos == 0) || (item.StockBultos == 0))
                    {
                        continue;
                    }
                }

                movsCount = movs.Count;
                stocks    = (item.Stocks == null) ? StockList.GetListByExpediente(item.Oid, false) : item.Stocks;
                foreach (StockInfo stock in stocks)
                {
                    if (filter.SoloMermas)
                    {
                        if ((stock.OidAlbaran != 0) || (stock.Kilos >= 0))
                        {
                            continue;
                        }
                    }

                    if ((filter.FechaIni <= stock.Fecha) && (stock.Fecha <= filter.FechaFin))
                    {
                        if ((producto == null) && (serie == null))
                        {
                            movs.Add(StockPrint.New(stock));
                        }
                        else if (producto != null)
                        {
                            if ((producto.Oid == stock.OidProducto) && (serie == null))
                            {
                                movs.Add(StockPrint.New(stock));
                            }
                            else if ((producto.Oid == stock.OidProducto) && (serie.Oid == stock.OidSerie))
                            {
                                movs.Add(StockPrint.New(stock));
                            }
                        }
                        else if (serie.Oid == stock.OidSerie)
                        {
                            movs.Add(StockPrint.New(stock));
                        }
                    }
                }

                if (movsCount < movs.Count)
                {
                    pList.Add(item.GetPrintObject());
                }
            }

            //Si no existen conceptos, no tiene sentido un informe detallado. Además, falla en Crystal Reports
            if (movs.Count <= 0)
            {
                return(null);
            }

            doc.SetDataSource(pList);
            doc.Subreports["StocksSubReport"].SetDataSource(movs);

            FormatHeader(doc);
            FormatReport(doc, filter, format);

            return(doc);
        }
        /// <summary>
        /// Obtiene el tablero de control en formato pdf o excel
        /// </summary>
        /// <param name="delegation">Delegación donde se consultara el tablero de control</param>
        /// <param name="nameChildCareCenter">Nombre de la estancia donde se consultaran el tablero de control</param>
        /// <param name="typeChildCareCenter">Tipo de la estancia donde se consultara el tablero de control</param>
        /// <param name="operador">Operador que realiza el proceso</param>
        /// <param name="starDate">Limite inferior para la consulta del tablero de control</param>
        /// <param name="endDate">Limite superior para la consulta del tablero de control</param>s
        /// <param name="data">Objeto con la información con la cual se construye el tablero de control</param>
        /// <param name="format">Indica el formato de salida deseado (pdf o excel)</param>
        /// <returns>Arreglo de bytes con el tablero generado</returns>
        public byte[] GetDashboardEbdis(string delegation, string nameChildCareCenter, string typeChildCareCenter, string operador,
                                        string starDate, string endDate, DashboardData data, ReportFormat format)
        {
            var report = BuildEbdisDashboard(delegation, nameChildCareCenter, typeChildCareCenter, operador, starDate, endDate, data);

            var dashboard = report.ExportToStream(format == ReportFormat.Excel ? ExportFormatType.Excel : ExportFormatType.PortableDocFormat);

            using (MemoryStream ms = new MemoryStream())
            {
                dashboard.CopyTo(ms);

                return(ms.ToArray());
            }
        }
Esempio n. 45
0
 public static IReporter Create(ReportFormat format) => format switch
 {
        /// <summary>
        /// Obtiene el certificado de uso de  salas en *.pdf o *.xls
        /// </summary>
        /// <param name="delegation">Delegación donde se consultara el certificado de uso de salas</param>
        /// <param name="nameChildCareCenter">Nombre de la estancia donde se consultaran las salas</param>
        /// <param name="operador">Operardor que realiza el proceso</param>
        /// <param name="city">Ciudada donde se encuantra la estancia</param>
        /// <param name="cycle">Ciclo a consultar</param>
        /// <param name="capacity">Capacidad instalada de la estancia</param>
        /// <param name="listRoom">lista de salas</param>
        /// <param name="format">formato del reporte</param>
        /// <returns>Arreglo de bytes con el certificado de uso de salas generado</returns>
        public byte[] GetCertificateUseRoom(string delegation, string nameChildCareCenter, string operador, string city, string cycle,
                                            int capacity, IEnumerable <CertificateRoom> listRoom, ReportFormat format)
        {
            var report = BuildEbdisCertificateUseRoom(delegation, nameChildCareCenter, operador, city, cycle, capacity, listRoom);

            var certificate = report.ExportToStream(format == ReportFormat.Excel ? ExportFormatType.Excel : ExportFormatType.PortableDocFormat);

            using (MemoryStream ms = new MemoryStream())
            {
                certificate.CopyTo(ms);

                return(ms.ToArray());
            }
        }
        /// <summary>
        /// Obtiene el reporte de indicadores en formato pdf o excel
        /// </summary>
        /// <param name="delegation">Delegación donde se consultaran los indicadores</param>
        /// <param name="operador">Operador que realiza el proceso</param>
        /// <param name="starDate">Limite inferior para la consulta de los indicadores</param>
        /// <param name="endDate">Limite superior para la consulta de los indicadores</param>
        /// <param name="documentationRuledInTime">Numero de tramites dictaminados en tiempo</param>
        /// <param name="acceptedRequests">Número de solicitudes aceptadas</param>
        /// <param name="rejectedRequests">Número de solicitudes rechazadas</param>
        /// <param name="totalReceivedRequests">Numero total de solicitudes recibidos</param>
        /// <param name="pitsSoldViaWeb">Número de fosas vendida vía web</param>
        /// <param name="requestsInTime">Numero trámites realizados en el tiempo establecido</param>
        /// <param name="documentationRuleTimes">Lista con  (Fecha dictaminación documentación - Fecha de recepción de documentación) </param>
        /// <param name="format">Indica el formato de salida deseado</param>
        /// <returns>Arreglo de bytes con el reporte generado</returns>
        public byte[] GetIndicatorsPitStream(string delegation, string operador, string starDate, string endDate,
                                             int documentationRuledInTime, int acceptedRequests, int rejectedRequests, int totalReceivedRequests, int pitsSoldViaWeb,
                                             int requestsInTime, IEnumerable <int> documentationRuleTimes, ReportFormat format)
        {
            var report = BuildPitIndicators(delegation, operador, starDate, endDate, documentationRuledInTime, acceptedRequests, rejectedRequests, totalReceivedRequests,
                                            pitsSoldViaWeb, requestsInTime, documentationRuleTimes);



            var PitIndicators = report.ExportToStream(format == ReportFormat.Excel ? ExportFormatType.Excel : ExportFormatType.PortableDocFormat);

            using (MemoryStream ms = new MemoryStream())
            {
                PitIndicators.CopyTo(ms);
                return(ms.ToArray());
            }
        }
Esempio n. 48
0
 public static OrderQuickReportsViewModel Create(Order selectedOrder, ReportFormat format)
 {
     return(ViewModelSource.Create(() => new OrderQuickReportsViewModel(selectedOrder, format)));
 }
Esempio n. 49
0
        public static CsvReportRecordReader CreateReportRecordReader(string filePath, ReportFormat format)
        {
            switch (format)
            {
            case ReportFormat.Csv:
                return(new CsvReportRecordReader(
                           new FileStream(filePath, FileMode.Open), ','));

            case ReportFormat.Tsv:
                return(new CsvReportRecordReader(
                           new FileStream(filePath, FileMode.Open), '\t'));
            }

            return(null);
        }
Esempio n. 50
0
 protected abstract byte[] Save(ReportFormat reportFormat);
 public RowReportStreamReader(string filePath, ReportFormat format)
 {
     csvReportRecordReader = RowReportRecordReaderFactory.CreateReportRecordReader(filePath, format);
     recordReader          = new RowReportRecordReader(csvReportRecordReader);
 }
Esempio n. 52
0
 protected abstract string GetFileExtension(ReportFormat reportFormat);
Esempio n. 53
0
 void BindGalleryQuickReportsFormatItem(int index, ReportFormat parameter)
 {
     galleryQuickReports.Gallery.Groups[0].Items[index].BindCommand(() => ViewModel.QuickReportFormat(parameter), ViewModel, () => parameter);
 }
Esempio n. 54
0
 string IReportBuilder.GetFileExtension(ReportFormat reportFormat)
 {
     return(GetFileExtension(reportFormat));
 }
Esempio n. 55
0
 public bool CanQuickReport(ReportFormat format)
 {
     return(SelectedEntity != null);
 }
Esempio n. 56
0
 /// <summary>
 /// Updates a report format.
 /// </summary>
 /// <param name="id">The id of the report format to update.</param>
 /// <param name="reportFormat">The updated report format.</param>
 /// <returns>Returns the update report format.</returns>
 public ReportFormat UpdateReportFormat(Guid id, ReportFormat reportFormat)
 {
     return(this.Client.Put <ReportFormat, ReportFormat>($"format/{id}", reportFormat));
 }
Esempio n. 57
0
        /// <summary>
        /// Update an existing scheduled report
        /// </summary>
        /// <param name="idReport">The ID of the report to update</param>
        /// <param name="idSite">ID of the piwik site</param>
        /// <param name="description">Description of the report</param>
        /// <param name="period">A piwik period</param>
        /// <param name="hour">Defines the hour at which the report will be sent</param>
        /// <param name="reportType">The report type</param>
        /// <param name="reportFormat">The report format</param>
        /// <param name="includedStatistics">The included statistics</param>
        /// <param name="emailMe">true if the report should be sent to the own user</param>
        /// <param name="additionalEmails">A string array of additional email recipients</param>
        /// <returns>True if update was successful</returns>
        public Boolean updateReport(
            int idReport,
            int idSite,
            string description,
            PiwikPeriod period,
            int hour,
            ReportType reportType,
            ReportFormat reportFormat,
            List<Statistic> includedStatistics,
            Boolean emailMe,
            string[] additionalEmails = null
            )
        {
            Dictionary<string, Object> additionalParameters = new Dictionary<string, Object>()
            {
                { "emailMe", emailMe.ToString().ToLower() },
                { "displayFormat", 1 },
                { "additionalEmails", additionalEmails }
            };

            Parameter[] p = 
            {
                new SimpleParameter("idReport", idReport),
                new SimpleParameter("idSite", idSite),
                new SimpleParameter("description", description),
                new PeriodParameter("period", period),
                new SimpleParameter("hour", hour),
                new SimpleParameter("reportType", reportType.ToString()),
                new SimpleParameter("reportFormat", reportFormat.ToString()),                                
                new ArrayParameter("reports", includedStatistics.Select(i => i.ToString()).ToArray(), false),
                new DictionaryParameter("parameters", additionalParameters)
            };

            return this.sendRequest<Boolean>("updateReport", new List<Parameter>(p));
        }
        static ReportFormatTest()
        {
            ConstructorArgumentValidationTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new ConstructorArgumentValidationTestScenario <ReportFormat>
            {
                Name             = "constructor should throw ArgumentException when parameter 'displayTimestamp' is false and parameter 'timestampFormat' is not null",
                ConstructionFunc = () =>
                {
                    var result = new ReportFormat(
                        false,
                        A.Dummy <DateTimeFormat>());

                    return(result);
                },
                ExpectedExceptionType            = typeof(ArgumentException),
                ExpectedExceptionMessageContains = new[] { "displayTimestamp is false, but timestampFormat is not null", },
            });

            EquatableTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
            {
                var referenceObjectForEquatableTestScenarios = A.Dummy <ReportFormat>().Whose(_ => _.DisplayTimestamp == true);

                var result = new EquatableTestScenario <ReportFormat>
                {
                    Name            = "Default Code Generated Scenario",
                    ReferenceObject = referenceObjectForEquatableTestScenarios,
                    ObjectsThatAreEqualToButNotTheSameAsReferenceObject = new ReportFormat[]
                    {
                        new ReportFormat(
                            referenceObjectForEquatableTestScenarios.DisplayTimestamp,
                            referenceObjectForEquatableTestScenarios.TimestampFormat,
                            referenceObjectForEquatableTestScenarios.Options),
                    },
                    ObjectsThatAreNotEqualToReferenceObject = new ReportFormat[]
                    {
                        new ReportFormat(
                            A.Dummy <ReportFormat>().Whose(_ => !_.DisplayTimestamp.IsEqualTo(referenceObjectForEquatableTestScenarios.DisplayTimestamp)).DisplayTimestamp,
                            null),
                        new ReportFormat(
                            referenceObjectForEquatableTestScenarios.DisplayTimestamp,
                            A.Dummy <ReportFormat>().Whose(_ => !_.TimestampFormat.IsEqualTo(referenceObjectForEquatableTestScenarios.TimestampFormat)).TimestampFormat),
                        new ReportFormat(
                            referenceObjectForEquatableTestScenarios.DisplayTimestamp,
                            referenceObjectForEquatableTestScenarios.TimestampFormat,
                            A.Dummy <ReportFormat>().Whose(_ => !_.Options.IsEqualTo(referenceObjectForEquatableTestScenarios.Options)).Options),
                    },
                    ObjectsThatAreNotOfTheSameTypeAsReferenceObject = new object[]
                    {
                        A.Dummy <object>(),
                        A.Dummy <string>(),
                        A.Dummy <int>(),
                        A.Dummy <int?>(),
                        A.Dummy <Guid>(),
                    },
                };

                return(result);
            });

            DeepCloneWithTestScenarios
            .RemoveAllScenarios()
            .AddScenario(() =>
                         new DeepCloneWithTestScenario <ReportFormat>
            {
                Name             = "DeepCloneWithTimestampFormat should deep clone object and replace TimestampFormat with the provided timestampFormat",
                WithPropertyName = "TimestampFormat",
                SystemUnderTestDeepCloneWithValueFunc = () =>
                {
                    var systemUnderTest = A.Dummy <ReportFormat>().Whose(_ => _.DisplayTimestamp == true);

                    var referenceObject = A.Dummy <ReportFormat>().ThatIs(_ => !systemUnderTest.TimestampFormat.IsEqualTo(_.TimestampFormat));

                    var result = new SystemUnderTestDeepCloneWithValue <ReportFormat>
                    {
                        SystemUnderTest    = systemUnderTest,
                        DeepCloneWithValue = referenceObject.TimestampFormat,
                    };

                    return(result);
                },
            })
            .AddScenario(() =>
                         new DeepCloneWithTestScenario <ReportFormat>
            {
                Name             = "DeepCloneWithOptions should deep clone object and replace Options with the provided options",
                WithPropertyName = "Options",
                SystemUnderTestDeepCloneWithValueFunc = () =>
                {
                    var systemUnderTest = A.Dummy <ReportFormat>();

                    var referenceObject = A.Dummy <ReportFormat>().ThatIs(_ => !systemUnderTest.Options.IsEqualTo(_.Options));

                    var result = new SystemUnderTestDeepCloneWithValue <ReportFormat>
                    {
                        SystemUnderTest    = systemUnderTest,
                        DeepCloneWithValue = referenceObject.Options,
                    };

                    return(result);
                },
            });
        }