Order Search.frx 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Report ScriptLanguage="CSharp" ReportInfo.Created="03/18/2023 18:03:24" ReportInfo.Modified="03/30/2023 03:34:24" 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. private Hashtable expandedOrders = new Hashtable();
  21. // called when we click checkbox in the preview window
  22. private void CheckBox2_Click(object sender, EventArgs e)
  23. {
  24. // order ID is in the checkbox Hyperlink
  25. int orderID = int.Parse((sender as CheckBoxObject).Hyperlink.Value);
  26. // toggle expanded state
  27. if (expandedOrders.ContainsKey(orderID))
  28. expandedOrders.Remove(orderID);
  29. else
  30. expandedOrders[orderID] = 1;
  31. // refresh the report
  32. Report.Refresh();
  33. }
  34. private void Data1_BeforePrint(object sender, EventArgs e)
  35. {
  36. int orderID = ((Int32)Report.GetColumnValue(&quot;Order Details.OrderID&quot;));
  37. bool orderDetailsVisible = expandedOrders.ContainsKey(orderID);
  38. // set check state
  39. CheckBox2.Checked = !orderDetailsVisible;
  40. // set order details visibility
  41. Data2.Visible = orderDetailsVisible;
  42. Data2.Header.Visible = orderDetailsVisible;
  43. Data2.Footer.Visible = orderDetailsVisible;
  44. }
  45. // dialog form checkbox handler
  46. private void CheckBox1_CheckedChanged(object sender, EventArgs e)
  47. {
  48. CheckedListBox1.Enabled = CheckBox1.Checked;
  49. }
  50. }
  51. }
  52. </ScriptText>
  53. <Dictionary>
  54. <TableDataSource Name="Customers" ReferenceName="NorthWind.Customers" DataType="System.Int32" Enabled="true">
  55. <Column Name="CustomerID" DataType="System.String"/>
  56. <Column Name="CompanyName" DataType="System.String"/>
  57. <Column Name="ContactName" DataType="System.String"/>
  58. <Column Name="ContactTitle" DataType="System.String"/>
  59. <Column Name="Address" DataType="System.String"/>
  60. <Column Name="City" DataType="System.String"/>
  61. <Column Name="Region" DataType="System.String"/>
  62. <Column Name="PostalCode" DataType="System.String"/>
  63. <Column Name="Country" DataType="System.String"/>
  64. <Column Name="Phone" DataType="System.String"/>
  65. <Column Name="Fax" DataType="System.String"/>
  66. </TableDataSource>
  67. <TableDataSource Name="Order Details" ReferenceName="NorthWind.Order Details" DataType="System.Int32" Enabled="true">
  68. <Column Name="OrderID" DataType="System.Int32"/>
  69. <Column Name="ProductID" DataType="System.Int32"/>
  70. <Column Name="UnitPrice" DataType="System.Decimal"/>
  71. <Column Name="Quantity" DataType="System.Int16"/>
  72. <Column Name="Discount" DataType="System.Single"/>
  73. <Column Name="Column" Alias="Price" DataType="System.Decimal" Calculated="true" Expression="[Order Details.Quantity]*[Order Details.UnitPrice]*(decimal)(1 - [Order Details.Discount])"/>
  74. </TableDataSource>
  75. <TableDataSource Name="Orders" ReferenceName="NorthWind.Orders" DataType="System.Int32" Enabled="true">
  76. <Column Name="OrderID" DataType="System.Int32"/>
  77. <Column Name="CustomerID" DataType="System.String"/>
  78. <Column Name="EmployeeID" DataType="System.Int32"/>
  79. <Column Name="OrderDate" DataType="System.DateTime"/>
  80. <Column Name="RequiredDate" DataType="System.DateTime"/>
  81. <Column Name="ShippedDate" DataType="System.DateTime"/>
  82. <Column Name="ShipVia" DataType="System.Int32"/>
  83. <Column Name="Freight" DataType="System.Decimal"/>
  84. <Column Name="ShipName" DataType="System.String"/>
  85. <Column Name="ShipAddress" DataType="System.String"/>
  86. <Column Name="ShipCity" DataType="System.String"/>
  87. <Column Name="ShipRegion" DataType="System.String"/>
  88. <Column Name="ShipPostalCode" DataType="System.String"/>
  89. <Column Name="ShipCountry" DataType="System.String"/>
  90. <Column Name="Latitude" DataType="System.Double"/>
  91. <Column Name="Longitude" DataType="System.Double"/>
  92. </TableDataSource>
  93. <TableDataSource Name="Products" ReferenceName="NorthWind.Products" DataType="System.Int32" Enabled="true">
  94. <Column Name="ProductID" DataType="System.Int32"/>
  95. <Column Name="ProductName" DataType="System.String"/>
  96. <Column Name="SupplierID" DataType="System.Int32"/>
  97. <Column Name="CategoryID" DataType="System.Int32"/>
  98. <Column Name="QuantityPerUnit" DataType="System.String"/>
  99. <Column Name="UnitPrice" DataType="System.Decimal"/>
  100. <Column Name="UnitsInStock" DataType="System.Int16"/>
  101. <Column Name="UnitsOnOrder" DataType="System.Int16"/>
  102. <Column Name="ReorderLevel" DataType="System.Int16"/>
  103. <Column Name="Discontinued" DataType="System.Boolean" BindableControl="CheckBox"/>
  104. <Column Name="EAN13" DataType="System.String"/>
  105. </TableDataSource>
  106. <Relation Name="CustomersOrders" ReferenceName="NorthWind.CustomersOrders" ParentDataSource="Customers" ChildDataSource="Orders" ParentColumns="CustomerID" ChildColumns="CustomerID" Enabled="true"/>
  107. <Relation Name="OrdersOrderDetails" ReferenceName="NorthWind.OrdersOrderDetails" ParentDataSource="Orders" ChildDataSource="Order Details" ParentColumns="OrderID" ChildColumns="OrderID" Enabled="true"/>
  108. <Relation Name="ProductsOrderDetails" ReferenceName="NorthWind.ProductsOrderDetails" ParentDataSource="Products" ChildDataSource="Order Details" ParentColumns="ProductID" ChildColumns="ProductID" Enabled="true"/>
  109. <Total Name="OrderTotal" Expression="[Order Details.Price]" Evaluator="Data2" PrintOn="DataFooter1"/>
  110. </Dictionary>
  111. <ReportPage Name="Page1" Watermark.Font="Segoe UI, 60pt">
  112. <ReportTitleBand Name="ReportTitle1" Width="718.2" Height="75.6">
  113. <TextObject Name="Text1" Left="189" Width="264.6" Height="56.7" Text="ORDERS" VertAlign="Center" Font="Segoe UI, 24pt, style=Bold" TextFill.Color="DimGray"/>
  114. <TextObject Name="Text18" Width="56.7" Height="56.7" Text="Ṅ" VertAlign="Center" Font="Segoe UI, 36pt, style=Bold" TextFill.Color="DimGray"/>
  115. <TextObject Name="Text19" Left="56.7" Top="9.45" Width="94.5" Height="37.8" Border.Lines="Left" Text="NORTHWIND&#13;&#10;TRADERS" Padding="10, 0, 2, 0" VertAlign="Center" Font="Segoe UI, 9pt" TextFill.Color="DimGray"/>
  116. <TextObject Name="Text25" Left="491.4" Top="9.45" Width="226.8" Height="18.9" Text="Begin date: [beginDate.Value]" Format="Date" Format.Format="d" HorzAlign="Right" Font="Segoe UI, 9pt"/>
  117. <TextObject Name="Text26" Left="491.4" Top="28.35" Width="226.8" Height="18.9" Text="End date: [endDate.Value]" Format="Date" Format.Format="d" HorzAlign="Right" Font="Segoe UI, 9pt"/>
  118. </ReportTitleBand>
  119. <DataBand Name="Data1" Top="107.95" Width="718.2" Height="18.9" BeforePrintEvent="Data1_BeforePrint" DataSource="Orders" Filter="[Orders.OrderDate] &gt; beginDate.Value &amp;&amp; [Orders.OrderDate] &lt; endDate.Value">
  120. <TextObject Name="Text22" Left="56.7" Width="94.5" Height="18.9" Text="[Orders.OrderID]" VertAlign="Center" Font="Segoe UI, 9pt"/>
  121. <TextObject Name="Text23" Left="245.7" Width="245.7" Height="18.9" Text="[Orders.Customers.CompanyName]" VertAlign="Center" Font="Segoe UI, 9pt"/>
  122. <TextObject Name="Text24" Left="151.2" Width="94.5" Height="18.9" Text="[Orders.OrderDate]" Format="Date" Format.Format="d" VertAlign="Center" Font="Segoe UI, 9pt"/>
  123. <CheckBoxObject Name="CheckBox2" Left="37.8" Top="3.78" Width="11.34" Height="11.34" Border.Lines="All" Border.Color="Gainsboro" Border.Width="0.5" Cursor="Hand" Hyperlink.Kind="Custom" Hyperlink.Expression="[Orders.OrderID]" ClickEvent="CheckBox2_Click" CheckedSymbol="Plus" UncheckedSymbol="Minus"/>
  124. <ChildBand Name="Child1" Top="128.85" Width="718.2" Height="18.9" PrintIfDatabandEmpty="true">
  125. <TextObject Name="Text27" Left="56.7" Width="434.7" Height="18.9" Text="No orders found" Font="Segoe UI, 9pt"/>
  126. </ChildBand>
  127. <DataHeaderBand Name="DataHeader1" Top="77.6" Width="718.2" Height="28.35">
  128. <TextObject Name="Text2" Left="56.7" Width="94.5" Height="18.9" Border.Lines="Bottom" Border.Color="Gainsboro" Text="Order ID" Font="Segoe UI, 9pt, style=Bold"/>
  129. <TextObject Name="Text3" Left="245.7" Width="245.7" Height="18.9" Border.Lines="Bottom" Border.Color="Gainsboro" Text="Company name" Font="Segoe UI, 9pt, style=Bold"/>
  130. <TextObject Name="Text4" Left="151.2" Width="94.5" Height="18.9" Border.Lines="Bottom" Border.Color="Gainsboro" Text="Order date" Font="Segoe UI, 9pt, style=Bold"/>
  131. </DataHeaderBand>
  132. <DataBand Name="Data2" Top="180.1" Width="718.2" Height="18.9" DataSource="Order Details">
  133. <TextObject Name="Text28" Left="94.5" Width="245.7" Height="18.9" Border.Lines="Bottom" Border.Color="Gainsboro" Text="[Order Details.Products.ProductName]" Font="Segoe UI, 9pt"/>
  134. <TextObject Name="Text29" Left="340.2" Width="94.5" Height="18.9" Border.Lines="Bottom" Border.Color="Gainsboro" Text="[Order Details.UnitPrice]" Format="Currency" Format.UseLocale="true" Format.DecimalDigits="2" HorzAlign="Right" WordWrap="false" Font="Segoe UI, 9pt" Trimming="EllipsisCharacter"/>
  135. <TextObject Name="Text30" Left="434.7" Width="94.5" Height="18.9" Border.Lines="Bottom" Border.Color="Gainsboro" Text="[Order Details.Quantity]" HorzAlign="Center" Font="Segoe UI, 9pt"/>
  136. <TextObject Name="Text31" Left="529.2" Width="94.5" Height="18.9" Border.Lines="Bottom" Border.Color="Gainsboro" Text="[Order Details.Discount]" Format="Percent" Format.UseLocale="true" Format.DecimalDigits="0" HorzAlign="Center" WordWrap="false" Font="Segoe UI, 9pt" Trimming="EllipsisCharacter"/>
  137. <TextObject Name="Text32" Left="623.7" Width="94.5" Height="18.9" Border.Lines="Bottom" Border.Color="Gainsboro" Text="[Order Details.Price]" Format="Currency" Format.UseLocale="true" Format.DecimalDigits="2" HorzAlign="Right" WordWrap="false" Font="Segoe UI, 9pt" Trimming="EllipsisCharacter"/>
  138. <DataHeaderBand Name="DataHeader2" Top="149.75" Width="718.2" Height="28.35" KeepWithData="true">
  139. <TextObject Name="Text5" Left="94.5" Top="9.45" Width="245.7" Height="18.9" Border.Lines="Bottom" Border.Color="Gainsboro" Text="Product name" Font="Segoe UI, 9pt, style=Bold"/>
  140. <TextObject Name="Text6" Left="340.2" Top="9.45" Width="94.5" Height="18.9" Border.Lines="Bottom" Border.Color="Gainsboro" Text="Unit price" HorzAlign="Right" Font="Segoe UI, 9pt, style=Bold"/>
  141. <TextObject Name="Text7" Left="434.7" Top="9.45" Width="94.5" Height="18.9" Border.Lines="Bottom" Border.Color="Gainsboro" Text="Quantity" HorzAlign="Center" Font="Segoe UI, 9pt, style=Bold"/>
  142. <TextObject Name="Text8" Left="529.2" Top="9.45" Width="94.5" Height="18.9" Border.Lines="Bottom" Border.Color="Gainsboro" Text="Discount" HorzAlign="Center" Font="Segoe UI, 9pt, style=Bold"/>
  143. <TextObject Name="Text9" Left="623.7" Top="9.45" Width="94.5" Height="18.9" Border.Lines="Bottom" Border.Color="Gainsboro" Text="Price" HorzAlign="Right" Font="Segoe UI, 9pt, style=Bold"/>
  144. </DataHeaderBand>
  145. <DataFooterBand Name="DataFooter1" Top="201" Width="718.2" Height="37.8">
  146. <TextObject Name="Text33" Left="529.2" Top="9.45" Width="189" Height="18.9" Text="Order total: [OrderTotal]" Format="Currency" Format.UseLocale="true" Format.DecimalDigits="2" HorzAlign="Right" Font="Segoe UI, 9pt, style=Bold"/>
  147. </DataFooterBand>
  148. </DataBand>
  149. </DataBand>
  150. <PageFooterBand Name="PageFooter1" Top="240.8" Width="718.2" Height="18.9"/>
  151. </ReportPage>
  152. <DialogPage Name="Form1" AcceptButton="btnOk" CancelButton="btnCancel" AutoScaleDimensions="192, 192" ClientSize="592, 640">
  153. <ButtonControl Name="btnOk" Left="260" Top="574" Width="150" Height="46" Anchor="Bottom, Right" Font="Segoe UI, 8.5pt" TabIndex="0" Text="OK" DialogResult="OK"/>
  154. <ButtonControl Name="btnCancel" Left="422" Top="574" Width="150" Height="46" Anchor="Bottom, Right" Font="Segoe UI, 8.5pt" TabIndex="0" Text="Cancel" DialogResult="Cancel"/>
  155. <DateTimePickerControl Name="beginDate" Left="168" Top="96" Width="400" Height="50" Font="Segoe UI, 8.5pt" TabIndex="0" Text="DateTimePicker" Format="Short" Value="2014-01-01"/>
  156. <LabelControl Name="Label1" Left="24" Top="32" Width="404" Height="30" Font="Segoe UI, 8.5pt" TabIndex="0" Text="Search for orders placed between dates:"/>
  157. <LabelControl Name="Label2" Left="24" Top="104" Width="65" Height="30" Font="Segoe UI, 8.5pt" TabIndex="0" Text="Begin:"/>
  158. <DateTimePickerControl Name="endDate" Left="168" Top="164" Width="400" Height="50" Font="Segoe UI, 8.5pt" TabIndex="0" Text="DateTimePicker" Format="Short" Value="2014-02-01"/>
  159. <LabelControl Name="Label3" Left="24" Top="172" Width="47" Height="30" Font="Segoe UI, 8.5pt" TabIndex="0" Text="End:"/>
  160. <CheckedListBoxControl Name="CheckedListBox1" Left="24" Top="300" Width="544" Height="244" Enabled="false" Font="Segoe UI, 8.5pt" TabIndex="0" Text="CheckedListBox" DataColumn="Orders.Customers.CompanyName"/>
  161. <CheckBoxControl Name="CheckBox1" Left="24" Top="244" Width="335" Font="Segoe UI, 8.5pt" TabIndex="0" Text="Search for specific customers:" CheckedChangedEvent="CheckBox1_CheckedChanged"/>
  162. </DialogPage>
  163. </Report>