unset($_POST['factor']); } //---------------------------------------------------------------------------------------------------- if (isset($_POST['updatePrice'])) { if (!check_num('price', 0) && !check_num('factor', 0)) { $input_error = 1; display_error(tr("The price entered must be numeric.")); set_focus('price'); } if ($input_error != 1) { if (isset($_POST['PriceID'])) { //editing an existing price update_item_price($_POST['PriceID'], $_POST['sales_type_id'], $_POST['curr_abrev'], input_num('price'), input_num('factor')); $msg = tr("This price has been updated."); } elseif ($input_error != 1) { add_item_price($_POST['stock_id'], $_POST['sales_type_id'], $_POST['curr_abrev'], input_num('price'), input_num('factor')); display_note(tr("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 tr("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%");
} if ($type == 'ITEM' || $type == 'KIT' || $type == 'PRICE') { if (isset($price) && $price != "") { if ($currency == "") { $currency = get_company_pref("curr_default"); } else { $row = get_currency($currency); if (!$row) { add_currency($currency, "", "", "", ""); } } $sql = "SELECT * FROM " . TB_PREF . "prices\tWHERE stock_id='{$code}' AND sales_type_id={$_POST['sales_type_id']} AND\n\t\t\t\t\tcurr_abrev='{$currency}'"; $result = db_query($sql, "price could not be retrieved"); $row = db_fetch_row($result); if (!$row) { add_item_price($code, $_POST['sales_type_id'], $currency, $price); } else { update_item_price($row[0], $_POST['sales_type_id'], $currency, $price); } $pr++; } } if ($type == 'BUY') { $code = db_escape($code); if (check_stock_id($code)) { $supplier_id = get_supplier_id(db_escape($category)); if ($supplier_id == 0) { display_notification("Supplier {$category} not found"); } else { $sql = "SELECT stock_id from " . TB_PREF . "purch_data where supplier_id={$supplier_id} AND stock_id={$code}"; $result = db_query($sql, "Could not lookup supplier purchasing data");