<?php include "layouts/menu.php"; ?>
<script>
	function autocomplet() {
	var min_length = 0; // min caracters to display the autocomplete
	var keyword = $('#did').val();
	if (keyword.length >= min_length) {
		$.ajax({
			url: 'ajax_refresh.php',
			type: 'POST',
			data: {keyword:keyword},
			success:function(data){
				$('#country_list_id').show();
				$('#country_list_id').html(data);
			}
		});
	} else {
		$('#country_list_id').hide();
	}
}
function set_item(item) {
	// change input value
	$('#did').val(item);
	// hide proposition list
	$('#country_list_id').hide();
}
	</script>
	 <script>
	function autocomp() {
	var min_length = 0; // min caracters to display the autocomplete
	var keyword = $('#didn').val();
	if (keyword.length >= min_length) {
		$.ajax({
			url: 'ajax_sname.php',
			type: 'POST',
			data: {keyword:keyword},
			success:function(data){
				$('#dname').show();
				$('#dname').html(data);
			}
		});
	} else {
		$('#dname').hide();
	}
}

// set_item : this function will be executed when we select an item
function set_itemm(item) {
	// change input value
	$('#didn').val(item);
	// hide proposition list
	$('#dname').hide();
}
	</script>
 <script>
	function autocomplett() {
	var min_length = 0; // min caracters to display the autocomplete
	var keyword = $('#zxcvb').val();
	if (keyword.length >= min_length) {
		$.ajax({
			url: 'ajax_refreshq.php',
			type: 'POST',
			data: {keyword:keyword},
			success:function(data){
				$('#qwertyu').show();
				$('#qwertyu').html(data);
			}
		});
	} else {
		$('#qwertyu').hide();
	}
}
// set_item : this function will be executed when we select an item
function set_itemmm(item) {
	// change input value
	$('#zxcvb').val(item);
	// hide proposition list
	$('#qwertyu').hide();
}
	</script>
  <!--  page-wrapper -->
           <div class="right_col" role="main">
         


            <div class="clearfix"></div>

            <div class="clearfix"></div>

            <div class="row">
			
           <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title" >
                    <h2>Customer Details <small></small></h2>
                    <ul class="nav navbar-right panel_toolbox">
                      <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                      </li>
                      <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                        <ul class="dropdown-menu" role="menu">
                          <li><a href="#">Settings 1</a>
                          </li>
                          <li><a href="#">Settings 2</a>
                          </li>
                        </ul>
                      </li>
                      <li><a class="close-link"><i class="fa fa-close"></i></a>
                      </li>
                    </ul>
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
                    <div class="row">
                      <div class="col-sm-12">
                        <div class="card-box table-responsive">		
<?php
			  
  $hpls=$_REQUEST['hpls'];
  $vname=$_REQUEST['vname'];
  $area=$_REQUEST['area'];
  $areag=$_REQUEST['areag'];
  $broker=$_REQUEST['brk'];
  $com=$_REQUEST['com'];
  $vtype=$_REQUEST['vtype'];
  $dealer=$_REQUEST['dealer'];
  
   $hpdate=$_REQUEST['hpdate'];
  $hpdate1=$_REQUEST['hpdate1'];
  $pendue=$_REQUEST['pendue'];
  $pendue1=$_REQUEST['pendue1'];
  $hlamt=$_REQUEST['hlamt'];
  $hlamt1=$_REQUEST['hlamt1'];
  $defamt=$_REQUEST['defamt'];
  $defamt1=$_REQUEST['defamt1'];
   $penamt=$_REQUEST['penamt'];
  $penamt1=$_REQUEST['penamt1'];
  $paiddue=$_REQUEST['paiddue'];
  $paiddue1=$_REQUEST['paiddue1'];
  $baldue=$_REQUEST['baldue'];
  $baldue1=$_REQUEST['baldue1'];
  $dueday=$_REQUEST['dueday'];
  $dueday1=$_REQUEST['dueday1'];

