! -> Note
$ -> Affected files
+03-Sep-2008 Joe Hunt
+# Bug [0000043] Inventory Adjustment Session doesn't update standard cost
+# Bug [0000044]Standard Cost error on credit note
+$ /inventory/includes/db/items_adjust_db.inc
+ /purchasing/includes/db/grn_db.inc
+ /purchasing/includes/invoice_db.inc
+
02-Sep-2008 Joe Hunt
# Bug when selecting report, List of Journal Entries, by type. Nothing selected.
$ /reporting/includes/reports_classes.inc
add_gl_trans_std_cost(systypes::inventory_adjustment(), $adj_id, $date_, $stock_gl_codes['inventory_account'], 0, 0, $memo_, ($standard_cost * $quantity));
}
+ update_average_material_cost(null, $stock_id, $standard_cost, $quantity, $date_);
}
//-------------------------------------------------------------------------------------------------------------
function update_average_material_cost($supplier, $stock_id, $price, $qty, $date, $adj_only=false)
{
- $currency = get_supplier_currency($supplier);
+ if ($supplier != null)
+ $currency = get_supplier_currency($supplier);
+ else
+ $currency = null;
if ($currency != null)
$price_in_home_currency = to_home_currency($price, $currency, $date);
else
if (!$supp_trans->is_invoice)
{
$entered_grn->this_quantity_inv = -$entered_grn->this_quantity_inv;
+ update_average_material_cost($supp_trans->supplier_id, $entered_grn->item_code,
+ $entered_grn->chg_price, $entered_grn->this_quantity_inv, $date_);
}
$line_taxfree = $entered_grn->taxfree_charge_price($supp_trans->tax_group_id);
$entered_grn->this_quantity_inv * $line_taxfree, $supp_trans->supplier_id);
// -------------- if price changed since po received. 16 Aug 2008 Joe Hunt
$old_price = $old[0];
- if ($old_price != $entered_grn->chg_price) // price-change, so update
+ if ($supp_trans->is_invoice && $old_price != $entered_grn->chg_price) // price-change, so update
{
$diff = $entered_grn->chg_price - $old_price;
$old_date = sql2date($old[1]);