activate('_page_body'); //-------------------------------------------------------------------------------------------------- start_form(false, true); 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); echo "
"; set_global_stock_item($_POST['stock_id']); $result = get_item_code_dflts($_POST['stock_id']); $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%"); $th = array(_("EAN/UPC Code"), _("Quantity"), _("Units"), _("Description"),_("Category"), "", ""); table_header($th); $k = $j = 0; //row colour counter while ($myrow = db_fetch($result)) { alt_table_row_color($k); label_cell($myrow["item_code"]); qty_cell($myrow["quantity"], $dec); label_cell($units); label_cell($myrow["description"]); label_cell($myrow["cat_name"]); edit_button_cell("Edit".$myrow['id'], _("Edit")); edit_button_cell("Delete".$myrow['id'], _("Delete")); end_row(); $j++; If ($j == 12) { $j = 1; table_header($th); } //end of page full new headings } //end of while loop end_table(); 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; } echo "
"; hidden('selected_id', $selected_id); start_table($table_style2); hidden('code_id', $selected_id); text_row(_("UPC/EAN code:"), 'item_code', null, 20, 21); qty_row(_("Quantity:"), 'quantity', null, '', $units, $dec); text_row(_("Description:"), 'description', null, 50, 200); stock_categories_list_row(_("Category:"), 'category_id', null); end_table(1); submit_add_or_update_center($selected_id == -1, '', true); end_form(); end_page(); ?>