<?php
/**********************************************************************
***********************************************************************/
$page_security = 'SA_BANKTRANSVIEW';
$path_to_root="../..";
include_once($path_to_root . "/includes/session.inc");

include_once($path_to_root . "/includes/date_functions.inc");
include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/includes/data_checks.inc");

include_once($path_to_root . "/gl/includes/gl_db.inc");
include_once($path_to_root . "/gl/includes/ui/bank_inquiry_ui.inc");
include_once($path_to_root . "/includes/banking.inc");

$js = "";
if ($SysPrefs->use_popup_windows)
	$js .= get_js_open_window(800, 500);
if (user_use_date_picker())
	$js .= get_js_date_picker();
page(_($help_context = "Bank Statement"), isset($_GET['bank_account']), false, "", $js);

check_db_has_bank_accounts(_("There are no bank accounts defined in the system."));

//-----------------------------------------------------------------------------------
// Ajax updates
//
if (get_post('Show'))
{
	$Ajax->activate('trans_tbl');
}
//------------------------------------------------------------------------------------------------

if (isset($_GET['bank_account'])){
	$_POST['bank_account'] = $_GET['bank_account'];
}
if (isset($_GET['from_date']))
{
	$_POST['TransAfterDate'] = $_GET['from_date'];
}
if (isset($_GET['to_date']))
{
	$_POST['TransToDate'] = $_GET['to_date'];
}

display_bank_account_inquiry_filtering_controls();

//------------------------------------------------------------------------------------------------

if (!isset($_POST['bank_account']))
	$_POST['bank_account'] = "";

div_start('trans_tbl');
display_bank_account_inquiry_details($_POST['bank_account'], get_post('TransAfterDate'), get_post('TransToDate'),
                                        get_post('filtering_tran_type'), get_post('debit_credit'), get_post('reconciled_open'), 
                                        $_POST['person_type_id'], $_POST['gl_trans_type_id']);
div_end();
//------------------------------------------------------------------------------------------------

end_page();

?>
