Skip to main content

Notifications

Announcements

No record found.

Customizing POS Receipt Layout

Community Member Profile Picture Community Member Microsoft Employee

Introduction

POS Receipts are generated after every transaction that occurs on POS. The default receipt provided by LS Central is generally sufficient but as is in all things there are always exceptions.

There are two approaches we can use to modify the POS Receipts and we are going to see them both.

Slip:  Staff:  Date :  CronuS Food Market South  64.89  -65.00  0.11  00000p0001000000067  tro  03/31/21 9:02  De s on  Computer Ill 800 MHz  3 pcs e 21.63  64  89  57  c  Total LCY  VAT  25  Net . Amt  51.91  VAT  12.98  Amo u n t  64 .89  Welcome again

This is the default receipt provided by LS. I have marked division of sections using color.

  • Red – Header
  • Green – Body
  • Blue – Footer

References

Pre-requisites

  • Microsoft Dynamics 365 Business Central
  • LS Central
  • Development Environment Setup for Business Central

Configuration

  • Using Receipt Printing from POS Terminal / Store Card

We can add text directly into the Header or the Footer of the POS Receipts and also define some basic properties like bold, italic or wide for the text. It can be defined at POS Level or Store Level i.e. for individual POS Terminals or for all the POS Terminals in a Store.

  • Go to POS Terminal Card.
  • Go to Printing -> Receipt Printing
  • Here you add static content, like Store Name, GST/VAT No, Store Address, etc in both header and footer.
  • Here you can also define, if you want to specify the Item No. or Barcode in the POS Receipt.
  • Similar, to this, we can also define for Store level, i.e. all the POS Terminals in a Store.
  • Using the “POS Print Utility” procedure:

In this method, we will write actual code to modify the receipt. If you are using NAV, then this is pretty straight forward, but in case of Business Central, we only have access to Events which we can subscribe to, to change the behaviour of the procedure.

The highlighted four procedures do the majority of the work done in printing.

PrintHeader -> Prints the content of the header defined in the Receipt Printing.

Slip:  Staff :  Date :  Cronus Food Market South  64.89  64.89  -65.00  0.11  00000P0001000000067  03/31/21 9:02  Des on  Computer 111 800 MHz  3 PCS @ 21.63  Iota i LCY  C  25  Net. Amt  51.91  again  VAT  12.98  Amo u n t  64.89  We come

PrintSubHeader: It prints the Information related to the current Transaction.

Slip:  Staff :  Date :  Clonus Food Market South  64 .89  64 .89  -65.00  0.11  00000P0001000000067  tro  03/31/21 9:02  Computer Ill 800 MHz  3 PCS e 21.63  Total  Trans :  12 .98  C  25  We ome  Net. Amt  51.91  again  Amount  64 .89

PrintSalesInfo: It prints the actual Items of the Transaction along with VAT and other details at the bottom.

Date :  Cronus Food Market South  00000p0001000000067  64 . E9  64.89  -65.00  0.11  03/31/21 9:02  Description  computer 111 goo MHz  3 pcs e 21.63  Total  VAT'  25  LCY  Net . Amt  51 .91  VAT  12 . 98  Amount  64 .89  Welcome again

PrintFooter: It prints the Footer Text defined in the Receipt Printing.

staff :  Date :  Clonus Food Market South  00000P0001000000067  64.89  -65.00  0.11  03/31/21 9:02  Des on  Computer Ill 800 MHz  3 pcs @ 21.63  64  Total LCY  VAT  25  Net . Amt  51.91  VAT  12.98  89  Amou n t  64.89  Re I come again

Now that we know which procedure is responsible for which part of the Receipt, we can subscribe to that procedure’s event.

For example, let’s try me modify the “Sub Header” part of the Receipt.

As such we need to modify the “PrintSubHeader” procedure, so we subscribe to its event.

The parameter, sender gives us a reference to the current instance of “POS Print Utility” codeunit which we can use to call all the procedures of that codeunit with the correct values.

TransactionHeader is the current “Transaction Header” record.

At the start of the procedure, we need to set the IsHandled variable to True so that once your procedure ends, the parent “PrintSubHeader” procedure exits immediately.

  • DSTR – It is the design String, here we define the design of the Line that will be printed. It is at max up to 40 characters. It follows the pattern “#(alignment)##…”. The Design String is divided into sections, each section contains one piece of data.
  • Value – It is a text array, which defines the data which is to be printed in the sections. The number of values set in the Value should be equal to the sections in the design string.
  • Node – It is used as a Label for the data in the section. The number of values in this array should be the same as the values in Value array.

Next, the essential part is the “FormatStr” procedure, the 4 booleans at the end are used to specify whether the String is going to be Wide, Bold, High or Italic respectively.

After this, the final piece of the puzzle is the “AddPrintLine” procedure, the first argument is the “Section ID”, it is related to which part of the receipt we are printing in, it is better to set it the same as the procedure from which this event is being triggered.

Next argument, specifies the maximum number of Sections that will be in the design string, just make sure it is more than the values you have provided.

Next, we pass the Node and Value array, the Design String and specify whether the String is going to be Wide, Bold, High or Italic and the Tray at the end. The value for Tray can be taken directly from the Event’s parameters.

Similar to this, we will add one more line and then we will check the results.

The “PrintSeperator” procedure is used to draw a horizontal line across the receipt using dashes.

Here is the final result:

Cronus Food Market South  Inv. No. : 00000?0001000000066  Date: 04/01/21  Computer 111 800 MHz  2 pcs @ 21.63  Total  VAT i  C  25  We come  Net . Amt  34.61  aga n  Staff :  VAT  8.65  43 .26  43.26  -43.26  Amount  43.26

Conclusion:

Thus we saw how to customize POS Receipts in LS Central either through POS/Store Receipt Printing or for advanced customizations through Event subscriptions.

The post Customizing POS Receipt Layout appeared first on Cloudfronts - Microsoft Dynamics 365 | Power BI | Azure.

Comments

*This post is locked for comments