<?php require('header.php'); ?>
<?php require('veritabani.php'); 

if(!isset($_SESSION["password"]))

	
	 {
		echo "<br><center><h2>Yoktur";
}else{
	
	function my_session_start($timeout = 14) {
    ini_set('session.gc_maxlifetime', $timeout);
    session_start();

    if (isset($_SESSION['timeout_idle']) && $_SESSION['timeout_idle'] < time()) {
        session_destroy();
        session_start();
        session_regenerate_id();
        $_SESSION = array();
    }

    $_SESSION['timeout_idle'] = time() + $timeout;
}
?>
<script>
function SayiKontrol(e) {
	olay = document.all ? window.event : e;
	tus = document.all ? olay.keyCode : olay.which;
	if(tus<48||tus>57) {
		if(document.all) { olay.returnValue = false; } else { olay.preventDefault(); }
	}
}

function HarfKontrol(e) {
	olay = document.all ? window.event : e;
	tus = document.all ? olay.keyCode : olay.which;
	if(tus>=48&&tus<=57) {
		if(document.all) { olay.returnValue = false; } else { olay.preventDefault(); }
	}
}
</script>
<script language="JavaScript">
function kontrol() 
{
 var bilgi=document.form.ara.value;
 if (bilgi !="") return true;
 else alert ('Lütfen Boş Bırakmayınız !')
 return false;
}
</script>
    <div class="row">
    <div class="box col-md-12">
    <div class="box-inner">
    <div class="box-header well" data-original-title="">
        <h2><i class="glyphicon glyphicon-user"></i> Müşteri Sorgulama</h2>
		


        <div class="box-icon">
            <a href="#" class="btn btn-setting btn-round btn-default"><i class="glyphicon glyphicon-cog"></i></a>
            <a href="#" class="btn btn-minimize btn-round btn-default"><i
                    class="glyphicon glyphicon-chevron-up"></i></a>
            <a href="#" class="btn btn-close btn-round btn-default"><i class="glyphicon glyphicon-remove"></i></a>
        </div>
    </div>

				<form  name=form method=post action="puan.php?ck=sor" onSubmit="return kontrol()">
&nbsp;&nbsp;&nbsp;<div class="control-group">
                  
                    
        </form>

	
<div class="control-group">
     <div class="form-group has-success col-md-4">
		    <label class="control-label"  for="ara">Müşteri Kart Numarası</label><br>
                    <input type="text" value="" class="form-control" onkeypress="SayiKontrol(event)" name="ara">
					 
                <br><br>
				
                    <button type="submit" id="submit" class="btn btn-default">  &nbsp;&nbsp;&nbsp;   Ara    &nbsp;&nbsp;&nbsp; </button>
 </div>
</form>
<a href="" target="_blank"></a>
    <table class="table table-striped table-bordered bootstrap-datatable datatable responsive">
 
	
<?



$ck = @$_GET["ck"];
switch($ck){
case"sor":
 
	if ($_POST){
    $ara=$_POST["ara"];
	
	
	$sorgu=sqlsrv_query($puan," 
select Cari_Kod,Puan,ToplamTutar,KrediBakiyesi,RiskBakiyesi from INTERBONUS_PUAN WHERE Cari_Kod LIKE '%$ara%'
             
  
  ");
   

 while($kayit=sqlsrv_fetch_array($sorgu,SQLSRV_FETCH_ASSOC))
	{


 
	?>
	   <thead>
    <tr>
        <th>Kart No</th>
        <th>Puan</th>
        <th>Toplam Alışveriş</th>
        <th>Kredi Bakiyesi</th>
        <th>Risk Bakiyesi</th>
       
    </tr>
    </thead>
    <tbody>
    <tr>
        <td><h4><? echo $kayit["Cari_Kod"]; ?></td>
        <td class="center"><h4><? echo $kayit["Puan"]; ?></td>
        <td class="center"><b><h4><? echo $kayit["ToplamTutar"]; ?>&nbsp;₺</td>
	<td class="center"><h4><? echo $kayit["KrediBakiyesi"]; ?>&nbsp;₺</td>
	<td class="center"><h4><? echo $kayit["RiskBakiyesi"]; ?>&nbsp;₺</td>

       
           
        </td>
        
			
          
        </td>
    </tr>
   
    </tr>
               </div>
        </div>
    </div><!--/span-->
		<?
	}
 		}else{
			echo 'Eslesen Kayit Yok.';
		}
?>
     <?// ***************************************************************Çek öldür ************************************************************
break;
case"cek_ac"
?>



<?


        $ad = $_GET["id"]; 
$liste = odbc_exec($conn2,"update INTERBONUS_INDIRIMCEK SET Flag=0 WHERE ID='$ad'");  

			
                   if(odbc_num_rows($liste)>0){ 
				   
				      ?> <center>
 <table >
	

	<tbody>
	<tr>
			
			<td><font face="Cambria" size="4" color="#fff"><b><span class="check"><br><br>İşlem Başarılı...<br><br>Çek Aktif Edildi</span></font></td>
		
		</tr>
		
		
		</table>

		
<?}else{?>
 <table class="table1">
	

	<tbody>
	<tr>
			
			<td><font face="Cambria" size="4" color="#fff"><b><span class="checks"><br><br>İşlem Başarısız...<br>Kod Bozuk<br></span></font></td>
		
		</tr>
		
		
		</table>
		
		<?}?>
		<?// ***************************************************************Çek öldür ************************************************************
break;
case"cek_kapa"
?>
<table class="table1">
	

	<tbody>
	<tr>
			
			<td><font face="Cambria" size="4" color="#fff"><b><span class="check"><br><br>İşlem Başarılı...<br><br>Çek Pasif Edildi</span></font></td>
		
		</tr>
		
		
		</table>


<?


        $kapa = $_GET["id"]; 
$liste = odbc_exec($conn2,"update INTERBONUS_INDIRIMCEK SET Flag=1 WHERE ID='$kapa'");  

			
        //******************************************************** bitti **************************************  
	
?>


  <?
  
 
	}
	}
	
		
		
?>  
<?php require('footer.php'); ?>
