X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=purchasing%2Fsupplier_trans_gl.php;h=64dc49aa561d4d143c7dc83cf3f46dde155d61c2;hb=e28f3fe01f168d761393ce2f10409284eef2adb4;hp=903dc56980ba1b91e14e71972d5368fc3880fca8;hpb=431531eebf3ba494002cfbf7ea36f9e82d4975c0;p=fa-stable.git
diff --git a/purchasing/supplier_trans_gl.php b/purchasing/supplier_trans_gl.php
index 903dc569..64dc49aa 100644
--- a/purchasing/supplier_trans_gl.php
+++ b/purchasing/supplier_trans_gl.php
@@ -3,10 +3,10 @@
$page_security=5;
$path_to_root="..";
-include($path_to_root . "/purchasing/includes/supp_trans_class.inc");
-include($path_to_root . "/includes/session.inc");
+include_once($path_to_root . "/purchasing/includes/supp_trans_class.inc");
+include_once($path_to_root . "/includes/session.inc");
-include($path_to_root . "/purchasing/includes/purchasing_ui.inc");
+include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc");
$js = "";
if ($use_date_picker)
$js .= get_js_date_picker();
@@ -21,77 +21,88 @@ if (!isset($_SESSION['supp_trans']))
}
//------------------------------------------------------------------------------------------------
-
-function clear_fields()
+function clear_fields()
{
+ global $Ajax;
+
unset($_POST['gl_code']);
unset($_POST['dimension_id']);
unset($_POST['dimension2_id']);
unset($_POST['amount']);
unset($_POST['memo_']);
- unset($_POST['AcctSelection']);
- unset($_POST['AddGLCodeToTrans']);
+ unset($_POST['AddGLCodeToTrans']);
+ $Ajax->activate('gl_ctrls');
+ set_focus('gl_code');
}
-
//------------------------------------------------------------------------------------------------
+// GL postings are often entered in the same form to two accounts
+// so fileds are cleared only on user demand.
+//
+if (isset($_POST['ClearFields']))
+{
+ clear_fields();
+}
if (isset($_POST['AddGLCodeToTrans'])){
+ $Ajax->activate('gl_items');
$input_error = false;
- if (!isset($_POST['gl_code']))
- {
- $_POST['gl_code'] = $_POST['AcctSelection'];
- }
- $sql = "SELECT account_code, account_name FROM ".TB_PREF."chart_master WHERE account_code=" . $_POST['gl_code'];
+ $sql = "SELECT account_code, account_name FROM ".TB_PREF."chart_master WHERE account_code='" . $_POST['gl_code'] . "'";
$result = db_query($sql,"get account information");
if (db_num_rows($result) == 0)
{
display_error(_("The account code entered is not a valid code, this line cannot be added to the transaction."));
+ set_focus('gl_code');
$input_error = true;
- }
- else
+ }
+ else
{
$myrow = db_fetch_row($result);
$gl_act_name = $myrow[1];
- if (!is_numeric($_POST['amount']))
+ if (!check_num('amount'))
{
display_error(_("The amount entered is not numeric. This line cannot be added to the transaction."));
+ set_focus('amount');
$input_error = true;
}
}
if ($input_error == false)
{
- $_SESSION['supp_trans']->add_gl_codes_to_trans($_POST['gl_code'], $gl_act_name,
- $_POST['dimension_id'], $_POST['dimension2_id'], $_POST['amount'], $_POST['memo_']);
- clear_fields();
+ $_SESSION['supp_trans']->add_gl_codes_to_trans($_POST['gl_code'], $gl_act_name,
+ $_POST['dimension_id'], $_POST['dimension2_id'],
+ input_num('amount'), $_POST['memo_']);
+ set_focus('gl_code');
}
}
//------------------------------------------------------------------------------------------------
-if (isset($_GET['Delete']))
+$id = find_submit('Delete');
+if ($id != -1)
{
- $_SESSION['supp_trans']->remove_gl_codes_from_trans($_GET['Delete']);
- clear_fields();
+ $_SESSION['supp_trans']->remove_gl_codes_from_trans($id);
+ clear_fields();
+ $Ajax->activate('gl_items');
}
//------------------------------------------------------------------------------------------------
-display_heading($_SESSION['supp_trans']->supplier_name);
+display_heading($_SESSION['supp_trans']->supplier_name);
+start_form(false,true);
display_gl_items($_SESSION['supp_trans'], 1);
-
+end_form();
echo "
";
if ($_SESSION['supp_trans']->is_invoice == true)
{
hyperlink_no_params("$path_to_root/purchasing/supplier_invoice.php", _("Back to Invoice Entry"));
-}
-else
+}
+else
{
- hyperlink_no_params("$path_to_root/purchasing/supplier_credit.php", _("Back to Credit Note Entry"));
+ hyperlink_no_params("$path_to_root/purchasing/supplier_credit.php", _("Back to Credit Note Entry"));
}
echo "