From 29ca33a6b909f751522e42e116f1205a648a17e5 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Wed, 13 Jan 2010 11:51:10 +0000 Subject: [PATCH] Changed so also Item Adjustment and Cost Update allow more than 2 dec in price --- CHANGELOG.txt | 6 ++++++ inventory/cost_update.php | 18 +++++++----------- inventory/includes/item_adjustments_ui.inc | 12 ++++++++---- inventory/view/view_adjustment.php | 2 +- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 42386417..adb441b2 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,12 @@ Legend: ! -> Note $ -> Affected files +13-Jan-2010 Joe Hunt +! Changed so also Item Adjustment and Cost Update allow more than 2 dec in price +$ /inventory/cost_update.php + /inventory/includes/item_adjustments_ui.inc + /inventory/view/view_adjustment.php + 12-Jan-2010 Janusz Dobrowolski # Fixed buggy exemptions display $ /taxes/item_tax_types.php diff --git a/inventory/cost_update.php b/inventory/cost_update.php index 2ce775fc..088cad58 100644 --- a/inventory/cost_update.php +++ b/inventory/cost_update.php @@ -103,20 +103,16 @@ hidden("OldLabourCost", $myrow["labour_cost"]); hidden("OldOverheadCost", $myrow["overhead_cost"]); start_table($table_style2); +$dec1 = $dec2 = $dec3 = 0; +$_POST['material_cost'] = price_decimal_format($myrow["material_cost"], $dec1); +$_POST['labour_cost'] = price_decimal_format($myrow["labour_cost"], $dec2); +$_POST['overhead_cost'] = price_decimal_format($myrow["overhead_cost"], $dec3); -$_POST['material_cost'] = price_format($myrow["material_cost"]); -$_POST['labour_cost'] = price_format($myrow["labour_cost"]); -$_POST['overhead_cost'] = price_format($myrow["overhead_cost"]); - -amount_row(_("Standard Material Cost Per Unit"), "material_cost", - null, "class='tableheader2'"); - +amount_row(_("Standard Material Cost Per Unit"), "material_cost", null, "class='tableheader2'", null, $dec1); if ($myrow["mb_flag"]=='M') { - amount_row(_("Standard Labour Cost Per Unit"), "labour_cost", - null, "class='tableheader2'"); - amount_row(_("Standard Overhead Cost Per Unit"), "overhead_cost", - null, "class='tableheader2'"); + amount_row(_("Standard Labour Cost Per Unit"), "labour_cost", null, "class='tableheader2'", null, $dec2); + amount_row(_("Standard Overhead Cost Per Unit"), "overhead_cost", null, "class='tableheader2'", null, $dec3); } else { diff --git a/inventory/includes/item_adjustments_ui.inc b/inventory/includes/item_adjustments_ui.inc index 7b67cca3..cfe697fa 100644 --- a/inventory/includes/item_adjustments_ui.inc +++ b/inventory/includes/item_adjustments_ui.inc @@ -81,7 +81,7 @@ function display_adjustment_items($title, &$order) label_cell($stock_item->item_description); qty_cell($stock_item->quantity, false, get_qty_dec($stock_item->stock_id)); label_cell($stock_item->units); - amount_cell($stock_item->standard_cost); + amount_decimal_cell($stock_item->standard_cost); amount_cell($stock_item->standard_cost * $stock_item->quantity); edit_button_cell("Edit$line_no", _("Edit"), @@ -112,13 +112,15 @@ function adjustment_edit_item_controls(&$order, $line_no=-1) global $Ajax; start_row(); + $dec2 = 0; $id = find_submit('Edit'); if ($line_no != -1 && $line_no == $id) { $_POST['stock_id'] = $order->line_items[$id]->stock_id; $_POST['qty'] = qty_format($order->line_items[$id]->quantity, $order->line_items[$id]->stock_id, $dec); - $_POST['std_cost'] = price_format($order->line_items[$id]->standard_cost); + //$_POST['std_cost'] = price_format($order->line_items[$id]->standard_cost); + $_POST['std_cost'] = price_decimal_format($order->line_items[$id]->standard_cost, $dec2); $_POST['units'] = $order->line_items[$id]->units; hidden('stock_id', $_POST['stock_id']); @@ -138,14 +140,16 @@ function adjustment_edit_item_controls(&$order, $line_no=-1) $item_info = get_item_edit_info($_POST['stock_id']); $dec = $item_info['decimals']; $_POST['qty'] = number_format2(0, $dec); - $_POST['std_cost'] = price_format($item_info["standard_cost"]); + //$_POST['std_cost'] = price_format($item_info["standard_cost"]); + $_POST['std_cost'] = price_decimal_format($item_info["standard_cost"], $dec2); $_POST['units'] = $item_info["units"]; } qty_cells(null, 'qty', $_POST['qty'], null, null, $dec); label_cell($_POST['units'], '', 'units'); - amount_cells(null, 'std_cost', $_POST['std_cost']); + //amount_cells(null, 'std_cost', $_POST['std_cost']); + amount_cells(null, 'std_cost', null, null, null, $dec2); label_cell(" "); if ($id != -1) diff --git a/inventory/view/view_adjustment.php b/inventory/view/view_adjustment.php index 6bc50764..953e6018 100644 --- a/inventory/view/view_adjustment.php +++ b/inventory/view/view_adjustment.php @@ -64,7 +64,7 @@ while ($adjustment = db_fetch($adjustment_items)) label_cell($adjustment['description']); qty_cell($adjustment['qty'], false, get_qty_dec($adjustment['stock_id'])); label_cell($adjustment['units']); - amount_cell($adjustment['standard_cost']); + amount_decimal_cell($adjustment['standard_cost']); end_row(); } -- 2.30.2