set_global_stock_item($_POST['stock_id']); //---------------------------------------------------------------------------------------------------- if ($Mode == 'ADD_ITEM' || $Mode == 'UPDATE_ITEM') { if (!check_num('price', 0)) { $input_error = 1; display_error(_("The price entered must be numeric.")); set_focus('price'); } elseif ($Mode == 'ADD_ITEM' && get_stock_price_type_currency($_POST['stock_id'], $_POST['sales_type_id'], $_POST['curr_abrev'])) { $input_error = 1; display_error(_("The sales pricing for this item, sales type and currency has already been added.")); set_focus('supplier_id'); } if ($input_error != 1) { if ($selected_id != -1) { //editing an existing price update_item_price($selected_id, $_POST['sales_type_id'], $_POST['curr_abrev'], input_num('price')); $msg = _("This price has been updated."); } else { add_item_price($_POST['stock_id'], $_POST['sales_type_id'], $_POST['curr_abrev'], input_num('price')); $msg = _("The new price has been added."); } display_notification($msg); $Mode = 'RESET'; } } //------------------------------------------------------------------------------------------------------ if ($Mode == 'Delete') { //the link to delete a selected record was clicked delete_item_price($selected_id); display_notification(_("The selected price has been deleted.")); $Mode = 'RESET';
{ unset($_POST['PriceID']); unset($_POST['price']); 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."); } //---------------------------------------------------------------------------------------------------
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"); $row = db_fetch_row($result); $descr = db_escape($description);