<?php
session_start();
error_reporting(0);
$user_name=$_SESSION['user_name'];
if(empty($user_name))
 {
 header("location:index.php");
 }

include_once("database_connection.php"); 
$sqlu="select id from user_tblsbifi where user_name='$user_name' " ;
$resultu=mysqli_query($conn,$sqlu);
$datau=mysqli_fetch_array($resultu);
$idu=$datau['id'];

?>
<html>
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>

 <link type="text/css" href="menu/menu_admin.css" rel="stylesheet" />
<script language="javascript" type="text/javascript" src="datetimepicker.js"></script>
</head>
<body>
<div class="background">
<form method ="post" action=""/>
<?php
if(isset($_POST['txtsubmit']) && $_POST['txtsubmit']=='REFRESH')
	{
		
		$_POST['dump_date']='';		
		$_POST['dump_date1']='';
		$_POST['loan_type']='';
		
}
if(isset($_POST['txtsubmit']) && $_POST['txtsubmit']=='Download Report')
	{
	$dump_date=$_POST['dump_date'];		
	$dump_date1=$_POST['dump_date1'];
	$loan_type=	$_POST['loan_type'];
	
	}

	include("header2.php");
	if(($_SESSION['unique_id']=='B'))
	{
	include("menu/menu_bank.php");
	}	
	else
	{
	header("location:index.php");
	}
	?>
	
	<table style="width:1000px;" align="center"  class="table table-bordered"   >
	<tr >
		<td style="width:250px;;"><font size="4">Product</font></td>
		<td><select name="loan_type" class="field"  style="width:350px; height:35px;" required >
			<option value="<?php echo $_POST['loan_type'];?>"><?php echo $_POST['loan_type'];?></option>
			<option value="Personal Loan">Personal Loan</option>
			<option value="Auto Loan">Auto Loan</option>
			<option value="Education Loan">Education Loan</option>
			<option value="Housing Loan">Housing Loan</option>
			<option value="Seller-FI">Seller-FI</option>
			<option value="BSV">BSV</option>
			<option value="ITR">ITR</option>
			<option value="ALL">ALL</option>
			</select>
		</td>			
		</tr>
		</table>
		<table style="width:1000px;" align="center"  class="table table-bordered"   >
		<tr>
		<td style="width:250px;;"><font size="4">Dates</font></td>
		<td><input type="text" name="dump_date" id="dump_date" class="field"  style="width:150px; height:35px;" value="<?php echo $_POST['dump_date'];?>" required /></td>
		<td><input type="text" name="dump_date1" id="dump_date1"  class="field"  style="width:150px; height:35px;" value="<?php echo $_POST['dump_date1'];?>" required /></td>
		</tr>
		<tr>
		<td style="width:250px;;"><font size="4">&nbsp;</font></td>
		<td><a href="javascript:NewCssCal('dump_date','ddmmmyyyy','dropdown',false)">&nbsp;<img src="images/cal.gif" style="width:16px; height:16px;" border="0" alt="Pick a date" ></a></td>
		<td><a href="javascript:NewCssCal('dump_date1','ddmmmyyyy','dropdown',false)">&nbsp;<img src="images/cal.gif" style="width:16px; height:16px;" border="0" alt="Pick a date" ></a></td>
		</tr>
		</table>
		<table  style="width:400px;" cellspacing="5" align="center">
			<tr>	
			<td><input type='submit' name='txtsubmit'  value="Download Report" id="searchbutton" /></td>
			</tr>
		</table>
		<table style="width:1000px;" align="center"  class="table table-bordered"   >
		<tr>
		<?php
		if($dump_date and $dump_date1  and $loan_type!="ALL")
		{
		$loan_type=strtoupper($loan_type);
		$dir=$dump_date.'/'.$dump_date1.'//'.$loan_type;
		$export='<a href="export_bankreport.php?id='. $dir.'">EXPORT</a>';
		?>
		<td align="center"><font size="4"><b><?php echo $export ; ?></b></font></td>
		<?php
		}
		elseif($dump_date and $dump_date1  and $loan_type=="ALL")
		{
		$loan_type=strtoupper($loan_type);
		$dir=$dump_date.'/'.$dump_date1;
		$export='<a href="export_bankreportallid.php?id='. $dir.'">EXPORT</a>';
		?>
		<td align="center"><font size="4"><b><?php echo $export ; ?></b></font></td>
		<?php
		}
		else
		{
		}
		?>
		</tr>
		</table>
		
			</form>
			</body>
			</html>

