<?php
include("../../../secure.php");
$path="../../../";
include("../../../map.php");
include("../../../scripts.php");
$sqlf = mysqli_query($conn, "select * from t4 where id=".$_GET["id"]." order by id desc"); $rsf=mysqli_fetch_assoc($sqlf);
$sqlff = mysqli_query($conn, "select * from t5 where id=".$rsf["s1"]." order by id desc"); $rsff=mysqli_fetch_assoc($sqlff);
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
<style type="text/css">
	table {font-family: 'Open Sans', sans-serif; font-size:12px;}
</style>
<?php if($MSA<>1){?>
<body onload="window.print()">
<?php }?>
			<table class="table" style="font-size:12px;">
				<tr>
					<td scope="col" style="width:30%;" colspan=2 class=""><b><?php echo $rsff["t1"]?></b><br><?php echo $firma?></td>
					<td scope="col" style="text-align:center; font-size:15px; font-weight:bold" class="">Fiş Listesi</td>
					<td scope="col" style="width:30%;text-align:right" colspan=2 class=""><?php echo dtarih(date("Y-m-d H:i:s"),"gg.aa.yyyy time")?></td>
				</tr>
			</table>
			<table class="table" style="font-size:12px;">
				<tr>
					<td scope="col" style="width:15%;" class="">Fiş No {<?php echo $rsf["id"]?>}</td>
					<td scope="col" style="width:15%;" class="">Fiş Tarihi {<?php echo dtarih($rsf["t9"],"gg.aa.yyyy");?>}</td>
					<td scope="col" style="" class="">Açıklama {<?php echo $rsf["n1"]?>}</td>
					<td scope="col" style="width:15%;" class=" tar">{<?php echo $rsf["t2"]?>} Fişi</td>
					<td scope="col" style="width:15%;" class=" tar"></td>
				</tr>
			</table>
			<table class="table" style="font-size:12px;">
				<tr>
					<th scope="col" style="width:14%;" class="">Hesap Kodu</th>
					<th scope="col" style="width:29%;" class="">Hesap Adı</th>
					<th scope="col" style="" class="">Açıklama</th>
					<th scope="col" style="width:12%;" class=" tar">Tutar</th>
					<th scope="col" style="width:12%;" class=" tar">Borç</th>
					<th scope="col" style="width:12%;" class=" tar">Alacak</th>
				</tr>
				<?php $i=0;$sqlfu = mysqli_query($conn, "select * from t4 where s1=".$_GET["id"]." order by id asc"); while($rsfu=mysqli_fetch_assoc($sqlfu)){$i++?>
				<?php $sqlfx = mysqli_query($conn, "select * from kategoriler where t4='".substr($rsfu["t2"],0,3)."'"); $rsfx=mysqli_fetch_assoc($sqlfx);?>
					<tr>
						<th scope="col" class=""><?php echo $rsfx["t4"]?></th>
						<th scope="col" class=""><?php echo $rsfx["Cat_".$_SESSION['lang'].""]?></th>
						<th scope="col" class=""></th>
						<th scope="col" class="tar"></th>
						<th scope="col" class="tar"><?php if($rsfu["pb1"]<>0){echo number_format($rsfu["pb1"],2, ',', '.');}?></th>
						<th scope="col" class="tar"><?php if($rsfu["pb2"]<>0){echo number_format($rsfu["pb2"],2, ',', '.');}?></th>
					</tr>
					<tr>
						<td scope="col" class=""><?php echo $rsfu["t2"]?></td>
						<td scope="col" class=""><?php echo $rsfu["t3"]?></td>
						<td scope="col" class=""><?php echo $rsfu["t4"]?></td>
						<td scope="col" class="tar"><?php if($rsfu["pb1"]<>0){echo number_format($rsfu["pb1"],2, ',', '.');}else{echo number_format($rsfu["pb2"],2, ',', '.');}?></td>
						<td scope="col" class="tar"></td>
						<td scope="col" class="tar"></td>
					</tr>
				<?php }?>
				<tr>
					<td scope="col" class="">Toplam</td>
					<td scope="col" class=""></td>
					<td scope="col" class=""></td>
					<td scope="col" class="tar"></td>
					<td scope="col" class=" tar"><?php echo number_format($rsf["pb1"],2, ',', '.')?></td>
					<td scope="col" class=" tar"><?php echo number_format($rsf["pb2"],2, ',', '.')?></td>
				</tr>
			</table>