/// <summary> /// Constructor. /// </summary> /// <param name="velocityEngine">The velocity engine</param> /// <param name="velocityContext">The current velocity context.</param> /// <param name="reportWriter">The report writer</param> /// <param name="templatePath">The template path.</param> /// <param name="contentType">The content type of the report.</param> /// <param name="extension">The extension of the report file.</param> /// <param name="helper">The formatting helper class.</param> /// <param name="pageSize">The number of test steps displayed in one page.</param> public MultipleFilesVtlReportWriter(VelocityEngine velocityEngine, VelocityContext velocityContext, IReportWriter reportWriter, string templatePath, string contentType, string extension, FormatHelper helper, int pageSize) : base(velocityEngine, velocityContext, reportWriter, templatePath, contentType, extension, helper) { if (pageSize <= 0) throw new ArgumentOutOfRangeException("size", "Must be greater than zero."); this.pageSize = pageSize; }
public HtmlReporter(IHtmlReportConfiguration configuration, IReportBuilder builder, IReportWriter writer, IFileReader reader) { _configuration = configuration; _builder = builder; _writer = writer; _fileReader = reader; }
public ReportTasks(TextWriter writer, IReportOptionsFactory report_options_factory, IConcernReportFactory concern_report_factory, ITestReportFactory test_report_factory, IReportWriter report_writer) { this.writer = writer; this.report_options_factory = report_options_factory; this.concern_report_factory = concern_report_factory; this.test_report_factory = test_report_factory; this.report_writer = report_writer; }
public TestableHtmlReporter(IHtmlReportConfiguration configuration, IReportBuilder reportBuilder, IReportWriter writer, IFileReader fileReader) : base(configuration, reportBuilder, writer, fileReader) { Configuration = configuration; ReportBuilder = reportBuilder; Writer = writer; FileReader = fileReader; Configuration.RunsOn(Arg.Any<Story>()).Returns(true); }
/// <inheritdoc /> public VelocityContext CreateVelocityContext(IReportWriter reportWriter, FormatHelper helper) { var context = new VelocityContext(); context.Put("report", reportWriter.Report); var root = reportWriter.Report.TestPackageRun == null ? null : reportWriter.Report.TestPackageRun.RootTestStepRun; context.Put("tree", TestStepRunNode.BuildTreeFromRoot(root)); context.Put("helper", helper); context.Put("resourceRoot", reportWriter.ReportContainer.ReportName); context.Put("passed", TestStatus.Passed); context.Put("failed", TestStatus.Failed); context.Put("skipped", TestStatus.Skipped); context.Put("inconclusive", TestStatus.Inconclusive); context.Put("pagingEnabled", false); context.Put("pageIndex", 0); context.Put("pageSize", 0); context.Put("pageCount", 1); return context; }
/// <inheritdoc /> public override void Format(IReportWriter reportWriter, ReportFormatterOptions formatterOptions, IProgressMonitor progressMonitor) { using (progressMonitor.BeginTask("Formatting report.", 10)) { using (MultipartMimeReportContainer archiveContainer = new MultipartMimeReportContainer(reportWriter.ReportContainer)) { string archivePath = archiveContainer.ReportName + ".mht"; reportWriter.AddReportDocumentPath(archivePath); archiveContainer.OpenArchive(archivePath); progressMonitor.Worked(0.5); DefaultReportWriter archiveWriter = new DefaultReportWriter(reportWriter.Report, archiveContainer); using (IProgressMonitor subProgressMonitor = progressMonitor.CreateSubProgressMonitor(9)) htmlReportFormatter.Format(archiveWriter, formatterOptions, subProgressMonitor); archiveContainer.CloseArchive(); progressMonitor.Worked(0.5); } } }
/// <inheritdoc /> public override void Format(IReportWriter reportWriter, ReportFormatterOptions options, IProgressMonitor progressMonitor) { AttachmentContentDisposition attachmentContentDisposition = GetAttachmentContentDisposition(options); using (progressMonitor.BeginTask("Formatting report.", 10)) { progressMonitor.SetStatus("Applying template."); ApplyTemplate(reportWriter, attachmentContentDisposition, options); progressMonitor.Worked(3); progressMonitor.SetStatus("Copying resources."); CopyResources(reportWriter); progressMonitor.Worked(2); progressMonitor.SetStatus(@""); if (attachmentContentDisposition == AttachmentContentDisposition.Link) { using (IProgressMonitor subProgressMonitor = progressMonitor.CreateSubProgressMonitor(5)) reportWriter.SaveReportAttachments(subProgressMonitor); } } }
/// <summary> /// Constructor. /// </summary> /// <param name="velocityEngine">The velocity engine</param> /// <param name="velocityContext">The current velocity context.</param> /// <param name="reportWriter">The report writer</param> /// <param name="templatePath">The template path.</param> /// <param name="contentType">The content type of the report.</param> /// <param name="extension">The extension of the report file.</param> /// <param name="helper">The formatting helper class.</param> public SingleFileVtlReportWriter(VelocityEngine velocityEngine, VelocityContext velocityContext, IReportWriter reportWriter, string templatePath, string contentType, string extension, FormatHelper helper) : base(velocityEngine, velocityContext, reportWriter, templatePath, contentType, extension, helper) { }
private void WriteDetails(IReportWriter writer, string prefix, Predicate <Account> filter) { // compute summary foreach (var securityTypeGroup in calc.GetHoldingsBySecurityType(filter)) { decimal marketValue = 0; decimal costBasis = 0; decimal gainLoss = 0; SecurityType st = securityTypeGroup.Key; string caption = prefix + Security.GetSecurityTypeCaption(st); bool foundSecuritiesInGroup = false; Security current = null; List <SecurityPurchase> bySecurity = new List <SecurityPurchase>(); foreach (SecurityPurchase i in securityTypeGroup.Value) { if (current != null && current != i.Security) { WriteSecurities(writer, bySecurity, ref marketValue, ref costBasis, ref gainLoss); bySecurity.Clear(); } current = i.Security; // only report the security group header if it has some units left in it. if (i.UnitsRemaining > 0) { if (!foundSecuritiesInGroup) { foundSecuritiesInGroup = true; // create the security type group and subtable for these securities. writer.WriteSubHeading(caption); writer.StartTable(); writer.StartColumnDefinitions(); foreach (var minwidth in new double[] { 20, //Expander 80, // Date Acquired 300, // Description 100, // Quantity 100, // Price 100, // Market Value 100, // Unit Cost 100, // Cost Basis 100, // Gain/Loss 50, // % }) { writer.WriteColumnDefinition("Auto", minwidth, double.MaxValue); } writer.EndColumnDefinitions(); WriteRowHeaders(writer); } bySecurity.Add(i); } } if (foundSecuritiesInGroup) { // write the final group of securities. WriteSecurities(writer, bySecurity, ref marketValue, ref costBasis, ref gainLoss); writer.StartFooterRow(); WriteRow(writer, true, true, FontWeights.Bold, null, "Total", null, null, null, marketValue, null, costBasis, gainLoss); // only close the table writer.EndTable(); } } }
/// <inheritdoc /> public override void Format(IReportWriter reportWriter, ReportFormatterOptions options, IProgressMonitor progressMonitor) { AttachmentContentDisposition attachmentContentDisposition = GetAttachmentContentDisposition(options); reportWriter.SaveReport(attachmentContentDisposition, progressMonitor); }
private void GenerateCategories(IReportWriter writer) { TaxCategoryCollection taxCategories = new TaxCategoryCollection(); List <TaxCategory> list = taxCategories.GenerateGroups(money, this.startDate, this.endDate); if (list == null) { writer.WriteParagraph("You have not associated any categories with tax categories."); writer.WriteParagraph("Please use the Category Properties dialog to associate tax categories then try again."); return; } writer.WriteHeading("Tax Categories"); writer.StartTable(); writer.StartColumnDefinitions(); writer.WriteColumnDefinition("auto", 100, double.MaxValue); writer.WriteColumnDefinition("auto", 100, double.MaxValue); writer.WriteColumnDefinition("auto", 100, double.MaxValue); writer.EndColumnDefinitions(); writer.StartHeaderRow(); writer.StartCell(); writer.WriteParagraph("Category"); writer.EndCell(); writer.StartCell(); writer.WriteNumber("Amount"); writer.EndCell(); writer.StartCell(); writer.WriteNumber("Tax Excempt"); writer.EndCell(); writer.EndRow(); decimal tax = GetSalesTax(); writer.StartRow(); writer.StartCell(); writer.WriteParagraph("Sales Tax"); writer.EndCell(); writer.StartCell(); writer.WriteNumber(tax.ToString("C"), FontStyles.Normal, FontWeights.Bold, null); writer.EndCell(); writer.EndRow(); foreach (TaxCategory tc in list) { writer.StartHeaderRow(); writer.StartCell(); writer.WriteParagraph(tc.Name); writer.EndCell(); writer.StartCell(); writer.EndCell(); writer.EndRow(); decimal sum = 0; IDictionary <string, List <Transaction> > groups = tc.Groups; foreach (KeyValuePair <string, List <Transaction> > subtotal in groups) { writer.StartRow(); writer.StartCell(); writer.WriteParagraph(subtotal.Key); writer.EndCell(); decimal value = 0; decimal taxExempt = 0; foreach (Transaction t in subtotal.Value) { var amount = t.Amount; if (t.Investment != null && t.Investment.Security != null && t.Investment.Security.Taxable == YesNo.No) { taxExempt += amount; } else { value += amount; } } if (tc.DefaultSign < 0) { value = value * -1; } writer.StartCell(); writer.WriteNumber(value.ToString("C")); writer.EndCell(); writer.StartCell(); if (taxExempt > 0) { writer.WriteNumber(taxExempt.ToString("C")); } writer.EndCell(); writer.EndRow(); sum += value; } writer.StartRow(); writer.StartCell(); writer.EndCell(); writer.StartCell(); writer.WriteNumber(sum.ToString("C"), FontStyles.Normal, FontWeights.Bold, null); writer.EndCell(); writer.EndRow(); } writer.EndTable(); }
private static XPathDocument SerializeReportToXPathDocument(IReportWriter reportWriter, AttachmentContentDisposition attachmentContentDisposition) { return XmlUtils.WriteToXPathDocument( xmlWriter => reportWriter.SerializeReport(xmlWriter, attachmentContentDisposition)); }
public override void WriteContent(IReportWriter w) { }
protected internal abstract void Generate(IReportWriter write);
public override void WriteContent(IReportWriter w) { w.WriteDrawing(this); }
public ScenarioReport(string assemblyName, IReportWriter writer) { _writer = writer; _queue = new ConcurrentQueue <Func <IReportWriter, Task> >(); _queue.Enqueue(rw => rw.Write(new StartReport(assemblyName, DateTimeOffset.Now))); }
private static XPathDocument SerializeReportToXPathDocument(IReportWriter reportWriter, AttachmentContentDisposition attachmentContentDisposition) { return(XmlUtils.WriteToXPathDocument( xmlWriter => reportWriter.SerializeReport(xmlWriter, attachmentContentDisposition))); }
private DiagnosticsReporter CreateSut() { _builder = Substitute.For <IReportBuilder>(); _writer = Substitute.For <IReportWriter>(); return(new DiagnosticsReporter(_builder, _writer)); }
public void Generate(IReportWriter writer) { if (doc == null) { return; } var document = view.DocumentViewer.Document; bool found = false; bool first = true; var style = new Style(typeof(Paragraph)); style.Setters.Add(new Setter(Paragraph.BackgroundProperty, Brushes.Teal)); style.Setters.Add(new Setter(Paragraph.ForegroundProperty, Brushes.White)); style.Setters.Add(new Setter(Paragraph.FontSizeProperty, 18.0)); document.Resources.Remove("HeadingStyle"); document.Resources.Add("HeadingStyle", style); foreach (XElement change in doc.Root.Elements("change")) { string version = (string)change.Attribute("version"); if (string.IsNullOrEmpty(version)) { continue; } bool match = IsSameOrOlder(previousVersion, version); if (!found && match) { writer.WriteHeading("The following changes were already installed"); found = true; } if (first && !found) { writer.WriteHeading("The following changes are now available"); first = false; } string date = (string)change.Attribute("date"); writer.WriteSubHeading(version + " " + date); foreach (string line in change.Value.Split('\r', '\n')) { string trimmed = line.Trim(); if (!string.IsNullOrEmpty(trimmed)) { FlowDocumentReportWriter fwriter = (FlowDocumentReportWriter)writer; Paragraph p = fwriter.WriteParagraph(trimmed, FontStyles.Normal, FontWeights.Normal, found ? Brushes.Gray : Brushes.Black, 11); p.TextIndent = 20; p.Margin = new Thickness(0); p.Padding = new Thickness(0); } } } if (installButton && !HasLatestVersion()) { document.Blocks.InsertAfter(document.Blocks.FirstBlock, new BlockUIContainer(CreateInstallButton())); } }
private void WriteRow(IReportWriter writer, bool expandable, bool header, FontWeight weight, DateTime?aquired, string description, string descriptionUrl, decimal?quantity, decimal?price, decimal marketValue, decimal?unitCost, decimal costBasis, decimal gainLoss) { if (header) { writer.StartHeaderRow(); } else { writer.StartRow(); } if (expandable) { writer.StartCell(); writer.EndCell(); } writer.StartCell(); if (aquired.HasValue) { writer.WriteParagraph(aquired.Value.ToShortDateString(), FontStyles.Normal, weight, null); } writer.EndCell(); writer.StartCell(); writer.WriteParagraph(description, FontStyles.Normal, weight, null); if (!string.IsNullOrEmpty(descriptionUrl)) { FlowDocumentReportWriter fw = (FlowDocumentReportWriter)writer; Paragraph p = fw.CurrentParagraph; p.Tag = descriptionUrl; p.PreviewMouseLeftButtonDown += OnReportCellMouseDown; p.Cursor = Cursors.Arrow; //p.TextDecorations.Add(TextDecorations.Underline); p.SetResourceReference(Paragraph.ForegroundProperty, "HyperlinkForeground"); } writer.EndCell(); writer.StartCell(); if (quantity.HasValue) { writer.WriteNumber(quantity.Value.ToString("N2")); } writer.EndCell(); writer.StartCell(); if (price.HasValue) { writer.WriteNumber(price.Value.ToString("N2")); } writer.EndCell(); writer.StartCell(); writer.WriteNumber(marketValue.ToString("N2")); writer.EndCell(); writer.StartCell(); if (unitCost.HasValue) { writer.WriteNumber(unitCost.Value.ToString("N2")); } writer.EndCell(); writer.StartCell(); writer.WriteNumber(costBasis.ToString("N2")); writer.EndCell(); writer.StartCell(); writer.WriteNumber(gainLoss.ToString("N2")); writer.EndCell(); writer.StartCell(); decimal percent = costBasis == 0 ? 0 : (gainLoss / costBasis) * 100; writer.WriteNumber(percent.ToString("N0")); writer.EndCell(); writer.EndRow(); }
private MarkDownReporter CreateSut() { _builder = Substitute.For <IReportBuilder>(); _writer = Substitute.For <IReportWriter>(); return(new MarkDownReporter(_builder, _writer)); }
/// <summary> /// Constructor. /// </summary> /// <param name="velocityEngine">The velocity engine</param> /// <param name="velocityContext">The current velocity context.</param> /// <param name="reportWriter">The report writer</param> /// <param name="templatePath">The template path.</param> /// <param name="contentType">The content type of the report.</param> /// <param name="extension">The extension of the report file.</param> /// <param name="helper">The formatting helper class.</param> protected VtlReportWriter(VelocityEngine velocityEngine, VelocityContext velocityContext, IReportWriter reportWriter, string templatePath, string contentType, string extension, FormatHelper helper) { if (velocityEngine == null) throw new ArgumentNullException("velocityEngine"); if (velocityContext == null) throw new ArgumentNullException("velocityContext"); if (reportWriter == null) throw new ArgumentNullException("reportWriter"); if (templatePath == null) throw new ArgumentNullException("templatePath"); if (contentType == null) throw new ArgumentNullException("contentType"); if (extension == null) throw new ArgumentNullException("extension"); if (helper == null) throw new ArgumentNullException("helper"); this.velocityEngine = velocityEngine; this.velocityContext = velocityContext; this.reportWriter = reportWriter; this.templatePath = templatePath; this.contentType = contentType; this.extension = extension; this.helper = helper; InitializeHelper(); }
/// <summary> /// Writes the report to a <see cref="IReportWriter" />. /// </summary> /// <param name="w">The target <see cref="IReportWriter" />.</param> public override void Write(IReportWriter w) { this.UpdateParent(this); this.UpdateFigureNumbers(); base.Write(w); }
/// <summary> /// Applies the transform to produce a report. /// </summary> protected virtual void ApplyTransform(IReportWriter reportWriter, AttachmentContentDisposition attachmentContentDisposition, ReportFormatterOptions options) { XsltArgumentList arguments = new XsltArgumentList(); PopulateArguments(arguments, options, reportWriter.ReportContainer.ReportName); XPathDocument document = SerializeReportToXPathDocument(reportWriter, attachmentContentDisposition); string reportPath = reportWriter.ReportContainer.ReportName + @"." + extension; Encoding encoding = new UTF8Encoding(false); XslCompiledTransform transform = Transform; XmlWriterSettings settings = transform.OutputSettings.Clone(); settings.CheckCharacters = false; settings.Encoding = encoding; settings.CloseOutput = true; using (XmlWriter writer = XmlWriter.Create(reportWriter.ReportContainer.OpenWrite(reportPath, contentType, encoding), settings)) transform.Transform(document, arguments, writer); reportWriter.AddReportDocumentPath(reportPath); }
/// <summary> /// Writes the content of the paragraph. /// </summary> /// <param name="w">The target <see cref="IReportWriter" />.</param> public override void WriteContent(IReportWriter w) { w.WriteParagraph(this); }
/// <summary> /// The write content. /// </summary> /// <param name="w">The w.</param> public override void WriteContent(IReportWriter w) { w.WriteEquation(this); }
/// <summary> /// The write content. /// </summary> /// <param name="w"> /// The w. /// </param> public override void WriteContent(IReportWriter w) { w.WriteDrawing(this); }
/// <summary> /// The write content. /// </summary> /// <param name="w">The w.</param> public override void WriteContent(IReportWriter w) { w.WriteHeader(this); }
public MarkDownReporter(IReportBuilder builder, IReportWriter writer) { _builder = builder; _writer = writer; }
private void GenerateCapitalGains(IReportWriter writer) { var calculator = new CapitalGainsTaxCalculator(this.money, this.endDate, this.consolidateOnDateSold, true); List <SecuritySale> errors = new List <SecuritySale>(from s in calculator.GetSales() where s.Error != null select s); if (errors.Count > 0) { writer.WriteHeading("Errors Found"); foreach (SecuritySale error in errors) { writer.WriteParagraph(error.Error.Message); } } if ((from u in calculator.Unknown where InRange(u.DateSold) select u).Any()) { writer.WriteHeading("Capital Gains with Unknown Cost Basis"); writer.StartTable(); writer.StartColumnDefinitions(); for (int i = 0; i < 4; i++) { writer.WriteColumnDefinition("Auto", 100, double.MaxValue); } writer.EndColumnDefinitions(); writer.StartHeaderRow(); writer.StartCell(); writer.WriteParagraph("Security"); writer.EndCell(); writer.StartCell(); writer.WriteNumber("Quantity"); writer.EndCell(); writer.StartCell(); writer.WriteNumber("Date Sold"); writer.EndCell(); writer.StartCell(); writer.WriteNumber("Sale Price"); writer.EndCell(); writer.StartCell(); writer.WriteNumber("Proceeds"); writer.EndCell(); writer.EndRow(); foreach (var data in calculator.Unknown) { if (!InRange(data.DateSold)) { continue; } writer.StartRow(); writer.StartCell(); writer.WriteParagraph(data.Security.Name); writer.EndCell(); writer.StartCell(); writer.WriteNumber(Rounded(data.UnitsSold, 3)); writer.EndCell(); writer.StartCell(); writer.WriteNumber(data.DateSold.ToShortDateString()); writer.EndCell(); writer.StartCell(); writer.WriteNumber(data.SalePricePerUnit.ToString("C")); writer.EndCell(); writer.StartCell(); writer.WriteNumber(data.SaleProceeds.ToString("C")); writer.EndCell(); } writer.EndTable(); } if (calculator.ShortTerm.Count > 0) { decimal total = 0; writer.WriteHeading("Short Term Capital Gains and Losses"); WriteHeaders(writer); foreach (var data in calculator.ShortTerm) { if (!InRange(data.DateSold)) { continue; } WriteCapitalGains(writer, data); total += data.TotalGain; } WriteCapitalGainsTotal(writer, total); writer.EndTable(); } if (calculator.LongTerm.Count > 0) { decimal total = 0; writer.WriteHeading("Long Term Capital Gains and Losses"); WriteHeaders(writer); foreach (var data in calculator.LongTerm) { if (!InRange(data.DateSold)) { continue; } WriteCapitalGains(writer, data); total += data.TotalGain; } WriteCapitalGainsTotal(writer, total); } writer.EndTable(); }
/// <summary> /// The write content. /// </summary> /// <param name="w"> /// The w. /// </param> public override void WriteContent(IReportWriter w) { w.WriteEquation(this); }
public override void Generate(IReportWriter writer) { FlowDocumentReportWriter fwriter = (FlowDocumentReportWriter)writer; writer.WriteHeading("Tax Report For "); int firstYear = DateTime.Now.Year; int lastYear = DateTime.Now.Year; ICollection <Transaction> transactions = this.money.Transactions.GetAllTransactionsByDate(); Transaction first = transactions.FirstOrDefault(); if (first != null) { firstYear = first.Date.Year; } Transaction last = transactions.LastOrDefault(); if (last != null) { lastYear = last.Date.Year; if (this.fiscalYearStart > 0 && last.Date.Month > this.fiscalYearStart + 1) { lastYear++; } // don't show a report containing zero data. Scroll back to the last year // of data and show that. if (this.fiscalYearStart > 0 && lastYear > this.endDate.Year) { SetStartDate(lastYear); } else if (this.fiscalYearStart == 0 && this.startDate.Year > lastYear) { SetStartDate(lastYear); } } Paragraph heading = fwriter.CurrentParagraph; ComboBox byYearCombo = new ComboBox(); byYearCombo.Margin = new System.Windows.Thickness(5, 0, 0, 0); int selected = -1; int index = 0; for (int i = firstYear; i <= lastYear; i++) { if (this.fiscalYearStart > 0 && i == this.endDate.Year) { selected = index; } else if (this.fiscalYearStart == 0 && i == this.startDate.Year) { selected = index; } if (this.fiscalYearStart > 0) { byYearCombo.Items.Add("FY " + i); } else { byYearCombo.Items.Add(i.ToString()); } index++; } if (selected != -1) { byYearCombo.SelectedIndex = selected; } byYearCombo.SelectionChanged += OnYearChanged; byYearCombo.Margin = new Thickness(10, 0, 0, 0); heading.Inlines.Add(new InlineUIContainer(byYearCombo)); /* * <StackPanel Margin="10,5,10,5" Grid.Row="2" Orientation="Horizontal"> * <TextBlock Text="Consolidate securities by: " Background="Transparent"/> * <ComboBox x:Name="ConsolidateSecuritiesCombo" SelectedIndex="0"> * <ComboBoxItem>Date Acquired</ComboBoxItem> * <ComboBoxItem>Date Sold</ComboBoxItem> * </ComboBox> * </StackPanel> * <CheckBox Margin="10,5,10,5" x:Name="CapitalGainsOnlyCheckBox" Grid.Row="3">Capital Gains Only</CheckBox> */ ComboBox consolidateCombo = new ComboBox(); consolidateCombo.Items.Add("Date Acquired"); consolidateCombo.Items.Add("Date Sold"); consolidateCombo.SelectedIndex = this.consolidateOnDateSold ? 1 : 0; consolidateCombo.SelectionChanged += OnConsolidateComboSelectionChanged; writer.WriteParagraph("Consolidate securities by: "); Paragraph prompt = fwriter.CurrentParagraph; prompt.Margin = new Thickness(0, 0, 0, 4); prompt.Inlines.Add(new InlineUIContainer(consolidateCombo)); CheckBox checkBox = new CheckBox(); checkBox.Content = "Capital Gains Only"; checkBox.IsChecked = this.capitalGainsOnly; checkBox.Checked += OnCapitalGainsOnlyChanged; checkBox.Unchecked += OnCapitalGainsOnlyChanged; writer.WriteParagraph(""); Paragraph checkBoxParagraph = fwriter.CurrentParagraph; checkBoxParagraph.Inlines.Add(new InlineUIContainer(checkBox)); if (!capitalGainsOnly) { // find all tax related categories and summarize accordingly. GenerateCategories(writer); } GenerateCapitalGains(writer); FlowDocument document = view.DocumentViewer.Document; document.Blocks.InsertAfter(document.Blocks.FirstBlock, new BlockUIContainer(CreateExportTxfButton())); }
public CsvReportFormat(IReportWriter writer) { _writer = writer; }
/// <summary> /// The write content. /// </summary> /// <param name="w"> /// The w. /// </param> public override void WriteContent(IReportWriter w) { w.WriteHeader(this); }
public void Generate(IReportWriter writer) { flowwriter = writer as FlowDocumentReportWriter; calc = new CostBasisCalculator(this.myMoney, this.reportDate); string heading = "Investment Portfolio Summary"; if (this.account != null) { heading += " for " + account.Name + " (" + account.AccountId + ")"; } writer.WriteHeading(heading); if (reportDate.Date != DateTime.Today) { writer.WriteSubHeading("As of " + reportDate.Date.AddDays(-1).ToLongDateString()); } totalMarketValue = 0; totalGainLoss = 0; // outer table contains 2 columns, left is the summary table, right is the pie chart. writer.StartTable(); writer.StartColumnDefinitions(); writer.WriteColumnDefinition("Auto", 100, double.MaxValue); writer.WriteColumnDefinition("Auto", 100, double.MaxValue); writer.EndColumnDefinitions(); writer.StartRow(); writer.StartCell(); writer.StartTable(); writer.StartColumnDefinitions(); foreach (double minWidth in new double[] { 300, 100, 100 }) { writer.WriteColumnDefinition("Auto", minWidth, double.MaxValue); } writer.EndColumnDefinitions(); List <SecurityPieData> data = new List <SecurityPieData>(); if (account == null) { WriteSummary(writer, data, TaxableIncomeType.None, "Retirement Tax Free ", new Predicate <Account>((a) => { return(!a.IsClosed && !a.IsTaxDeferred && a.Type == AccountType.Retirement); }), true); WriteSummary(writer, data, TaxableIncomeType.All, "Retirement ", new Predicate <Account>((a) => { return(!a.IsClosed && a.IsTaxDeferred && a.Type == AccountType.Retirement); }), true); WriteSummary(writer, data, TaxableIncomeType.All, "Tax Deferred ", new Predicate <Account>((a) => { return(!a.IsClosed && a.IsTaxDeferred && a.Type == AccountType.Brokerage); }), true); WriteSummary(writer, data, TaxableIncomeType.Gains, "", new Predicate <Account>((a) => { return(!a.IsClosed && !a.IsTaxDeferred && a.Type == AccountType.Brokerage); }), true); } else { TaxableIncomeType taxableIncomeType; if (account.IsTaxDeferred) { taxableIncomeType = TaxableIncomeType.All; } else { if (account.Type == AccountType.Retirement) { // Currently treating this combination as tax free taxableIncomeType = TaxableIncomeType.None; } else { taxableIncomeType = TaxableIncomeType.Gains; } } WriteSummary(writer, data, taxableIncomeType, "", new Predicate <Account>((a) => { return(a == account); }), false); } WriteheaderRow(writer, "Total", totalMarketValue.ToString("C"), totalGainLoss.ToString("C")); writer.EndTable(); writer.EndCell(); // pie chart Chart chart = new Chart(); chart.MinWidth = 400; chart.MinHeight = 300; chart.BorderThickness = new Thickness(0); chart.Padding = new Thickness(0); chart.Margin = new Thickness(0, 00, 0, 0); chart.VerticalAlignment = VerticalAlignment.Top; chart.HorizontalAlignment = HorizontalAlignment.Left; PieSeries series = new PieSeries(); series.IndependentValueBinding = new Binding("Name"); series.DependentValueBinding = new Binding("Total"); chart.Series.Add(series); series.ItemsSource = data; writer.StartCell(); writer.WriteElement(chart); writer.EndCell(); // end the outer table. writer.EndTable(); totalMarketValue = 0; totalGainLoss = 0; List <SecuritySale> errors = new List <SecuritySale>(calc.GetPendingSales(new Predicate <Account>((a) => { return(a == account); }))); if (errors.Count > 0) { writer.WriteSubHeading("Pending Sales"); foreach (var sp in errors) { writer.WriteParagraph(string.Format("Pending sale of {1} units of '{2}' from account '{0}' recorded on {3}", sp.Account.Name, sp.UnitsSold, sp.Security.Name, sp.DateSold.ToShortDateString())); } } if (account == null) { WriteDetails(writer, "Retirement Tax Free ", new Predicate <Account>((a) => { return(!a.IsClosed && !a.IsTaxDeferred && a.Type == AccountType.Retirement); })); WriteDetails(writer, "Retirement ", new Predicate <Account>((a) => { return(!a.IsClosed && a.IsTaxDeferred && a.Type == AccountType.Retirement); })); WriteDetails(writer, "Tax Deferred ", new Predicate <Account>((a) => { return(!a.IsClosed && a.IsTaxDeferred && a.Type == AccountType.Brokerage); })); WriteDetails(writer, "", new Predicate <Account>((a) => { return(!a.IsClosed && !a.IsTaxDeferred && a.Type == AccountType.Brokerage); })); } else { WriteDetails(writer, "", new Predicate <Account>((a) => { return(a == account); })); } }
/// <summary> /// Applies the template to produce a report. /// </summary> protected virtual void ApplyTemplate(IReportWriter reportWriter, AttachmentContentDisposition attachmentContentDisposition, ReportFormatterOptions options) { VelocityEngine velocityEngine = VelocityEngineFactory.CreateVelocityEngine(); var helper = new FormatHelper(); VelocityContext velocityContext = VelocityEngineFactory.CreateVelocityContext(reportWriter, helper); var writer = GetReportWriter(velocityEngine, velocityContext, reportWriter, helper, options); reportWriter.WithUpdatedContentPathsAndDisposition(attachmentContentDisposition, writer.Run); }
private void WriteSummary(IReportWriter writer, List <SecurityPieData> data, TaxableIncomeType taxableIncomeType, string prefix, Predicate <Account> filter, bool subtotal) { bool wroteSectionHeader = false; string caption = prefix + "Investments"; decimal totalSectionMarketValue; decimal totalSectionGainValue = 0; decimal cash = RoundToNearestCent(this.myMoney.GetInvestmentCashBalance(filter)); if (taxableIncomeType == TaxableIncomeType.None) { totalSectionGainValue = 0; } if (taxableIncomeType == TaxableIncomeType.All) { totalSectionGainValue = cash; } totalSectionMarketValue = cash; if (cash > 0) { WriteheaderRow(writer, caption, "Market Value", "Taxable"); wroteSectionHeader = true; WriteSummaryRow(writer, " Cash", cash.ToString("C"), totalSectionGainValue.ToString("C")); caption = prefix + "Cash"; data.Add(new SecurityPieData() { Total = RoundToNearestCent(cash), Name = caption }); } int rowCount = 0; // compute summary foreach (var securityGroup in calc.GetHoldingsBySecurityType(filter)) { decimal marketValue = 0; decimal gainLoss = 0; SecurityType st = securityGroup.Key; int count = 0; foreach (SecurityPurchase i in securityGroup.Value) { if (i.UnitsRemaining > 0) { marketValue += i.MarketValue; gainLoss += i.GainLoss; count++; } } if (taxableIncomeType == TaxableIncomeType.None) { gainLoss = 0; } if (taxableIncomeType == TaxableIncomeType.All) { gainLoss = marketValue; } if (count > 0) { if (!wroteSectionHeader) { WriteheaderRow(writer, caption, "Market Value", "Taxable"); wroteSectionHeader = true; } caption = prefix + Security.GetSecurityTypeCaption(st); data.Add(new SecurityPieData() { Total = RoundToNearestCent(marketValue), Name = caption }); caption = " " + Security.GetSecurityTypeCaption(st); WriteSummaryRow(writer, caption, marketValue.ToString("C"), gainLoss.ToString("C")); rowCount++; } totalSectionMarketValue += marketValue; totalSectionGainValue += gainLoss; } if (wroteSectionHeader && subtotal && rowCount > 1) { WriteSummaryRow(writer, " SubTotal", totalSectionMarketValue.ToString("C"), totalSectionGainValue.ToString("C")); } totalMarketValue += totalSectionMarketValue; totalGainLoss += totalSectionGainValue; }
private VtlReportWriter GetReportWriter(VelocityEngine velocityEngine, VelocityContext velocityContext, IReportWriter reportWriter, FormatHelper helper, ReportFormatterOptions options) { int pageSize = GetReportPageSize(options); int testCount = (reportWriter.Report.TestPackageRun == null) ? 0 : reportWriter.Report.TestPackageRun.Statistics.TestCount; if (pageSize < 0) { HtmlReportSplitSettings settings = preferenceManager.HtmlReportSplitSettings; pageSize = settings.Enabled ? settings.PageSize : 0; } if (supportSplit && pageSize > 0 && testCount > pageSize) return new MultipleFilesVtlReportWriter(velocityEngine, velocityContext, reportWriter, templatePath, contentType, extension, helper, pageSize); return new SingleFileVtlReportWriter(velocityEngine, velocityContext, reportWriter, templatePath, contentType, extension, helper); }
private void WriteheaderRow(IReportWriter writer, String col1, String col2, String col3) { writer.StartHeaderRow(); WriteSummaryRow(writer, col1, col2, col3); }
/// <summary> /// Writes the content of the item to the specified <see cref="IReportWriter" />. /// </summary> /// <param name="w">The target <see cref="IReportWriter" />.</param> public virtual void WriteContent(IReportWriter w) { }
public DiagnosticsReporter(IReportBuilder builder, IReportWriter writer) { _builder = builder; _writer = writer; }
/// <inheritdoc /> public void Format(IReportWriter reportWriter, string formatterName, ReportFormatterOptions formatterOptions, IProgressMonitor progressMonitor) { if (reportWriter == null) throw new ArgumentNullException(@"reportWriter"); if (formatterName == null) throw new ArgumentNullException(@"formatterName"); if (formatterOptions == null) throw new ArgumentNullException(@"formatterOptions"); if (progressMonitor == null) throw new ArgumentNullException(@"progressMonitor"); IReportFormatter formatter = GetReportFormatter(formatterName); if (formatter == null) throw new InvalidOperationException(String.Format("There is no report formatter named '{0}'.", formatterName)); formatter.Format(reportWriter, formatterOptions, progressMonitor); }
/// <inheritdoc /> public abstract void Format(IReportWriter reportWriter, ReportFormatterOptions formatterOptions, IProgressMonitor progressMonitor);
/// <summary> /// The write. /// </summary> /// <param name="w"> /// The w. /// </param> public virtual void Write(IReportWriter w) { this.Update(); this.WriteContent(w); foreach (var child in this.Children) { child.Write(w); } }
/// <summary> /// Copies additional resources to the content path within the report. /// </summary> protected virtual void CopyResources(IReportWriter reportWriter) { foreach (string resourcePath in resourcePaths) { if (resourcePath.Length > 0) { string sourceContentPath = Path.Combine(resourceDirectory.FullName, resourcePath); string destContentPath = Path.Combine(reportWriter.ReportContainer.ReportName, resourcePath); ReportContainerUtils.CopyToReport(reportWriter.ReportContainer, sourceContentPath, destContentPath); } } }
/// <summary> /// The write content. /// </summary> /// <param name="w"> /// The w. /// </param> public override void WriteContent(IReportWriter w) { w.WriteParagraph(this); }
/// <summary> /// Default constructor for dependency injection. /// </summary> /// <param name="model">The application model.</param> /// <param name="context">The migration context.</param> /// <param name="state">The application's run state.</param> /// <param name="writer">An instance of a <see cref="IReportWriter"/> to be used for writing the report.</param> /// <param name="logger">An instance of a <see cref="ILogger"/> to be used for logging within the class.</param> protected BizTalkReporterBase(IApplicationModel model, MigrationContext context, IRunState state, IReportWriter writer, ILogger logger) { Model = (AzureIntegrationServicesModel)model ?? throw new ArgumentNullException(nameof(model)); Context = context ?? throw new ArgumentNullException(nameof(context)); State = state ?? throw new ArgumentNullException(nameof(state)); Writer = writer ?? throw new ArgumentNullException(nameof(writer)); Logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public BrokenLinkCollectionWorkflow(CancellationToken cancellationToken, Configurations configurations, IStatistics statistics, IHardwareMonitor hardwareMonitor, IResourceExtractor resourceExtractor, IReportWriter reportWriter, ILog log, IResourceEnricher resourceEnricher, IResourceVerifier resourceVerifier, Func <IHtmlRenderer> getHtmlRenderer) { _log = log; _coordinatorBlock = new CoordinatorBlock(cancellationToken, log); _eventBroadcasterBlock = new EventBroadcasterBlock(cancellationToken); _processingResultGeneratorBlock = new ProcessingResultGeneratorBlock(cancellationToken, resourceExtractor, log); _reportWriterBlock = new ReportWriterBlock(cancellationToken, reportWriter, log); _resourceEnricherBlock = new ResourceEnricherBlock(cancellationToken, resourceEnricher, log); _resourceVerifierBlock = new ResourceVerifierBlock(cancellationToken, statistics, resourceVerifier, log); _htmlRendererBlock = new HtmlRendererBlock( cancellationToken, statistics, log, configurations, hardwareMonitor, getHtmlRenderer ); WireUpBlocks(); void WireUpBlocks() { var generalDataflowLinkOptions = new DataflowLinkOptions { PropagateCompletion = true }; _coordinatorBlock.LinkTo(NullTarget <Resource>(), PropagateNullObjectsOnly <Resource>()); _coordinatorBlock.LinkTo(_resourceEnricherBlock, generalDataflowLinkOptions); _resourceEnricherBlock.LinkTo(NullTarget <Resource>(), PropagateNullObjectsOnly <Resource>()); _resourceEnricherBlock.LinkTo(_resourceVerifierBlock, generalDataflowLinkOptions); _resourceEnricherBlock.FailedProcessingResults.LinkTo(_coordinatorBlock); _resourceVerifierBlock.LinkTo(NullTarget <Resource>(), PropagateNullObjectsOnly <Resource>()); _resourceVerifierBlock.LinkTo(_htmlRendererBlock, generalDataflowLinkOptions); _resourceVerifierBlock.FailedProcessingResults.LinkTo(_coordinatorBlock); _resourceVerifierBlock.VerificationResults.LinkTo(_reportWriterBlock); _resourceVerifierBlock.Events.LinkTo(_eventBroadcasterBlock); _htmlRendererBlock.LinkTo(NullTarget <RenderingResult>(), PropagateNullObjectsOnly <RenderingResult>()); _htmlRendererBlock.LinkTo(_processingResultGeneratorBlock, generalDataflowLinkOptions); _htmlRendererBlock.VerificationResults.LinkTo(_reportWriterBlock, generalDataflowLinkOptions); _htmlRendererBlock.FailedProcessingResults.LinkTo(_coordinatorBlock); _htmlRendererBlock.Events.LinkTo(_eventBroadcasterBlock, generalDataflowLinkOptions); _processingResultGeneratorBlock.LinkTo(NullTarget <ProcessingResult>(), PropagateNullObjectsOnly <ProcessingResult>()); _processingResultGeneratorBlock.LinkTo(_coordinatorBlock); _eventBroadcasterBlock.LinkTo(NullTarget <Event>(), PropagateNullObjectsOnly <Event>()); Predicate <T> PropagateNullObjectsOnly <T>() { return(@object => @object == null); } ITargetBlock <T> NullTarget <T>() { return(DataflowBlock.NullTarget <T>()); } } }
/// <summary> /// The write. /// </summary> /// <param name="w"> /// The w. /// </param> public override void Write(IReportWriter w) { this.UpdateParent(this); this.UpdateFigureNumbers(); base.Write(w); }
public MetricsReportFormat(IReportWriter writer) { _writer = writer; }
/// <summary> /// Writes the content of the item. /// </summary> /// <param name="w"> /// The writer. /// </param> public virtual void WriteContent(IReportWriter w) { }
public StubFactory(Func <ITimeMeasure> getTimeMeasure, ITraceWriter traceWriter, IReportWriter reportWriter) { _getTimeMeasure = getTimeMeasure; _traceWriter = traceWriter; _reportWriter = reportWriter; }
private MarkDownReporter CreateSut() { _builder = Substitute.For<IReportBuilder>(); _writer = Substitute.For<IReportWriter>(); return new MarkDownReporter(_builder, _writer); }
public TextReportFormat(IReportWriter writer) { _writer = writer; }
private DiagnosticsReporter CreateSut() { _builder = Substitute.For<IReportBuilder>(); _writer = Substitute.For<IReportWriter>(); return new DiagnosticsReporter(_builder, _writer); }
public DiskEntityAddon(string pEntityPath, string pArchivedPath, IReportWriter pReportWriter) : base(pEntityPath, pArchivedPath, pReportWriter) { }
public override void WriteContent(IReportWriter w) { w.WritePlot(this); }