Just a few remarks.
Aren't you making it to difficult for yourself with giving every item an other product id for every incoming invoice? If the price changes this effect the value of goods in stock anyhow. If your purchase price changes significantly you'll have to adjust your sales price even if this means a drop in margin. Competitors with less stock will sell cheaper and leave you with disgruntled customers.
Bookmarks