if(($area ==NULL)&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($com!='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where mfin='$com' order by fname asc");
	$mess = "Pending Due From ".$com;
}
elseif(($area ==NULL)&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($com=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending order by fname asc");
	$mess = "Pending Due From All Company";
}
elseif(($area ==NULL)&&($areag !='None'))
{
echo "sdvfsd";
	$sql=mysqli_query($conn, "select * from pending where star='$areag' order by fname asc");
	$mess = "Pending in Scheme ".$areag;
}
elseif(($area ==NULL)&&($areag =='None')&&($hpdate !=NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($com!='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where ddate between '$hpdate' and '$hpdate1' && mfin='$com' order by fname asc");
	$mess = "Pending Loan Date From ".$hpdate." to ".$hpdate1;
	
}
elseif(($area ==NULL)&&($areag =='None')&&($hpdate !=NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($com=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where ddate between '$hpdate' and '$hpdate1' order by fname asc");
	$mess = "Pending Loan Date From ".$hpdate." to ".$hpdate1;

}
elseif(($area ==NULL)&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname!='None')&&($dealer=='None')&&($com!='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending  where vname='$vname' && mfin='$com' order by fname asc");
	$mess = "Pending Due Veh Name ".$vname." From ".$com;
}
elseif(($area ==NULL)&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname!='None')&&($dealer=='None')&&($com=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where vname='$vname' order by fname asc");
	$mess = "Pending Due Veh Name ".$vname." From All Company";
}
elseif(($area ==NULL)&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($com!='None')&&($broker!='None'))
{
	$sql=mysqli_query($conn, "select * from pending where mfin='$com' && bname='$broker' order by fname asc");
	$mess = "Pending Due Broker ".$broker." From ".$com;
}
elseif(($area ==NULL)&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($com=='None')&&($broker!='None'))
{
	$sql=mysqli_query($conn, "select * from pending where bname='$broker' order by fname asc");
	$mess = "Pending Due Broker ".$broker." From All Company";
}
elseif(($area ==NULL)&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer!='None')&&($com!='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where mfin='$com' && dealer='$dealer' order by fname asc");
	$mess = "Pending Due Dealer ".$dealer." From ".$com;
}
elseif(($area ==NULL)&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer!='None')&&($com=='None')&&($broker=='None'))
{
		$sql=mysqli_query($conn, "select * from pending where dealer='$dealer' order by fname asc");
	$mess = "Pending Due Dealer ".$dealer." From All Company";
}

elseif(($area !=NULL)&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($com!='None')&&($broker='None'))
{
	$sql=mysqli_query($conn, "select * from pending where mfin='$com' && area LIKE '%$area%' order by fname asc");
	$mess = "Pending Due Area ".$area." Broker ".$broker." From ".$com;
}
elseif(($area !=NULL)&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($com=='None')&&($broker!='None'))
{
	$sql=mysqli_query($conn, "select * from pending where bname='$broker' && area LIKE '%$area%' order by fname asc");
	$mess = "Pending Due Area ".$area." Broker ".$broker." From All Company";
}
elseif(($area !=NULL)&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer!='None')&&($com!='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where mfin='$com' && dealer='$dealer' && area LIKE '%$area%' order by fname asc");
	$mess = "Pending Due Area ".$area." Dealer ".$dealer." From ".$com;
}
elseif(($area !=NULL)&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer!='None')&&($com=='None')&&($broker=='None'))
{
		$sql=mysqli_query($conn, "select * from pending where dealer='$dealer' && area LIKE '%$area%' order by fname asc");
	$mess = "Pending Due Area ".$area." Dealer ".$dealer." From All Company";
}

elseif(($area ==NULL)&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype !='None')&&($vname=='None')&&($dealer=='None')&&($com!='None')&&($broker=='None'))
{
	header("location:pendingvt.php?hpls=$hpls&vtype=$vtype&area=$area&areag=$areag&vname=$vname&dealer=$dealer&brk=$brk&com=$com&hpdate=$hpdate&hpdate1=$hpdate1&pendue=$pendue&pendue1=$pendue1&hlamt=$hlamt&hlamt1=$hlamt1&defamt=$defamt&defamt1=$defamt1&penamt=$penamt&penamt1=$penamt1&paiddue=$paiddue&paiddue1=$paiddue1&baldue=$baldue&baldue1=$baldue1&dueday=$dueday&dueday1=$dueday1"); }


elseif(($area ==NULL)&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype !='None')&&($vname=='None')&&($dealer=='None')&&($com=='None')&&($broker=='None'))
{
	header("location:pendingvt.php?hpls=$hpls&vtype=$vtype&area=$area&areag=$areag&vname=$vname&dealer=$dealer&brk=$brk&com=$com&hpdate=$hpdate&hpdate1=$hpdate1&pendue=$pendue&pendue1=$pendue1&hlamt=$hlamt&hlamt1=$hlamt1&defamt=$defamt&defamt1=$defamt1&penamt=$penamt&penamt1=$penamt1&paiddue=$paiddue&paiddue1=$paiddue1&baldue=$baldue&baldue1=$baldue1&dueday=$dueday&dueday1=$dueday1"); }



elseif(($area !=NULL)&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($com=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where area LIKE '%$area%' order by fname asc");
	$mess = "Pending Due From All Company Area ".$area;
}
elseif(($area !=NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where area LIKE '%$area%' && mfin='$com' order by fname asc");
	$mess = "Pending Due From ".$com." Area ".$area;
}
elseif(($area !=NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue !=NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where pendmnt>='$pendue' && pendmnt<='$pendue1' && mfin='$com' order by fname asc");
	$mess = "Pending Due From ".$com." Days From".$pendue." To ".$pendue1;
}
elseif(($area !=NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue !=NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where area LIKE '%$area%' && mfin='$com' order by fname asc");
	$mess = "Pending Due From All Company - Area ".$area." Pending Due From".$pendue." To ".$pendue1;
}
elseif(($area ==NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue !=NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where  mfin='$com' && pendmnt>=$pendue && pendmnt<=$pendue1 order by fname asc");
	$mess = "Pending Due From ".$com." Pending Due From".$pendue." To ".$pendue1;
}
elseif(($area ==NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue !=NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where pendmnt>=$pendue && pendmnt<=$pendue1 order by fname asc");
	$mess = "Pending Due From All Company Pending Due From".$pendue." To ".$pendue1;
}
elseif(($area ==NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue !=NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer!='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where  mfin='$com' && dealer='$dealer' && pendmnt>=$pendue && pendmnt<=$pendue1 order by fname asc");
	$mess = "Pending Due From ".$com." Dealer ".$dealer." Pending Due From".$pendue." To ".$pendue1;
}
elseif(($area ==NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue !=NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer!='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where dealer='$dealer' && pendmnt>=$pendue && pendmnt<=$pendue1 order by fname asc");
	$mess = "Pending Due From All Company Dealer ".$dealer." Pending Due From".$pendue." To ".$pendue1;
}
elseif(($area ==NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue !=NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker!='None'))
{
	$sql=mysqli_query($conn, "select * from pending where  mfin='$com' && bname='$broker' && pendmnt>=$pendue && pendmnt<=$pendue1 order by fname asc");
	$mess = "Pending Due From ".$com." Broker ".$broker." Pending Due From".$pendue." To ".$pendue1;
}
elseif(($area ==NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue !=NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker!='None'))
{
	$sql=mysqli_query($conn, "select * from pending where bname='$broker' && pendmnt>=$pendue && pendmnt<=$pendue1 order by fname asc");
	$mess = "Pending Due From All Company Broker ".$broker." Pending Due From".$pendue." To ".$pendue1;
}
elseif(($area ==NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue !=NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype !='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
header("location:pendingvt.php?hpls=$hpls&vtype=$vtype&area=$area&areag=$areag&vname=$vname&dealer=$dealer&brk=$brk&com=$com&hpdate=$hpdate&hpdate1=$hpdate1&pendue=$pendue&pendue1=$pendue1&hlamt=$hlamt&hlamt1=$hlamt1&defamt=$defamt&defamt1=$defamt1&penamt=$penamt&penamt1=$penamt1&paiddue=$paiddue&paiddue1=$paiddue1&baldue=$baldue&baldue1=$baldue1&dueday=$dueday&dueday1=$dueday1"); }

elseif(($area ==NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue !=NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype !='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
header("location:pendingvt.php?hpls=$hpls&vtype=$vtype&area=$area&areag=$areag&vname=$vname&dealer=$dealer&brk=$brk&com=$com&hpdate=$hpdate&hpdate1=$hpdate1&pendue=$pendue&pendue1=$pendue1&hlamt=$hlamt&hlamt1=$hlamt1&defamt=$defamt&defamt1=$defamt1&penamt=$penamt&penamt1=$penamt1&paiddue=$paiddue&paiddue1=$paiddue1&baldue=$baldue&baldue1=$baldue1&dueday=$dueday&dueday1=$dueday1"); }





elseif(($area ==NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday !=NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where  mfin='$com' && dd>=$dueday && dd<=$dueday1 order by fname asc");
	$mess = "Pending Due From ".$com." Due Day From ".$dueday." To ".$dueday1;
}
elseif(($area ==NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday !=NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where dd>=$dueday && dd<=$dueday1 order by fname asc");
	$mess = "Pending Due From All Company Due Day From ".$dueday." To ".$dueday1;
}
elseif(($area !=NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday !=NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where area LIKE '%$area%' && mfin='$com' && dd>=$dueday && dd<=$dueday1 order by fname asc");
	$mess = "Pending Due From ".$com." Area ".$area." Due Day From".$dueday." To ".$dueday1;
}
elseif(($area !=NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday !=NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where area LIKE '%$area%' && mfin='$com' && dd>=$dueday && dd<=$dueday1 order by fname asc");
	$mess = "Pending Due From All Company - Area ".$area." Due Day From".$dueday." To ".$dueday1;
}
elseif(($area ==NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday !=NULL)&&($vtype =='None')&&($vname=='None')&&($dealer!='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where  mfin='$com' && dealer='$dealer' && dd>=$dueday && dd<=$dueday1 order by fname asc");
	$mess = "Pending Due From ".$com." Dealer ".$dealer." Due Day From".$dueday." To ".$dueday1;
}
elseif(($area ==NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday !=NULL)&&($vtype =='None')&&($vname=='None')&&($dealer!='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where dealer='$dealer'  && dd>=$dueday && dd<=$dueday1 order by fname asc");
	$mess = "Pending Due From All Company Dealer ".$dealer." Due Day From".$dueday." To ".$dueday1;
}
elseif(($area ==NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday !=NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker!='None'))
{
	$sql=mysqli_query($conn, "select * from pending where  mfin='$com' && bname='$broker'  && dd>=$dueday && dd<=$dueday1 order by fname asc");
	$mess = "Pending Due From ".$com." Broker ".$broker." Due Day From".$dueday." To ".$dueday1;
}
elseif(($area ==NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday !=NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker!='None'))
{
	$sql=mysqli_query($conn, "select * from pending where bname='$broker' && dd>=$dueday && dd<=$dueday1 order by fname asc");
	$mess = "Pending Due From All Company Broker ".$broker." Due Day From".$dueday." To ".$dueday1;
}
elseif(($area ==NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday !=NULL)&&($vtype !='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
header("location:pendingvt.php?hpls=$hpls&vtype=$vtype&area=$area&areag=$areag&vname=$vname&dealer=$dealer&brk=$brk&com=$com&hpdate=$hpdate&hpdate1=$hpdate1&pendue=$pendue&pendue1=$pendue1&hlamt=$hlamt&hlamt1=$hlamt1&defamt=$defamt&defamt1=$defamt1&penamt=$penamt&penamt1=$penamt1&paiddue=$paiddue&paiddue1=$paiddue1&baldue=$baldue&baldue1=$baldue1&dueday=$dueday&dueday1=$dueday1"); }

elseif(($area ==NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday !=NULL)&&($vtype !='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
header("location:pendingvt.php?hpls=$hpls&vtype=$vtype&area=$area&areag=$areag&vname=$vname&dealer=$dealer&brk=$brk&com=$com&hpdate=$hpdate&hpdate1=$hpdate1&pendue=$pendue&pendue1=$pendue1&hlamt=$hlamt&hlamt1=$hlamt1&defamt=$defamt&defamt1=$defamt1&penamt=$penamt&penamt1=$penamt1&paiddue=$paiddue&paiddue1=$paiddue1&baldue=$baldue&baldue1=$baldue1&dueday=$dueday&dueday1=$dueday1"); }
elseif(($area ==NULL)&&($areag !='None')&&($hpdate ==NULL)&&($pendue !=NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
header("location:sspend00g.php?due=$pendue&due2=$pendue1&area=$areag"); }
elseif(($hpls !=NULL)&&($area ==NULL)&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
header("location:pendhh.php?hpl=$hpls"); }






elseif(($area ==NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt !=NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where  mfin='$com' && penamt>=$penamt && penamt<=$penamt1 order by fname asc");
	$mess = "Pending Due From ".$com." Pending Amt From".$penamt." To ".$penamt1;
}
elseif(($area ==NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt !=NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where penamt>=$penamt && penamt<=$penamt1 order by fname asc");
	$mess = "Pending Due From All Company Pending Amt From".$penamt." To ".$penamt1;
}

elseif(($area ==NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt !=NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where  mfin='$com' && vno>=$hlamt && vno<=$hlamt1 order by fname asc");
	$mess = "Pending Due From ".$com." Principle Pending Amt From".$hlamt." To ".$hlamt1;
}
elseif(($area ==NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt !=NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where vno>=$hlamt && vno<=$hlamt1 order by fname asc");
	$mess = "Pending Due From All Company  Principle Pending Amt From".$hlamt." To ".$hlamt1;
}

elseif(($area ==NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt !=NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where  mfin='$com' && vname>=$defamt && vname<=$defamt1 order by fname asc");
	$mess = "Pending Due From ".$com." Principle Pending Amt From".$defamt." To ".$defamt1;
}
elseif(($area ==NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt !=NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where vname>=$defamt && vname<=$defamt1 order by fname asc");
	$mess = "Pending Due From All Company  Principle Pending Amt From".$defamt." To ".$defamt1;
}



elseif(($area !=NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt !=NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where area LIKE '%$area%' && mfin='$com' && penamt>=$penamt && penamt>=$penamt1 order by fname asc");
	$mess = "Pending Due From ".$com." Area ".$area." Pending Amt From".$penamt." To ".$penamt1;
}
elseif(($area !=NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt !=NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where area LIKE '%$area%' && mfin='$com' && penamt>=$penamt && penamt>=$penamt1 order by fname asc");
	$mess = "Pending Due From All Company - Area ".$area." Pending Amt From".$penamt." To ".$penamt1;
}
elseif(($area ==NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt !=NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer!='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where  mfin='$com' && dealer='$dealer' && penamt>=$penamt && penamt>=$penamt1 order by fname asc");
	$mess = "Pending Due From ".$com." Dealer ".$dealer." Pending Amt From".$penamt." To ".$penamt1;
}
elseif(($area ==NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt !=NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer!='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where dealer='$dealer'  && penamt>=$penamt && penamt>=$penamt1 order by fname asc");
	$mess = "Pending Due From All Company Dealer ".$dealer." Pending Amt From".$penamt." To ".$penamt1;
}
elseif(($area ==NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt !=NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker!='None'))
{
	$sql=mysqli_query($conn, "select * from pending where  mfin='$com' && bname='$broker'  && penamt>=$penamt && penamt>=$penamt1 order by fname asc");
	$mess = "Pending Due From ".$com." Broker ".$broker." Pending Amt From".$penamt." To ".$penamt1;
}
elseif(($area ==NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt !=NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker!='None'))
{
	$sql=mysqli_query($conn, "select * from pending where bname='$broker' && penamt>=$penamt && penamt>=$penamt1 order by fname asc");
	$mess = "Pending Due From All Company Broker ".$broker." Pending Amt From".$penamt." To ".$penamt1;
}






elseif(($area ==NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt !=NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where  mfin='$com' && defamt>=$defamt && defamt>=$defamt1 order by fname asc");
	$mess = "Pending Due From ".$com." Default Amt From".$penamt." To ".$penamt1;
}
elseif(($area ==NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt !=NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where defamt>=$defamt && defamt>=$defamt1 order by fname asc");
	$mess = "Pending Due From All Company Default Amt From".$penamt." To ".$penamt1;
}
elseif(($area !=NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt !=NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where area LIKE '%$area%' && mfin='$com' && defamt>=$defamt && defamt>=$defamt1 order by fname asc");
	$mess = "Pending Due From ".$com." Area ".$area." Default Amt From".$penamt." To ".$penamt1;
}
elseif(($area !=NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt !=NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where area LIKE '%$area%' && mfin='$com' && defamt>=$defamt && defamt>=$defamt1 order by fname asc");
	$mess = "Pending Due From All Company - Area ".$area." Default Amt From".$penamt." To ".$penamt1;
}
elseif(($area ==NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt !=NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer!='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where  mfin='$com' && dealer='$dealer' && defamt>=$defamt && defamt>=$defamt1 order by fname asc");
	$mess = "Pending Due From ".$com." Dealer ".$dealer." Default Amt From".$penamt." To ".$penamt1;
}
elseif(($area ==NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt !=NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer!='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where dealer='$dealer'  && defamt>=$defamt && defamt>=$defamt1 order by fname asc");
	$mess = "Pending Due From All Company Dealer ".$dealer." Default Amt From".$penamt." To ".$penamt1;
}
elseif(($area ==NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt !=NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker!='None'))
{
	$sql=mysqli_query($conn, "select * from pending where  mfin='$com' && bname='$broker'  && defamt>=$defamt && defamt>=$defamt1 order by fname asc");
	$mess = "Pending Due From ".$com." Broker ".$broker." Default Amt From".$penamt." To ".$penamt1;
}
elseif(($area ==NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt !=NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker!='None'))
{
	$sql=mysqli_query($conn, "select * from pending where bname='$broker' && defamt>=$defamt && defamt>=$defamt1 order by fname asc");
	$mess = "Pending Due From All Company Broker ".$broker." Default Amt From".$penamt." To ".$penamt1;
} 






elseif(($area ==NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt !=NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where  mfin='$com' && hloan>=$hlamt && hloan>=$hlamt1 order by fname asc");
	$mess = "Pending Due From ".$com." HL Amt From".$hlamt." To ".$hlamt1;
}
elseif(($area ==NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt !=NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where hloan>=$hlamt && hloan>=$hlamt1 order by fname asc");
	$mess = "Pending Due From All Company HL Amt From".$hlamt." To ".$hlamt1;
}
elseif(($area !=NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt !=NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where area LIKE '%$area%' && mfin='$com' && hloan>=$hlamt && hloan>=$hlamt1 order by fname asc");
	$mess = "Pending Due From ".$com." Area ".$area." HL Amt From".$hlamt." To ".$hlamt1;
}
elseif(($area !=NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt !=NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where area LIKE '%$area%' && mfin='$com' && hloan>=$hlamt && hloan>=$hlamt1 order by fname asc");
	$mess = "Pending Due From All Company - Area ".$area." HL Amt From".$hlamt." To ".$hlamt1;
}
elseif(($area ==NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt !=NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer!='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where  mfin='$com' && dealer='$dealer' && hloan>=$hlamt && hloan>=$hlamt1 order by fname asc");
	$mess = "Pending Due From ".$com." Dealer ".$dealer." HL Amt From".$hlamt." To ".$hlamt1;
}
elseif(($area ==NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt !=NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer!='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where dealer='$dealer'  && hloan>=$hlamt && hloan>=$hlamt1 order by fname asc");
	$mess = "Pending Due From All Company Dealer ".$dealer." HL Amt From".$hlamt." To ".$hlamt1;
}
elseif(($area ==NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt !=NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker!='None'))
{
	$sql=mysqli_query($conn, "select * from pending where  mfin='$com' && bname='$broker'  && hloan>=$hlamt && hloan>=$hlamt1 order by fname asc");
	$mess = "Pending Due From ".$com." Broker ".$broker." HL Amt From".$hlamt." To ".$hlamt1;
}
elseif(($area ==NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt !=NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker!='None'))
{
	$sql=mysqli_query($conn, "select * from pending where bname='$broker' && hloan>=$hlamt && hloan>=$hlamt1 order by fname asc");
	$mess = "Pending Due From All Company Broker ".$broker." HL Amt From".$hlamt." To ".$hlamt1;
}




elseif(($area ==NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue !=NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where  mfin='$com' && paiddue>=$hlamt && paymnt>=$paiddue1 order by fname asc");
	$mess = "Pending Due From ".$com." Paid Due From".$paiddue." To ".$paiddue1;
}
elseif(($area ==NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue !=NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where paiddue>=$hlamt && paymnt>=$paiddue1 order by fname asc");
	$mess = "Pending Due From All Company Paid Due From".$paiddue." To ".$paiddue1;
}
elseif(($area !=NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue !=NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where area LIKE '%$area%' && mfin='$com' && paiddue>=$hlamt && paymnt>=$paiddue1 order by fname asc");
	$mess = "Pending Due From ".$com." Area ".$area." Paid Due From".$paiddue." To ".$paiddue1;
}
elseif(($area !=NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue !=NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where area LIKE '%$area%' && mfin='$com' && paiddue>=$hlamt && paymnt>=$paiddue1 order by fname asc");
	$mess = "Pending Due From All Company - Area ".$area." Paid Due From".$paiddue." To ".$paiddue1;
}
elseif(($area ==NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue !=NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer!='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where  mfin='$com' && dealer='$dealer' && paiddue>=$hlamt && paymnt>=$paiddue1 order by fname asc");
	$mess = "Pending Due From ".$com." Dealer ".$dealer." Paid Due From".$paiddue." To ".$paiddue1;
}
elseif(($area ==NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue !=NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer!='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where dealer='$dealer'  && paiddue>=$hlamt && paymnt>=$paiddue1 order by fname asc");
	$mess = "Pending Due From All Company Dealer ".$dealer." Paid Due From".$paiddue." To ".$paiddue1;
}
elseif(($area ==NULL)&&($com!='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue !=NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker!='None'))
{
	$sql=mysqli_query($conn, "select * from pending where  mfin='$com' && bname='$broker'  && paiddue>=$hlamt && paymnt>=$paiddue1 order by fname asc");
	$mess = "Pending Due From ".$com." Broker ".$broker." Paid Due From".$paiddue." To ".$paiddue1;
}
elseif(($area ==NULL)&&($com=='None')&&($areag =='None')&&($hpdate ==NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue !=NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker!='None'))
{
	$sql=mysqli_query($conn, "select * from pending where bname='$broker' && paiddue>=$hlamt && paymnt>=$paiddue1 order by fname asc");
	$mess = "Pending Due From All Company Broker ".$broker." Paid Due From".$paiddue." To ".$paiddue1;
}




elseif(($area ==NULL)&&($com!='None')&&($areag =='None')&&($hpdate !=NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where  mfin='$com' && hpdate>=$hpdate && hpdate>=$hpdate1 order by fname asc");
	$mess = "Pending Due From ".$com." HP Date From".$hpdate." To ".$hpdate1;
}
elseif(($area ==NULL)&&($com=='None')&&($areag =='None')&&($hpdate !=NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where hpdate>=$hpdate && hpdate>=$hpdate1 order by fname asc");
	$mess = "Pending Due From All Company HP Date From".$hpdate." To ".$hpdate1;
}
elseif(($area !=NULL)&&($com!='None')&&($areag =='None')&&($hpdate !=NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where area LIKE '%$area%' && mfin='$com' && hpdate>=$hpdate && hpdate>=$hpdate1 order by fname asc");
	$mess = "Pending Due From ".$com." Area ".$area." HP Date From".$hpdate." To ".$hpdate1;
}
elseif(($area !=NULL)&&($com=='None')&&($areag =='None')&&($hpdate !=NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where area LIKE '%$area%' && mfin='$com' && hpdate>=$hpdate && hpdate>=$hpdate1 order by fname asc");
	$mess = "Pending Due From All Company - Area ".$area." HP Date From".$hpdate." To ".$hpdate1;
}
elseif(($area ==NULL)&&($com!='None')&&($areag =='None')&&($hpdate !=NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer!='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where  mfin='$com' && dealer='$dealer' && hpdate>=$hpdate && hpdate>=$hpdate1 order by fname asc");
	$mess = "Pending Due From ".$com." Dealer ".$dealer." HP Date From".$hpdate." To ".$hpdate1;
}
elseif(($area ==NULL)&&($com=='None')&&($areag =='None')&&($hpdate !=NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer!='None')&&($broker=='None'))
{
	$sql=mysqli_query($conn, "select * from pending where dealer='$dealer'  && hpdate>=$hpdate && hpdate>=$hpdate1 order by fname asc");
	$mess = "Pending Due From All Company Dealer ".$dealer." HP Date From".$hpdate." To ".$hpdate1;
}
elseif(($area ==NULL)&&($com!='None')&&($areag =='None')&&($hpdate !=NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker!='None'))
{
	$sql=mysqli_query($conn, "select * from pending where  mfin='$com' && bname='$broker'  && hpdate>=$hpdate && hpdate>=$hpdate1 order by fname asc");
	$mess = "Pending Due From ".$com." Broker ".$broker." HP Date From".$hpdate." To ".$hpdate1;
}
elseif(($area ==NULL)&&($com=='None')&&($areag =='None')&&($hpdate !=NULL)&&($pendue ==NULL)&&($hlamt ==NULL)&&($defamt ==NULL)&&($penamt ==NULL)&&($paiddue ==NULL)&&($baldue ==NULL)&&($dueday ==NULL)&&($vtype =='None')&&($vname=='None')&&($dealer=='None')&&($broker!='None'))
{
	$sql=mysqli_query($conn, "select * from pending where bname='$broker' && hpdate>=$hpdate && hpdate>=$hpdate1 order by fname asc");
	$mess = "Pending Due From All Company Broker ".$broker." HP Date From".$hpdate." To ".$hpdate1;
}

$n = mysqli_num_rows($sql);
 
						if($n==0)
						{
						echo "Nothing To Display";
						}
						else
					        { 
						?></p>						
  <table id="datatable-buttons" id="datatable-buttons" class="table table-striped table-bordered">  
					<thead> <tr class="alert alert-danger"><th colspan="14"><center><h4><b><?php echo $mess; ?></b><h4></center></th> </tr>
						<tr><th>S.No</th>
						<th>Loan No</th>
						<th>Name</th>
	<th>Phone</th>
	<th>LoanDate</th>


						<th>Interest %</th>
							<th>Valitity Days</th>
							<th>Current Days</th>

								<th>Loan Amt</th>
							
							
							<th>Remaining Principle</th>
							<th>Remaining Interest</th>
	<th>Total Pending</th>
							<th>LastRCPTDate</th>
								<th>Jewel Info</th>
							<th>Scheme</th>							
					</tr></thead>
					<tbody><?php $ii = 0; $rrdd = 0;
					$tot1 = 0; $tot2 =0; $tot3 = 0;
				while($row=mysqli_fetch_array($sql))
  { 
$x = $row['hpl'];

	 $aa = $row['penamt'];
				$bb = $row['hlbal'];
				$cc = $row['defamt'];
				$dd = $aa - $bb - $cc;
				$drty = $row['pendmnt'];
				$rrdd = $rrdd + $dd;
//if($dd > 0) {	
 //   if($drty>0) {	
    $ii++;		


?>			<tr>
				<td><b><b><?php echo $ii;?></b></td>
						<td><b><a href="udelete10.php?hpl=<?php echo $row['hpl']; ?>&mfin=<?php echo $mfin; ?>" target="_blank"><?php echo $row['hpl'];?></a></b></td>
						<td><b><?php echo $row['fname']; ?></a></b></td>
					
						<td><b><?php echo $row['pno'];?></a></b></td>
						<td><b><?php echo $row['hpdate'];?></b></td>
						
						<td><b><?php echo $row['dd'];?></b></td>
				<td><b><?php echo $row['defday'];?></b></td>
				<td><b><?php echo $row['pendmnt'];?></b></td>
			
				<td><b><?php echo $row['hpamt'];?></b></td>		
				<td><b><?php echo $row['vno'];?></b></td>
				<td><b><?php echo $row['vname'];?></b></td>
				<td><b><?php echo $row['tpdue'];?></b></td>
				<td><b><?php echo $row['model'];?></br><?php echo $row['ddd'];?></b></td>
				<td><b><?php echo $row['star'];?></b></td>
<?php 
$tot1 = $tot1 + $row['vno'];
$tot2 = $tot2 + $row['vname'];
$tot3 = $tot3 + $row['tpdue']; ?>
				<td><b><?php echo $row['lddate'];?></b></td>
			
					</tr>
					<?php
$x++; } }  
//} }

					?>  </tbody>
					<tfoot>
						<tr>
		
				<td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
				<td><b>Total</b></td>
			
		<td><b><?php echo round($tot1,0);?></b></td> 			
		<td><b><?php echo round($tot2,0);?></b></td> 			
		<td><b><?php echo round($tot3,0);?></b></td> 			
						<td></td><td><b></b></td>
				<td><b></b></td>
					</tr>
					</tfoot>
					</table>
					
</div>
</div></div></div></div>
</div></div></div>     <!-- /page content -->

        <!-- footer content -->
        <footer>
          <div class="pull-right">
             <a href="https://infossel.com">Infossel Soft Solution</a>
          </div>
          <div class="clearfix"></div>
        </footer>
        <!-- /footer content -->
      </div>
    </div>

    <!-- jQuery -->
    <script src="vendors/jquery/dist/jquery.min.js"></script>
    <!-- Bootstrap -->
    <script src="vendors/bootstrap/dist/js/bootstrap.min.js"></script>
    <!-- FastClick -->
    <script src="vendors/fastclick/lib/fastclick.js"></script>
    <!-- NProgress -->
    <script src="vendors/nprogress/nprogress.js"></script>
    <!-- iCheck -->
    <script src="vendors/iCheck/icheck.min.js"></script>
    <!-- Datatables -->
    <script src="vendors/datatables.net/js/jquery.dataTables.min.js"></script>
    <script src="vendors/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
    <script src="vendors/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
    <script src="vendors/datatables.net-buttons-bs/js/buttons.bootstrap.min.js"></script>
    <script src="vendors/datatables.net-buttons/js/buttons.flash.min.js"></script>
    <script src="vendors/datatables.net-buttons/js/buttons.html5.min.js"></script>
    <script src="vendors/datatables.net-buttons/js/buttons.print.min.js"></script>
    <script src="vendors/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js"></script>
    <script src="vendors/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
    <script src="vendors/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
    <script src="vendors/datatables.net-responsive-bs/js/responsive.bootstrap.js"></script>
    <script src="vendors/datatables.net-scroller/js/dataTables.scroller.min.js"></script>
    <script src="vendors/jszip/dist/jszip.min.js"></script>
    <script src="vendors/pdfmake/build/pdfmake.min.js"></script>
    <script src="vendors/pdfmake/build/vfs_fonts.js"></script>

    <!-- Custom Theme Scripts -->
    <script src="build/js/custom.min.js"></script>

  </body>
</html>
