<?php
header('Content-type: text/html; charset=utf-8');
$path="../../../";
include("".$path."deppo/tools/script/cevir.php");
$path2="config/"; include("".$path."config/map.php");
include("".$path."deppo/tools/script/fonksiyon".$ver.".php");
$raporTarihi = date("d.m.Y");
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
<script src="//code.jquery.com/jquery-latest.js" type="text/javascript"></script>
<?php include("".$path."deppo/tools/inc.php");?>
<style>
	body { font-family: Arial, sans-serif; background: #f7f7f7; margin: 20px; }
	.v3-container { margin: auto; background: white; padding: 15px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
	.antet { display: flex; justify-content: space-between; align-items: center; background: #f8f8f8; padding: 15px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); margin-bottom: 20px; }
	.logo img { height: 50px; margin-right: 10px;  float:left;}
	.rapor-baslik { font-size: 18px; font-weight: bold; color: #333; float:left; line-height: 50px;}
	.bilgiler { text-align: right; font-size: 14px; color: #555; }
</style>
<div class="v3-container" id="printed">
<?php
	if($module["e8_type"]=="1"){$dn="display:none";}
	$sql=mysqli_query($conn, "select * from t5 where id=".$_GET["id"]." order by id desc"); $rsm=mysqli_fetch_assoc($sql);
?>
    <title><?php echo $rsm["t1"]?> Cari Raporu</title>
    <div class="antet">
    <div class="logo">
        <img src="https://cdn.crmplus.com.tr/images/crm.png" alt="Logo">
        <div class="rapor-baslik">Cari Raporu</div>
    </div>
    <div class="bilgiler">
        <div>Müşteri: <?= $rsm["t1"] ?></div>
        <div>Rapor Tarihi: <?= $raporTarihi ?></div>
    </div>
</div>
    <table class="v3-table noshadow">
        <thead class="table-dark">
            <tr>
                <th class="w8"><?php echo translate("Tarih")?></th>
                <th><?php echo translate("Kısa Açıklama")?></th>
                <th style="text-align:right;" class='w15'><?php echo translate("Borç")?></th>
                <th style="text-align:right;" class='<?php echo $type?> w15'><?php echo translate("Ödenen")?></th>
            </tr>
        </thead>
        <tbody>
            <?php
				$sqlc=mysqli_query($conn, "select * from t4 where ne='cari' and s1=".$_GET["id"]." order by id desc"); while($hcari=mysqli_fetch_assoc($sqlc)){
				include("".$path."crmplus/modules/clients/client_current_calc2.php");
			?>
            <?php if(($_GET["ts1"]=="" and $_GET["ts2"]=="") or ($_GET["ts1"]<>"" and $_GET["ts2"]<>"") and ($hcari["t4"]>=$_GET["ts1"] and $hcari["t4"]<=$_GET["ts2"])){?>
            <tr>
                <td><?php echo dtarih($hcari["t4"],"gg/aa/yy")?></td>
                <td><?php echo $hcari["n1"]?></td>
                <td style="text-align:right;"><?php echo wprice($hcari["pb1"])?> <i class="fa fa-<?php echo $hcari["t6"]?>"></i></td>
                <td style="text-align:right;" class='<?php echo $type?>'><?php echo wprice($hcari["pb3"])?> <i class="fa fa-<?php echo $hcari["t6"]?>"></i></td>
            </tr>
            <?php }?>
            <?php }?>
            <tr>
                <td colspan='1'>
                    <?php if(($mcpb1-$mcpb2)-($mcpb3-$mcpb4)>0){?>
                    <button class="v3-btn"><?php echo translate("Bakiye")?> : <?php echo wprice(($mcpb1-$mcpb2)-($mcpb3-$mcpb4))?> <?php echo $ikpb?></button>
                    <?php }?>
                </td>
                <td colspan='3' style='text-align: right; color: #f00; font-size: 14px; font-weight: 800;'>
                    <?php if($module["currency"]<>""){?>
                    <button class="v3-btn v3-btn-success"><?php echo translate("Bakiye")?> : <?php echo wprice(($cpb1-$cpb2)-($cpb3-$cpb4))?> <?php echo $ikpb?></button>
                    <?php }else{?>
                    <?php if(($try_pb1-$try_pb2)-($try_pb3-$try_pb4)>0){?>
                    <button class="v3-btn v3-btn-success"><i class="fa fa-try"></i> <?php echo wprice(($try_pb1-$try_pb2)-($try_pb3-$try_pb4))?></button>
                    <?php }?>
                    <?php if(($eur_pb1-$eur_pb2)-($eur_pb3-$eur_pb4)>0){?>
                    <button class="v3-btn v3-btn-success"><i class="fa fa-eur"></i> <?php echo wprice(($eur_pb1-$eur_pb2)-($eur_pb3-$eur_pb4))?></button>
                    <?php }?>
                    <?php if(($usd_pb1-$usd_pb2)-($usd_pb3-$usd_pb4)>0){?>
                    <button class="v3-btn v3-btn-success"><i class="fa fa-usd"></i> <?php echo wprice(($usd_pb1-$usd_pb2)-($usd_pb3-$usd_pb4))?></button>
                    <?php }?>
                    <?php if(($gbp_pb1-$gbp_pb2)-($gbp_pb3-$gbp_pb4)>0){?>
                    <button class="v3-btn v3-btn-success"><i class="fa fa-gbp"></i> <?php echo wprice(($gbp_pb1-$gbp_pb2)-($gbp_pb3-$gbp_pb4))?></button>
                    <?php }?>
                    <?php }?>
                </td>
            </tr>
        </tbody>
    </table>
</div>