write_journal_entries($cart);
}
- if ($qty > 0 && ($qoh != -$qty)) {
- if ($qoh == 0 && $avg_cost != 0)
- $avg_cost = ($avg_cost + ($unit_cost*$qty_new)/($qoh+$qty))/2;
- else
- $avg_cost = ($avg_cost*($qoh+$qty_delayed)+$unit_cost*$qty_new)/($qoh+$qty);
- }
+ if ($qty > 0 && ($qoh != -$qty))
+ $avg_cost = ($avg_cost*($qoh+$qty_delayed)+$unit_cost*$qty_new)/($qoh+$qty);
$sql = "UPDATE ".TB_PREF."stock_master SET material_cost=".db_escape($avg_cost)."
WHERE stock_id=".db_escape($stock_id);
while($row = db_fetch($res))
{
+ $is_bank_to = is_bank_account($row['account']);
+ if ($is_bank_to)
+ void_bank_trans($row['trans_type'], $row['trans_no']);
+
// void any related gl trans
$date = Today();
$type = $row['trans_type'];