" . _("Item:"). " "; stock_items_list('stock_id', $_POST['stock_id'], false, true); echo "
"; // if stock sel has changed, clear the form if ($_POST['stock_id'] != get_global_stock_item()) { clear_data(); } set_global_stock_item($_POST['stock_id']); //---------------------------------------------------------------------------------------------------- function clear_data() { unset($_POST['PriceID']); unset($_POST['price']); } //---------------------------------------------------------------------------------------------------- if (isset($_POST['updatePrice'])) { if (!is_numeric($_POST['price']) || $_POST['price'] == "") { $input_error = 1; display_error( _("The price entered must be numeric.")); } if ($input_error != 1) { if (isset($_POST['PriceID'])) { //editing an existing price update_item_price($_POST['PriceID'], $_POST['sales_type_id'], $_POST['curr_abrev'], $_POST['price']); $msg = _("This price has been updated."); } elseif ($input_error !=1) { add_item_price($_POST['stock_id'], $_POST['sales_type_id'], $_POST['curr_abrev'], $_POST['price']); display_note(_("The new price has been added.")); } clear_data(); } } //------------------------------------------------------------------------------------------------------ if (isset($_GET['delete'])) { //the link to delete a selected record was clicked delete_item_price($_GET['PriceID']); echo _("The selected price has been deleted."); } //--------------------------------------------------------------------------------------------------- $mb_flag = get_mb_flag($_POST['stock_id']); $prices_list = get_prices($_POST['stock_id']); start_table("$table_style width=30%"); $th = array(_("Currency"), _("Sales Type"), _("Price"), "", ""); table_header($th); $k = 0; //row colour counter while ($myrow = db_fetch($prices_list)) { alt_table_row_color($k); label_cell($myrow["curr_abrev"]); label_cell($myrow["sales_type"]); amount_cell($myrow["price"]); edit_link_cell("PriceID=" . $myrow["id"]. "&Edit=1"); delete_link_cell("PriceID=" . $myrow["id"]. "&delete=yes"); end_row(); } end_table(); //------------------------------------------------------------------------------------------------ if (db_num_rows($prices_list) == 0) { display_note(_("There are no prices set up for this part.")); } echo "
"; if (isset($_GET['Edit'])) { $myrow = get_stock_price($_GET['PriceID']); hidden('PriceID', $_GET['PriceID']); $_POST['curr_abrev'] = $myrow["curr_abrev"]; $_POST['sales_type_id'] = $myrow["sales_type_id"]; $_POST['price'] = $myrow["price"]; } start_table($table_style2); currencies_list_row(_("Currency:"), 'curr_abrev', null); sales_types_list_row(_("Sales Type:"), 'sales_type_id', null); text_row(_("Price:"), 'price', null, 10, 10); end_table(1); submit_center('updatePrice', _("Add/Update Price")); end_form(); end_page(); ?>