<?php
/**********************************************************************
***********************************************************************/
$page_security = 'SA_BANKTRANSVIEW';
$path_to_root="..";

include($path_to_root . "/includes/session.inc");

$js = "";
if ($SysPrefs->use_popup_windows)
	$js .= get_js_open_window(800, 500);

$help_context = "Remove ".$systypes_array[ST_BATCH_BANK_TRANSFER_REQ]." entries";
page(_($help_context), true, false, "", $js);

include_once($path_to_root . "/includes/date_functions.inc");
include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/gl/includes/gl_db.inc");
include_once($path_to_root . "/gl/includes/ui/batch_bank_transfer_ui.inc");
include_once($path_to_root . "/gl/includes/ui/view_batch_bank_transfer_ui.inc");
include_once($path_to_root . "/gl/includes/db/batch_bank_transfer_db.inc");

if (isset($_GET["trans_no"])){

	$_POST["trans_no"] = $_GET["trans_no"];
}
if (isset($_POST["trans_no"])){

	$trans_no = $_POST["trans_no"];
}

$type_id = ST_BATCH_BANK_TRANSFER_REQ;

display_heading("Remove ".$systypes_array[$type_id] . " #".$trans_no." Entries");

if(isset($_POST['Remove_BBT_Entries'])){
    handle_remove_batch_bank_transfer_entries($type_id, $trans_no);
}

$Ajax->activate('trans_remove');
start_form();

div_start('trans_remove');

$removed = view_batch_bank_transfer(ST_BATCH_BANK_TRANSFER_REQ, $trans_no);

br();

hidden("trans_no",$_POST["trans_no"]);

if($removed){
    $message = "All transactions of this ".$systypes_array[$type_id]." have been removed";
    display_note($message, 0, 0, "style=red");
}else{
    submit_center_first('Remove_BBT_Entries', _("Remove All Entries"), '', 'default');
}

div_end();

br();


end_form();

br();


end_page(@$_GET['popup'], false, false);
?>