
	
	
	<div class="content-wrapper">
  <!-- Content Header (Page header) -->
  <div class="content-header">
    <div class="container-fluid">

    </div><!-- /.container-fluid -->
  </div>
  <!-- /.content-header -->
  <?php
  $buguntekil=0;
  $buguncogul=0;
  $geneltekil=0;
  $genelcogul=0;
  $buguntekilSorgu=$VT->VeriGetir("ziyaretciler","WHERE tarih=?",array(date("Y-m-d")),"ORDER BY ID ASC");
  if($buguntekilSorgu!=false)
  {
   $buguntekil=count($buguntekilSorgu);
   for($x=0;$x<count($buguntekilSorgu);$x++){$buguncogul+=$buguntekilSorgu[$x]["cogul"];}
 }
$geneltekilSorgu=$VT->VeriGetir("ziyaretciler","","","ORDER BY ID ASC");
if($geneltekilSorgu!=false)
{
 $geneltekil=count($geneltekilSorgu);
 for($x=0;$x<count($geneltekilSorgu);$x++){$genelcogul+=$geneltekilSorgu[$x]["cogul"];}
}
?>
<!-- Main content -->
<section class="content">
  <div class="container-fluid">
    <!-- Small boxes (Stat box) -->
    <div class="row">
      <div class="col-lg-3 col-6">
        <!-- small box -->
        <div class="small-box bg-info">
          <div class="inner">
            <h3><?=$buguntekil?></h3>

            <p>Bugün Tekil Ziyaretçiniz</p>
          </div>
          <div class="icon">
            <i class="ion ion-bag"></i>
          </div>
        </div>
      </div>
      <!-- ./col -->
      <div class="col-lg-3 col-6">
        <!-- small box -->
        <div class="small-box bg-success">
          <div class="inner">
            <h3><?=$buguncogul?></h3>

            <p>Bugün Çoğul Ziyaretçiniz</p>
          </div>
          <div class="icon">
            <i class="ion ion-stats-bars"></i>
          </div>
        </div>
      </div>
      <!-- ./col -->
      <div class="col-lg-3 col-6">
        <!-- small box -->
        <div class="small-box bg-warning">
          <div class="inner">
            <h3><?=$geneltekil?></h3>

            <p>Toplam Tekil Ziyaretçiniz</p>
          </div>
          <div class="icon">
            <i class="ion ion-person-add"></i>
          </div>
        </div>
      </div>
      <!-- ./col -->
      <div class="col-lg-3 col-6">
        <!-- small box -->
        <div class="small-box bg-danger">
          <div class="inner">
            <h3><?=$genelcogul?></h3>

            <p>Toplam Çoğul Ziyaretçiniz</p>
          </div>
          <div class="icon">
            <i class="ion ion-pie-graph"></i>
          </div>
        </div>
      </div>
      <!-- ./col -->
    </div>
    <!-- /.row -->
  </div>

  <!-- Main content -->
  <section class="content">
    <div class="container-fluid">
      <!-- Info boxes -->
      <div class="row">
        <div class="col-12 col-sm-6 col-md-3">
          <div class="info-box">
            <span class="info-box-icon bg-info elevation-1"><i class="fas fa-truck"></i></span>
            <?php 
            $yenisiparis=$VT->VeriGetir("siparisler WHERE takipno IS NULL");
            if ($yenisiparis!=false) 
            {
              ?>
              <div class="info-box-content">
                <span class="info-box-text">Bekleyen Sipariş</span>
                <span class="info-box-number"><?=count($yenisiparis)?></span>
              </div>
              <?php 
            }
            else
            {
             ?>
             <div class="info-box-content">
              <span class="info-box-text">Bekleyen Sipariş</span>
              <span class="info-box-number">0</span>
            </div>
            <?php
          }
          ?>
          <!-- /.info-box-content -->
        </div>
        <!-- /.info-box -->
      </div>
      <!-- /.col -->
      <div class="col-12 col-sm-6 col-md-3">
        <div class="info-box mb-3">
          <span class="info-box-icon bg-success elevation-1"><i class="fas fa-thumbs-up"></i></span>
          <?php 
          $tamamlandi=$VT->VeriGetir("siparisler","WHERE durum=?",array(1));
          if ($tamamlandi!=false) 
          {
            ?>
            <div class="info-box-content">
              <span class="info-box-text">Tamamlanan Sipariş</span>
              <span class="info-box-number"><?=count($tamamlandi)?></span>
            </div>
            <?php 
          }
          else
          {
           ?>
           <div class="info-box-content">
            <span class="info-box-text">Tamamlanan Sipariş</span>
            <span class="info-box-number">0</span>
          </div>
          <?php
        }
        ?>
        <!-- /.info-box-content -->
      </div>
      <!-- /.info-box -->
    </div>
    <!-- /.col -->

    <!-- fix for small devices only -->
    <div class="clearfix hidden-md-up"></div>

    <div class="col-12 col-sm-6 col-md-3">
      <div class="info-box mb-3">
        <span class="info-box-icon bg-danger elevation-1"><i class="fas fa-people-carry"></i></span>
        <?php 
        $uruniade=$VT->VeriGetir("iadeler","WHERE durum=?",array(1));
        if ($uruniade!=false) 
        {
          ?>
          <div class="info-box-content">
            <span class="info-box-text">İadeli Bekliyor</span>
            <span class="info-box-number"><?=count($uruniade)?></span>
          </div>
          <?php 
        }
        else
        {
         ?>
         <div class="info-box-content">
          <span class="info-box-text">İadeli Bekliyor</span>
          <span class="info-box-number">0</span>
        </div>
        <?php
      }
      ?>
      <!-- /.info-box-content -->
    </div>
    <!-- /.info-box -->
  </div>
  <!-- /.col -->

  <div class="col-12 col-sm-6 col-md-3">
    <div class="info-box mb-3">
      <span class="info-box-icon bg-warning elevation-1"><i class="fas fa-chart-line"></i></span>
      <?php
      $toplamkazanc=0;
      $iadesi=0;
      $tamamlandi=$VT->VeriGetir("siparisler","WHERE durum=?",array(1));
      if ($tamamlandi!=false) 
      {
        for ($i=0; $i <count($tamamlandi) ; $i++) { 
          $toplamkazanc=($toplamkazanc+$tamamlandi[$i]["odenentutar"]);
        }
      }
      $uruniade=$VT->VeriGetir("iadeler","WHERE durum=?",array(1));
      if ($uruniade!=false) 
      {
       for ($i=0; $i <count($uruniade) ; $i++) { 
        $iadeID=$uruniade[$i]["ID"];
        $siparisID=$uruniade[$i]["siparisID"];
        $iadeler=$VT->VeriGetir("iadeurunler","WHERE iadeID=?",array($iadeID),"ORDER BY ID ASC");
        if($iadeler!=false)
        {
          for ($x=0; $x <count($iadeler) ; $x++) { 
            $siparisurunID=$iadeler[$x]["siparisurunID"];
            $tutarBilgi=$VT->VeriGetir("siparisurunler","WHERE siparisID=?",array($siparisurunID));
            if ($tutarBilgi!=false) 
            {
              $iadesi=($iadesi+$tutarBilgi[0]["toplamtutar"]);
            }
          }

        }
      }
    }
    $toplamkazanc=($toplamkazanc-$iadesi);
    ?>
    <div class="info-box-content">
      <span class="info-box-text">Toplam Kazanç (₺)</span>
      <span class="info-box-number">₺ <?=number_format($toplamkazanc,2,",",".")?></span>
    </div>

    <!-- /.info-box-content -->
  </div>
  <!-- /.info-box -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</div>

