<?php
$path="../../";
include("../../map.php");
if($ver<>7){
	header("Content-Type: text/html;charset=utf-8");
	header('Content-Encoding: UTF-8');
	header("Content-Disposition: attachment; filename=tahsilat.xls");
}
echo "\xEF\xBB\xBF"; // UTF-8 BOM
$ts = new DateTime('first day of this month');
?>
<table border="1">
	<tr>
		<th class="" style=""><?php echo $sdil["40"]?></th>
		<th class="" style=""><?php echo $t25s[0]?></th>
		<th class="" style="text-align:right;"><?php echo $sdil["115"]?></th>
		<th class="" style="text-align:right;">Banka</th>
		<th class="" style="text-align:right;"><?php echo $sdil["144"]?></th>
	</tr>
	<?php
	$sqld=mysqli_query($conn, "select * from t1 where ne='dekont' and (n1 like '%".$_GET["key"]."%' or t3 like '%".$_GET["key"]."%' or t6 like '%".$_GET["key"]."%') order by id desc"); while($rsd=mysqli_fetch_assoc($sqld)){
		$sqlu2=mysqli_query($conn, "select * from t5 where id=".$rsd["s1"].""); $rsu2=mysqli_fetch_assoc($sqlu2);
		$sqlu19=mysqli_query($conn, "select * from t5 where (id=".$rsd["s19"]." or id=".$rsu2["s19"].")"); $rsu19=mysqli_fetch_assoc($sqlu19);
		if(($_GET["ts1"]=="" and $_GET["ts2"]=="" and ($rsd["t15"] <= date('Y-m-d') and $rsd["t15"] >= $ts->format('Y-m-d'))) or ($_GET["ts1"]<>"" and $_GET["ts2"]<>"") and ($rsd["t15"]>=$_GET["ts1"] and $rsd["t15"]<=$_GET["ts2"])){
			?>
			<tr data-id="<?php echo $rsd["id"];?>" style="height:25px;">
				<td> <?php echo $rsd["n1"];?> </td>
				<td> <?php if(mysqli_num_rows($sqlu2)==0 and mysqli_num_rows($sqlu19)==0){echo "".$rsd["t3"]." {".ctranslate("Üyeliksiz")."}";}elseif(mysqli_num_rows($sqlu2)==0 and mysqli_num_rows($sqlu19)<>0){echo "".$rsu19["t1"]." {".$rsd["t3"]."}";}elseif(mysqli_num_rows($sqlu2)<>0 and mysqli_num_rows($sqlu19)<>0){echo "".$rsu2["t1"]." {".$rsu19["t1"]."}";}else{echo $rsu2["t1"];}?> </td>
				<td  style="text-align:right;"> <?php echo dtarih($rsd["ts1"],"gg.ka.yy+time"," ")?></td>
				<td  style="text-align:right;"> <?php echo $rsd["t6"]?></td>
				<td  style="text-align:right;"> <?php echo wprice($rsd["pb1"]);?> <i class="fa fa-<?php echo strtolower($rsd["t9"]);?>"></i><br><span style="font-size:11px;"><?php echo $rsd["t7"]?>x<?php echo wprice($rsd["pb1"]/$rsd["t7"]);?></span></td>
			</tr>
		<?php }}?>
	</table>