Changed so also Item Adjustment and Cost Update allow more than 2 dec in price
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Wed, 13 Jan 2010 11:51:10 +0000 (11:51 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Wed, 13 Jan 2010 11:51:10 +0000 (11:51 +0000)
CHANGELOG.txt
inventory/cost_update.php
inventory/includes/item_adjustments_ui.inc
inventory/view/view_adjustment.php

index 42386417b8c495c78f06c2bd13ab02371a33f0a5..adb441b202c029369c636386ec1c04c2b8524d93 100644 (file)
@@ -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
index 2ce775fc66c439681abba877375a998e465d954a..088cad5853bf0ee75fbe32fb7653103375a685b0 100644 (file)
@@ -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
 {
index 7b67cca306a7fe7f90fb939aa466a281c421646a..cfe697fa1c30efd813e678766ed6efd38d39c7fe 100644 (file)
@@ -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("&nbsp;");
 
        if ($id != -1)
index 6bc5076480c97ef9bde002211158b9c477aad29a..953e6018e1eab816910ca14c8fe1e9c9b26a4b4d 100644 (file)
@@ -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();
 }