 
	
<?php

error_reporting(0); @session_start();



if(isset($_POST['search']))
{
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']);
function convert($data)
{
if(strpos($data,","))
{$chng = str_replace(",",".",$data); $data = $chng;}
return $data;
}   $barkod        =$_POST["search"];

$veri = str_replace(" ","",$barkod);
		$ver = trim($veri);
if(empty($ver)){

}else{
	$sql_check = odbc_exec($conn,"    
            select 
      Bd.Barkodu, 
                                        ST.StokAdi,
                                        ST.StokKodu, 
                                        PB1,Fiyat1,PB2,Fiyat2,PB3,Fiyat3,PB4,Fiyat4,PB5,Fiyat5 
                                        FROM Barkodlar BD 
                                        INNER JOIN Birimler BR ON BR.Id = BD.BirimId
                                        INNER JOIN Stoklar ST ON ST.Id = BR.StokId
                                        WHERE BD.Barkodu = '$barkod' ");
while($satir=odbc_fetch_array($sql_check)){

$adi     = $satir['StokAdi'];
$kodu    = $satir["StokKodu"];
$sfiyat  = $satir["Fiyat1"];
$net_fiyat_net      = number_format($sfiyat, 2, '.', '.');
$s_fiyat  = "<div class='animated zoomInDown' ><span style=' font-size: 80px;'><u><b> $net_fiyat_net </u></span><span style=' font-size: 50px;'>TL</span><div>";

$kdv     = $satir["alis_kdv"];
$sube_id     = $satir["SubeId"];
$birim_adi    = $satir["default_birim_adi"];
$row = odbc_num_rows($sql_check);

}




if($barkod){

$env = odbc_exec($conn,"  
 
               SELECT
--(SELECT B.Barkodu FROM Birimler Br, Barkodlar B WHERE Br.Id = S.AnaBirim AND B.Id = Br.BarkodId) Barkodu,
S.Id, Envanter, R.SubeId, StokKodu, StokAdi, Tanimi, StokTipi, Durum, OzelKod0, OzelKod1, OzelKod2, OzelKod3, OzelKod4, OzelKod5, OzelKod6,
KritikSeviye, OptimumSeviye, HemenTeslim, Tarih, Prim, Taksit, AlisFiyati, AlisPB, Tanimi, Seri, Birim.Adi AS BirimAdi ,(SELECT B.Barkodu FROM Barkodlar B WHERE B.Id = Birim.BarkodId) Barkodu , Fiyat1, PB1  , Fiyat2, PB2  , Fiyat3, PB3  , Fiyat4, PB4  , Fiyat5, PB5  FROM
--Stoklar
Stoklar AS S
INNER JOIN Birimler AS Birim ON Birim.Id = S.AnaBirim
--Envanter EX
LEFT JOIN (SELECT E.StokId, SubeId, Envanter
--E.StokId, SUM(Envanter) AS Envanter, SubeId
FROM
--ENVANTER
(

SELECT StokId, SUM(Envanter) AS Envanter, SubeId FROM (
SELECT
StokId, (Giren - Cikan) * Carpan AS Envanter,
CASE WHEN BelgeTipi IN (41,57) AND Giren > 0 THEN CAST(CariId AS smallint) ELSE SubeId END SubeId
FROM StokHareketleriDetayli SD
WHERE BelgeTipi NOT IN (26,27,30,31,42,45,46, 232, 60,61,64,65)

) AS R
WHERE 1=1

GROUP BY StokId, SubeId

) AS E

WHERE 1=1 
--GROUP BY E.StokId --Eğer şube toplam istenirse

) AS R ON R.StokId = S.Id



WHERE 1=1 AND Durum IN (0) AND S.Id IN (SELECT Brm.StokId FROM Barkodlar Brk, Birimler Brm
WHERE Brk.BirimId = Brm.Id AND Barkodu LIKE '81000098%') AND (Envanter > 0 OR Envanter < 0) ORDER BY S.Id, R.SubeId
go
 ");
  while($sor=odbc_fetch_array($env)){
	  
	  $envan     = $sor["Envanter"];
	  $envanter      = number_format($envan, 2, '.', '.');
	 
}
}

   if($row==0) {
	
 $sonuc =  "<font size=6  ><div class='animated rubberBand red'><b>Urun Bulunamadi ! </b></div>";   
header("Refresh: 10;");
	
 }  else{
	 
	$sonuc =  "<font size=6  ><div class='yellow'><b> $adi  </b></div>";   
	$sonucc =  " $s_fiyat ";   
	header("Refresh: 10;");
	
	}
}
}
?>
 <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
               >
				</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" />
	<a  href="isimmfg.php" class="btn btn-default" >İsim ile Sorgula </a>
	<hr>



</head>
<body>


 <font size=5  ><b> Lütfen Barkod Giriniz... </b></font> 
<form class="form-inline" role="form" name="test" action="#" method="POST">
                    <div class="form-group has-success has-feedback">
                   
                        <input  style=" width:400px; height:70px; font-size:44px;" id="myInput" face='DS-Digital'  type="tel"  class="form-control" id="inputSuccess1" name="search"  autofocus  autocomplete="off" >
       
                    </div>
					<button class="button lg" type="submit">Ara</button>
                </form>
				<hr>
				
	
<?php 

echo mb_convert_encoding($sonuc, "UTF-8", "ISO-8859-9");
echo " $sonucc "; ?>
<hr><?php
echo "$envanter ";
 odbc_close($conn);
 ?>

</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="cikis.php">Çıkış</a></div>
            
            
    
        </div>
    </body>
</html>