X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;ds=inline;f=purchasing%2Fsupplier_credit_grns.php;h=49b07b49ce9f70e46ed59730c98e976d3f404d84;hb=99730b8d6deb7e81d2f1ebeb2ce7066d27729485;hp=f195d788545982b955e6ea5d5398730c31078f55;hpb=431531eebf3ba494002cfbf7ea36f9e82d4975c0;p=fa-stable.git diff --git a/purchasing/supplier_credit_grns.php b/purchasing/supplier_credit_grns.php index f195d788..49b07b49 100644 --- a/purchasing/supplier_credit_grns.php +++ b/purchasing/supplier_credit_grns.php @@ -29,21 +29,17 @@ echo "
"; function check_data() { - if (!is_numeric($_POST['This_QuantityCredited'])) + if (!check_num('This_QuantityCredited', 0)) { - display_error(_("The quantity to credit must be numeric.")); + display_error(_("The quantity to credit must be numeric and greater than zero.")); + set_focus('This_QuantityCredited'); return false; } - if ($_POST['This_QuantityCredited'] <= 0) - { - display_error(_("The quantity to credit must be greater than zero.")); - return false; - } - - if (!is_numeric($_POST['ChgPrice']) || $_POST['ChgPrice'] < 0) + if (!check_num('ChgPrice', 0)) { display_error(_("The price is either not numeric or negative.")); + set_focus('ChgPrice'); return false; } @@ -68,8 +64,8 @@ if (isset($_POST['AddGRNToTrans'])) $_SESSION['supp_trans']->add_grn_to_trans($_POST['GRNNumber'], $_POST['po_detail_item'], $_POST['item_code'], $_POST['item_description'], $_POST['qty_recd'], - $_POST['prev_quantity_inv'], $_POST['This_QuantityCredited'], - $_POST['order_price'], $_POST['ChgPrice'], $complete, + $_POST['prev_quantity_inv'], input_num('This_QuantityCredited'), + $_POST['order_price'], input_num('ChgPrice'), $complete, $_POST['std_cost_unit'], ""); } } @@ -121,7 +117,7 @@ while ($myrow = db_fetch($result)) foreach ($_SESSION['supp_trans']->grn_items as $entered_grn) { - if ($entered_grn->id == $myrow["id"]) + if ($entered_grn->id == $myrow["id"]) { $grn_already_on_credit = True; } @@ -137,11 +133,12 @@ while ($myrow = db_fetch($result)) label_cell($myrow["item_code"]); label_cell($myrow["description"]); label_cell(sql2date($myrow["delivery_date"])); - qty_cell($myrow["qty_recd"]); - qty_cell($myrow["quantity_inv"]); - qty_cell($myrow["qty_recd"] - $myrow["quantity_inv"]); + $dec = get_qty_dec($myrow["item_code"]); + qty_cell($myrow["qty_recd"], false, $dec); + qty_cell($myrow["quantity_inv"], false, $dec); + qty_cell($myrow["qty_recd"] - $myrow["quantity_inv"], false, $dec); amount_cell($myrow["unit_price"]); - amount_cell($myrow["unit_price"] * $myrow["quantity_inv"]); + amount_cell(round($myrow["unit_price"] * $myrow["quantity_inv"], user_price_dec())); end_row(); $i++; if ($i > 15) @@ -166,15 +163,16 @@ if (isset($_POST['grn_item_id']) && $_POST['grn_item_id'] != "") start_table("$table_style width=80%"); $th = array(_("Sequence #"), _("Item"), _("Qty Already Invoiced"), _("Quantity to Credit"), _("Order Price"), _("Credit Price")); - table_header($th); + table_header($th); start_row(); label_cell($_POST['grn_item_id']); label_cell($myrow['item_code'] . " " . $myrow['description']); - qty_cell($myrow["quantity_inv"]); - text_cells(null, 'This_QuantityCredited', max($myrow['quantity_inv'], 0), 13, 15); + $dec = get_qty_dec($myrow['item_code']); + qty_cell($myrow["quantity_inv"], false, $dec); + qty_cells(null, 'This_QuantityCredited', qty_format(max($myrow['quantity_inv'],0),$myrow['item_code'], $dec), null, null, $dec); amount_cell($myrow['unit_price']); - text_cells(null, 'ChgPrice', $myrow['unit_price'], 13, 15); + amount_cells(null, 'ChgPrice', price_format($myrow['unit_price'])); end_row(); end_table(1);