Wednesday 5 August 2015

How To Delete All Transaction From Dynamics AX

To run it, make sure you’re in the company where you want to delete the transactions.
1. Press Ctrl + D.
2. Open the Class node in the AOT.
3. Find SysDatabaseTransDelete class, right click, select open, a pop up will appear asking if you want to delete all transactions in the company.
4. Click Yes


Tuesday 4 August 2015

Employee Time And Attendance Setup Dynamics AX HR

Organizations of all sizes use Time and attendance systems to record when their employees start and stop work, and the department where the work is performed. It’s also a  common practice to track meals and breaks, the type of work performed, and the number of items produced. The Time and attendance functionality of AX 2012 enables organizations to track the time and attendance including the jobs on which the workers are working on a given day. Using this functionality the workers can register various types of times such as Clock in, Clock out, Absence, Breaks, Flex time, Overtime etc. This functionality will find a lot of traction in the manufacturing industries where lot of the workers are paid based on their working profiles and make time registrations.
The below diagram depicts the overall flow of the worker’s time registration process in Dynamics AX 2012.
image
Now that we know an overview of the Time and attendance functionality, let us look at the setups which we need to make in order to use this functionality.
Basic setup for T&A:
There are a bunch of setups present under the Time and attendance form in the human resource module. Each of these setups as a significance and I will not explain those here as I will primarily highlight the process of the time and attendance recording in this post.
image
Calculation and Approval groups:
  • The calculation groups are a way to categorize the workers. For example, workers working in ‘same shifts’ or workers working in ‘same teams’. This helps the team lead/manager who calculates the time registrations for approval, to calculate the time registrations for a bunch of workers falling in same calculation group and this ensures reduced time in calculation.
  • Navigate to HR > Setup > Time & Attendance > Groups > Calculation groups and create a new record.
  • Optionally, you can password project the calculation groups by providing a password under the General tab.
image
  • An approval group is logically same as the calculation group and typically consists of a set or group of workers.
  • Navigate to HR > Setup > Time & Attendance > Groups > Approval groups and create a new record.
image
Indirect activities and Absence codes:
  • Dynamics AX 2012 enables workers of an organization to register time on several indirect activities which they may work on a given day and it also allows to register hours on absence codes if they are absent from working hours. Few examples of indirect activities are “Meetings”, “Travel” etc. .(Activities which are not directly related to projects, jobs)
  • Four different types of time registrations are allowed for the indirect activities which are “Job”, “Break”, “Switch code” and “On call”. Indirect activities are ideally configured under an activity group.
  • Go to HRM > Setup > Time & Attendance > Indirect activities.
  • Create a new record and select the Registration type from the four option as per your requirement. In my example, I will select Job.
image
  • Click Activities button.
  • Create new indirect activities such as Test1 and Test 2.
  • Check the Registration check box under General tab and specify account and offset account if needed.
image
  • You can also setup cost for the indirect activities by clicking the Cost button. Refer to screen below.
image
  • Similarly absence groups and codes can be configured for recording time for absence from work. If “Education break” is an example of absence group, then absence codes under it could be “ Training”, “Workshops”, “Long term education” etc.
  • Configure the absence groups and codes under HRM >  Setup > Absence > Absence groups.
image
Setup Worker/Employee for Time Registration:
  • Now that we have done most of the setups required for the Time and attendance function, let us setup the a worker and enable him for time registrations.
  • AX 2012 allows the workers to make time registrations in two forms. The Electronic timecard form and the Job registration form. In this case, we will just enable a worker to make registrations in Electronic time card form.
  • To do this, go to HR > Common forms > Workers > Workers.
  • Select any worker and double-click.
  • Click the Employment tab and expand the Time registration fast tab to set up parameters related to activating the worker for time registrations.
image
Setup Work Time Profiles:
  • Different work time profiles can be configured for workers working in different working hours and tasks. The worker time profile basically identifies the nature of time registrations which the workers is supposed to make in a given day. For example a worker can clock in, work for standard working hours, take a break, work overtime and clock out. The work time profile basically will contain these profile types.
  • The work time profiles are configured and setup for group of workers usually. For example, workers working on Day shifts may be allocated with a  “day shift” profile and workers working in “evening shift may be allocated with a “evening shift” profile.
  • When the work time profiles are setup in the worker time registration, then the time and attendance system automatically detects the profile depending on the clock-in time of the employee. The work time profile functionality and concept is large and I will cover this in detail in one of my upcoming posts.