<section>
  <div class="col-md-12">
    <!-- BAR CHART -->
    <div class="card card-success">
      <div class="card-header">
        <h3 class="card-title">Satış Raporları (₺)</h3>

        <div class="card-tools">
          <button type="button" class="btn btn-tool" data-card-widget="collapse"><i class="fas fa-minus"></i>
          </button>
          <button type="button" class="btn btn-tool" data-card-widget="remove"><i class="fas fa-times"></i></button>
        </div>
      </div>
      <div class="card-body">
        <div class="chart">
          <canvas id="barChart" style="min-height: 250px; height: 250px; max-height: 250px; max-width: 100%;"></canvas>
        </div>
      </div>
      <!-- /.card-body -->
    </div> 
  </div>
  <!-- /.content --> 
</section>

<!-- Main content -->
<section class="content">
  <div class="container-fluid">

    <!-- Main row -->
    <div class="row">
      <!-- Left col -->
      <section class="col-lg-6 connectedSortable">

        <div class="panel panel-default card-view">
         <div class="panel-heading">
          <div class="card-header" style="background: #fff;">
           <h6 class="panel-title txt-dark">Genel Tarayıcı İstatistiği</h6>
         </div>
         <div class="clearfix"></div>
       </div>
       <div class="panel-wrapper">
        <div class="panel-body" style="background:#fff; padding:8px;">
          <?php
          $trycilr=$VT->VeriGetir("ziyarettarayici","WHERE ID<>?",array(5),"ORDER BY ID ASC");

          ?>
          <div>
            <span class="badge badge-danger" style="width:40%;">
             Google Chrome
           </span>
           <span class="label label-warning pull-right" style="font-size: 16px; background: #eee; border: 1px solid #ddd; padding: 4px 9px; border-radius: 10px; float: right;"><?php if($trycilr!=false && $trycilr[0]["ziyaret"]){echo $trycilr[0]["ziyaret"];}else{echo "-";}?></span>
           <div class="clearfix"></div>
           <hr class="light-grey-hr"/>
           <span class="badge badge-warning" style="width:40%;">
             Mozila Firefox
           </span>
           <span class="label label-danger pull-right" style="font-size: 16px; background: #eee; border: 1px solid #ddd; padding: 4px 9px; border-radius: 10px; float: right;"><?php if($trycilr!=false && $trycilr[2]["ziyaret"]){echo $trycilr[2]["ziyaret"];}else{echo "-";}?></span>
           <div class="clearfix"></div>
           <hr class="light-grey-hr row "/>
           <span class="badge badge-primary" style="width:40%;">
             Internet Explorer
           </span>
           <span class="label label-success pull-right" style="font-size: 16px; background: #eee; border: 1px solid #ddd; padding: 4px 9px; border-radius: 10px; float: right;"><?php if($trycilr!=false && $trycilr[1]["ziyaret"]){echo $trycilr[1]["ziyaret"];}else{echo "-";}?></span>
           <div class="clearfix"></div>
           <hr class="light-grey-hr row "/>
           <span class="badge badge-info" style="width:40%;">
             Diğer
           </span>
           <span class="label label-primary pull-right" style="font-size: 16px; background: #eee; border: 1px solid #ddd; padding: 4px 9px; border-radius: 10px; float: right;"><?php if($trycilr!=false && $trycilr[3]["ziyaret"]){echo $trycilr[3]["ziyaret"];}else{echo "-";}?></span>
           <div class="clearfix"></div>
         </div>
       </div>	
     </div>
   </div> 
 </section>
 <!--  Takvim Başla --> 
 <!-- right col -->
 <section class="col-lg-6 connectedSortable"> 
  <!--  Takvim -->
  <div class="card">
    <div class="card-header border-0">
      <h3 class="card-title">Mağazaya Genel Bakış</h3>

    </div>
    <div class="card-body">
     <?php 
     $iadeler=$VT->VeriGetir("iadeler","WHERE durum=?",array(2));
     if ($iadeler!=false) 
     {
      ?>
      <div class="d-flex justify-content-between align-items-center border-bottom mb-3">
        <p class="text-success text-xl">
          <i class="ion ion-ios-refresh-empty"></i>
        </p>
        <p class="d-flex flex-column text-right">
          <span class="font-weight-bold">
            <i class="ion ion-android-arrow-up text-success"></i><?=count($iadeler)?></span>
            <span class="text-muted">GERİ İADELER</span>
          </p>
        </div>
        <?php 
      }
      else
      {
        ?>
        <div class="d-flex justify-content-between align-items-center border-bottom mb-3">
          <p class="text-success text-xl">
            <i class="ion ion-ios-refresh-empty"></i>
          </p>
          <p class="d-flex flex-column text-right">
            <span class="font-weight-bold">
              <i class="ion ion-android-arrow-up text-success"></i>0</span>
              <span class="text-muted">GERİ İADELER</span>
            </p>
          </div>
          <?php
        }
        ?>
        <!-- /.d-flex -->
        <?php 
        $oran=$VT->VeriGetir("siparisler","WHERE durum=?",array(2));
        if ($oran!=false) 
        {
          ?>
          <div class="d-flex justify-content-between align-items-center border-bottom mb-3">
            <p class="text-warning text-xl">
              <i class="ion ion-ios-cart-outline"></i>
            </p>
            <p class="d-flex flex-column text-right">
              <span class="font-weight-bold">
                <i class="ion ion-android-arrow-up text-warning"></i> <?=count($oran)?>
              </span>
              <span class="text-muted">ÖDEME BEKLİYOR</span>
            </p>
          </div>
          <?php 
        }
        ?>
        <!-- /.d-flex -->
        <?php 
        $oran=$VT->VeriGetir("uyeler","WHERE durum=?",array(1));
        if ($oran!=false) 
        {
          ?>
          <div class="d-flex justify-content-between align-items-center mb-0">
            <p class="text-danger text-xl">
              <i class="ion ion-ios-people-outline"></i>
            </p>
            <p class="d-flex flex-column text-right">
              <span class="font-weight-bold">
                <i class="ion ion-android-arrow-up text-success"></i> <?=count($oran)?> 
              </span>
              <span class="text-muted">KAYITLI MÜŞETİLER</span>
            </p>
          </div>
          <?php 
        }
        ?> 
      </div>
    </div>
  </section> 
