  <div class="box-content">

                <form name="form" method="post" role="form">
				
     	
    <div class="form-group">
    



				           <div class="form-group has-success col-md-4">
                        <input type="text" class="form-control"  name="kasano" >
                    </div>
				
				        
                    </div>

                   
               
                   &nbsp&nbsp&nbsp <button type="submit" class="btn btn-default"> &nbsp&nbsp&nbsp Raporla &nbsp&nbsp&nbsp</button>
                </form>

            </div>
        </div>
 <?php error_reporting(0);
 date_default_timezone_set('Europe/Istanbul');
 
 $conn = odbc_connect('DRIVER={SQL Server};SERVER=Localhost,1433;DATABASE=online_ciro','sa','be3rAswa2017');

if($_POST['kasano']){

 $sayi =$_POST['kasano'];
 
 $gdr =odbc_exec($conn," 
select top 1 KasaNo,Zno from Zraporu where KasaNo='00$sayi' order by id desc

 ");

while($ver=odbc_fetch_array($gdr)){
	
	$zno = $ver["Zno"];
	$kno = $ver["KasaNo"];
}
 
 $no = $zno + 1;
$myol = "\\\\Server\\inpos\\POSKON\\PRF$no.$kno";
$syol = "\\\\192.168.2.28\\inpos\\POSKON\\PRF$no.$kno";
$zyol = "C:\xampp\htdocs\posnet\ZR";
if($kno < '4'){
$execute = ('xcopy '. ''.$myol.'' .   ' C:\xampp\htdocs\posnet\ZR');
exec($execute,$output);
}else{
	$execute = ('xcopy '. ''.$syol.'' .   ' C:\xampp\htdocs\posnet\ZR');
exec($execute,$output);
	
}
function tarih ($dosya) { 
 
$tarih=date("Y-m-d H:i:s",filectime($dosya)); 
 
$months        =       array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); 
$aylar        =       array("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"); 
 
$tarih        =       str_replace($months, $aylar, $tarih); 
return  $tarih; 
}


$tarih = tarih("zr\PRF$no.$kno"); 


$satir = 11;
$satir1 = 10;



$Dosya = file("zr\PRF$no.$kno");

$SatirSayisi = count($Dosya);

echo $Dosya[10].'<br>';
echo $Dosya[11];
fclose($Dosya);


$nak = $Dosya[8];
$krd = $Dosya[10];
$toplam = $Dosya[11];

$nkt = explode (" ",$nak);
$krd = explode (" ",$krd);
$toplam = explode (" ",$toplam);


$kasano = "$kno";
$kredi = $krd[2];
$nakit = $nkt[2];
$topla = $toplam[2];

if(!empty($topla)){
odbc_exec($conn," 
INSERT INTO [dbo].[Zraporu]
           ([KasaNo]
           ,[Kredi]
           ,[Nakit]
           ,[Toplam]
           ,[Zno]
           ,[Tarih])
     VALUES
           ('$kasano'
           ,'$kredi'
           ,'$nakit'
           ,'$topla'
           ,'$no'
           ,'$tarih')

 ");
 
}
}
?>
