I am developing a inventory software in VB6 using MS Access 2010 as Database, We have a main Store where we receive Products from different Vendors and then distribute the products to our sub-stores located at different locations. I want to create a Periodic activity report of (Inventory) Products at each location like what was the Opening-Balance of each product at that particular location, how many New items were transferred, what was the quantity Returned and how many were sold. For which I have created two tables
Table Name : Store contain fields as under:
STORE
FieldName (Type)
ProductID (Text)
Onhand (Number)
LocationID (text)
ClosdingDate (Date)
ClosingQty (Number)
LogDetail
Field Name(Type)
LogID(Text)
LogDate (Date)
ProductID (Text)
LocationID (Text)
TransactionType(Text)
Transaction(Number)
Rate (Number)
TransactionType Field contain the value like ( I, T, R and S) where (I =IN, T =Transfer, R=Retuned, S=Sale)
What will be the query for following report format. (Previous Balance is required from the last physical stock taking date say 30/08/2014)
From Dt:01/09/2014 | ToDt: 15/09/2014
LocationID ProductID RATE PreviousBalance Transfer Return Sale NewBalance
B AA1 1000 4 3 0 0 7
B AA2 2500 0 4 0 0 4
B BB1 3000 6 0 0 0 6
B BB2 1000 0 4 0 4 0
B BB3 1500 3 0 0 0 3
B CC1 3000 6 0 6 0 0
B CC3 1200 0 10 2 5 3
19 21 8 9 23