image
Time and Attendance Registration Process in AX 2012:
  • In this post of mine, I will cover only the time registration process using the Electronic time card functionality. I will try to discuss the Clock-In/Clock-Out time registration functionality in posts later.
  • As we have set up Ahmed to register electronic time cards, we will now see the steps which he will follow to make time registrations.
  • Go to Home > Time and Attendance > Electronic Timecard
  • Select the worker. (Ahmad in this case)
image
  • System will automatically show the profile for the worker and the profile date will default to the current date/day. You can modify the profile date.
  • If you want your registrations not to be modified by team lead or your manager, then you can Lock the profile date by clicking the Lock button.
  • See the screen below in which I have entered a standard day’s time registrations.
image
  • After filling in the time card, click Check button. System will validate that all your time registrations are fine and checked for any violations.
  • Finally, Click Transfer to, transfer the time registration for calculation and approval.
Calculate and Approve Time & Attendance Registrations:
  • The next task is for the supervisors or the team members to calculate the time registrations done by their workers.
  • During the calculation, the worker time registrations are calculated against the work time profile. If there are any missing registrations, then it is automatically detected during the calculation and system will generate errors indicating these. The team lead or supervisor can then correct and recalculate the registrations.
  • To do this go to HRM > Common > Time and Attendance > Calculate.
image
  • Select the calculation group and date. The calculation group will enable the supervisor to mass calculate the time registrations for the workers here.
  • Click Ok button.
  • Note that, system may prompt for password if you have configured in the calculation group setup.
  • On the Calculate form, verify all the information and click Update > Calculate button and then click Ok on the
image
  • After the time registrations are calculated and verified, it needs to be approved. Approval is ideally done by the HR manager/Payroll manager. This is to ensure that the time registrations looks all correct before they are committed and posted in other modules.
  • To approve the time registration, Go to HRM > Common > Time and Attendance > Approve.
image
  • On the Approve form, click Update > Approve and then click Ok on the batch job.
image
  • You will get a confirmation that the registration for approved without errors.
  • The next task for the payroll manager or whoever approves the time registrations is to transfer the time registrations. This will ensure that all the transactions are posted successfully to the jobs on which registrations were made.
  • To transfer the time registration click Update > Transfer and then click Ok button on the dialog.
image
  • Notice that the TR lines will get transferred from the Approve screen.
image
  • Not let us verify the postings in the different modules. For example in this time registration Ahmed had entered time on the project 10001. So if you go to project 10001 and then to Posted transactions, you will find the the transactions created by the TR system. See screen below.
image

Monday 3 August 2015

Retail Print Receipt Customization

How the Windows printing works.
There are two plug-ins that important with respect to the printing process:  the Printing service and the Peripherals service.  The Printing service handles all of the layout of what is being printed; it reads from the Form Layout table and replaces data fields with information from the transaction being printed.  The resulting string (and it really is just a simple text string) then gets passed to the Peripherals plug-in which handles the communication with the printer.
The Peripherals plug-in is of most interest for this article, specifically the branch of code that starts with the PrintReceipt() method of the printers.cs file:
           switch (LSRetailPosis.Settings.HardwareProfiles.Printer.DeviceType) 
            
