QR codes on fiscal documents

As of January 1, 2021, invoices and other fiscal documents need to include a QR code. When generating the electronic signature, the QR code is generated at the same time. The data is stored in a new table.

This is in compliance with Decree-Law No. 28/2019.

Fiscal documents that require the QR code include, but are not limited to:

  • Invoices, credit notes, debit notes, simplified invoices and invoice receipts

  • Transport notes, packing slips, asset transports, loan packing slips (consignment), and return notes

  • Orders, quotes, consignment invoices, and proforma invoices

  • Receipts and cash VAT receipts

For sales deliveries, the QR code displays the same amount that is in the current document according to the SAF-T export information.

Data storage

The PORQRC - Portuguese QR-data table stores the data needed to generate the QR code string. This table also stores the image of the QR code (IMGQRC) and the string (STRQRC) used to generate the image.

The data for all documents in this table is exported to SAF-T.

Column

Type

Length

Long title

Mandatory

DOCTYP

A

5

Entry type

No

DOCNUM

VCR

 

Document number

No

QRC_A

A

9

VAT number

Yes

QRC_B

A

30

Customer VAT

Yes

QRC_C

A

12

Customer country

Yes

QRC_D

A

2

Document type

Yes

QRC_E

A

1

Document status

Yes

QRC_F

A

8

Document date

Yes

QRC_G

A

60

Document ID

Yes

QRC_H

A

70

ATCUD

Yes

QRC_I1

A

5

VAT region regime PT

Yes

QRC_I2

A

16

VAT exempt tax base

No

QRC_I3

A

16

VAT tax base at reduced rate

No

QRC_I4

A

16

Total VAT at reduced rate

No

QRC_I5

A

16

VAT tax base at intermediate rate

No

QRC_I6

A

16

Total VAT at intermediate rate

No

QRC_I7

A

16

VAT tax base at normal rate

No

QRC_I8

A

16

Total VAT at normal rate

No

QRC_J1

A

16

VAT region regime PT-AC

No

QRC_J2

A

16

VAT exempt tax base

No

QRC_J3

A

16

VAT tax base at reduced rate

No

QRC_J4

A

16

Total VAT at reduced rate

No

QRC_J5

A

16

VAT tax base at intermediate rate

No

QRC_J6

A

16

Total VAT at intermediate rate

No

QRC_J7

A

16

VAT tax base at normal rate

No

QRC_J8

A

16

Total VAT at normal rate

No

QRC_K1

A

5

VAT region regime PT-MA

No

QRC_K2

A

16

VAT exempt tax base

No

QRC_K3

A

16

VAT tax base at reduced rate

No

QRC_K4

A

16

Total VAT at reduced rate

No

QRC_K5

A

16

VAT tax base at intermediate rate

No

QRC_K6

A

16

Total VAT at intermediate rate

No

QRC_K7

A

16

VAT tax base at normal rate

No

QRC_K8

A

16

Total VAT at normal rate

No

QRC_L

A

16

Not subject to VAT

No

QRC_M

A

16

Stamp tax

No

QRC_N

A

16

Total tax

Yes

QRC_O

A

16

Document total

Yes

QRC_P

A

16

Withholding tax

No

QRC_Q

A

4

Hash code

Yes

QRC_R

A

4

Certificate number

Yes

CREDATTIM

ADATIM

 

Date time

No

UPDDATTIM

ADATIM

 

Date time

No

AUUID

AUUID

 

Single identifier

No

CREUSR

AUS

 

User

No

UPDUSR

AUS

 

User

No

STRQRC

A

250

QR Text

No

STAQRC

M

4

QR image status

No

IMGQRC

ABB

 

QR image

No

The index for this table is: DOCTYP+DOCNUM

The information for each field is as follows:

Code

Description

Instructions

SAGE X3 Field

QRC_A

Company VAT number

Enter the issuer's VAT without the country prefix.

<CompanyID> tag in SAFT

QRC_B

Customer VAT

Enter the customer's VAT. When issuing a document, the final consumer is populated with 999999990.

Using the same rule than <CustomerTaxID> in SAFT

QRC_C

Customer Country

Enter the same information used for SAF-T.

<Country> tag in SAFT

