Fixed editable line layout.
[fa-stable.git] / manufacturing / work_order_entry.php
index b30209fc984fca9f5bcc04172c8ce828fd366583..659e9bec41a88228830f5492f19ce43c11c5f082 100644 (file)
@@ -254,7 +254,10 @@ function can_process()
 
 if (isset($_POST['ADD_ITEM']) && can_process())
 {
-
+       if (!isset($_POST['cr_acc']))
+               $_POST['cr_acc'] = "";
+       if (!isset($_POST['cr_lab_acc']))
+               $_POST['cr_lab_acc'] = "";
        $id = add_work_order($_POST['wo_ref'], $_POST['StockLocation'], input_num('quantity'),
                $_POST['stock_id'],  $_POST['type'], $_POST['date_'],
                $_POST['RequDate'], $_POST['memo_'], input_num('Costs'), $_POST['cr_acc'], input_num('Labour'), $_POST['cr_lab_acc']);
@@ -377,7 +380,7 @@ else
        wo_types_list_row(_("Type:"), 'type', null);
 }
 
-if ($_POST['released'] == true)
+if (get_post('released'))
 {
        hidden('stock_id', $_POST['stock_id']);
        hidden('StockLocation', $_POST['StockLocation']);
@@ -388,13 +391,18 @@ if ($_POST['released'] == true)
 }
 else
 {
-       stock_manufactured_items_list_row(_("Item:"), 'stock_id', null);
+       stock_manufactured_items_list_row(_("Item:"), 'stock_id', null, false, true);
+       if (list_updated('stock_id'))
+               $Ajax->activate('quantity');
 
        locations_list_row(_("Destination Location:"), 'StockLocation', null);
 }
 
 if (!isset($_POST['quantity']))
        $_POST['quantity'] = qty_format(1, $_POST['stock_id'], $dec);
+else
+       $_POST['quantity'] = qty_format($_POST['quantity'], $_POST['stock_id'], $dec);
+       
 
 if (get_post('type') == wo_types::advanced())
 {
@@ -430,7 +438,7 @@ else
        
 }
 
-if ($_POST['released'])
+if (get_post('released'))
        label_row(_("Released On:"),$_POST['released_date']);
 
 textarea_row(_("Memo:"), 'memo_', null, 40, 5);
@@ -442,7 +450,7 @@ if (isset($selected_id))
        echo "<table align=center><tr>";
 
        submit_cells('UPDATE_ITEM', _("Update"), '', _('Save changes to work order'), true);
-       if (isset($_POST['released']))
+       if (get_post('released'))
        {
                submit_cells('close', _("Close This Work Order"),'','',true);
        }