Tuesday, August 26, 2014

Master Detail grid for a purchase order

August 26th 2014

Today I am going to show how I implemented master grid with a child detail grid for the purposes of a purchase order.  Normally I like to do this in a dialog but this time I chose to implement via a grid since this gave me an opportunity to add a single line each time a record is saved in the detail section.  I am sure I can do this in a dialog.  But this is working so I did not pursue that line.

Before I build the purchase order header, let me tell you how the detail view is done. Then it will be easy to incorporate it into the header grid and you are done with it.  The detail grid is a simple updatable grid with a property to add a single new record rather than the customary 3 records that alpha gives.  The item name field is designed as a look up to fill all the rest and in the onChange event I have triggered to save the grid via action javascript.  My grid is also designed to total the amount for the total cases and the cost, you can easily accomplish that. This is rather straight forward.  The main work comes in the next grid.

The header grid is based on the single record template.  The reason I chose this instead of others is that when you finish it almost looks like a dialog, not anything nearly like a grid.  I have also hidden the detail section and the buttons to direct the user my way.

To show the buttons show and hide property is used for the first two buttons based on the idea whether the grid is dirty or not.  And for the next three buttons it is based on the idea record id being grater than 1.

Printing report and sending email are again straight forward.  One is done with action javascript, the other via an xbasic routine.

To show the detail section on demand a div with an id is created below the detail section of the grid in the freeform area and the onClick event of the button opens the child grid filtered by the purchase order id at that location.

When all done the parent grid and child detail grid work flawlessly and has been a good addition to my work schedule.

The same method may be applied to receiving document and especially sales. I have to finish the sales before I post it.
In the meantime here are some videos to show how this is done

purchase order detail:
http://screencast.com/t/zwe2K2H6yC
purchase order header part 1
http://screencast.com/t/3ON0pzC30H1
purchase order header part 2
http://screencast.com/t/aeLcMqqa
real life functioning purchase order at my store
http://screencast.com/t/h7N63XZqKjM