X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=purchasing%2Fsupplier_invoice_grns.php;h=541a4c4da42b439417055114918a2d7c5af9993e;hb=8a53629bf51fc682489f6692ff4d6558a976c22c;hp=04aaaea7526dfce88f108eb2ed6cb05410dadd2e;hpb=431531eebf3ba494002cfbf7ea36f9e82d4975c0;p=fa-stable.git
diff --git a/purchasing/supplier_invoice_grns.php b/purchasing/supplier_invoice_grns.php
index 04aaaea7..541a4c4d 100644
--- a/purchasing/supplier_invoice_grns.php
+++ b/purchasing/supplier_invoice_grns.php
@@ -2,10 +2,9 @@
$page_security = 5;
$path_to_root="..";
-include_once($path_to_root . "/purchasing/includes/supp_trans_class.inc");
+include_once($path_to_root . "/purchasing/includes/supp_trans_class.inc");
include_once($path_to_root . "/includes/session.inc");
-
include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc");
include_once($path_to_root . "/purchasing/includes/purchasing_db.inc");
@@ -14,7 +13,6 @@ if ($use_date_picker)
$js .= get_js_date_picker();
page(_("Select Received Items to Add"), false, false, "", $js);
-
if (!isset($_SESSION['supp_trans']))
{
display_note("To enter supplier transactions the supplier must first be selected from the supplier selection screen, then the link to enter a supplier credit note must be clicked on.", 1, 0);;
@@ -33,42 +31,43 @@ function check_data()
{
global $check_price_charged_vs_order_price,
$check_qty_charged_vs_del_qty;
- if (!is_numeric($_POST['this_quantity_inv']))
- {
- display_error( _("The quantity to invoice must be numeric."));
- return false;
- }
-
- if ($_POST['this_quantity_inv'] <= 0)
+ if (!check_num('this_quantity_inv', 0) || input_num('this_quantity_inv')==0)
{
- display_error( _("The quantity to invoice must be greater than zero."));
+ display_error( _("The quantity to invoice must be numeric and greater than zero."));
+ set_focus('this_quantity_inv');
return false;
}
- if (!is_numeric($_POST['ChgPrice']))
+ if (!check_num('ChgPrice'))
{
display_error( _("The price is not numeric."));
+ set_focus('ChgPrice');
return false;
}
- if ($check_price_charged_vs_order_price == True)
+ if ($check_price_charged_vs_order_price == True)
{
- if ($_POST['ChgPrice']/$_POST['order_price'] >
- (1 + (sys_prefs::over_charge_allowance() / 100)))
- {
+ if ($_POST['order_price']!=input_num('ChgPrice')) {
+ if ($_POST['order_price']==0 ||
+ input_num('ChgPrice')/$_POST['order_price'] >
+ (1 + (sys_prefs::over_charge_allowance() / 100)))
+ {
display_error(_("The price being invoiced is more than the purchase order price by more than the allowed over-charge percentage. The system is set up to prohibit this. See the system administrator to modify the set up parameters if necessary.") .
_("The over-charge percentage allowance is :") . sys_prefs::over_charge_allowance() . "%");
+ set_focus('ChgPrice');
return false;
+ }
}
}
- if ($check_qty_charged_vs_del_qty == True)
+ if ($check_qty_charged_vs_del_qty == True)
{
- if ($_POST['this_quantity_inv'] / ($_POST['qty_recd'] - $_POST['prev_quantity_inv']) >
+ if (input_num('this_quantity_inv') / ($_POST['qty_recd'] - $_POST['prev_quantity_inv']) >
(1+ (sys_prefs::over_charge_allowance() / 100)))
{
display_error( _("The quantity being invoiced is more than the outstanding quantity by more than the allowed over-charge percentage. The system is set up to prohibit this. See the system administrator to modify the set up parameters if necessary.")
. _("The over-charge percentage allowance is :") . sys_prefs::over_charge_allowance() . "%");
+ set_focus('this_quantity_inv');
return false;
}
}
@@ -83,40 +82,38 @@ if (isset($_POST['AddGRNToTrans']))
if (check_data())
{
- if ($_POST['this_quantity_inv'] >= ($_POST['qty_recd'] - $_POST['prev_quantity_inv']))
+ if (input_num('this_quantity_inv') >= ($_POST['qty_recd'] - $_POST['prev_quantity_inv']))
{
- $complete = True;
- }
- else
+ $complete = true;
+ }
+ else
{
- $complete = False;
+ $complete = false;
}
- //$_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_quantity_inv'],
- // $_POST['order_price'], $_POST['ChgPrice'], $complete,
- // $_POST['std_cost_unit'], $_POST['gl_code']);
$_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_quantity_inv'],
- $_POST['order_price'], $_POST['ChgPrice'], $complete,
+ $_POST['prev_quantity_inv'], input_num('this_quantity_inv'),
+ $_POST['order_price'], input_num('ChgPrice'), $complete,
$_POST['std_cost_unit'], "");
}
}
//-----------------------------------------------------------------------------------------
-
-if (isset($_GET['Delete']))
+$id = find_submit('Delete');
+if ($id != -1)
{
- $_SESSION['supp_trans']->remove_grn_from_trans($_GET['Delete']);
+ $_SESSION['supp_trans']->remove_grn_from_trans($id);
+ $Ajax->activate('grn_items');
+ $Ajax->activate('grn_table');
}
//-----------------------------------------------------------------------------------------
-
+start_form(false,true);
display_grn_items($_SESSION['supp_trans'], 1);
-
+end_form();
echo "
";
+
hyperlink_no_params("$path_to_root/purchasing/supplier_invoice.php", _("Back to Supplier Invoice Entry"));
echo "