</div>  
</div>  
</div>  
<?php 
$krediKartiAylar=array();
$HavaleAylar=array();
$KapidaAylar=array();
for($i=1;$i<13;$i++) 
{ 
  if($i<10){$ay="0".$i;}else{$ay=$i;}
  $baslamatarih=date("Y")."-".$ay."-01"; /*2020-03-01*/
  $bitistarih=date("Y")."-".$ay."-31"; /*2020-03-01*/
  /*K.Kartı*/
  $siparisraporKrediKarti=$VT->VeriGetir("siparisler","WHERE odemetipi=? AND tarih BETWEEN ? AND ?",
    array(1,$baslamatarih,$bitistarih),"ORDER BY ID ASC");
  if($siparisraporKrediKarti!=false)
  {
    $toplamdeger=0;
    for($x=0;$x<count($siparisraporKrediKarti);$x++) 
    { 
      $toplamdeger=($toplamdeger+$siparisraporKrediKarti[$x]["odenentutar"]);
    }
    $krediKartiAylar[]=$toplamdeger;
  } 
  else
  {
    $krediKartiAylar[]=0;
  }
  /*Havale*/
  $siparisraporHavale=$VT->VeriGetir("siparisler","WHERE odemetipi=? AND tarih BETWEEN ? AND ?",
    array(2,$baslamatarih,$bitistarih),"ORDER BY ID ASC");
  if($siparisraporHavale!=false)
  {
    $toplamdeger=0;
    for($x=0;$x<count($siparisraporHavale);$x++) 
    { 
      $toplamdeger=($toplamdeger+$siparisraporHavale[$x]["odenentutar"]);
    }
    $HavaleAylar[]=$toplamdeger;
  } 
  else
  {
    $HavaleAylar[]=0;
  }
  /*Kapıda Ödeme*/
  $siparisraporKapida=$VT->VeriGetir("siparisler","WHERE odemetipi=? AND tarih BETWEEN ? AND ?",
    array(3,$baslamatarih,$bitistarih),"ORDER BY ID ASC");
  if($siparisraporKapida!=false)
  {
    $toplamdeger=0;
    for($x=0;$x<count($siparisraporKapida);$x++) 
    { 
      $toplamdeger=($toplamdeger+$siparisraporKapida[$x]["odenentutar"]);
    }
    $KapidaAylar[]=$toplamdeger;
  } 
  else
  {
    $KapidaAylar[]=0;
  }

} 
/*print_r($krediKartiAylar);*/
?> 