QRC_D

Document type

SAF-T document type.

<InvoiceType>/<MovementType>/<Worktype>/<Paymenttype> tag in SAFT

QRC_E

Document status

SAF-T document status.

<InvoiceStatus>/<MovementStatus>/<WorkStatus>/<PaymentStatus> tag in SAFT

QRC_F

Document date

Use this date YYYYMMDD format.

<InvoiceDate>/<MovementDate>/<WorkDate>/<PaymentDate> tag in SAFT

QRC_G

Unique document identification

The document type plus the Sage X3 number doc.

<InvoiceNo>/<DocumentNumber>/<DocumentNumber>/<PaymentRefNo> tag in SAFT

QRC_H

ATCUD

0

0

QRC_I1

VAT region regime

Enter according to the technical notes in the TaxCountryRegion field of SAFT (PT). For a document with no VAT rate, which should appear in table 4.2, 4.3 or 4.4 of the SAF-T (PT), enter 0 (I1:0).

<TaxCountryRegion> in SAFT

QRC_I2

VAT-exempt tax base

Total value of the tax base exempt from VAT (including taxable transactions under Stamp tax, whether or not they are exempt from Stamp tax). Format with 2 decimal places and use a period (.) for the decimal separator with no thousands separator.

 <CreditAmount> or <debitamount> tag when <TaxPercentage>=0 and <TaxCountryRegion>PT</TaxCountryRegion> and <TaxType>=IVA

QRC_I3

VAT tax base at reduced rate

Total value of the tax base subject to the reduced VAT rate. Format with 2 decimal places and use a period (.) for the decimal separator with no thousands separator.

 <CreditAmount> or <debitamount> tag when <TaxCountryRegion>PT</TaxCountryRegion> and <TaxCode>RED</TaxCode> and <TaxType>=IVA

QRC_I4

Total VAT at reduced rate

Total value of VAT at the reduced rate in the document. Format with 2 decimal places and use a period (.) for the decimal separator with no thousands separator.

( <CreditAmount> or <debitamount>* <TaxPercentage>) tag when <TaxCountryRegion>PT</TaxCountryRegion> and <TaxCode>RED</TaxCode>and <TaxType>=IVA

QRC_I5

VAT tax base at the intermediate rate

Total value of the tax base subject to the intermediate VAT rate. Format with 2 decimal places and use a period (.) for the decimal separator with no thousands separator.

  <CreditAmount> or <debitamount> tag when <TaxCountryRegion>PT</TaxCountryRegion> and <TaxCode>INT</TaxCode> and <TaxType>=IVA

QRC_I6

Total VAT at intermediate rate

Total value of VAT at the intermediate rate in the document. Format with 2 decimal places and use a period (.) for the decimal separator with no thousands separator.

 ( <CreditAmount> or <debitamount>* <TaxPercentage>) tag when <TaxCountryRegion>PT</TaxCountryRegion> and <TaxCode>INT</TaxCode> and <TaxType>=IVA

QRC_I7

VAT tax base at the normal rate

Total value of the tax base subject to the normal VAT rate. Format with 2 decimal places and use a period (.) for the decimal separator with no thousands separator.

  <CreditAmount> or <debitamount> tag when <TaxCountryRegion>PT</TaxCountryRegion> and <TaxCode>NOR</TaxCode> and <TaxType>=IVA

QRC_I8

Total VAT at normal rate

Total value of VAT at the normal rate in the document. Format with 2 decimal places and use a period (.) for the decimal separator with no thousands separator.

 ( <CreditAmount> or <debitamount>* <TaxPercentage>) tag when <TaxCountryRegion>PT</TaxCountryRegion> and <TaxCode>NOR</TaxCode> and <TaxType>=IVA

QRC_J1

VAT region regime

Enter according to the technical notes in the TaxCountryRegion field of SAFT (PT).

 <TaxCountryRegion> in SAFT

QRC_J2

VAT-exempt tax base

Total value of the tax base exempt from VAT (including taxable transactions under Stamp tax, whether or not they are exempt from Stamp tax). Format with 2 decimal places and use a period (.) for the decimal separator with no thousands separator.

  <CreditAmount> or <debitamount> tag when <TaxPercentage>=0 and <TaxCountryRegion>PT-AC</TaxCountryRegion> and <TaxType>=IVA