{ 
                
case DeviceTypes.OPOS: 
                    
OPOSPrinting(text); 
                    
break; 

                
case DeviceTypes.Windows: 
                   
WindowsPrinting(text, LSRetailPosis.Settings.HardwareProfiles.Printer.DeviceName); 
                    
break; 
            
}
When this code gets hit, the receipt has already been created in memory and is ready to send to the printer.  The decision to send to an OPOS printer (OPOSPrinting method) or a Windows printer (WindowsPrinting method) fully depends on the setting on the Printer tab of the POS Hardware Profile window:
HardwareProfile
Images and Barcodes:  The WindowsPrinting() method uses an standard method for communicating with the printer:  the System.Drawing.Printing class.  A very simplistic way of looking at this way of printing is to think of drawing an image of the page in memory and then sending that image to the printer.  Printing simple text alone using this method is somewhat difficult; adding complex formatting (images, different fonts, etc.) is something that we have left for Partners and Customers to customize.
When printing to an OPOS device, you can send special OPOS codes to the printer to print either a barcode or an image, both of which are directly managed by the printer.  Because System.Drawing.Printing is not specific to any one printer or class of printers, this shortcut is not available for Windows printers.  In fact, if you print these fields to a Windows printer, you’ll notice that they show up as placeholders like this:  <L> and <B:00001>.  If you are looking to add barcode and image functionality, the code in the printDoc_PrintPage() method is where you would start.
Page Breaking:  The printDoc_PrintPage() method is also where there is a bug in page break functionality.  OPOS printers have no concept of page breaks – if you add 100 lines to a receipt, it will just keep scrolling the paper and printing.  System.Drawing.Printing requires that you calculate the page size and add page breaks manually.  The implementation that we ship does not have this code for page breaks.  This means if you have a long receipt, even if you are printing to scrolling paper, sooner or later a page break will get hit and the receipt will just quit printing.
Attached below is code that shows one way that you can incorporate page breaking into the code.  Since we are printing with a fixed-sized font (7-point Courier New) we can calculate how many lines can be printed on a “page.”  The code then writes out each line of the receipt until it hits that number of lines.  It then stops writing, flushes to the printer, and sets the PrintPageEventArgs.HasMorePages Property for whether another page should be printed.  The PrintDocument.PrintPage Event entry on MSDN includes an excellent example showing how page breaks should be calculated.
I have included both the original version of “Printer.cs” and the version with my changes.  Create a new project for the Peripherals plug-in and merge in the code changes.  This fix has not gone through formal testing and you may find a better way to keep track of paging, but it works in my limited testing and should be a good starting point.
Page Size:  Printing to an OPOS device is very simplistic; a fixed-width font is used and a relatively narrow page size is used.  If you need to print to a Windows printer and use different paper sizes, there are limitations but a few things you can try.
First of all, you can try different font styles and sizes.  The printDoc_PrintPage() method hard-codes to 7-point Courier New:
                Font tempFont = new Font("Courier New", 7, FontStyle.Regular); 
                
SolidBrush tempBrush = new SolidBrush(Color.Black); 
               
System.Drawing.PointF tempPoint = new System.Drawing.PointF(0, 0);
Simply changing this font (it’s in five places) will spread your text across the page.  Make sure to use a fixed-width font or your receipts won’t line up properly.  You will also have to experiment with the values of the offsets for placing the text (coordinate variables x and y).
Also, a not-so-obvious feature of the Form Layout designer is the ability to change the number of columns in any of the three sections.  Simply right-click on a blank area and select “Number of columns” from the pop-up menu.  Change the value to change the width of your paper.  A lot of trial and error will be needed to match up font size and paper width, but it should give you some options.
LayoutDesigner
Hopefully this gives you a place to start if you need to use a Windows driver to print receipts.  There are limitations to using System.Drawing.Printing for printing; if you’re looking for more flexibility (pre-printed forms, better use of graphics, headers and footers per page, etc.) you may want to look at other options such as third-party controls or report writers.

Saturday 1 August 2015

Create Sales order from Creation to Invoice



Step 1: Select Account Receivable -> Common -> All Sales Order



Step 2 : Click Sales Order (left corner)



Step 3: Input required information in Sales order header screen and Click Ok



Step 4 : After clicked Ok on the above (Sales header) screen.  Sales line screen will be displayed as below;

Input Item details, warehouse information  and required sales qty.




Confirming Sales Order

Step 5 : Click Sell menu and Click Sales order confirmation option;



Note :  Sales Order confirmation screen will be displayed; Select required information (Print options) and click Ok

Posting Packing slip
Step 6: Click Pick and Pack menu and click Packing slip option.



Note : Packing slip dialog box will be displayed.  Input Packing slip Qty and click Ok.

Check the Sales order status; order status should be “Delivered”



Invoice in Sales order

Step 7 : Click Invoice menu and click Invoice option




Check the Sales order status; order status should be “Invoiced”