<!-- DataTables 

 and  MONTH(KONSINYE_TARIH) = MONTH(CURDATE())


-->
    <link rel="stylesheet" href="./plugins/datatables/dataTables.bootstrap.css">


 <!-- DataTables -->
    <script src="./plugins/datatables/jquery.dataTables.min.js"></script>
    <script src="./plugins/datatables/dataTables.bootstrap.min.js"></script>


<script language="javascript">
function confirmDel() {
 var agree=confirm("Bu içeriği silmek istediğinizden emin misiniz?\nBu işlem geri alınamaz!");
 if (agree) {
  return true ; }
 else {
  return false ;}
}
</script>





<!-- Add mousewheel plugin (this is optional) -->
<script type="text/javascript" src="fancybox/lib/jquery.mousewheel-3.0.6.pack.js"></script>

<!-- Add fancyBox -->
<link rel="stylesheet" href="fancybox/source/jquery.fancybox.css?v=2.1.5" type="text/css" media="screen" />
<script type="text/javascript" src="fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>

<!-- Optionally add helpers - button, thumbnail and/or media -->
<link rel="stylesheet" href="fancybox/source/helpers/jquery.fancybox-buttons.css?v=1.0.5" type="text/css" media="screen" />
<script type="text/javascript" src="fancybox/source/helpers/jquery.fancybox-buttons.js?v=1.0.5"></script>
<script type="text/javascript" src="fancybox/source/helpers/jquery.fancybox-media.js?v=1.0.6"></script>

<link rel="stylesheet" href="fancybox/source/helpers/jquery.fancybox-thumbs.css?v=1.0.7" type="text/css" media="screen" />
<script type="text/javascript" src="fancybox/source/helpers/jquery.fancybox-thumbs.js?v=1.0.7"></script>






<script type="text/javascript">
	$(document).ready(function() {
	$(".various").fancybox({
		maxWidth	: 800,
		maxHeight	: 600,
		fitToView	: false,
		width		: '70%',
		height		: '70%',
		autoSize	: false,
		closeClick	: false,
		openEffect	: 'none',
		closeEffect	: 'none'
	});
});
</script>
 <div class="box">
                <div class="box-header">
                  <h3 class="box-title">Yapılan Satışlar</h3>
                </div><!-- /.box-header -->
                <div class="box-body">
                  <table id="example1" class="table table-bordered table-striped">
                    <thead>
                      <tr>

                        <th>Satış Tarihi</th>
                        <th>Satılan Ürün Adı</th>
<th>Eczane</th>
<th>Reçete Eden Hekim</th>
<th>Kurum Adı</th>
<th>Ürün Kullanım Şekli</th>
<th>Satış Şekli</th>
<th>Satış Adet</th>
<th>Ürün Kasa Tutarı</th>
 <th> Toplam Tutar</th>    
                      </tr>
                    </thead>
                    




<tbody>












<?php
include("baglan.php");
	
$gosterim=10000;
 $sayfa=@$_GET['sayfa'];
 
if(empty($sayfa) || !is_numeric($sayfa)){$sayfa=1;}

 
$k_sayisi=mysql_num_rows(mysql_query("Select * From konsinyesatis"));
 
$s_sayisi=ceil($k_sayisi/$gosterim);
 
$ilk_kayit=($sayfa*$gosterim)-$gosterim;
	
	
	
 $sorumlu_kodu=$_SESSION["kullanici_adi"];
 
  $sql = mysql_query("SELECT * FROM konsinyesatis  WHERE SATIS_DEPRESANT='$sorumlu_kodu'    Order By KONSINYE_ISLEM_ID DESC Limit $ilk_kayit,$gosterim");
 $i = 0; 
    $sutun    = 1;  
$s    = 0; 
    
    


	while($veri = mysql_fetch_assoc($sql)) 
	
    { 
	
$i++; 

    

	
        echo ' 
      	

<tr>

	<td><b>',$veri["KONSINYE_TARIH"],'</b></td>
	<td  >',$veri["KONSINYE_URUN_ADI"],'</td>

 <td  >',$veri["KONSINYE_ECZANE"],'</td>
 <td  >',$veri["KONSINYE_RECETE_EDEN_DOKTOR"],'</td>
   <td  >',$veri["SATIS_KURUM"],' </td>
 <td  >',$veri["SATIS_URUN_KULLANIM"],'</td>
 <td  >',$veri["SATIS_SEKLI"],'</td>
   <td  >',$veri["SATIS_ADET"],'</td>
   <td  >',$veri["SATIS_TUTARI"],' TL</td>
   <td  >',$veri["SATIS_TOPLAM"],' TL</td>
 



<td   ><a class="various fancybox.iframe" href="hedef/satisduzenle.php?KONSINYE_ISLEM_ID=',$veri["KONSINYE_ISLEM_ID"],'"> 

<button  class="btn btn-primary btn-sm">Satış Düzenle</button></a></td>

 
			

				
				
		 </tr>	 
				'; 
		
		
    
    } 

 

 

 
?>
                    </tbody>
                    
                  </table>

    <span class="bg-red" style="padding:10px; font-size:18px;">
               Aylık Satış Toplamı: <b><?php
	include"baglan.php";			  
$query = mysql_query("SELECT format(SUM(SATIS_TOPLAM),2) as toplam FROM konsinyesatis  WHERE SATIS_DEPRESANT='$sorumlu_kodu'"); 
$row = mysql_fetch_array($query);
echo $row['toplam'];
?> TL</b>
                  </span>
     

 &nbsp;  
   <span class="bg-red" style="padding:10px; font-size:18px;" >
                Genel Satış Toplamı : <b><?php
	include"baglan.php";			  
$query = mysql_query("SELECT format(SUM(SATIS_TOPLAM),2) as toplam FROM konsinyesatis WHERE SATIS_DEPRESANT='$sorumlu_kodu'"); 
$row = mysql_fetch_array($query);
echo $row['toplam'];
?> TL</b>
                  </span>

<?php
	include"baglan.php";
$sorgu = mysql_query("select  SELECT SUM(konsinyeler.SATIS_TOPLAM) * from konsinyesatis inner join konsinyeler on konsinyesatis.KONSINYE_ID=72");
$bilgi = mysql_fetch_array($sorgu);

echo $bilgi['SATIS_ADET'];
?>

                             

                </div><!-- /.box-body -->
              </div><!-- /.box -->


 








            </div><!-- /.col -->
          </div><!-- /.row -->

    <script>
      $(function () {
     
        $('#example1').DataTable({
          "paging": true,
          "lengthChange": true,
          "searching": true,
          "ordering": true,
          "info": true,
          "autoWidth": true
"aaSorting": [[ 4, "desc" ]]
        });
      });
    </script>