I want to match the Inventory Valuation Report with the Balance Sheet Report (Inventory Account).

Condition1:

 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]);

Condition2:

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]);

Point 1:

      In Condition 1, we had the material cost updated in the stock_master, and negative handling was passed in gl_trans while voiding the adjustment.

      In Condition 2, the material cost was not updated in the stock_master, and negative handling was also not passed in gl_trans while voiding the adjustment.

Point 2:
      In Condition 1, when I checked the Inventory Valuation Report and the Balance Sheet Report after voiding, the inventory account was not matching.

     Similarly, in Condition 2, the reports were also not matching.

However, the Inventory Valuation Report of Condition 1 was matching with the Balance Sheet of Condition 2.

Please help me in resolving my issue.