<?php require('header.php');
$bugun = date("Y-m-d");
$yenitarih = strtotime('-1 day',strtotime($bugun));
$dun = date('Y-m-d' ,$yenitarih );
date_default_timezone_set('Europe/Istanbul');
					
@session_start();
header('Content-type: text/html; charset=utf-8');

	$ck = @$_GET["ck"];


						
	$sorgu=odbc_exec($conn,"
SELECT [id],(case when iptal = 1 then 'IPTAL '+[tip] else [tip] end) 
BelgeTip  ,kul.[Adi] Kasiyer ,[kasa_no] KasaNo ,[belge_no] FisNo ,[z_no] ZNo , 
convert(varchar, [tarih], 104) BelgeTarih , convert(varchar, [saat], 8) BelgeSaat  ,
[aratoplam_indirim] Indirim ,[toplam] GenelTop FROM [online_ciro].[dbo].[belge_tanim] 
as bt  left join [vtmaster].[dbo].[Kullanicilar] kul on kul.Id = bt.kasiyer where
id = $ck
         
");
       while($kayit=odbc_fetch_array($sorgu))
	{	
$tipp =$kayit["BelgeTip"];
$kasa =$kayit["KasaNo"];
$fis =$kayit["FisNo"];
$btarih =$kayit["BelgeTarih"];
$bsaat =$kayit["BelgeSaat"];

?>
<!DOCTYPE html>
<html lang="tr">
<head>
 <meta charset="UTF-8">
</head>
<body onload="setTimeout('timeout()', 50)"></body>
<div>
        <ul class="breadcrumb">
            <li>
                <a href="posnet.php">Anasayfa</a>
            </li>
            <li>
                <a href="#">Fiş Detay</a>
            </li>
        </ul>
    </div>
<div class="row">
        <div class="box col-md-12">
            <div class="box-inner">
                <div class="box-header well" data-original-title="">
                    <h2>KasaNo : <?php echo $kasa; ?>  Belge No : <?php echo $fis; ?> &nbsp Tarih : <?php echo $btarih; ?> &nbsp Saat :<?php echo $bsaat; ?></h2>

                
                </div>
				<div id="main_fb">
   <div id="friend_list">
                <div class="box-content">
                    <table class="table table-striped table-bordered bootstrap-datatable datatable responsive">
					
                        <thead>
                    <th>Barkod</th>
        <th>Ürün Adı</th>
        <th>Miktar</th>
		 <th>Birim Fiyat</th>
		 <th>Tutar</th>
		 
       
               
               
                    
                        </thead>

						<?php 



	}
						
	$sorgu=odbc_exec($conn,"
SELECT [adi] UrunAdi ,[barkod] Barkod ,[birim] BirimAdi ,
[miktar] Miktar ,[fiyat] Fiyat ,[indirim] Indirim ,[tutar] Tutar  FROM [online_ciro].[dbo].[belge_detay] 
where tanim_id =$ck
         
");
  
       while($kayit=odbc_fetch_array($sorgu))
	{	
$tipp =$kayit["tip"];

							

 $Miktar = number_format($kayit["Miktar"], 2, ',', '.');
 $fiyat = number_format($kayit["Fiyat"], 2, ',', '.');
 $nakit = number_format($kayit["nakit"], 2, ',', '.');
 $kredi = number_format($kayit["kredi"], 2, ',', '.');
 $toplam = number_format($kayit["Tutar"], 2, ',', '.');
 $gtoplam += number_format($kayit["Tutar"], 2, '.', ',');
	
?> 

                        </tbody>
                        <tbody>
                        <tr>
 <td class="center"><h4><b><?php echo $kayit["Barkod"]; ?></td>
        <td class="center"><h4><b><?php echo $kayit["UrunAdi"]; ?></td>
		<td class="center"><h5><b><?php echo $Miktar.' '.$kayit["BirimAdi"]; ?></td>
	
		<td class="center"><h4><b><font color='yellow'><?php echo $fiyat.' '.'₺'; ?></td></font>
		
		<td class="center"><h4><b><font color='yellow'><?php echo $toplam.' '.'₺'; ?></td></font>
	<?php }  ?>	    <td><center>							
              
                            </td>
							
                        </tr>


                      <tr>
					  <td ><center></center></td>
					  <td><center></center></td>
					  <td><center></center></td>
					  <td><center></center></td>
					  <td><center></center><font color='red'><?php echo $gtoplam.' '.'₺'; ?></font></td>
					
					  
					  </tr>
                        </tbody>
                    </table>
                   <?php
$url = htmlspecialchars($_SERVER['HTTP_REFERER']);  // hangi sayfadan gelindigi degerini verir.
echo "<a href='$url' class='btn btn-success'>önceki sayfa</a>"; // dugmeye o degeri atiyoruz.

?>
                </div>
            </div>
        </div>
    </div><!--/span-->
	</div>
</div>

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

</html>























