<div class="inner-wrapper">
	<section role="main" class="content-body">
		<header class="page-header">
			<h2><?php echo $sdil[23]; //Muhasebe?></h2>
			
			<div class="right-wrapper text-right">
				<ol class="breadcrumbs">
					<li>
						<a href=".">
							<i class="fa fa-home"></i>
						</a>
					</li>
					<li><span><?php echo $sdil[23]; //Muhasebe?></span></li>
					<li><span><?php echo $sdil[24]; //Faturalar?></span></li>
				</ol>
				
				<a class="sidebar-right-toggle" data-open="sidebar-right"><i class="fa fa-chevron-left"></i></a>
			</div>
		</header>
		<?php if($_GET["durum"]=="ok"){?>
			<div class="alert alert-success">
				<?php echo $sdil[212]; //Islem Basariyla Gerçeklestirilmistir !?>
			</div>
		<?php }?>
		<div class="v3-row" id="process"></div>
		<div class="row">
			<div class="col">
				<section class="card">
					<header class="card-header">
						<div class="card-actions">
							<button type="button"  style="float:right; margin-left:10px;margin-top: 5px;" class="btn btn-default" data-toggle="dropdown"> <i class="fa fa-plus"></i> </button>
							<div class="dropdown-menu" role="menu">
								<a class="btn btn-warning dropdown-item text-1 mt2 mfrm" data-toggle="modal" data-target="#myModal"  data-width="90%" data-url="modules/accounting/accounting_invoice.php?ne=<?php echo $_GET["ne"]?>&islem=sfatura" data-ref="?ne=muhasebe&islem=fatura" data-title="<?php echo $sdil[148]; //Satış?> <?php echo $sdil[24]; //Faturalar?>"><i class="fa fa-plus "></i> <?php echo $sdil[148]; //Satış?> <?php echo $sdil[24]; //Faturalar?></a>
								<a class="btn btn-success dropdown-item text-1 mt2 mfrm" data-toggle="modal" data-target="#myModal"  data-width="90%" data-url="modules/accounting/accounting_invoice.php?ne=<?php echo $_GET["ne"]?>&islem=afatura" data-ref="?ne=muhasebe&islem=fatura" data-title="<?php echo $sdil[149]; //Alış?> <?php echo $sdil[24]; //Faturalar?>"><i class="fa fa-plus "></i> <?php echo $sdil[149]; //Alış?> <?php echo $sdil[24]; //Faturalar?></a>
								<a class="btn btn-danger dropdown-item text-1 mt2 mfrm" data-toggle="modal" data-target="#myModal"  data-width="90%" data-url="modules/accounting/accounting_invoice.php?ne=<?php echo $_GET["ne"]?>&islem=ifatura" data-ref="?ne=muhasebe&islem=fatura" data-title="<?php echo $sdil[139]; //İptal?> <?php echo $sdil[24]; //Faturalar?>"><i class="fa fa-plus "></i> <?php echo $sdil[139]; //İptal?> <?php echo $sdil[24]; //Faturalar?></a>
							</div>
							<?php include("modules/public/filter.php");?>
						</div>
						
						<h2 class="card-title cb"><?php echo $sdil[24]; //Faturalar?></h2>
						<p class="card-subtitle">...</p>
					</header>
					<div class="card-body" style="">
					<?php if($_GET["ts1"]=="" and $_GET["ts2"]==""){?>
						<div class="alert alert-warning">#<?php echo translate("Son 30 Gün Listeniyor.")?></div>
					<?php }?>
						<table class="table"  style="">
							<thead>
								<tr class="mdn">
									<th class="black-cell w10 mw10" style="">ID</span></th>
									<th scope="col" class=""><?php echo $t25; //Cari?></th>
									<th scope="col" class="w12 mw12"><?php echo translate("Fatura Tarihi")?></th>
									<th scope="col" class="w8 mw8"><?php echo translate("Fatura Tipi")?></th>
									<th scope="col" class="w8 mw8"><?php echo $sdil[154]; //Ödeme Tipi?></th>
									<th scope="col" class="w15 mw15 tar"><?php echo $sdil[176]; //tutar?></th>
								</tr>
							</thead>
							<tbody>
								<?php
								$ts1="";$ts2="";
								if($_GET["type"]<>""){
									$sorgu="ne like '%".$_GET["type"]."%'";
								}else{
									$sorgu="ne='sfatura' or ne='afatura' or ne='ifatura'";
								}
								$sqlf = mysqli_query($conn, "select * from t4 where ".$sorgu." $lacc order by id desc"); while($rsf=mysqli_fetch_assoc($sqlf)){
									if(($_GET["ts1"]=="" and $_GET["ts2"]=="" and $rsf["t9"] >= date('Y-m-d', strtotime(date("Y-m-d"). ' -30 days'))) or ($_GET["ts1"]<>"" and $_GET["ts2"]<>"") and ($rsf["t9"]>=$_GET["ts1"] and $rsf["t9"]<=$_GET["ts2"])){
									$sqlm = mysqli_query($conn, "select * from t5 where id=".$rsf["s1"]." order by id desc"); $rsm=mysqli_fetch_assoc($sqlm);
									$tahsilat=0;
									$sqlhc=mysqli_query($conn, "select * from t4 where ne='cari' and s5=".$rsf["id"]." order by id desc"); while($hcari=mysqli_fetch_assoc($sqlhc)){
										$tahsilat = $tahsilat + $hcari["pb3"];
									}
									?>
									<tr class="cp <?php if($rsf["pb2"]<>$tahsilat){echo "bg-warning";}else{echo "bg-success";}?> mfrm" data-toggle="modal" data-target="#myModal"  data-width="90%" data-url="modules/accounting/accounting_invoice.php?ne=muhasebe&islem=<?php echo $rsf["ne"]?>&id=<?php echo $rsf["id"]?>" data-title="<?php echo $sdil[24]; //Faturalar?>">
										<td scope="row" class="mdn cp text-info cp"><b><?php echo i2a($rsf["id"],7);?></b><br><?php echo $rsf["t1"]?></td>
										<td class=""><?php echo $rsm["t1"]?> <?php echo $rsf["n2"]?></td>
										<td><?php echo dtarih($rsf["t9"],"gg ua yyyy")?><?php if($rsf["t6"]<>""){echo "<br>".dtarih($rsf["t6"],"gg ua yyyy");?> <?php if($rsf["pb2"]-$rsf["pb3"]<>0){?><?php if($rsf["pb2"]<>$tahsilat and $rsf["t6"]<>"" and date("Y-m-d") >= $rsf["t6"]){echo '<i class="fa fa-exclamation-triangle text-danger" title=""></i>';}}}?></td>
										<td class="mdn"><?php if($rsf["ne"]=="afatura"){?><?php echo $sdil[149]; //Alış?><?php }elseif($rsf["ne"]=="sfatura"){?><?php echo $sdil[148]; //Satış?><?php }elseif($rsf["ne"]=="ifatura"){?><?php echo $sdil[139]; //İptal?><?php }?> <?php echo $sdil[24]; //Faturalar?></td>
										<td class="mdn"><?php echo $rsf["t2"]?></td>
										<td style="text-align:right;">
											<?php echo number_format($rsf["pb2"], 2, ',', '.');?> <?php echo $ikpb?><br>
											<?php if($rsf["pb2"]<>$tahsilat){?>
											<b>Kalan Bakiye : <?php echo number_format($rsf["pb2"]-$tahsilat, 2, ',', '.');?> <?php echo $ikpb?></b>
											<?php }else{?>
											<b>Tahsil Edildi</b>
											<?php }?>
										</td>
									</tr>
								<?php }}?>
							</tbody>
						</table>
					</div>
				</section>
			</div>
		</div>
		<!-- end: page -->
	</section>
</div>
<aside id="sidebar-right" class="sidebar-right">
	<div class="nano">
		<div class="nano-content">
			<a href="#" class="mobile-close d-md-none">
				Collapse <i class="fa fa-chevron-right"></i>
			</a>
			<div class="sidebar-right-wrapper">
				...
			</div>
		</div>
	</div>
</aside>
</section>