QRC_J3

VAT tax base at reduced rate

Total value of the tax base subject to the reduced VAT rate. Format with 2 decimal places and use a . for the decimal separator and no thousands separator.

  <CreditAmount> or <debitamount> tag when <TaxCountryRegion>PT-AC</TaxCountryRegion> and <TaxCode>RED</TaxCode> and <TaxType>=IVA

QRC_J4

Total VAT at reduced rate

Total value of VAT at the reduced rate in the document. Format with 2 decimal places and use a period (.) for the decimal separator with no thousands separator.

 ( <CreditAmount> or <debitamount>* <TaxPercentage>) tag when <TaxCountryRegion>PT-AC</TaxCountryRegion> and <TaxCode>RED</TaxCode> and <TaxType>=IVA

QRC_J5

VAT tax base at the intermediate rate

Total value of the tax base subject to the intermediate VAT rate. Format with 2 decimal places and use a period (.) for the decimal separator with no thousands separator.

  <CreditAmount> or <debitamount> tag when <TaxCountryRegion>PT-AC</TaxCountryRegion> and <TaxCode>INT</TaxCode> and <TaxType>=IVA

QRC_J6

Total VAT at intermediate rate

Total value of VAT at the intermediate rate in the document. Format with 2 decimal places and use a period (.) for the decimal separator with no thousands separator.

  ( <CreditAmount> or <debitamount>* <TaxPercentage>) tag when <TaxCountryRegion>PT<-AC/TaxCountryRegion> and <TaxCode>INT</TaxCode> and <TaxType>=IVA

QRC_J7

VAT tax base at the normal rate

Total value of the tax base subject to the normal VAT rate. Format with 2 decimal places and use a period (.) for the decimal separator with no thousands separator.

 <CreditAmount> or <debitamount> tag when <TaxCountryRegion>PT-AC</TaxCountryRegion> and <TaxCode>NOR</TaxCode> and <TaxType>=IVA

QRC_J8

Total VAT at normal rate

Total value of VAT at the normal rate in the document. Format with 2 decimal places and use a period (.) for the decimal separator with no thousands separator.

 ( <CreditAmount> or <debitamount>* <TaxPercentage>) tag when <TaxCountryRegion>PT-AC</TaxCountryRegion> and <TaxCode>NOR</TaxCode> and <TaxType>=IVA

QRC_K1

VAT region regime

Enter according to the technical notes in the TaxCountryRegion field of SAFT (PT).

 <TaxCountryRegion> in SAFT

QRC_K2

VAT-exempt tax base

Total value of the tax base exempt from VAT (including taxable transactions under Stamp tax, whether or not they are exempt from Stamp tax). Format with 2 decimal places and use a period (.) for the decimal separator with no thousands separator.

  <CreditAmount> or <debitamount> tag when <TaxPercentage>=0 and <TaxCountryRegion>PT-MA</TaxCountryRegion>  and <TaxType>=IVA

QRC_K3

VAT tax base at reduced rate

Total value of the tax base subject to the reduced VAT rate. Format with 2 decimal places and use a period (.) for the decimal separator with no thousands separator.

  <CreditAmount> or <debitamount> tag when <TaxCountryRegion>PT-MA</TaxCountryRegion> and <TaxCode>RED</TaxCode> and <TaxType>=IVA

QRC_K4

Total VAT at reduced rate

Total value of VAT at the reduced rate in the document. Format with 2 decimal places and use a period (.) for the decimal separator with no thousands separator.

 ( <CreditAmount> or <debitamount>* <TaxPercentage>) tag when <TaxCountryRegion>PT-MA</TaxCountryRegion> and <TaxCode>RED</TaxCode> and <TaxType>=IVA

QRC_K5

VAT tax base at the intermediate rate

Total value of the tax base subject to the intermediate VAT rate. Format with 2 decimal places and use a period (.) for the decimal separator with no thousands separator.

  <CreditAmount> or <debitamount> tag when <TaxCountryRegion>PT-MA</TaxCountryRegion> and <TaxCode>INT</TaxCode> and <TaxType>=IVA

