 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

	
<?php

error_reporting(0); @session_start();


//include "bower_components/moment/jd.php";

date_default_timezone_set('Europe/Istanbul');
$tarih = date('Y-m-d');
$saat = date('H:i:s');
$kull = trim($_SESSION['name']," ");
$kull_adi = $kull." - Android";
$su_id = trim($_SESSION['su_id']);

error_reporting(0);

include "config.php";

?>
 <footer >
        <p class="col-md-9 col-sm-9 col-xs-12 copyright"> <a href="#" target="_blank">POSnet Yazılım A.Ş
                </a>&nbsp 2017 - <?php echo date('Y') ?></p>

        <p class="col-md-3 col-sm-3 col-xs-12 powered-by"><a
               >
				Pazaristan</a></p>
				<center><body style="background: url(images/bg.png);" >
    </footer>
<script>
    document.onkeydown=function(evt){
        var keyCode = evt ? (evt.which ? evt.which : evt.keyCode) : event.keyCode;
        if(keyCode == 13)
        {
             $('body').fullscreen();//your function call here
            document.test.submit();
        }
    }
	
</script>

<html>
<head>

<title>POSnet Web Yazılım</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="description" content="POSnet web yazılım">
	<meta name="author" content="Ahmet AVCI">

	<!-- The styles -->
	<link id="bs-css" href="css/bootstrap-cerulean.min.css" rel="stylesheet">
 
	<link href="css/charisma-app.css" rel="stylesheet">
	<link href='bower_components/fullcalendar/dist/fullcalendar.css' rel='stylesheet'>
	<link href='bower_components/fullcalendar/dist/fullcalendar.print.css' rel='stylesheet' media='print'>
	<link href='bower_components/chosen/chosen.min.css' rel='stylesheet'>
	<link href='bower_components/colorbox/example3/colorbox.css' rel='stylesheet'>
	<link href='bower_components/responsive-tables/responsive-tables.css' rel='stylesheet'>
	<link href='bower_components/bootstrap-tour/build/css/bootstrap-tour.min.css' rel='stylesheet'>
	<link href='css/jquery.noty.css' rel='stylesheet'>
	<link href='css/noty_theme_default.css' rel='stylesheet'>
	<link href='css/elfinder.min.css' rel='stylesheet'>
	<link href='css/elfinder.theme.css' rel='stylesheet'>
	<link href='css/jquery.iphone.toggle.css' rel='stylesheet'>
	<link href='css/uploadify.css' rel='stylesheet'>
	<link href='css/animate.min.css' rel='stylesheet'>

	<!-- jQuery -->
	<script src="bower_components/jquery/jquery.min.js"></script>
<center>
	
	

<img src="images/logo.png" />


</head>
<body>

<script>

fonction kontrol(){ if(document.getElementById("date").value==""){ alert("Lütfen isim kısmını doldurun."); return false; } }
</script>
				
	
<div class="row">
    
        <div class="box-inner">
     
            <div class="box-content">

                <form name="form" method="post" action="fgisim.php?ck=sor" role="form">
				
  
    
    



				       
                        <input style=" width:600px; height:70px; font-size:40px;" type="Text" class="form-control" name="date" minlength="3"  placeholder="Stok İsmi Yazınız.." autofocus  autocomplete="off"  >
                   
				
				 

                   <br>
               
                  <button type="submit" style=" width:200px; height:55px; font-size:20px;" onSubmit="return kontrol();" class="btn btn-success btn-lg">Listele</button> 
                </form>

          
        </div>
    </div>
    <!--/span-->
