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;
$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
{
$myrow = db_fetch_row($result);
$gl_act_name = $myrow[1];
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'],
input_num('amount'), $_POST['memo_']);
set_focus('gl_code');
}
}
//------------------------------------------------------------------------------------------------
$id = find_submit('Delete');
if ($id != -1)
{
$_SESSION['supp_trans']->remove_gl_codes_from_trans($id);
clear_fields();
$Ajax->activate('gl_items');
}
//------------------------------------------------------------------------------------------------
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
{
hyperlink_no_params("$path_to_root/purchasing/supplier_credit.php", _("Back to Credit Note Entry"));
}
echo "