tag:blogger.com,1999:blog-17203529537031986352024-02-19T18:01:18.270+11:00Inner-workings of Dynamics AXThanks to the popularity of Microsoft Dynamics AX (aka Axapta), there are tons of blogs containing useful insights and interesting facts on AX. The community is ever-growing and feels great to be a part of it. With this blog, I will add my two cents to the knowledge base and enforce my concepts as well. I will focus more on relatively unknown facts about AX as the fundamental aspects are thoroughly covered. So, let's begin.Aman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.comBlogger51125tag:blogger.com,1999:blog-1720352953703198635.post-20717504588219594742016-07-27T00:16:00.000+10:002017-10-25T11:32:57.886+11:00Master planning<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Dynamics AX master
planning (MP) covers the short-term calculation of material and capacity
requirements. Matching supply and demand to get net requirements of a product.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Similar to forecast
scheduling batch job, here we run a <span style="font-weight: bold;">master
scheduling batch job</span> that creates <span style="font-weight: bold;">net
requirements</span> for an item and corresponding planned orders.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="font-weight: bold;">Static and Dynamic master plans</span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
On a higher level,
you can also devise a strategy of having two kinds of master plans, static and
dynamic. </div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Master planning
parameters (Master planning> Setup> Parameters) has two options for
current static master plan and current dynamic master plan. Master scheduling
batch job usually runs every night calculating net requirements for all items.
The result of that calculation is available in the static master plan. The
static plan is the master plan to be used in purchase and production management
for scheduling orders. It is the default plan when accessing the planned orders
forms. On the other hand, the sales department needs a plan to run simulations
in order to check possible delivery dates in sales orders. Therefore, sales
requires running a master scheduling simulation locally, which is for the
individual item only. The result of that simulation is available in the dynamic
master plan.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="margin: 0in;">
<span style="font-family: "calibri";"><span style="font-size: 14.6667px;">Three options:</span></span><br />
<span style="font-family: "calibri";"><span style="font-size: 14.6667px;"><br /></span></span>
<span style="font-family: "calibri";"><span style="font-size: 14.6667px;">1. For a basic setup, you need only static plan setup. We don't specify the dynamic plan.</span></span><br />
<span style="font-family: "calibri";"><span style="font-size: 14.6667px;"><br /></span></span>
<span style="font-family: "calibri";"><span style="font-size: 14.6667px;">2. Or use the same plan for both static and dynamic. If you enter the same master plan for the static and the dynamic master plan in the master planning parameters, you run a one master plan strategy. Planned orders of current master scheduling simulations in sales update the static plan, which is used in purchasing and production. Depending on your company's requirements, this could be useful.</span></span><br />
<span style="font-family: "calibri";"><span style="font-size: 14.6667px;"><br /></span></span>
<span style="font-family: "calibri";"><span style="font-size: 14.6667px;">3. Last option would be to use separate plans for both. In order to apply a two master plan strategy, you need to enter a different master plan for the static and the dynamic plan. When running the batch job for static master scheduling in the night, it usually copies the static plan into the dynamic plan in order to base simulations on the current static plan. In this case, simulations in sales will start applying a common data basis with purchase and production management in the morning. Simulation throughout the day do not change planned orders in the static plan, thereby avoiding problems in purchasing and production caused by planned orders changing every moment.</span></span><br />
<span style="font-family: "calibri";"><span style="font-size: 14.6667px;"><br /></span></span>
<span style="font-family: "calibri";"><span style="font-size: 14.6667px;"><b>Important note</b> <i>MP uses table InventSumLogTTS to assist in its calculations. Problem is this table can grow big quickly. MS and LCS diagnostics recommend to keep this table clean. MP batch job can do this cleaning for you but it requires that your dynamic plan is set. Even if you dont use dynamic plans, it is better if you set it same as your static plan. This way each run of MP job, will delete unwanted records from this table.</i></span></span><br />
<span style="font-family: "calibri";"><span style="font-size: 14.6667px;"><i>See class ReqCalcScheduleItem\InsertItemSched</i></span></span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="font-weight: bold;">Master plan</span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
First thing required
is setting up<span style="font-weight: bold;"> master plans </span>(Master
planning > Setup > Plans > Master plans). A master plan covers
multiple scenarios you want handled in your master planning.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="font-style: italic;">Ticking the 'Include on-hand inventory' and 'Include
inv. Transactions' boxes will ensure that any stock on hand and open purchase
orders will be included in planned order calculations.</span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
The ‘Include demand
forecast’ must also be ticked to ensure that the forecast entered against each
item is included in the calculations.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Reduction Principle
could be set to None.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Time fences, safety
times, action and futures messages will not be set at the plan level. <span style="font-style: italic;">These will be set at the Coverage group level as the
Master plan settings override the coverage group.</span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Futures messages
fast tab - used to specify if requirement date on planned order should
automatically update to calculated futures date</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Action messages fast
tab- used to specify if requirement date on planned order should automatically
update to action date</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Safety margin - add
2,3 days for buffer. Cushion to help you for delays. Its going to add up on top
of Coverage group safety margin. Be careful.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="font-weight: bold;">Master plan parameters</span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
General tab - Define
your static and dynamic plans</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Planned orders tab -
Find trade agreements. This is to find the vendor for an item when the primary
vendor is not specified on an item. Two criteria - minimum lead time or lowest
price.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Standard update -
Grouping planned orders into individual purchase orders when firming them. By
vendor, buyer group etc. I have done customisations to add group by warehouse
(InventDimId), maybe in another post.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="font-weight: bold;">Time fences</span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
What is time fences?
No of days master planning should look out from today to find transaction. It
can be applied on Master plan or Coverage group. As said above, Master plan
will override Coverage group.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
For eg, if Coverage
time fence is 100 days, it will look in future 100 days for all receipts and
demand to do its calculations.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Coverage is longest,
firming is shortest.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Explosion - usually
same as coverage. Used in <span style="font-weight: bold;">production</span>.
It’s the no of days in which if it finds a planned production order it will be
exploded into its net requirements. You need 10 of item a, 5 of item b etc</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Capacity - used to
schedule work orders, resources, resource groups. </div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Action, Futures -
calculation on no of days requirements where you will have action and futures
messages.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Freeze - no of days
you are not allowed to create new planned orders</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Firming -
automatically firm an order after a no of days</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="font-weight: bold;">Calendar setup</span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Calendars in AX are
used to basically set what days I can order products and can be set at
different levels Warehouse, Vendor and Item Coverage Group.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
The standard logic
of master planning is that Item Coverage Group overrides the Vendor which
overrides the warehouse (store).</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Based on this we can
use this logic to set up basic calendars against the warehouse (store) showing
that they can order every week day.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Then if required we
can set a different calendar against the Vendor if we only order products from
this Vendor on different days.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
The last option is
to set a calendar against individual coverage group which we can then set
against an item or group of items.</div>
<br />
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Using this logic
should hopefully limit the number of calendars that we need to configure and
should also limit the number of coverage groups that we will need to create.<br />
<br />
Example of a warehouse and its calendar property.<br />
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXrLH8sOBL-jqE_IywVD8cUkB5z9oOl1bbTASyXO_2HaS4uD3QLjgtLNZ4bdo5LqDSren6smoNdTxbiu3GgwBVH4yqYfJlkyU2wLWOdYDHK4WV-LZ0-hRhVOC8ffU0t_4R7gp0ZktC31uW/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="193" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXrLH8sOBL-jqE_IywVD8cUkB5z9oOl1bbTASyXO_2HaS4uD3QLjgtLNZ4bdo5LqDSren6smoNdTxbiu3GgwBVH4yqYfJlkyU2wLWOdYDHK4WV-LZ0-hRhVOC8ffU0t_4R7gp0ZktC31uW/s320/1.png" width="320" /></a></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Warehouse has a default calendar with working times set; which days they
can order. Assumption is for most stores this will be Monday-Friday.<span style="font-size: 11pt;"> </span></div>
<br />
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="font-weight: bold;">Working times</span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTvTy4Bb8cFjle4g1UkFmfXIRo3Z3kdkoQit0QfEdSJElXZNwFW2q8DBZ2-n8BJ0qyQw78a2HMs6obuY-S4IsRdkvUDALvlvQFIhU43iSqR4rrpjKPmW0b45pe7PrarnCrXDz1V2Gy420I/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTvTy4Bb8cFjle4g1UkFmfXIRo3Z3kdkoQit0QfEdSJElXZNwFW2q8DBZ2-n8BJ0qyQw78a2HMs6obuY-S4IsRdkvUDALvlvQFIhU43iSqR4rrpjKPmW0b45pe7PrarnCrXDz1V2Gy420I/s320/2.png" width="320" /></a></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="font-weight: bold;"><br /></span></div>
</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="font-style: italic;">Note: if you run master scheduling and calendar days
are not open, no Net requirements/Planned orders will be created against the
items.</span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="font-weight: bold;">Coverage groups</span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Coverage groups are
the main tool that master planning will use on when and how we want to order
products. Essentially it allows us to configure time periods (Daily, Weekly)
for how frequently we want to order individual products. The coverage group is
set against an individual product (Released products > Plan > Item
coverage). There is also a default property 'General coverage group' in
parameters form.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
There are 4 coverage
codes we can define.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="font-weight: bold;"><br /></span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<u>Requirement </u>- this group is used to order a
product only when we have demand for the product for example we have a script
for the drug this will be used for expensive drug items or drug items that we
don’t want to stock. <span style="font-size: 11pt;">Each
uncovered demand drives a planned supply. Usually for high value items, you
don’t want to buy too much and keep in stock</span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin-left: .75in; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<u>Period</u> - you can define a coverage period eg 7
days, 30 days. How many days you want to look out from the first piece of
demand a<span style="font-size: 11pt;">nd
group that many days of orders together. For eg an order created on 1st for
next 7 days of demand. Good thing is we are grouping 7 days of demand in one
order, bad is we have 7 days of on-hand sitting on us (inventory holding
costs). It is based on 1st requirement date not calendar date. 7 days does not
mean it creates an order every week. It means when it finds demand it creates
an order for next 7 days.</span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin-left: .375in; margin: 0in;">
One
example of a setup would be to define 3 period type coverage groups.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin-left: .375in; margin: 0in;">
Daily
– this group as the name suggests is products that we can order daily, this
coverage group is also usually combined with a minimum stock on hand value for
the product and this will basically mean we will order the product based on
daily usage and the minimum stock level.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin-left: .375in; margin: 0in;">
Weekly
– this group as the name suggests is for products that are ordered on a weekly
basis again this is also usually combined with a minimum stock on hand that can
then alert the user if usage is higher than normal and the product may need to
be ordered in advance.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin-left: .375in; margin: 0in;">
Monthly
– this group is to cover products that are ordered on a monthly basis and also
will normally be combined with minimum stock level that can then alert the user
if usage is higher than normal and the product may need to be ordered in
advance.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<u>Min/Max</u> - controls the size of supply. AX will order so much to bring you to the max
level. Once inventory value falls below min, an order big enough to bring value
up to the max is generated.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<u><br /></u></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<u>Manual</u> - Net requirements are not calculated.<span style="font-size: 11pt;"> </span></div>
<br />
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Eg, a daily coverage
group</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhFcOjQJp_IDimjkJxBxbT9rpYc0o8SC9C_nFPXrDJ-TgKGllPT1A1013Mp51xNxAaUs-zwWb6oMcVKwe6VpD_vX05MnBxk89DuilxKE4y-CFa3DuWuKlwOS24bpAZbjfis7XhwTYPI72o/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="193" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhFcOjQJp_IDimjkJxBxbT9rpYc0o8SC9C_nFPXrDJ-TgKGllPT1A1013Mp51xNxAaUs-zwWb6oMcVKwe6VpD_vX05MnBxk89DuilxKE4y-CFa3DuWuKlwOS24bpAZbjfis7XhwTYPI72o/s320/3.png" width="320" /></a></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="font-weight: bold;">Positive and Negative days (Coverage groups)</span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="font-weight: bold;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-22jlFz633fcqAqfJFaO2P1E52FA3Tc615LoCFIiNe95oFzY3C-YwVd0Vf5CmSawMfnsLeCzde8fCfUgFgfTPJVG-jt5wiforMZ8zDGDuXNZqXRra4kj7IRJu2V2s60IZ_0wtyaEoLYdq/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="165" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-22jlFz633fcqAqfJFaO2P1E52FA3Tc615LoCFIiNe95oFzY3C-YwVd0Vf5CmSawMfnsLeCzde8fCfUgFgfTPJVG-jt5wiforMZ8zDGDuXNZqXRra4kj7IRJu2V2s60IZ_0wtyaEoLYdq/s320/4.png" width="320" /></a></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="font-weight: bold;"><br /></span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Negative days -
Imagine we have a sales order for 10 items on 1st and we don’t have stock.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="text-decoration: underline;">If negative days is 0</span>, AX will say you
can't wait for the next purchase order so creates a new planned order.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Negative days is
like a window from a sales order(demand) of days when receipts in those days
will satisfy this demand.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="text-decoration: underline;">But if negative days is 20</span> and an
existing purchase order coming in on 17th, master planning pegs that purchase
order against the sales order. And does not create any new planned order. No of
orders in system are reduced. The purchase order will get an action message
created telling that the PO is going to be late and sales order is going to get a
futures message saying that the SO is also going to be 17 days late because it has a PO
pegged against it. Time to contact your vendor to speed things up!</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
If negative days did
not cover this demand on 1st, was less than 17, a new planned order would be
created.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Positive days -
Opposite direction. <span style="font-size: 11pt;">How far back master
planning will look for inventory to satisfy this demand (sales order). </span><span style="font-size: 11pt;">For ex, Sales order
on 31st, positive days 15 days, will go back 15 days to find any receipt. Does
not find any so creates a planned order.</span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<i><br /></i>
<i>Note: for master
planning, on hand inventory is a receipt. </i><span style="font-size: 11pt; font-style: italic;">People set their positive days to a large number like
999 so that on-hand inventory is always seen.</span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Negative days works
on lead times for an item. If the lead time for an item is not covered by a PO,
a planned order is created. Now different items might have different lead
times. There is a property called Dynamic negative days.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="font-weight: bold;">Dynamic negative days</span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Dyn neg days = LT +
Neg days</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
This gives more
flexibility and reduces no of coverage groups as LT is based on the item you
are planning.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNO7z4gLtenkVaszmosR9A-cxeATucpeRCyZFBMWlA62te8DTpXSMPbgDKOVYyZnIGKjKpK-nSXwAdMp9JNTgjGCrRnasExURKtGWxhzPYFxijSWwaROFT7l4SIg-EaZwh7FilxIM9pfDP/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="155" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNO7z4gLtenkVaszmosR9A-cxeATucpeRCyZFBMWlA62te8DTpXSMPbgDKOVYyZnIGKjKpK-nSXwAdMp9JNTgjGCrRnasExURKtGWxhzPYFxijSWwaROFT7l4SIg-EaZwh7FilxIM9pfDP/s320/5.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCGp2I2g8zCbdGIilOVWC87MTe0yN0beO4avEqZNRNSWrwMTV53Osre9q2k-SICNCEITeCFMcaoRs9bvSzKGkESBZUqSVdiTHmntI3o66fVkudNZ3_KqaqGcsdpRr7Ih6At3wOd4xESPwj/s1600/6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="301" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCGp2I2g8zCbdGIilOVWC87MTe0yN0beO4avEqZNRNSWrwMTV53Osre9q2k-SICNCEITeCFMcaoRs9bvSzKGkESBZUqSVdiTHmntI3o66fVkudNZ3_KqaqGcsdpRr7Ih6At3wOd4xESPwj/s320/6.png" width="320" /></a></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="font-weight: bold;">Action and Future messages (Master plan)</span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Negative/Positive
days are closely tied with action and future messages. An example to see action
and future messages in action. One prerequisite is that master plan should have
both ticked and set to appropriate no of days. If say Action message is not ticked,
you will not see any Action message arrow on the purchase order.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpOjPE94VcTLJFniAvdYtkVYiRcBNoBNO_pX2KOsePfGm4kjTAiwlZuAJLvYUSTvO6y7rvIWeJPZWge-vnjFSCz59IEhnW-jqIQZbK6uF21psC1fxetlFCHPNEznO-Uz52urX75_v-FXa_/s1600/7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="111" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpOjPE94VcTLJFniAvdYtkVYiRcBNoBNO_pX2KOsePfGm4kjTAiwlZuAJLvYUSTvO6y7rvIWeJPZWge-vnjFSCz59IEhnW-jqIQZbK6uF21psC1fxetlFCHPNEznO-Uz52urX75_v-FXa_/s320/7.png" width="320" /></a></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
For example, Item
'000000014' with a sales order for 10 qty on 1/8/2016 and a purchase order for
10 qty on 17/8/2016. The coverage group used 'MAN' has negative days set as 20.
Item has no stock.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Before running
master scheduling:</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg51f0uk4vhPYzdkrikdt1_wC74V-dTz3l8B3cjaAxO6mduh_NVL2qkun9awQ4qFx_vzW7mRbahS2fZ4CQXcgDGf0BqvPlPMHdhDUt3driI-ENHT1StD5ujGlZNldwsIX0YkkNPokbpPYY5/s1600/8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="156" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg51f0uk4vhPYzdkrikdt1_wC74V-dTz3l8B3cjaAxO6mduh_NVL2qkun9awQ4qFx_vzW7mRbahS2fZ4CQXcgDGf0BqvPlPMHdhDUt3driI-ENHT1StD5ujGlZNldwsIX0YkkNPokbpPYY5/s320/8.png" width="320" /></a></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
After
running master scheduling, the sales order gets a future message and purchase
order gets an action message:</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3Zu0oJSs8BuW1Igbyz5kyRO7cwT5nKsu9Qin2NUnFnA_AvjCrw9-hFSvUxwiiqZ3sbaxDBsgcay85VczCOkUMpgTEB8syZOInFJv0Mkgzd9u_OcdnaNlqnESCnZ7M5eaCZLlmVd9hDBTh/s1600/9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="154" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3Zu0oJSs8BuW1Igbyz5kyRO7cwT5nKsu9Qin2NUnFnA_AvjCrw9-hFSvUxwiiqZ3sbaxDBsgcay85VczCOkUMpgTEB8syZOInFJv0Mkgzd9u_OcdnaNlqnESCnZ7M5eaCZLlmVd9hDBTh/s320/9.png" width="320" /></a></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Action tab is
basically saying that the purchase order should be advanced by 16 days to
1/8/2016 instead of current 17/8/2016:</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQGqmdf-Rot3z0clmPJDmEHQ__HZmftJurJXwurFgiC8WCfyg6cABUs8hDJlZ4tY8S7zHg93yhdsNbke_LGQJ9plK4gld8yoQzbCDxfzwy8YfUQYybT-iop7Halj2-qQ6KyNJjUSOW4mQy/s1600/10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="234" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQGqmdf-Rot3z0clmPJDmEHQ__HZmftJurJXwurFgiC8WCfyg6cABUs8hDJlZ4tY8S7zHg93yhdsNbke_LGQJ9plK4gld8yoQzbCDxfzwy8YfUQYybT-iop7Halj2-qQ6KyNJjUSOW4mQy/s320/10.png" width="320" /></a></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Futures tab is
basically saying that the sales order should be delayed by 16 days to 17/8/2016
instead of current 1/8/2016:</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyznp2oR3IRMhJVj-2bnOimdQ5pW4l1j2uEPyMrNj7N05qGPHafPEjjr6KRUB89V1W77OhGNWTYiclGqGVPGHDv7ELs5C-PwXBTmrgiGkRB5YqaSqwlj9Im9LdIRvy5iMBgCP9r01s8TBe/s1600/11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="234" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyznp2oR3IRMhJVj-2bnOimdQ5pW4l1j2uEPyMrNj7N05qGPHafPEjjr6KRUB89V1W77OhGNWTYiclGqGVPGHDv7ELs5C-PwXBTmrgiGkRB5YqaSqwlj9Im9LdIRvy5iMBgCP9r01s8TBe/s320/11.png" width="320" /></a></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="font-weight: bold;">Master scheduling batch job</span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Finally we run the <span style="font-weight: bold;">Master scheduling batch job</span> (Master planning
> Periodic > Master scheduling) to calculate the <span style="font-weight: bold;">net requirements</span> of finished items.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
We can check the
results at Released products > Plan tab > Net requirements. There are two
planned orders of type master plan created.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Note: As a result of
these orders, and just like forecasting, there are no transactions
(InventTrans) created against the item.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr1bgbuz53vEZB_orOiO-Q2j3OcSnCk9tvGqgivjYsa03YItqiseToi2oB0oFy7JbHEhWWjpKHYBLAA5VKy0aezfOwWX-hezGYv7QgLA2fRI1lqyrzHUpgefyHwdSXjz2Z54lNSFgOOEk3/s1600/12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="190" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr1bgbuz53vEZB_orOiO-Q2j3OcSnCk9tvGqgivjYsa03YItqiseToi2oB0oFy7JbHEhWWjpKHYBLAA5VKy0aezfOwWX-hezGYv7QgLA2fRI1lqyrzHUpgefyHwdSXjz2Z54lNSFgOOEk3/s320/12.png" width="320" /></a></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="font-weight: bold;"><br /></span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="font-weight: bold;">Approved planned orders</span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Intermediate step
between unprocessed planned order and a firmed purchase order.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
A button on top to
Approve, changes status to "Approved", means we reviewed the planned
order and will firm it soon but not right away. Need some time to check
something else. What approving does is, it excludes these orders from getting
deleted or regenerated as master planning runs every night. If regeneration
happens, your items might get different quantities etc which can be confusing.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
You could also
Change status to "Completed", which means we reviewed the order, but
we dont want to firm it and can be deleted by the master planning batch.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="font-weight: bold;">Fulfil minimum</span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Released product
> Plan > Item coverage > General > Fulfil minimum</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Fulfil minimum
defines when your safety stock requirement date is.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
This has been a long post and maybe left more questions unanswered than answered. No doubt master planning subject is not covered much and can use few more posts. Maybe in future posts. </div>
</div>
Aman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.com5tag:blogger.com,1999:blog-1720352953703198635.post-8293407594404554062016-07-26T23:57:00.000+10:002016-07-26T23:57:37.289+10:00Demand forecasting<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
In the next two posts, we will cover demand forecasting and master planning at a basic
level.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Forecasting is a
long-term estimation, required to estimate and adjust future capacities of item
supply and work centers.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="font-weight: bold;">Forecast models</span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
First thing needed
in setting up forecasting is a <span style="font-weight: bold;">forecast model</span>
(Inventory management > Setup > Forecast > Forecast models). Forecast
models represent different planning scenarios. </div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="font-weight: bold;">Forecast plans</span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Forecast models
refer to <span style="font-weight: bold;">forecast plans </span>(Master planning
> Setup > Plans > Forecast plans).</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
You specify the
forecast model on a forecast plan. A Forecast plan is the basis for calculating
forecasts in forecast scheduling. You may include forecast plans in master
scheduling as well. It includes time fences and safety margin. More on time fences in next post.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
You may enter the
current forecast plan in the master planning parameters (Master planning>
Setup> Parameters). The current forecast plan is the default for displaying
forecast scheduling results.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Forecasting is based
on items but you can also use <span style="font-weight: bold;">item allocation
key</span>, if you do not enter forecasts per item number. Item allocation keys
are groups, containing a percentage for every item included in the key.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
You may specify item
allocation keys in the form Inventory management> Setup> Forecast>
Item allocation keys. After selecting or inserting an item allocation key, you
may push the button Lines to enter the item numbers that are assigned to the key
together with their percentage of the group total.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="font-weight: bold;">Demand forecast</span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Next you enter <span style="font-weight: bold;">Demand forecast</span>. Go to Released products >
Plan tab > Demand forecast.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
One option is to
manually insert lines. Select a forecast model, select the site and warehouse,
date, sales quantity and sales price. </div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Another option could
be to use demand forecasting calculated using the new functionality in AX R3.
With the R3 release of 2012, a new feature was added that allows your to have
the system create your statistical forecasts based on the history in the system
and then allow you to adjust the forecasts through Excel before automatically
uploading them back into the demand forecast tables.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<a href="https://dynamicsaxtipoftheday.com/2014/06/15/configuring-demand-forecasting/">https://dynamicsaxtipoftheday.com/2014/06/15/configuring-demand-forecasting/</a></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Yet another option could be to write custom logic to estimate forecasts from item's sales history. For example, daily sales data could be obtained by dividing sales qty sold by the no of days that item is sold. Daily sales figure can be multiplied by the no of days in the period we will order, say 1 week. Sales data can be obtained from Inventory transactions (InventTrans or SalesLines). And a batch job to run overnight and fill up your demand forecast table (ForecastSales). This needs some thinking.</div>
<br />
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
In our example, we will insert few lines manually. Create two lines with date separated by a week 1/8/2016 and
8/8/2016, quantities 10 and 6.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVoPNySUPb4-BpapegxC-f3tJVJLSWQvp2atq41Xa78kUndPQ6zxlBKKOYjnZtL_t0NuuX96Z_oMpZuGbFCg09_cvZ45RFWigU4d_A2WP2mXPOY5wlCsv6J7eB1MIo222TxqbVOZMr7uN4/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="219" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVoPNySUPb4-BpapegxC-f3tJVJLSWQvp2atq41Xa78kUndPQ6zxlBKKOYjnZtL_t0NuuX96Z_oMpZuGbFCg09_cvZ45RFWigU4d_A2WP2mXPOY5wlCsv6J7eB1MIo222TxqbVOZMr7uN4/s320/1.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<span style="font-weight: bold;">Forecast scheduling batch job</span></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Next you run <span style="font-weight: bold;">Forecast scheduling batch job</span> (Master planning
> Periodic > Forecast scheduling) to calculate the <span style="font-weight: bold;">gross requirements</span> of finished items. As a
result of forecast scheduling, Dynamics AX creates planned purchase/production
orders covering the gross requirements of forecasting. These planned orders
refer to the selected forecast plan.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Note: Since forecast
scheduling refers to a long-term estimation, it does not include the current
inventory as well as current sales and purchase orders in the calculation.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
We can check the
results at Released products > Plan tab > Gross requirements.</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Select the forecast
plan you used on top filter. Top grid shows the warehouse and the Coverage
group used. (More on coverage groups in the next post on Master planning)</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Lower grid shows the
lines from demand forecast and a planned order with required quantity against
those quantities. If you 'View details' on the planned order number, will open
the planned order created, with the demand forecast lines pegged against it. </div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Note: As a result of
these orders, there are no transactions (InventTrans) created against the item.
Also its not mandatory to run forecast scheduling batch job. You can directly
run master scheduling batch job that uses your demand forecast to create planned
orders. Difference is the orders would be shown under a different plan (filter
in planned orders list page).</div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7SWbFNFwIBvnzHZjn30FZyZcAKpk2l8phZ8iJqfrDLJXV0tDXwVja3EDP5-U7K3bwNdq7ywO8EXsChaTb2ql5tdUQdcq43JifGvf2cfLaYaLONWxvGTc9_BdDLrfLQ8-SXprnOcSERfFk/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="164" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7SWbFNFwIBvnzHZjn30FZyZcAKpk2l8phZ8iJqfrDLJXV0tDXwVja3EDP5-U7K3bwNdq7ywO8EXsChaTb2ql5tdUQdcq43JifGvf2cfLaYaLONWxvGTc9_BdDLrfLQ8-SXprnOcSERfFk/s320/2.png" width="320" /></a></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Next
post we will cover the basics of master planning.</div>
Aman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.com0tag:blogger.com,1999:blog-1720352953703198635.post-52265888425279323662016-07-20T11:21:00.000+10:002018-04-16T12:14:57.727+10:00AX retail pull jobs not uploading<div class="MsoNormal">
What to do when a pull job
is not uploading transactions. For ex, sales transactions from POS to AX head office.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
First thing to check is event
viewer for any errors. If you don’t see any errors, you can try below method.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
A bit of background first.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
AX retail push jobs use SQL
change tracking to push data from HO to store. But pull jobs use a different
way, a replication counter. Let’s see how it works for sales
transactions.<o:p></o:p><br />
<br />
In below example, RetailPOS is the store database.</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Table [RetailPOS].[ax].[RETAILTRANSACTIONSALESTRANS]
has a field called [REPLICATIONCOUNTERFROMORIGIN] that is an auto-incremented
number, every new transactions gets a new number.<o:p></o:p></div>
<div class="MsoNormal">
There is another table
[RetailPOS].[crt].[TABLEREPLICATIONLOG] that stores a list of all tables that
need to upload data. This table has a field FILTERMAX, which is a reference to
the above field RETAILTRANSACTIONSALESTRANS.REPLICATIONCOUNTERFROMORIGIN<o:p></o:p></div>
<div class="MsoNormal">
Field FILTERMAX is always
up-to-date to indicate the last transaction uploaded.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
That means any new
transactions created in store DB will get a value in
RETAILTRANSACTIONSALESTRANS.REPLICATIONCOUNTERFROMORIGIN greater than the one
currently set in FILTERMAX. Every time the pull job runs, it checks
REPLICATIONCOUNTERFROMORIGIN in all tables against the FILTERMAX value for
those tables and sees if there are any new transactions that need to be
uploaded, using the Async client service and sets the FILTERMAX values for the
tables to the last uploaded value.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
So one thing you could do is
to force the store database into thinking that the records haven’t been
uploaded to Async Server. If table [RetailPOS].[crt].[TABLEREPLICATIONLOG] was
cleared out it would "reset" the store database and it would re-upload all
records into a new RPF file. This should be OK since any duplicate
transactions would be ignored by AX.<br />
<br />
If you just want to resend one specific table data, you could filter for that table's records using TableName, say ax.RetailTransactionSalesTrans and set FILTERMIN and FILTERMAX to 0.<br />
If you run the P-job now, Async Client will package this table's entire history in a RPF file for upload.<br />
This could be helpful if you are not sure which records are missing from HO.<br />
<br />
But if you want to reset all of the store tables, follow these steps:</div>
<div class="MsoNormal">
1. Stop the AsyncClient in
the StoreDB machine<o:p></o:p></div>
<div class="MsoNormal">
2. Make a backup of the store
Database<o:p></o:p></div>
<div class="MsoNormal">
3. Delete the records in the TABLEREPLICATIONLOG table.</div>
<div class="MsoNormal">
4. Start the Async Client<o:p></o:p></div>
<div class="MsoNormal">
5. Run the P-job<span style="font-size: 12pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="color: green; font-family: "consolas"; font-size: 9.5pt;">/****** Script for SelectTopNRows command
from SSMS ******/</span><span style="font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">SELECT</span><span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: blue;">TOP</span> 1000 [ID]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[UPLOADSESSIONID]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[TABLENAME]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[FILTERFIELDNAME]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[FILTERMIN]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[FILTERMAX]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: blue;">FROM</span> [RetailPOS]<span style="color: grey;">.</span>[crt]<span style="color: grey;">.</span>[TABLEREPLICATIONLOG]<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXI9SSHma2qgT1T7T_lzOMVcnHmEywRo4H092fMLzmKadmO2c3MhH1Im_iJhAyQf6cuqr6Cgdv8MM8EcFRwCNIgUE28fqLqWyUPwX982kUZNUiLzbKuwtyolEora6w9uKt-rfeVX5vq_ON/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="113" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXI9SSHma2qgT1T7T_lzOMVcnHmEywRo4H092fMLzmKadmO2c3MhH1Im_iJhAyQf6cuqr6Cgdv8MM8EcFRwCNIgUE28fqLqWyUPwX982kUZNUiLzbKuwtyolEora6w9uKt-rfeVX5vq_ON/s320/1.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="color: green; font-family: "consolas"; font-size: 9.5pt;">/****** Script for SelectTopNRows command
from SSMS ******/</span><span style="font-family: "consolas"; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: "consolas"; font-size: 9.5pt;">SELECT</span><span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: blue;">TOP</span> 1000 [BARCODE]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[ITEMCORRECTEDLINE]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[ITEMID]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[PERIODICDISCGROUP]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[PERIODICDISCTYPE]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[PERIODICPERCENTAGEDISCOUNT]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[PRESCRIPTIONID]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[PRICE]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[PRICECHANGE]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[PURCHID]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[QTY]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[REPLICATIONCOUNTERFROMORIGIN]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[STORE]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[TAXAMOUNT]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[TAXGROUP]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[TRANSACTIONCODE]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[TRANSACTIONID]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[CREATEDDATETIME]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[MODIFIEDDATETIME]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[CREATEDTRANSACTIONID]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[MODIFIEDTRANSACTIONID]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[DATAAREAID]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: grey;">,</span>[ROWVERSION]<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 9.5pt;"> <span style="color: blue;">FROM</span> [RetailPOS]<span style="color: grey;">.</span>[ax]<span style="color: grey;">.</span>[RETAILTRANSACTIONSALESTRANS]<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdwHlPk9dLV8WE6E3Iw05qlU5WoiNPLkKw20yUA-pSAbMQ6jPy8qqQ05-fJbWqu-P6Z8LjbVTepSoR4dJDXD1zf3VYlsi1X2L8_90sfsc3SdMbvc6MqVe2OrZDFUZyyNHUSAO_zWdZnCqS/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="129" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdwHlPk9dLV8WE6E3Iw05qlU5WoiNPLkKw20yUA-pSAbMQ6jPy8qqQ05-fJbWqu-P6Z8LjbVTepSoR4dJDXD1zf3VYlsi1X2L8_90sfsc3SdMbvc6MqVe2OrZDFUZyyNHUSAO_zWdZnCqS/s320/2.png" width="320" /></a></div>
<div class="MsoNormal">
<br /></div>
<br />
<div class="MsoNormal">
<br /></div>
Aman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.com0tag:blogger.com,1999:blog-1720352953703198635.post-30124169171667954432016-07-14T09:58:00.001+10:002016-07-27T16:44:15.964+10:00Open pure SSRS based reports in AX clientNormally you would create SSRS reports in AX using the inbuilt reporting frameworks, for example the report data provider (RDP) framework.<br />
<a href="https://technet.microsoft.com/en-us/library/ee873263.aspx">https://technet.microsoft.com/en-us/library/ee873263.aspx</a><br />
<br />
But in case you have pure SSRS based reports, created and hosted outside of AX and you want someway to integrate them in AX, there is no "out of the box" way around. But its not that difficult. What we can do is host the SSRS report's URL inside a web control in AX, as a SSRS report is essentially just a URL.<br />
<br />
To begin with you need to determine your SSRS reports URL links. Some information on that.<br />
<a href="https://msdn.microsoft.com/en-us/library/dd255286.aspx">https://msdn.microsoft.com/en-us/library/dd255286.aspx</a><br />
<br />
The report URL is essentially made up of two parts.<br />
1. The link to the SSRS report server where all reports are hosted.<br />
For example, "http://abcServer/ReportServer"<br />
<br />
So you could create a parameter say abcServerURL (table SRSServers) in System administration, report servers form to store this bit as it would be same for all your SSRS reports. Please note the SRSServers table is global, same value across all partitions and companies. If you dont want to have same value for all partitions you would want to store this value in a different table. If you have multiple partitions, multiple companies on the same AOS cluster, this property would be shared, which means same reports would be made available to all the users. Your BI consultant should implement a security layer to map the user ids with the exact partition/company data they should be exposed to. Otherwise you would expose other companies data to a user!<br />
<br />
2. The part of the URL string that points to the exact report<br />
For example, "/Pages/ReportViewer.aspx?%2fReports%2f+Sales+Report&rs:Command=Render"<br />
We would create one form for each report and 'hardcode' this second bit of the URL inside each form.<br />
<br />
Thus, the complete URL will be a concatenation of the two parts<br />
"http://abcServer/ReportServer/Pages/ReportViewer.aspx?%2fReports%2f+Sales+Report&rs:Command=Render"<br />
<br />
So you might have 10 reports, all the 10 reports will have the same first part but a different second part, pointing to the exact report.<br />
<br />
Next you need to design the form that hosts the web control. Create a form for each report. In design, add a managedHost control.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgP1uxbL8C6J9110h0yV83AGh7ndGd_Sem926n4gHMBo2Eybf4WC4Xh6oGp-ugE3CQUfc2x2-pvB3YPPsAsWpcxKmWGnwq_TQ9Oe9PT_mh4PlWki_UX_hayMj30fk_YyyFmwFAkzuiUYgel/s1600/1.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="284" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgP1uxbL8C6J9110h0yV83AGh7ndGd_Sem926n4gHMBo2Eybf4WC4Xh6oGp-ugE3CQUfc2x2-pvB3YPPsAsWpcxKmWGnwq_TQ9Oe9PT_mh4PlWki_UX_hayMj30fk_YyyFmwFAkzuiUYgel/s320/1.PNG" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhO2IbFQQhy0o7QaiRWgOTU_Zblqw1y3NQOx0FxWqcCFrmYDnyUcQ9DW6hjsODxHlUsGVayQIVg2AfhsdhNoefF5NKIePVI0ClrZQnJV4rsBY8Oo0xy7DyWCcL_wb_b-YbaC5aADVrbzH-E/s1600/2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="118" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhO2IbFQQhy0o7QaiRWgOTU_Zblqw1y3NQOx0FxWqcCFrmYDnyUcQ9DW6hjsODxHlUsGVayQIVg2AfhsdhNoefF5NKIePVI0ClrZQnJV4rsBY8Oo0xy7DyWCcL_wb_b-YbaC5aADVrbzH-E/s320/2.PNG" width="320" /></a></div>
<br />
Finally in the init method of the form, we will "create" the URL and launch it.<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: "arial"; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> public void init()
{
System.Windows.Forms.WebBrowser ssrsBrowser;
SRSServers sRSServers;
str url;
super();
select firstonly abcServerURL from sRSServers;
if (!sRSServers.abcServerURL)
throw error ("Report server URL not setup");
url = sRSServers.abcServerURL + "/Pages/ReportViewer.aspx?%2fReports%2fSales+Report&rs:Command=Render";
ssrsBrowser= managedhost.control();
ssrsBrowser.Navigate(url);
}
</code></pre>
<br />
Thats it. You have successfully managed to get pure SSRS power inside your AX. Cheers.
Aman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.com0tag:blogger.com,1999:blog-1720352953703198635.post-19726156982514201992016-06-09T12:37:00.000+10:002016-06-27T09:17:30.573+10:00Adding custom filter on a list pageImagine you want a filter on a list page say planned orders list page. Filter works on the order date and shows order due today or all. It has two values in the selection Today/All. Its not that straightforward as it may seem as it is a list page. On a normal AX form, its much easier.<br />
<br />
A number of steps required to achieve this.<br />
<br />
1. Add the custom filter to the list page. Note the filterExpression, its a call to method we create in next step. Also you need an enum and an EDT based off the enum, EDT is selected in the properties as well.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgs7qgsroCyyUjRoEnkinTgsaAGcI6y0tMcMn24GRaHacP6eddhHC5ckiWMmJRJXtHc99rawwMQfqf769YOtNwqdjdrwRjL1O6sdbFHDsV_YGxoI5KjdhKEwkTyVpA6SbP3LsiXSEo8OTB7/s1600/Listpage.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="176" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgs7qgsroCyyUjRoEnkinTgsaAGcI6y0tMcMn24GRaHacP6eddhHC5ckiWMmJRJXtHc99rawwMQfqf769YOtNwqdjdrwRjL1O6sdbFHDsV_YGxoI5KjdhKEwkTyVpA6SbP3LsiXSEo8OTB7/s320/Listpage.PNG" width="320" /></a></div>
<br />
<br />
<br />
2. SysQueryRangeUtil<br />
Add a method to the SysQueryRangeUtil.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJUjZ_6mNCn9po3hgHn9Z50z7CNJx_5DAwi605j9QVJfJZMGIeaqzVGm_l-TtNTP3DlPeFI7bhlHSBHvJeuXK_yu8nZ6UagMwXTDY3_MbuilAMj1aZDgpDW_KLQDQutjX6OyKoN0XSccom/s1600/2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="111" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJUjZ_6mNCn9po3hgHn9Z50z7CNJx_5DAwi605j9QVJfJZMGIeaqzVGm_l-TtNTP3DlPeFI7bhlHSBHvJeuXK_yu8nZ6UagMwXTDY3_MbuilAMj1aZDgpDW_KLQDQutjX6OyKoN0XSccom/s320/2.PNG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
3. Interaction class</div>
<div class="separator" style="clear: both; text-align: left;">
List pages use the interaction classes for logic. We need to customize 2 methods in the ReqTransPOListPageInteraction.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
In method initializing, after super(), add this</div>
<pre style="background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: "arial"; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> customFilter = SysEPCustomFilter::construct(formStr(ReqTransPOListPage));
customFilter.load();
customFilter.setInitialFilterControlValue(formControlStr(ReqTransPOListPage, yourFilter), 0);
</code></pre>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both;">
Note: customFilter.load() will reload the last saved selection in your filter. In case, you want a specific enum selection everytime, comment out this line.</div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
In method initializeQuery, before super(), add this</div>
<div class="separator" style="clear: both;">
Note the call to method in SysQueryRangeUtil</div>
<pre style="background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: "arial"; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> if (this.listPage().listPageArgs().parameters())
{
reqPOFilterEnum = customFilter.getFilterControlValue(formControlStr(ReqTransPOListPage, yourFilter));
SysQuery::findOrCreateRange(_query.dataSourceTable(tableNum(ReqPO)), fieldNum(ReqPO, ReqDateOrder)).value(SysQueryRangeUtil::xxxReqPOFilter(reqPOFilterEnum));
}
</code></pre>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
4. Your list page </div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwfYV-AfZ4AqMPF9AHJJ3CHZU_wpOwTc7BCS3T1XU5oo657NBndffetXLJPK7zJNuTw_vAfvLLFyhE_K3QufilTlT7W8wLMF0IVOOqK1RMzTHdRYtsRzkhQLHEntlrfm1_0jHU7hjcZvAq/s1600/3.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="135" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwfYV-AfZ4AqMPF9AHJJ3CHZU_wpOwTc7BCS3T1XU5oo657NBndffetXLJPK7zJNuTw_vAfvLLFyhE_K3QufilTlT7W8wLMF0IVOOqK1RMzTHdRYtsRzkhQLHEntlrfm1_0jHU7hjcZvAq/s320/3.PNG" width="320" /></a></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
That's it. Cheers</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<br />
<br />Aman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.com0tag:blogger.com,1999:blog-1720352953703198635.post-73133131559228322222016-05-08T22:46:00.001+10:002016-05-08T22:46:40.969+10:00Multi-threaded batch job template<div class="MsoNormal">
Batch jobs in AX are important concepts, required for
processing different business logic, filling up tables for reports etc<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Multi-threaded batch jobs are an advanced usage of the batch jobs functionality, which can handle
even more heavy duty tasks due to parallel processing capability.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Since these jobs have been becoming common place, I thought
to create a template to make my life easier.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
It’s a project with few objects.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgblPhnuEBJxlsa3I0PIPTEd1SKSbuCgNCGPwkEGdDweeWSWblpgY6OL9ofh8CdSWJXMP7d7NOemSzU2dXfCOgXBUar6pAGOKKVR3vIpfiaZ0fQtyYx40LIadhBhPfjDVJ7_SaxLAqeSId_/s1600/Project.PNG" imageanchor="1"><img border="0" height="207" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgblPhnuEBJxlsa3I0PIPTEd1SKSbuCgNCGPwkEGdDweeWSWblpgY6OL9ofh8CdSWJXMP7d7NOemSzU2dXfCOgXBUar6pAGOKKVR3vIpfiaZ0fQtyYx40LIadhBhPfjDVJ7_SaxLAqeSId_/s320/Project.PNG" width="320" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
Few pointers:</div>
<div class="MsoNormal" style="margin-left: 18.0pt;">
</div>
<ol>
<li>Objects have prefix Template,
which I replace with the feature I want the batch job for.</li>
<li>"TemplateService" class, "createTasks" method is where the magic happens. This methods spins off a fixed
number of threads depending on server thread setting, usually 8. It divides the
workload in these 8 threads and makes a list of SysOperationServiceController
objects. These objects are basically call to the “run” method of the class,
which has the main business logic. For example, you want to process records in
CustTable. If you have 32 customers, you will get 8 threads working on a set
of (32/8) 4 customers each. This is not the best usage scenario for multi-threading but think 32000 customers, meaning each thread handles 4000 customers in parallel. Your job would finish in roughly 1/8th the time required to finish a single threaded batch job. A less common way to do multi-threading, would be to spin as many threads as required. For example if we want to iterate through all the customers and do some logic for each, we could spin 32 threads. Will try to modify this template to suit that requirement.</li>
<li>Another nice logic is in method “AddrunTimeTaskList”
in class “ANSysOperationServiceBase”. This class extends SysOperationServiceBase,
to enable adding dependent task to a list of parallel tasks. Please see my
previous blog <a href="http://amannain.blogspot.com.au/2014/04/multi-threading-dependent-tasks-in.html" target="_blank">here </a>for more info on this. My template project shows how to use
this class and add a dependent method to a list of tasks.</li>
<li>There are “runInitialTask” and “runFinalTask”
methods which can be used to call tasks before and after your parallel list of
tasks. </li>
<li>I use paging in query to divide
the workload. This requires your AOT query to have its order by node set.<span style="text-indent: -18pt;"> </span></li>
</ol>
<div style="text-indent: -24px;">
Please email me for xpo. Cheers.</div>
<div style="text-indent: -24px;">
<br /></div>
<div style="text-indent: -24px;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr3f2BAdOSG8MPBhP5wwxWWDqulijH1KsyetiyMo2b19aoJRrhTUSN-eazQVbFas8sq86g5rpZKRc4Zn_PVTvMQDKa2L1RkR0Uc54cSw83GoDBi_rVI3Gf3lLhmIElJqEDQpFRYw5TT8Pn/s1600/Service.PNG" imageanchor="1"><img border="0" height="168" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr3f2BAdOSG8MPBhP5wwxWWDqulijH1KsyetiyMo2b19aoJRrhTUSN-eazQVbFas8sq86g5rpZKRc4Zn_PVTvMQDKa2L1RkR0Uc54cSw83GoDBi_rVI3Gf3lLhmIElJqEDQpFRYw5TT8Pn/s320/Service.PNG" width="320" /></a></div>
<div style="text-indent: -24px;">
<br /></div>
<div style="text-indent: -24px;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhW3XmcZvkRsBuh-xFOmczYiro_dm_hrKw_f-t7P7ngxJ9Jrcjrwdr3NHzWZ0x_KuP_ITkBXDyt5QhbnZo2tOOb8hy-hSJYLhNENn6d3I92tDkkYsN7oyJEA80BctkfbokH19jndyYxs1LY/s1600/run.PNG" imageanchor="1"><img border="0" height="172" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhW3XmcZvkRsBuh-xFOmczYiro_dm_hrKw_f-t7P7ngxJ9Jrcjrwdr3NHzWZ0x_KuP_ITkBXDyt5QhbnZo2tOOb8hy-hSJYLhNENn6d3I92tDkkYsN7oyJEA80BctkfbokH19jndyYxs1LY/s320/run.PNG" width="320" /></a></div>
<div style="text-indent: -24px;">
<br /></div>
<div style="text-indent: -24px;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuVMCyn2T_jG4O_cFaW2_l2UoqXRiRl5nJawyGXGTcBPqNz9iCnGzwoJ2eJXU6SMT-rxV_ohNkzqlVXNXaGKeDICk9Kpv-STj4qOttWrUELknfFeL_3Te-gbbe_dabeRbqsrpxc7YIkDFc/s1600/batch1.PNG" imageanchor="1"><img border="0" height="192" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuVMCyn2T_jG4O_cFaW2_l2UoqXRiRl5nJawyGXGTcBPqNz9iCnGzwoJ2eJXU6SMT-rxV_ohNkzqlVXNXaGKeDICk9Kpv-STj4qOttWrUELknfFeL_3Te-gbbe_dabeRbqsrpxc7YIkDFc/s320/batch1.PNG" width="320" /></a></div>
<div style="text-indent: -24px;">
<br /></div>
<div style="text-indent: -24px;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2ywVouae9LVKYc9JyhAkHKZwnp4sKfSvJkomUx5HCDtEBk79yRhb7KBZk4vQthKEJSfRG_2YucloY-BcFDlSuiekpcWlCAwmeGVm6tZQdJCuohqiKfgu6to70tOEUFQDqOolGEC9Osc4v/s1600/info.PNG" imageanchor="1"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2ywVouae9LVKYc9JyhAkHKZwnp4sKfSvJkomUx5HCDtEBk79yRhb7KBZk4vQthKEJSfRG_2YucloY-BcFDlSuiekpcWlCAwmeGVm6tZQdJCuohqiKfgu6to70tOEUFQDqOolGEC9Osc4v/s320/info.PNG" width="259" /></a></div>
<o:p></o:p><br />
<div class="MsoNormal" style="margin-left: 18.0pt;">
<o:p></o:p></div>
Aman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.com1tag:blogger.com,1999:blog-1720352953703198635.post-87181864637809464362015-07-15T10:16:00.000+10:002015-07-15T10:16:39.172+10:00AX crash analysisI hope noone ever needs to use this. But in case your AOS is crashing, there is a nifty little windows debugging tool called adplus that collects crash dump files, which can then be analyzed through Dynamics Lifecycle Services crash analysis option.<br />
<br />
Basically you attach Adplus to AX32Serv.exe , run the job/process that causes the crash, and wait for AOS to crash. As and when AOS crashes, the tool dumps system stats to a file (*.dmp). Previously we were required to send the file to Microsoft support for them to analyse but now the tool is available to us. Just upload the file on Lifecycle services which will generate a report that might point to the real cause behind the crash.<br />
<br />
http://blogs.msdn.com/b/axsupport/archive/2010/11/29/how-to-use-adplus-for-aos-crashes.aspx<br />
http://blogs.msdn.com/b/axsupport/archive/2015/03/23/crash-and-hang-analysis-on-lcs.aspxAman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.com2tag:blogger.com,1999:blog-1720352953703198635.post-22518368813351513092015-05-25T21:44:00.001+10:002016-07-26T23:58:12.609+10:00Inventory valuation methods<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;">Different inventory costing/valuation methods in AX especially how sales cost is calculated and adjusted after an inventory close in different methods. </span></div>
<div class="MsoNormal">
<b><span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;"><br /></span></b></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><b><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;">Inventory Model Groups</span></b><b><span style="font-family: "arial" , "sans-serif"; font-size: 12.0pt;"><o:p></o:p></span></b></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><i><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;">(Inventory
management> Setup> Inventory> Inventory model groups</span></i><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;">)<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Inventory
model groups include settings for the valuation method and for item handling.
They are important for inventory valuation and ledger integration.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Selecting
an inventory model (FIFO, LIFO, average or standard cost) on the tab <i>Inventory
model</i>, you specify the inventory valuation method, which is the way
Dynamics AX links issue transactions to receipt transactions in terms of
valuation.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">If you
change the <i>Inventory model </i>or <i>Ledger integration </i>settings on the
tab <i>Setup </i>of an inventory model group after posting item transactions,
reconciliation of inventory and finance may become very difficult.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><b><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;">Inventory Valuation</span></b><b><span style="font-family: "arial" , "sans-serif"; font-size: 14.0pt;"><o:p></o:p></span></b></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">The
basis of inventory valuation is a simple principle:<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Receipt
costs - cost amounts are provided by the receipt transaction<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Issue
costs - cost amounts are calculated according to the valuation model<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<u><span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">The cost
amount of the issue transaction derives from the receipt transactions, which
refer to the issue according to the valuation model (FIFO, LIFO, average). It
is not possible to enter the cost price and cost amount in an issue
transaction, therefore.<o:p></o:p></span></u></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Exceptions
to this rule are moving average valuation (for issue transactions keeping the
average cost price shown at the time of posting) and the standard cost price
valuation, for which Dynamics AX provides two different options:<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">– Fixed
receipt price (This is a checkbox on the Item model group form)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">–
Standard cost (This is seen in the Inventory model dropdown)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">The
option “Fixed receipt price” is available/enabled for valuation
methods FIFO, LIFO and weighted average cost. Applying this option fixes the receipt
cost price in advance, preventing to change it when recording a transaction.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">“Standard
cost” provides true standard costs, applying the standard cost price of an item
for all issue and receipt transaction. The difference between the methods
“Standard cost” and “Fixed receipt price” shows, when changing the standard
cost price of an item. Whereas the standard cost method immediately posts an
adjustment of inventory value, the fixed receipt price method does not directly
post a difference. In this method, the new price only applies to new receipts –
existing inventory will issue to the old price until it is consumed completely.
As a prerequisite for applying the standard cost method, the multisite
functionality needs to be active in the company account concerned.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><b><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;">Valuation Method</span></b><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;"><o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Dynamics AX provides following valuation methods – available
in the field <i>Inventory model </i>of the inventory model group – to calculate
the cost amount of issue transactions:<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpFirst" style="mso-layout-grid-align: none; mso-list: l0 level1 lfo2; text-autospace: none; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "palatinolinotype" , "sans-serif"; font-size: 10.0pt;">–<span style="font-stretch: normal;">
</span></span><!--[endif]--><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;">FIFO<o:p></o:p></span></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-layout-grid-align: none; mso-list: l0 level1 lfo2; text-autospace: none; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "palatinolinotype" , "sans-serif"; font-size: 10.0pt;">–<span style="font-stretch: normal;">
</span></span><!--[endif]--><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;">LIFO<o:p></o:p></span></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-layout-grid-align: none; mso-list: l0 level1 lfo2; text-autospace: none; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "palatinolinotype" , "sans-serif"; font-size: 10.0pt;">–<span style="font-stretch: normal;">
</span></span><!--[endif]--><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;">LIFO date<o:p></o:p></span></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-layout-grid-align: none; mso-list: l0 level1 lfo2; text-autospace: none; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "palatinolinotype" , "sans-serif"; font-size: 10.0pt;">–<span style="font-stretch: normal;">
</span></span><!--[endif]--><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;">Weighted average<o:p></o:p></span></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-layout-grid-align: none; mso-list: l0 level1 lfo2; text-autospace: none; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "palatinolinotype" , "sans-serif"; font-size: 10.0pt;">–<span style="font-stretch: normal;">
</span></span><!--[endif]--><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;">Weighted average date<o:p></o:p></span></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-layout-grid-align: none; mso-list: l0 level1 lfo2; text-autospace: none; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "palatinolinotype" , "sans-serif"; font-size: 10.0pt;">–<span style="font-stretch: normal;">
</span></span><!--[endif]--><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;">Standard cost<o:p></o:p></span></span></div>
<div class="MsoListParagraphCxSpLast" style="mso-layout-grid-align: none; mso-list: l0 level1 lfo2; text-autospace: none; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "palatinolinotype" , "sans-serif"; font-size: 10.0pt;">–<span style="font-stretch: normal;">
</span></span><!--[endif]--><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;"><u>Moving average (I have used this for AX Retail)</u><o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<b><span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Valuation of
Item receipts<o:p></o:p></span></b></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Receipt transactions get their financial value when you post
the related financial transaction (invoice). Except for the standard cost
method, the different transaction types therefore provide the receipt cost
price and amount as follows:<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">– Purchase order
receipts<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Amount of the invoice line<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">– Sales item return<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;"><u>Original value of the returned item; return cost price
entered in the return/sales order line, if not assigned to an original sales
order</u><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">– Other receipts<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Cost amount entered in the journal line<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><b><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;">Valuation of
Item issues</span></b><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;"><o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">The cost price and amount of item issues always complies
with the average cost price when posting the transaction. The valuation method
applies when closing the inventory determining the assignment of item receipts
to item issues according to the inventory model (FIFO, LIFO or average). <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Inventory closing calculates the cost price and amount of an
issue transaction based on assigned receipts. The issue price and amount
therefore is not final until you have posted the financial transaction
(invoice) of all assigned receipts and inventory closing is finished. <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">As an exception, individual assignment of issue transactions
to receipt transactions does not apply to following valuation methods:<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoListParagraph" style="mso-layout-grid-align: none; mso-list: l2 level1 lfo1; text-autospace: none; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "palatinolinotype" , "sans-serif"; font-size: 10.0pt;">-<span style="font-stretch: normal;">
</span></span><!--[endif]--><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;">Standard cost price – This method
(standard cost or fixed price) immediately applies to issue and receipt
transactions.<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoListParagraph" style="mso-layout-grid-align: none; mso-list: l2 level1 lfo1; text-autospace: none; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "palatinolinotype" , "sans-serif"; font-size: 10.0pt;">-<span style="font-stretch: normal;">
</span></span><!--[endif]--><u><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;">Moving average
– Keeps the posted cost price of issue transactions <b>and does not require
inventory closing</b>.<o:p></o:p></span></u></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><b><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;">Standard cost price</span></b><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;"><o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">For
items of the inventory model “Standard cost”, inventory closing is not required
because all receipts and issues immediately post the standard cost price
available in the item price form.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">When
activating a new standard cost price, Dynamics AX immediately applies an
adjustment of inventory value for the current stock, which posts in inventory
and in the general ledger. The new standard cost price therefore may apply to
issues of that stock right away.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<b><span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Fixed receipt price<o:p></o:p></span></b></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">The
checkbox “Fixed receipt price” in the inventory model group applies in combination
with the valuation methods FIFO, LIFO or average cost. <u>When selecting this
option, the cost price entered in the released products form or the item price
form specifies a fixed cost price for receipt transactions.</u><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-size: 13.3333px;">The cost price and cost amount calculates according to the valuation method and therefore always complies with the standard cost price of the item, as long as you do not change the item cost price.</span></span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-size: 13.3333px;"><br /></span></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-size: 13.3333px;">When you change the item cost price, consumption of existing stock in inventory will comply with the old cost price calculating the cost amount of issue transactions according to the valuation method. Therefore, inventory closing is also required for the option “Fixed receipt price”.</span></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<b><span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Moving average price <o:p></o:p></span></b></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">For
items of the inventory model “Moving average”, receipt transactions are posted
with the price provided by the transaction (vendor invoice). <u>When posting an
issue transaction, the average cost price at the time of posting applies. This
cost price does not change through inventory closing.</u><b><o:p></o:p></b></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">If a
vendor invoice refers to a purchase receipt, which is not completely on stock
any more, for the quantity not on stock, a difference between the physical cost
amount and the financial cost amount of the purchase transaction is posted as
an adjustment to a price difference account. For the quantity still on stock,
posting the purchase invoice posts the total amount – including possible
differences – to the financial cost amount.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Following
table shows an overview of the different valuation methods available in
Dynamics AX:<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><b><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;">Inventory
models controlling the valuation methods in Dynamics AX</span></b><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;"><o:p></o:p></span></span></div>
<div class="MsoListParagraph" style="mso-layout-grid-align: none; mso-list: l1 level1 lfo3; text-autospace: none; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "symbol"; font-size: 10.0pt;">·<span style="font-stretch: normal;">
</span></span><!--[endif]--><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;">FIFO (First In First Out) - Item
issues refer to the oldest item receipt still on stock<b><o:p></o:p></b></span></span></div>
<div class="MsoNormal" style="mso-layout-grid-align: none; text-autospace: none; text-indent: 72.0pt;">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoListParagraph" style="mso-layout-grid-align: none; mso-list: l1 level1 lfo3; text-autospace: none; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "symbol"; font-size: 10.0pt;">·<span style="font-stretch: normal;">
</span></span><!--[endif]--><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;">LIFO (Last In First Out) - Item
issues refer to the newest item receipt on stock that is available when closing
inventory<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoListParagraph" style="mso-layout-grid-align: none; mso-list: l1 level1 lfo3; text-autospace: none; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "symbol"; font-size: 10.0pt;">·<span style="font-stretch: normal;">
</span></span><!--[endif]--><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;">LIFO date - Like LIFO, limiting the assignment of issues to receipts
before the particular issue<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoListParagraph" style="mso-layout-grid-align: none; mso-list: l1 level1 lfo3; text-autospace: none; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "symbol"; font-size: 10.0pt;">·<span style="font-stretch: normal;">
</span></span><!--[endif]--><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;">Standard cost - The cost price of item issues and receipts is equal to
the active standard cost price of the item<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoListParagraph" style="mso-layout-grid-align: none; mso-list: l1 level1 lfo3; text-autospace: none; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "symbol"; font-size: 10.0pt;">·<span style="font-stretch: normal;">
</span></span><!--[endif]--><u><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;">Weighted average - The cost price of
item issues in a period is the average cost price of all receipts (including
the beginning balance) in this period (inventory closing period) <o:p></o:p></span></u></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoListParagraph" style="mso-layout-grid-align: none; mso-list: l1 level1 lfo3; text-autospace: none; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "symbol"; font-size: 10.0pt;">·<span style="font-stretch: normal;">
</span></span><!--[endif]--><u><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;">Weighted average date – The cost price
of item issues is the average cost price calculated separately for each day.<o:p></o:p></span></u></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoListParagraph" style="mso-layout-grid-align: none; mso-list: l1 level1 lfo3; text-autospace: none; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "symbol"; font-size: 10.0pt;">·<span style="font-stretch: normal;">
</span></span><!--[endif]--><u><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;">Moving average - The cost price of item
issues is the average cost price of the inventory quantity at the time of
posting the issue.<o:p></o:p></span></u></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Below example shows cost price calculation for the different valuation
methods. Three receipt transactions with different cost prices and an issue
transaction in between.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<b><span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Posted
transactions for comparing valuation methods<o:p></o:p></span></b></div>
<div class="MsoNormal">
<b><span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Date Transaction Quantity Cost amount<o:p></o:p></span></b></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">July 1 Receipt 10 100<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">July 2 Receipt 10 200<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">July 3 Issue 10 (to
be calculated)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">July 4 Receipt 10 300<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">After
inventory closing, the cost amount of the issue shows following figure
depending on the valuation method:<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<b><span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Valuation
of the item issue <o:p></o:p></span></b></div>
<div class="MsoNormal">
<b><span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Model Amount Explanation<o:p></o:p></span></b></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">FIFO 100 From receipt on
July 1<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">LIFO 300 From receipt on
July 4<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">LIFO
date 200 From receipt on
July 2<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Weighted
average 200 Average of all
receipts<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Weighted
average date 150 From receipt on
July 1 and July 2<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Moving
average 150 Current average
when posting the issue<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<b><span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Inventory Closing and Adjustment<o:p></o:p></span></b></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">When you
post an issue transaction, Dynamics AX always applies the average cost price
(except for the standard cost model). In order to calculate the correct cost
price and amount according to the valuation method (<i>Inventory model</i>) of
the item, you need to close inventory. <u>Only items assigned to inventory model “Standard
cost”, or “Moving average” do not apply inventory closing.</u><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">You need
to close inventory periodically – usually as part of the month closing
procedure in finance – in order to show correct item costs in finance and to
close inventory transactions. After closing inventory, it is not possible to
post inventory transactions in the closed period any more.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<b><span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Need for inventory closing<o:p></o:p></span></b></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;"><u>The main
task of an inventory closing is to calculate the actual cost price of an
inventory issue.</u> At the time of inventory issue posting, system does not
calculate an exact issue cost price according to the inventory model. Instead,
system uses some estimated value for the issue cost price, which looks like a
good approximation for the actual cost price. Then, during the inventory
closing, the actual issue cost price is calculated with respect to inventory
model settings. After that, system calculates the difference between the
initial (estimated) issue cost price and the true issue cost price, then system
writes this down into inventory transactions and inventory adjustments. Then GL
postings for these adjustments are created. Why this approach has been chosen?
In general, during posting of an initial inventory issue, system might not have
all information required to calculate the true cost price. For example, if
negative inventory is turned on, we can post issues before corresponding
receipts; In the Weighted Average model, it is impossible to calculate an issue
cost price before all the receipts for a period has been posted; For FIFO/LIFO
models, the receipts might be posted out of chronological order and so on.</span> </span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<b><span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Changing an inventory model<o:p></o:p></span></b></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">As long
as there are no open transactions for an item, we can change its model group.
Changing model group to Standard cost however, is not straightforward and requires
a conversion tool to be run.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><b><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;">Inventory recalculation</span></b><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;"><o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;"><u>Recalculates
the inventory as of a given date without closing the inventory.</u> This process
matches inventory receipts and issues for the transactions that are not
financially matched through inventory dimensions in order to determine the real
value of the on-hand inventory. Unlike inventory close, it does not settle
issues or close transactions. Inventory recalculation can be performed on a
subset of inventory items whereas Inventory close must be performed on all
inventory items. It is not as accurate as an inventory close and should not be
relied on to replace inventory close.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-family: "arial" , "sans-serif"; font-size: 10.0pt;">This
process is batchable, with options to select items. There is no from date
option only an upto date and option to select period. But as the volume of data
grows it’s going to get slow.</span> </span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<b><span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">Past inventory
report<o:p></o:p></span></b></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 10.0pt;">If you
want to know the physical inventory on a date in the past, you may select a
report in the menu path <i>Inventory management> Reports> Status>
Physical inventory</i>. <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<b><span style="font-family: "arial" , "helvetica" , sans-serif;">Examples</span></b><br />
<b><span style="font-family: "arial" , "helvetica" , sans-serif;">In this case, purchase and sales data is imported via external files and processed date wise. Effects on Financial cost amounts, on hand inventory and cost price is noted.</span></b></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoListParagraph" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: "arial" , "helvetica" , sans-serif;"><span lang="EN-US">1.<span style="font-stretch: normal;"> </span></span><!--[endif]--><span lang="EN-US">Initial purchase file imported;<o:p></o:p></span></span></div>
<div class="MsoListParagraph" style="margin-left: 72.0pt; mso-list: l0 level2 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: "arial" , "helvetica" , sans-serif;"><span lang="EN-US">a.<span style="font-stretch: normal;">
</span></span><!--[endif]--><span lang="EN-US">19/12/2014
Purchase for a product; Qty = 7; total purchase $ = 17.50 ($2.50 each)<o:p></o:p></span></span></div>
<div class="MsoListParagraph" style="margin-left: 72.0pt; mso-list: l0 level2 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: "arial" , "helvetica" , sans-serif;"><span lang="EN-US">b.<span style="font-stretch: normal;">
</span></span><!--[endif]--><span lang="EN-US">On
hand inventory updated = 7; Financial cost amount = $17.50; Cost Price =
2.50<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoListParagraph" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: "arial" , "helvetica" , sans-serif;"><span lang="EN-US">2.<span style="font-stretch: normal;"> </span></span><!--[endif]--><span lang="EN-US">Next purchase file imported:<o:p></o:p></span></span></div>
<div class="MsoListParagraph" style="margin-left: 72.0pt; mso-list: l0 level2 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: "arial" , "helvetica" , sans-serif;"><span lang="EN-US">a.<span style="font-stretch: normal;">
</span></span><!--[endif]--><span lang="EN-US">29/12/2014
Purchase for a product; Qty = 5; total purchase $ = 11.50 ($2.30 each)<o:p></o:p></span></span></div>
<div class="MsoListParagraph" style="margin-left: 72.0pt; mso-list: l0 level2 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: "arial" , "helvetica" , sans-serif;"><span lang="EN-US">b.<span style="font-stretch: normal;">
</span></span><!--[endif]--><span lang="EN-US">On
hand inventory updated = 12; Financial cost amount = $29; Cost Price = 2.42<o:p></o:p></span></span></div>
<div class="MsoListParagraph" style="margin-left: 72.0pt;">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoListParagraph" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: "arial" , "helvetica" , sans-serif;"><span lang="EN-US">3.<span style="font-stretch: normal;"> </span></span><!--[endif]--><span lang="EN-US">Sales File imported with sale qty of 1 both for 20/12/2014 and 30/12/2014.<o:p></o:p></span></span></div>
<div class="MsoListParagraph" style="margin-left: 72.0pt; mso-list: l0 level2 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><span style="font-family: "arial" , "helvetica" , sans-serif;"><span lang="EN-US">a.<span style="font-stretch: normal;">
</span></span><!--[endif]--><span lang="EN-US">On
hand inventory updated = 10; Financial cost amount & Cost Price in different cases as below<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;">Moving average</span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div align="center">
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-table-layout-alt: fixed; mso-yfti-tbllook: 1184; width: 509px;">
<tbody>
<tr style="height: 18.05pt; mso-yfti-firstrow: yes; mso-yfti-irow: 0;">
<td style="border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 70.9pt;" valign="top" width="95"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Sale/Purch<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 1.0cm;" valign="top" width="38"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Qty<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 40.15pt;" valign="top" width="54"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Date<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Each cost<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 43.7pt;" valign="top" width="58"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Total
cost<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 73.6pt;" valign="top" width="98"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">NewFinancial
Cost Amt<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 54.8pt;" valign="top" width="73"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Resulting stock<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 35.45pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Cost
Price<o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 8.55pt; mso-yfti-irow: 1;">
<td style="border-top: none; border: solid windowtext 1.0pt; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 70.9pt;" valign="top" width="95"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Purchase<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 1.0cm;" valign="top" width="38"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">7<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 40.15pt;" valign="top" width="54"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">19/01<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 43.7pt;" valign="top" width="58"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">17.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 73.6pt;" valign="top" width="98"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">17.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 54.8pt;" valign="top" width="73"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">7<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 35.45pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.50<o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 8.55pt; mso-yfti-irow: 2;">
<td style="border-top: none; border: solid windowtext 1.0pt; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 70.9pt;" valign="top" width="95"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Purchase<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 1.0cm;" valign="top" width="38"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">5<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 40.15pt;" valign="top" width="54"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">29/01<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.30<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 43.7pt;" valign="top" width="58"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">11.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 73.6pt;" valign="top" width="98"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">29<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 54.8pt;" valign="top" width="73"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">12<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 35.45pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.42<o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 8.55pt; mso-yfti-irow: 3;">
<td style="border-top: none; border: solid windowtext 1.0pt; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 70.9pt;" valign="top" width="95"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Sale<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 1.0cm;" valign="top" width="38"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">1<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 40.15pt;" valign="top" width="54"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">20/01<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.42<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 43.7pt;" valign="top" width="58"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.42<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 73.6pt;" valign="top" width="98"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">26.58<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 54.8pt;" valign="top" width="73"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">11<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 35.45pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.42<o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 9.05pt; mso-yfti-irow: 4; mso-yfti-lastrow: yes;">
<td style="border-top: none; border: solid windowtext 1.0pt; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 70.9pt;" valign="top" width="95"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Sale<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 1.0cm;" valign="top" width="38"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">1<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 40.15pt;" valign="top" width="54"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">30/01<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.42<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 43.7pt;" valign="top" width="58"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.42<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 73.6pt;" valign="top" width="98"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">24.16<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 54.8pt;" valign="top" width="73"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">10<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 35.45pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.42<o:p></o:p></span></div>
</td>
</tr>
</tbody></table>
</div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">FIFO<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Before recalculation<o:p></o:p></span></div>
<div align="center">
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-table-layout-alt: fixed; mso-yfti-tbllook: 1184; width: 509px;">
<tbody>
<tr style="height: 18.05pt; mso-yfti-firstrow: yes; mso-yfti-irow: 0;">
<td style="border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 70.9pt;" valign="top" width="95"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Sale/Purch<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 1.0cm;" valign="top" width="38"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Qty<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 40.15pt;" valign="top" width="54"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Date<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Each cost<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 43.7pt;" valign="top" width="58"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Total
cost<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 73.6pt;" valign="top" width="98"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">NewFinancial
Cost Amt<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 54.8pt;" valign="top" width="73"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Resulting stock<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 35.45pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Cost
Price<o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 8.55pt; mso-yfti-irow: 1;">
<td style="border-top: none; border: solid windowtext 1.0pt; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 70.9pt;" valign="top" width="95"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Purchase<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 1.0cm;" valign="top" width="38"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">7<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 40.15pt;" valign="top" width="54"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">19/01<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 43.7pt;" valign="top" width="58"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">17.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 73.6pt;" valign="top" width="98"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">17.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 54.8pt;" valign="top" width="73"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">7<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 35.45pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.50<o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 8.55pt; mso-yfti-irow: 2;">
<td style="border-top: none; border: solid windowtext 1.0pt; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 70.9pt;" valign="top" width="95"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Purchase<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 1.0cm;" valign="top" width="38"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">5<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 40.15pt;" valign="top" width="54"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">29/01<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.30<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 43.7pt;" valign="top" width="58"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">11.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 73.6pt;" valign="top" width="98"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">29<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 54.8pt;" valign="top" width="73"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">12<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 35.45pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.42<o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 8.55pt; mso-yfti-irow: 3;">
<td style="border-top: none; border: solid windowtext 1.0pt; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 70.9pt;" valign="top" width="95"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Sale<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 1.0cm;" valign="top" width="38"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">1<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 40.15pt;" valign="top" width="54"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">20/01<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.42<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 43.7pt;" valign="top" width="58"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.42<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 73.6pt;" valign="top" width="98"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">26.58<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 54.8pt;" valign="top" width="73"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">11<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 35.45pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.42<o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 9.05pt; mso-yfti-irow: 4; mso-yfti-lastrow: yes;">
<td style="border-top: none; border: solid windowtext 1.0pt; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 70.9pt;" valign="top" width="95"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Sale<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 1.0cm;" valign="top" width="38"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">1<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 40.15pt;" valign="top" width="54"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">30/01<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.42<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 43.7pt;" valign="top" width="58"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.42<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 73.6pt;" valign="top" width="98"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">24.16<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 54.8pt;" valign="top" width="73"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">10<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 35.45pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.42<o:p></o:p></span></div>
</td>
</tr>
</tbody></table>
</div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">After
recalculation<o:p></o:p></span></div>
<div align="center">
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-table-layout-alt: fixed; mso-yfti-tbllook: 1184; width: 509px;">
<tbody>
<tr style="height: 18.05pt; mso-yfti-firstrow: yes; mso-yfti-irow: 0;">
<td style="border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 70.9pt;" valign="top" width="95"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Sale/Purch<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 1.0cm;" valign="top" width="38"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Qty<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 40.15pt;" valign="top" width="54"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Date<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Each cost<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 43.7pt;" valign="top" width="58"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Total
cost<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 73.6pt;" valign="top" width="98"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">NewFinancial
Cost Amt<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 54.8pt;" valign="top" width="73"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Resulting stock<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 35.45pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Cost
Price<o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 8.55pt; mso-yfti-irow: 1;">
<td style="border-top: none; border: solid windowtext 1.0pt; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 70.9pt;" valign="top" width="95"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Purchase<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 1.0cm;" valign="top" width="38"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">7<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 40.15pt;" valign="top" width="54"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">19/01<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 43.7pt;" valign="top" width="58"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">17.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 73.6pt;" valign="top" width="98"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">17.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 54.8pt;" valign="top" width="73"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">7<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 35.45pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.50<o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 8.55pt; mso-yfti-irow: 2;">
<td style="border-top: none; border: solid windowtext 1.0pt; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 70.9pt;" valign="top" width="95"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Purchase<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 1.0cm;" valign="top" width="38"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">5<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 40.15pt;" valign="top" width="54"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">29/01<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.30<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 43.7pt;" valign="top" width="58"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">11.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 73.6pt;" valign="top" width="98"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">29<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 54.8pt;" valign="top" width="73"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">12<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 35.45pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.42<o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 8.55pt; mso-yfti-irow: 3;">
<td style="border-top: none; border: solid windowtext 1.0pt; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 70.9pt;" valign="top" width="95"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Sale<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 1.0cm;" valign="top" width="38"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">1<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 40.15pt;" valign="top" width="54"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">20/01<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 43.7pt;" valign="top" width="58"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 73.6pt;" valign="top" width="98"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">26.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 54.8pt;" valign="top" width="73"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">11<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 35.45pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.40<o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 9.05pt; mso-yfti-irow: 4; mso-yfti-lastrow: yes;">
<td style="border-top: none; border: solid windowtext 1.0pt; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 70.9pt;" valign="top" width="95"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Sale<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 1.0cm;" valign="top" width="38"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">1<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 40.15pt;" valign="top" width="54"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">30/01<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 43.7pt;" valign="top" width="58"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 73.6pt;" valign="top" width="98"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">24.00<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 54.8pt;" valign="top" width="73"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">10<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 35.45pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.40<o:p></o:p></span></div>
</td>
</tr>
</tbody></table>
</div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Weighted
average by date<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Before
recalculation<o:p></o:p></span></div>
<div align="center">
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-table-layout-alt: fixed; mso-yfti-tbllook: 1184; width: 509px;">
<tbody>
<tr style="height: 18.05pt; mso-yfti-firstrow: yes; mso-yfti-irow: 0;">
<td style="border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 70.9pt;" valign="top" width="95"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Sale/Purch<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 1.0cm;" valign="top" width="38"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Qty<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 40.15pt;" valign="top" width="54"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Date<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Each cost<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 43.7pt;" valign="top" width="58"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Total
cost<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 73.6pt;" valign="top" width="98"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">NewFinancial
Cost Amt<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 54.8pt;" valign="top" width="73"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Resulting stock<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 35.45pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Cost
Price<o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 8.55pt; mso-yfti-irow: 1;">
<td style="border-top: none; border: solid windowtext 1.0pt; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 70.9pt;" valign="top" width="95"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Purchase<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 1.0cm;" valign="top" width="38"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">7<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 40.15pt;" valign="top" width="54"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">19/01<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 43.7pt;" valign="top" width="58"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">17.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 73.6pt;" valign="top" width="98"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">17.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 54.8pt;" valign="top" width="73"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">7<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 35.45pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.50<o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 8.55pt; mso-yfti-irow: 2;">
<td style="border-top: none; border: solid windowtext 1.0pt; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 70.9pt;" valign="top" width="95"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Purchase<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 1.0cm;" valign="top" width="38"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">5<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 40.15pt;" valign="top" width="54"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">29/01<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.30<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 43.7pt;" valign="top" width="58"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">11.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 73.6pt;" valign="top" width="98"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">29<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 54.8pt;" valign="top" width="73"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">12<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 35.45pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.42<o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 8.55pt; mso-yfti-irow: 3;">
<td style="border-top: none; border: solid windowtext 1.0pt; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 70.9pt;" valign="top" width="95"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Sale<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 1.0cm;" valign="top" width="38"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">1<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 40.15pt;" valign="top" width="54"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">20/01<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.42<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 43.7pt;" valign="top" width="58"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.42<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 73.6pt;" valign="top" width="98"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">26.58<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 54.8pt;" valign="top" width="73"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">11<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 35.45pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.42<o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 9.05pt; mso-yfti-irow: 4; mso-yfti-lastrow: yes;">
<td style="border-top: none; border: solid windowtext 1.0pt; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 70.9pt;" valign="top" width="95"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Sale<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 1.0cm;" valign="top" width="38"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">1<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 40.15pt;" valign="top" width="54"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">30/01<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.42<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 43.7pt;" valign="top" width="58"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.42<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 73.6pt;" valign="top" width="98"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">24.16<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 54.8pt;" valign="top" width="73"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">10<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 35.45pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.42<o:p></o:p></span></div>
</td>
</tr>
</tbody></table>
</div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">After
recalculation<o:p></o:p></span></div>
<div align="center">
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-table-layout-alt: fixed; mso-yfti-tbllook: 1184; width: 509px;">
<tbody>
<tr style="height: 18.05pt; mso-yfti-firstrow: yes; mso-yfti-irow: 0;">
<td style="border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 70.9pt;" valign="top" width="95"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Sale/Purch<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 1.0cm;" valign="top" width="38"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Qty<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 40.15pt;" valign="top" width="54"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Date<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Each cost<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 43.7pt;" valign="top" width="58"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Total
cost<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 73.6pt;" valign="top" width="98"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">NewFinancial
Cost Amt<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 54.8pt;" valign="top" width="73"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Resulting stock<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; height: 18.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 35.45pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Cost
Price<o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 8.55pt; mso-yfti-irow: 1;">
<td style="border-top: none; border: solid windowtext 1.0pt; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 70.9pt;" valign="top" width="95"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Purchase<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 1.0cm;" valign="top" width="38"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">7<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 40.15pt;" valign="top" width="54"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">19/01<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 43.7pt;" valign="top" width="58"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">17.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 73.6pt;" valign="top" width="98"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">17.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 54.8pt;" valign="top" width="73"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">7<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 35.45pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.50<o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 8.55pt; mso-yfti-irow: 2;">
<td style="border-top: none; border: solid windowtext 1.0pt; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 70.9pt;" valign="top" width="95"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Purchase<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 1.0cm;" valign="top" width="38"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">5<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 40.15pt;" valign="top" width="54"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">29/01<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.30<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 43.7pt;" valign="top" width="58"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">11.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 73.6pt;" valign="top" width="98"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">29<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 54.8pt;" valign="top" width="73"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">12<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 35.45pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.42<o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 8.55pt; mso-yfti-irow: 3;">
<td style="border-top: none; border: solid windowtext 1.0pt; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 70.9pt;" valign="top" width="95"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Sale<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 1.0cm;" valign="top" width="38"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">1<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 40.15pt;" valign="top" width="54"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">20/01<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="background: yellow; font-family: "arial" , "helvetica" , sans-serif;">2.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 43.7pt;" valign="top" width="58"><div class="MsoNormal">
<span lang="EN-US" style="background: yellow; font-family: "arial" , "helvetica" , sans-serif;">2.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 73.6pt;" valign="top" width="98"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">26.50<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 54.8pt;" valign="top" width="73"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">11<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 8.55pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 35.45pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.41<o:p></o:p></span></div>
</td>
</tr>
<tr style="height: 9.05pt; mso-yfti-irow: 4; mso-yfti-lastrow: yes;">
<td style="border-top: none; border: solid windowtext 1.0pt; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 70.9pt;" valign="top" width="95"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">Sale<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 1.0cm;" valign="top" width="38"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">1<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 40.15pt;" valign="top" width="54"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">30/01<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 34.9pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.42<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 43.7pt;" valign="top" width="58"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.42<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 73.6pt;" valign="top" width="98"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">24.08<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 54.8pt;" valign="top" width="73"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">10<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; height: 9.05pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 35.45pt;" valign="top" width="47"><div class="MsoNormal">
<span lang="EN-US" style="font-family: "arial" , "helvetica" , sans-serif;">2.41<o:p></o:p></span></div>
</td>
</tr>
</tbody></table>
</div>
<div class="MsoNormal">
</div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<div class="MsoNormal">
<br /></div>
Aman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.com6tag:blogger.com,1999:blog-1720352953703198635.post-25210772519592920942015-05-13T10:57:00.000+10:002015-05-13T11:00:02.588+10:00Get the running average cost of an itemThis is how you fetch an item's running average cost. In below case both the warehouse and site are same as the retail store ID. You set the inventDim and use inventOnHand class that does the trick.<br />
<br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> private CostPrice getAverageCost(RetailStoreId _storeId, ItemId _itemdId)
{
InventDim inventDim;
InventDimParm inventDimParm;
InventOnHand inventOnHand;
;
inventDim.InventLocationId = _storeId;
inventDim.InventSiteId = _storeId;
inventDim = InventDim::findOrCreate(inventDim);
inventDimParm.initFromInventDim(inventDim);
inventOnHand = InventOnHand::newItemDim(_itemdId, inventDim, inventDimParm);
return inventOnHand.costPricePcs();
}
</code></pre>
<br />
This is the same cost that you see on On-hand form for an item (Cost price field at the bottom), for a particular warehouse. For weighted average model group, cost price = Financial cost amount / Posted qty.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnq_fnpITcDrfhpTQNUThlaxm0dKvn7qweYsn6X2L_nqpQy2T-U9lTxAVdo4c-bHnTKD6_aC8l6JYrg0yYJYkNn0PRFsSbRbigwfxVNbvCLXq_6H9nB14FmMb-7OM0hVqIbPq-GDRPQXcI/s1600/Before.GIF" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="255" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnq_fnpITcDrfhpTQNUThlaxm0dKvn7qweYsn6X2L_nqpQy2T-U9lTxAVdo4c-bHnTKD6_aC8l6JYrg0yYJYkNn0PRFsSbRbigwfxVNbvCLXq_6H9nB14FmMb-7OM0hVqIbPq-GDRPQXcI/s320/Before.GIF" width="320" /></a></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />Aman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.com0tag:blogger.com,1999:blog-1720352953703198635.post-79193514410761612272015-01-14T23:22:00.000+11:002015-01-14T23:22:25.076+11:00Creating batch jobs with X++Two jobs to create batch jobs with X++, one for runBase and other for SysOperation.<br />
The two jobs are essentially the same, except that the SysOperation job uses both controller and contract classes.<br />
You could also choose to add dependency between two tasks.<br />
batchHeader.addTask(batchTaskToRun);<br />
batchHeader.addTask(dependsOnBatchTask);<br />
batchHeader.addDependency(batchTaskToRun, dependsOnBatchTask);<br />
<br />
You will get the same result as <a href="http://amannain.blogspot.com.au/2012/01/tackling-dependent-tasks-in-batch-job.html" target="_blank">here</a>, my previous blog post on adding dependency between jobs manually.<br />
<br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> static void batchRunBase(Args _args)
{
#define.recurrenceStartTime('23:00')
#define.recurrenceInterval(1)
#define.noOfRetriesOnFailure(4)
BatchHeader batchHeader;
BatchInfo batchInfo;
SysRecurrenceData sysRecurrenceData;
utcDateTime batchStartTime;
Batch batch;
Tutorial_RunBaseBatch yourRunBaseBatchClass;
;
select firstOnly RecId from batch
where batch.ClassNumber == classNum(Tutorial_RunBaseBatch) &&
batch.Company == curext() &&
batch.DataPartition == getcurrentpartition();
if (!batch.RecId)
{
yourRunBaseBatchClass = Tutorial_RunBaseBatch::construct();
batchInfo = yourRunBaseBatchClass.batchinfo();
batchInfo.parmRetriesOnFailure(#noOfRetriesOnFailure);
// Create the batch job
batchHeader = BatchHeader::construct();
batchHeader.addTask(yourRunBaseBatchClass); // or controller class
//batchHeader.parmCaption("Tutorial");
batchStartTime = DateTimeUtil::newDateTime(systemDateGet(), str2time(#recurrenceStartTime), DateTimeUtil::getUserPreferredTimeZone());
// Set the recurrence data
sysRecurrenceData = SysRecurrence::defaultRecurrence();
sysRecurrenceData = SysRecurrence::setRecurrenceStartDateTime(sysRecurrenceData, batchStartTime);
sysRecurrenceData = SysRecurrence::setRecurrenceNoEnd(sysRecurrenceData);
sysRecurrenceData = SysRecurrence::setRecurrenceUnit(sysRecurrenceData, SysRecurrenceUnit::Day, #recurrenceInterval);
batchHeader.parmRecurrenceData(sysRecurrenceData);
// Set the batch alert configurations
batchHeader.parmAlerts(NoYes::No, NoYes::Yes, NoYes::No, NoYes::Yes, NoYes::Yes);
batchHeader.parmStartDateTime(batchStartTime);
// Save the batch job
batchHeader.save();
}
}
</code></pre>
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> static void batchSys(Args _args)
{
#define.recurrenceStartTime('23:00')
#define.recurrenceInterval(1)
#define.noOfRetriesOnFailure(4)
BatchHeader batchHeader;
BatchInfo batchInfo;
SysRecurrenceData sysRecurrenceData;
utcDateTime batchStartTime;
Batch batch;
AbcDemandForecastServiceController AbcDemandForecastServiceController;
AbcDemandForecastServiceContract AbcDemandForecastServiceContract;
;
select firstOnly RecId from batch
where batch.ClassNumber == classNum(AbcDemandForecastServiceController) &&
batch.Company == curext() &&
batch.DataPartition == getcurrentpartition();
if (!batch.RecId)
{
AbcDemandForecastServiceController = new AbcDemandForecastServiceController(classStr(AbcDemandForecastServiceOperation), methodStr(AbcDemandForecastServiceOperation, calcDemandForecast), SysOperationExecutionMode::Synchronous);
AbcDemandForecastServiceContract = AbcDemandForecastServiceController.getDataContractObject(classStr(AbcDemandForecastServiceContract));
batchInfo = AbcDemandForecastServiceController.batchInfo();
batchInfo.parmRetriesOnFailure(#noOfRetriesOnFailure);
// Create the batch job
batchHeader = BatchHeader::construct();
batchHeader.addTask(AbcDemandForecastServiceController);
//batchHeader.parmCaption("Tutorial SysOperation");
batchStartTime = DateTimeUtil::newDateTime(systemDateGet(), str2time(#recurrenceStartTime), DateTimeUtil::getUserPreferredTimeZone());
// Set the recurrence data
sysRecurrenceData = SysRecurrence::defaultRecurrence();
sysRecurrenceData = SysRecurrence::setRecurrenceStartDateTime(sysRecurrenceData, batchStartTime);
sysRecurrenceData = SysRecurrence::setRecurrenceNoEnd(sysRecurrenceData);
sysRecurrenceData = SysRecurrence::setRecurrenceUnit(sysRecurrenceData, SysRecurrenceUnit::Day, #recurrenceInterval);
batchHeader.parmRecurrenceData(sysRecurrenceData);
// Set the batch alert configurations
batchHeader.parmAlerts(NoYes::No, NoYes::Yes, NoYes::No, NoYes::Yes, NoYes::Yes);
batchHeader.parmStartDateTime(batchStartTime);
// Save the batch job
batchHeader.save();
}
}
</code></pre>
Aman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.com0tag:blogger.com,1999:blog-1720352953703198635.post-76001850683292915242014-04-26T13:39:00.000+10:002014-04-26T13:39:10.216+10:00Access denied errors and Code permissionsSometimes users with limited privileges stumble upon errors like below.<br />
<div>
<br /></div>
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> Microsoft.Dynamics.Ax.Xpp.ErrorException: Exception of type 'Microsoft.Dynamics.Ax.Xpp.ErrorException' was thrown.
at Dynamics.Ax.Application.SysOperationController.Checkaccess() in SysOperationController.checkAccess.xpp:line 6
at Dynamics.Ax.Application.SysOperationServiceController.Checkaccess() in SysOperationServiceController.checkAccess.xpp:line 24
at Dynamics.Ax.Application.SysOperationServiceController.Unpack(Object[] packedState) in
SysOperationServiceController.unpack.xpp:line 13
at Dynamics.Ax.Application.BatchRun.runJobStatic(Int64 batchId) in BatchRun.runJobStatic.xpp:line 32
at BatchRun::runJobStatic(Object[] )
at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] parameters)
at BatchIL.taskThreadEntry(Object threadArg)
</code></pre>
<br />
Along with one line like Access denied to %1 class.
Clearly these are permissions issues owing to limited privileges added to the user's roles in security. One crude way to resolve the issue would be to simply elevate the access rights for the user, but that's not always practical. Second, more preferred way would be to give granular level access to that particular method where exception occurs. These methods are ususally run on Server and have attribute [SysEntryPointAttribute]. Here we can use Code permissions. Name suggests the purpose itself. Permission to code. See the example below. We have a custom code permission with one server method added. Not the property EffectiveAccess set as Invoke.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJGmU3LaWQs3DTJFKWEZ9tZKR0F0W0HVsA6xUMkOp744B6bXbMQgnnBug2-J6XMh18ckt11xNav5l2IeSNUQZqPN9EEZN5zSbtXRieCLN2zxr7rzmS-hbaIT_WsWI22w5h4CAnvQyPEweI/s1600/codepermission.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJGmU3LaWQs3DTJFKWEZ9tZKR0F0W0HVsA6xUMkOp744B6bXbMQgnnBug2-J6XMh18ckt11xNav5l2IeSNUQZqPN9EEZN5zSbtXRieCLN2zxr7rzmS-hbaIT_WsWI22w5h4CAnvQyPEweI/s1600/codepermission.PNG" height="100" width="320" /></a></div>
<br />
And this code permission is bound to the menu item that starts the logic.
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnq5hnblBq70MiGW4c-DP_bZ8VqnRjPfQcJKaGEC2Id3nKc1ijmyiZKQSRjSwuObJ7CJayrjAg377okevIeM7gYWHT3b3dGORqxllEI-e8NS0RVdsxLJ7xFMmWwDpBYalj-0xPtAtLnqvf/s1600/menuItem.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnq5hnblBq70MiGW4c-DP_bZ8VqnRjPfQcJKaGEC2Id3nKc1ijmyiZKQSRjSwuObJ7CJayrjAg377okevIeM7gYWHT3b3dGORqxllEI-e8NS0RVdsxLJ7xFMmWwDpBYalj-0xPtAtLnqvf/s1600/menuItem.PNG" height="118" width="320" /></a></div>
<br />Aman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.com0tag:blogger.com,1999:blog-1720352953703198635.post-62258641834447324742014-04-26T13:19:00.000+10:002014-04-26T13:19:01.748+10:00Using update_recordset with ViewsWe know that update_recordset statements should be used in place of while select forupdate wherever we can. We get the benefit of time saved by reduced server-sql trips.<br />
<br />
Lets discuss a unique scenario.<br />
Imagine you have to update table A with a status based on count of a particular column on another related table B. While select would look like this.<br />
<br />
<br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> ttsbegin;
while select forupdate stagingImportTable
exists join stagingPurchImport
where stagingPurchImport.ImportId == stagingImportTable.RecId
exists join stagingImportQueue
where stagingImportQueue.ImportID == stagingImportTable.ImportId &&
stagingImportQueue.ToDelete
{
select count(RecId) from stagingPurchImport
where stagingPurchImport.ImportId == stagingImportTable.RecId &&
!stagingPurchImport.PostedId;
if (stagingPurchImport.RecId != 0)
stagingImportTable.Status = MMSImportStatus::Incomplete;
else
stagingImportTable.Status = MMSImportStatus::Posted;
stagingImportTable.update();
}
ttscommit;
</code></pre>
<br />
Essentially we need to know the count (or any other aggregate value for that matter) of a column to decide which status needs to be set. The above statement can be very time consuming and that's where Views come to the rescue. How do we go about it?
First we need a query with table B as primary datasource and range as the column we need the count of, joined by table A. See below image.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigdbOf7ZfGkeNAb5j5CiH0Kkijegig_x0_9ajG67pxdOktt4Nb-b9lmQI5a89jw2VfJapDH4D5XnLSyyUVKKoku0sqMu9BDvFNuByy9S0WEMdcUkVyUp4FUbAwUe7mUFqQRUM_zKEIuIt3/s1600/query.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigdbOf7ZfGkeNAb5j5CiH0Kkijegig_x0_9ajG67pxdOktt4Nb-b9lmQI5a89jw2VfJapDH4D5XnLSyyUVKKoku0sqMu9BDvFNuByy9S0WEMdcUkVyUp4FUbAwUe7mUFqQRUM_zKEIuIt3/s1600/query.PNG" height="167" width="320" /></a></div>
<br />
<br />
Now we create a View with the above query as datasource (just drag and drop) and add two fields. First one we call CountOfRecId, which is an aggregation of RecIds. See below. (Note: when you try adding the field to a view, by default its a string, but when you choose the actual field, the datatype changes). Second field we add (ImportID) is to assist the join in the update statement we see next.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFkJP9LF3yTLKV2zxURkepIFk_8klw8MejWrwr7cVRwboScB1tjWLMTddWfNuTli99Dxl4RlYEvcwFAVijYmNqgrPGOuiGXZWfPufJD2825vpqYT2xh_AfDqRRhBqxlSsvWfAXxp_URsY9/s1600/count.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFkJP9LF3yTLKV2zxURkepIFk_8klw8MejWrwr7cVRwboScB1tjWLMTddWfNuTli99Dxl4RlYEvcwFAVijYmNqgrPGOuiGXZWfPufJD2825vpqYT2xh_AfDqRRhBqxlSsvWfAXxp_URsY9/s1600/count.PNG" height="111" width="320" /></a></div>
<br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> ttsbegin;
update_recordset stagingImportTable
setting Status = MMSImportStatus::Incomplete
exists join purchView
where purchView.CountOfRecId != 0 &&
purchView.ImportId == stagingImportTable.ImportId
exists join stagingImportQueue
where stagingImportQueue.ImportID == stagingImportTable.ImportId &&
stagingImportQueue.ToDelete;
ttscommit;
ttsbegin;
update_recordset stagingImportTable
setting Status = MMSImportStatus::Posted
exists join stagingImportQueue
where stagingImportQueue.ImportID == stagingImportTable.ImportId &&
stagingImportQueue.ToDelete
notexists join purchView
where purchView.ImportId == stagingImportTable.ImportId;
ttscommit;
</code></pre>
Since we have leveraged the power of queries and views, we get the count super-fast, which we then use in the update_recordset statement by making a join with the View, which behaves like a table. If you browse the View, it looks like this. Note the RecId value.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjd59RB2PZX5WNmyio0Fy7nPZU1TpYnvfsfOnul_8zPXBAKzqbcEKxh_aLiXupy3IRDFt28YZb2L_nBFWLUzk3ojl4V52RGWAH0B0T7mSSeJpPnHYwF-Vd4PLeaQQVjXzSactqr79_l7ldm/s1600/views.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjd59RB2PZX5WNmyio0Fy7nPZU1TpYnvfsfOnul_8zPXBAKzqbcEKxh_aLiXupy3IRDFt28YZb2L_nBFWLUzk3ojl4V52RGWAH0B0T7mSSeJpPnHYwF-Vd4PLeaQQVjXzSactqr79_l7ldm/s1600/views.PNG" height="114" width="320" /></a></div>
<br />Aman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.com0tag:blogger.com,1999:blog-1720352953703198635.post-46419837919178021332014-04-25T12:20:00.000+10:002015-06-04T11:03:03.345+10:00Multi-threading - Dependent tasks in batch using SysOperation frameworkFor a recent requirement, we had to make a custom batch job that could process thousands of lines coming from retail stores and post sales orders, purchase orders and counting journals for stock adjustments in AX. This batch job was to run on a regular basis daily. And to raise the bar of complexity even further, there was a sequence to the postings. First goes purchase, then sales and finally stock. Plus there were methods at the beginning and at the end for preparing the data and cleaning up activities at the end. So all in all we have a heavy duty batch job doing lots of heavy lifting and at the same time maintaining a sequence. That's when i started looking at multi-threading in AX.<br />
<br />
Adding dependent tasks in AX 2009 has been possible using RunBaseBatch framework. Read this post<br />
<a href="http://blogs.msdn.com/b/axsupport/archive/2011/04/13/threading-in-dynamics-ax.aspx">http://blogs.msdn.com/b/axsupport/archive/2011/04/13/threading-in-dynamics-ax.aspx</a><br />
<br />
But we needed to tweak this approach as we have the SysOperation framework replacing most of the RunBase code going in future. All new batch jobs, ssrs reports rely on SysOperation classes.<br />
<br />
I am going to show few of the tweakings we did and how we used them in the batch job.<br />
<br />
First of all we needed a way to have a list of tasks that could be executed in parallel and at the same time define a dependent task. We created a custom class that extended SysOperationServiceBase and custom method that took a list and a task(class) as parameter. We called it addRunTimeTaskList().<br />
<br />
Notice how we loop through the list of tasks, calling addRunTimeTask() for each and at the end call addDependency(). This is important you can't call addDependency() without calling addRunTimeTask() first. Note addDependency() method makes task _batchTaskAfter a dependent of each batchTask of the list. Enum BatchDependencyStatus::Finished tells that dependent task will only start executing once the parent tasks have finished successfully.<br />
<br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> /// <summary>
/// Used to add a list of runtime tasks to the current batch job
/// </summary>
/// <param name="_batchTasks">
/// List of tasks to be added
/// </param>
/// <param name="_batchTaskAfter">
/// task to be run after all other tasks are complete
/// </param>
/// <remarks>
///
/// </remarks>
protected void AddRunTimeTaskList(List _batchTasks, Batchable _batchTaskAfter = null)
{
BatchHeader bh = this.getCurrentBatchHeader();
Batch b = this.getCurrentBatchTask();
Batchable batchTask;
ListEnumerator listEnum;
boolean isRunTimeJob = bh.parmRuntimeJob();
listEnum = _batchTasks.getEnumerator();
listEnum.reset();
if( this.isExecutingInBatch() )
{
if( _batchTaskAfter )
{
bh.addRuntimeTask(_batchTaskAfter,b.RecId);
}
/*Now loop through all the tasks and add them*/
while(listEnum.moveNext())
{
batchTask = listEnum.current();
//b.RunTimeTask = true;
//bh.addTask(batchTask);
bh.addRuntimeTask(batchTask,b.RecId);
if(_batchTaskAfter)
{
bh.addDependency(_batchTaskAfter,batchTask,BatchDependencyStatus::Finished);
}
}
try
{
ttsBegin;
//Need to restore this value as there is an issue in this version of AX
bh.parmRuntimeJob(isRunTimeJob);
bh.save();
ttsCommit;
}
catch( Exception::UpdateConflict )
{
error("Failed to add child task");
}
}
else
{
/*Now loop through all the tasks and add them*/
while(listEnum.moveNext())
{
batchTask = listEnum.current();
batchTask.run();
}
/*See if there is a batch to run after*/
if(_batchTaskAfter)
{
_batchTaskAfter.run();
}
}
}
</code></pre>
<br />
This is how we call the method addRunTimeTaskList() passing a list and a call to another method as dependent.<br />
<br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> this.AddRunTimeTaskList(batchTasks_Sales, this.batchTaskAfterSales());
</code></pre>
<br />
Lets see how we populate batchTasks_Sales. We while through a query each time calling method addUpdateBatch_Sales(), in which we fill a list with instances of SysOperationServiceController class and setting the data contract alongwith.<br />
<br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> while (queryRun.next())
{
mmsStagingImportTable = queryRun.get(tableNum(MMSStagingImportTable));
if (queryRun.changed(tableNum(MMSStagingImportTable)))
{
updateBatch.parmDescription(strFmt("@SYS76785", startingPosition, "@MMS2867"));
startingPosition++;
updateBatch.parmStartDate(processingDate);
updateBatch.parmImportId(mmsStagingImportTable.ImportId);
this.addUpdateBatch_Sales(updateBatch, classStr(MMSStagingDataSalesCopy), methodStr(MMSStagingDataSalesCopy, copyData));
}
}
</code></pre>
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> public void addUpdateBatch_Sales(MMSStagingDataSalesCopyBatchDC _updateBatch, ClassName _class, MethodName _method)
{
MMSStagingDataSalesCopyBatchDC dataContract;
SysOperationServiceController sosc = new SysOperationServiceController(_class, _method, SysOperationExecutionMode::Synchronous );
dataContract = sosc.getDataContractObject();
if (dataContract)
{
dataContract.parmDescription(_updateBatch.parmDescription());
dataContract.parmStartDate(_updateBatch.parmStartDate());
dataContract.parmImportId(_updateBatch.parmImportId());
}
batchTasks_Sales.addEnd(sosc);
}
</code></pre>
Final piece of the puzzle, dependent method batchTaskAfterSales() which calls the next method.<br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> private SysOperationServiceController batchTaskAfterSales()
{
MMSStagingMasterPostingDC dataContractStock;
SysOperationServiceController sosc = new SysOperationServiceController(classStr(MMSStagingDataMasterPosting), methodStr(MMSStagingDataMasterPosting, batchStores), SysOperationExecutionMode::Synchronous);
dataContractStock = sosc.getDataContractObject();
return sosc;
}
</code></pre>
If you run the batch job and have it executing, going to the "View tasks" and selecting dependent task, you could see in the bottom grid the parent tasks.
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipc3h_NwSRbJVkTt-yvbIlCWxmL1mCh-vTIu6OGcKeOrzDsSAHUisa8tPWhydy5DNkyjvl4hJp7xpvwRVL1rEc2Hm5SK3l_D4XizsBZYL9r_Tax7XVQjH98DH9xXhKI3Db6oEmrMNTMFhK/s1600/batch.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="227" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipc3h_NwSRbJVkTt-yvbIlCWxmL1mCh-vTIu6OGcKeOrzDsSAHUisa8tPWhydy5DNkyjvl4hJp7xpvwRVL1rEc2Hm5SK3l_D4XizsBZYL9r_Tax7XVQjH98DH9xXhKI3Db6oEmrMNTMFhK/s1600/batch.PNG" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
EDIT: Its important that you use SysOperationExecutionMode::Synchronous in instantiating SysOperationServiceController otherwise your dependent task would run before.</div>
<br />Aman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.com3tag:blogger.com,1999:blog-1720352953703198635.post-50487931804017296732014-04-25T10:50:00.001+10:002014-04-25T12:21:20.144+10:00AIF Document Services: Handling header-line relationships and custom operationsUsing AIF document services to create data in AX is not a new thing. Its been around for a while now. Document services component of AX is easily the most used aspect when it comes to using AIF services with AX. For most of the basic AX tables, document services are shipped out of the box. For the custom tables that you create, you can easily create document services exposing the tables to the outside world. Create, Read, Update are commonly used service operations. Today i want to discuss how we can use these document services to create some data maintaining the header-line relations of the tables involved. We have two tables, MMSStagingImportTable the parent and MMSStagingStockImport the child and lets assume that we have a query with this relationship and all the Axd* and Ax* objects are already created in AX, port containing the service operations is activated and service reference is added in a .NET console application. For more info refer<br />
<a href="http://technet.microsoft.com/en-us/library/aa856656.aspx">http://technet.microsoft.com/en-us/library/aa856656.aspx</a><br />
<br />
Below code is a function loadStock() in the .NET console application that shows how i am creating a header with 2 lines using the create service operation.<br />
<br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> static void loadStock()
{
// Instantiate an instance of the service client class.
MMSIntellipharmServiceClient client = new MMSIntellipharmServiceClient();
// Initizlise parameters used for the create method
CallContext context = new CallContext() { Company = "mms" };
// Create an instance of the document class.
AxdMMSIntellipharm stagingForm = new AxdMMSIntellipharm();
// Create instances of the entities that are used in the service and set the needed fields on those entities.
AxdEntity_MMSStagingImportTable stagingImportTable = new AxdEntity_MMSStagingImportTable();
stagingImportTable.ImportId = "IPH_1002";
stagingImportTable.ImportDate = new DateTime(2014, 4, 4);
stagingImportTable.Datasource = AxdEnum_MMSImportDatasource.IPh;
stagingImportTable.Type = AxdEnum_MMSImportType.Stock;
AxdEntity_MMSStagingStockImport stagingStockImport = new AxdEntity_MMSStagingStockImport();
stagingStockImport.Barcode = "535353";
stagingStockImport.Cost = 14;
stagingStockImport.IsGST = AxdExtType_MMSImportIsGST.Yes;
stagingStockImport.ListPrice = 23;
stagingStockImport.SellPrice = 24;
stagingStockImport.SOH = 50;
stagingStockImport.StockDate = new DateTime(2014, 3, 25);
stagingStockImport.StoreId = "1300";
stagingStockImport.StoreItemDesc = "desc";
stagingStockImport.StoreItemId = "555555";
AxdEntity_MMSStagingStockImport stagingStockImport2 = new AxdEntity_MMSStagingStockImport();
stagingStockImport2.Barcode = "768756";
stagingStockImport2.Cost = 13;
stagingStockImport2.IsGST = AxdExtType_MMSImportIsGST.Yes;
stagingStockImport2.ListPrice = 27;
stagingStockImport2.SellPrice = 26;
stagingStockImport2.SOH = 40;
stagingStockImport2.StockDate = new DateTime(2014, 3, 24);
stagingStockImport2.StoreId = "1301";
stagingStockImport2.StoreItemDesc = "desc";
stagingStockImport2.StoreItemId = "444444";
stagingImportTable.MMSStagingStockImport = new AxdEntity_MMSStagingStockImport[2] { stagingStockImport, stagingStockImport2 };
stagingForm.MMSStagingImportTable = new AxdEntity_MMSStagingImportTable[1] { stagingImportTable };
// Call the create method on the service passing in the document.
EntityKey[] keys = client.create(context, stagingForm);
// The create method returns an EntityKey which contains the RecID of the header.
EntityKey returnedRecord = (EntityKey)keys.GetValue(0);
Console.WriteLine("New stock header created " + returnedRecord.KeyData[0].Value);
Console.ReadLine();
}
</code></pre>
<br />
This function can be called from the main() method like below.
<br />
<br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> static void Main(string[] args)
{
Console.WriteLine("Choose the action you want to perform:");
Console.WriteLine("1: Load purchase data");
Console.WriteLine("2: Load sales data");
Console.WriteLine("3: Load stock data");
Console.WriteLine("4: Load queue");
Console.WriteLine("5: Load stock data batches");
Console.WriteLine("6: Make import Id ready");
Console.WriteLine("7: Add ready import Ids to queue");
string userChoice = Console.ReadLine();
switch (userChoice)
{
case "1":
Program.loadPurchase();
break;
case "2":
Program.loadSales();
break;
case "3":
Program.loadStock();
break;
case "4":
Program.loadQueue();
break;
case "5":
Program.loadStockMultiple();
break;
case "6":
Program.makeReady();
break;
case "7":
Program.addToQueue();
break;
}
Console.WriteLine("Press any key to exit");
Console.ReadLine();
}
</code></pre>
<br />
Next we will enhance the loadStock() method by inserting 2 more lines to the same header. I will be using service operations read and update. I haven't seen any example of this kind yet, which is the primary reason for this blog post. This update is actually not updating anything in our case. It merely reads the returned header from the EntityKey[] and adds two more lines to it. Can you notice the differences between loadStockMultiple() and loadStock()?
<br />
<br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> static void loadStockMultiple()
{
// Instantiate an instance of the service client class.
MMSIntellipharmServiceClient client = new MMSIntellipharmServiceClient();
// Initizlise parameters used for the create method
CallContext context = new CallContext() { Company = "mms" };
// Create an instance of the document class.
AxdMMSIntellipharm stagingForm = new AxdMMSIntellipharm();
// Create instances of the entities that are used in the service and set the needed fields on those entities.
AxdEntity_MMSStagingImportTable stagingImportTable = new AxdEntity_MMSStagingImportTable();
stagingImportTable.ImportId = "IPH_1005";
stagingImportTable.ImportDate = new DateTime(2014, 4, 4);
stagingImportTable.Datasource = AxdEnum_MMSImportDatasource.IPh;
stagingImportTable.Status = AxdEnum_MMSImportStatus.New;
stagingImportTable.Type = AxdEnum_MMSImportType.Stock;
AxdEntity_MMSStagingStockImport stagingStockImport = new AxdEntity_MMSStagingStockImport();
stagingStockImport.Barcode = "535353";
stagingStockImport.Cost = 14;
stagingStockImport.IsGST = AxdExtType_MMSImportIsGST.Yes;
stagingStockImport.ListPrice = 23;
stagingStockImport.SellPrice = 24;
stagingStockImport.SOH = 50;
stagingStockImport.StockDate = new DateTime(2014, 3, 25);
stagingStockImport.StoreId = "1300";
stagingStockImport.StoreItemDesc = "desc";
stagingStockImport.StoreItemId = "555555";
AxdEntity_MMSStagingStockImport stagingStockImport2 = new AxdEntity_MMSStagingStockImport();
stagingStockImport2.Barcode = "768756";
stagingStockImport2.Cost = 13;
stagingStockImport2.IsGST = AxdExtType_MMSImportIsGST.Yes;
stagingStockImport2.ListPrice = 27;
stagingStockImport2.SellPrice = 26;
stagingStockImport2.SOH = 40;
stagingStockImport2.StockDate = new DateTime(2014, 3, 24);
stagingStockImport2.StoreId = "1301";
stagingStockImport2.StoreItemDesc = "desc";
stagingStockImport2.StoreItemId = "444444";
stagingImportTable.MMSStagingStockImport = new AxdEntity_MMSStagingStockImport[2] { stagingStockImport, stagingStockImport2 };
stagingForm.MMSStagingImportTable = new AxdEntity_MMSStagingImportTable[1] { stagingImportTable };
// Call the create method on the service passing in the document.
EntityKey[] keys = client.create(context, stagingForm);
//update >
// Use the keys to read
AxdMMSIntellipharm stagingFormUpd = client.read(context, keys);
// Create instances of the entities that are used in the service and set the needed fields on those entities.
AxdEntity_MMSStagingImportTable stagingImportTableUpd = stagingFormUpd.MMSStagingImportTable.First();
stagingImportTableUpd.action = AxdEnum_AxdEntityAction.update;
stagingImportTableUpd.actionSpecified = true;
AxdEntity_MMSStagingStockImport stagingStockImportUpd1 = new AxdEntity_MMSStagingStockImport();
stagingStockImportUpd1.action = AxdEnum_AxdEntityAction.create;
stagingStockImportUpd1.actionSpecified = true;
stagingStockImportUpd1.Barcode = "53535";
stagingStockImportUpd1.Cost = 14;
stagingStockImportUpd1.IsGST = AxdExtType_MMSImportIsGST.Yes;
stagingStockImportUpd1.ListPrice = 23;
stagingStockImportUpd1.SellPrice = 24;
stagingStockImportUpd1.SOH = 50;
stagingStockImportUpd1.StockDate = new DateTime(2014, 3, 25);
stagingStockImportUpd1.StoreId = "1300";
stagingStockImportUpd1.StoreItemDesc = "desc";
stagingStockImportUpd1.StoreItemId = "555555";
AxdEntity_MMSStagingStockImport stagingStockImportUpd2 = new AxdEntity_MMSStagingStockImport();
stagingStockImportUpd2.action = AxdEnum_AxdEntityAction.create;
stagingStockImportUpd2.actionSpecified = true;
stagingStockImportUpd2.Barcode = "76875";
stagingStockImportUpd2.Cost = 13;
stagingStockImportUpd2.IsGST = AxdExtType_MMSImportIsGST.Yes;
stagingStockImportUpd2.ListPrice = 27;
stagingStockImportUpd2.SellPrice = 26;
stagingStockImportUpd2.SOH = 40;
stagingStockImportUpd2.StockDate = new DateTime(2014, 3, 24);
stagingStockImportUpd2.StoreId = "1301";
stagingStockImportUpd2.StoreItemDesc = "desc";
stagingStockImportUpd2.StoreItemId = "444444";
stagingImportTableUpd.MMSStagingStockImport = new AxdEntity_MMSStagingStockImport[2] { stagingStockImportUpd1, stagingStockImportUpd2 };
stagingFormUpd.MMSStagingImportTable = new AxdEntity_MMSStagingImportTable[1] { stagingImportTableUpd };
client.update(context, keys, stagingFormUpd);
EntityKey returnedRecord = (EntityKey)keys.GetValue(0);
Console.WriteLine("New stock header created & updated " + returnedRecord.KeyData[0].Value);
Console.ReadLine();
//update <
}
</code></pre>
<br />
The RecVersion value in AX for the header remains 1, which shows that there is no update to the record. Also notice the use of action and actionSpecified with each buffer, in case of header we use AxdEnum_AxdEntityAction.update and in case of lines we use AxdEnum_AxdEntityAction.create.<br />
<br />
We can also add custom service operations along with the standard ones as you can see in my main method, addToQueue() and makeReady(). makeReady() expects a parameter.<br />
Both the methods are added to the DocumentService class in AX with attribute [SysEntryPointAttribute(true)].<br />
<br />
.NET code:<br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> static void makeReady()
{
try
{
Console.WriteLine("Enter an Import Id to make ready :");
string importId = Console.ReadLine();
// Instantiate an instance of the service client class.
MMSIntellipharmServiceClient client = new MMSIntellipharmServiceClient();
// Initizlise parameters used for the create method
CallContext context = new CallContext() { Company = "mms" };
// Create an instance of the document class.
AxdMMSIntellipharm staging = new AxdMMSIntellipharm();
client.makeReady(context, importId);
Console.WriteLine("Success!");
}
catch (Exception e)
{
Console.WriteLine(e.InnerException.Message);
}
Console.ReadLine();
}
</code></pre>
<br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> static void addToQueue()
{
try
{
// Instantiate an instance of the service client class.
MMSIntellipharmServiceClient client = new MMSIntellipharmServiceClient();
// Initizlise parameters used for the create method
CallContext context = new CallContext() { Company = "mms" };
// Create an instance of the document class.
AxdMMSIntellipharm staging = new AxdMMSIntellipharm();
client.addToQueue(context);
Console.WriteLine("Success!");
}
catch (Exception e)
{
Console.WriteLine(e.InnerException.Message);
}
Console.ReadLine();
}
</code></pre>
<br />
AX code:<br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> [SysEntryPointAttribute(true)]
public void makeReady(MMSImportID _importId)
{
MMSStagingImportTable importTable;
ttsbegin;
select firstOnly forupdate importTable where importTable.ImportId == _importId;
if (importTable)
{
importTable.Status = MMSImportStatus::Ready;
importTable.update();
}
ttscommit;
}
</code></pre>
<br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> [SysEntryPointAttribute(true)]
public void addToQueue()
{
MMSStagingImportTable importTable;
MMSStagingImportQueue queueTable, queueTableNot;
MMSSeqId seqId;
NumberSeq numberSeq;
numberSeq = NumberSeq::newGetNum(MMSStagingImportQueue::numRefSeqId());
numberSeq.used();
seqId = numberSeq.num();
ttsBegin;
insert_recordset queueTable(ImportID, SeqID)
select ImportID, seqId
from importTable
where importTable.Status == MMSImportStatus::Ready
notexists join queueTableNot
where queueTableNot.ImportID == importTable.ImportId;
ttsCommit;
}
</code></pre>
<br />
Thats a lot of code for one post. I hope you learned something new today.Aman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.com1tag:blogger.com,1999:blog-1720352953703198635.post-76218343416015171052014-02-16T15:38:00.000+11:002014-02-16T15:40:12.374+11:00Capturing infolog messagesI had a requirement to retrieve the content of infolog and store it in log tables, made to track the progress of a batch job and take action on any errors.
I used the below method in a catch statement handling all unexpected errors and at the same time updating error log tables. The while loop retrieves all the infolog errors using SysInfologEnumerator and SysInfologMessageStruct infolog classes and concatenating a string with the error messages.
<br />
<br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> private str getErrorStr()
{
SysInfologEnumerator enumerator;
SysInfologMessageStruct msgStruct;
Exception exception;
str error;
enumerator = SysInfologEnumerator::newData(infolog.cut());
while (enumerator.moveNext())
{
msgStruct = new SysInfologMessageStruct(enumerator.currentMessage());
exception = enumerator.currentException();
error = strfmt("%1 %2", error, msgStruct.message());
}
return error;
}
</code></pre>
<br />
And the catch statement calling the above method.
<br />
<br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> catch (Exception::Error)
{
ttsbegin;
mmsStagingPurchImport.selectForUpdate(true);
mmsStagingPurchImport.Error = true;
mmsStagingPurchImport.ErrorLog = this.getErrorStr();
mmsStagingPurchImport.update();
ttscommit;
retry;
}
</code></pre>
Aman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.com0tag:blogger.com,1999:blog-1720352953703198635.post-53967141313330713042014-02-16T15:27:00.000+11:002014-02-16T15:29:15.174+11:00Handy script to update storage & tracking dimension on an itemBelow code snippet updates an item's storage and tracking dimensions.
<br />
<br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> InventTableInventoryDimensionGroups::updateDimensionGroupsForItem(curext(), inventTable.ItemId,
5637144577,
5637144577);
</code></pre>
<br />
All you need is itemId and recIds of the storage and tracking dimensions to update, which can be found in EcoResStorageDimensionGroup and EcoResTrackingDimensionGroup tables holding the recIds of Storage and Tracking dimensions.<br />
<br />
I had a recent requirement to make sure there are no itemIds in the system which dont have storage or tracking dimensions not set as I had to create and post some counting journals that require these dimensions. Luckily all the items required the same storage and tracking dimensions so my job became easier.<br />
<br />
I used the below job to run a while loop with notexists join finding out items that don't have these dimensions set and update the same.
<br />
<br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> static void ScriptToUpdateStorageTrackingDimensions(Args _args)
{
InventTable inventTable;
EcoResStorageDimensionGroupItem EcoResStorageDimensionGroupItem;
EcoResTrackingDimensionGroupItem EcoResTrackingDimensionGroupItem;
int storageCount, trackingCount;
while select inventTable
notexists join EcoResStorageDimensionGroupItem
where EcoResStorageDimensionGroupItem.itemId == inventTable.itemId &&
EcoResStorageDimensionGroupItem.ItemDataAreaId == 'abc'
{
storageCount++;
InventTableInventoryDimensionGroups::updateDimensionGroupsForItem(
curext(), inventTable.ItemId,
5637144577,
0);
}
while select inventTable
notexists join EcoResTrackingDimensionGroupItem
where EcoResTrackingDimensionGroupItem.itemId == inventTable.itemId &&
EcoResTrackingDimensionGroupItem.ItemDataAreaId == 'abc'
{
trackingCount++;
InventTableInventoryDimensionGroups::updateDimensionGroupsForItem(
curext(), inventTable.ItemId,
5637144577,
5637144577);
}
//sw - storage - 5637144577
//none - tracking - 5637144577
info(int2str(storageCount));
info(int2str(trackingCount));
info('Done');
}
</code></pre>
Aman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.com0tag:blogger.com,1999:blog-1720352953703198635.post-8068299434933556072013-10-18T09:01:00.000+11:002013-10-18T09:01:41.061+11:00Job to fetch sales orders with lot of linesA quick job to fetch sales orders with lot of lines.<br />
<br />
<pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>static void salesTableFetch(Args _args)
{
SalesLine salesLine;
;
while select count(recId), SalesId from salesLine
group by SalesId
{
if (salesLine.RecId > 100)
{
info(salesLine.salesId);
}
}
}
</code></pre>
Aman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.com0tag:blogger.com,1999:blog-1720352953703198635.post-31495177258740052792013-09-26T00:04:00.002+10:002013-09-26T00:04:44.184+10:00jumpRef variationsjumpRef method is overriden for enabling the 'View details' feature, when you right click on a field.<br />
If your datasource on a form has relations to multiple tables with the same field, the form may choose the undesired table to reference.<br />
<br />
You can do this either on the datasource field or the form control. Once you have overridden the method add code similar to the example below.<br />
<pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code> Args args;
FormRun formRun;
args = new Args(formstr(VendTable));
args.record(VendTable::find("1000629"));
formRun = classfactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.wait();
formRun.detach();
</code></pre>
<br />
Notice the record parameter, it is the actual table record you want to open.<br />
<br />
Imagine a situation where you open a form B by clicking a button on form A. The clicked method of the button had the above code. And you want to perform some operation after the form B is closed. You could use the closedOk method of form B and call any method on form A like below.<br />
<pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code> if (formRun.closedOk())
MMSTmpVendPrincipalDistributor_ds.executeQuery();
</code></pre>
<br />
Instead of formRun, a more secure and neater approach would be to use the MenuFunction like below. Its secure because it uses the menu item on which we can control access. copyCallerQuery() is optional. In some instances, when you have a grid of a different datasource than the main datasource with no relation to main datasource table, its records wont be populated if you don't use copyCallerQuery.<br />
<pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code> menuFunction = new MenuFunction(MenuItemDisplayStr(VendTable), MenuItemType::Display);
menuFunction.copyCallerQuery(CopyCallerQuery::Yes);
menuFunction.run(args);
</code></pre>
<br />
AX also provides two classes, smmUtility and MenuFunction, which provide out of the box methods to achieve above functionality. Some examples picked up from standard AX.
<br />
<br />
smmUtility: openMenuItemForm and performJumpRef<br />
<pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>smmUtility::openMenuItemForm(menuitemDisplayStr(DirPartyTable),vendTable,element,false);
smmUtility::peformJumpRef(tablenum(smmQuotationReasonGroup), smmQuotationReasonGroup::find(this.text()).RecId);
</code></pre>
<br />
MenuFunction: runClient<br />
<pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>public void jumpRef()
{
Args argsProductForm;
argsProductForm = new Args();
argsProductForm.record(EcoResProduct);
argsProductForm.caller(element);
argsProductForm.copyCallerQuery(CopyCallerQuery::No);
MenuFunction::runClient(menuitemDisplayStr(EcoResProductDetails),MenuItemType::Display,false,argsProductForm);
}
</code></pre>
Aman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.com0tag:blogger.com,1999:blog-1720352953703198635.post-21670619559267640572013-09-19T09:25:00.002+10:002013-09-19T09:25:31.968+10:00Using Macros - #localmacro #if and #define<div>
Most of us are familiar with Macros. Unfortunately, they are seldom used to their potential.</div>
<div>
From MSDN, </div>
<div>
A macro is a variable known to the precompiler. The variable can have a value that is a sequence of characters, but it is not required to have a value. The #define directive tells the precompiler to create the macro variable, including an optional value. The #if directive tests whether the variable is defined, and optionally, whether it has a specific value.</div>
<div>
<br /></div>
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> static void SimpleDefineIfJob(Args _args)
{
str sTest = "Initial value.";
;
#define.MyMacro // MyMacro is now defined.
#if.MyMacro
sTest = "Yes, MyMacro is defined.";
info(sTest);
#endif
// Notice the non-code sentence line causes no X++ compiler error,
// because the X++ compiler never sees it.
#ifnot.MyMacro
The X++ compiler would reject this sentence.
sTest = "No, MyMacro is not defined.";
info(sTest);
#endif
}
</code></pre>
<br />
Again from MSDN,
<br />
The #localmacro directive is a good choice when you want a macro to have a value that is several lines long, or when your macro value contains a closing parenthesis. The #localmacro directive is a good choice when you want your macro value to be lines of X++ or SQL code.<br />
One particular use i found is when you want to suppress or replace particular where clauses from a select statement. #localmacro works wonderfully.<br />
<br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> static void LocalMacroInSelect(Args _args)
{
VendTable vendTable;
boolean showAllRecords = false;
#localmacro.WhileLoopFilter
while select firstOnly10 vendTable
%1
{
info(vendTable.accountNum);
}
#endmacro
if (showAllRecords)
{
#WhileLoopFilter(where vendTable.blocked == CustVendorBlocked::All)
}
else
{
#WhileLoopFilter(where vendTable.blocked == CustVendorBlocked::Payment)
}
}
</code></pre>
Aman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.com0tag:blogger.com,1999:blog-1720352953703198635.post-25454358113897075932013-09-19T08:51:00.000+10:002013-10-04T09:38:51.206+10:00Read Enum ElementsA quick job to fetch enum elements using a for loop. Much better than having to manually type the values.
<br />
<br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> static void EnumValues(Args _args)
{
DictEnum enum = new DictEnum(enumName2Id("ABC"));
int i;
for (i=0; i < enum.values(); i++)
{
info(strFmt("%1-%2", enum.index2Label(i), enum.index2value(i)));
}
}
</code></pre>
Aman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.com0tag:blogger.com,1999:blog-1720352953703198635.post-80905738518997616882013-07-24T23:06:00.001+10:002013-07-24T23:06:32.270+10:00Playing with controller class<div style="text-align: justify;">
SysOperation framework relies on SysOperationServiceController class for passing the args argument from the menu item to the framework. Overriding some of the methods on this class gives you more control over its functioning. Same way when you want to modify the user interface of a SysOperation service, UI Builder classes are the way to go. Two methods of particular interest to me are:</div>
<div>
<div style="text-align: justify;">
<b>showQueryValues</b> When a query is used and this method returns true, then the fields with ranges and a Select button will be shown on the dialog. Return false in this method to hide them.</div>
</div>
<div>
<div style="text-align: justify;">
<b>showQuerySelectButton</b> This method does the same as the showQueryValues method, but only affects the Select button.</div>
</div>
<div>
<div style="text-align: justify;">
<br /></div>
</div>
<div>
<div style="text-align: justify;">
Some cases we want to create a batchable job, which a user can use but don't want to give him the option to 'select' any particular records or its meaningless to show the query fields on dialog. Overriding the above two methods to return false can solve the purpose.</div>
</div>
<div>
<div style="text-align: justify;">
<br /></div>
</div>
<div>
<div style="text-align: justify;">
You will also need to override main and construct methods in this case, like below.</div>
</div>
<div>
<br /></div>
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> public static void main(args _args)
{
MMSPriceUpdatePublishDataController controller = MMSPriceUpdatePublishDataController::construct();
controller.startOperation();
}
</code></pre>
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> private static MMSPriceUpdatePublishDataController construct(SysOperationExecutionMode _mode = SysOperationExecutionMode::ReliableAsynchronous)
{
MMSPriceUpdatePublishDataController controller = new MMSPriceUpdatePublishDataController(classStr(MMSPriceUpdatePublishData),methodStr(MMSPriceUpdatePublishData, run), _mode);
return controller;
}
</code></pre>
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> public boolean showQuerySelectButton(str parameterName)
{
return false;
}
</code></pre>
Also set the Object property on the menu item as the name of your controller class.
Aman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.com0tag:blogger.com,1999:blog-1720352953703198635.post-24235832013961454292013-07-17T21:22:00.000+10:002013-07-17T21:22:46.483+10:00Posting trade agreementsPosting trade agreements is not a straightforward thing and i found it during a recent assignment. Trade agreements broadly revolve around three main tables, PriceDiscAdmTable, PriceDiscAdmTrans and PriceDiscTable and posting is handled via class PriceDiscAdmCheckPost.
<br />
<br />
So i create a journal header and fill the journal lines (details in another blog maybe) and call the below method to do the posting.<br />
<br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> void postTradeAgreement(PriceDiscAdmTable _priceJourHeader)
{
PriceDiscAdmCheckPost jourPost;
PriceDiscTable tradeTable;
InfologData infologData;
//Post
jourPost = new PriceDiscAdmCheckPost(false);
infologData = infolog.infologData(); // store infolog data
infolog.clear(); // if you don't clear the infolog, posting errors out.
jourPost.initJournalNum(_priceJourHeader.JournalNum);
jourPost.run();
infolog.import(infologData); // import infolog data
}
</code></pre>
<br />
See anything strange?<br />
I do three things related to Infolog.<br />
1. Store the contents.
I am storing the contents of infolog (my logic needs to show info to user later) in a data type InfologData, which is a container. <br />
<br />
2. Clear the infolog.
If i dont clear the infolog just before i hit run() method to post, i get an error which makes no sense.<br />
<br />
3. Import the infolog contents again.<br />
<br />
Anybody knows a better way?Aman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.com0tag:blogger.com,1999:blog-1720352953703198635.post-19737843671687767602013-07-17T21:06:00.000+10:002013-07-17T21:06:37.540+10:00Default unit on a Product<div class="MsoNormal">
<span style="font-family: "Arial","sans-serif"; font-size: 10.0pt;">While writing logic to create new products through code, there was a discussion to have the
Purch/Invent/Sales unit id on a Product to be defaulted to ‘Each’. And idea was
to hardcode it.</span></div>
<div class="MsoNormal">
<span style="font-family: "Arial","sans-serif"; font-size: 10.0pt;">This
unit id is required by AX for trade agreements creation.</span></div>
<br />
<div class="MsoNormal">
<span style="font-family: "Arial","sans-serif"; font-size: 10.0pt;">While
trying to code this, we found a parameter setting on Inventory
parameters form that lets the user parameterise it instead of harcoding.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "Arial","sans-serif"; font-size: 10.0pt;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEif-LUt_cCzrc7ukAK9pcvZ9ev7iMhHJtELh0ImDnGc-VGWQQl5DJsOdsBmEKbpytHZhKOje5LP0X4EEoAiTcGgd5_SqIMhwOZbkQx4muiZ7zchRXLNRyS_Hw9bFO1nKpQIDtSh_cVd8x0S/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="167" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEif-LUt_cCzrc7ukAK9pcvZ9ev7iMhHJtELh0ImDnGc-VGWQQl5DJsOdsBmEKbpytHZhKOje5LP0X4EEoAiTcGgd5_SqIMhwOZbkQx4muiZ7zchRXLNRyS_Hw9bFO1nKpQIDtSh_cVd8x0S/s320/1.png" width="320" /></a></div>
<div class="MsoNormal">
<span style="font-family: "Arial","sans-serif"; font-size: 10.0pt;"><br /></span></div>
Aman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.com0tag:blogger.com,1999:blog-1720352953703198635.post-82061558738246880192013-07-03T20:41:00.000+10:002013-07-03T20:41:09.791+10:00List page controls designThis would be a quick post. More so for my remembrance than for enlightening public in general :)<br />
<br />
Controlling the visibility of a form's controls and action pane buttons is something very common.<br />
But doing so for a list page is not so common.<br />
<br />
For a normal form, to make a field invisible you would write something like below in form's <i>init()</i> method.<br />
<br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> VendTable_ds.object(fieldNum(VendTable, yourField)).visible(false);
</code></pre>
<br />
For a list page, you would write something like below in that list page's interaction class's <i>initialized()</i> method.<br />
<br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> this.listPage().listPageFieldVisible(formControlStr(VendTableListPage, VendTable_YourField), false);
</code></pre>
<br />
<u>More features</u><br />
this.listPage().listPageArgs().menuItemName() - would let you control the list page's behavior depending on which menu item is your page getting called from.<br />
<br />
this.listPage().actionPaneControlVisible and this.listPage().actionPaneControlEnabled - for controlling action panes behavior.<br />
<br />
I refered VendTableListPageInteraction class for this post. Cheers.Aman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.com0tag:blogger.com,1999:blog-1720352953703198635.post-12598250923044471002013-07-03T20:14:00.000+10:002013-07-03T20:14:08.412+10:00Cross company traversingToday's discussion is around traversing a table across companies. In our example, a record sits in a custom parameters table, which needs to be updated. Instinctively first thing to check would be the <b>SaveDataPerCompany</b> property of the table, which in our case is set to <b>Yes</b>. So this table stores records per company and for implementing the feature in discussion we will forcefully update the record across all companies by overriding the table's update method.
<br />
<br />
Logic centers around<br />
1. Traversing DataArea table, which is a system table containing all legal entities<br />
2. Using keyword changeCompany which swaps the companies one by one and<br />
3. Clearing the table object after each change, failing to do so makes the logic not work.<br />
<br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU62xSYSowO0mzMy6ncpKAHQgoblHC1Ybeh6DyTLOFNDzEcL2bS7CAfmNGjJMdvZAm9KzuzthJxBhU0-EzjdALDSsdA307bqkQ1tjXO9fZKCJeR9n8-Ncnue6oPz_bXebJenGOITvueuLI/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> public void update()
{
YourTable yourtable;
DataArea DataArea;
super();
while select DataArea where !DataArea.isVirtual
{
changecompany (DataArea.Id)
{
yourtable= null;
ttsBegin;
yourtable= Yourtable::find(true);
if (yourtable.RecId)
{
yourtable.Field = "";
yourtable.update();
}
ttsCommit;
}
}
}
</code></pre>
Aman Nainhttp://www.blogger.com/profile/04739206311957621165noreply@blogger.com1