How to add an EPC QR code to an invoice from Delphi and Lazarus

2022-03-29

The standardization of payment systems results not only in new standards but also in new documents built on these standards. The reporting system should offer its users a fast and convenient way to create such standard documents.

EPC is a European Payments Council standard. It was designed to simplify the coding of payment information in the Single Euro Payments Area using a QR code. Such a barcode contains all the necessary information for making a payment. You can see an example of encoded information in the table below.

Service Tag:

BCD

Version:

001

Character set:

1

Identification:

SCT

BIC:

BPOTBEB1

Name:

Red Cross

IBAN:

BE72000000001616

Amount:

EUR1

Reason (4 chars max):

CHAR

Ref of invoice:

Empty line or REFINVOICE

Or text:

Urgency fund or Empty line

Information:

Sample EPC QR code

FastReport VCL has special classes of presets to simplify the arrangement of such data and organize them as objects. The TfrxEPCPaymentPreset class is designed to quickly generate a QR code in the EPC format.

Let's look at how to add an EPC QR code and connect to it the data from the example. It is based on a report from our demo application “Nested Groups”. The report has been slightly changed to display a list of purchased items for each company. We want to add an EPC QR code at the end of each company's payment document so that the client could make a quick payment.

Our report in the report designer

Select a barcode object with the “QRCode” type on the FastReport VCL components palette and place it on the footer band.

Selecting an object to create

Click on the barcode object and go to the ExpressionPreset property, expand it, and select TfrxEPCPaymentPreset in the PresetClass property.

Selecting a class of settings

The settings have been assigned and can now be accessed by expanding the DataObject property in the Object Inspector.

Barcode settings

Next, we are going to link the fields with relevant data. Drag the required fields from the data tree to the desired property in the object inspector.

Linking fields to properties

To enter static data, you need to use single quotes, because these fields are expressions. For example, you would use the format 'BE00000000000000' to specify a fixed value in the IBAN property.

Let's combine all the necessary data to make the code by assigning the appropriate properties.

Barcode settings

You can run the report and make sure that the barcode is generated in the desired format.

Preview

These are not all the possibilities of this class of settings. The DrawOptions property allows you to control frame settings and additional information in accordance with the scan2pay standard.

Display settings

Let's take a closer look at these properties:

FillColor: the background color of the barcode fill.
FrameColor: frame color with rounded edges.
FrameVisible: enables or disables the frame inside the barcode.
FrameWidth: inner frame thickness.
Hint: additional text information
HintType: determines where to show additional information:

  • htEPCNone –to hide additional information;
  • htEPCLeft –along the left edge of the frame;
  • htEPCRight - along the right edge of the frame;
  • htEPCTop - along the top edge of the frame;
  • htEPCRight - along the bottom edge of the frame;

Fill in the fields as shown in the screenshot above and run the report for execution.

Preview

As a result, we received a scan2pay barcode. These settings are unusual because the frame and text are drawn inside the object (unlike the frame around the object, for which the Frame property is responsible), and such a frame will be displayed correctly in all formats of exported files.

December 11, 2023

New S3 transport (Amazon) in FastReport VCL

In this article, we will look at the new transport in S3 (Amazon) for FastReport VCL, which is an object storage of files and buckets.
September 26, 2023

New NextCloud transport in FastReport VCL

Detailed instructions on how to use the new transport to connect to NextCloud to save the built reports to the cloud.
September 26, 2023

Installing FastReport and FastCube components in Lazarus

Instructions for installing FastReport in Lazarus for various operating systems with a comparison of Trial, Professional editions.
Fast Reports
  • 800-985-8986 (English, US)
  • +4930568373928 (German)
  • +55 19 98147-8148 (Portuguese)
  • info@fast-report.com
  • 901 N Pitt Str #325 Alexandria VA 22314

© 1998-2024 Fast Reports Inc.