if ($clearing_act)
$total += add_gl_trans_supplier(ST_SUPPRECEIVE, $grn, $date_, $stock_gl_code["inventory_account"],
$stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'],
- $order_line->receive_qty * $order_line->taxfree_charge_price($po), $po->supplier_id, '', 0, $order_line->stock_id);
+ $order_line->taxfree_charge_value($po), $po->supplier_id, '', 0, $order_line->stock_id);
update_average_material_cost($po->supplier_id, $order_line->stock_id, $order_line->price,
$order_line->receive_qty, $date_);
}
/* Update location stock records - NB a po cannot be entered for a service/kit parts done automatically */
add_stock_move(ST_SUPPRECEIVE, $order_line->stock_id, $grn, $po->Location, $date_, "",
$order_line->receive_qty, $order_line->standard_cost,
- $po->supplier_id, 1, $order_line->taxfree_charge_price($po));
+ $po->supplier_id, 1, $order_line->taxfree_charge_value($po)/$order_line->receive_qty);
} /*quantity received is != 0 */
} /*end of order_line loop */
$this->standard_cost =0;
$this->grn_item_id = $grn_item_id;
}
-
+
+ // Deprecated, use with care. If you need line value as it is calculated in invoice, use taxfree_charge_value below.
function taxfree_charge_price($po)
{
- return get_tax_free_price_for_item($this->stock_id, $this->price,
+ return get_tax_free_price_for_item($this->stock_id, $this->price,
+ $po->tax_group_id, $po->tax_included, $po->tax_group_array);
+ }
+
+ //
+ // GRN line tax free value.
+ //
+ function taxfree_charge_value($po)
+ {
+ return get_tax_free_price_for_item($this->stock_id, $this->receive_qty*$this->price,
$po->tax_group_id, $po->tax_included, $po->tax_group_array);
}
}