Average Cost Calculation at FA
1. 10 pcs of Item A purchased at $15
2. 6 pcs are sold
3. 15 pcs of Item A purchased at $18
avg cost = ((15*18)+(4*15)) / 19 = 17.36
This is the formula of Avg Cost
However the problem at FA is that if you even Stock IN it calculates the Avg Cost. Even if you do Stock Transfer it calculates Avg Cost. Even the Voding Stock Moves affects the Average Cost
I have some modifications and conditions applied in
function void_stock_move()
if (!in_array ($type ,array(ST_LOCTRANSFER))) //condition added by faisal
if(!get_company_pref ('controlled_avg_cost') || in_array ($type, array(ST_WORKORDER, ST_MANURECEIVE, ST_SUPPRECEIVE)))
update_average_material_cost($row["supplier_id"], $row["stock_id"],
$unit_cost, -$row["qty"], sql2date($row["tran_date"]), false, "Void Stock Move # $type_no and type = ".$systypes_array[$type]);
This function also is modified but the idea is to limit it on all Transaction Types