QRC_K6

Total VAT at intermediate rate

Total value of VAT at the intermediate rate in the document. Format with 2 decimal places and use a period (.) for the decimal separator with no thousands separator.

  ( <CreditAmount> or <debitamount>* <TaxPercentage>) tag when <TaxCountryRegion>PT-MA</TaxCountryRegion> and <TaxCode>INT</TaxCode> and <TaxType>=IVA

QRC_K7

VAT tax base at the normal rate

Total value of the tax base subject to the normal VAT rate. Format with 2 decimal places and use a period (.) for the decimal separator with no thousands separator.

 <CreditAmount> or <debitamount> tag when <TaxCountryRegion>PT-MA</TaxCountryRegion> and <TaxCode>NOR</TaxCode> and <TaxType>=IVA

QRC_K8

Total VAT at normal rate

Total value of VAT at the normal rate in the document. Format with 2 decimal places and use a period (.) for the decimal separator with no thousands separator.

 ( <CreditAmount> or <debitamount>* <TaxPercentage>) tag when <TaxCountryRegion>PT-MA</TaxCountryRegion> and <TaxCode>NOR</TaxCode>  and <TaxType>=IVA

QRC_L

Not subject / non-taxable in VAT

Total value related to non-subject / non-taxable transactions in VAT. Format with 2 decimal places and use a period (.) for the decimal separator with no thousands separator.

 <CreditAmount> or <debitamount> tag when <TaxType>=NS

QRC_M

Stamp tax

Total value of Stamp tax in the document. Format with 2 decimal places and use a period (.) for the decimal separator with no thousands separator.

 <CreditAmount> or <debitamount> tag when <TaxType>=IS

QRC_N

Total taxes

Total value of VAT and Stamp Tax - SAF-T (PT) TaxPayable field. Format with 2 decimal places and use a period (.) for the decimal separator with no thousands separator.

<TaxPayable> tag in SAFT

QRC_O

Total document

Total document value: GrossTotal field of SAFT (PT). Format with 2 decimal places and use a period (.) for the decimal separator with no thousands separator.

< GrossTotal> tag in SAFT

QRC_P

Withholding tax

Total withholding tax amount: SAF-T (PT) WithholdingTaxAmount field. Format with 2 decimal places and use a period (.) for the decimal separator with no thousands separator.

<WithholdingTaxAmount> tag in SAFT

QRC_Q

Hash code

The 4 digits used in printing.

The 4 numbers from HASH used in the printout

QRC_R

certificate number

 

<SoftwareCertificateNumber> tag in SAFT or

Reports

A QR Code was added in the SBONFACP - Customer invoice report.

You need to add the PORQRC table to reports. Include the following links depending on the report in question.

The DOCNUM and DOCTYP fields in the PORQRC table connect the table and fields listed below. The table join needs to be a left join between the original table and the new table.

  • ORDERS - SORDER to SOHNUM + SOHTYP

  • QUOTES - SQUOTE to SQHNUM + SQHTYP

  • PROFORMA/INVOICE - SINVOICE to NUM + SIVTYP

  • DELIVERIES - SDELIVERY to SDHNUM + SDHTYP

  • CUSTOMER RETURNS- SRETURN to SRHNUM + SRHTYP

  • STOCK DOCUMENTS - SCHGH to VCRNUM + SGHTYP

  • SUPPLIER RETURNS - PRETURN to PNHNUM + PNHTYP

  • TRANSPORT NOTE - TRANNOTEH to TNHNUM + TNHTYP

  • PAYMENTS - PAYMENTH to NUM + PAYTYP

  • AUTO INVOICE - PINVOICE to NUM + PIVTYP

Generate and add the QR image

Generate the QR code image, IMGQRC, using the QR code string stored in STRQRC field.

The QR code must comply with the following specifications:

  • Error Recovery Rate (ECC): M

  • Type: Byte

  • Points per module (Size): 2

  • Version: v = 9 (minimum value)

  • Image dimensions: minimum 30 x 30 mm

There is no font defined for QR code generation. 

Add the IMGQRC image to the report in an area where it does not overlap existing report information and 2,5 mm from the page margins as shown in the example below.