X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=inventory%2Fmanage%2Fitem_codes.php;h=1881258c22593c9cc1c66a47c9bef3530946ca45;hb=2f3375b4493c1b1e0b17c2801298275f22f8d76e;hp=af88a52044a021b059f8e00fbdb02a14636d94e6;hpb=d2cc0860eccf02eaefcd90731ac3af141a841529;p=fa-stable.git diff --git a/inventory/manage/item_codes.php b/inventory/manage/item_codes.php index af88a520..1881258c 100644 --- a/inventory/manage/item_codes.php +++ b/inventory/manage/item_codes.php @@ -13,11 +13,14 @@ $page_security = 'SA_FORITEMCODE'; $path_to_root = "../.."; include_once($path_to_root . "/includes/session.inc"); -page(_($help_context = "Foreign Item Codes")); +$js = ""; +if ($SysPrefs->use_popup_windows && $SysPrefs->use_popup_search) + $js .= get_js_open_window(900, 500); + +page(_($help_context = "Foreign Item Codes"), false, false, "", $js); include_once($path_to_root . "/includes/date_functions.inc"); include_once($path_to_root . "/includes/ui.inc"); -include_once($path_to_root . "/includes/manufacturing.inc"); include_once($path_to_root . "/includes/data_checks.inc"); check_db_has_purchasable_items(_("There are no inventory items defined in the system.")); @@ -35,10 +38,10 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM') display_error( _("There is no item selected.")); set_focus('stock_id'); } - elseif (!check_num('quantity', 0)) + elseif (!input_num('quantity')) { $input_error = 1; - display_error( _("The price entered was not numeric.")); + display_error( _("The quantity entered was not positive number.")); set_focus('quantity'); } elseif ($_POST['description'] == '') @@ -103,21 +106,26 @@ if (!isset($_POST['stock_id'])) $_POST['stock_id'] = get_global_stock_item(); echo "
" . _("Item:"). " "; -stock_purchasable_items_list('stock_id', $_POST['stock_id'], false, true); +//Manufcatured item visible +echo stock_items_list('stock_id', $_POST['stock_id'], false, true); echo "
"; set_global_stock_item($_POST['stock_id']); +$units = $dec = ''; $result = get_item_code_dflts($_POST['stock_id']); -$dec = $result['decimals']; -$units = $result['units']; -$dflt_desc = $result['description']; -$dflt_cat = $result['category_id']; +if ($result) { + $dec = $result['decimals']; + $units = $result['units']; + $dflt_desc = $result['description']; + $dflt_cat = $result['category_id']; +} + $result = get_all_item_codes($_POST['stock_id']); div_start('code_table'); - start_table("$table_style width=60%"); + start_table(TABLESTYLE, "width='60%'"); $th = array(_("EAN/UPC Code"), _("Quantity"), _("Units"), _("Description"),_("Category"), "", ""); @@ -152,27 +160,28 @@ div_end(); //----------------------------------------------------------------------------------------------- -if ($Mode =='Edit') -{ - $myrow = get_item_code($selected_id); - $_POST['item_code'] = $myrow["item_code"]; - $_POST['quantity'] = $myrow["quantity"]; - $_POST['description'] = $myrow["description"]; - $_POST['category_id'] = $myrow["category_id"]; -} - else { - $_POST['quantity'] = 1; - $_POST['description'] = $dflt_desc; - $_POST['category_id'] = $dflt_cat; +if ($selected_id != '') { + if ($Mode =='Edit') + { + $myrow = get_item_code($selected_id); + $_POST['item_code'] = $myrow["item_code"]; + $_POST['quantity'] = $myrow["quantity"]; + $_POST['description'] = $myrow["description"]; + $_POST['category_id'] = $myrow["category_id"]; + } + hidden('selected_id', $selected_id); +} else { + $_POST['quantity'] = 1; + $_POST['description'] = $dflt_desc; + $_POST['category_id'] = $dflt_cat; } echo "
"; -hidden('selected_id', $selected_id); -start_table($table_style2); +start_table(TABLESTYLE2); hidden('code_id', $selected_id); -text_row(_("UPC/EAN code:"), 'item_code', null, 20, 21); +text_row(_("UPC/EAN code:"), 'item_code', null, 20, 20); qty_row(_("Quantity:"), 'quantity', null, '', $units, $dec); text_row(_("Description:"), 'description', null, 50, 200); stock_categories_list_row(_("Category:"), 'category_id', null); @@ -184,4 +193,3 @@ submit_add_or_update_center($selected_id == -1, '', 'both'); end_form(); end_page(); -?>