Proposal summary
AMVOP would like to incorporate the recent updates from ZATCA regarding the QR Code of Invoices to match their norms and policies of E-Invoicing Regulations.
Requirement
Need to implement the recent updates from ZATCA on QR Code in the Invoice PDFs generated in Netsuite.
Our Solution
Updates from ZATCA on QR Code Creation:
It is mandatory to generate and print the QR code encoded in Base64 format with up to 500 characters that must contain the fields as specified below table.
Here we consider the first five as the information regarding the rest are not yet available.
We propose a scripting solution for QR Code Encoding. Because it has to undergo 2 conversions and intermediate concatenation operations:
We will add a field in the Invoice record to store the final conversion result and this field will be referred to in the PDF ( Commercial Invoice (Local, Commercial Invoice (Export), ATCL Invoice, AMMP Invoice ) for generating the QR.
- Concatenation and Conversion-
An example of real-time scenario is shown below:
- For the Sellers name = “Bobs Records” its string has length=12 including the Space, and its hexadecimal value is 426f6273205265636f726473. Its Tag value (which is static) is 1 (decimal) so its hexadecimal is 01 (in one byte). The length (which is dynamic depending on the length of the value) is 12 (decimal) so its hexadecimal is 0c (in one byte).
- Now concatenate this 010c with 426f6273205265636f726473 which gives 010c426f6273205265636f726473.
- Repeat the same steps 1 and 2 for the rest VAT Registration Number, Time Stamp, Invoice Total (with VAT) and VAT Total.
- Then concatenate all the results for the following 5 variables:-
- Sellers name / Company name: This can be populated from Subsidiary
- Company VAT Registration number: This can be populated from Subsidiary
- Timestamp of the invoice (date and time): The time at which the Print is generated
- Invoice total : Total Invoice Amount (Can fetch from the corresponding transaction)
- VAT total : Total Tax Amount (Can fetch from the corresponding transaction)
which gives like this:
- Now convert this entire string to Base64 which gives:
- Basic conversions-
UTF8 (Normal Text ) ¹–> Hexadecimal (Hex) ² –> Base64
After scanning the QR the text displayed will be like this:
Additional Instructions:
These are some risk factors but we can handle this in script
Assumptions
- AMVOP confirmed that ZATCA Scanning System is compatible of Base64 input and can decode the value to the respective text values as shown:
- The Encoding process is only for the 5 data available such as Sellers name, VAT Registration Number, Time Stamp, Invoice Total (with VAT) and VAT Total. Their values will follow the same reference and alignment in Advanced PDF Template as implemented in the previous customisation.