Extending Reports with the QR Pay
This documentation explains how to extend a report in Business Central with a QR Pay QR-CODE. The QR-Code is automatically generated and added during the report printing or when booking or converting a document.
Procedure
There are two approaches to achieve this:
-
Custom Reports:
In custom reports, you can directly integrate the required code into the report. -
Standard Reports:
For standard reports, you can create a report extension that implements the appropriate code.
Please note that there are differences between Word Reports and RDLC Reports that need to be considered during implementation.
Requirements
Before you begin, ensure that the following prerequisites are met:
- CORE must be referenced in the extension.
- QR Pay must be referenced in the extension.
- QR Pay must be activated in the corresponding module setup.
Learn more about creating a Word Layout report in Microsoft Business Central.
Learn more about creating an RDLC Layout report in Microsoft Business Central.
Setup in QR Pay
To ensure correct functionality, the following configurations must be made for the created/extended report in QR Pay:
- The Report ID and Table Id for the QR Pay Setup Record must be set up.
- In the QR Pay Module Setup all necessary field should be configured
Modify the Amount value in the QR-Code generation
- In this section, we will change the QR-Code Amount with a EventSubscriber.
- Create a new
.al-file in Visual Studio Code or open an existing.al-file. -
Add the following code to the opened file:
4. Use the RecordRef to calculate the new Amount 5. Set the ParamIshandledBoolean to true if this value should be used
Extending RDLC Reports
- In this section, we will add a QR Pay QR-Code to a report of your choice.
- Create a new
.al-file in Visual Studio Code or open an existing.al-file that extends the desired report. -
Add the following code to the opened file:
-
Replace "XXX" with the ID of the report you want to extend (Report 1306 "Standard Sales - Invoice and 117 Reminder are extended in the standard of QR Pay already).
- Publish the extension.
- Open Report Layouts in Business Central.
- Find the layout you want to extend and click "Update and Download Layout".
- Open the downloaded layout file.
- Add an image by selecting "Insert" -> "Picture".
- Position the added image where you want the barcode to appear.
- Right-click on the image and select "Image Properties".
- Make the following adjustments in the "Image Properties" dialog:
- General:
- Name: Barcode
- Image Source: Database
- Field to Use:
=System.Convert.FromBase64String(Fields!SIM_QRPGlobal_BarcodeRDLCText.Value) - MIME Type:
image/bmp
- Size:
- Display: Resize proportionally
- Visibility:
- Expression:
=IsNothing(Fields!SIM_QRPGlobal_BarcodeRDLCText.Value) OR (Globals!PageNumber>1)
- Expression:
- General:
- Save the edited
.rdlfile. - Go back to Report Layouts in Business Central and add the edited layout:
- Select "New" to add a new layout, and upload the edited file.
- Alternatively, you can replace the existing layout with the edited file.
- Link the report to the newly created layout.
- When you print the report, the barcode should be displayed correctly.
Extending Word Reports
- In this section, we will add a QR Pay QR-Code to a report of your choice.
- Create a new
.al-file in Visual Studio Code or open an existing.al-file that extends the desired report. -
Add the following code to the opened file:
-
Replace "XXX" with the ID of the report you want to extend (Report 1306 "Standard Sales - Invoice and 117 Reminder are extended in the standard of QR Pay already).
- Publish the extension.
- Open the Word file of the report.
- Navigate to the "Developer" tab in the Word document and select "XML Mapping Pane".
- Right-click on "Global_Barcode".
- Select "Insert Content Control" and then "Picture".
- Position the picture where you want the barcode to appear in the document.
- Save the Word file.
- Go back to Business Central and upload the Word file as a layout.
- Link the edited layout to the corresponding report.
- When printing this report, the barcode will now be output.