Printing QR Code in the Customisations

Discussion in 'Knowledge Base' started by admin, Apr 5, 2021.

  1. admin

    admin Administrator Staff Member

    (From TallyPrime Release 1.1)

    QR code (Quick Response Code) is a convenient way to store all kinds of data or information in a small space. Now customers can add QR Codes in Tally invoices depending upon the IRN response. By default, this QR Code will have IRN and other information. Generally, QR codes uses to make UPI payments, company details like item details, addresses, phone numbers, E-mail addresses, company websites, URLs, and so on.

    From TallyPrime Release 1.1, customers can print QR Code in the transactions like Sales, Credit Note, Debit Note, POS, and Receipt as tax invoice, and so on. This helps the customers to print the required details in the QR Code.

    You can now print the QR Code in your customisations as well based on your requirements. A new attribute QR Code is introduced at the Part level to print the QR Code.


    [Part: <Part Name>]

    QR Code : <Sub-attribute 1>:<Sub-attribute 2>


    Sub-attribute 1 specifies the text to be enclosed in a QR Code.

    Sub-attribute 2 specifies whether the QR Code should have a border or not. This is the optional parameter. The default value is ‘YES’.

    QR Code Usage in TDL
    In TDL, the QR Code can be used in the following ways:

    • QR Code with a border using hardcoded text
    [Part : TSPLSmpQRCode]

    QR Code : “This is the text which will be encoded into the QR Code”

    • QR Code without border using hardcoded text
    [Part : TSPLSmpQRCode]

    QR Code : “This is the text which will be encoded into the QR Code”: NO

    • QR Code using a function
    [Part : TSPLSmpQRCode]

    QR Code : $$<FunctionName>

    • QR Code using field value
    [Part : TSPLSmpQRCode]

    QR Code : #<FieldName>

    • QR Code using variable value
    [Part : TSPLSmpQRCode]

    QR Code : ##<VariableName>

    • QR Code using sub-expression like system formula
    [Part : TSPLSmpQRCode]

    QR Code : @@<ExpressionName>

    An additional option of error correction is implemented as a system variable (as it is expected to be an advanced setting), named ‘SVQRErrorCorrectionLevel‘. It is a number variable. With higher error correction level, the ability to sustain “damage” and function even when a part of the QR code image is obscured, defaced or removed, is higher. All QR Code that will be generated in Tally will take error correction from this system variable. The various levels it can hold are as follows:

    • Level ‘0’ : withstands up to 7% damage (known as LOW error correction level)
    • Level ‘1’ : withstands up to 15% damage (known as MEDIUM error correction level)
    • Level ‘2’ : withstands up to 25% damage (known as QUARTILE error correction level)
    • Level ‘3’ : withstands up to 30% damage (known as HIGH error correction level)
    Any other number specified in the system variable will be rounded to the nearest value in the range of 0 to 4. If the value is not specified through the system variable, the default value is taken as ‘0’ i.e, LOW.

    • The higher the error correction level, the more space is required to render the QR Code because the resolution of the QR Code image increases with a higher error correction level.
    • The higher the error correction level, the more damage it can sustain before it becomes unreadable.
    • Level 0 or Level 1 represents the best compromise between space and roughness for general marketing use.
    • Level 2 and Level 3 are generally recommended for industrial environments where keeping the QR Code clean or undamaged will be a challenge.
    You can set the system variable ‘SVQRErrorCorrectionLevel’ as given below:

    [System : Variable]

    SVQRErrorCorrectionLevel : 2

    [Variable : SVQRErrorCorrectionLevel]

    Type : Number


    Consider the use case as a sales executive wants the name of the stock item and its closing balance on his mobile to send it to his customer.

    [#Part: STKI Basic]

    Add : Right Part : At End : StockItem QRcode

    [Part: StockItem QRcode]

    Line : Empty

    QR Code : ($Name + “, Closing Balance: ” + $$String:$ClosingBalance) : True

    Width : 20% screen

    Height : 20% screen



    When the user scans the QR code, he gets the information on his mobile as given below:


    Points to Remember

    • The minimum border thickness recommended for a QR code depends on the version of the QR code, so it is recommended to use the border in the QR Code attribute instead of using the border at the part level. Additional border can be specified in Part if required.
    • The QR code library supports UTF-8 Unicode characters.

  2. Bhawna

    Bhawna Member

    Dear Admin

    Thanks for sharing this information. I am currently using a barcode for Stock Item (Alias) using the TDL. Is there a way I could use QR Code for Stock Item Labels? Would appreciate any inputs regarding the same. Thanks

    TDL currently used

    ;; Sri Ganeshji : Sri Balaji : Sri Pitreshwarji : Sri Durgaji : Sri Venkateshwara

    Objective(s) :-
    - To Print Barcode for the Stock Items

    Specific TDL Feature(s) used :-
    - Repeat attribute at Part Level
    - Explode attribute at Line Level
    - Creation of new Style using Bar coding Font ‘IDAutomationHC39S’
    - User Defined Function to replace "" (Space) with "=" symbol as this font ‘IDAutomationHC39S’ treats "=" as space.

    Last Updation :-
    - Altered on 17/06/2010

    ;; Adding Label Printing Report to the already existing Report

    [#Form: Purchase Color]

    Add : Print : TSPL FFE LabelPrint
    Add : Button : TSPL FFE LabelPrint
    [Button : TSPL FFE LabelPrint]
    Action :print Report: TSPL FFE LabelPrint
    Key :ctrl+F6
    ;;Label Printing Report

    [Report: TSPL FFE LabelPrint]

    Form : TSPL FFE LabelPrint
    Object : Voucher

    [Form: TSPL FFE LabelPrint]

    Part : TSPL FFE LabelPrint
    Width : 125 MMS
    FullHeight : Yes

    [Part: TSPL FFE LabelPrint]

    Parts : TSPL FFE LabelPrint1,TSPL FFE LabelPrint2
    Vertical :No

    [Part: TSPL FFE LabelPrint2]
    Use: TSPL FFE LabelPrint1

    [Part: TSPL FFE LabelPrint1]

    Line : TSPL FFE LabelPrint
    Repeat : TSPL FFE LabelPrint : Inventory Entries
    Scroll : Vertical

    [Line: TSPL FFE LabelPrint]

    Field : TSPL FFE StkItemLabel1, TSPL FFE StkItemLabel2
    Explode : TSPL FFENLine
    Explode : TSPL FFE MoreLabels : $$Number:$BilledQty > 1
    Space Bottom : .75

    [Field : TSPL FFE StkItemLabel2]
    Use : Name Field
    Set as : $StockItemName
    Style : Normal
    Inactive : Yes

    [Part : TSPL FFENLine]
    Lines : TSPL FFENLine3, TSPL FFENLine2

    [Line : TSPL FFENLine2]
    Fields : TSPL FFE StkItemLabel2
    Local : Field : TSPL FFE StkItemLabel2: Set as : $TSPLFEEStkAlias:StockItem:$StockItemName
    Local : Field : TSPL FFE StkItemLabel2: Inactive: $$IsEven:$$ExplodeLevel+1
    Height : 5 MM

    [Line : TSPL FFENLine3]
    Fields : Info Field, TSPL FFERate
    Local : Field : Info Field : Info : "Rate: Rs "
    Local : Field : Info Field : Inactive: $$IsEven:$$ExplodeLevel+1
    Height : 5 MM

    [Field : TSPL FFERate]
    Use : Short Name Field
    Set as : $StandardPrice:StockItem:$StockItemName
    Inactive : $$IsEven:$$ExplodeLevel+1
    Style : Normal Bold
    Width : 100 MMS

    [Part: TSPL FFE MoreLabels]

    Line : TSPL FFE MoreLabels

    [Line: TSPL FFE MoreLabels]

    Field : TSPL FFE StkItemLabel1
    Explode: TSPL FFENLine
    Explode : TSPL FFE MoreLabels : $$Number:$BilledQty > ($$ExplodeLevel+$$Line) *2
    Space bottom : .75

    [Field: TSPL FFE StkItemLabel1]

    Use : Name Field
    Set as : "(" + @TSPLFEEBarcodeLF + ")"
    TSPLFEEBarcodeLF : $$TSPLFFEBarcodeString:mad:TSPLFEEStkName
    TSPLFEEStkName : If $$IsEmpty:($TSPLFEEStkAlias:StockItem:$StockItemName) then $StockItemName +
    else ($TSPLFEEStkAlias:StockItem:$StockItemName)
    Style : TSPL FFE BarCode
    Width : 125 MMS

    [Style: TSPL FFE BarCode]

    Font : IDAutomationHC39S
    Height : 14

    [#Object: StockItem]

    TSPLFEEStkAlias : $$Alias

    ;; Function to replace space with "="

    [Function: TSPL FFE BarcodeString]

    Parameter : TSPLFFEEBarcodeInput : String

    Variable : TSPLFFE Temp : String
    Variable : TSPLFFE Count : Number
    Variable : TSPLFFEEBarcodeOutput : String

    10 : Set : TSPLFFE Temp : ""
    20 : FOR TOKEN : TSPL TokenVar : ##TSPLFFEEBarcodeInput : " "
    30 : Set : TSPLFFE Temp : ##TSPLFFETemp + $$String:##TSPLTokenVar + "="
    40 : END FOR
    50 : SET : TSPLFFE Count : $$StringLength:##TSPLFFETemp
    60 : SET : TSPLFFEEBarcodeOutput : $$StringPart:##TSPLFFETemp:0:(##TSPLFFECount-1)
    70 : RETURN : ##TSPLFFEEBarcodeOutput

    ;; End-of-File

  3. somnath mali

    somnath mali New Member

    Hello Sir, I Want QR TDL in POS invoice, IS Succses ? Then Contact Me. 9545421155

Share This Page