Closing stock of items datewise in MSD axapta

Sometimes we need to to find the Stock of Item by Date. You can set following code in for or while loop to get closing stock for all items in tables.

Closing Stock

You can get posted,recieved and deducted qty. screeshot of code is as above.