thanks Mr. Highandwild and Mr. Jdraw.
Yes I have created a table which stores the movements of the product as per following.
InternalTransactions: (id, ProductInvolved, QTY, From, To, Date).
I have checked the attachments but still cant solve my problem. could you please tell me step by step...