<script type="text/javascript">
  $(function() {
   var areaChartData = {
    labels  : ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz','Ağustos','Eylül','Ekim','Kasım','Aralık'],
    datasets: [
    {
      label               : 'Kredi Kartı İle Satışlar ₺',
      backgroundColor     : 'rgba(233,30,99,0.9)',
      borderColor         : 'rgba(233,30,99,0.8)',
      pointRadius          : false,
      pointColor          : '#e91e63',
      pointStrokeColor    : 'rgba(233,30,99,1)',
      pointHighlightFill  : '#fff',
      pointHighlightStroke: 'rgba(233,30,99,1)',
      data                : [<?=$krediKartiAylar[0]?>,<?=$krediKartiAylar[1]?>, <?=$krediKartiAylar[2]?>, <?=$krediKartiAylar[3]?>, <?=$krediKartiAylar[4]?>, <?=$krediKartiAylar[5]?>, <?=$krediKartiAylar[6]?>, <?=$krediKartiAylar[7]?>,<?=$krediKartiAylar[8]?>, <?=$krediKartiAylar[9]?>, <?=$krediKartiAylar[10]?>, <?=$krediKartiAylar[11]?>]
    },
    {
      label               : 'Havale / EFT İle Satışlar ₺',
      backgroundColor     : 'rgba(210, 214, 222, 1)',
      borderColor         : 'rgba(210, 214, 222, 1)',
      pointRadius         : false,
      pointColor          : 'rgba(210, 214, 222, 1)',
      pointStrokeColor    : '#c1c7d1',
      pointHighlightFill  : '#fff',
      pointHighlightStroke: 'rgba(220,220,220,1)',
      data                : [<?=$HavaleAylar[0]?>,<?=$HavaleAylar[1]?>, <?=$HavaleAylar[2]?>, <?=$HavaleAylar[3]?>, <?=$HavaleAylar[4]?>, <?=$HavaleAylar[5]?>, <?=$HavaleAylar[6]?>, <?=$HavaleAylar[7]?>,<?=$HavaleAylar[8]?>, <?=$HavaleAylar[9]?>, <?=$HavaleAylar[10]?>, <?=$HavaleAylar[11]?>]
    },
    {
      label               : 'Kapıda Ödeme İle Satışlar ₺',
      backgroundColor     : 'rgba(60,141,188,0.9)',
      borderColor         : 'rgba(60,141,188,0.8)',
      pointRadius          : false,
      pointColor          : '#3b8bba',
      pointStrokeColor    : 'rgba(60,141,188,1)',
      pointHighlightFill  : '#fff',
      pointHighlightStroke: 'rgba(60,141,188,1)',
      data                : [<?=$KapidaAylar[0]?>,<?=$KapidaAylar[1]?>, <?=$KapidaAylar[2]?>, <?=$KapidaAylar[3]?>, <?=$KapidaAylar[4]?>, <?=$KapidaAylar[5]?>, <?=$KapidaAylar[6]?>, <?=$KapidaAylar[7]?>,<?=$KapidaAylar[8]?>, <?=$KapidaAylar[9]?>, <?=$KapidaAylar[10]?>, <?=$KapidaAylar[11]?>]
    },
    ]
  }

  var areaChartOptions = {
    maintainAspectRatio : false,
    responsive : true,
    legend: {
      display: false
    },
    scales: {
      xAxes: [{
        gridLines : {
          display : false,
        }
      }],
      yAxes: [{
        gridLines : {
          display : false,
        }
      }]
    }
  }
    //-------------
    //- BAR CHART -
    //-------------
    var barChartCanvas = $('#barChart').get(0).getContext('2d')
    var barChartData = jQuery.extend(true, {}, areaChartData)
    var temp0 = areaChartData.datasets[0]
    var temp1 = areaChartData.datasets[1]
    barChartData.datasets[0] = temp1
    barChartData.datasets[1] = temp0

    var barChartOptions = {
      responsive              : true,
      maintainAspectRatio     : false,
      datasetFill             : false
    }

    var barChart = new Chart(barChartCanvas, {
      type: 'bar', 
      data: barChartData,
      options: barChartOptions
    });

  });
</script>


