<?php
include("map.php");
include("secure.php");
session_start();
header("Access-Control-Allow-Origin: *");
$ws 	= json_decode(file_get_contents('https://cdn.'.$cdnurl.'/data', false, stream_context_create($arrContextOptions)));
$mmail = array_column(array_filter($ws->data ?? [], fn($i) => $i->type === 'settings'), 'mail')[0] ?? null;

if($_GET["islem"]=="guide" or $_GET["islem"]=="notification" or $_GET["islem"]=="notifications"){}else{}
	if($_GET["islem"]=="izle"){
		include("scripts.php");
		$sql=mysqli_query($conn, "select id,n1, from medya where ne='video' and id=".$_GET["id"].""); $rsv=mysqli_fetch_assoc($sql);
		echo "<div class=\"container-fluid\" style=\"background-color:black; margin-top:10px; text-align:center;\">";
		if($rsv["t4"]==".mp4"){
			echo "
			<link href=\"http://vjs.zencdn.net/5.0.0/video-js.css\" rel=\"stylesheet\">
			<script src=\"http://vjs.zencdn.net/ie8/1.1.0/videojs-ie8.min.js\"></script>
			<video id=\"my-video\" class=\"video-js\" controls preload=\"auto\" width=\"640\" height=\"480\" poster=\"../deppo/video/".$rsv["n2"]."\" data-setup=\"{}\">
			<source src=\"../deppo/video/".$rsv["n1"]."\" type=\"video/mp4\">
			</video>
			<script src=\"http://vjs.zencdn.net/5.0.0/video.js\"></script>
			";
		}else{
			echo "<iframe width=\"100%\" height=\"97%\" src=\"".vcevir($rsv["n1"])."?rel=0&autoplay=1\" frameborder=\"0\" allowfullscreen></iframe>";
		}
		echo "</div>";

	}elseif($_GET["islem"]=="smsg"){
		$sql=mysqli_query($conn, "select distinct n1 from genel where ne='asifre' and n1<>''"); while($rss=mysqli_fetch_assoc($sql)){
			nDevice("CrmPlus+", "Test Bildirim", $rss["n1"], "Crm");
		}

	}elseif($_GET["islem"]=="update_cdn"){
		foreach ($ws->data as $item){
			if($item->type=="settings"){
				$cdn_js = $item->cdn_js;
				$cdn_css = $item->cdn_css;
			}
		}
		echo "<h4>Js's</h4>";
		$cdn_js = explode(",",$cdn_js); foreach($cdn_js as $ijs){
			if(trim($ijs)<>""){
				$js = "../deppo/tools/js/".end(explode('/', $ijs));
				$file	= file_get_contents("https:".trim($ijs), false, stream_context_create($arrContextOptions));
				if(file_exists($js)){ fopen($js, "w"); }
				file_put_contents($js, preg_replace( '/\R+/', "\n", $file));
				echo "https:".trim($ijs)."<br>";
			}
		}
		echo "<hr>";
		echo "<h4>Css's</h4>";
		$cdn_css = explode(",",$cdn_css); foreach($cdn_css as $icss){
			if(trim($icss)<>""){
				$css = "../deppo/tools/css/".end(explode('/', $icss));
				$file	= file_get_contents("https:".trim($icss), false, stream_context_create($arrContextOptions));
				if(file_exists($css)){ fopen($css, "w"); }
				file_put_contents($css, preg_replace( '/\R+/', "\n", $file));
				echo "https:".trim($icss)."<br>";
			}
		}

	}elseif($_GET["islem"]=="integrations"){
		$data = file_get_contents('https://cdn.'.$cdnurl.'/integrations', false, stream_context_create($arrContextOptions));
		Print_r($data);

	}elseif($_GET["islem"]=="market"){
		include("scripts.php");
		foreach ($ws->data as $item){
			if($item->type=="settings"){
				$mmail = $item->mail;
			}
		}
		if($pow1<>"Web Atölyesi"){$ex="1.20";}else{$ex="1";}
		echo '<div id="result"></div>';
		echo '<div style="width: 100%; height: 100vh; overflow: auto;">';
		foreach ($ws->data as $item){
			if($item->type=="kayit"){
				$firms = explode(',',$item->i1); foreach($firms as $firm){
					if($firm=="" or $firm==$pow1){
						echo "
						<form id=\"m".$item->id."\" class=\"col-md-4\" style=\"width:".($mobile<>"" ? "100" : '33')."%; float:left; margin-right:2px;\">
						<input type=\"hidden\" name=\"malici\" value=\"".$mmail."\">
						<input type=\"hidden\" name=\"mesaj\" value=\"".$_SERVER["SERVER_NAME"]." sitesinden <b>".$_SESSION["user"]."</b>; CrmPlus+ Modül Marketten ".$item->title."  ".$item->price." ".$item->pb." Ürün/Hizmet Sipariş Verdi.\">
						<input type=\"hidden\" name=\"konu\" value=\"Market > ".$item->title." Talep\">
						<div class=\"panel\" style=\"border: 1px solid #fff3cd; border-radius: 10px;\">
						<div class=\"panel-heading\" style=\"font-size:22px;\">
						<b><i class=\"".$item->icon."\"></i> ".$item->title."</b><br>
						</div>
						<div class=\"panel-body\">
						<div style=\"height:65px; overflow:auto;\">".$item->description."</div><br>
						<i class=\"fa fa-try\"></i> <b style=\"font-size:18px;\">".wprice(yuvarla(($item->price*$ex)*$usd,50))." + ".ctranslate("Kdv")."</b><br><br>
						<button class=\"btn btn-warning\" id=\"r".$item->id."\" type=\"button\" onclick=\"AjaxPost('?islem=gmail','#m".$item->id."','#result','100');\">".translate("Satın Al")."</button>
						<a href=\"fonksiyon.php?islem=dmarket&id=".$item->id."\" style=\"margin-left:10px;\" class=\"btn btn-info mfrm\">".$sdil[207]."</a>
						</div>
						</div>
						</form>
						";
					}
				}
			}
		}
		echo '</div>';

	}elseif($_GET["islem"]=="dmarket"){
		foreach ($ws->data as $item){
			if($item->id==$_GET["id"]){
				echo "
				<h3>".$item->title."</h3>
				<p>".$item->detail."</p>
				";
			}
		}

	}elseif($_GET["islem"]=="keys"){
		if($_GET["ne"]<>""){$qry="where ne='".$_GET["ne"]."'";}
		$sqlx=mysqli_query($conn, "select n4 from ".$_SESSION["lang"]." $qry"); while($rsx=mysqli_fetch_assoc($sqlx)){
			if($rsx["n4"]<>""){ $keys .= "".$rsx["n4"].","; }
		}
		$iarr = array(); $ekeys = explode(",",$keys);
		foreach($ekeys as $key){
			if($key<>""){ $iarr[] = $key; }
		}
		$sqlx=mysqli_query($conn, "select * from kategoriler where (ne='".$_GET["ne"][0]."kategori' or ne='ukategori') order by sira asc"); while($rsx=mysqli_fetch_assoc($sqlx)){
			$iarr[] = $rsx["Cat_".$_SESSION['lang'].""];
		}
		$kkey=tanim("keys","n1",0); $kkey=($kkey == '') ? $keywords : $kkey; $tags = explode(',',$kkey); foreach($tags as $key){
			if($key<>""){ $iarr[] = $key; }
		}
		sort($iarr);
		foreach (array_unique($iarr) as $i){
			$option .= "<option value=\"".$i."\">".$i."</option>";
		}
		Print_r($option);

	}elseif($_GET["islem"]=="clang"){
		if($_GET["lang"]<>$_SESSION["lang"]){
			echo "url:?";
		}

	}elseif($_GET["islem"]=="clearCache"){
		$cdir = "../deppo/cache/";
		foreach (glob($cdir."*") as $cfile){
			unlink($cfile);
		}
		$_SESSION["cache"] = [];
		echo "Ön Bellek Temizlendi.";

	}elseif($_GET["islem"]=="allread"){
		$sql = mysqli_query($conn, "select * from t1 where ne='dekont'"); while($rs=mysqli_fetch_assoc($sql)){
			$notify = array ('desktop' => '1','browser' => '1','nbrowser' => '1');
			$rjsn = json_encode($notify, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
			$Rs = mysqli_query($conn, "update t1 set n12='".addslashes(stripslashes($rjsn))."' where id=".$rs["id"]."");
		}
		$sql = mysqli_query($conn, "select * from eticaret where ne='siparis'"); while($rs=mysqli_fetch_assoc($sql)){
			$notify = array ('desktop' => '1','browser' => '1','nbrowser' => '1');
			$rjsn = json_encode($notify, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
			$Rs = mysqli_query($conn, "update eticaret set n12='".addslashes(stripslashes($rjsn))."' where id=".$rs["id"]."");
		}
		$sql = mysqli_query($conn, "select * from t2 where (ne='fmesaj' or ne='request' or ne='yorum')"); while($rs=mysqli_fetch_assoc($sql)){
			$notify = array ('desktop' => '1','browser' => '1','nbrowser' => '1');
			$rjsn = json_encode($notify, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
			$Rs = mysqli_query($conn, "update t2 set n12='".addslashes(stripslashes($rjsn))."' where id=".$rs["id"]."");
		}
		
	}elseif($_GET["islem"]=="phpinfo"){
		echo phpinfo(INFO_MODULES);
		if($MSA==1){ echo phpinfo(32); }

	}elseif($_GET["islem"]=="updater"){
		foreach ($ws->data ?? [] as $item) {
			if ($item->type === "haber" && $item->catID == 157 && ($item->i3 != $pow2 && ($item->i1 == "" || $item->i1 == $_SERVER["SERVER_NAME"]) && ($item->i2 == "" || $item->i2 == $pow1) || true)) {
				$i3 = $item->i3; $i4 = $item->i4; $i5 = $item->i5; break;
			}
		}
		$folders = "deppo,config"; // Sabit klasörler
		if (empty($_GET["module"])) {
			$folders .= ",crmplus"; $mpath = "";
		} else {
			$mpath = "sub/".$_GET["module"]."/";
		}
		if (file_exists("../".$mpath."sale")) { $folders .= ",sale"; }
		if (file_exists("../".$mpath."account")) { $folders .= ",account"; }

		if($_GET["mode"] == "console"){
			updater($i3, "../".$mpath, $folders, "true"); // JSON mod
		} else {
			include("scripts.php");
			updater($i3, "../".$mpath, $folders); // HTML mod
		}
		exit;

	}elseif($_GET["islem"]=="update"){
		include("scripts.php");
		if ($_SERVER['HTTP_HOST'] == "cloud.crmplus.com.tr") {
			$strikethrough="text-decoration: line-through;";
			$nonupdate = "alert('Güncelleme bu adreste devre dışı bırakılmıştır.'); return false;";
		}
		?>
		<div id="check" style="position: fixed; width: 65%; margin-left: 25%; margin-right: 25%; margin-top: 15%; font-size: 24px; text-align:center">
			<img src="https://cdn.crmplus.com.tr/images/crm-plus-icon.png" style="height: 60px;"><br><br>
			<?php echo ctranslate("Yayınlanan en güncel yazılımı kullanıyorsunuz")?><br><br>
			<span class="v3-btn v3-btn-success" style="font-size: 30px;"><?php echo $pow2?></span>
			<br><br>
			<div style="text-align:center; width:100%; font-size:14px;">
				<?php echo ctranslate("Son güncelleme")?>
				<span class="v3-btn-xs v3-btn-info"><?php echo timeago($pow6)?></span>;
				<?php echo ctranslate("CrmPlus+ ile ilgili bir sorun yaşıyorsanız ya da manuel güncelleme yapmak istiyorsanız")?> 
				<a onclick="<?php echo $nonupdate?>show('#preload'); location.href='<?php echo $weburl.'/'.$crmpath?>/fonksiyon.php?islem=updater'" class="v3-btn-xs v3-btn-warning cp" style="<?php echo $strikethrough?>"><i class="fas fa-angle-double-up"></i> Güncelle</a> butonunu tıklayınız.
			</div>
			<div style="margin-top:50px; font-size:13px ">
				<?php if($module["oim"] == "1"){ ?>
					<a onclick="<?php echo $nonupdate?>show('#preload'); location.href='<?php echo $weburl."/".$crmpath."/fonksiyon.php?islem=updater&module=".strtolower($module["oim_name"])?>'" class="v3-btn-xs v3-btn-success cp" style="margin-right:5px;<?php echo $strikethrough?>">
						<i class="fas fa-angle-double-up"></i> <?php echo $module["oim_name"]." Güncelle";?>
					</a>
				<?php } ?>
				
				<?php if($module["mobile_app"] == "1"){ ?>
					<a onclick="<?php echo $nonupdate?>show('#preload'); location.href='<?php echo $weburl."/".$crmpath."/fonksiyon.php?islem=updater&module=app'"?>" class="v3-btn-xs v3-btn-warning cp" style="margin-right:5px;<?php echo $strikethrough?>">
					<i class="fas fa-angle-double-up"></i> Mobil Uygulama Güncelle
				</a>
			<?php } ?>
			
			<?php if($module["g3"] == "1"){ ?>
				<a onclick="<?php echo $nonupdate?>show('#preload'); location.href='<?php echo $weburl."/".$crmpath."/fonksiyon.php?islem=updater&module=tahsilat'"?>" class="v3-btn-xs v3-btn-danger cp" style="margin-right:5px;<?php echo $strikethrough?>">
				<i class="fas fa-angle-double-up"></i> E-Tahsilat Güncelle
			</a>
		<?php } ?>
	</div>
</div>
<div style="position: fixed; bottom: 5px;">
	<div class="btn-xs btn-warning" style="float:left; margin-right:5px;">UserID: #<?php echo $_SESSION["UserID"];?></div>
	<div class="btn-xs btn-warning" style="float:left; margin-right:5px;"><?php if($_SESSION["DeviceID"]<>""){echo "DeviceID: #".$_SESSION["DeviceID"];}else{echo "MacID: #".$_SESSION["MacID"];}?></div>
</div>
<?php
}elseif($_GET["addmodule"]<>""){
	$file="https://cdn.".$cdnurl."/update/php".substr(phpversion(),0,1)."/".$_GET["addmodule"].".zip";
	chmod("/", 0777);
	chmod("../deppo", 0777);
	if(filetransfer($file,"../deppo/".$_GET["addmodule"].".zip")){
		$zip = new ZipArchive;
		$res = $zip->open("../deppo/".$_GET["addmodule"].".zip");
		if ($res === TRUE) {
			$zip->extractTo('../');
			$zip->close();
			unlink("../deppo/".$_GET["addmodule"].".zip");
		} else {
			echo "zip Err";
		}
	}else{
		echo "File Err";
	}
	echo "<i class=\"fa fa-check\"></i>";		
		//?add=catalogs
}elseif($_GET["islem"]=="ver"){
	echo "<center>";	
	echo "<h1>".$pow1."</h1>";
	echo "<h1>".$pow2."</h1>";
	echo "<h1>".$pow3."</h1>";
	echo "<h1>".$pow4."</h1>";
	echo "<h1>".$pow5."</h1>";
	echo "</center>";

}elseif($_GET["islem"]=="ex"){
	if($_GET["id"]<>trim($module["currency"])){
		if($_GET["pb"]=="USD"){
			$price=wprice($_GET["val"]*$usd);
		}elseif($_GET["pb"]=="EUR"){
			$price=wprice($_GET["val"]*$eur);
		}elseif($_GET["pb"]=="GBP"){
			$price=wprice($_GET["val"]*$gbp);
		}
		echo "".$price." ".$ikpb."";
	}

}elseif($_GET["islem"]=="gsms"){
	echo "<div style=\"display:none;\">";
	echo smsgonder($_POST["sms"],telefon($_POST["gsm"]));
	echo "</div>";
	echo "Gönderildi";

}elseif($_GET["islem"]=="gmail"){
	$Mesaj 		= $_POST["mesaj"];
	$konu			= $_POST["konu"];
	$gonderen	= $_POST["gonderen"];
	$malici			= $_POST["malici"];
	$mgonderen	= $mail;
	$mesaj			= $Mesaj;
	$path			= "../";
	include("".$path."deppo/tools/script/design.php");
	$mesaj 		= $design_top.$mesaj.$design_bottom;
		//echo emailgonder($malici,$konu,$cc,$mesaj);
	echo "url:?";

}elseif($_GET["islem"]=="test"){
	foreach ($ws->data as $item){
		if($item->type=="settings"){
			$mmail = $item->mail;
			$mgsm = $item->gsm;
		}
	}
	if($_GET["type"]=="email"){
		echo 			"Mail Gönderim Test İşlemi<hr>";
		$Mesaj 		= "Mail Test {".$_GET["gonderen"]."}";
		$konu			= "Mail Test";
		$gonderen		= "CrmPlus+";
		if($fmail=="mail@mail.com" or $fmail==""){
			$malici			= $mmail;
		}else{
			$malici			= $fmail;
		}
		$mgonderen	= $_GET["gonderen"];
		$mesaj			= $Mesaj;
		echo 			"Mail Gönderim Test İşlemi Alıcı =>".$malici." <hr>";
		$path			= "../";
		include("".$path."deppo/tools/script/design.php");
		$mesaj 		= $design_top.$mesaj.$design_bottom;
		echo emailgonder($malici,$konu,$cc,$mesaj);
	}else{
		$smstxt 		= "Sms Test";
		if($fgsm=="+90(5xx) 456 7890" or $fgsm==""){
			$gsm			= telefon($mgsm);
		}else{
			$gsm			= telefon($fgsm);
		}
		$path		="../";
		echo 		"Sms Gönderim Test İşlemi Alıcı =>".$gsm." <hr>";
		echo smsgonder($smstxt, $gsm);
	}

}else if($_GET["islem"]=="count"){
	if($_GET["s2"]<>""){$qry = "where s2='".$_GET["s2"]."'";}
	$sql=mysqli_query($conn, "select id from ".$_GET["tbl"]." $qry"); $rscount=mysqli_num_rows($sql);
	echo $rscount;

}else if($_GET["islem"]=="kontrol"){
	if($_GET["ne"]=="uye"){
		$sql=mysqli_query($conn, "select * from t5 where t2='".v3e($_GET["veri"])."' or t4='".$_GET["veri"]."'"); $rs=mysqli_fetch_assoc($sql);
		if(mysqli_num_rows($sql)>0){echo "<a href=\"?islem=duye&ne=uye&id=".$rs["id"]."\" class=\"cspan pulse\"><i class=\"fas fa-exclamation-triangle\" style=\"font-size:15px; color:red;\" title=\"Kayıt Var!\"></i> Kayıt Var!</a>";}
	}elseif($_GET["ne"]=="kayit" or $_GET["ne"]=="sayfa" or $_GET["ne"]=="haber" or $_GET["ne"]=="msayfa"){
		$sql=mysqli_query($conn, "select * from ".$_SESSION['lang']." where ne='".$_GET["ne"]."' and (t1='".$_GET["veri"]."' or t4='".$_GET["veri"]."' or t5='".$_GET["veri"]."')"); $rs=mysqli_fetch_assoc($sql);
		if(mysqli_num_rows($sql)>0){echo "<a href=\"?islem=d".$_GET["ne"]."&ne=".$_GET["ne"]."&id=".$rs["id"]."\" class=\"cspan pulse\"><i class=\"fas fa-exclamation-triangle\" style=\"font-size:15px; color:red;\" title=\"Kayıt Var!\"></i> Kayıt Var!</a>";}
	}

}elseif($_GET["islem"]=="order_reminder"){
	$sqlo = mysqli_query($conn, "select * from eticaret where id=".$_GET["id"].""); $siparis=mysqli_fetch_assoc($sqlo); $jsO=json_decode($siparis["n11"],true); $jsoi=json_decode($siparis["n17"],true);
	$sqlm = mysqli_query($conn, "select * from t5 where id=".$siparis["s1"].""); $rsm=mysqli_fetch_assoc($sqlm);  $jsml=json_decode($rsm["n16"],true); $jsmi=json_decode($rsm["n17"],true);
	include("modules/ecommerce/ecommerce_order_calc.php");
	$sqlb = mysqli_query($conn, "select * from genel where ne='banka' and id=".$jsO["Order_Bank_Id"].""); $rsb = mysqli_fetch_assoc($sqlb);
	$Mesaj	= "
	Merhaba Değerli Müşterimiz,<br>
	Siparişiniz için teşekkür ederiz! Siparişinizin ödemesini tamamlamak için lütfen aşağıda yer alan havale bilgilerini kullanın.<br><br>
	Sipariş Numarası: #".$siparis["t4"]."<br>
	Toplam Tutar: {wprice($gtoplam)} {$siparis['t2']}<br><br>
	Havale Bilgileri:<br>
	Banka: ".$rsb["t1"]."<br>
	IBAN: ".$rsb["n3"]."<br>
	Alıcı Adı: ".$rsb["n1"]."<br><br>
	Ödeme Süreci:<br>
	Havale işlemini yukarıdaki bilgileri kullanarak yapın.<br>
	Havale açıklama kısmına Sipariş #".$siparis["t4"]." yazmayı unutmayın.<br>
	Ödemenizin onaylanmasıyla birlikte siparişiniz işleme alınacaktır.<br><br>
	Unutmayın, ödemenizi 72 saat içinde tamamlamanız gerekmektedir. Bu süre içinde ödeme yapılmazsa siparişiniz iptal edilebilir.<br>
	Sorularınız veya yardıma ihtiyacınız olursa, lütfen bize ".$fmail." adresinden ulaşın.<br>
	İlginiz ve güveniniz için teşekkür ederiz.<br><br>
	Saygılarımızla,<br>
	".$firma." Müşteri Hizmetleri
	";
	$konu			= "Havale Bilgisi Hatırlatma - Sipariş #".$siparis["t4"]."";
	$gonderen		= $firma;
	$malici			= v3d($rsm["t2"]);
	$mgonderen	= $fmail;
	$mesaj			= $Mesaj;
	$path			= "../";
	include("".$path."deppo/tools/script/design.php");
	$mesaj 		= $design_top.$mesaj.$design_bottom;
	emailgonder($malici,$konu,$cc,$mesaj);
	echo "<center>{$mesaj} <h4 style=\"margin-top:15px; font-size:24px;\">E-Mail Gönderildi</center></h4>";

}else if($_GET["islem"]=="get_order"){
	$sql=mysqli_query($conn, "select * from ".$_SESSION['lang']." where s2=".$_GET["id"]." order by s1 desc"); $rs=mysqli_fetch_assoc($sql);
	if($_GET["s2"]==1 or $_GET["s2"]==2){$i=10;}else{$i=1;}
	if(mysqli_num_rows($sql)>0){echo $rs["s1"]+$i;}else{echo $_GET["s2"]+$i;}

}else if($_GET["islem"]=="tck"){
	if(strlen($_GET["veri"])==11 && is_numeric($_GET["veri"])){
		$say=0;
		for($i=0;$i<=9;$i++){
			$say=$say+$_GET["veri"][$i];
		}
		if(substr($say,-1) == substr($_GET["veri"],-1)){
			echo "<i class=\"fa fa-check\" style=\"font-size:20px; color:green;\" title=\"App\"></i>";
		}else { 
			echo "<i class=\"fa fa-exclamation\" style=\"font-size:20px; color:red;\" title=\"Err!\"></i>";
		}
	}else {
		echo "<i class=\"fa fa-exclamation\" style=\"font-size:20px; color:red;\" title=\"Err!\"></i>";
	}

}elseif($_GET["islem"]=="rmail"){
	function trURLtoCHAR($str) {
			// HTML karakterlerini gerçek karakterlere dönüştürür
		return html_entity_decode($str, ENT_QUOTES, 'UTF-8');
	}
	$mail_server = "{".tanim("email","n3",$_GET["mID"]).":995/pop3/ssl/novalidate-cert}INBOX";
	$mail_user = tanim("email","n1",$_GET["mID"]);
	$mail_pass = tanim("email","n2",$_GET["mID"]);
	$imap = imap_open($mail_server, $mail_user, $mail_pass);
	$message = imap_fetchbody($imap,$_GET["i"],1);
	$message = quoted_printable_decode($message);
	$message = mb_convert_encoding($message, "UTF-8");
	echo $message;

}elseif($_GET["islem"]=="mcount"){
	$mail_server = "{".tanim("mail","n3",$_GET["id"]).":995/pop3/ssl/novalidate-cert}INBOX";
	$mail_user = tanim("mail","n1",$_GET["id"]);
	$mail_pass = tanim("mail","n2",$_GET["id"]);
	$imap = imap_open($mail_server, $mail_user, $mail_pass);
	$nmc=imap_num_msg($imap);
	$m=0;for ($i = 1; $i <= $nmc; ++$i){
		$header = imap_header($imap, $i);
		$recent=$header->Recent; 
		$unseen=$header->Unseen;
		//echo json_encode($header);
		if($recent == "N"){$m++;}
	}
	if($_GET["ne"]==""){
		echo $m;
	}elseif($_GET["ne"]=="nmc"){
		echo "<a class=\"notification-icon\" style=\"".($m==0 ? "display:none" : "")."\">";
		echo	"<i class=\"fa fa-envelope\"></i>";
		echo	"<span class=\"badge v3-bg-warning\">".$m."</span>";
		echo	"</a>";
	}

}elseif($_GET["islem"]=="chat"){
	$sqlc = mysqli_query($conn, "select id FROM t2 where ne='chat' and (s2=".$_SESSION["user_id"]." and s3=0)"); $cchat = mysqli_num_rows($sqlc);
	?>
	<a class="notification-icon" style="position:absolute; margin-top:-20px; right:15px; border-radius:5px; background:red;<?php if($cchat==0){ echo"display:none;";}?>">
		<span class="badge v3-bg-warning"><?php echo $cchat;?></span>
	</a>
<?php }elseif($_GET["islem"]=="news"){?>
	<?php echo file_get_contents('https://cdn.".$cdnurl."/news/', false, stream_context_create($arrContextOptions));?>
<?php }elseif($_GET["islem"]=="notes"){?>
	<script type="text/javascript">
		jQuery(function() {
			jQuery(".mfrm").click(function () {
				var theModal = jQuery(this).data("target"),
				frmSRC = jQuery(this).attr("data-url");
				jQuery(theModal + ' iframe').attr('src', frmSRC);
				jQuery(theModal + ' button.close').click(function () {
					jQuery(theModal + ' iframe').attr('src', 'about:blank');
				});
			});
		});
	</script>
	<?php $sql=mysqli_query($conn, "select * from genel where ne='not' order by id desc"); while($rs=mysqli_fetch_assoc($sql)){
		$t5s = explode(',',$rs["t5"]); $start = strtotime($rs["t4"]); $end = strtotime($rs["t9"]); $today = strtotime(date('Y-m-d'));
		if (($rs["s3"] == 0 && $today >= $start && $today <= $end) || ($rs["s3"] == 1 && $today >= $start && $today <= $end) || ($rs["s3"] == 2 && $today >= $start && $today <= $end)) {
			if(in_array($_SESSION["user_id"], $t5s) or ($_SESSION["user_id"]==$rs["s19"])){
				?>
				<li>
					<a class="cp clearfix mfrm" data-toggle="modal" data-target="#myModal" data-title="<?php echo $sdil[48]; //E-Ajanda?>" data-width="60%" data-url="modules/events/note.php?ne=<?php echo $_GET["ne"]?>&islem=<?php echo $_GET["islem"]?>&durum=noku&gun=<?php echo $cgun;?>&ay=<?php echo $bay;?>&yil=<?php echo $yil;?>&id=<?php echo $rs["id"];?>">
						<div class="image">
							<i class="fa fa-calendar bg-danger text-light"></i>
						</div>
						<span class="title"><?php echo $sdil[68]; //Not?> <span class="fr mfr mr5 mmr5"><?php if($rs["s3"]<>0){?><i class="fa fa-refresh"></i><?php }?> <?php echo dtarih($rs["t4"],"gg ka yy"," ")?>-<?php echo dtarih($rs["t9"],"gg ka yy"," ")?> <?php echo $rs["t2"]?></span></span>
						<span class="message"><span class="fl mfl"><?php echo $rs["t1"];?></span>
						<span class="fr mfr mr5 mmr5"><?php echo kisalt($rs["n1"],2);?></span>
						<span class="fr mfr mr5 mmr5">
							<?php $t5Sx = explode(',',$rs["t5"]); $sqlm=mysqli_query($conn, "select * from t5"); while($rsm=mysqli_fetch_assoc($sqlm)){?>
								<?php foreach($t5Sx as $t5s){if($t5s==$rsm["id"]){echo "{".$rsm["t1"]."}";}}?>
							<?php }?>
						</span>
					</span>
				</a>
			</li>
		<?php }}}?>
		<?php
	}elseif($_GET["islem"]=="google_translate"){
		header('Content-Type: text/html; charset=utf-8');
		include("scripts.php");
		include("../deppo/tools/script/translate.php");
		$sql=mysqli_query($conn, "select * from lang1 where id=".$_GET["id"].""); $rs=mysqli_fetch_assoc($sql);
		echo "<title>".$rs["t1"]."</title>";
		?>
		<script src="//cdn.crmplus.com.tr/js/b1f22d74f8.js" crossorigin="anonymous"></script>
		<script>
			var $cc = jQuery.noConflict();
			function copyToClipboard(element) {
				var $temp = $cc("<textarea>");
				$cc("body").append($temp);
				$temp.val($cc(element).text()).select();
				document.execCommand("copy");
				$temp.remove();
				alert('Hafızaya Kopyalandı, Ctrl+V ile Yapıştırabilirsiniz.');
			}
			function transfer(type){
				setTimeout(function(){
					jQuery('#type').val('lang'+type+'');
					var editor = CKEDITOR.instances['in1'];
					var t1 = jQuery('#t1').html();
					var t1 = t1.replace('<font style="vertical-align: inherit;">','');
					var t1 = t1.replace('</font>','');
					var t1 = t1.replace('<font style="vertical-align: inherit;">','');
					var t1 = t1.replace('</font>','');
					jQuery('#it1').val(t1);
					var n2 = jQuery('#n2').html();
					var n2 = n2.replace('<font style="vertical-align: inherit;">','');
					var n2 = n2.replace('</font>','');
					var n2 = n2.replace('<font style="vertical-align: inherit;">','');
					var n2 = n2.replace('</font>','');
					jQuery('#in2').val(n2);
					var n1 = jQuery('#n1').html();
					var n1 = n1.replace('<font style="vertical-align: inherit;">','');
					var n1 = n1.replace('</font>','');
					var n1 = n1.replace('<font style="vertical-align: inherit;">','');
					var n1 = n1.replace('</font>','');
					editor.setData(n1);
				}, 1000);
			}
		</script>
		<form method="post" action="?ne=<?php echo $_GET["ne"]?>&islem=<?php echo $_GET["islem"]?>&id=<?php echo $_GET["id"]?>&cmd=save" style="padding: 5px 15px 0px 15px;">
			<input type="hidden" id="type" name="lang" value="" class="notranslate">
			<div style="text-align:right;width:100%">
				<?php
				if(!empty($m1)){
					$i = 0;$diller = explode(',',$m1); foreach($diller as $dil) {$i++; if($i > 99) {$i = 1;}
					?>
					<a class="v3-btn-xs v3-btn-info notranslate cp" style="position: relative; margin-right:5px" onclick="Translate('tr|<?php echo strtolower($dil);?>'); transfer('<?php echo $i;?>'); return false;">  <?php echo $dil;?> </a>
				<?php }}?>
			</div>
			<div>
				<div style="display:none;" id="t1"><?php echo $rs["t1"]?></div>
				<input class="v3-form-control" type="text" name="t1" id="it1" value="<?php echo $rs["t1"]?>">
			</div>
			<div style="margin-top:15px;">
				<div style="display:none;" id="n2"><?php echo $rs["n2"]?></div>
				<textarea class="v3-form-control" name="n2" id="in2"><?php echo $rs["n2"]?></textarea>
			</div>
			<div style="margin-top:15px;">
				<div style="display:none;" id="n1"><?php echo $rs["n1"]?></div>
				<textarea class="v3-form-control" name="n1" id="in1"><?php echo $rs["n1"]?></textarea>
			</div>
			<div style="margin-top:15px;">
				<button class="v3-btn v3-btn-warning notranslate" style="float:right;" type="submit">Kaydet</button>
			</div>
		</form>
		<script>var rte = CKEDITOR.replace('in1');</script>
		<?php
		if($_GET["cmd"]=="save"){
			$sql2=mysqli_query($conn, "select * from ".$_POST['lang']." where id=".$_GET["id"].""); $rs2=mysqli_fetch_assoc($sql2);
			if(mysqli_num_rows($sql2)==0){
				$sqli = $conn->query("insert into ".$_POST['lang']." (id, ne, t1, n1, n2, s2, s13, s19, ts1, ts2, ts3) values ('".$_GET["id"]."', '".$_GET["ne"]."', '".addslashes(stripslashes(trim($_POST["t1"])))."', '".addslashes(stripslashes($_POST["n1"]))."', n2='".addslashes(stripslashes($_POST["n2"]))."', '".$rs["s2"]."', '".$rs["s13"]."', '".$_SESSION["user_id"]."', '".$rs["ts1"]."', '".$rs["ts2'"]."', '".$rs["ts3"]."')");
				echo "#".$_GET["id"]." ".$_GET["ne"]." Eklendi";
			}else{
				$Sql = mysqli_query($conn, "update ".$_POST['lang']." set t1='".addslashes(stripslashes(trim($_POST["t1"])))."', n1='".addslashes(stripslashes($_POST["n1"]))."', n2='".addslashes(stripslashes($_POST["n2"]))."' where id=".$_GET["id"]."");
				echo "#".$_GET["id"]." ".$_GET["ne"]." Güncellendi";
			}
		}
		?>
		<?php
	}elseif($_GET["islem"]=="cdetail"){
		$sqlhc=mysqli_query($conn, "select * from t4 where ne='cari' and s1=".$_GET["id"]." order by id desc"); while($hcari=mysqli_fetch_assoc($sqlhc)){
			include("modules/clients/client_current_calc2.php");
		}
		
		if($_GET["fid"]<>""){
			$sqlf=mysqli_query($conn, "select * from t4 where id=".$_GET["fid"]." order by id desc"); $rsf=mysqli_fetch_assoc($sqlf);
			$sqlhc=mysqli_query($conn, "select * from t4 where ne='cari' and s5=".$_GET["fid"]." order by id desc"); while($hc=mysqli_fetch_assoc($sqlhc)){
				$tahsilat = $tahsilat + $hc["pb3"];
			}
			$bakiye = ($rsf["pb2"]-$tahsilat);
		}elseif($_GET["iid"]<>""){
			$sqlc=mysqli_query($conn, "select * from t4 where ne='cari' and id=".$_GET["iid"]." order by id desc"); $hcari=mysqli_fetch_assoc($sqlc);
		}
		include("scripts.php");
		$rarr =  array ('usd' => $usd, 'eur' => $eur, 'gpb' => $gbp); $rate=json_encode($rarr);
		if($_GET["id"]==""){$dn="display:none";}
		if($_GET["drm"]=="gelir"){$gider="display:none";}elseif($_GET["drm"]=="gider"){$gelir="display:none";}
		if ($_GET["durum"]=="ucari"){
			if(!empty($_POST["cs5"])){$cs5=$_POST["cs5"];}else{$cs5=0;}
			if(!empty($_GET["id"])){$gid=$_GET["id"];}elseif(!empty($_POST["cs1"])){$gid=$_POST["cs1"];}
			if($_GET["iid"]<>""){
				$Rs = mysqli_query($conn, "update t4 set t1='".$_POST["ct1"]."', s3='".$_POST["cs3"]."', t3='".addslashes(stripslashes($_POST["ct3"]))."', t6='".$_POST["ct6"]."', t4='".$_POST["ct4"]."', t11='".$_POST["ct11"]."', t12='".$_POST["ct12"]."', n1='".$_POST["cn1"]."', n2='".$_POST["cn2"]."', pb1='".sprice($_POST["cpb1"])."', pb2='".sprice($_POST["cpb2"])."', pb3='".sprice($_POST["cpb3"])."', pb4='".sprice($_POST["cpb4"])."' Where id=".$_GET["iid"]."");
				echo location("?islem=".$_GET["islem"]."&id=".$_GET["id"]."&iid=".$_GET["iid"]."&durum=ok",self,500,1);
			}else{
				$sql = $conn->query("insert into t4(t1,t2,t3,t4,ne,t6,t11,t12,pb1,pb2,pb3,pb4,ts1,n1,n2,s1,s3,s5) values ('".$_POST["ct1"]."', 'cari', '".addslashes(stripslashes($_POST["ct3"]))."', '".$_POST["ct4"]."', 'cari', '".$_POST["ct6"]."', '".$_POST["ct11"]."', '".$_POST["ct12"]."', '".sprice($_POST["cpb1"])."', '".sprice($_POST["cpb2"])."', '".sprice($_POST["cpb3"])."', '".sprice($_POST["cpb4"])."', now(), '".$_POST["cn1"]."', '".$_POST["cn2"]."', '".$gid."', '".$_POST["cs3"]."', '".$cs5."')");
				$sqlc=mysqli_query($conn, "select * from t4 where ne='cari' and s1=".$gid." order by id desc"); $rsc=mysqli_fetch_assoc($sqlc);
				if($_POST["t1"]=="Çek"){
					$sql0 = $conn->query("insert into t4(ne,t1,t2,t3,t4,pb1,n1,s1,s3,s4) values ('hizmet', '".$_POST["cn1"]."', '".$_POST["ct2"]."', '".date("Y-m-d")."', '".$_POST["ct4"]."', '".$_POST["cpb2"]."', '".$_POST["cn1"]."', '".$gid."', '".$_POST["s3"]."', '".$_POST["s4"]."')");
					$sql1 = $conn->query("insert into genel (ne,t1,t2,t3,t4,n1,s1,s2) values ('not', '".$sdil[163]." (".$rsc["t1"].")', '00:00', 'cek' , '".$_POST["ct4"]."', '".$sdil[163]." (".$rsc["t1"].") ".$_POST["t1"]." nolu çek', '".$gid."', '".mysqli_insert_id()."')");
				}
				echo location("?islem=".$_GET["islem"]."&id=".$_GET["id"]."&iid=".$rsc["id"]."&durum=ok",self,500,1);
			}
		}
		?>
		<div class="panel">
			<div class="panel-body">
				<div>
					<!-- Nav tabs -->
					<ul class="nav nav-tabs" role="tablist">
						<li role="presentation" class="active"><a href="#detail" aria-controls="detail" role="tab" data-toggle="tab"><?php echo ctranslate("Hesap Hareket Fişi")?></a></li>
						<?php if($_GET["iid"]<>""){?>
							<li role="presentation"><a href="#files" aria-controls="files" role="tab" data-toggle="tab"><?php echo ctranslate("Dosyalar")?></a></li>
						<?php }?>
						<li role="presentation" class="bg-success"  style="float:right;border-radius: 5px 5px 0 0;"><a href="#" aria-controls="detail" role="tab" data-toggle="tab"><i class="fas fa-coins"></i> <b><?php if($_GET["fid"]<>""){echo wprice($bakiye);}else{echo wprice(($cpb1-$cpb2)-($cpb3-$cpb4));}?></b> <?php echo trim($module["currency"]);?></a></li>
					</ul>
					<!-- Tab panes -->
					<div class="tab-content">
						<div role="tabpanel" class="tab-pane active" id="detail">
							<form id="cdetail" method="post" action="?islem=cdetail&durum=ucari&id=<?php echo $_GET["id"]?>&iid=<?php echo $_GET["iid"]?>&fid=<?php echo $_GET["fid"]?>&s5=<?php echo $_GET["s5"]?>&drm=<?php echo $_GET["drm"]?>">
								<input type="hidden" name="cs5" id="cs5" class="small form-control" value="<?php if($_GET["fid"]<>""){echo $_GET["fid"];}else{echo "0";}?>">
								<div class="row" style="margin-top:20px;">
									<div class="col-sm-6 col-xs-12">
										<label><?php echo $sdil[40];?></label>
										<input class="form-control" name="cn1" placeholder="<?php echo $sdil[40];?>" value="<?php if($_GET["fid"]<>""){echo $rsf["n2"];}else{echo $hcari["n1"];}?>">
									</div>
									<div class="col-sm-3 col-xs-12 mmt15">
										<label class=""><?php echo $sdil[168]; //Tip?></label>
										<input type="text" list="lct11" id="ct11" name="ct11" class="small form-control" value="<?php echo $hcari["t11"];?>" style="text-align:right;">
										<datalist id="lct11">
											<?php $sqlx=mysqli_query($conn, "select id,t1 from ".$_SESSION["lang"]." where ne='client_project' and s13=1 order by t2 asc"); while($rsx=mysqli_fetch_assoc($sqlx)){?>
												<option id="<?php echo $rsx["id"]?>" value="<?php echo $rsx["t1"]?>"><?php echo $rsx["t1"]?></option>
											<?php }?>
										</datalist>
										<script>
											jQuery( "#ct11" ).change(function() {
												var inputVal = jQuery(this).val();
												var id = jQuery("#lct11 option[value='"+inputVal+"']").attr("id");
												jQuery( "#cs5" ).val(id);
											});
										</script>
									</div>
									<div class="col-sm-3 col-xs-12 mmt15 p0 mp0">
										<div class="col-sm-6 col-xs-6">
											<label class=""><?php echo ctranslate("Para Birimi");?></label>
											<select name="ct6" class="form-control">
												<option value="TRY" <?php if($hcari["t6"]=="TL" or $hcari["t6"]=="TRY"){?>Selected<?php }?>>TRY</option>
												<option value="EUR" <?php if($hcari["t6"]=="EUR"){?>Selected<?php }?>>EUR</option>
												<option value="USD" <?php if($hcari["t6"]=="USD"){?>Selected<?php }?>>USD</option>
												<option value="GBP" <?php if($hcari["t6"]=="GBP"){?>Selected<?php }?>>GBP</option>
											</select>
										</div>
										<div class="col-sm-6 col-xs-6">
											<label class=""><?php echo $sdil[154];?></label>
											<select name="ct1" class="form-control">
												<option value="Nakit" <?php if($hcari["t1"]=="Nakit"){?>Selected<?php }?>><?php echo $sdil[160]; //Nakit?></option>j
												<option value="Banka" <?php if($hcari["t1"]=="Banka"){?>Selected<?php }?>><?php echo $sdil[161]; //Banka?></option>
												<option value="Pos" <?php if($hcari["t1"]=="Pos"){?>Selected<?php }?>><?php echo $sdil[162]; //Pos?></option>
												<option value="Çek" <?php if($hcari["t1"]=="Çek"){?>Selected<?php }?>><?php echo $sdil[163]; //Çek?></option>
												<option value="Taksit" <?php if($hcari["t1"]=="Taksit"){?>Selected<?php }?>><?php echo $sdil[227]; //Taksit?></option>
											</select>
										</div>
									</div>
									<div class="col-sm-3 col-xs-12 mt15 mmt15 p0 mp0" style="clear: both;">
										<div class="col-sm-6 col-xs-6 bg-success" style="<?php echo $dn?>">
											<label class=""><?php echo ctranslate("Alacak");?></label>
											<input type="text" name="cpb1" class="small form-control" value="<?php if($hcari["pb1"]<>""){echo para($hcari["pb1"]);}else{echo "0";}?>" onfocus="if(this.value == '0') { this.value = ''} "  onblur="if(this.value == '') { this.value='0'; }" style="text-align:right;">
										</div>
										<div class="col-sm-6 col-xs-6 bg-warning" style="<?php echo $dn?>">
											<label class=""><?php echo ctranslate("Borç");?></label>
											<input type="text" name="cpb2" class="small form-control" value="<?php if($hcari["pb2"]<>""){echo para($hcari["pb2"]);}else{echo "0";}?>" onfocus="if(this.value == '0') { this.value = ''} "  onblur="if(this.value == '') { this.value='0'; }" style="text-align:right;">
										</div>
									</div>
									<div class="col-sm-3 col-xs-12 mt15 mmt15 p0 mp0">
										<div class="col-sm-6 col-xs-6 bg-success" style="<?php echo $gelir?>">
											<label class=""><?php echo ctranslate("Gelir");?></label>
											<input type="text" name="cpb3" id="" class="small form-control gelir" value="<?php if($hcari["pb3"]<>""){echo para($hcari["pb3"]);}elseif($_GET["fid"]<>""){echo  para($bakiye);}else{echo "0";}?>" onfocus="if(this.value == '0') { this.value = ''} "  onblur="if(this.value == '') { this.value='0'; }" style="text-align:right;">
										</div>
										<div class="col-sm-6 col-xs-4 bg-warning" style="<?php echo $gider?>">
											<label class=""><?php echo ctranslate("Gider");?></label>
											<input type="text" name="cpb4" class="small form-control gider" value="<?php if($hcari["pb4"]<>""){echo para($hcari["pb4"]);}else{echo "0";}?>" onfocus="if(this.value == '0') { this.value = ''} "  onblur="if(this.value == '') { this.value='0'; }" style="text-align:right;">
										</div>
									</div>
									<div class="col-sm-3 col-xs-12 mmt15">
										<label class=""><?php echo $sdil[115]; //Tarih?></label>
										<input type="date" name="ct4" class="form-control" placeholder="" value="<?php if($hcari["t4"]<>""){echo $hcari["t4"];}else{echo date("Y-m-d");}?>">
									</div>
									<div class="col-sm-3 col-xs-12 mt15 mmt15 p0 mp0">
										<div class="col-sm-6 col-xs-6" style="">
											<label class=""><?php echo ctranslate("Vade Tarihi");?></label>
											<input type="date" name="ct12" id="ct12" class="form-control" placeholder="<?php echo ctranslate("Vade Tarihi");?>" value="<?php echo $hcari["t12"];?>">
										</div>
										<div class="col-sm-6 col-xs-6" style="">
											<label class=""><?php echo ctranslate("Tekrar");?></label>
											<select name="cs3" class="form-control notranslate" style="height: 34px;">
												<option value="0" <?php if($hcari["s3"]==0){echo "selected";}?>> Yok</option>
												<option value="1" <?php if($hcari["s3"]==1){echo "selected";}?>> Aylık</option>
												<option value="2" <?php if($hcari["s3"]==2){echo "selected";}?>> Yıllık</option>
											</select>
										</div>
									</div>
									<div class="col-sm-12 col-xs-12 mt15 mmt15" style="margin-top:20px;">
										<label><?php echo $sdil[207];?></label>
										<textarea class="form-control" rows="3" name="cn2" placeholder="<?php echo $sdil[207];?>"><?php echo $hcari["n2"];?></textarea>
									</div>
								</div>
								<div class="row mt15 mmt15 p0 mp0">
									<div class="col-sm-3 col-xs-6 ">
										<select name="cs1" data-placeholder="Seçiniz" style="width:99%;" class="chosen-select <?php if($_GET["id"]<>""){echo "dn";}?>" tabindex="8">
											<option value="0"><?php echo $sdil[221]; //Lütfen Seçiniz?></option>
											<?php $sql5=mysqli_query($conn, "select * from t5 where t1 LIKE '%".$_GET["q"]."%' ".$luye." order by t1 asc"); while($rs5=mysqli_fetch_assoc($sql5)){?>
												<option value="<?php echo $rs5["id"]?>" <?php if($rs5["id"]==$_GET["id"]){echo "Selected";}?>><?php echo $rs5["t1"]?></option>
											<?php }?>
										</select>	
									</div>
									<div class="col-sm-3 col-xs-6">
										<input type="text" name="ct3" class="small form-control" value='<?php if($hcari["t3"]<>""){echo $hcari["t3"];}else{echo $rate;}?>' style="text-align:right;">
									</div>
									<div class="col-sm-6 col-xs-12">
										<button style="float:right; margin-right:12px;" class="btn btn-warning" id="rcdetail" type="submit"><i class="fa fa-share-square" aria-hidden="true"></i> <?php if($_GET["iid"]<>""){echo $sdil[203];}else{echo $sdil[201];}?></button>
										<button style="float:right; margin-right:12px;<?php if($hcari["t12"]==""){echo "display:none;";}?>" class="btn btn-info" onclick="jQuery('#ct12').val(''); setTimeout(function(){ jQuery('#cdetail').submit(); }, 100);" type="button"><i class="fa-regular fa-bell-slash"></i> <?php echo translate("Bildirimi Sonlandır")?></button>
									</div>
								</div>
							</form>
							<script type="text/JavaScript" language="JavaScript">
								jQuery('#cdetail').on('change',function(){
										//jQuery('#cdetail').change(function(e){
									var gelir = jQuery('.gelir').val();
									var gider = jQuery('.gider').val();
									if(gelir!=0){
										jQuery('.gider').attr('readonly',true);
									}else{
										jQuery('.gider').attr('readonly',false);
									}
									if(gider!=0){
										jQuery('.gelir').attr('readonly',true);
									}else{
										jQuery('.gelir').attr('readonly',false);
									}
								});
							</script>
						</div>
						<?php if($_GET["iid"]<>""){?>
							<div role="tabpanel" class="tab-pane" id="files">
								<style>
									.btn-delete-div {
										padding: 4px;
										margin-top: 1px;
										border-radius: 0px 14px 14px 0px;
									}
								</style>
								<script type="text/JavaScript" language="JavaScript">
									jQuery(document).ready(function () {
										jQuery('#mfiles').load("modules/ajax/ajax_files.php?ne=cari&islem=<?php echo $_GET["islem"];?>&id=<?php echo $hcari["id"];?>&nedir=resim");
									});
								</script>
								<div id="mfiles" class="mfiles" style="border: 2px dashed #d9d9d9 !important; min-height:200px;padding-top: 5px;"></div>
							</div>
							<form id="uform" method="post" action="modules/upload/upload_image.php?ne=cari&islem=<?php echo $_GET["islem"];?>&x=yukle&id=<?php echo $_GET["id"]?>&iid=<?php echo $_GET["iid"]?>&s5=<?php echo $_GET["s5"]?>"  target="modal" enctype="multipart/form-data" style="display:none;">
								<input type="hidden" name="s1_1" value="<?php echo $hcari["id"]?>">
								<input type="file" id="udragdrop" name="resim1" accept="*">
								<input type="checkbox" name="durum1" value="ON" style="float:left; display:none;" checked>
								<input type="checkbox" name="boyut1" value="ON" checked id="boyut1"  checked>
								<input type="text" id="t1" class="form-control" name="i1" value="">
							</form>
							<script>
								mfiles.ondragover = mfiles.ondragenter = function(evt) {
									evt.preventDefault();
								};
								mfiles.ondrop = function(evt) {
									udragdrop.files = evt.dataTransfer.files;
									jQuery("#uform").submit();
									jQuery('#preload').fadeIn('slow');
									setTimeout(function(){
										jQuery('#mfiles').load('modules/ajax/ajax_medya_iframe.php?nedir=resim&ne=cari&id=".$hcari["id"]."');
										jQuery('#preload').fadeOut('slow');
									}, 3000);
									evt.preventDefault();
								};
							</script>
						<?php }?>
					</div>
				</div>
			</div>
			<div class="panel-footer">By Crm +Plus</div>
		</div>
		<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
		<?php
	}elseif($_GET["islem"]=="sdetail"){
		$sqlh=mysqli_query($conn, "select * from t4 where ne='hizmet' and s1=".$_GET["id"]." and id=".$_GET["iid"].""); $rsh=mysqli_fetch_assoc($sqlh);
		$sqlc=mysqli_query($conn, "select * from t5 where id=".$rsh["s1"].""); $rsc=mysqli_fetch_assoc($sqlc);
		include("scripts.php");
		if ($_GET["durum"]=="uservis"){
			if(!empty($_GET["id"])){$gid=$_GET["id"];}elseif(!empty($_POST["ss1"])){$gid=$_POST["ss1"];}
			if($_GET["iid"]<>""){
				$ln2="".$_POST["sn1"]." [".$_POST["st1"]."]<br>".$igun.".".$iay.".".$iyil." / ".$sgun.".".$say.".".$syil."<br>Tutar : ".$_POST["spb1"]."";
				$Rs = mysqli_query($conn, "update t4 set t1='".$_POST["st1"]."', t2='".$_POST["st2"]."', t3='".$_POST["ts1"]."', t4='".$_POST["ts2"]."', pb1='".$_POST["spb1"]."', n1='".$_POST["sn1"]."', n2='".$_POST["sn2"]."', s2='".$_POST["s2"]."', s3='".$_POST["s3"]."', s4='".$_POST["s4"]."' Where id=".$_GET["iid"]."");
				$sqln=mysqli_query($conn, "select * from genel where ne='not' and s2='".$_GET["iid"]."'"); $rsn=mysqli_fetch_assoc($sqln);
				if($_POST["spb1"]<>0){
					$sqlc=mysqli_query($conn, "select * from t4 where ne='cari' and s5='".$_GET["iid"]."'"); $cari=mysqli_fetch_assoc($sqlc);
					if(mysqli_num_rows($sqlc)==0){
						$sql = $conn->query("insert into t4(t1,t2,t4,ne,t4,t6,pb1,pb2,pb3,pb4,s1,s5,n1,n2,ts1) values ('Nakit', 'hizmet', '".$_POST["ts1"]."', 'cari', '".$_GET["iid"]."', '".$_POST["st2"]."', '".$_POST["spb1"]."', '0', '0', '0', '".$_GET["id"]."', '".$_GET["iid"]."', '".$_POST["sn1"]." (".$_POST["st1"].")', now())");
					}else{
						$Rs = mysqli_query($conn, "update t4 set pb1='".$_POST["spb1"]."', n1='".$_POST["sn1"]." (".$_POST["st1"].")' Where s5=".$_GET["iid"]."");
					}
				}
				echo location("?islem=".$_GET["islem"]."&id=".$_GET["id"]."&iid=".$_GET["iid"]."&durum=ok",self,500,1);
			}else{
				$ln2="".$_POST["sn1"]." [".$_POST["st1"]."]<br>".$igun.".".$iay.".".$iyil." / ".$sgun.".".$say.".".$syil."<br>Tutar : ".$_POST["spb1"]."";
				$sql = $conn->query("insert into t4(ne,t1,t2,t3,t4,pb1,n1,n2,s1,s2,s3,s4) values ('hizmet', '".$_POST["st1"]."', '".$_POST["st2"]."', '".$_POST["ts1"]."', '".$_POST["ts2"]."', '".$_POST["spb1"]."', '".$_POST["sn1"]."', '".$_POST["sn2"]."', '".$_GET["id"]."', '".$_POST["s2"]."', '".$_POST["s3"]."', '".$_POST["s4"]."')");
				if($_POST["spb1"]<>0){
					$sql = $conn->query("insert into t4(ne,t2,t4,t6,t11,pb1,pb2,pb3,pb4,s1,s5,n1,ts1) values ('cari', 'hizmet', '".$_POST["ts1"]."', '".$_POST["st2"]."', '".$_POST["st1"]."', '".str_replace(',','',number_format($_POST["spb1"],2))."', '0', '0', '0', '".$_GET["id"]."', '".mysqli_insert_id()."', '".$_POST["sn1"]." (".$_POST["st1"].")', now())");
				}
				$sqlc=mysqli_query($conn, "select * from t4 where ne='hizmet' and s1=".$gid." order by id desc"); $rsc=mysqli_fetch_assoc($sqlc);
				echo location("?islem=".$_GET["islem"]."&id=".$_GET["id"]."&iid=".$rsc["id"]."&durum=ok",self,500,1);
			}
		}
		?>
		<div class="panel">
			<div class="panel-heading" style=""><?php echo ctranslate("Servis Fişi");?> {<?php echo $rsc["t1"]?>} <?php if($_GET["iid"]<>""){?><span style="float:right;"><?php echo tfark2(date("Y-m-d"),$rsh["t4"],"text");?> kaldı</span><?php }?></div>
			<div class="panel-body">
				<div>
  <!-- Nav tabs
  <ul class="nav nav-tabs" role="tablist">
    <li role="presentation" class="active"><a href="#detail" aria-controls="detail" role="tab" data-toggle="tab"><?php echo ctranslate("Servis Fişi")?></a></li>
  </ul>
  Tab panes -->
  <div class="tab-content">
  	<div role="tabpanel" class="tab-pane active" id="detail">
  		<form id="cdetail" method="post" action="?islem=sdetail&durum=uservis&id=<?php echo $_GET["id"]?>&iid=<?php echo $_GET["iid"]?>&drm=<?php echo $_GET["drm"]?>">
  			<input type="hidden" name="cs5" id="cs5" class="small form-control" value="<?php if($_GET["fid"]<>""){echo $_GET["fid"];}else{echo "0";}?>">
  			<div class="row" style="margin-top:20px;">
  				<div class="col-sm-6 col-xs-12">
  					<label><?php echo $sdil[40];?></label>
  					<input class="form-control" name="sn1" placeholder="<?php echo $sdil[40];?>" value="<?php echo $rsh["n1"];?>">
  				</div>
  				<div class="col-sm-3 col-xs-6">
  					<label class=""><?php echo $sdil[168]; //Tip?></label>
  					<input type="text" name="st1" id="st1" list="lst1" class="small form-control" value="<?php echo $rsh["t1"];?>" style="text-align:right;" autocomplete="off">
  					<datalist id="lst1">
  						<?php $sqlx=mysqli_query($conn, "select id,t1 from ".$_SESSION["lang"]." where ne='client_project' and s13=1 order by t2 asc"); while($rsx=mysqli_fetch_assoc($sqlx)){?>
  							<option id="<?php echo $rsx["id"]?>" value="<?php echo $rsx["t1"]?>"><?php echo $rsx["t1"]?></option>
  						<?php }?>
  					</datalist>
  					<script>
  						jQuery( "#st1" ).change(function() {
  							var inputVal = jQuery(this).val();
  							var id = jQuery("#lst1 option[value='"+inputVal+"']").attr("id");
  							jQuery( "#cs5" ).val(id);
  						});
  					</script>
  				</div>
  				<div class="col-sm-3 col-xs-6" style="">
  					<label class=""><?php echo ctranslate("Tekrar")?></label>
  					<select name="s3" class="form-control notranslate">
  						<option value="0" <?php if($rsh["s3"]==0){echo "selected";}?>> ...</option>
  						<option value="1" <?php if($rsh["s3"]==1){echo "selected";}?>> Aylık</option>
  						<option value="2" <?php if($rsh["s3"]==2){echo "selected";}?>> Yıllık</option>
  					</select>
  				</div>
  				<div class="col-sm-3 col-xs-12 mmt15 mt15" style="">
  					<label class=""><?php echo ctranslate("Başlangıç Tarihi");?></label>
  					<input type="date" name="ts1" class="form-control" placeholder="" value="<?php if($rsh["t3"]<>""){echo $rsh["t3"];}else{echo date("Y-m-d");}?>">
  				</div>
  				<div class="col-sm-3 col-xs-12 mmt15 mt15" style="">
  					<label class=""><?php echo ctranslate("Bitiş Tarihi");?></label>
  					<input type="date" name="ts2" class="form-control" placeholder="" value="<?php if($rsh["t4"]<>""){echo $rsh["t4"];}else{echo date('Y-m-d', strtotime('+1 year'));}?>">
  				</div>
  				<div class="col-sm-3 col-xs-6 mmt15 mt15" style="">
  					<label class=""><?php echo ctranslate("Tutar");?></label>
  					<input type="text" name="spb1" id="" class="small form-control gelir" value="<?php if($rsh["pb1"]<>""){echo para($rsh["pb1"]);}else{echo "0";}?>" onfocus="if(this.value == '0') { this.value = ''} "  onblur="if(this.value == '') { this.value='0'; }" style="text-align:right;">
  				</div>
  				<div class="col-sm-3 col-xs-6 mmt15 mt15">
  					<label class=""><?php echo ctranslate("Kur");?></label>
  					<select name="st2" class="form-control">
  						<option value="TRY" <?php if($rsh["t2"]=="TL" or $hcari["t6"]=="TRY"){?>Selected<?php }?>>TRY</option>
  						<option value="EUR" <?php if($rsh["t2"]=="EUR"){?>Selected<?php }?>>EUR</option>
  						<option value="USD" <?php if($rsh["t2"]=="USD"){?>Selected<?php }?>>USD</option>
  						<option value="GBP" <?php if($rsh["t2"]=="GBP"){?>Selected<?php }?>>GBP</option>
  					</select>
  				</div>
  				
  				<div class="col-sm-12 col-xs-12" style="margin-top:20px;">
  					<label><?php echo $sdil[207];?></label>
  					<textarea class="form-control" rows="3" name="sn2" placeholder="<?php echo $sdil[207];?>"><?php echo $rsh["n2"];?></textarea>
  				</div>
  			</div>
  			<div class="row" style="margin-top:20px;">
  				<button style="float:right; margin-right:12px;" class="btn btn-warning" id="rsdetail" type="submit"><i class="fa fa-share-square" aria-hidden="true"></i> <?php if($_GET["iid"]<>""){echo $sdil[203];}else{echo $sdil[201];}?></button>
  			</div>
  		</form>
  		
  	</div>
  </div>
</div>
</div>
<div class="panel-footer" style="color:#b1b0b0">
	Değerli Müşterimiz <?php echo $rsc["t1"]?>;<br>
	Hizmet(ler)inizin Süresi <?php echo dtarih($rsh["t4"],"gg ua yy")?> tarihinde sona erecektir, hizmet(ler)inizde bir aksama olmaması için <?php echo dtarih($rsh["t4"],"gg ua yy")?> tarihinden önce yenileme yapılması önemle rica olunur.
</div>
</div>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<?php
}elseif($_GET["islem"]=="bildirim"){
	if($_GET["ne"]=="hata"){
		$konu="Hata Bildirimi";
		$alici=$mmail;
	}elseif($_GET["ne"]=="hizmet"){
		$sql5=mysqli_query($conn, "select * from t5 where id=".$_GET["UserID"].""); $rs5=mysqli_fetch_assoc($sql5);
		$sqlh=mysqli_query($conn, "select * from t4 where ne='hizmet' and id=".$_GET["id"].""); $rsh=mysqli_fetch_assoc($sqlh);
		$konu="Hizmet Bildirimi";
		$alici=V3d($rs5["t2"]);
		$user=$rs5["t1"];
		$Bildirim="
		Sayın ".$rs5["t1"].";<br><br>
		<b>".$rsh["n1"]." (".$rsh["t1"].")</b> Hizmet(ler)inizin Süresi, <b>".dtarih($rsh["t4"],"gg ua yyyy")."</b> tarihinde sonlanacaktır.<br>
		Hizmet(ler)imizde kesinti olmaması için <b>".dtarih($rsh["t4"],"gg ua yyyy")."</b> tarihinden önce ödemeniz gereken tutar <b>".$rsh["pb1"]."</b> ".$kpb."'dir<br>
		ödemeyi yaptıysanız bu uyarıyı dikkate almayınız.
		";
	}elseif($_GET["ne"]=="siparis"){
		$sql5=mysqli_query($conn, "select * from t5 where id=".$_GET["UserID"].""); $rs5=mysqli_fetch_assoc($sql5);
		$sqlh=mysqli_query($conn, "select * from t4 where ne='hizmet' and id=".$_GET["id"].""); $rsh=mysqli_fetch_assoc($sqlh);
		$konu="Sipariş Bildirimi";
		$alici=V3d($rs5["t2"]);
		$user=$rs5["t1"];
	}
	?>
	<?php include("scripts.php")?>
	<div class="panel">
		<div class="panel-body">
			<?php if($_GET["durum"]=="ok"){?>
				<div class="alert alert-success" role="alert">Bildirim Gönderildi.</div>
			<?php }?>
			<form id="bildirim" method="post" action="fonksiyon.php?islem=bildirim&ne=<?php echo $_GET["ne"]?>&UserID=<?php echo $_GET["UserID"]?>&id=<?php echo $_GET["id"]?>&op=gonder">
				<?php if($_GET["ne"]=="hata"){?>
					<input type="hidden" name="Weburl" value="<?php echo $weburl?>" />
					<input type="hidden" name="Ip-Adres" value="<?php echo getRealIpAddr();?>" />
					<input type="hidden" name="User" value="<?php echo $_SESSION["user"];?>" />
				<?php }?>
				<div class="row">
					<div class="col-md-12">
						<label><?php echo $sdil[93]; //Ad Soyad?></label>
						<input name="Ad_Soyad" type="text" class="form-control" placeholder="<?php echo $sdil[93]; //Ad Soyad?>" value="<?php echo $user?>" />
					</div>
					<div class="col-md-12">
						<label>Konu</label>
						<input type="text" name="Konu" class="form-control" placeholder="<?php echo $konu?>"/>
					</div>
				</div>
				<?php if($_GET["ne"]=="hata"){?>
					<div class="row">
						<div class="col-md-6 col-sm-6 col-xs-6">
							<label>Web Url</label>
							<input type="text" class="form-control" placeholder="<?php echo $weburl?>" disabled/>
						</div>
						<div class="col-md-6 col-sm-6 col-xs-6">
							<label>Ip <?php echo $sdil[103]; //Adres?></label>
							<input type="text" class="form-control" placeholder="<?php echo getRealIpAddr();?>" disabled/>
						</div>
					</div>
				<?php }?>
				<div class="row"> 
					<div class="col-md-12">
						<label><?php echo $sdil[172]; //Mesaj?></label>
						<textarea name="Bildirim" class="form-control" id="rte" rows="5" placeholder="<?php echo $sdil[172]; //Mesaj?>"><?php echo $Bildirim;?></textarea>
					</div>
				</div>
				<div class="row" style="margin-top:5px"> 
					<button style="float:right; margin-right:12px;" class="btn btn-warning" id="rbildirim" type="submit"><i class="fa fa-share-square" aria-hidden="true"></i> <?php echo $sdil[112]; //GÃ¶nder?></button>
				</div>
			</form>
		</div>
		<div class="panel-footer">By Crm +Plus</div>
	</div>
	<script type="text/javascript">CKEDITOR.replace( 'rte', {toolbar: [ { name: 'document', items: [ 'Source'] }, [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ], { name: 'basicstyles', items: [ 'Bold', 'Italic' ] } ]});</script>
	<?php
	if($_GET["op"]=="gonder"){
		if($_GET["ne"]=="hata"){
			$mesaj		= "".$firma." > ".$weburl.";<br/><br/>";
			foreach ($_POST as $key => $val){
				$mesaj	= "".$mesaj."<b>".$key."</b> : ".$val." <br/>";
			}
		}elseif($_GET["ne"]=="hizmet"){
			$mesaj		= $_POST["Bildirim"];
		}elseif($_GET["ne"]=="siparis"){
			$mesaj		= $_POST["Bildirim"];
		}
		$mesaj		= $design_top.$mesaj.$design_bottom;
		$malici		= $alici;
		$konu		= $_POST["Konu"];
		$path		= "../";
		emailgonder($malici,$konu,$cc,$mesaj);
		echo location("?islem=".$_GET["islem"]."&ne=".$_GET["ne"]."&id=".$_GET["id"]."&UserID=".$_GET["UserID"]."&durum=ok",self,500,1);
	}
}elseif($_GET["islem"]=="cols"){
	$sql=mysqli_query($conn, "select * from genel where ne='cols' $lcols"); $rs=mysqli_fetch_assoc($sql);
	if(mysqli_num_rows($sql)==0){
		$sql = $conn->query("insert into genel (ne) values ('cols')");
	}
	$jsi = json_decode($rs["n1"], true);
	?>
	<?php include("scripts.php");?>
	<div class="panel" style="overflow-y: auto; height: 100vh;">
		<div id="result"></div>
		<div class="panel-body">
			<form id="cols">
				<div class="row">
					<div class="col-xs-9">
						<input type="text"  list="olist" name="c_<?php echo $_GET["ne"]?>_order" class="form-control" value="<?php echo $jsi["c_".$_GET["ne"]."_order"]?>" placeholder="Sql Order" style="margin-bottom:5px;">
						<datalist id="olist">
							<option value="ORDER BY id DESC">Yeni Eklenenler</option>
							<option value="ORDER BY t1 ASC">A-Z</option>
							<option value="ORDER BY t1 DESC">Z-A</option>
							<option value="ORDER BY s5 ASC">Artan Stok</option>
							<option value="ORDER BY s5 DESC">Azalan Stok</option>
							<option value="ORDER BY pb1 ASC">En Düşük Fiyat</option>
							<option value="ORDER BY pb1 DESC">En Yüksek Fiyat</option>
						</div>
						<div class="col-xs-3">
							<input type="number" max="25" name="c_<?php echo $_GET["ne"]?>_limit" class="form-control" value="<?php echo $jsi["c_".$_GET["ne"]."_limit"]?>" placeholder="Limit" style="margin-bottom:5px;">
						</div>
					</div>
					<input type="hidden" name="cols" value="<?php echo $_GET["ne"]?>">
					<ul class="list-group" style="<?php if($_GET["ne"]<>"kayit"){echo "display:none";}?>">
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_kayit_islem" value="1" <?php if($jsi["c_kayit_islem"]=="1"){echo "checked";}?>></span>
							<span style="float:right;">İşlemler</span>
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_kayit_medya" value="1" <?php if($jsi["c_kayit_medya"]=="1"){echo "checked";}?>></span>
							<span style="float:right;">Medya</span>
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_kayit_kategori" value="1" <?php if($jsi["c_kayit_kategori"]=="1"){echo "checked";}?>></span>    
							<span style="float:right;">Kategori</span>    
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_kayit_akategori" value="1" <?php if($jsi["c_kayit_akategori"]=="1"){echo "checked";}?>></span>    
							<span style="float:right;">Alt Kategori</span>    
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_kayit_a2kategori" value="1" <?php if($jsi["c_kayit_a2kategori"]=="1"){echo "checked";}?>></span>    
							<span style="float:right;">Alt2 Kategori</span>    
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_kayit_afiyat" value="1" <?php if($jsi["c_kayit_afiyat"]=="1"){echo "checked";}?>></span>    
							<span style="float:right;">Alış Fiyat</span>    
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_kayit_lfiyat" value="1" <?php if($jsi["c_kayit_lfiyat"]=="1"){echo "checked";}?>></span>    
							<span style="float:right;">Liste Fiyat</span>    
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_kayit_sfiyat" value="1" <?php if($jsi["c_kayit_sfiyat"]=="1"){echo "checked";}?>></span>    
							<span style="float:right;">Satış Fiyat</span>    
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_kayit_kdv" value="1" <?php if($jsi["c_kayit_kdv"]=="1"){echo "checked";}?>></span>    
							<span style="float:right;">Kdv</span>    
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_kayit_stok" value="1" <?php if($jsi["c_kayit_stok"]=="1"){echo "checked";}?>></span>    
							<span style="float:right;">Stok</span>    
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_kayit_marka" value="1" <?php if($jsi["c_kayit_marka"]=="1"){echo "checked";}?>></span>    
							<span style="float:right;">Marka</span>    
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_kayit_sira" value="1" <?php if($jsi["c_kayit_sira"]=="1"){echo "checked";}?>></span>    
							<span style="float:right;">Sıra</span>
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_kayit_tarih" value="1" <?php if($jsi["c_kayit_tarih"]=="1"){echo "checked";}?>></span>    
							<span style="float:right;">Tarih</span>
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_kayit_yonetici" value="1" <?php if($jsi["c_kayit_yonetici"]=="1"){echo "checked";}?>></span>    
							<span style="float:right;">Yönetici</span>
						</li>
						<?php $i=0;$sqli=mysqli_query($conn, "select * from genel where ne='inputs' $linputs and n3='".$_GET["ne"]."' and s1=0 $luye order by s10,id asc"); while($rsi=mysqli_fetch_assoc($sqli)){$i++;?>
							<li class="list-group-item" style="display: flow-root;">
								<span style="float:left;"><input type="checkbox" name="c_kayit_input_<?php echo $rsi["id"];?>" value="1" <?php if($jsi["c_kayit_input_".$rsi["id"].""]=="1"){echo "checked";}?>></span>    
								<span style="float:right;">(<?php echo $rsi["n4"];?>) <?php echo ctranslate($rsi["n1"]);?></span>
							</li>
						<?php }?>
					</ul>
					<ul class="list-group"  style="<?php if($_GET["ne"]<>"uye"){echo "display:none";}?>">
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_uye_islem" value="1" <?php if($jsi["c_uye_islem"]=="1"){echo "checked";}?>></span>
							<span style="float:right;">İşlemler</span>
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_uye_medya" value="1" <?php if($jsi["c_uye_medya"]=="1"){echo "checked";}?>></span>
							<span style="float:right;">Medya</span>
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_uye_kategori" value="1" <?php if($jsi["c_uye_kategori"]=="1"){echo "checked";}?>></span>    
							<span style="float:right;">Kategori</span>    
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_uye_akategori" value="1" <?php if($jsi["c_uye_akategori"]=="1"){echo "checked";}?>></span>    
							<span style="float:right;">Alt Kategori</span>    
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_uye_puan" value="1" <?php if($jsi["c_uye_puan"]=="1"){echo "checked";}?>></span>    
							<span style="float:right;">Puan</span>    
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_uye_bakiye" value="1" <?php if($jsi["c_uye_bakiye"]=="1"){echo "checked";}?>></span>    
							<span style="float:right;">Bakiye</span>    
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_uye_gsm" value="1" <?php if($jsi["c_uye_gsm"]=="1"){echo "checked";}?>></span>    
							<span style="float:right;">Gsm</span>    
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_uye_email" value="1" <?php if($jsi["c_uye_email"]=="1"){echo "checked";}?>></span>    
							<span style="float:right;">EMail</span>    
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_uye_konum" value="1" <?php if($jsi["c_uye_konum"]=="1"){echo "checked";}?>></span>    
							<span style="float:right;">Konum</span>    
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_uye_app" value="1" <?php if($jsi["c_uye_app"]=="1"){echo "checked";}?>></span>
							<span style="float:right;">App</span>
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_uye_tarih" value="1" <?php if($jsi["c_uye_tarih"]=="1"){echo "checked";}?>></span>    
							<span style="float:right;">Tarih</span>
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_uye_yonetici" value="1" <?php if($jsi["c_uye_yonetici"]=="1"){echo "checked";}?>></span>    
							<span style="float:right;">Yönetici</span>
						</li>
						<?php $i=0;$sqli=mysqli_query($conn, "select * from genel where ne='inputs' $linputs and n3='".$_GET["ne"]."' and s1=0 $luye order by s10,id asc"); while($rsi=mysqli_fetch_assoc($sqli)){$i++;?>
							<li class="list-group-item" style="display: flow-root;">
								<span style="float:left;"><input type="checkbox" name="c_uye_input_<?php echo $rsi["id"];?>" value="1" <?php if($jsi["c_uye_input_".$rsi["id"].""]=="1"){echo "checked";}?>></span>    
								<span style="float:right;">(<?php echo $rsi["n4"];?>) <?php echo ctranslate($rsi["n1"]);?></span>
							</li>
						<?php }?>
					</ul>
					<ul class="list-group" style="<?php if($_GET["ne"]<>"eticaret"){echo "display:none";}?>">
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_eticaret_orderimages" value="1" <?php if($jsi["c_eticaret_orderimages"]=="1"){echo "checked";}?>></span>
							<span style="float:right;">Sipariş Resimleri</span>
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_eticaret_client" value="1" <?php if($jsi["c_eticaret_client"]=="1"){echo "checked";}?>></span>
							<span style="float:right;">Müşteri</span>
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_eticaret_firm" value="1" <?php if($jsi["c_eticaret_firm"]=="1"){echo "checked";}?>></span>
							<span style="float:right;">Firma Adı</span>
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_eticaret_ototal" value="1" <?php if($jsi["c_eticaret_ototal"]=="1"){echo "checked";}?>></span>
							<span style="float:right;">Toplam</span>
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_eticaret_ptype" value="1" <?php if($jsi["c_eticaret_ptype"]=="1"){echo "checked";}?>></span>
							<span style="float:right;">Ödeme Tipi</span>
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_eticaret_oship" value="1" <?php if($jsi["c_eticaret_oship"]=="1"){echo "checked";}?>></span>
							<span style="float:right;">Kargo Firması</span>
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_eticaret_odate" value="1" <?php if($jsi["c_eticaret_odate"]=="1"){echo "checked";}?>></span>
							<span style="float:right;">Tarih</span>
						</li>
					</ul>
					<ul class="list-group" style="<?php if($_GET["ne"]<>"service"){echo "display:none";}?>">
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_service_islem" value="1" <?php if($jsi["c_service_islem"]=="1"){echo "checked";}?>></span>
							<span style="float:right;">İşlemler</span>
						</li>
					</ul>
					<ul class="list-group" style="<?php if($_GET["ne"]<>"request" and $_GET["ne"]<>"mesajlar"){echo "display:none";}?>">
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_request_hesap" value="1" <?php if($jsi["c_request_hesap"]=="1"){echo "checked";}?>></span>
							<span style="float:right;">Hesap</span>
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_request_form" value="1" <?php if($jsi["c_request_form"]=="1"){echo "checked";}?>></span>
							<span style="float:right;">Form</span>
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_request_cont" value="1" <?php if($jsi["c_request_cont"]=="1"){echo "checked";}?>></span>
							<span style="float:right;">İçerik</span>
						</li>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_request_tarih" value="1" <?php if($jsi["c_request_tarih"]=="1"){echo "checked";}?>></span>
							<span style="float:right;">Tarih</span>
						</li>
						<?php
						if($_GET["fid"]<>""){$rqry="and s1=".$_GET["fid"]."";}
						$cjsli = Array(); $sqll = mysqli_query($conn, "select * from t2 where (ne='request' or ne='fmesaj') $rqry $luye"); while($rsl=mysqli_fetch_assoc($sqll)){ $jsli = json_decode($rsl["n2"],true); 
						foreach($jsli as $ckey=>$cval){$cjsli[] = $ckey;}
					}
					foreach(array_unique($cjsli) as $v=>$k){
						?>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_request_<?php echo $k;?>" value="1" <?php if($jsi["c_request_".$k.""]=="1"){echo "checked";}?>></span>    
							<span style="float:right;"><?php echo ctranslate(str_replace("_"," ",$k));?></span>
						</li>
					<?php }?>
				</ul>
				<ul class="list-group" style="<?php if($_GET["ne"]=="kayit" or $_GET["ne"]=="uye" or $_GET["ne"]=="eticaret" or $_GET["ne"]=="service" or $_GET["ne"]=="request"){echo "display:none";}?>">
					<li class="list-group-item" style="display: flow-root;">
						<span style="float:left;"><input type="checkbox" name="c_islem" value="1" <?php if($jsi["c_islem"]=="1"){echo "checked";}?>></span>
						<span style="float:right;">İşlemler</span>
					</li>
					<li class="list-group-item" style="display: flow-root;">
						<span style="float:left;"><input type="checkbox" name="c_medya" value="1" <?php if($jsi["c_medya"]=="1"){echo "checked";}?>></span>
						<span style="float:right;">Medya</span>
					</li>
					<li class="list-group-item" style="display: flow-root;">
						<span style="float:left;"><input type="checkbox" name="c_kategori" value="1" <?php if($jsi["c_kategori"]=="1"){echo "checked";}?>></span>    
						<span style="float:right;">Kategori</span>    
					</li>
					<li class="list-group-item" style="display: flow-root;">
						<span style="float:left;"><input type="checkbox" name="c_sira" value="1" <?php if($jsi["c_sira"]=="1"){echo "checked";}?>></span>    
						<span style="float:right;">Sıra</span>
					</li>
					<li class="list-group-item" style="display: flow-root;">
						<span style="float:left;"><input type="checkbox" name="c_yonetici" value="1" <?php if($jsi["c_yonetici"]=="1"){echo "checked";}?>></span>    
						<span style="float:right;">Yönetici</span>
					</li>
					<?php $i=0;$sqli=mysqli_query($conn, "select * from genel where ne='inputs' $linputs and n3='".$_GET["ne"]."' and s1=0 $luye order by s10,id asc"); while($rsi=mysqli_fetch_assoc($sqli)){$i++;?>
						<li class="list-group-item" style="display: flow-root;">
							<span style="float:left;"><input type="checkbox" name="c_input_<?php echo $rsi["id"];?>" value="1" <?php if($jsi["c_input_".$rsi["id"].""]=="1"){echo "checked";}?>></span>    
							<span style="float:right;">(<?php echo $rsi["n4"];?>) <?php echo ctranslate($rsi["n1"]);?></span>
						</li>
					<?php }?>
				</ul>
				<div class="row dn" style="margin-top:5px">
					<button style="width:100%; text-align:center;" class="btn btn-warning" id="rbildirim" type="submit"><i class="fa fa-share-square" aria-hidden="true"></i> <?php echo ctranslate("Kaydet")?></button>
				</div>
			</form>
			<script>
				let timer;
				document.getElementById('cols').addEventListener('input', function() {
				clearTimeout(timer); // Önceki zamanlayıcıyı iptal et
				timer = setTimeout(function() {
					let formData = new FormData(document.getElementById('cols'));
					let queryString = new URLSearchParams(formData).toString();
					AjaxPResult(`?islem=cols&ne=<?php echo $_GET["ne"]?>&op=update`, '#cols', '#result', 'nopl');
				}, 1000); // Son değişiklikten sonra 1 saniye bekle
			});
		</script>
	</div>
</div>
<?php
if($_GET["op"]=="update"){
	$iarr = array();
	foreach ($_POST as $key => $value){
		if(substr($key,0,1)=="c"){
			$iarr = $iarr + array( $key => $value);
		}
	}
	$rjsi = json_encode($iarr, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
	$Rs = mysqli_query($conn, "update genel set n1='".addslashes(stripslashes($rjsi))."', s19='".$_SESSION["user_id"]."' where ne='cols'");
	echo location("?islem=cols&ne=".$_GET["ne"]."&fid=".$_GET["fid"]."&durum=ok",self,500,1);
}
?>
<?php }elseif($_GET["islem"]=="add_comment"){?>
	<?php include("scripts.php")?>
	<div class="panel">
		<div class="panel-heading">Yorum Ekle</div>
		<div class="panel-body">
			<?php if($_GET["op"]=="gonder"){?>
				<div class="alert alert-success" role="alert">Talep Gönderildi.</div>
			<?php }?>
			<form id="bildirim" method="post">
				<input type="hidden" name="Konu" value="Geri Bildirim" />
				<div class="row">
					<div class="col-md-4"><label><?php echo $sdil[93]; //Ad Soyad?></label></div>
					<div class="col-md-4"><input name="Ad_Soyad" type="text" class="form-control" placeholder="<?php echo $sdil[93]; //Ad Soyad?>" /></div>
				</div>
				<div class="row"> 
					<div class="col-md-4"><label>Yorum Url</label></div>
					<div class="col-md-8"><input type="text" name="yorum_link" class="form-control" placeholder="Yorum linki"/></div>
				</div>
				<div class="row"> 
					<div class="col-md-4"><label>Email</label></div>
					<div class="col-md-8"><input type="text" class="form-control" name="alici" placeholder="Email"/></div>
				</div>
				<div class="row"> 
					<div class="col-md-4"><label><?php echo $sdil[172]; //Mesaj?></label></div>
					<div class="col-md-8"><textarea name="Bildirim" class="form-control" rows="5" placeholder="<?php echo $sdil[172]; //Mesaj?>"></textarea></div>
				</div>
				<div class="row" style="margin-top:5px"> 
					<button style="float:right; margin-right:12px;" class="btn btn-warning" id="rbildirim" type="button" onclick="AjaxPost('fonksiyon.php?islem=add_comment&op=gonder','#bildirim','#rbildirim','100');this.disabled = true;"><i class="fa fa-share-square" aria-hidden="true"></i> <?php echo $sdil[112]; //GÃ¶nder?></button>
				</div>
			</form>
		</div>
		<div class="panel-footer">By Crm +Plus</div>
	</div>
	<?php
	if($_GET["op"]=="gonder"){
		$mesaj	.= "Sayın ".$_POST["Ad_Soyad"]."<br><br>".$_POST["Bildirim"]."";
		$mesaj	.= "<a href=\"".$_POST["yorum_link"]."/add#comments\" target=\"_blank\">Lütfen Tıklayınız</a>";
		$mesaj	= $design_top.$mesaj.$design_bottom;
		$malici	= $_POST["alici"];
		$konu	= $_POST["Konu"];
		$path	= "../";
		echo emailgonder($malici,$konu,$cc,$mesaj);
	}
}elseif($_GET["islem"]=="dgorev"){
	include("scripts.php");
	$sql=mysqli_query($conn, "select * from genel where ne='gorev' and id=".$_GET["id"].""); $rs=mysqli_fetch_assoc($sql);
	$sql2=mysqli_query($conn, "select * from t5 where id=".$rs["s1"].""); $rs5=mysqli_fetch_assoc($sql2);
	$sqlg=mysqli_query($conn, "select * from medya where ne='resim' and s1=".$rs["id"]."");
	$sqld=mysqli_query($conn, "select * from medya where ne='dosya' and s1=".$rs["id"]."");
	$sqlv=mysqli_query($conn, "select * from medya where ne='video' and s1=".$rs["id"]."");
	?>
	<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/fancybox/3.0.47/jquery.fancybox.min.css" />
	<div class="v3-panel">
		<div class="v3-panel-heading"><?php echo $tasks[0]?> <?php echo $sdil[207]; //Detay?> <!--<a href="#n2" onclick="toggle('#n2');" class="btn-warning btn-xs btn" style="float:right;"> Güncelle</a>--></div>
		<div class="v3-panel-body">
			<div class="v3-row"> 
				<div class="v3-col-md-12"><b><?php echo $rs["t1"]?></b></div>
			</div>
			<div class="v3-row">
				<div class="v3-col-md-12"><?php echo $rs["n1"]?>
				<?php while($rsd=mysqli_fetch_assoc($sqld)){?>
					<div class="v3-col-xs-2 v3-col-md-2">
						<a href="<?php echo $weburl?>/deppo/dosya/<?php echo $rsd["t1"];?>" class="v3-thumbnail" download>
							<img src="<?php echo $weburl?>/deppo/dosya/<?php echo  $rsd["t5"];?>" alt="<?php echo $rsd["t2"];?>" >
						</a>
					</div>
				<?php }?>
				<?php while($rsg=mysqli_fetch_assoc($sqlg)){?>
					<div class="v3-col-xs-2 v3-col-md-2">
						<a data-fancybox="gallery" href="<?php echo $weburl?>/deppo/image/<?php echo $rsg["t1"];?>" class="v3-thumbnail">
							<img src="<?php echo $weburl?>/deppo/image/<?php echo  $rsg["t1"];?>" alt="<?php echo $rs["t1"];?>" >
						</a>
					</div>
				<?php }?>
				<?php while($rsv=mysqli_fetch_assoc($sqlv)){?>
					<div class="v3-col-xs-2 v3-col-md-2">
						<div class="v3-thumbnail">
							<h4><?php echo $rsv["t2"];?></h4>
							<iframe src="<?php echo  $rsv["n1"];?>" style="height:350px;" Allowfullscreen></iframe>
							<p><?php echo $rsv["n3"];?></p>
						</div>
					</div>
				<?php }?>
			</div>
		</div>
		<?php $noheader="true";include("modules/public/log_user.php");?>
	</div>
</div>
<script>
	if (document.getElementById("rte") != undefined) {
		CKEDITOR.replace('rte');
	};
</script>
<script src="//cdnjs.cloudflare.com/ajax/libs/fancybox/3.0.47/jquery.fancybox.min.js"></script>
<?php if($_GET["durum"]=="ggorev"){
	$Rs = mysqli_query($conn, "update genel set n2='".$_POST["n2"]."' where id='".$_GET["id"]."'");
	echo location("?islem=".$_GET["islem"]."&id=".$_GET["id"]."&durum=ok",self,1000,1);
}		
?>
<?php
}elseif($_GET["islem"]=="dekont"){
	$notify = array ('desktop' => '1','ndesktop' => '1','browser' => '1','nbrowser' => '1');
	$rjsn = json_encode($notify, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
	$Rs = mysqli_query($conn, "update t1 set n12='".addslashes(stripslashes($rjsn))."' where id=".$_GET["id"]."");
	$sql = mysqli_query($conn, "select * from t1 where id=".$_GET["id"].""); $rs=mysqli_fetch_assoc($sql); $jsoi = json_decode($rs["n11"],true);
	include("scripts.php");
?>
<style>
	@media print { .noprint { display:none; } }
	body { background-color: #f8f9fa; font-family: 'Helvetica Neue', Arial, sans-serif; }
	.panel-default { border: 1px solid #ddd; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
	.panel-heading { background-color: #004080 !important; color: white !important; border-bottom: 2px solid #003366; }
	.panel-title { font-size: 20px; font-weight: bold; letter-spacing: 0.5px; }
	.table { margin-bottom: 15px; background: white; }
	.table th { background: #f2f4f7; width: 35%; }
	.table td, .table th { vertical-align: middle !important; }
	h4.text-center { background: #004080; color: white; padding: 6px; border-radius: 4px; font-size: 16px; margin-top: 20px; }
	.alert-info strong { color: #004080; }
	.panel-footer { background: #f2f4f7; color: #777; font-size: 12px; border-top: 1px solid #ddd; }
	.fa { cursor: pointer; }
	#sts { border: 1px solid #ccc; font-size: 13px; height: 28px; }
</style>

<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">

<div id="result"></div>
<div class="panel panel-default" id="print">
	<div class="panel-heading text-center">
		<h3 class="panel-title"><span style=" display: inline-block; transform: rotate(318deg); font-size: 39px; font-weight: bold; color: #007bff; margin-right: 4px; ">e</span><span style="font-size: 30px; font-weight: 600; color: #000;">-Dekont</span></h3>

		<div style="position: absolute; background: #ffffff9e; right: 5px; top: 30px; padding:3px; border-radius: 5px 5px 0px 0px;" class="noprint">
			<a style="float:left; font-size: 24px; margin-top:3px;" onclick="divyaz('print')" title="Yazdır"><i class="fa fa-print"></i></a>
			<a style="float:left; margin-left: 10px; margin-right: 10px; font-size: 24px; margin-top:3px;" href="?islem=<?php echo $_GET["islem"]?>&id=<?php echo $_GET["id"]?>&cmd=email" title="E-posta Gönder"><i class="fa fa-envelope"></i></a>
			<select class="form-control noprint" id="sts" onChange="self.location.href=this.options[this.selectedIndex].value;" style="width: 120px; float: right; font-size: 13px; height: 28px !important;">
				<option data-bg="alert-warning" data-status="0" value="fonksiyon.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $rs["id"];?>&durum=onay&s13=0" <?php if($rs["s13"]==0){echo "Selected";}?>>Beklemede</option>
				<option data-bg="alert-success" data-status="1" value="fonksiyon.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $rs["id"];?>&durum=onay&s13=1" <?php if($rs["s13"]==1){echo "Selected";}?>>Onaylandı</option>
				<option data-bg="alert-danger" data-status="2" value="fonksiyon.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $rs["id"];?>&durum=onay&s13=2" <?php if($rs["s13"]==2){echo "Selected";}?>>İptal</option>
			</select>
		</div>
	</div>

	<div class="panel-body">

		<h4 class="text-center">İşlem Bilgileri</h4>
		<table class="table table-bordered">
			<tr><th>İşlem No</th><td><?php echo $rs["t8"]?></td></tr>
			<tr><th>Tarih</th><td><?php echo dtarih($rs["ts1"],"gg ua yyyy + time")?></td></tr>
			<tr><th>Ad Soyad</th><td><?php echo $rs["t3"]?></td></tr>
			<tr><th>E-Mail</th><td><?php echo $rs["t4"]?></td></tr>
			<tr><th>GSM</th><td><?php echo $rs["t10"]?></td></tr>
		</table>

		<h4 class="text-center">Ödeme Bilgileri</h4>
		<table class="table table-bordered">
			<tr><th>Kart Üzerindeki İsim</th><td><?php echo $rs["t14"]?></td></tr>
			<tr><th>Kart</th><td><?php echo private_str(V3d($rs["t11"]), 2, 12)?></td></tr>
			<tr><th>Banka</th><td><?php echo $rs["t6"]?> (<?php echo ($rs["t7"]==0) ? "Tek Çekim" : $rs["t7"]." Taksit";?>)</td></tr>
			<tr><th>Toplam</th><td><strong><?php echo wprice($rs["pb1"])?> <?php echo $rs["t9"]?></strong></td></tr>

			<?php if(($_SESSION["kim"]=="Admin" or ($_SESSION["kim"]=="yonetici" and $_SESSION["y15"]==1))){ 
				if($rs["t18"]=="pos"){
					$sql = mysqli_query($conn, "select * from genel where ne='banka' and s1=".$jsoi["Bank_Id"]." and s2=1"); $rsb = mysqli_fetch_assoc($sql);
					if ($jsoi["Bank_Id"]==12){ $aurl="denizbank"; }elseif ($jsoi["Bank_Id"]==14){ $aurl="finansbank"; }elseif ($jsoi["Bank_Id"]==16){ $aurl="garanti"; }elseif ($jsoi["Bank_Id"]==20){ $aurl="kuveytturk"; }elseif ($jsoi["Bank_Id"]==38){ $aurl="vakifbank"; }elseif ($jsoi["Bank_Id"]==39){ $aurl="yapikredi"; }else{ $aurl="est"; }
				}else{ $aurl="fintech/".$rs["t18"].""; }
			?>
			<tr class="noprint">
				<th>İade İşlemi</th>
				<td>
					<form action="<?php echo $weburl."/deppo/tools/vpos/".$aurl?>/refund.php" target="modal2" method="post" class="row" id="frefund">
						<input type="hidden" name="transid" value="<?php echo $rs["t8"]?>">
						<input type="hidden" name="bankid" value="<?php echo $jsoi["Bank_Id"]?>">
						<div class="col-xs-4 col-md-3" title="n1">İade (<?php echo sprice(wprice($rs["pb1"]))?>)</div>
						<div class="col-xs-8 col-md-9">
							<input type="text" name="Total" value="" placeholder="İade tutarı giriniz" class="form-control input-sm" style="display:inline-block;width:auto;">
							<button type="submit" class="btn btn-xs btn-primary refund" <?php if($rs["s13"]<>1){echo "disabled";}?>>İade Et</button>
						</div>
					</form>
				</td>
			</tr>
			<script>jQuery(".refund").click(function(){jQuery('#myModal2').modal('show');});</script>
			<?php } ?>
		</table>

		<div class="alert alert-info"><strong>Açıklama:</strong> <?php echo $rs["n1"]?></div>

		<?php if($rs["s13"]==0){?>
			<div class="alert alert-warning text-center">Bankadan işlem sonucu alınamadı; Lütfen bankayı kontrol ediniz.</div>
		<?php }elseif($rs["s13"]==2){?>
			<div class="alert alert-danger text-center">Hata Mesajı: <?php echo v3d($rs["n2"])?></div>
		<?php }?>
	</div>

	<div class="panel-footer text-center">
		<small>Bu belge dijital ortamda oluşturulmuştur.<br>Crm +Plus © <?php echo date("Y");?></small>
	</div>
</div>

<script>
function divyaz(divId){
	var printContents=document.getElementById(divId).innerHTML;
	var originalContents=document.body.innerHTML;
	document.body.innerHTML="<html><head><title></title></head><body>"+printContents+"</body>";
	window.print();
	document.body.innerHTML=originalContents;
}
</script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>

	<?php
	if($_GET["durum"]=="onay"){
		$Rs = mysqli_query($conn, "update t1 set s13='".$_GET["s13"]."' where id=".$_GET["id"]."");
		echo location("?islem=".$_GET["islem"]."&id=".$_GET["id"]."&durum=ok",self,500,1);
	}
	?>
	<?php
	if($_GET["cmd"]=="email"){
		$mesaj	.= "
		<h2 style=\"text-align: left;width:99%\">".translate("Dekont")."</h2><hr>
		<table style=\"width:99%\">
		<tr class=\"warning\">
		<th style=\"vertical-align: text-top;width:50%; text-align: left;\">
		<div style=\"padding: 10px;width:95%; height:80px; margin:10px; border:solid 1px #ccc; background:white;\">
		".$firma."<br>
		".$fadres."<br>
		".$ftel."<br>
		</div>
		</th>
		<th style=\"vertical-align: text-top;width:50%; text-align: left;\">
		<div style=\"padding: 10px;width:95%; height:80px; margin:10px; border:solid 1px #ccc; background:white;\">
		Sayın : ".$rs["t3"]."<br>
		".$rs["t10"]."<br>
		".$rs["t4"]."
		</div>
		</th>
		</tr>
		<tr>
		<td style=\"vertical-align: text-top;\" colspan=\"2\">
		<div style=\"padding: 10px;width:98%; height:80px; margin:10px; border:solid 1px #ccc; background:white;\">
		Aşağıda kredi kartınızdan gerçekleştirilen işlemin detayları yer almaktadır.<br>
		<b>Kredi Kartınızdan <b>".$rs["t7"]." Taksit</b> toplam <b>".number_format($rs["pb1"],2)." ".$rs["t9"]."</b> <b>".$rs["n1"]."</b> açıklaması ile çekilmiştir.
		</div>
		</td>
		</tr>
		<tr>
		<td colspan=\"4\"><hr></td>
		</tr>
		</table>
		";
		//--/Müşteri Mail/--->
		$malici		= $rs["t4"];
		$konu		= ctranslate("Dekont");
		$path		= "../";
		emailgonder($malici,$konu,$cc,$mesaj);
		echo location("?islem=".$_GET["islem"]."&id=".$_GET["id"]."&durum=ok",self,500,1);
	}
	?>
<?php }elseif($_GET["islem"]=="icons"){
	$data = file_get_contents("https://cdn.".$cdnurl."/wpanel/fa5.json", false, stream_context_create($arrContextOptions));
	$tags = explode('{',$data); foreach($tags as $tag){
		$t=0;$tags2 = explode(',',$tag); foreach($tags2 as $tag2){$t++;
			if($t>1){
				if(strpos($tag2,$_GET["q"]) !== FALSE){
					?>
					<li data-icon="<?php echo str_replace('"','',trim($tag2));?>" onclick="getfa(this)"><i class="<?php echo str_replace('"','',trim($tag2));?>"></i> <?php echo str_replace('"','',trim($tag2));?></li>
				<?php }}}?>
			<?php }?>
			<script>
				function getfa(e){
					var ID = e.getAttribute("data-icon");
					jQuery("#<?php echo $_GET["ID"]?>").val(ID);
					hide("icons");
					return false;
				}
			</script>
		<?php }elseif($_GET["islem"]=="newsletter"){ ?>
			<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
			<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
			<a href="?islem=newsletter&op=xls"><i class="fa fa-file-excel-o btn btn-xs btn-success" aria-hidden="true" style="margin-bottom: 5px; float:right"> xls</i></a>
			<?php
			$url		 = "".$weburl."/deppo/newsletter.json";
			$dosya  = "../deppo/newsletter.json";
			$result	 = file_get_contents($url, false, stream_context_create($arrContextOptions));
			$arrays = json_decode($result, true);
			$iarr = array();
			echo '<table class="table">';
			foreach($arrays as $array){
				echo '<tr>';
				echo '<td>'.$array["id"].'</td>';
				echo '<td>'.$array["Ad Soyad"].'</td>';
				echo '<td>'.$array["Email"].'</td>';
				echo '<td>'.$array["Gsm"].'</td>';
				echo '<td><a href="?islem='.$_GET["islem"].'&id='.$array["id"].'" class="fa fa-trash"></a></td>';
				echo '</tr>';
			}
			echo '</table>';
			if($_GET["id"]<>""){
				$iarr = array();
				foreach($arrays as $key=>$value){
					if($value[id]<>$_GET["id"]){
						$iarr = $iarr + array( $key => $value);
					}
				}
				$data = json_encode($iarr, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
				$fp	  = fopen($dosya, 'w');
				fwrite($fp, $data);
				fclose($fp);
				echo "<script language=\"JavaScript\">window.location.href = \"?islem=".$_GET["islem"]."\";</script>";
			}elseif($_GET["op"]=="xls"){
				$dosya  = "../deppo/newsletter.json";
				$csv  = "../deppo/excel/ebulten.csv";
				header('Content-Type: text/html; charset=utf-8');
				function jsonToCSV($jfilename, $cfilename){
					if (($json = file_get_contents($jfilename)) == false)
						die('Error reading json file...');
					$data = json_decode($json, true);
					$fp = fopen($cfilename, 'w');
					$header = false;
					foreach ($data as $row){
						if (empty($header)){
							$header = array_keys($row);
							fputcsv($fp, $header);
							$header = array_flip($header);
						}
						fputcsv($fp, array_merge($header, $row));
					}
					fclose($fp);
					return;
				}
				jsonToCSV($dosya, $csv);
				echo '<center><a href="'.$csv.'" target="_blank">.csv dosyası hazır, indir</a></center>';
			}
			?>
			<?php
		}elseif($_GET["islem"]=="mailbox"){
			session_start();  ob_start();
			if($_GET["tID"]>0){
				$_SESSION["tID"]=$_GET["tID"];
			}elseif($_GET["tID"]=="0"){
				$_SESSION["tID"]="";
				foreach ($_SESSION as $key => $value){
					if(substr($key,0,2)=="tm"){
						$_SESSION["tm_".$key] = "";
					}
				}
			}
			$tID=$_SESSION["tID"];
			$sqls=mysqli_query($conn, "select * from genel where ne='sablon' and id=".$tID.""); $rss=mysqli_fetch_assoc($sqls);
			if(mysqli_num_rows($sqls)>0){
				$mesajbox=$rss["n1"];
				$dmail=$rss["t10"];
				$mesajsub=$rss["t1"];
			}
			if($_GET["durum"]<>"send"){
				?>
				<?php include("scripts.php");?>
				<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
				<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
				<link rel="stylesheet" href="//cdn.crmplus.com.tr/css/watolye.css" type="text/css" /> 
				<form method="post" action="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&durum=send" class="v3-row form" autocomplete="off" style="padding:10px;">
					<?php //include("modules/public/control_bar.php")?>
					<div class="v3-col-xs-4">
						<label>Gönderen</b></label>
						<input class="form-control" type="text" name="gonderen" value="<?php if($_SESSION["gonderen"]<>""){echo $_SESSION["gonderen"];}else{ echo $firma;};?>" placeholder="Gönderen">
					</div>
					<div class="v3-col-xs-4">
						<label>Gönderen Adres</b></label>
						<select name="mgonderen" data-placeholder="Seçiniz" data-plugin-selecttwo="" class="form-control populate" tabindex="8">
							<?php $sqlmg=mysqli_query($conn, "select * from genel where ne='tanim' and t2='email' order by id desc"); while($rsmg=mysqli_fetch_assoc($sqlmg)){ ?>
								<option value="<?php echo v3d($rsmg["n1"]);?>" <?php if(($dmail=="" and v3d($rsmg["n1"])==$mail) or v3d($rsmg["n1"])==$dmail){?>Selected<?php }?>><?php echo v3d($rsmg["n1"]);?></option>
							<?php }?>
						</select>
					</div>
					<div class="v3-col-xs-4" style="display:none;">
						<label><?php echo $sdil[127]; //Grup Seç?></label>
						<select name="s2" data-placeholder="Seçiniz" data-plugin-selecttwo="" class="form-control populate" tabindex="8">
							<option value="">...</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 echo $rsc["Cat_".$_SESSION["lang"].""];?></option>
							<?php }?>
						</select>
					</div>
					<div class="v3-col-xs-4">
						<label>Alıcı</b></label>
						<input class="form-control" type="text" name="alici" value="<?php echo $_GET["alici"];?>" placeholder="Alıcı">
					</div>
					<div class="v3-col-xs-8" style="margin-top:15px;">
						<input type="text" name="konu" value="<?php echo $mesajsub;?>" placeholder="Konu" class="form-control">
					</div>
					<?php if($module["gtaslak"]=="1"){?>
						<div class="v3-col-xs-4" style="margin-top:15px;">
							<select onChange="self.location.href=this.options[this.selectedIndex].value;" class="form-control">
								<option value="?ne=<?php echo $_GET['ne'];?>&islem=<?php echo $_GET['islem'];?>&tID=0&alici=<?php echo $_GET["alici"];?>"><?php echo translate("Taslaklar")?></option>
								<?php $sqlt=mysqli_query($conn, "select * from genel where ne='sablon' and t2='tmail' order by id desc"); while($rst=mysqli_fetch_assoc($sqlt)){ ?>
									<option value="?ne=<?php echo $_GET['ne'];?>&islem=<?php echo $_GET['islem'];?>&tID=<?php echo $rst["id"];?>&alici=<?php echo $_GET["alici"];?>" <?php if($tID==$rst["id"]){?>selected<?php }?>><?php echo $rst["t1"];?></option>
								<?php }?>
							</select>
						</div>
					<?php }?>
					<div class="v3-col-xs-12" style="margin-top:15px;">
						<textarea name="mesaj" class="form-control rte" id="rte" style="height:300px;" placeholder="Email <?php echo $sdil[207]; //Detay?>"><?php echo $mesajbox;?></textarea>
						<br />
						<span style="font-size: 9pt">
							<a onclick="copyToClipboard('#ladsoyad')" id="ladsoyad" class="v3-btn v3-btn-xs v3-btn-info mr5" title="Müşteri Ad Soyad">{AdSoyad}</a> 
							<a onclick="copyToClipboard('#lfirmaadi')" id="lfirmaadi" class="v3-btn v3-btn-xs v3-btn-info mr5" title="Müşteri Firma Adı">{FirmaAdi}</a> 
							<a onclick="copyToClipboard('#lunvan')" id="lunvan" class="v3-btn v3-btn-xs v3-btn-info mr5" title="Müşteri Ünvan">{Unvan}</a> 
							<a onclick="copyToClipboard('#ltel')" id="ltel" class="v3-btn v3-btn-xs v3-btn-info mr5" title="Müşteri Telefon">{Telefon}</a> 
							<a onclick="copyToClipboard('#lemail')" id="lemail" class="v3-btn v3-btn-xs v3-btn-info mr5" title="Müşteri Email">{Email}</a> 
							<a onclick="copyToClipboard('#lsifre')" id="lsifre" class="v3-btn v3-btn-xs v3-btn-info mr5" title="Müşteri Şifre">{Sifre}</a> 
							<a onclick="copyToClipboard('#firma')" id="firma" class="v3-btn v3-btn-xs v3-btn-warning mr5" title="<?php echo $firma?>">{firma}</a> 
							<a onclick="copyToClipboard('#ftel')" id="ftel" class="v3-btn v3-btn-xs v3-btn-warning mr5" title="<?php echo $ftel?>">{ftel}</a> 
							<a onclick="copyToClipboard('#ftel2')" id="ftel2" class="v3-btn v3-btn-xs v3-btn-warning mr5" title="<?php echo $ftel2?>">[ftel2]</a> 
							<a onclick="copyToClipboard('#fgsm')" id="fweb" class="v3-btn v3-btn-xs v3-btn-warning mr5" title="<?php echo $fgsm?>">{fgsm}</a> 
							<a onclick="copyToClipboard('#fweb')" id="fweb" class="v3-btn v3-btn-xs v3-btn-warning mr5" title="<?php echo $fweb?>">{fweb}</a> 
							<a onclick="copyToClipboard('#fadres')" id="fadres" class="v3-btn v3-btn-xs v3-btn-warning mr5" title="<?php echo $fadres?>">{fadres}</a> 
						</span>
					</div>
					<div style="clear:both;"></div>
					<div class="v3-col-xs-12">
						<button id="send" class="v3-btn v3-btn-warning" type="submit" style="margin-top:15px; float:right;" <?php if ($e10==1 and $MSA<>1){?>disabled<?php }?>><?php echo $sdil[112]; //Gönder?></button>
					</div>
				</form>
				<?php
			echo $footer;
			}elseif($_GET["durum"]=="send"){
				$sql=mysqli_query($conn, "select * from t5 where t2='".base64_encode($_POST["alici"])."'"); $rs=mysqli_fetch_assoc($sql);
				$mesaj 		= $_POST["mesaj"];
				$mesaj 		= str_replace('{AdSoyad}', $rs["t1"], $mesaj);
				$mesaj 		= str_replace('{Telefon}', telefon($rs["t4"]), $mesaj);
				$mesaj 		= str_replace('{Email}', base64_decode($rs["t2"]), $mesaj);
				$mesaj 		= str_replace('{Sifre}', base64_decode($rs["t3"]), $mesaj);
				$mesaj 		= str_replace('{firma}', $firma, $mesaj);
				$mesaj 		= str_replace('{ftel}', $ftel, $mesaj);
				$mesaj 		= str_replace('{ftel2}', $ftel2, $mesaj);
				$mesaj 		= str_replace('{fgsm}', $fgsm, $mesaj);
				$mesaj 		= str_replace('{fweb}', $fweb, $mesaj);
				$mesaj 		= str_replace('{fadres}', $fadres, $mesaj);
				$konu			= $_POST["konu"];
				$gonderen		= $_POST["gonderen"];
				$malici			= $_POST["alici"];
				$mgonderen	= $_POST["mgonderen"];
				$mesaj			= $design_top.$mesaj.$design_bottom;
				$path			= "../";
				emailgonder($malici,$konu,$cc,$mesaj);
				echo location("?islem=".$_GET["islem"]."&ne=".$_GET["ne"]."&alici=".$_POST["alici"]."&tID=0&durum=ok",self,500,1);
			}

			}elseif($_GET["islem"]=="smsbox"){
				session_start(); ob_start();

				if ($_GET["durum"] !== "send") {
				?>
					<?php include("scripts.php");?>
					<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
					<form method="post" action="?ne=<?php echo $_GET["ne"];?>&islem=smsbox&durum=send" class="form" style="padding:15px;">
						<div class="v3-col-xs-4">
							<label>Alıcı GSM</label>
							<input class="form-control" type="text" name="alici" value="<?php echo $_GET["alici"];?>" placeholder="5xxxxxxxxx" readonly>
						</div>
						<div class="v3-col-xs-12" style="margin-top:15px;">
							<textarea name="mesaj" class="form-control" style="height:150px;" placeholder="SMS içeriğini buraya yazınız"></textarea>
							<br />
							<span style="font-size: 9pt">
								<a onclick="copyToClipboard('#ladsoyad')" id="ladsoyad" class="v3-btn v3-btn-xs v3-btn-info mr5" title="Müşteri Ad Soyad">{AdSoyad}</a> 
								<a onclick="copyToClipboard('#lfirmaadi')" id="lfirmaadi" class="v3-btn v3-btn-xs v3-btn-info mr5" title="Müşteri Firma Adı">{FirmaAdi}</a> 
								<a onclick="copyToClipboard('#lunvan')" id="lunvan" class="v3-btn v3-btn-xs v3-btn-info mr5" title="Müşteri Ünvan">{Unvan}</a> 
								<a onclick="copyToClipboard('#ltel')" id="ltel" class="v3-btn v3-btn-xs v3-btn-info mr5" title="Müşteri Telefon">{Telefon}</a> 
								<a onclick="copyToClipboard('#lemail')" id="lemail" class="v3-btn v3-btn-xs v3-btn-info mr5" title="Müşteri Email">{Email}</a> 
								<a onclick="copyToClipboard('#lsifre')" id="lsifre" class="v3-btn v3-btn-xs v3-btn-info mr5" title="Müşteri Şifre">{Sifre}</a> 
								<a onclick="copyToClipboard('#firma')" id="firma" class="v3-btn v3-btn-xs v3-btn-warning mr5" title="<?php echo $firma?>">{firma}</a> 
								<a onclick="copyToClipboard('#ftel')" id="ftel" class="v3-btn v3-btn-xs v3-btn-warning mr5" title="<?php echo $ftel?>">{ftel}</a> 
								<a onclick="copyToClipboard('#ftel2')" id="ftel2" class="v3-btn v3-btn-xs v3-btn-warning mr5" title="<?php echo $ftel2?>">[ftel2]</a> 
								<a onclick="copyToClipboard('#fgsm')" id="fweb" class="v3-btn v3-btn-xs v3-btn-warning mr5" title="<?php echo $fgsm?>">{fgsm}</a> 
								<a onclick="copyToClipboard('#fweb')" id="fweb" class="v3-btn v3-btn-xs v3-btn-warning mr5" title="<?php echo $fweb?>">{fweb}</a> 
								<a onclick="copyToClipboard('#fadres')" id="fadres" class="v3-btn v3-btn-xs v3-btn-warning mr5" title="<?php echo $fadres?>">{fadres}</a> 
							</span>
						</div>
						<div class="v3-col-xs-12">
							<button type="submit" class="btn btn-success" style="margin-top:15px; float:right;">Gönder</button>
						</div>
					</form>
				<?php
				echo $footer;
				} elseif ($_GET["durum"] == "send") {
					$alici   = trim($_POST["alici"]);
					$mesaj   = trim($_POST["mesaj"]);

					smsgonder(telefon($alici), $mesaj);
					echo location("?islem=smsbox&ne=".$_GET["ne"]."&durum=ok", self, 500, 1);
				}
			?>
		<?php }elseif($_GET["islem"]=="devir"){?>
			<?php include("scripts.php");?>
			<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
			<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
			<link rel="stylesheet" href="//cdn.crmplus.com.tr/css/watolye.css" type="text/css" />
			<div class="container" style="margin-top:30px;">
				<div class="row text-center">
					<div class="col-xs-6">
						<a href="?islem=devir&durum=devir" class="btn btn-success btn-lg" style="width:100%;">
							<i class="fa fa-refresh"></i> Hesap Devir Yap
						</a>
					</div>
					<div class="col-xs-6">
						<a href="?islem=devir&durum=devir_list" class="btn btn-primary btn-lg" style="width:100%;">
							<i class="fa fa-archive"></i> Geçmiş Devirler
						</a>
					</div>
				</div>
				<div class="row" style="margin-top:30px;">
					<div class="col-xs-12">
						<div class="panel panel-default">
							<div class="panel-heading text-center">
								<h4><i class="fa fa-info-circle"></i> Devir İşlemleri Hakkında</h4>
							</div>
							<div class="panel-body">
								<p>Hesap devir işlemi ile mevcut cariler sıfırlanır ve yeni devir kaydı oluşturulur.</p>
								<p><strong>Uyarı:</strong> Bir kez yapılan devir işlemi geri alınamaz.</p>
							</div>
						</div>
					</div>
				</div>
			</div>
			<?php
			if($_GET["durum"] == "devir"){
				$jsf = "../deppo/datas/archive_" . date("m-Y") . ".json";
				if(!file_exists($jsf)){
					$result = [];
					$sql = mysqli_query($conn, "SELECT * FROM t4"); while($rs = mysqli_fetch_assoc($sql)){ $result[] = $rs; }
						// 1. ADIM: JSON OLUŞTUR
					$data = json_encode($result, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
					file_put_contents($jsf, $data);
						// 2. ADIM: JSON VERİSİNDEN DEVİR BAKİYESİ HESAPLA
					$clients = [];
					foreach($result as $row){
						if($row['ne'] == 'cari'){
							$s1 = $row['s1'];
							if(!isset($clients[$s1])){ $clients[$s1] = ['alacak'=>0, 'borc'=>0]; }
							$clients[$s1]['alacak'] += ($row['pb1'] - $row['pb2']);
							$clients[$s1]['borc']   += ($row['pb3'] - $row['pb4']);
						}
					}
//----------------------------------------->Sil
						$buay = strtotime(date("Y-m-01")); // Ayın 1'i baz alınır
						$sql = mysqli_query($conn, "SELECT id, ne, t4, t9, t10, t12 FROM t4"); while($w = mysqli_fetch_assoc($sql)){
							$ne = $w["ne"];
							$id = $w["id"];
							$sil = false;
							// Tarihler strtotime'a çevrilir (boşsa 0)
							$t4  = $w["t4"]  ? strtotime($w["t4"])  : 0;
							$t9  = $w["t9"]  ? strtotime($w["t9"])  : 0;
							$t10 = $w["t10"] ? strtotime($w["t10"]) : 0;
							$t12 = $w["t12"] ? strtotime($w["t12"]) : 0;
							if ($ne == "service" && $t10 < $buay) $sil = true;
							if (in_array($ne, ["sfatura", "afatura", "ifatura"]) && $t9 < $buay) $sil = true;
							if (in_array($ne, ["cek", "senet"]) && $t4 < $buay) $sil = true;
							if ($ne == "cari" && (($t12 > 0 && $t12 < $buay) || ($t12 == 0 && $t4 < $buay))) $sil = true;
							if ($sil) {
								// Fatura veya teklif silindiğinde, alt ürünlerin de silinmesi gerek
								if (in_array($ne, ["sfatura", "afatura", "ifatura"])) {
									// Bu faturaya ait alt ürünleri sil
									$faturaID = $id; // Fatura ID'si
									mysqli_query($conn, "DELETE FROM furun WHERE s1='$faturaID'");
								}
								// Teklif için aynı işlem
								if (in_array($ne, ["teklif"])) {
									$teklifID = $id; // Teklif ID'si
									mysqli_query($conn, "DELETE FROM furun WHERE s1='$teklifID'");
								}
								// Ana kaydı sil
								mysqli_query($conn, "DELETE FROM t4 WHERE id='$id' LIMIT 1");
							}
						}
//----------------------------------------->Sil
						foreach($clients as $uyeID => $bakiye){
							$alacak = $bakiye['alacak'];
							$borc   = $bakiye['borc'];
							if(($alacak - $borc) != 0){
								$sql = $conn->query("INSERT INTO t4 (t1, t2, t3, t4, ne, t6, t11, pb1, pb2, pb3, pb4, ts1, n1, s1, s5) VALUES ('Nakit', 'cari', '', '".date("Y-m-d")."', 'cari', '".$kpb."', 'Devir', '".sprice($alacak)."', '0', '".sprice($borc)."', '0', NOW(), 'Hesap Devri', '".(int)$uyeID."', '0')");
							}
						}
						echo "<div class='alert alert-success'>Devir İşlemi Tamamlandı ve eski kayıt temizlendi.</div>";
					} else {
						echo "<div class='alert alert-warning'>Bu ay için devir işlemi zaten yapılmış.</div>";
					}
				}elseif($_GET["durum"] == "devir_list"){
					echo "<ul class=\"list-group\">";
					$dir = opendir("../deppo/datas");
					while(($dosya = readdir($dir)) !== false){
						if(!is_dir($dosya)){
							if(substr($dosya,0,7)=="archive"){
								echo "<li class=\"list-group-item\">
								<span class=\"badge\">
								<a href=\"?islem=devir&durum=view&json=".$dosya."\" class=\"fa fa-eye\"></a>
								</span> ".$dosya."
								</li>";
							}
						}
					}
					closedir($dir);
					echo "</ul>";
				}
				?>
			<?php }elseif($_GET["islem"]=="search_point"){?>
				<?php include("scripts.php");?>
				<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
				<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
				<link rel="stylesheet" href="//cdn.crmplus.com.tr/css/watolye.css" type="text/css" /> 
				<form method="post" action="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&durum=search" class="v3-row form" autocomplete="off" style="padding:10px;">
					<?php //include("modules/public/control_bar.php")?>
					<div class="v3-col-xs-10">
						<label>Aranan</b></label>
						<input class="form-control" type="text" name="q" value="" placeholder="Aranan">
					</div>
					<div class="v3-col-xs-2">
						<button id="send" class="v3-btn v3-btn-warning" type="submit" style="margin-top:20px; float:right;"><?php echo $sdil[112]; //Gönder?></button>
					</div>
				</form>
				<?php
				if($_GET["durum"]=="search"){
					$points = json_decode(getpoint('0','list','../../../'),true); krsort($points); $i=0;
					echo '<table class="table"><tr>';
					foreach($points as $key=>$value){
						if ($value["EventId"]==$_POST["q"]){
							$sqlc=mysqli_query($conn, "select * from t5 where id=".$value["UserId"].""); $rsc=mysqli_fetch_assoc($sqlc);
							echo '<td>'.$value["EventId"].'</td>';
							echo '<td><a href="'.$weburl.'/crmplus?islem=duye&ne=uye&id='.$rsc["id"].'" target="_top">'.$rsc["t1"].'</a></td>';
							echo '<td>'.$value["Point"].'</td>';
							echo '<td>'.dtarih($value["Date"],"gg.ka.yyyy").'</td>';
						}
					}
					echo '</tr></table>';
				}
				?>
			<?php }elseif($_GET["islem"]=="guide"){?>
				<iframe src="//dev.<?php echo $cdnurl?>/crmplus/?keys=<?php echo $_GET["keys"]?>" style="background:#171717; border:0px; width:100%; height:100%;"></iframe>
				<?php
	}elseif($_GET["islem"]=="uxml"){		//xml Session
		$_SESSION["uxml"]=$_GET["xml"];
		echo "<i class='fa fa-check'></i>";
	}elseif($_GET["islem"]=="colordedect"){		//colordedect
		$data = file_get_contents("https://cdn.".$cdnurl."/colordedector/?image=".$logo."", false, stream_context_create($arrContextOptions));
		$json = json_decode($data, true);
		foreach($json as $key=>$value){
			$colors=$colors.",".$key;
		}
		$Rs = mysqli_query($conn, "update ".$_SESSION["lang"]." set i2='".str_replace('Array,','',ltrim($colors,','))."' ");
	}elseif($_GET["islem"]=="initializeTranslations"){
		initializeTranslations();
	}elseif($_GET["durum"]=="sidebar"){
		if($_SESSION["sidebar"]==""){
			$_SESSION["sidebar"]="collapsed";
		}else{
			$_SESSION["sidebar"]="";
		}
	}elseif($_GET["durum"]=="ujson"){
		if($_SESSION["user_id"]=="0"){
			$sql=mysqli_query($conn, "select * from ".$_SESSION["lang"]." where ne='ayarlar' "); $rs=mysqli_fetch_assoc($sql); $jsi = json_decode($rs["n18"], true);
		}elseif($_SESSION["user_id"]<>"0"){
			$sql=mysqli_query($conn, "select * from t5 where id=".$_SESSION["user_id"].""); $rs=mysqli_fetch_assoc($sql); $jsi = json_decode($rs["n19"], true);
			if(is_array($jsi)<>1){$jsi = array();}
		}
		foreach ($_GET as $key => $value){
			if($key<>"durum"){
				echo $key; echo ":"; echo $value; echo "<br>";
			}
		}
		$iarr = uparr($jsi, $key, $value);
		$rjsi = json_encode($iarr, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
		if($_SESSION["user_id"]=="0"){
			$update = mysqli_query($conn, "update ".$_SESSION["lang"]." set n18='".addslashes(stripslashes($rjsi))."' where ne='ayarlar'");
		}elseif($_SESSION["user_id"]<>"0"){
			$update = mysqli_query($conn, "update t5 set n19='".addslashes(stripslashes($rjsi))."' where id='".$_SESSION["user_id"]."'");
		}
		//Print_r($jsi);
		
	}elseif($_GET["durum"]=="wdisable"){
		$_SESSION["w".$_GET["ID"].""]="display:none;";
	}elseif($_GET["durum"]=="wenable"){
		$_SESSION["w".$_GET["ID"].""]="display:block;";
	}elseif($_GET["durum"]=="ftasarim"){
		$array = "".$_POST['l'].",".$_POST['t'].",".$_POST['w'].",".$_POST['h']."";
		$sql=mysqli_query($conn, "select * from genel where ne='ftasarim'"); $rs=mysqli_fetch_assoc($sql);
		if(mysqli_num_rows($sql)==0){
			$sql = $conn->query("insert into genel (ne) values ('ftasarim')");
		}
		$Rs = mysqli_query($conn, "update genel set ".$_POST['ne']."='".$array."' where ne='ftasarim'");
	}elseif($_GET["durum"]=="sftasarim"){
		$array = "".$_POST['l'].",".$_POST['t'].",".$_POST['w'].",".$_POST['h']."";
		$sql=mysqli_query($conn, "select * from genel where ne='sftasarim'"); $rs=mysqli_fetch_assoc($sql);
		if(mysqli_num_rows($sql)==0){
			$sql = $conn->query("insert into genel (ne) values ('sftasarim')");
		}
		$Rs = mysqli_query($conn, "update genel set ".$_POST['ne']."='".$array."' where ne='sftasarim'");
	}else if($_GET["durum"]=="authority"){
		foreach ($_SESSION as $key => $value){
			if(substr($key,0,1)=="y"){ $_SESSION[$key]="";}
		}
		$sql=mysqli_query($conn, "select * from t5 where id=".$_SESSION["user_id"].""); $rs=mysqli_fetch_assoc($sql); $jsa = json_decode($rs["n8"], true); $jsi = json_decode($rs["n17"],true);
		$jyetki = json_decode($rs["n10"],true);
		$_SESSION["jyetki"]=$jyetki;
		foreach($jyetki as $key=>$value){
			$_SESSION[$key]=$jyetki[$key];
			setcookie($key,$jyetki[$value], time()+(60*60*24*30));
		}
		echo "
		<div id=\"check\" style=\"position: fixed; width: 50%; margin-left: 25%; margin-right: 25%; margin-top: 15%; font-size: 24px; text-align:center\">
		<i class=\"fa fa-check-square-o\" aria-hidden=\"true\" style=\"color:#34a917; font-size:100px;\"></i><br> ".ctranslate("Yetkiler Güncellendi")."<br>".$item->i3."
		</div>
		";
		foreach($jyetki as $key=>$value){
			//echo "".$key." => ".$jyetki[$key]."<br>";
		}
	}elseif($_GET["durum"]=="add_keep"){
		if(!empty($_POST["t5"])){$st5 = implode(',',$_POST["t5"]);}else{$st5="0";}
		if(!empty($_POST["s3"])){$ss3=$_POST["s3"];}else{$ss3="0";}
		$sql = $conn->query("insert into genel(t1,t2,t3,t5,ne,n1,s3,s19,ts1,ts2) values ('Keep Note', '".addslashes($_POST["t2"])."', '".$_GET["islem"]."', '".$st5."', 'not', '".addslashes($_POST["n1"])."', '".$ss3."', '".$_SESSION["user_id"]."', now() ,now())");
		echo "url:".$weburl."/".$crmpath."/?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&ay=".$_POST["ay"]."&yil=".$_POST["yil"]."&durum=ok";
	}elseif($_GET["durum"]=="tags"){
		$tags=explode(",",tanim("tags","n1",0));
		foreach($tags as $tag){$i++;
			echo "<div class='btn-group' style='margin-right:5px;margin-bottom:5px;'><button class='btn btn-warning cp' onclick=\"copyToClipboard('#tag".$i."');\">".$tag."</button></div>";
			echo "<div id='tag".$i."' style=\"display:none;\">".$firma." firması için ".trim($tag)." hakkında blog yazısı</div>";
		}
	}elseif($_GET["durum"]=="keep"){	//keep
		$Rs = mysqli_query($conn, "update genel set n1='".$_POST["n1"]."', n2='".$_POST["position"]."', n3='".$_POST["properties"]."', n4='".$_POST["color"]."', n5='".$_POST["zindex"]."', s3='".$_POST["s3"]."', t4='".$_POST["t4"]."', ts2=now() where id=".$_GET["id"]."");
		echo "<i class=\"fa-solid fa-check\"></i>";
		
	}elseif($_GET["durum"]=="mkeep"){	//mobil keep
		$Rs = mysqli_query($conn, "update genel set t1='".$_POST["t1"]."', n1='".$_POST["n1"]."', ts2=now() where id=".$_GET["id"]."");

	}elseif($_GET["durum"]=="exupdate"){	//manuel Kur
		echo kural(1,$module["exchange_type"]);
		echo "<SCRIPT LANGUAGE='JavaScript'>window.location='".$weburl."/".$crmpath."';</script>";
		echo "".$sdil[180]."	".$sdil[134]." {".date("d.m.Y H:i:s")."} [<b>TCMB</b>]";

	}elseif($_GET["durum"]=="spass"){	//Pass
		$Rss = mysqli_query($conn, "update genel set t4='".v3e($_GET["pass"])."' where ne='asifre' and t1='YWRtaW4='");
	}
?>