User Function.frx 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Report ScriptLanguage="CSharp" ReportInfo.Description="Demonstrates the following AdvMatrixObject features:&#13;&#10;- user-defined aggregate function (see the report script code)" ReportInfo.Created="05/16/2008 01:44:40" ReportInfo.Modified="04/07/2023 17:58:53" ReportInfo.CreatorVersion="1.0.0.0">
  3. <ScriptText>using System;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using System.ComponentModel;
  7. using System.Windows.Forms;
  8. using System.Drawing;
  9. using System.Data;
  10. using FastReport;
  11. using FastReport.Data;
  12. using FastReport.Dialog;
  13. using FastReport.Barcode;
  14. using FastReport.Table;
  15. using FastReport.Utils;
  16. namespace FastReport
  17. {
  18. public class ReportScript
  19. {
  20. public object _Sum(List&lt;dynamic&gt; l)
  21. {
  22. dynamic value = 0;
  23. foreach (dynamic v in l)
  24. value += v;
  25. return value;
  26. }
  27. }
  28. }
  29. </ScriptText>
  30. <Dictionary>
  31. <TableDataSource Name="MatrixDemo" ReferenceName="NorthWind.MatrixDemo" DataType="System.Int32" Enabled="true">
  32. <Column Name="Name" DataType="System.String"/>
  33. <Column Name="Year" DataType="System.Int32"/>
  34. <Column Name="Month" DataType="System.Int32"/>
  35. <Column Name="ItemsSold" DataType="System.Int32"/>
  36. <Column Name="Revenue" DataType="System.Decimal"/>
  37. </TableDataSource>
  38. </Dictionary>
  39. <ReportPage Name="Page1" Watermark.Font="Arial, 60pt">
  40. <ReportTitleBand Name="ReportTitle1" Width="718.2" Height="37.8" CanGrow="true">
  41. <TextObject Name="Text1" Width="718.2" Height="37.8" Text="REVENUE BY EMPLOYEE" HorzAlign="Center" VertAlign="Center" Font="Segoe UI, 14pt, style=Bold"/>
  42. </ReportTitleBand>
  43. <DataBand Name="Data1" Top="39.8" Width="718.2" Height="87.52">
  44. <AdvMatrixObject Name="Matrix1" Left="9.45" Top="11.92" Width="313.74" Height="66.15" DataSource="MatrixDemo">
  45. <Columns>
  46. <Descriptor Expression="[MatrixDemo.Year]"/>
  47. <Descriptor DisplayText="Total"/>
  48. </Columns>
  49. <Rows>
  50. <Descriptor Expression="[MatrixDemo.Name]"/>
  51. <Descriptor DisplayText="Total"/>
  52. </Rows>
  53. <TableColumn Name="Column1" Width="103.95"/>
  54. <TableColumn Name="Column2" Width="98.28" AutoSize="true"/>
  55. <TableColumn Name="Column3" Width="111.51" AutoSize="true"/>
  56. <TableRow Name="Row1" Height="28.35">
  57. <TableCell Name="Cell1" Border.Lines="All" Border.Color="White" Fill.Color="LightGray" Text="Employee" HorzAlign="Center" VertAlign="Center" Font="Segoe UI, 9pt"/>
  58. <TableCell Name="Cell2" Border.Lines="All" Border.Color="White" Fill.Color="LightGray" Text="[Year]" AllowExpressions="false" HorzAlign="Center" VertAlign="Center" Font="Segoe UI, 9pt"/>
  59. <TableCell Name="Cell7" Border.Lines="All" Border.Color="White" Fill.Color="LightGray" Text="Total" HorzAlign="Center" VertAlign="Center" Font="Segoe UI, 9pt, style=Bold"/>
  60. </TableRow>
  61. <TableRow Name="Row2">
  62. <TableCell Name="Cell3" Border.Lines="All" Border.Color="White" Fill.Color="LightGray" Text="[Name]" AllowExpressions="false" VertAlign="Center" Font="Segoe UI, 9pt"/>
  63. <TableCell Name="Cell4" Border.Lines="All" Border.Color="White" Fill.Color="WhiteSmoke" Text="[_Sum([MatrixDemo.Revenue])]" AllowExpressions="false" Format="Currency" Format.UseLocale="true" Format.DecimalDigits="2" HorzAlign="Right" VertAlign="Center" Font="Segoe UI, 9pt"/>
  64. <TableCell Name="Cell8" Border.Lines="All" Border.Color="White" Fill.Color="WhiteSmoke" Text="[_Sum([MatrixDemo.Revenue])]" AllowExpressions="false" Format="Currency" Format.UseLocale="true" Format.DecimalDigits="2" HorzAlign="Right" VertAlign="Center" Font="Segoe UI, 9pt"/>
  65. </TableRow>
  66. <TableRow Name="Row4">
  67. <TableCell Name="Cell5" Border.Lines="All" Border.Color="White" Fill.Color="LightGray" Text="Total" HorzAlign="Center" VertAlign="Center" Font="Segoe UI, 9pt, style=Bold"/>
  68. <TableCell Name="Cell6" Border.Lines="All" Border.Color="White" Fill.Color="WhiteSmoke" Text="[_Sum([MatrixDemo.Revenue])]" AllowExpressions="false" Format="Currency" Format.UseLocale="true" Format.DecimalDigits="2" HorzAlign="Right" VertAlign="Center" Font="Segoe UI, 9pt"/>
  69. <TableCell Name="Cell9" Border.Lines="All" Border.Color="White" Fill.Color="WhiteSmoke" Text="[_Sum([MatrixDemo.Revenue])]" AllowExpressions="false" Format="Currency" Format.UseLocale="true" Format.DecimalDigits="2" HorzAlign="Right" VertAlign="Center" Font="Segoe UI, 9pt, style=Bold"/>
  70. </TableRow>
  71. </AdvMatrixObject>
  72. </DataBand>
  73. <PageFooterBand Name="PageFooter1" Top="129.32" Width="718.2" Height="28.35" Fill.Color="WhiteSmoke">
  74. <TextObject Name="Text12" Left="9.45" Width="217.35" Height="28.35" Cursor="Hand" Hyperlink.Value="https://www.fast-report.com/en/product/fast-report-net/" Text="Generated by FastReport" VertAlign="Center" Font="Segoe UI, 9pt, style=Underline" TextFill.Color="Blue"/>
  75. </PageFooterBand>
  76. </ReportPage>
  77. </Report>