<?php
$path="../../";
include("../../map.php");
?>
<table class="v3-table" style="">
<thead>
	<tr class="mdn">
		<th class="w20 mw20"><?php echo ctranslate("F.No")?></th>
		<th class="w10 mw10" style=""><?php echo ctranslate($t25s[0]);?></th>
		<th class="" style=""><?php echo ctranslate($t24s[0]);?></th>
		<th class="tac w8 mw6"><?php echo ctranslate("Miktar")?></th>
		<th class="w10 mw10"><?php echo ctranslate("Tarih")?></th>
	</tr>
</thead>
<tbody>
	<?php
		$sqlreport = mysqli_query($conn, "select * from t4 where ne='stok' order by id desc"); while($report=mysqli_fetch_assoc($sqlreport)){
		$sqlu = mysqli_query($conn, "select * from ".$_SESSION['lang']." where ne='kayit' and id='".$report["s2"]."' order by id desc"); $rsu=mysqli_fetch_assoc($sqlu);
		$sqlm=mysqli_query($conn, "select * from t5 where id=".$report["s1"].""); $rsm=mysqli_fetch_assoc($sqlm);
	?>
	<tr class="" onclick="location.href='?islem=dkayit&ne=kayit&id=<?php echo $rsm["id"]?>#&tab-rapor'" style="cursor:pointer;">
		<td class="tal mdn mtal"><?php if($report["s5"]<0){?><i class="fa fa-sign-out"></i><?php }else{?><i class="fa fa-sign-in"></i><?php }?> <?php echo $report["id"]?></td>
		<td class="mdn"><?php echo names($rsm["t1"],"sname");?></td>
		<td class=""><?php echo kisalt($rsu["t1"],5);?></td>
		<td class="tac">x <?php echo $report["s5"];?></td>
		<td class="mdn"><div title="<?php echo dtarih($report["ts1"],"gg ka yyyy");?>" class="v3-date"><span><?php echo dtarih($report["ts1"],"gg");?></span><span><?php echo dtarih($report["ts1"],"ka");?></span></div></td>
	</tr>
	<?php }?>
	<?php
	$sqlreport = mysqli_query($conn, "select * from t4 where ne='furun' order by id desc"); while($report=mysqli_fetch_assoc($sqlreport)){
		$sqlu = mysqli_query($conn, "select * from ".$_SESSION['lang']." where ne='kayit' and id='".$report["s2"]."' order by id desc"); $rsu=mysqli_fetch_assoc($sqlu);
		$sqlf=mysqli_query($conn, "select * from t4 where id=".$report["s1"].""); $rsf=mysqli_fetch_assoc($sqlf);
		$sqlm=mysqli_query($conn, "select * from t5 where id=".$rsf["s1"].""); $rsm=mysqli_fetch_assoc($sqlm);
		?>
	<tr class="" onclick="location.href='?islem=dkayit&ne=kayit&id=<?php echo $rsm["id"]?>#&tab-rapor'" style="cursor:pointer;">
		<td class="tal mdn mtal"><?php if($rsf["ne"]=="sfatura"){?><i class="fa fa-sign-out"></i><?php }else{?><i class="fa fa-sign-in"></i><?php }?> <?php echo $rsf["t1"]?></td>
		<td class="mdn"><?php echo names($rsm["t1"],"sname");?></td>
		<td><?php echo kisalt($rsu["t1"],5);?></td>
		<td class="tac">x <?php if($rsf["ne"]=="sfatura"){echo $report["s5"]*-1;}else{echo $report["s5"];}?></td>
		<td class="mdn"><div title="<?php echo dtarih($report["ts1"],"gg ka yyyy");?>" class="v3-date"><span><?php echo dtarih($report["ts1"],"gg");?></span><span><?php echo dtarih($report["ts1"],"ka");?></span></div></td>
	</tr>
	<?php }?>
	<?php
		$sqlb = mysqli_query($conn, "select distinct t4,s5,s3,s2 from eticaret where ne='sepet' order by id desc"); while($siparissep=mysqli_fetch_assoc($sqlb)){
		$sqlu = mysqli_query($conn, "select * from ".$_SESSION['lang']." where ne='kayit' and id='".$siparissep["s3"]."' order by id desc"); $rsu=mysqli_fetch_assoc($sqlu);
	if(mysqli_num_rows($sqlu)>0){
		$sqls = mysqli_query($conn, "select * from eticaret where ne='siparis' and id=".$siparissep["s5"]." and (s4=1 or s4=4 or s4=3)"); $siparis=mysqli_fetch_assoc($sqls);
		if(mysqli_num_rows($sqls)>0){
		$sqlm=mysqli_query($conn, "select * from t5 where id=".$siparis["s1"].""); $rsm=mysqli_fetch_assoc($sqlm);
	?>
	<tr class="" onclick="window.open('?ne=eticaret&islem=siparis&id=<?php echo $siparis["id"];?>')" style="cursor:pointer;">
		<td class="tal mdn mtal"><i class="fa fa-shopping-basket" title="Cikis"></i> <?php echo substr($siparis["t4"],0,10)?></td>
		<td class="mdn"><?php echo names($rsm["t1"],"sname");?></td>
		<td class=""><?php echo kisalt($rsu["t1"],5);?></td>
		<td class="tac">x <?php echo $siparissep["s2"]*-1;?></td>
		<td class="mdn"><div title="<?php echo dtarih($siparis["ts1"],"gg ka yyyy");?>" class="v3-date"><span><?php echo dtarih($siparis["ts1"],"gg");?></span><span><?php echo dtarih($siparis["ts1"],"ka");?></span></div></td>
	</tr>
	<?php }}}?>
</table>