<?php
header("Content-Type: text/html;charset=utf-8");
error_reporting(0);
$path="../../";
if($_POST){
	if($_POST["xls"]<>""){
		header('Content-Encoding: UTF-8');
		$file="".$_GET["ne"]."_".date("dmyHis").".xls";
		header("Content-type: application/vnd.ms-excel");
		header("Content-Disposition: attachment; filename=".$file."");
		header("Pragma: no-cache");
		header("Expires: 0");
		echo "\xEF\xBB\xBF"; //UTF-8 BOM
		echo $out;
	}
	include "../".$_GET["path"]."".$_GET["ne"].".php";
}else{
//include("../public/log.php");
include("../../map.php");
include("../../scripts.php");
?>
	<div class="v3-container">
<?php if($_GET["ne"]=="report_clients"){?>
		<div class="panel panel-default" style="margin-top:15%;">
		  <div class="panel-heading">
			<h3 class="panel-title">Genel Rapor</h3>
		  </div>
		  <div class="panel-body">
			<form action="?ne=<?php echo $_GET["ne"];?>&path=<?php echo $_GET["path"];?>" method="post">
				<div class="v3-col-md-6">
					<input type="text" class="form-control" name="q" placeholder="Aranan...">
				</div>
				<div class="v3-col-md-3">
					<input type="date" class="form-control" name="ts1" value="<?php echo date("Y-m-d")?>">
				</div>
				<div class="v3-col-md-3">
					<input type="date" class="form-control" name="ts2" value="<?php echo date("Y-m-d")?>">
				</div>
				<div class="v3-col-md-6">
					<select size=1 name="s2" style="" class="form-control">
						<option value=""><?php echo translate("Tümü")?></option>
						<?php $sqlc=mysqli_query($conn, "select * from kategoriler where ne='kkategori' order by sira asc"); while($rsc=mysqli_fetch_assoc($sqlc)){?>
						<option value="<?php echo $rsc["Cat_ID"];?>" <?php if($rsc["Cat_ID"]==$rsu["s2"]){?>Selected<?php }?> title="<?php echo $rsc["Cat_".$_SESSION["lang"].""];?>" alt="<?php echo $rsc["Cat_".$_SESSION["lang"].""];?>" style="color:#6699FF">[<?php echo $rsc["Cat_ID"];?>] <?php echo $rsc["Cat_".$_SESSION["lang"].""];?></option>
						<?php }?>
					</select>
				</div>
				<div class="v3-col-md-3">
					<label for="xls" style=""> <?php echo translate("xls Export")?>
						<input id="xls" type="checkbox" name="xls" value="true" title="xls export">
					</label>
				</div>
				<div class="v3-col-md-3">
					<button type="submit"  style="" class="v3-btn v3-warning"><?php echo translate("Filtrele")?></button>
				</div>
			</form>
		  </div>
			<div class="panel-footer">Genel Alacak, Borç, Geciken</div>
		</div>
		<div class="panel panel-default">
		  <div class="panel-heading">
			<h3 class="panel-title">Günlük Rapor (Beta)</h3>
		  </div>
		  <div class="panel-body">
			<form action="?ne=<?php echo $_GET["ne"];?>_daily&path=<?php echo $_GET["path"];?>" method="post">
				<div class="v3-col-md-6">
					<input type="text" class="form-control" name="q" placeholder="Aranan...">
				</div>
				<div class="v3-col-md-3">
					<input type="date" class="form-control" name="ts1" value="<?php echo date("Y-m-d")?>">
				</div>
				<div class="v3-col-md-3">
					<input type="date" class="form-control" name="ts2" value="<?php echo date("Y-m-d")?>">
				</div>
				<div class="v3-col-md-3">
					<div class="v3-col-md-6">
						<label for="alacak" style=""> <?php echo translate("Alacak")?>
							<input id="alacak" type="radio" name="type" value="alacak" title="<?php echo translate("Alacak")?>" checked>
						</label>
					</div>
					<div class="v3-col-md-6">
						<label for="tahsilat" style=""> <?php echo translate("Tahsilat")?>
							<input id="tahsilat" type="radio" name="type" value="tahsilat" title="<?php echo translate("Tahsilat")?>">
						</label>
					</div>
				</div>
				<div class="v3-col-md-3">
					<select size=1 name="s2" style="" class="form-control">
						<option value=""><?php echo translate("Tümü")?></option>
						<?php $sqlc=mysqli_query($conn, "select * from kategoriler where ne='kkategori' order by sira asc"); while($rsc=mysqli_fetch_assoc($sqlc)){?>
						<option value="<?php echo $rsc["Cat_ID"];?>" <?php if($rsc["Cat_ID"]==$rsu["s2"]){?>Selected<?php }?> title="<?php echo $rsc["Cat_".$_SESSION["lang"].""];?>" alt="<?php echo $rsc["Cat_".$_SESSION["lang"].""];?>" style="color:#6699FF">[<?php echo $rsc["Cat_ID"];?>] <?php echo $rsc["Cat_".$_SESSION["lang"].""];?></option>
						<?php }?>
					</select>
				</div>
				<div class="v3-col-md-3">
					<label for="xls" style=""> <?php echo translate("xls Export")?>
						<input id="xls" type="checkbox" name="xls" value="true" title="xls export">
					</label>
				</div>
				<div class="v3-col-md-3">
					<button type="submit"  style="" class="v3-btn v3-warning"><?php echo translate("Filtrele")?></button>
				</div>
			</form>
		  </div>
			<div class="panel-footer">Belirtilen tarih aralığından belirtilen gün kadar alacak izleme</div>
		</div>
		<div class="panel panel-default">
			<div class="panel-heading">
				<h3 class="panel-title">Aylık Rapor (Beta)</h3>
			</div>
			  <div class="panel-body">
				<form action="?ne=<?php echo $_GET["ne"];?>_monthly&path=<?php echo $_GET["path"];?>" method="post">
					<div class="v3-col-md-9">
						<input type="text" class="form-control" name="q" placeholder="Aranan...">
					</div>
					<div class="v3-col-md-3">
						<input type="number" name="year" class="v3-form-control" style="border-color: #007bff; background-color: #f7f7f7;" placeholder="Yıl" value="<?php echo date('Y')?>">
					</div>
					<div class="v3-col-md-3">
						<div class="v3-col-md-6">
							<label for="alacak" style=""> <?php echo translate("Alacak")?>
								<input id="alacak" type="radio" name="type" value="alacak" title="<?php echo translate("Alacak")?>" checked>
							</label>
						</div>
						<div class="v3-col-md-6">
							<label for="tahsilat" style=""> <?php echo translate("Tahsilat")?>
								<input id="tahsilat" type="radio" name="type" value="tahsilat" title="<?php echo translate("Tahsilat")?>">
							</label>
						</div>
					</div>
					<div class="v3-col-md-3">
						<select size=1 name="s2" style="" class="form-control">
							<option value=""><?php echo translate("Tümü")?></option>
							<?php $sqlc=mysqli_query($conn, "select * from kategoriler where ne='kkategori' order by sira asc"); while($rsc=mysqli_fetch_assoc($sqlc)){?>
							<option value="<?php echo $rsc["Cat_ID"];?>" <?php if($rsc["Cat_ID"]==$rsu["s2"]){?>Selected<?php }?> title="<?php echo $rsc["Cat_".$_SESSION["lang"].""];?>" alt="<?php echo $rsc["Cat_".$_SESSION["lang"].""];?>" style="color:#6699FF">[<?php echo $rsc["Cat_ID"];?>] <?php echo $rsc["Cat_".$_SESSION["lang"].""];?></option>
							<?php }?>
						</select>
					</div>
					<div class="v3-col-md-3">
						<label for="xls" style=""> <?php echo translate("xls Export")?>
							<input id="xls" type="checkbox" name="xls" value="true" title="xls export">
						</label>
					</div>
					<div class="v3-col-md-3">
						<button type="submit"  style="" class="v3-btn v3-warning"><?php echo translate("Filtrele")?></button>
					</div>
				</form>
			  </div>
			<div class="panel-footer">Aylık bazda alacak izleme</div>
		</div>
<?php }else{?>
		<div class="panel panel-default" style="margin-top:15%;">
		  <div class="panel-heading">
			<h3 class="panel-title">Genel Rapor</h3>
		  </div>
		  <div class="panel-body">
			<form action="?ne=<?php echo $_GET["ne"];?>&path=<?php echo $_GET["path"];?>" method="post">
					<div class="v3-col-md-12">
						<input type="text" class="form-control" name="q" placeholder="Aranan...">
					</div>
				<div class="v3-col-md-6">
					<input type="date" class="form-control" name="ts1" value="<?php echo date("Y-m-d")?>">
				</div>
				<div class="v3-col-md-6">
					<input type="date" class="form-control" name="ts2" value="<?php echo date("Y-m-d")?>">
				</div>
<?php if($_GET["ne"]<>"report_ecommerces"){?>
				<div class="v3-col-md-6">
					<select size=1 name="s9" style="" class="form-control">
						<option value=""><?php echo translate("Tümü")?></option>
						<?php $sqlc=mysqli_query($conn, "select * from kategoriler where ne='ukategori' order by sira asc"); while($rsc=mysqli_fetch_assoc($sqlc)){?>
						<option value="<?php echo $rsc["Cat_ID"];?>" <?php if($rsc["Cat_ID"]==$rsu["s9"]){?>Selected<?php }?> title="<?php echo $rsc["Cat_".$_SESSION["lang"].""];?>" alt="<?php echo $rsc["Cat_".$_SESSION["lang"].""];?>" style="color:#6699FF">[<?php echo $rsc["Cat_ID"];?>] <?php echo $rsc["Cat_".$_SESSION["lang"].""];?></option>
						<?php }?>
					</select>
				</div>
<?php }?>
<?php if($_GET["ne"]=="report_ecommerces"){?>
				<div class="v3-col-md-2">
						<select size=1 name="type" style="" class="form-control">
						<option value="orders"><?php echo translate("Sadece Siparişler")?></option>
						<option value="order_items"><?php echo translate("Sadece Ürünler")?></option>
						<option value="orders_and_items"><?php echo translate("Sipariş ve Ürünler")?></option>
					</select>
				</div>
				<div class="v3-col-md-2">
						<select size=1 name="odeme" style="" class="form-control">
						<option value="PayTr"><?php echo translate("PayTr")?></option>
						<option value="Havale"><?php echo translate("Havale")?></option>
						<option value="Pos"><?php echo translate("Pos")?></option>
					</select>
				</div>
<?php }?>
				<div class="v3-col-md-6">
					<label for="xls" style="float:left; width:40%;"> <?php echo translate("xls Export")?>
						<input id="xls" type="checkbox" name="xls" value="true" title="xls export">
					</label>
					<button type="submit"  style="float:right;" class="v3-btn v3-warning w50"><?php echo translate("Filtrele")?></button>
				</div>
			</form>
		  </div>
		</div>
<?php }?>
	</div>
<?php }?>