80585 Ax2012 Enus Retail All
Transcript of 80585 Ax2012 Enus Retail All
-
8/9/2019 80585 Ax2012 Enus Retail All
1/152
Table of Contents
Module 1: MICROSOFT DYNAMICS AX 2012 R2 FOR RETAIL INBRICK AND MORTAR STORES- DEVELOPMENT ANDCUSTOMIZATION
Lesson 1 : Course Objectives ....................................................................................................................... 1-1
Module 2: INTRODUCTION TO POINT OF SALE (POS) OVERVIEW
Lesson 1 : Introduction to POS ................................................................................................................... 2-2
Module 3: POS EXTENSIBILITY TECHNICAL OVERVIEW
Lesson 1 : Extend Point of Sale ................................................................................................................... 3-2
Lesson 2 : Retail POS Plug-ins .................................................................................................................... 3-2
Lesson 3 : Commerce Data Exchange: Real-time Service Calls ...................................................... 3-5
Module 4: POS FRAMEWORK
Lesson 1 : POS Architecture Overview ..................................................................................................... 4-2
Module 5: DEVELOPMENT ENVIRONMENT REQUIREMENTSLesson 1 : Development Environment Requirements ........................................................................ 5-2
Module 6: TECHNICAL BACKGROUND
Lesson 1 : Technical knowledge required to customize POS ......................................................... 6-2
Module 7: LOCALIZATION INFORMATION
Lesson 1 : POS Localization ......................................................................................................................... 7-2
1
-
8/9/2019 80585 Ax2012 Enus Retail All
2/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
Module 8: EXTENSIBILITY BEST PRACTICES
Lesson 1 : Solution Approach ..................................................................................................................... 8-2
Lesson 2 : Reference ....................................................................................................................................... 8-5
Module 9: LOGON EXTENSIBILITY – SAMPLE AND HOW-TO
Lesson 1 : Logon Extensibility ..................................................................................................................... 9-2
Module 10: POS THEMES
Lesson 1 : POS Skins .................................................................................................................................... 10-2
Module 11: USER-INTERFACE EXTENSIBILITY – SAMPLE ANDHOW-TO
Lesson 1 : How to Modify a Form in Microsoft Dynamics AX 2012 R2 POS .......................... 11-2
Module 12: TRIGGER EXTENSIBILITY – SAMPLE AND HOW-TO
Lesson 1 : How to Modify the Trigger Project ................................................................................... 12-2
Module 13: SERVICES EXTENSIBILITY – SAMPLE AND HOW-TO
Lesson 1 : How to Modify the Services Project ................................................................................. 13-2
Module 14: BLANK OPERATION EXTENSIBILITY
Lesson 1 : Blank Operation on the Retail POS Register ................................................................. 14-2
Module 15: CUSTOM FIELDS ON POS LAYOUTS
Lesson 1 : Custom Fields on the POS Layout ..................................................................................... 15-2
2
-
8/9/2019 80585 Ax2012 Enus Retail All
3/152
Table of Contents
Module 16: REAL-TIME SERVICES EXTENSIBILITY – SAMPLE ANDHOW-TO
Lesson 1 : Extending the RetailTransactionServiceEx Class .......................................................... 16-2
Module 17: POS PAYMENT CONNECTOR
Lesson 1 : Payment Connector ................................................................................................................ 17-2
Module 18: POS DATABASE TOOL EXTENSIBILITY FOR STOREAND OFFLINE DATABASE
Lesson 1 : CreateDatabase Service ......................................................................................................... 18-2
Module 19: EXTENSIBILITY TESTING CONSIDERATIONS
Lesson 1 : Testing ......................................................................................................................................... 19-2
Lesson 2 : Challenges .................................................................................................................................. 19-5
Lesson 3 : Testing Considerations .......................................................................................................... 19-6
Module 20: EXTENSIBILITY DEPLOYMENT AND HOTFIX UPDATECONSIDERATIONS
Lesson 1 : Deployment Planning ............................................................................................................ 20-2
Lesson 2 : Deploy POS Customizations ................................................................................................ 20-3
Lesson 3 : Merge Any Existing Code Changes with POS and Redeploy .................................. 20-4
Lesson 4 : Install Updates to Non-Database Retail Components ............................................... 20-4
Lesson 5 : Install Updates to Store Databases by Using the Retail Database Utility ........... 20-5
Lesson 6 : Install Update to CDX: Real-Time Service....................................................................... 20-5
Module 21: EXTENSIBILITY LAB MANUAL
3
-
8/9/2019 80585 Ax2012 Enus Retail All
4/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
4
-
8/9/2019 80585 Ax2012 Enus Retail All
5/152
MICROSOFT DYNAMICS AX 2012 R2 FOR RETAIL INBRICK AND MORTAR STORES- DEVELOPMENT AND
CUSTOMIZATIONCourse Objectives
The main objectives of the Microsoft Dynamics for Retail in Brick and MortarStores course is to understand the development and customization that isexplained in the following topics:
• Introduction to Point of Sale (POS) – Overview• POS extensibility technical overview• POS Framework• Development environment requirements• Extensibility Interface Definition – Triggers and Services• Technical background• Localization Information• Extensibility Best practices• Logon Extensibility – Sample and How-to• POS Themes• User-interface Extensibility – Sample and How-to• Trigger Extensibility – Sample and How-to• Services Extensibility – Sample and How-to• Blank Operation Extensibility• Custom Field on POS Layouts• Real-time services Extensibility – Sample and How-to• Device Integration – (Hydra, EFTPOS)• POS Database Tool Extensibility For Store and Offline Database• Extensibility testing considerations• Extensibility deployment considerations• Deployment of ongoing hotfixes for Customized POS for version(s)
and code maintenance
1 - 1
-
8/9/2019 80585 Ax2012 Enus Retail All
6/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
Module Review
Student Objectives1. What do you expect to learn by participating in this course?
2. List three main objectives.
1 - 2
-
8/9/2019 80585 Ax2012 Enus Retail All
7/152
MODULE 2: INTRODUCTION TO POINT OF SALE(POS) OVERVIEW
Module OverviewMicrosoft Dynamics AX for Retail POS is the point of sale (POS) program forMicrosoft Dynamics AX. POS tasks are performed by using a POS register. Thegraphical user interface (UI) is easy to use and can be set up to meet therequirements of many industries, such as grocery, fashion and specialty retailers.
Objectives
The main objective of this module is to discuss the Microsoft Dynamics POSOverview.
2- 1
-
8/9/2019 80585 Ax2012 Enus Retail All
8/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
Introduction to POS
Microsoft Dynamics AX for Retail POS
Microsoft Dynamics AX Retail POS is a solution that brings speed, power,flexibility, dependability, and ease of use to the point-of-sale. Retail POS has adynamic interface that can be configured and customized for your type ofbusiness and store procedures. Additionally, Retail POS can work offline. This helpsmake sure that your stores remain fully operational during network interruptions.All data is automatically updated when the connection is restored.
FIGURE 2.1: RETAIL SOLUTION SYSTEM OVERVIEW
2 - 2
-
8/9/2019 80585 Ax2012 Enus Retail All
9/152
Module 2: Introduction to Point of Sale (POS) Overview
Microsoft Dynamics Retail Components:
Microsoft Dynamics POS interacts with the following retail components to performend to end operations:
• Commerce Data Exchange: Synch service• Commerce Data Exchange: Real time service• Store and offline database
Microsoft Dynamics AX for Retail Synch Service:
Synch service is the integrated service that periodically sends data between thehead office and store database. Communications that use synch service aremanaged through distribution locations and Retail Scheduler in RetailHeadquarters (HQ).
Microsoft Dynamics AX for Retail Real time Service:
Together with synch service and Retail Scheduler, real-time service completes thecommunications mechanism of Microsoft Dynamics AX for Retail by providingreal-time, synchronous communication between POS registers and MicrosoftDynamics AX. It can be used to authenticate cashier logon credentials, sendloyalty requests, and exchange “up-to-the-minute” physical inventory informationbetween the head office and the stores, and more.
Store Database:
Each store must have its’ own database, and a single database is used for multipleregisters. This helps make sure that the same master data is available to all POSregisters in the store.
Offline Database:
You can also create an offline databases on POS computers. An offline databasehelps make sure that the store’s operations can continue even if the connection tothe shared database server is lost. If the connection to the shared database serveris lost, the POS computers switch to offline databases. The shared database andthe offline databases are kept in sync by using Microsoft Sync framework.
The store and the offline database can be set up by using the create databaseutility.
2 - 3
-
8/9/2019 80585 Ax2012 Enus Retail All
10/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
Microsoft Dynamics POS Operations
Microsoft Dynamics AX for Retail POS is the point of sale (POS) program for Retail.You can use Retail POS to perform the following tasks:
• Process sales• Operate the cash drawer• Scan bar codes• Print customer receipts• Calculate the sales total• Calculate tax• Calculate the change that is due back from the amount that is paid
• Issue product refunds• Suspend transactions• Process customer loyalty transactions• Issue credit memos• Issue gift cards• Scan bar codes• Receive payments• Print receipts• Create and track customer orders• Process debit cards and credit cards• Check inventory, plus many more.
The following operations cannot be performed when the store database is offline:
• Print an X report• Print a Z report• Close a shift• Blind-close a shift• View blind-closed shifts• Suspend a shift, plus more
2 - 4
-
8/9/2019 80585 Ax2012 Enus Retail All
11/152
Module 2: Introduction to Point of Sale (POS) Overview
The following operations cannot be performed when the connectivity to HQ is notworking (CDX: Real time service connection down):
• Inventory Lookup• Gift Card Operations• Loyalty Operations• Customer order Operations, plus more
2 - 5
-
8/9/2019 80585 Ax2012 Enus Retail All
12/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
Module Review
Module Review and Takeaways
• About Microsoft Dynamics AX 2012 POS• Real time service• Synch service• POS Operations• Store and Offline database.
Test Your Knowledge
Test your knowledge with the following questions.
1. What is the CDX: Synch service used for?
2. What is the CDX Real-time service used for?
3. What is the difference between the CDX synch service and the CDX Real-timeservice?
4. Describe any POS Operations.
5. Can an offline database be shared across multiple terminals?
6. Describe any two operations that cannot be performed when the POS storedatabase is offline.
2 - 6
-
8/9/2019 80585 Ax2012 Enus Retail All
13/152
Module 2: Introduction to Point of Sale (POS) Overview
Test Your Knowledge SolutionsMODEL ANSWER:
1. Synch service is the integrated service that periodically sends databetween the head office, stores, and individual Retail POS terminals.
2. Real-time service completes the communications mechanism ofMicrosoft Dynamics AX for Retail by providing real-time, synchronouscommunication.
3. Synch service is used for synching the data between HQ and POS.Real time service is used for providing real-time information form theHQ.
4. Receive payment operation. This operation can be used to receivepayment from the customer in POS through different tender typesthat are configured in HQ.
5. No. Only the store database can be shared across multiple terminals.
6. Close shift and print Z-report.
2 - 7
-
8/9/2019 80585 Ax2012 Enus Retail All
14/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
2 - 8
-
8/9/2019 80585 Ax2012 Enus Retail All
15/152
MODULE 3: POS EXTENSIBILITY TECHNICALOVERVIEW
Module OverviewThis module discusses the Microsoft Dynamics AX 2012 POS extensibility and itsoperations.
Objectives
The main objective of this module is to help you understand how to customizeand extend the Microsoft Dynamics AX 2012 POS. After you complete this course,you will know how to customize and extend POS.
3- 1
-
8/9/2019 80585 Ax2012 Enus Retail All
16/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
Extend Point of Sale
Microsoft Dynamics AX for Retail POS is a fully customizable point of sale (POS)component of Microsoft Dynamics AX 2012 for Retail. You can use Retail POS toprocess sales, operate the cash drawer, and scan bar codes or print customerreceipts, among other business tasks.
Lesson Objectives
How to customize or extend Microsoft Dynamics AX 2012 POS.
POS Extension
To customize business logic in Retail POS, you must install the Retail SoftwareDevelopment Kit (SDK). The SDK is included with Microsoft Dynamics AX 2012. Itcontains two folders:
• POS Plug-ins – Contains code that you use to extend and customizeRetail POS. For more information about how to install Retail POSPlug-ins, refer to Install Retail SDK.
• Commerce Runtime – Contains services that you use to extend andcustomize the online store for Microsoft Dynamics AX 2012 for Retail.The details of this are not explained in this course.
Retail POS Plug-insThis topic talks about the Retail POS Plug-ins and how to use the Plug-ins toextend or customize the business logic, user interface UI and new operations inPOS.
Lesson Objectives
After you complete this lesson, you will know how to customize or extend theMicrosoft Dynamics AX 2012 POS.
About POS Plug-ins
Retail POS Plug-ins contains set of services and application triggers. Most of thefunctionality in Retail POS is implemented by using services. For example, you usethe Customer service for tracking, adding or deleting customers from the RetailPOS register.
3 - 2
http://technet.microsoft.com/en-us/library/hh771575.aspxhttp://technet.microsoft.com/en-us/library/hh771575.aspxhttp://technet.microsoft.com/en-us/library/hh771575.aspxhttp://technet.microsoft.com/en-us/library/hh771575.aspx
-
8/9/2019 80585 Ax2012 Enus Retail All
17/152
Module 3: POS Extensibility Technical Overview
These services are a collection of the .NET Framework assemblies that implementpublic interfaces. Refer to the POS Extensibility Interface Definition coursedocument for more information.
Retail POS loads the services at run time and invokes their functionality throughthese interfaces. Because Retail POS Plug-ins is included with the C# source codefor these assemblies, you can customize or replace services and triggers to extendfeatures in Retail POS, such as calculating taxes.
By default, Retail POS Plug-ins is installed in the following directory:
1. C:\Users\...\Documents\Retail SDK\POS Plug-ins\
The folder contains two Visual Studio solutions —one for services and the other fortriggers. Triggers are used to insert custom code before or after Retail POSoperations, such as issuing a gift certificate, a customer add, a clear, or a payment,and more. For example: Before you issue a gift card, if you want to do a validationsuch as whether the customer is eligible to issue a gift card, you can perform thevalidation here.
The Microsoft.Dynamics.Retail.Pos.Contracts.dll assembly exposes all the publicinterfaces to be used for implementing extensions and customizations to thefollowing Retail POS functionality:
• Operations• Services• Triggers
• Commerce Data Exchange: Real-time Service
FIGURE 3.1: POS PLUG-INS
3 - 3
-
8/9/2019 80585 Ax2012 Enus Retail All
18/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
Operations
An operation is an activity that occurs in Retail POS. Operations can be a singlestep or a multi-step. Refer to the POS Framework course document for moreinformation.
Services
Services include one or more operations and implement a single, unique interface.You can make partial modifications to an existing service and continue to use theremaining functionality. Or, you can replace the complete service assembly withyour own custom code. For more information about how to implement services,refer to “How to modify a Form” at http://technet.microsoft.com/en-us/library/jj937978.aspx
Interface for Services
Features in the Retail POS are services that interact with the program throughinterfaces. Services include one or more operations and implement a single,unique interface. Each service implement an interface. The developer can makepartial or full modifications to the service’s project. Microsoft Dynamics AX 2012ships with a collection of core services that can be customized or replaced usingRetail POS Plug-ins. For descriptions of all the services interfaces that are availablein Retail POS, please refer Interfaces for Services "
TriggersTriggers are events raised by Retail POS that enable you to insert custom codebefore or after operations. There are two types of triggers:
• Pre-triggers• Post-triggers
Please refer the POS Framework course document for more information.
3 - 4
http://technet.microsoft.com/en-us/library/jj937978.aspxhttp://technet.microsoft.com/en-us/library/jj937978.aspxhttp://technet.microsoft.com/en-us/library/jj937978.aspxhttp://msdn.microsoft.com/en-us/library/microsoft.dynamics.retail.pos.contracts.services.aspxhttp://msdn.microsoft.com/en-us/library/microsoft.dynamics.retail.pos.contracts.services.aspxhttp://msdn.microsoft.com/en-us/library/microsoft.dynamics.retail.pos.contracts.services.aspxhttp://msdn.microsoft.com/en-us/library/microsoft.dynamics.retail.pos.contracts.services.aspxhttp://technet.microsoft.com/en-us/library/jj937978.aspxhttp://technet.microsoft.com/en-us/library/jj937978.aspx
-
8/9/2019 80585 Ax2012 Enus Retail All
19/152
-
8/9/2019 80585 Ax2012 Enus Retail All
20/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
Module Review
Module Review and Takeaways
• Understand how to extend Retail POS• Retail POS Plug-ins Operations• Services, Triggers and Real-time services
Tools• Use Visual Studio 2010 Ultimate or a more recent version to
customize Microsoft Dynamics AX 2012 POS.• To customize the Real-time service use in HQ, use the Morphx
development suite.
Test Your Knowledge
Test your knowledge with the following questions.
1. What is Retail POS Plug-ins?
2. When do you use POS Plug-ins?
3. What are the two main components of Retail POS Plug-ins?
4. When should Real-time services be used?
5. What is the difference between services and triggers?
3 - 6
-
8/9/2019 80585 Ax2012 Enus Retail All
21/152
Module 3: POS Extensibility Technical Overview
Test Your Knowledge SolutionsMODEL ANSWER:
1. Retail POS Plug-ins contain sets of services and application triggers toextend POS
2. To extend or customize POS
3. Services and Triggers
4. Any real-time, synchronous communication between MicrosoftDynamics AX 2012 and individual Retail POS terminals like Gift card,loyalty
5. Services contains the core business logic whereas triggers are eventsraised by Retail POS that enable you to insert custom code before orafter operations.
3 - 7
-
8/9/2019 80585 Ax2012 Enus Retail All
22/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
3 - 8
-
8/9/2019 80585 Ax2012 Enus Retail All
23/152
MODULE 4: POS FRAMEWORK
Module OverviewThis module explains the POS technical architecture. This module also providesinformation about the different components in the POS framework
Objectives
The main objective of this module is to help understand the POS technicalframework, its components and other retail components it uses.
4 - 1
-
8/9/2019 80585 Ax2012 Enus Retail All
24/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
POS Architecture Overview
This course provides information about the different POS architecturecomponents that include the following:
• POS Core• CDX: Real time service and Synch service• POS Database
POS Architecture
The POS Architecture consists of the POS Core components.
FIGURE 4.1: POS ARCHITECTURE CORE COMPONENTS
4 - 2
-
8/9/2019 80585 Ax2012 Enus Retail All
25/152
Module 4: POS Framework
POS Core
The POS core is the focal point of POS that interacts between the POS userinterface (UI), and the POS data layer, services and triggers.
The key components of the POS core include the following:• Operations• Transaction• SystemFramework• SystemeSettings• DataAccess (Data Layer)• Contracts
The components in the POS core are not extensible.
FIGURE 4.2: POS COMPONENTS
4 - 3
-
8/9/2019 80585 Ax2012 Enus Retail All
26/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
Operations
An operation is an activity that occurs in Retail POS. Operations can be a single
step, or a multi-step. For example, Add Item adds a sales line to the currenttransaction. The Customer add operation presents a form for a cashier to entercustomer information. After data is entered and the form is closed, the customerinformation is sent to Retail Headquarters.
Microsoft Dynamics AX 2012 includes a collection of core operations that cannotbe modified. However, you can create new functionality by using theBlankOperations. You can use Blank Operations to extend Microsoft Dynamics AXfor Retail POS by adding custom logic to the Retail POS register buttons. In theRetail POS register, you can add the blank operation button to the POS layout andlink it with your custom operations.
Transaction
The transaction dll contains the core transaction classes and Interfaces that areused in standard and extended components. Most POS operations will have thePOS transaction passed as parameters that are during the operation.
System Framework:
This dll contains the transaction service. This service is a direct start toHeadquarters (HQ).
System Settings:This dll contains all the settings that are related to connection details, operatordetails, terminal details, store details, transaction service details, hardware profile,functionality profile and other Application details that can be used whileextending POS.
Data Access:
This dll acts as a data layer between the application and the POS database. Itprovides a set of interfaces and, or classes that are used in standard operations,services and triggers.
Contracts
The contracts dll contains interfaces that are used across multiple core andextended components of Point of Sale. When POS Plugins are installed, this dll isincluded as part of plugin code. When you extend a service and, or triggers, addthis dll to the project. Also, dll should be deployed to the POS folder, after youextend.
4 - 4
-
8/9/2019 80585 Ax2012 Enus Retail All
27/152
Module 4: POS Framework
POS Extensibility
POS Extensibility points give the user the option to extend the POS for customrequirements. The key components include the following:
Services FormsAlthough third-party components from the DevExpress libraries were used tobuild the POS application, you do not have to be familiar with how to set up adevelopment environment by using the DevExpress libraries.
All Windows forms in POS are developed by using the "DXExperience Winforms"product that is created by DevExpress. However, you must have a DevExpresslicense to modify the design-time visual changes to existing forms. Although youare not required to have DevExpress tools to create new POS forms, it isrecommended that you use them to have a consistent appearance with the rest ofthe product.
Microsoft Dynamics AX 2012 R2 POS introduces a new way to customize forms byusing the Interaction service. Multiple developers can customize one or moreforms in one service. If there are multiple customizations, the Interaction serviceloads only the first customization it finds for a form. The following list of formsuses this new pattern and their implementations are included in theInteractionDefaults service.
• ExtendedLogOnForm• ExtendedLogOnScanForm• frmBarcodeSelect• frmDimensions• frmInput• frmPayCash• frmPayCurrency• frmPayCustomerAccount• frmReturnTransaction• LogbookForm• LogOnForm• ManagerAccessForm• RegisterTimeForm• ViewTimeClockEntriesForm• ProductDetailsForm• ProductInformationForm
4 - 5
-
8/9/2019 80585 Ax2012 Enus Retail All
28/152
-
8/9/2019 80585 Ax2012 Enus Retail All
29/152
Module 4: POS Framework
FIGURE 4.3: REAL-TIME SERVICE
CDX: Synch Service (Retail Store Connect)
Commerce Data Exchange: Synch Service is a service that shares data among retailcomponents. These components include the head office, stores, and individualpoint of sale (POS) terminals. When you install Synch Service, the Retail Salt Utilityand Retail Scheduler are also installed. The Retail Salt Utility provides additionalencryption for the passwords and credentials that are associated with the Retailsystem. Retail Scheduler is used to manage the distribution of data between thehead office and the stores
4 - 7
-
8/9/2019 80585 Ax2012 Enus Retail All
30/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
FIGURE 4.4: CDX SYNCH SERVICE
POS Database
This lesson explains about the POS store database and offline database.
Lesson Objectives
• Store Database• Offline Database• Retail Offline Synch Service
Store Database
Store database is a central database that is inside a store. Typically, a storedatabase is hosted on a shared server that is connected to all the POS terminals inthe store. Multiple POS computers in a store can connect to the same storedatabase.
Store database data is synched with HQ by using the Synch service.
4 - 8
-
8/9/2019 80585 Ax2012 Enus Retail All
31/152
-
8/9/2019 80585 Ax2012 Enus Retail All
32/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
Module ReviewModule Review and Takeaways
• POS Architecture• POS Core• CDX : Real time service and Synch service• POS Database
Test Your Knowledge
Test your knowledge with the following questions.
1. What are the main components of the POS architecture?
2. What is the POS Core?
3. How is the Transaction library used?
4. How is the CDX Synch service used?
5. Which service synchs the data between the store database and the offlinedatabase?
4 - 10
-
8/9/2019 80585 Ax2012 Enus Retail All
33/152
Module 4: POS Framework
Test Your Knowledge SolutionsMODEL ANSWER:
• POS Core, CDX Real-time service, CDX Synch service and storedatabase
• The POS core is the focal point of the POS that interacts between thePOS UI and the POS data layer.
• The dll transaction contains the core transaction classes and theInterfaces that are used in standard and extended components. MostPOS operations will have the POS transaction passed as parameters,which are used during the operation.
• Retail offline synch service.
4 - 11
-
8/9/2019 80585 Ax2012 Enus Retail All
34/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
4 - 12
-
8/9/2019 80585 Ax2012 Enus Retail All
35/152
-
8/9/2019 80585 Ax2012 Enus Retail All
36/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
Development Environment Requirements
System Requirements
The development environment that is shown the following table assumes that allthe components are installed in single box. If you are installing each componenton different boxes, then refer to the “AX2012 System Requirements” document fordetailed information.
Components Requirements
Operating System Windows Server 2012 Standard Edition orDatacenter
Edition
Windows Server 2008 R2 Standard Edition,Enterprise Edition, Web Edition, or DatacenterEdition
Windows Server 2008 Standard Edition, EnterpriseEdition, Web Edition, or Datacenter Edition, withService Pack 2 (Only 64-bit versions of WindowsServer 2008 are supported)
Processor Intel Pentium/Celeron family or a compatiblePentium III Xeon or larger processor. Werecommend a processor speed of 1.1 GHz or larger.
Important:
Microsoft Dynamics AX is not supported on Itanium64-bit processors.
RAM We recommend 4 GB or more of RAM for servercomputers.
Hard disk space Minimum 80 GB
5- 2
http://www.microsoft.com/en-in/download/details.aspx?id=11094http://www.microsoft.com/en-in/download/details.aspx?id=11094http://www.microsoft.com/en-in/download/details.aspx?id=11094http://www.microsoft.com/en-in/download/details.aspx?id=11094
-
8/9/2019 80585 Ax2012 Enus Retail All
37/152
Module 5: Development Environment Requirements
Software RequirementsComponents Requirements Notes
Application Object
Server (AOS)
NET Framework 4.0, with the hotfixfrom Knowledge Base article 2390372,
(http://support.microsoft.com/kb/2390372 ).
SQL Server 2008 Native Client
Install SQL Server NativeClient on the AOS serverif the AOS server isseparate from thedatabase server.
You must install the SQLServer 2008 version of theNative Client, even if youare using SQL
Server 2012.
AX Client .NET Framework 4.0
Debugger No additional software requirements
Visual Studio and Tools Windows PowerShell 2.0
Visual Studio 2010, ProfessionalEdition, Premium Edition,
Ultimate Edition, or Team Edition,with Service Pack 1
Visual Studio 2012 can beinstalled side by side withVisual Studio 2010.However, Visual Studio2012 is not supported forMicrosoft Dynamics AXdevelopment.
.NET Business Connector No additional software requirements
5 - 3
http://support.microsoft.com/kb/2390372http://support.microsoft.com/kb/2390372http://support.microsoft.com/kb/2390372http://support.microsoft.com/kb/2390372http://support.microsoft.com/kb/2390372http://support.microsoft.com/kb/2390372
-
8/9/2019 80585 Ax2012 Enus Retail All
38/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
Components Requirements Notes
Database Microsoft SQL Server 2012, StandardEdition,
Enterprise Edition, or BusinessIntelligence Edition. Service Pack 1(http://www.microsoft.com/enus/download/details.aspx?id=35575 ) issupported. However, it is not required.
–or–
SQL Server 2008 R2, Standard Edition,Enterprise Edition, or DatacenterEdition. Service Pack 1
(http://www.microsoft.com/download /en/details.aspx?id=26727 ) andService Pack 2
(http://www.microsoft.com/enus/download/details.aspx?id=30437 ) aresupported.
Service Pack 1 is required if you areinstalling
Reporting Services extensions.
–or–
SQL Server 2008, Standard Edition orEnterprise Edition, with Service Pack 1.Service Pack 3 is supported. However,it is not required.
By default, SQL Server2012 is supported with
Microsoft Dynamics AX2012 R2. To use SQLServer 2012 with anearlier version ofMicrosoft Dynamics AX2012, you must installMicrosoft Dynamics AXhotfix 2680186
(https://mbs2.microsoft.com/Knowledgebase/KBDisplay.aspx?scid=kb;en-
us;2680186 ).
Only 64-bit versions ofSQL Server are supported.
For the minimumhardware requirementsfor SQL Server, seehttp://www.microsoft.com
/sql/default.mspx .
In a productionenvironment, werecommend that youinstall the latestcumulative update for theversion of SQL Server thatyou are using.
The Retail module inMicrosoft Dynamics AX,Retail POS, CommerceData Exchange: SynchService and Real-timeservice, Retail StoreDatabase Utility andRetail SDK
Application Object Server (AOS), OSand other components are mentionedearlier in this document.
5- 4
http://www.microsoft.com/enus/download/details.aspx?id=35575http://www.microsoft.com/enus/download/details.aspx?id=35575http://www.microsoft.com/enus/download/details.aspx?id=35575http://www.microsoft.com/enus/download/details.aspx?id=35575http://www.microsoft.com/download/en/details.aspx?id=26727http://www.microsoft.com/download/en/details.aspx?id=26727http://www.microsoft.com/download/en/details.aspx?id=26727http://www.microsoft.com/download/en/details.aspx?id=26727http://www.microsoft.com/enus/download/details.aspx?id=30437http://www.microsoft.com/enus/download/details.aspx?id=30437http://www.microsoft.com/enus/download/details.aspx?id=30437http://www.microsoft.com/enus/download/details.aspx?id=30437https://mbs2.microsoft.com/Knowledgebase/KBDisplay.aspx?scid=kb;en-us;2680186https://mbs2.microsoft.com/Knowledgebase/KBDisplay.aspx?scid=kb;en-us;2680186https://mbs2.microsoft.com/Knowledgebase/KBDisplay.aspx?scid=kb;en-us;2680186https://mbs2.microsoft.com/Knowledgebase/KBDisplay.aspx?scid=kb;en-us;2680186https://mbs2.microsoft.com/Knowledgebase/KBDisplay.aspx?scid=kb;en-us;2680186https://mbs2.microsoft.com/Knowledgebase/KBDisplay.aspx?scid=kb;en-us;2680186https://mbs2.microsoft.com/Knowledgebase/KBDisplay.aspx?scid=kb;en-us;2680186https://mbs2.microsoft.com/Knowledgebase/KBDisplay.aspx?scid=kb;en-us;2680186https://mbs2.microsoft.com/Knowledgebase/KBDisplay.aspx?scid=kb;en-us;2680186https://mbs2.microsoft.com/Knowledgebase/KBDisplay.aspx?scid=kb;en-us;2680186http://www.microsoft.com/enus/download/details.aspx?id=30437http://www.microsoft.com/enus/download/details.aspx?id=30437http://www.microsoft.com/download/en/details.aspx?id=26727http://www.microsoft.com/download/en/details.aspx?id=26727http://www.microsoft.com/enus/download/details.aspx?id=35575http://www.microsoft.com/enus/download/details.aspx?id=35575
-
8/9/2019 80585 Ax2012 Enus Retail All
39/152
MODULE 6: TECHNICAL BACKGROUND
Module OverviewThis module provides information about the knowledge required to customizePOS
Objectives
• Understand the knowledge required to customize the POS
6 - 1
-
8/9/2019 80585 Ax2012 Enus Retail All
40/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
Technical knowledge required to customize POS
In this lesson we will understand the technical knowledge required for thedeveloper to customize POS.
Microsoft .Net framework
The developer should have basic knowledge on .net framework and advancedknowledge on C#. Retail POS is developed using C#, and thus knowledge in c# ismandatory.
POS Functionality
The developer should have a basic understanding of POS processes andfunctionality to extend or customize POS. Please refer POS functional trainingdocument (AX2012 ENUS_RTL) for more information.
SQL Server 2008 or higher version
Basic knowledge on SQL Server is required to customize POS because we will becreating or modifying the tables, stored procedures for POS
Retail HQ Setup and Configuration
It is preferable to have knowledge on HQ Retail setup (Distribution schedule) andconfiguration like CDX sync and real time services to quickly diagnose theproblem and issues.
Knowledge on X++
Basic knowledge on x++ is required to customize or extend CDX Real-timeservice.
6 - 2
-
8/9/2019 80585 Ax2012 Enus Retail All
41/152
MODULE 7: LOCALIZATION INFORMATION
Module OverviewThis module provides information about how to localize Point of Sale (POS) bychanging the POS labels and strings.
Objectives
• Explain the requirements that are used to change POS labels andstrings.
7 - 1
-
8/9/2019 80585 Ax2012 Enus Retail All
42/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
POS LocalizationLocalization is the process of adapting software to meet country-specific laws orregulations. Microsoft localizes Microsoft Dynamics AX to include features andfunctionality designed to address specific tax, accounting or financial reportingrequirements for various countries.
Languages
Translation is the process of adapting software or documentation to meetlanguage requirements for a particular country. For any given language, Microsoftmay translate some, all or none of the user interface (UI) and documentation forMicrosoft Dynamics AX.
To set up POS in specific language, go the respective Retail Channel and changethe retail channel language. We can change the language in AX Retail bynavigating to Retail->Common->Retail channels->Retail stores->Language
FIGURE 7.1: SET UP POS IN SPECIFIC LANGUAGE
A very common requirement to localize the POS in Dynamics AX for Retail is tochange the wording of the strings and labels in the product. In this lesson we willlearn how to do that.
7 - 2
-
8/9/2019 80585 Ax2012 Enus Retail All
43/152
-
8/9/2019 80585 Ax2012 Enus Retail All
44/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
FIGURE 7.2: RETAIL POS PROPERTIES
7 - 4
-
8/9/2019 80585 Ax2012 Enus Retail All
45/152
Module 7: Localization Information
FIGURE 7.3: OPERATOR ID
Find the ID of the string that you want to change and then add the new text tothe RetailLanguageText table with ID you of the string you want to change.
Since there is no form for adding strings to the RetailLanguageText table, we willpopulate the values directly in the AOT. Open a new developer workspace andnavigate to Data Dictionary > Tables > RetailLanguageText. Right-click and selectOpen. Create a new records by populating the languageID, Text and textID fields:
7 - 5
-
8/9/2019 80585 Ax2012 Enus Retail All
46/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
FIGURE 7.4: EMPLOYEE ID
Also use the RETAILLANGUAGETEXT table for any strings that you create fromscratch. The Blank Operation sample plug-in uses 50700 as a starting number; that
number through 50700-50999 are currently un-used. We can use the numberbetween these series for our custom strings. Please make sure that TextID is notconflicting with strings from other developers or possibly by future versions of theproduct.
Once you’ve added your strings to the table, you can use this method to grabstrings from the table.
myString = ApplicationLocalizer.Language.Translate(28);
7 - 6
-
8/9/2019 80585 Ax2012 Enus Retail All
47/152
Module 7: Localization Information
Module ReviewModule Review and Takeaways
• Understand how to change POS Strings and labels
Test Your Knowledge
Test your knowledge with the following questions.
1. What is the command parameter used to launch POS in special mode whichdisplays the label ids?
2. In which table the POS custom strings and labels are stored?
3. Which library stores all the POS labels and string resources?
7 - 7
-
8/9/2019 80585 Ax2012 Enus Retail All
48/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
Test Your Knowledge SolutionsMODEL ANSWER:
1. -tr
2. RETAILLANGUAGETEXT table
3. POSResources.resources.dll
7 - 8
-
8/9/2019 80585 Ax2012 Enus Retail All
49/152
MODULE 8: EXTENSIBILITY BEST PRACTICES
Module OverviewAX Retail POS (Point of Sales) is a .Net solution which is available as part of AXRetail installation. The SDK will be available for the implementation team tocustomize further as per the specific customer’s requirement. With the SDK we cancustomize the POS services and Triggers only.
This document provides general guidelines on how to customize the Retailsolution and overall solution approach for the POS Retail part. As this is on .Net,.Net specific coding guidelines will be applicable by default.
Objectives
• Provide best practices and guidelines/standards for Retail POScustomization.
8 - 1
-
8/9/2019 80585 Ax2012 Enus Retail All
50/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
Solution ApproachThere are two primary approaches for POS customization. These are:
1. Greenfield Development
2. Brownfield Development
Greenfield Development
The Greenfield approach for adding customizations on POS is to implement thecustomization in default interfaces provided by the plugins. Then Replace theOOB DLL provided by the Retail POS installation with the custom DLL.
For example, in order to customize the Sales Order service, load the services
solution form the Retail POS SDK(By default the SDK path will beC:\Users\...\Documents\Retail SDK\POS Plug-ins\) folder and extend it by addingthe new classes and methods within the same SalesOrder project.
Brownfield Development
In brownfield development style, partial classes are used to keep customizedcode separate from the OOB plugins code.
The advantages of using partial classes is that
•
Customized code resides in a separate file rather than existing plugincode file which help in code merging during the hotfix deploymentand we will have the clear separation of code between thecustomization and OOB Retail SDK.
• In future, if there are any upgrades or hot fixes release, developerscan make those changes to OOB Plugin code by comparing it withthe new updates in code, while customized code can be demarkedclearly
• During operations lifecycle of the system, you can more easily find ifthe issue belongs to OOB Plugin code or it is customized code
In all Retail implementation of AX, each customer will have a specific requirementfor authorizing credit card payments. To do that, developer will have to modifythe EFT class provided in the EFT Project. To incorporate this change, follow thebelow steps:
8 - 2
-
8/9/2019 80585 Ax2012 Enus Retail All
51/152
Module 8: Extensibility Best Practices
Create a new C# file
Taking the Credit card Payment Processing scenario, create a new file called_EFT.cs in the EFT project, as shown in the figure below.
Modify the class declaration and namespace
In the new class file created,
• Rename the class declaration to partial class; in the current scenario, itwill be “public partial class EFT : IEFT ”
• Rename the namespace to match the OOB class, which in the currentscenario, will be “ namespace EFT”
• Copy namespaces from OOB class, to the new class file• Implement new methods or comment the existing methods in the
OOB class and implement it as required in the new partial class.
In the OOB file class,
• If the class is not partial class, rename the class declaration to partial;in the current scenario, it will be “ public partial class EFT: IEFT ”
Source Code Control
Source code control gives you the benefits of versioning, tracking and revertingback to earlier versions. If you are part of a team customizing POS, automatedsource code control provides a significant advantage. When many people worktogether to create, support, and update source code files for POS, thecoordination of files and updates is a complex process. Team Foundation Server(TFS) provides stable, easy-to-use source code management to keep the team'sdevelopers in sync with each other's changes.
Solution Configuration
When setting the solution in TFS, the delivery team must configure the completeServices and Triggers solution in TFS. While configuring the Services or Triggerssolution, proper version of the AX Retail POS version must be chosen (AX 2012R2)
From the Services or Triggers solution, the project specific solution must beconfigured as a branch from the main application. By doing this, we are keepingthe original source code as is in the main solution and keep only the projectspecific code in the branch
8 - 3
-
8/9/2019 80585 Ax2012 Enus Retail All
52/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
The projects which we are not used for customization from the Retail SDK can beremoved from the TFS branch. In this way, the delivery team will be focused onlyon the items they will be modifying and delivering to the customer. The solution
available in the branch should comply with the coding standards of .Net likeFxCop, StyleCop, VS Code analysis and Code metric standards. For detailedinformation on these standards please refer the link in the reference section.
TFS for Version control .NET solution
Daily builds
Use Release version of the dlls’ for deploying to testing, Staging and Productionenvironments
Unit Testing
It is usually conducted by the development team. This testing is to verify andvalidate that the individual units of source code are fit for use.
Considerations:
• The ability of the system to properly process erroneous transactions• systems or components pass data and control correctly to one
another
Using Test Driven Development (TDD) developer can write unit test cases forsolution before actually writing that code. By writing a test and then writing thecode to make that test pass developers have a much better idea of what the goaland purpose of the code is. Also, a TDD comprehensive suite of unit tests can berun at any time to provide feedback that the software is still working. It improvesthe quality of code and ensures total code coverage of custom code. Thedeveloper can use Visual T#, NUnit, MS Test, xUnit or any other viable unit testframework for TDD driven unit testing. For detailed information on the unittesting please refer the link in the reference section
8 - 4
-
8/9/2019 80585 Ax2012 Enus Retail All
53/152
Module 8: Extensibility Best Practices
ReferencePartial Classes and Methods (C# Programming Guide) -http://msdn.microsoft.com/en-us/library/wa80x488(v=VS.100).aspx
AX for Retail: A Better Sample for EFT plug-in (Credit Card processing)http://blogs.msdn.com/b/axsupport/archive/2012/01/14/ax-for-retail-a-better-sample-for-eft-plug-in-credit-card-processing.aspx
C# coding guidelineshttp://msdn.microsoft.com/en-US/library/vstudio/ms229042(v=vs.100).aspx
Guidelines for Test-Driven Development
http://msdn.microsoft.com/en-us/library/aa730844(VS.80).aspx
Test Driven Development
http://msdn.microsoft.com/en-us/library/aa730844(v=vs.80).aspx
Visual Studio 2010: Test Driven Development
http://msdn.microsoft.com/en-us/gg454254
FxCop
http://msdn.microsoft.com/en-US/library/bb429476(v=vs.80).aspx
Code analysis
http://msdn.microsoft.com/en-us/library/3z0aeatx.aspx
StyleCop
http://archive.msdn.microsoft.com/sourceanalysis
Code Metrics:
http://msdn.microsoft.com/en-us/library/bb385914.aspx
8 - 5
http://msdn.microsoft.com/en-us/library/wa80x488(v=VS.100).aspxhttp://msdn.microsoft.com/en-us/library/wa80x488(v=VS.100).aspxhttp://blogs.msdn.com/b/axsupport/archive/2012/01/14/ax-for-retail-a-better-sample-for-eft-plug-in-credit-card-processing.aspxhttp://blogs.msdn.com/b/axsupport/archive/2012/01/14/ax-for-retail-a-better-sample-for-eft-plug-in-credit-card-processing.aspxhttp://blogs.msdn.com/b/axsupport/archive/2012/01/14/ax-for-retail-a-better-sample-for-eft-plug-in-credit-card-processing.aspxhttp://msdn.microsoft.com/en-US/library/vstudio/ms229042(v=vs.100).aspxhttp://msdn.microsoft.com/en-US/library/vstudio/ms229042(v=vs.100).aspxhttp://msdn.microsoft.com/en-us/library/aa730844(VS.80).aspxhttp://msdn.microsoft.com/en-us/library/aa730844(VS.80).aspxhttp://msdn.microsoft.com/en-us/library/aa730844(v=vs.80).aspxhttp://msdn.microsoft.com/en-us/library/aa730844(v=vs.80).aspxhttp://msdn.microsoft.com/en-us/gg454254http://msdn.microsoft.com/en-US/library/bb429476(v=vs.80).aspxhttp://msdn.microsoft.com/en-US/library/bb429476(v=vs.80).aspxhttp://msdn.microsoft.com/en-us/library/3z0aeatx.aspxhttp://msdn.microsoft.com/en-us/library/3z0aeatx.aspxhttp://archive.msdn.microsoft.com/sourceanalysishttp://archive.msdn.microsoft.com/sourceanalysishttp://msdn.microsoft.com/en-us/library/bb385914.aspxhttp://msdn.microsoft.com/en-us/library/bb385914.aspxhttp://msdn.microsoft.com/en-us/library/bb385914.aspxhttp://archive.msdn.microsoft.com/sourceanalysishttp://msdn.microsoft.com/en-us/library/3z0aeatx.aspxhttp://msdn.microsoft.com/en-US/library/bb429476(v=vs.80).aspxhttp://msdn.microsoft.com/en-us/gg454254http://msdn.microsoft.com/en-us/library/aa730844(v=vs.80).aspxhttp://msdn.microsoft.com/en-us/library/aa730844(VS.80).aspxhttp://msdn.microsoft.com/en-US/library/vstudio/ms229042(v=vs.100).aspxhttp://blogs.msdn.com/b/axsupport/archive/2012/01/14/ax-for-retail-a-better-sample-for-eft-plug-in-credit-card-processing.aspxhttp://blogs.msdn.com/b/axsupport/archive/2012/01/14/ax-for-retail-a-better-sample-for-eft-plug-in-credit-card-processing.aspxhttp://msdn.microsoft.com/en-us/library/wa80x488(v=VS.100).aspx
-
8/9/2019 80585 Ax2012 Enus Retail All
54/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
Module Review
Best Practice:
1. Follow C# coding guidelines
2. Follow FxCop and StyleCop standards
3. Enable static code analysis in VS
4. Follow the below code metrics:
• Maintainability Index per method > 20• Cyclomatic Complexity per method
-
8/9/2019 80585 Ax2012 Enus Retail All
55/152
Module 8: Extensibility Best Practices
Test Your Knowledge SolutionsMODEL ANSWER:
1. In Greenfield approach all the customization is done in new classes orprojects and added as reference
2. In Brownfield approach customizations are done in partial classes.
8 - 7
-
8/9/2019 80585 Ax2012 Enus Retail All
56/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
8 - 8
-
8/9/2019 80585 Ax2012 Enus Retail All
57/152
-
8/9/2019 80585 Ax2012 Enus Retail All
58/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
Logon ExtensibilityThis lesson provides brief information about the POS Logon extensibility featureusing some external devices or any other mediums.
Extending Logon by using Biometric devices:
Dynamics AX Retail 2012 R2 POS allows ISVs to use biometric device for logon.Following interface must be implemented by POS plugin:
FIGURE 9.1: BIOMETRIC DEVICE FOR LOGON INTERFACE
Following the typical sequence for POS logon follow and call into the biometricplugin
9 - 2
-
8/9/2019 80585 Ax2012 Enus Retail All
59/152
-
8/9/2019 80585 Ax2012 Enus Retail All
60/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
Biometric Plugin
The below code provides the abstract for implementing the Biometric plugin. We
can extend this code to implement biometric login in POS.
public sealed class BiometricPlugin : IBiometricDevice{
public event BiometricDeviceDataEventHandler DataReceived;public event BiometricDeviceStatusEventHandler StatusUpdate;
public void Load(){
// Init the biometric device}
public void Unload(){
// Cleanup }
public string DeviceName{
get { return string .Empty; }}
public string DeviceDescription{
get { return string .Empty; }}
public bool IsActive{
get { return true ; }
}
public void BeginEnrollCapture(){
// Create worker thread for enroll capture and return}
public void BeginVerifyCapture(){
// Create worker thread for verify capture and return}
public void EndCapture(){
// close the thread.}
9 - 4
-
8/9/2019 80585 Ax2012 Enus Retail All
61/152
Module 9: Logon Extensibility – Sample and How-To
public string Identify(IExtendedLogOnInfo captureData,ICollection< byte []> candidates)
{string logOnKey = null ;
// Identify the give capture data from given cadidates andreturn hash (e.g. MD5 HASH) of found cadidate.
return logOnKey;}
}
9- 5
-
8/9/2019 80585 Ax2012 Enus Retail All
62/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
Module ReviewModule Review and Takeaways
• Understand how to extend Log on functionality in POS
Test Your Knowledge
Test your knowledge with the following questions.
1. What Services project used for Logon functionality extension?
9 - 6
-
8/9/2019 80585 Ax2012 Enus Retail All
63/152
Module 9: Logon Extensibility – Sample and How-To
Test Your Knowledge SolutionsMODEL ANSWER:
1.
LogOn
9- 7
-
8/9/2019 80585 Ax2012 Enus Retail All
64/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
9 - 8
-
8/9/2019 80585 Ax2012 Enus Retail All
65/152
MODULE 10: POS THEMES
Module OverviewIn this module you will understand how to change the look and feel of MicrosoftDynamics AX for Retail POS registers by creating new Retail POS skins. To createor modify existing Retail POS skins, you must obtain a license from DevExpress . Retail POS uses DXExperience Winforms created by DevExpress. You can developyour own forms without using DevExpress, but it is recommended you use theseto maintain a consistent look and feel.
Objectives
• Understand how to create or modify existing Retail POS Skins
10 - 1
http://www.devexpress.com/http://www.devexpress.com/http://www.devexpress.com/http://www.devexpress.com/
-
8/9/2019 80585 Ax2012 Enus Retail All
66/152
-
8/9/2019 80585 Ax2012 Enus Retail All
67/152
Module 10: POS Themes
FIGURE 10.2: CUSTOM SKIN WINDOW
Setting color properties on your new skin:
• Select the common property from the SkinEditor Tool
FIGURE 10.3: SKIN EDITOR TOOL
10 - 3
-
8/9/2019 80585 Ax2012 Enus Retail All
68/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
• Set the Common > Control color property to Blue.• Set the Common > ControlText color property to White.• Click File->Save.• You must now convert your project into an assembly that will be used
by Retail POS. Click File->Create Assembly. You should see aconfirmation dialog similar to the following:
FIGURE 10.4: ASSEMBLY GENERATED INFORMATION WINDOW
The newly generated skin assemblies are placed in the:\Users\\Documents\My DXSkins\ directory. There will be afolder beneath that directory with the same name as your skin, in this caseMyFirstCustomSkin. Inside that folder, you will find a MyFirstCustomSkin.dll.
Launching Retail POS with your new skin:
In order for Retail POS to load your new skin, you must place the skin assembly inthe Retail POS runtime folder. Copy the MyFirstCustomSkin.dll to the Skins folderunderneath the Retail POS runtime directory.
You also need to make Retail POS aware of your new skin.
Using Commerce Data Exchange: Synch Service
•
Open Microsoft Dynamics AX for Retail Headquarters and go toRetail->Setup->POS->Profiles->Visual Profiles.• Right-click the Theme dropdown and click View Details.• Click the New button and set the POS skin name field to
MyFirstCustomSkin.• Close the POS skins form and with the POS visual profiles form still
open, set the Theme dropdown to MyFirstCustomSkin. Close theform.
10 - 4
http://void%280%29/http://void%280%29/
-
8/9/2019 80585 Ax2012 Enus Retail All
69/152
Module 10: POS Themes
• Go to Retail->Periodic->Data Distribution->Distribution Schedule.Select the N-1090 job and then click the Run directly button. This willsynch the new skin to Retail POS. You can run the following queryagainst the AXRetailPOS database to make sure this procedure
worked:SELECT POSSKINNAME, * from RetailVisualProfile
• Launch Retail POS and your new skin’s visualization effects shoulddisplay similar to the following image.
FIGURE 10.5: SKIN VISULATION EFFECTS DISPLAY
10 - 5
-
8/9/2019 80585 Ax2012 Enus Retail All
70/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
Module ReviewTools
DevExpress SkinEditor Tool.
Test Your Knowledge
Test your knowledge with the following questions.
1. How will you update the new skin created using the tool in POS
10 - 6
-
8/9/2019 80585 Ax2012 Enus Retail All
71/152
Module 10: POS Themes
Test Your Knowledge Solutions
Module Review and Takeaways
1. How will you update the new skin created using the tool in POS
MODEL ANSWER:
• In order for Retail POS to load your new skin, you must place the skinassembly in the Retail POS runtime folder. Copy theMyFirstCustomSkin.dll to the Skins folder underneath the Retail POSruntime directory. Also update the new skin name in Retail->Setup->POS->Profiles->Visual Profiles and run the N-1090 scheduler job.
10 - 7
-
8/9/2019 80585 Ax2012 Enus Retail All
72/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
10 - 8
-
8/9/2019 80585 Ax2012 Enus Retail All
73/152
MODULE 11: USER-INTERFACE EXTENSIBILITY –SAMPLE AND HOW-TO
Module OverviewMicrosoft Dynamics AX for Retail POS introduces a new way to customize formsby using the Interaction service. Multiple developers can use this service tocustomize one or more forms in one service. If there are multiple customizations,the Interaction service loads only the first customization it finds for a form. Thismodule also explains how to customize forms that are not part of the Interactionservices.
11 - 1
-
8/9/2019 80585 Ax2012 Enus Retail All
74/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
How to Modify a Form in Microsoft Dynamics AX 2012R2 POS
This lesson explains how to modify the Microsoft Dynamics AX 2012 R2 POS formsin Interaction service and other services forms.
Lesson Objectives
• Explain how to customize a form by using the InteractionDefaultservice.
• Explain how to customize forms in POS Plugins without using theInteractionDefault service.
Customizing Forms by Using InteractionDefault Service
The following list of forms use this new pattern and their implementations areincluded in the InteractionDefaults service.
• ExtendedLogOnForm• ExtendedLogOnScanForm• frmBarcodeSelect• frmDimensions
• frmInput• frmPayCash• frmPayCurrency• frmPayCustomerAccount• frmReturnTransaction• LogbookForm• LogOnForm• ManagerAccessForm• RegisterTimeForm• ViewTimeClockEntriesForm• ProductDetailsForm• ProductInformationForm
11 - 2
-
8/9/2019 80585 Ax2012 Enus Retail All
75/152
Module 11: User-Interface Extensibility – Sample and How-To
To customize an interaction form, follow these steps.
1. In the folder where you installed the Retail POS SDK, open theMicrosoft Dynamics AX for Retail POS Plug-ins folder.
2. Open the Services folder and double-click the Services Visual Studio solution file.
In this step, you override the LogOnForm form. This form has adependency on the ManagerAccessForm.
3. To change the background color, right-click the LoOnForm.cs fromInteractionDefuslt project and select View Code.
4. Add the following code to the OnLoad() method for the first line ofthe method to change the back ground color to dark red.
Sample code to change the form background color((Form)this.BackColor = Color.DarkRed;
5. Compile the InteractionDefaults project.
6. Copy the new assembly to thePos\Services\InteractionDefaults\Extension folder and start Retail POS.The LogOnForm should resemble the following:
FIGURE 11.1: OPERATOR ID WINDOW
11 - 3
-
8/9/2019 80585 Ax2012 Enus Retail All
76/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
How to Modify a Form in the Microsoft Dynamics Ax 2012
R2 POS Item Search FormThis topic explains how to add a new column to the existing Item search formand view that form in the POS user interface (UI). For example, you will add thecolumn SerachName of the Item in the Item search form. You will fetch thiscolumn value from the ECORESPRODUCT table.
To customize the ItemSearch form, follow these steps.
By default, in the folder where you installed the Retail POS Software Development Kit(SDK), it will be located at C:\Users\...\Documents\Retail SDK\POS Plug-ins.
1. Open the Microsoft Dynamics AX for Retail POS Plug-ins folder. Formore information about how to install the Retail SDK, refer to theinstallation guide.
2. Open the Services folder and double-click the Visual Studio solution file, services.sln .
3. Open the Services folder and double-click the Services Visual Studiosolution file.
4. Click the Dialog project and expand the WinFormsTouch Folder.Click frmItemSearch.cs and select view code. To modify the forms,you must have a DevExpres license.
5. Add the following code in the variable declaration section of thefrmItemSearch class to declare the new column.
private DevExpress.XtraGrid.Columns.GridColumn colSearchString;
6. Initialize the column in InitializeComponent() method.this.colSearchString = new evExpress.XtraGrid.Columns.GridColumn();
7. You must add the column in the gridView to appear in the form. Forthis include the new column in the range and set the columnproperties in InitializeComponent() method.this .grdView.Columns.AddRange( new
DevExpress.XtraGrid.Columns. GridColumn [] {this .colItemName,this .colItemId,this .colSearchString,this .colItemPrice,this .colItemUnitOfMeasure,this .colItemTaxRate,this .colItemOwnThirdProduc,this .colItemRoundTrunc});
11 - 4
-
8/9/2019 80585 Ax2012 Enus Retail All
77/152
Module 11: User-Interface Extensibility – Sample and How-To
//// colSearchString//this .colSearchString.Caption = "Search name" ;this .colSearchString.FieldName = "SEARCHNAME";this .colSearchString.Name = "colSearchString" ;
this .colSearchString.OptionsColumn.AllowSort =DevExpress.Utils. DefaultBoolean .False;this .colSearchString.SortMode =
DevExpress.XtraGrid. ColumnSortMode .Custom;this .colSearchString.Visible = true ;this .colSearchString.VisibleIndex = 0;this .colSearchString.Width = 161;
8. Now, modify the Item Search query to include the new column in thesearch criteria for filtering and displaying in the GetItemList() method.
string query = string .Format("SELECT ITEMID, ITEMNAME, '' ASITEMPRICE,I.SEARCHNAME, I.UNITOFMEASURE, I.INVENTPRODUCTTYPE_BR " +
"FROM ( " +" SELECT IT.INVENTPRODUCTTYPE_BR, IT.ITEMID,
COALESCE(TR.NAME, IT.ITEMNAME, IT.ITEMID) AS ITEMNAME, IT.DATAAREAID,ISNULL(IM.UNITID, '') AS UNITOFMEASURE, ROW_NUMBER() " +
" OVER (ORDER BY IT.{0} {1}) AS ROW " +" FROM ASSORTEDINVENTITEMS IT " +" JOIN INVENTTABLEMODULE IM ON IT.ITEMID =
IM.ITEMID AND IM.MODULETYPE = 2 " +" JOIN ECORESPRODUCT AS PR ON PR.RECID =
IT.PRODUCT " +" LEFT JOIN ECORESPRODUCTTRANSLATION AS TR
ON PR.RECID = TR.PRODUCT AND TR.LANGUAGEID = @CULTUREID " +" WHERE IT.STORERECID = @STORERECID {2}) I "
+"WHERE I.DATAAREAID=@DATAAREAID AND I .ROW >
@FROMROW AND I.ROW
-
8/9/2019 80585 Ax2012 Enus Retail All
78/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
FIGURE 11.2: PRODUCT SEARCH WINDOW
11 - 6
-
8/9/2019 80585 Ax2012 Enus Retail All
79/152
MODULE 12: TRIGGER EXTENSIBILITY – SAMPLEAND HOW-TO
Module OverviewTriggers are used to capture events that start before and after Microsoft DynamicsAX for Retail POS operations. You can insert custom logic before the operationruns or after it is completed. The Retail POS IOperationTriggers interfaceintroduces new generic triggers called the PreProcessOperation andPostProcessOperation.
Objectives
• Explain how to extend triggers in Microsoft Dynamics AX 2012 R2POS.
12 - 1
-
8/9/2019 80585 Ax2012 Enus Retail All
80/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
How to Modify the Trigger ProjectThis lesson explains how to modify the triggers. To extend the triggers, you willuse the operation triggers as an example and then customize these triggers. Youwill update the GiftCardBalance operation by asking the customer if he or shewants to add his or her balance after it is verified.
Lesson Objectives
• Explain how to customize triggers and how the triggers are used.
How to Modify the OperationsTrigger Project
To modify the OperationsTrigger project, follow these steps.
1. Back up the existing assembly before any modification. If you mustrevert for any reason, the original assemblies will be available in suchscenarios.
2. Browse to the folder where the Retail POS Software Development Kit(SDK) is installed. By default, it will be located atC:\Users\...\Documents\Retail SDK\POS Plug-ins\.
3. Open the Triggers folder and double-click the Triggers Visual Studiosolution file.
4. Add a reference to the following assemblies that are located in theRetail POS runtime folder:
o DevExpress.Utils.v11.2.dllo POSProcesses.dllo System.Windows.Forms.dll
5. Update the GiftCardBalance operation by asking the customer if he orshe wants to add to his or her balance after it is verified.
6. Open the OperationTriggers.cs file and locate thePostProcessOperation method.
7. Add the following C# code:public void PostProcessOperation(IPosTransaction posTransaction,PosisOperations posisOperation)
{if (posisOperation == PosisOperations.GiftCardBalance){
using (var form = newLSRetailPosis.POSProcesses.frmMessage("Would you like to add to your giftcard amount?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
{
LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(form);if (form.DialogResult == DialogResult.OK)
12 - 2
-
8/9/2019 80585 Ax2012 Enus Retail All
81/152
Module 12: Trigger Extensibility – Sample and How-To{
//reference existing or new logic for adding moneyto customer gift cards
}}
}else
{LSRetailPosis.ApplicationLog.Log("IOperationTriggersV1.PostProcessOperation", "After the operation has been processed this trigger is called.",LSRetailPosis.LogTraceLevel.Trace);
}}
8. After you build the project, put the assembly in the RetailPOS\Services\Extensions folder. This path applies only to MicrosoftDynamics AX 2012 R2. For later versions, use POS\Extensions.
9. Start the POS runtime and perform the Gift card balance operation.
10. After you receive the balance, the dialog box appears with the
customer message that is written in the post process.
12 - 3
-
8/9/2019 80585 Ax2012 Enus Retail All
82/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
12 - 4
-
8/9/2019 80585 Ax2012 Enus Retail All
83/152
MODULE 13: SERVICES EXTENSIBILITY – SAMPLEAND HOW-TO
Module OverviewMicrosoft Dynamics AX 2012 includes a collection of core services that can becustomized or replaced by using Retail POS Plug-ins. You can also create newservices that can be started from existing services or triggers.
Objectives
• Explain how to extend services in Microsoft Dynamics AX 2012 R2POS.
13 - 1
-
8/9/2019 80585 Ax2012 Enus Retail All
84/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
How to Modify the Services ProjectServices include one or more operations and implement a single, unique interface.You can make modifications to an existing service and continue to use theremaining functionality.
Lesson Objectives
• This lesson explains how to modify the Z-Report by using EODservices project.
How to Modify the Z-ReportExample:
If, in the Z-report, you want to print the count of a returned transaction in theshift, you can do the following:
1. Before the modification, take the backup of the existing assembly sothat the original assemblies will then remain available if you mustrevert to them.
2. Browse to the folder where you installed the Retail POS SoftwareDevelopment Kit (SDK). By default, this folder will be located atC:\Users\...\Documents\Retail SDK\POS Plug-ins\.
3. Open the Services folder and double-click the Services Visual Studiosolution file.
4. Browse to the EOD project and double-click the BatchPrinting.cs file
and add the following new method:public static int CalculateReturnransactionCount(Batch batch)
{int count = 0;DbConnection connection =
ApplicationSettings.Database.LocalConnection;
if (connection.State != ConnectionState.Open)connection.Open();
string query = "SELECT COUNT(S.TRANSACTIONID) FROMRETAILTRANSACTIONTABLE H INNER JOIN RETAILTRANSACTIONSALESTRANS S ON " +
"H.TRANSACTIONID = S.TRANSACTIONID ANDH.STORE = S.STORE AND H.TERMINAL = S.TERMINALID AND H.DATAAREAID =S.DATAAREAID " +
"WHERE H.STORE = @STOREID " +"AND H.BATCHTERMINALID =
@BATCHTERMINALID " +"AND H.DATAAREAID = @DATAAREAID " +"AND H.BATCHID = @BATCHID " +"AND S.QTY > 0";
using (DbCommand dBCommand = new SqlCommand()){
dBCommand.Connection = connection;dBCommand.CommandText = query;dBCommand.Parameters.Clear();
13 - 2
-
8/9/2019 80585 Ax2012 Enus Retail All
85/152
Module 13: Services Extensibility – Sample and How-Toif (batch != null){
dBCommand.Parameters.Add(newSqlParameter("@STOREID", batch.StoreId));
dBCommand.Parameters.Add(newSqlParameter("@BATCHTERMINALID", batch.TerminalId));
dBCommand.Parameters.Add(new
SqlParameter("@BATCHID", batch.BatchId));dBCommand.Parameters.Add(newSqlParameter("@DATAAREAID", ApplicationSettings.Database.DATAAREAID));
}count = DBUtil.ToInt32(dBCommand.ExecuteScalar());
return count;}
5. Locate the Print method (this Batch batch, ReportType reportType) inthe BatchPrinting.cs file and then add the following line of code afterthe line reportLayout.PrepareHeader(batch, reportType);
reportLayout.AppendLine(string.Format("Return count-{0}",CalculateNegativeTransaction(batch)));
6. After you do this, build the project and put the assembly in the RetailPOS\Services\Extensions folder. This path applies only to MicrosoftDynamics AX 2012 R2. For later versions, use POS\Extensions.
7. Start the POS runtime and perform the Z-report operation to view thechanges in the report.
13 - 3
-
8/9/2019 80585 Ax2012 Enus Retail All
86/152
-
8/9/2019 80585 Ax2012 Enus Retail All
87/152
-
8/9/2019 80585 Ax2012 Enus Retail All
88/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
Blank Operation on the Retail POS RegisterThis lesson explains how to set up a blank operation and add custom logic to theblank operation
Setting Up a Blank Operation on the Retail POS Register
To set up a blank operation on the Retail POS register, follow these steps.
1. Start Retail POS. Right-click the Cashier Tasks button and then selectButton Properties. The Configure button form opens.
2. In the Action drop-down list, select Blank Operation. The Operationnumber field is a string value that Retail POS uses to identify theBlank Operation. Because you can send multiple blank operations toRetail POS at the same time, you must give each blank operation aunique identity so that Retail POS can distinguish which blankoperation to execute.
You can use the Blank Operation param field to send an optional stringparameter. The Operation number and Blank Operation param values combine toform the method signature of the Blank Operation. In this scenario, set theOperation number to MyTask and leave the Blank Operation param value to MyParam.
3. You can use the fields under the Appearance tab on the right-side ofthe Configure button form to customize the appearance of the
button. For example, you can set the text value that displays on thebutton when Retail POS is started. Change the button name toMyOperation, as shown in the following image:
FIGURE 14.1 CONFIGURE BUTTON FORM
14 - 2
-
8/9/2019 80585 Ax2012 Enus Retail All
89/152
Module 14: Blank Operation Extensibility
Adding Custom Logic to the Blank Operation
To add custom logic to the Blank Operation, follow these steps.
1. Browse to the folder where you installed the Retail POS Software
Development Kit (SDK). By default, it will be located atC:\Users\...\Documents\Retail SDK\POS Plug-ins\.
2. Open the Services folder and double-click the Services Visual Studiosolution file.
3. Browse to the Blank Operations project and expand it.
4. Right-click the reference node and then click Add reference andbrowse for the assemblies POSProcessess in the Retail POS folder andthen select it, and then click OK .
5. Open the BlankOperation.cs file and find the BlankOperation method,as shown in the following C# code example:
public void BlankOperation(IBlankOperationInfo operationInfo,IPosTransaction posTransaction)
Notice the BlankOperation method takes two parameters: an operationInfo objectand a posTransaction object. The operationInfo object contains the‘MyTask’ operation number and the ‘My Param’ operation parameter that you seton the MyOperation button of the Retail POS register. Retail POS uses thatOperation number to identify the Blank Operation that is being passed.
The posTransaction object contains all the information about the currenttransaction.
Several Blank Operations can be handled in the one BlankOperation method. Usea C# Switch statement on the operationInfo.OperationId value to capture thespecific Blank Operation that you must have. You can do this by adding thefollowing code to the BlankOperation method.
public void BlankOperation(IBlankOperationInfo operationInfo,IPosTransaction posTransaction){
switch (operationInfo.OperationId){
case "MyTask"://TODO: insert method call to your custom logic
LSRetailPosis.POSProcesses. POSFormsManager .ShowPOSStatusPanelText( "My taskoperation is clicked" );
operationInfo.OperationHandled = true;break;
}
6. Compile the BlankOperations project.
7. Copy your new assembly to the POS\Services\Extension folder andstart Retail POS. This path applies only for Microsoft Dynamics AX2012 R2. For later versions, use POS\Extensions.
14 - 3
-
8/9/2019 80585 Ax2012 Enus Retail All
90/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
8. Click the Cashier Tasks button and then click the MyOperation button. You will receive the following message in the status panel:
FIGURE 14.2: STATUS PANEL MESSAGE
14 - 4
-
8/9/2019 80585 Ax2012 Enus Retail All
91/152
MODULE 15: CUSTOM FIELDS ON POS LAYOUTS
Module OverviewThis module explains how to add custom fields to Point-of-Sale (POS) layouts. InMicrosoft Dynamics AX for Retail 2012 R2, you can also add custom fields on POSReceipt layouts.
Objectives
• Explain how to add fields to the receipt layout.
15 - 1
-
8/9/2019 80585 Ax2012 Enus Retail All
92/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
Custom Fields on the POS LayoutThis lesson explains how to add fields to the receipt. You will learn how to add aline item field that shows the time that the item is added to a transaction and aheader field that shows the total quantity of the whole transaction.
Adding Fields to the Receipt Layout
To create custom fields, follow these steps.
1. When you create the custom fields, as with the custom fields for tilllayout, receipt fields are defined in Headquarters on the CustomFields form(Retail > Setup > POS > Profiles > Custom fields ). For thisexample, you will create two fields, both of the type
Receipt : TotalQty and TimeScanned.
FIGURE 15.1: CUSTOM FIELDS FORM
Any fields that are created in custom fields are available in all three sections of thereceipt format designer —Header, Lines, and Footer. The Caption text ID is aunique identifier for the text that will show in the receipt format designer (unlikethe custom fields for till layout that use the Name in the designer, and the Captiontext ID in the POS). The Caption text ID is still stored in the RetailLanguageTexttable and is only used at Headquarters.
Because there is no form to add strings to the RetailLanguageText table, you willpopulate the values directly in the Application Object Tree (AOT).
2. Open a new developer workspace and browse to Data Dictionary >Tables > RetailLanguageText . Right-click and select Open.
15 - 2
-
8/9/2019 80585 Ax2012 Enus Retail All
93/152
Module 15: Custom Fields on POS Layouts3. Create two records by populating the languageID, Text and textID
fields:
FIGURE 15.2: NEW DEVELOPER WORKSPACE
To add the custom fields to the Receipt Layout, follow these steps.
After the fields are created they can immediately be added to any receipt format.
4. Browse to Retail > Setup > POS > Receipt formats and then clickthe Designer button for any receipt format.
15 - 3
-
8/9/2019 80585 Ax2012 Enus Retail All
94/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
FIGURE 15.3: RECEIPT FORMATS
If the fields and labels are created correctly, you should be able to find them inthe field list for any of the three sections:
15 - 4
-
8/9/2019 80585 Ax2012 Enus Retail All
95/152
Module 15: Custom Fields on POS Layouts
FIGURE 15.4: RECEIPT FORMAT DESIGNER
Note : You did not correctly create the RetailLanguageText record, if somethingappears that resembles (22000)??Missing String?? .
1. Find a place to drag the Total Quantity and Time Scanned fieldsonto the header section and give each a hard-coded text label. Make
sure that you press the Save button when you are finished.2. Run the A-1090 or N-1090 job to push the new receipt to the POS
database.
15 - 5
-
8/9/2019 80585 Ax2012 Enus Retail All
96/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
FIGURE 15.5: RECEIPT FORMAT DESIGNER WITH TRANSACTION COMMENTSHIGHLIGHTED
To connect the custom fields in code, follow these steps.
3. Before the modification, take the backup of the existing assembly sothat the original assemblies remain available if you must revert tothem.
4. Browse to the folder where you installed the Retail POS SoftwareDevelopment Kit (SDK). By default, it will be located atC:\Users\...\Documents\Retail SDK\POS Plug-ins\.
5. Open the Services folder and then double-click the Services VisualStudio solution file.
6. Locate the FormModulation.cs file in the Printing service. Valuesfor the header and footer fields are handled in the
GetInfoFromTransaction() method and for lines it is theGetInfoFromSaleLineItem() method. Locate the switch statementfor GetInfoFromTransaction() from the following code example.
switch (itemInfo.Variable.ToUpperInvariant().Replace( " " , string .Empty)){
case "DATE":return
((IPosTransactionV1)theTransaction).BeginDateTime.ToShortDateString();case "TIME24H":
return
15 - 6
-
8/9/2019 80585 Ax2012 Enus Retail All
97/152
Module 15: Custom Fields on POS Layouts((IPosTransactionV1)theTransaction).BeginDateTime.ToString( "HH:mm");
7. To print a value for the custom field, you have to add the field nameto the switch statement.
case "TOTALQTY": return theTransaction.SaleItems.Sum(s =>s.Quantity).ToString();
To use PartnerData fields for line items, follow these steps.
The header example used a simple calculated field to print a value. However, youwant to extend the RetailTransaction object to store extended values that canthen be printed on the receipt. You can do this with the PartnerData object thatis introduced in Microsoft Dynamics AX for Retail 2012 Feature Pack.
The PartnerData object is a dynamic collection that can be defined at run timeinstead of compile time. Fields can be stored at the transaction level, the sales linelevel, or the payment line level. These fields are then stored in transaction object
and can be used in triggers or services. In the example, you will create a field thatis named “ TimeAdded ” on the sales line and then use it when you print thereceipt.
8. Open the Triggers solution in Visual Studio and browse to theItemTriggers project. Now you have to add several things to theproject before you add the code.o The PartnerData object relies on a feature that is introduced in
C# 4.0. To use PartnerData in any of the POS code, the projectmust add a reference to Microsoft.Csharp
o The example uses the SaleLineItem POS object. This object is in
the Transaction class. The project also requires a reference tothe Transaction.DLL file from the POS installation folder. Makesure that you set the Copy Local property to False when you addthis reference.
o Finally, a using LSRetailPosis.Transaction.Line.SaleItem; linemust be added to the top of the ItemTriggers.cs file.
9. After this is set up, you must add the following lines to the PreSale()method:
using LSRetailPosis.Transaction.Line.SaleItem;[...]
public void PreSale(IPreTriggerResult preTriggerResult, ISaleLineItemsaleLineItem, IPosTransaction posTransaction){SaleLineItem s = (SaleLineItem)saleLineItem;s.PartnerData.TimeAdded = System.DateTime.Now.ToString("HH:mm:ss");
15 - 7
-
8/9/2019 80585 Ax2012 Enus Retail All
98/152
Microsoft Dynamics AX ® 2012 R2 For Retail in Brick and Mortar Stores -Development and Customization
10. Now you must read the TimeAdded value when you print sales lineson the receipt. This is performed in the FormModulation.cs again,this time in the GetInfoFromSaleLineItem() method.
switch (itemInfo.Variable.ToUpperInvariant().Replace( " " , string .Empty)){
case "TIMESCANNED": returnValue = saleLine.PartnerData.TimeAdded;break ;
case "TAXID" :returnValue = saleLine.TaxGroupId;break ;
11. Compile the ItemTriggers. dll and Printing.dll and then copy them tothe POS\Services\Extension subfolder in the POS installation. Thispath applies only to Microsoft Dynamics AX 2012 R2. For laterversions, use POS\Extensions.
12. Start POS and print a receipt by doing a sale transaction so that youwill able to view the modification in POS.
Similar to this, you can also add custom fields on the following:
• Payment Grid• Product Receipt G