Thursday, September 14, 2017

How to extend receipt using custom fields

Hello it has been a while since my last post. Today I want to guide you thru on extending the receipt layout using custom fields. This is great if the business wanted to see additional fields or information on the receipt. If you follow this guide you will become a pro/expert on modifying the receipt :P

1. Open up the AOT and go to RetailLangaugeText table, open it and fill in the column “languageId” to “en-us”, Text to how you want it to show up on the receipt designer and uniqe TextId. You can close the AOT after you’re done.




2. Go to Retail > Setup > POS > Profiles > Custom fields and add your custom field and assign a unique Caption text ID that you created earlier in the AOT.

3. We want to add the new Custom field on the Receipt layout. Go to receipt designer and add the field to the correct section of the receipt. In my case I added "Discount Price" to the "Lines" section of the receipt. Click “Save” at the top and close this form.


4.  Open up your Retail SDK and open up your Commerce Run-time solution. If you don't have the Retail SDK you would need to install this component using AX Setup.

5. On the Solution Explorer type in “ReceiptService.cs” into the search bar and open that class.

6.  The receipt layout has 3 sections: Header, Line, Footer. Depending on where you are planning to put your custom field matter in this case. If you are using the custom field in Header or Footer, the method you want to use is GetInfoFromTransaction(). If you are using the field in the Lines section then the method you want to code in is GetInfoFromSaleLineItem(). In my case I’m planning to put mine on the Lines of the receipt so I will be putting my custom code in GetInfoFromSaleLineItem().

7. This method contains numerous case statements. What I’m trying to achieve on the receipt is to show the discounted price of the item instead of the original price.


8. Navigate to where the Reference folder and we want to copy these DLLs.


9.  Open IIS and we want to stop the “RetailServer”.


10. Paste the DLLs into this folder. After this is done don’t forget to start IIS back up!

11. Open mPOS and login. Go back to Visual Studio and we want to attach the process.

12. Attach the following processes, click Attach if you get a warning. We want to make sure that our symbols get loaded for debugging. We can see this if you see a red circle where you put the breakpoint. If you see a white circle, then that mean the symbol did not load.

13.  From here you can debug and test your code to see if it working correctly.

14.  I was able to get the discounted price to show instead of the original price. For the customer they would like to know how much they have saved so I included the Regular and Saving fields. This will let the customer know the amount they have saved.






4 comments:

  1. Hope you can response me , I need make a new label what divide the total amount with tax in the receipt for example Total Amount with tax : 2000 / 100
    New Total Amount with tax : 20
    this is to put in the receipt the normal "total amount with tax" and "New total amount with tax" in the same receipt... greetings

    ReplyDelete
    Replies
    1. You should be able to as long as as those fields exist in the code.

      Delete
  2. Thanks for the post. I like this very much. Receipt books in Australia can be ordered in online. Online services are very popular for fast delivery and affordability.

    ReplyDelete
  3. Here is the investors contact Email details,_   lfdsloans@lemeridianfds.com  Or Whatsapp +1 989-394-3740 that helped me with loan of 90,000.00 Euros to startup my business and I'm very grateful,It was really hard on me here trying to make a way as a single mother things hasn't be easy with me but with the help of Le_Meridian put smile on my face as i watch my business growing stronger and expanding as well.I know you may surprise why me putting things like this here but i really have to express my gratitude so anyone seeking for financial help or going through hardship with there business or want to startup business project can see to this and have hope of getting out of the hardship..Thank You.

    ReplyDelete