<?php if ($_POST){
    $ara=$_POST["date"];
	
	
	
	?>
	


<div class="row">
        <div class="box col-md-12">
            <div class="box-inner">
           
                <div class="box-content">
                    <table style=" width:850px; height:70px; font-size:20px;" border='1'  >
                        <thead >
                        <tr style=" color:grey;">
                            <th >Barkod</th>
                            <th>Stok Adı</th>
                            <th>Birim</th>
                            <th>Fiyat</th>
                            <th>Şube</th>
                            <th>Depo</th>
                           
                            
                    
                        </tr>
                        </thead>
<?php

	if(empty($ara)) {
      echo '    <div class="alert alert-danger">
                    <button type="button" class="close" data-dismiss="alert">&times;</button>
                     <h4>Lütfen Boş Bırakmayınız</h4>
                </div>';
	?><meta http-equiv="refresh" content="3;URL=fgisim.php"><?php
   } else {
	ini_set("mssql.charset", "UTF-8");
iconv('UTF-8', 'ISO-8859-9', $sql_check);
	$tarih = date("Y-m-d"); 
	$araa = mb_convert_encoding($ara, "UTF-8", "ISO-8859-9");
	$sql_check = sqlsrv_query($con,"
	
  SELECT TOP 200 B.KDVDahil,
S.Id, S.StokKodu, S.StokAdi,D.SubeId,  S.Tanimi, S.StokTipi, S.Durum, S.AlisFiyati, S.AlisPB,  B.Fiyat1, B.PB1, B.Fiyat2, B.PB2, Dep.Envanter sube,D.SubeMevcudu merkez,
B.Adi AS BirimAdi, B.Carpan, Barkodu, KG.Orani KDV, OG.Orani OTV,
ISNULL((SELECT Kod FROM OzelKodlar OK WHERE OK.Id = S.OzelKod0), '''') AS OzelKod0,
ISNULL((SELECT Kod FROM OzelKodlar OK WHERE OK.Id = S.OzelKod1), '''') AS OzelKod1,
ISNULL((SELECT Kod FROM OzelKodlar OK WHERE OK.Id = S.OzelKod2), '''') AS OzelKod2,
ISNULL((SELECT Kod FROM OzelKodlar OK WHERE OK.Id = S.OzelKod3), '''') AS OzelKod3,
ISNULL((SELECT Kod FROM OzelKodlar OK WHERE OK.Id = S.OzelKod4), '''') AS OzelKod4,
ISNULL((SELECT Kod FROM OzelKodlar OK WHERE OK.Id = S.OzelKod5), '''') AS OzelKod5,
ISNULL((SELECT Kod FROM OzelKodlar OK WHERE OK.Id = S.OzelKod6), '''') AS OzelKod6,
(SELECT TOP 1 SB.Carpan FROM Birimler AS SB WHERE SB.StokId = S.Id AND SB.Id <> B.Id) Carpan2,
(SELECT TOP 1 SB.Adi FROM Birimler AS SB WHERE SB.StokId = S.Id AND SB.Id <> B.Id) BirimAdi2

FROM Stoklar S
INNER JOIN Birimler AS B ON B.StokId = S.Id
INNER JOIN (SELECT VarsayilanBirim AS BId FROM Stoklar AS S WHERE StokAdi LIKE '%$ara%'
    UNION
SELECT BirimId FROM Barkodlar AS B WHERE Barkodu LIKE '%$ara') AS BIds ON BIds.BId = B.Id
LEFT JOIN Barkodlar AS Bar ON Bar.Id = B.BarkodId
LEFT JOIN KDVGruplari AS KG ON KG.Grubu = B.KDVGrubu AND ISNULL(KG.Tipi, 0) = 0
LEFT JOIN KDVGruplari AS OG ON OG.Grubu = B.OTVGrubu AND KG.Tipi = 1

LEFT JOIN DepoDetayliEnvanter D ON D.SubeId IN  (26) AND D.Id = S.Id
LEFT JOIN DepoDetayliEnvanter Dep ON Dep.SubeId IN  (28) AND Dep.Id = S.Id

		 
			 ");

 while($satir = sqlsrv_fetch_array($sql_check)) { 
	
$say = sqlsrv_has_rows($sql_check);
	
$adi = $satir['StokAdi'];
$fiyat1 = $satir["Fiyat1"];
$birim = $satir["BirimAdi"];
$barkod = $satir["Barkodu"];
$miktar = $satir["Miktar"];
$subee = $satir["sube"];
$depoo = $satir["merkez"];

  $fiyat = number_format($fiyat1, 2, ',', '.');
  $nakit_ciro = number_format($nakit, 2, ',', '.');
  $cek_ciro = number_format($cek, 2, ',', '.');
  $envanter = number_format($miktar, 2, '.', '.');
  $sube = number_format($subee, 2, '.', '.');
  $depo = number_format($depoo, 2, '.', '.');

?>
                        <tbody>
                        <tr>
                          <td class="center"><?php echo $barkod; ?></td>
                            <td class="center"><b><?php echo $adi; ?></td>
                            <td class="center"><?php echo $birim; ?></td>
                          
                            <td class="yellow"><b><?php echo $fiyat; ?></b></td>
							
                            <td class="red"><b><?php echo $sube; ?></b></td>
                            <td class="red"><b><?php echo $depo; ?></b></td>
                   
                            
                        </tr>
 <?php }      }?>     
                          
                         <?php if ($say < 1){ ?><font size=4 color=red ><?php echo $ara; ?>  Kayıt Bulunamadı  </font><?php }else{ ?>
						
<?php } }   ?> 
                       <meta http-equiv="refresh" content="180;URL=fg.php">
                        </tr>
                   
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
  


</body>
</html>
</center>
<html>
    <head>
        <script>
            
            var menuDisplayed = false;
            var menuBox = null;
            
            window.addEventListener("contextmenu", function() {
                var left = arguments[0].clientX;
                var top = arguments[0].clientY;
                
                menuBox = window.document.querySelector(".menu");
                menuBox.style.left = left + "px";
                menuBox.style.top = top + "px";
                menuBox.style.display = "block";
                
                arguments[0].preventDefault();
                
                menuDisplayed = true;
            }, false);
            
            window.addEventListener("click", function() {
                if(menuDisplayed == true){
                    menuBox.style.display = "none"; 
                }
            }, true);
        </script>
        <style>
            .menu
            {
                width: 150px;
                box-shadow: 3px 3px 5px #888888;
                border-style: solid;
                border-width: 1px;
                border-color: grey;
                border-radius: 2px;
                padding-left: 5px;
                padding-right: 5px;
                padding-top: 3px;
                padding-bottom: 3px;
                position: fixed;
                display: none;
            }
            
            .menu-item
            {
                height: 20px;
            }
            
            .menu-item:hover
            {
                background-color: #6CB5FF;
                cursor: pointer;
            }
        </style>
    </head>
    <body>
        <div class="menu">
            <div href="cikis.php" class="menu-item"><a href="fg.php">Barkod İle Arama</a></div>
        </div>
    </body>
</html>

