how to add a custom field to receipt

2
How to: Add a custom field to a receipt Sample files N/A Further reading Microsoft Dynamics AX 2012 for Developers [AX 2012] SDK Download RunOperation Method Tutorial A developer who is familiar with Microsoft .NET can use the SDK to create custom receipt fields. One will need to install the SDK and then modify the appropriate projects to create custom receipt fields. 1. Before getting started it is advised to create a backup archive of the printer service that ships with POS. This may be found in the “Services” subfolder under the folder containing the Retail Point of Sales (POS.exe) application. The printing service is contained in the “Printing.dll” file in the “Services” folder. 2. Locate the Printer service in the SDK. Build the project to confirm that your environment is setup properly. When testing the service, it will need to be copied to the POS service folder as described in the previous step. 3. Open the “FormModulation.cs” file which is part of the printing service in the SDK. 4. For general receipt variables or fields, update the “GetInfoFromTranscation” method and add a case statement for the new field. Note that the name should be all upper case. Return the string that has the desired value. If needed you can use “theTranscation” to get data associated with the transaction. For example, to defined a receipt field (called “RePrintTime”)

Upload: islam-sultan

Post on 23-Oct-2015

26 views

Category:

Documents


0 download

DESCRIPTION

How to Add a Custom Field to Receipt

TRANSCRIPT

Page 1: How to Add a Custom Field to Receipt

How to: Add a custom field to a receipt

Sample filesN/A

Further reading Microsoft Dynamics AX 2012 for Developers [AX 2012] SDK Download RunOperation Method

TutorialA developer who is familiar with Microsoft .NET can use the SDK to create custom receipt fields. One will need to install the SDK and then modify the appropriate projects to create custom receipt fields.

1. Before getting started it is advised to create a backup archive of the printer service that ships with POS. This may be found in the “Services” subfolder under the folder containing the Retail Point of Sales (POS.exe) application. The printing service is contained in the “Printing.dll” file in the “Services” folder.

2. Locate the Printer service in the SDK. Build the project to confirm that your environment is setup properly. When testing the service, it will need to be copied to the POS service folder as described in the previous step.

3. Open the “FormModulation.cs” file which is part of the printing service in the SDK. 4. For general receipt variables or fields, update the “GetInfoFromTranscation” method and add a

case statement for the new field. Note that the name should be all upper case. Return the string that has the desired value. If needed you can use “theTranscation” to get data associated with the transaction. For example, to defined a receipt field (called “RePrintTime”) that shows the time the current time each time the receipt is printed, you may add the following to the switch statement:

case "REPRINTTIME": return DateTime.UtcNow.ToString("HH:mm");

5. For variables that apply to the “Lines” section the same steps can be done as identified above but the code change would be made within the “GetInfoFromSalesLineItem” method.

NOTE: The above descirbes how to add support for receipt varialbles in POS. Changes to the receipt designer are not covered by this document.