This Happens when there are Recipes in the system that are set as stockable (product has stock) and are set to deplete their ingredients upon sale (Poll Recipe on Sale Option) at the same time.
This leads to sending both of the recipe (having a cost of X=total of its ingredient costs) and the ingredients (individually) to the posdetailmovement table.
To solve the problem we need the following:
- verify that all recipes in the system that are set as poll recipe on sale, do not have stock. to find those items, you can run the following Query:
select * from products p inner join recipe_header rh on p.prodnum=rh.prodnum and rh.isactive=1 where p.isproduction=0 and p.pollrecipe=1
- for each of the items decide what to do (most probably the item's stock should be depleted) make sure to adjust all item stock to zero (in each existing branch, in each location) and then set the item as having no stock; this will fix the items.
- to fix the old data, run the following sql
delete from posdetailmovement where prodnum in (select prodnum from products where isproduction=1)
- Finally, unpost all sales from BIM CALC and repost them.
hope this helps