Swiss QR Bills
- 3 minutes to read
The How to Create a Custom DevExpress Report Control - Swiss QR Bill Implementation GitHub project illustrates how to implement a custom SwissQRBill control.
Add a Report
To get started with this tutorial, open an existing reporting application or create a new application (the Add a Report to Your .NET Application section explains how to create a reporting application on different platforms).
Add a new blank report to your application.
Select the report on the Report Designer's surface and switch to the Property Grid. Set the following properties:
Add the QR-bill Payment Part and Receipt
Add the Report Footer band to the report.
Enable the Report Footer band's Print At Bottom property to display the band's content at the bottom of report pages.
Add the XRPanel control to the Report Footer band's bottom right-hand corner. The panel and report page's bottom right corners should be at the same place.
Set the panel's Size | Height property to 1050 and the Size | Width property - to 1480. This size corresponds to A6 format.
Add one more XRPanel control to the Report Footer band's bottom left-hand corner. The panel and report page's bottom left corners should be at the same place.
Set the panel's Size | Height property to 1050 and the Size | Width property - to 620.
Disable the panels' Behavior | CanGrow property to fix the panels' size regardless their content.
Prepare Data Source
The QR payment part and receipt should contain account, creditor, and debtor information. Include this data in the report's data source.
The Swiss QR Bill demo uses the BillDS business class as the report's data source. Copy the SwissQRReportDataSource.cs/SwissQRReportDataSource.vb file with this class from the C:\Users\Public\Documents\DevExpress Demos 20.2\Components\Reporting\CS\DevExpress.DemoReports\SwissQRCode folder to your project to use this tutorial.
Save the project and build the solution.
Run the Data Source Wizard to bind the report to the added class' data.
Add Report Controls
The receipt and QR payment part should include the following sections:
Use the following report controls for these sections:
|Swiss QR Code||XRBarCode|
Arrange these controls on the report's panel and apply font settings according to the QR bill guidelines.
Bind the table cells to the data source fields.
Do the following to set up the XRBarCode control:
Bind the XRBarCode control (set its Text property) to the demo data source's [QRBillData].[QRCodeData] field. This field provides data prepared in code.
Set the Size | Width and Height properties to 460. (The guidelines recommend 46 x 46 mm).
Set the following properties in the Behavior category:
Set the QRCode-specific properties in the Symbology group:
View the Result
Switch to Preview to see the result: