Powered by Blogger.

Fixing Costing Calculation Issue In FrontAccounting 2.4



To fix it, just open file : \manufacturing\includes\db\work_order_costing_db.inc with text editor like Notepad++, Atom, Sublime Text, etc.

Find this code :

if ($qty > 0 && ($qoh != -$qty))
 $avg_cost = ($avg_cost*($qoh+$qty_delayed)+$unit_cost*$qty_new)/($qoh+$qty);


then replace with this code :

/*
 if ($qty > 0 && ($qoh != -$qty))
 $avg_cost = ($avg_cost*($qoh+$qty_delayed)+$unit_cost*$qty_new)/($qoh+$qty);
 */
 
 //Add by : Andik Mabrur
 $avg_costbfr = $avg_cost;
 if ($qty > 0 && ($qoh != -$qty))
 {
 $qohbfr = $qoh - $qty;//Qty on-hand before
 if($qohbfr == 0)
 $avg_cost = $unit_cost;
 else if($qohbfr > 0)
 $avg_cost = (($avg_cost * $qohbfr) + ($unit_cost * $qty)) / $qoh;
 else
 {
 if($avg_costbfr == 0)
 $avg_cost = $unit_cost;
 else
 $avg_cost = (abs($avg_cost * $qohbfr) + ($unit_cost * $qty)) / (abs($qohbfr) + $qty);
 }
 }
 //end

this issue has been fixed in FrontAccounting version 2.44, so if you have new implementation just use 2.44 version or later.

No comments