Changed the Quantity routines to use the Item Units decimals if any. A lot of files.
[fa-stable.git] / inventory / manage / item_units.php
index ce5f50d0de6ef45680f803e43232c313957a2dfe..3798bfe30f24f94e62720645c2f196766787eb70 100644 (file)
@@ -13,7 +13,7 @@ include_once($path_to_root . "/inventory/includes/db/items_units_db.inc");
 if (isset($_GET['selected_id']))
 {
        $selected_id = $_GET['selected_id'];
-} 
+}
 else if (isset($_POST['selected_id']))
 {
        $selected_id = $_POST['selected_id'];
@@ -21,25 +21,25 @@ else if (isset($_POST['selected_id']))
 
 //----------------------------------------------------------------------------------
 
-if (isset($_POST['ADD_ITEM']) || isset($_POST['UPDATE_ITEM'])) 
+if (isset($_POST['ADD_ITEM']) || isset($_POST['UPDATE_ITEM']))
 {
 
        //initialise no input errors assumed initially before we test
        $input_error = 0;
 
-       if (strlen($_POST['abbr']) == 0) 
+       if (strlen($_POST['abbr']) == 0)
        {
                $input_error = 1;
                display_error(_("The unit of measure code cannot be empty."));
                set_focus('abbr');
        }
-       if (strlen($_POST['description']) == 0) 
+       if (strlen($_POST['description']) == 0)
        {
                $input_error = 1;
                display_error(_("The unit of measure description cannot be empty."));
                set_focus('description');
        }
-       if (!is_numeric($_POST['decimals'])) 
+       if (!is_numeric($_POST['decimals']))
        {
                $input_error = 1;
                display_error(_("The number of decimal places must be integer."));
@@ -49,26 +49,26 @@ if (isset($_POST['ADD_ITEM']) || isset($_POST['UPDATE_ITEM']))
 
        if ($input_error !=1) {
        write_item_unit(isset($selected_id) ? $selected_id : '', $_POST['abbr'], $_POST['description'], $_POST['decimals'] );
-               meta_forward($_SERVER['PHP_SELF']); 
+               meta_forward($_SERVER['PHP_SELF']);
        }
 }
 
-//---------------------------------------------------------------------------------- 
+//----------------------------------------------------------------------------------
 
-if (isset($_GET['delete'])) 
+if (isset($_GET['delete']))
 {
 
        // PREVENT DELETES IF DEPENDENT RECORDS IN 'stock_master'
-    
+
        if (item_unit_used($selected_id))
        {
                display_error(_("Cannot delete this unit of measure because items have been created using this units."));
 
-       } 
-       else 
+       }
+       else
        {
                delete_item_unit($selected_id);
-               meta_forward($_SERVER['PHP_SELF']);             
+               meta_forward($_SERVER['PHP_SELF']);
        }
 }
 
@@ -81,9 +81,9 @@ $th = array(_('Unit'), _('Description'), _('Decimals'), "", "");
 table_header($th);
 $k = 0; //row colour counter
 
-while ($myrow = db_fetch($result)) 
+while ($myrow = db_fetch($result))
 {
-       
+
        alt_table_row_color($k);
 
        label_cell($myrow["abbr"]);
@@ -105,7 +105,7 @@ start_form();
 
 start_table("class='tablestyle_noborder'");
 
-if (isset($selected_id)) 
+if (isset($selected_id))
 {
        //editing an existing item category
 
@@ -123,8 +123,10 @@ if (isset($selected_id) && item_unit_used($selected_id)) {
     hidden('abbr', $_POST['abbr']);
 } else
     text_row(_("Unit Abbreviation:"), 'abbr', null, 20, 20);
-text_row(_("Descriptive Name:"), 'description', null, 40, 40);  
-text_row(_("Decimal Places:"), 'decimals', null, 3, 3);  
+text_row(_("Descriptive Name:"), 'description', null, 40, 40);
+
+//text_row(_("Decimal Places:"), 'decimals', null, 3, 3);
+number_list_row(_("Decimal Places:"), 'decimals', null, 0, 6, _("User Quantity Decimals"));
 
 end_table(1);