X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=purchasing%2Fpo_entry_items.php;h=5a7958d28d9295ba6941b311c6f481dcc2bc4388;hb=e67a7d7074ceb37291846e68f8c5683bb93560ab;hp=a5f4b7d59e9f2e7919a03b134c18b71b0bbe067b;hpb=80dd97a37f674cc3691fa04af4c29607067566b2;p=fa-stable.git diff --git a/purchasing/po_entry_items.php b/purchasing/po_entry_items.php index a5f4b7d5..5a7958d2 100644 --- a/purchasing/po_entry_items.php +++ b/purchasing/po_entry_items.php @@ -24,11 +24,11 @@ if ($use_date_picker) if (isset($_GET['ModifyOrderNumber'])) { - page(_("Modify Purchase Order #") . $_GET['ModifyOrderNumber'], false, false, "", $js); + page(_($help_context = "Modify Purchase Order #") . $_GET['ModifyOrderNumber'], false, false, "", $js); } else { - page(_("Purchase Order Entry"), false, false, "", $js); + page(_($help_context = "Purchase Order Entry"), false, false, "", $js); } //--------------------------------------------------------------------------------------------------- @@ -157,9 +157,12 @@ function handle_cancel_po() function check_data() { - if (!check_num('qty',0)) + $dec = get_qty_dec($_POST['stock_id']); + $min = 1 / pow(10, $dec); + if (!check_num('qty',$min)) { - display_error(_("The quantity of the order item must be numeric and not less than zero.")); + $min = number_format2($min, $dec); + display_error(_("The quantity of the order item must be numeric and not less than ").$min); set_focus('qty'); return false; } @@ -185,19 +188,21 @@ function handle_update_item() { $allow_update = check_data(); - if ($allow_update && - ($_SESSION['PO']->line_items[$_POST['line_no']]->qty_inv > input_num('qty') || - $_SESSION['PO']->line_items[$_POST['line_no']]->qty_received > input_num('qty'))) + if ($allow_update) { - display_error(_("You are attempting to make the quantity ordered a quantity less than has already been invoiced or received. This is prohibited.") . - "
" . _("The quantity received can only be modified by entering a negative receipt and the quantity invoiced can only be reduced by entering a credit note against this item.")); - set_focus('qty'); - return; - } + if ($_SESSION['PO']->line_items[$_POST['line_no']]->qty_inv > input_num('qty') || + $_SESSION['PO']->line_items[$_POST['line_no']]->qty_received > input_num('qty')) + { + display_error(_("You are attempting to make the quantity ordered a quantity less than has already been invoiced or received. This is prohibited.") . + "
" . _("The quantity received can only be modified by entering a negative receipt and the quantity invoiced can only be reduced by entering a credit note against this item.")); + set_focus('qty'); + return; + } - $_SESSION['PO']->update_order_item($_POST['line_no'], input_num('qty'), input_num('price'), - $_POST['req_del_date']); - unset_form_variables(); + $_SESSION['PO']->update_order_item($_POST['line_no'], input_num('qty'), input_num('price'), + $_POST['req_del_date']); + unset_form_variables(); + } line_start_focus(); } @@ -213,24 +218,18 @@ function handle_add_new_item() { foreach ($_SESSION['PO']->line_items as $order_item) { - /* do a loop round the items on the order to see that the item is not already on this order */ - if (($order_item->stock_id == $_POST['stock_id']) && - ($order_item->Deleted == false)) + if (($order_item->stock_id == $_POST['stock_id'])) { - $allow_update = false; - display_error(_("The selected item is already on this order.")); + display_warning(_("The selected item is already on this order.")); } } /* end of the foreach loop to look for pre-existing items of the same code */ } if ($allow_update == true) { - $sql = "SELECT description, units, mb_flag - FROM ".TB_PREF."stock_master WHERE stock_id = '". $_POST['stock_id'] . "'"; - - $result = db_query($sql,"The stock details for " . $_POST['stock_id'] . " could not be retrieved"); + $result = get_short_info($_POST['stock_id']); if (db_num_rows($result) == 0) {