<?php
header('Content-Type: text/html; charset=utf-8');
error_reporting(0);
$path="../../";
include("../../map.php");
include("../../scripts.php");
include("../../secure.php");
?>
<!DOCTYPE html>
<html lang="tr">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title><?php echo ctranslate("Banka(lar)")?></title>
</head>
<body>
<div class="alert alert-warning" id="result" style="display:none;"></div>
<div class="" style="padding:0px 15px;">
	<div class="row">
		<!-- İçerik alanı -->
		<div class="col-12">
			<div class="tab-content" id="pills-tabContent">
				<div class="tab-pane show active" id="pills-content-1" role="tabpanel" aria-labelledby="pills-tab-1">
					<table class="table table-no-more table-bordered table-striped mb-0" style="overflow:auto;">
						<tr class="tittr  mdn">
							<td><?php echo ctranslate("#Banka")?></td>
							<td class="w20"><?php echo ctranslate("#Tip")?></td>
							<?php if($c7==1){?>
								<td class="w8"><?php echo ctranslate("#Bakiye")?></td>
							<?php }?>
							<td class="w6"><?php echo ctranslate("#Sıra")?></td>
							<td class="w6"><?php echo ctranslate("#İşlem")?></td>
							<tr>
								<form method="POST" action="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&durum=ekle">
									<input type="hidden" value="banka" name="ne">
									<input type="hidden" value="" name="s1" id="as1">
									<input type="hidden" value="" name="s4" id="as4">
									<input type="hidden" value="" name="t3" id="at3">
									<?php $sqlk=mysqli_query($conn, "select * from genel where ne='banka' and s2<>0"); $cbanka = mysqli_num_rows($sqlk); ?>
									<tr class="addtr mdfx">
										<td class="mw35  tw55 mfl">
											<select size="1" id="at1" name="t1" class="form-control" title="Banka Seçiniz">
												<option selected value="0"><?php echo $sdil[221]; //Lütfen Seçiniz?></option>
												<option value="Garanti Bankası" data-id="16" data-cc="62" data-cl="69CD33">Garanti Bankası</option>
												<option value="Akbank" data-id="41" data-cc="46" data-cl="FEDC04">Akbank</option>
												<option value="Yapı Kredi" data-id="39" data-cc="67" data-cl="6C0071">Yapı Kredi</option>
												<option value="Tc.İş Bankası" data-id="28" data-cc="64" data-cl="E21066">Tc.İş Bankası</option>
												<option value="Vakıfbank" data-id="38" data-cc="15" data-cl="f7b413">Vakıfbank</option>
												<option value="Ziraat Bankası" data-id="40" data-cc="10" data-cl="e51519">Ziraat Bankası</option>
												<option value="Finansbank" data-id="14" data-cc="111" data-cl="0E4391">Finansbank</option>
												<option value="Deniz Bank" data-id="12" data-cc="134" data-cl="01326d">Deniz Bank</option>
												<option value="Tc.Halk Bankası" data-id="27" data-cc="12" data-cl="36defd">Tc.Halk Bankası</option>
												<option value="TEB" data-id="32" data-cc="32" data-cl="00a76d">TEB</option>
												<option value="Albarakatürk" data-id="3" data-cc="203" data-cl="ca132b">Albarakatürk</option>
												<option value="Anadolubank" data-id="5" data-cc="135" data-cl="000">Anadolubank</option>
												<option value="Asya Katılım Bankası" data-id="7" data-cc="208" data-cl="0c467e">Asya Katılım Bankası</option>
												<option value="Citibank" data-id="11" data-cc="92" data-cl="f80000">Citibank</option>
												<option value="Fortis Bank" data-id="15" data-cc="71" data-cl="f80000">Fortis Bank</option>
												<option value="HSBC Bank" data-id="18" data-cc="123" data-cl="d50011">HSBC Bank</option>
												<option value="ING Bank" data-id="19" data-cc="99" data-cl="f85612">ING Bank</option>
												<option value="Kuveyt Türk" data-id="20" data-cc="205" data-cl="036345">Kuveyt Türk</option>
												<option value="Şekerbank" data-id="26" data-cc="59" data-cl="01774f">Şekerbank</option>
												<option value="Türkiye Finans" data-id="37" data-cc="206" data-cl="00c0ae">Türkiye Finans</option>
												<option value="Diğer" data-id="0" data-cc="0" data-cl="ccc">Diğer</option>
											</select>
										</td>
										<td class="w20 mw30 tw30 mfl">
											<select size="1" name="s2" class="form-control" style="width:75%; float:left;">
												<?php if($s3<>0 or $module["muhasebe_ekstre"]<>0){?>
													<option value="0,0,Havale" Selected><?php echo $sdil[226]; //Havale/Eft?></option>
												<?php }?>
												<?php if(($s5<>0 or $g3<>0) and $cbanka <= $module["pos_limit"]){?>
													<option value="1,1,Pos">Pos</option>
													<!--<option value="2,2,Oo">Ortak Ödeme</option>-->
													<?php $t=0; $sqlt=mysqli_query($conn, "select * from genel where ne='tanim' and t2='Pay' and s13=1 order by id asc"); while($rst=mysqli_fetch_assoc($sqlt)){$t++;?>
														<option value="<?php echo $t+2?>,<?php echo $rst["id"]?>,<?php echo $rst["n4"]?>"><?php echo $rst["n4"]?></option>
													<?php }?>
												<?php }else{?>
													<option value="0"><?php echo translate("#Yetersiz Pos Limiti")?></option>
												<?php }?>
											</select>
											<div class="switch switch-sm switch-success mdn" style="float:right;">
												<input type="checkbox" name="s13" value="1" data-plugin-ios-switch="" <?php if($rs["s13"]=="1") {?>checked<?php }?>>
											</div>
										</td>
										<?php if($c7==1){?>
											<td class="w8 mdn">
												<input type="text" name="pb1" value="0.00" class="form-control p5 mp5">
											</td>
										<?php }?>
										<td class="w6 mdn">
											<input type="text" name="s10" value="0" title="Sıra" class="form-control">
										</td>
										
										<td class="w6 mw33 tw15 mfl mpt5">
											<div class="input-group-btn">
												<button tabindex="-1" class="btn btn-warning" type="submit" <?php if ($e10==1 and $MSA<>"1"){?>disabled<?php }?>><i class="fa fa-plus"></i> </button>
											</div>
										</td>
										<tr>
										</form>
										<?php $sql=mysqli_query($conn, "select * from genel where ne='banka' order by s10 asc"); while($rs=mysqli_fetch_assoc($sql)){ ?>
											<form method="POST" action="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $rs["id"];?>&durum=duzenle" id="xf<?php echo $rs["id"];?>" name="xf<?php echo $rs["id"];?>">
												<input type="hidden" value="banka" name="ne">
												<input type="hidden" value="<?php echo $rs["s1"];?>" name="s1" id="us1_<?php echo $rs["id"];?>">
												<input type="hidden" value="<?php echo $rs["s4"];?>" name="s4" id="us4_<?php echo $rs["id"];?>">
												<input type="hidden" value="<?php echo $rs["t3"];?>" name="t3" id="ut3_<?php echo $rs["id"];?>">
												<tr class="btr mdfx">
													<td class="mw35 tw55 mfl">
														<select size="1" id="ut1_<?php echo $rs["id"];?>" name="t1" class="form-control" title="Banka Seçiniz">
															<option selected value="0"><?php echo $sdil[221]; //Lütfen Seçiniz?></option>
															<option value="Garanti Bankası" data-id="16" data-cc="62" data-cl="69CD33" <?php if($rs["s1"]==16){echo "Selected";}?>>Garanti Bankası <?php if($rs["s1"]==16 and $rs["t2"]=="Havale"){echo "{".$rs["t12"]."}";}?></option>
															<option value="Akbank" data-id="41" data-cc="46" data-cl="FEDC04" <?php if($rs["s1"]==41){echo "Selected";}?>>Akbank <?php if($rs["s1"]==41 and $rs["t2"]=="Havale"){echo "{".$rs["t12"]."}";}?></option>
															<option value="Yapı Kredi" data-id="39" data-cc="67" data-cl="6C0071" <?php if($rs["s1"]==39){echo "Selected";}?>>Yapı Kredi <?php if($rs["s1"]==39 and $rs["t2"]=="Havale"){echo "{".$rs["t12"]."}";}?></option>
															<option value="Tc.İş Bankası" data-id="28" data-cc="64" data-cl="E21066" <?php if($rs["s1"]==28){echo "Selected";}?>>Tc.İş Bankası <?php if($rs["s1"]==28 and $rs["t2"]=="Havale"){echo "{".$rs["t12"]."}";}?></option>
															<option value="Vakıfbank" data-id="38" data-cc="15" data-cl="f7b413" <?php if($rs["s1"]==38){echo "Selected";}?>>Vakıfbank <?php if($rs["s1"]==38 and $rs["t2"]=="Havale"){echo "{".$rs["t12"]."}";}?></option>
															<option value="Ziraat Bankası" data-id="40" data-cc="10" data-cl="e51519" <?php if($rs["s1"]==40){echo "Selected";}?>>Ziraat Bankası <?php if($rs["s1"]==40 and $rs["t2"]=="Havale"){echo "{".$rs["t12"]."}";}?></option>
															<option value="Finansbank" data-id="14" data-cc="111" data-cl="0E4391" <?php if($rs["s1"]==14){echo "Selected";}?>>Finansbank <?php if($rs["s1"]==14 and $rs["t2"]=="Havale"){echo "{".$rs["t12"]."}";}?></option>
															<option value="Deniz Bank" data-id="12" data-cc="134" data-cl="01326d" <?php if($rs["s1"]==12){echo "Selected";}?>>Deniz Bank <?php if($rs["s1"]==12 and $rs["t2"]=="Havale"){echo "{".$rs["t12"]."}";}?></option>
															<option value="Tc.Halk Bankası" data-id="27" data-cc="12" data-cl="36defd" <?php if($rs["s1"]==27){echo "Selected";}?>>Tc.Halk Bankası <?php if($rs["s1"]==27 and $rs["t2"]=="Havale"){echo "{".$rs["t12"]."}";}?></option>
															<option value="TEB" data-id="32" data-cc="32" data-cl="00a76d" <?php if($rs["s1"]==32){echo "Selected";}?>>TEB <?php if($rs["s1"]==32 and $rs["t2"]=="Havale"){echo "{".$rs["t12"]."}";}?></option>
															<option value="Albarakatürk" data-id="3" data-cc="203" data-cl="ca132b" <?php if($rs["s1"]==3){echo "Selected";}?>>Albarakatürk <?php if($rs["s1"]==3 and $rs["t2"]=="Havale"){echo "{".$rs["t12"]."}";}?></option>
															<option value="Anadolubank" data-id="5" data-cc="135" data-cl="000" <?php if($rs["s1"]==5){echo "Selected";}?>>Anadolubank <?php if($rs["s1"]==5 and $rs["t2"]=="Havale"){echo "{".$rs["t12"]."}";}?></option>
															<option value="Asya Katılım Bankası" data-id="7" data-cc="208" data-cl="0c467e" <?php if($rs["s1"]==7){echo "Selected";}?>>Asya Katılım Bankası <?php if($rs["s1"]==7 and $rs["t2"]=="Havale"){echo "{".$rs["t12"]."}";}?></option>
															<option value="Citibank" data-id="11" data-cc="92" data-cl="f80000" <?php if($rs["s1"]==11){echo "Selected";}?>>Citibank <?php if($rs["s1"]==11 and $rs["t2"]=="Havale"){echo "{".$rs["t12"]."}";}?></option>
															<option value="Fortis Bank" data-id="15" data-cc="71" data-cl="f80000" <?php if($rs["s1"]==15){echo "Selected";}?>>Fortis Bank <?php if($rs["s1"]==15 and $rs["t2"]=="Havale"){echo "{".$rs["t12"]."}";}?></option>
															<option value="HSBC Bank" data-id="18" data-cc="123" data-cl="d50011" <?php if($rs["s1"]==18){echo "Selected";}?>>HSBC Bank <?php if($rs["s1"]==18 and $rs["t2"]=="Havale"){echo "{".$rs["t12"]."}";}?></option>
															<option value="ING Bank" data-id="19" data-cc="99" data-cl="f85612" <?php if($rs["s1"]==19){echo "Selected";}?>>ING Bank <?php if($rs["s1"]==19 and $rs["t2"]=="Havale"){echo "{".$rs["t12"]."}";}?></option>
															<option value="Kuveyt Türk" data-id="20" data-cc="205" data-cl="036345" <?php if($rs["s1"]==20){echo "Selected";}?>>Kuveyt Türk <?php if($rs["s1"]==20 and $rs["t2"]=="Havale"){echo "{".$rs["t12"]."}";}?></option>
															<option value="Şekerbank" data-id="26" data-cc="59" data-cl="01774f" <?php if($rs["s1"]==26){echo "Selected";}?>>Şekerbank <?php if($rs["s1"]==26 and $rs["t2"]=="Havale"){echo "{".$rs["t12"]."}";}?></option>
															<option value="Türkiye Finans" data-id="37" data-cc="206" data-cl="00c0ae" <?php if($rs["s1"]==37){echo "Selected";}?>>Türkiye Finans <?php if($rs["s1"]==37 and $rs["t2"]=="Havale"){echo "{".$rs["t12"]."}";}?></option>
															<option value="Diğer" data-id="0" data-cc="0" data-cl="ccc" <?php if($rs["s1"]==0){echo "Selected";}?>>Diğer <?php if($rs["s1"]==0 and $rs["t2"]=="Havale"){echo "{".$rs["t12"]."}";}?></option>
														</select>
													</td>
													<td class="w20 mw30 tw30 mfl">
														<select size="1" name="s2" class="form-control" style="width:75%; float:left;">
															<?php if($s3<>0 or $module["muhasebe_ekstre"]<>0){?>
																<option value="0,0,Havale" <?php if($rs["s2"]==0){?>Selected<?php }?>><?php echo $sdil[226]; //Havale/Eft?></option>
															<?php }?>
															<option value="1,1,Pos" <?php if($rs["s2"]==1){?>Selected<?php }?>>Pos</option>
															<!--<option value="2,1,Oo" <?php if($rs["s2"]==2){?>Selected<?php }?>>Ortak Ödeme</option>-->
															<?php $t=0;$sqlt=mysqli_query($conn, "select * from genel where ne='tanim' and t2='Pay' order by id asc"); while($rst=mysqli_fetch_assoc($sqlt)){$t++;?>
																<option value="<?php echo $t+2?>,<?php echo $rst["id"]?>,<?php echo $rst["n4"]?>" <?php if($rs["s2"]==$t+2){?>Selected<?php }?>><?php echo $rst["n4"]?></option>
															<?php }?>
														</select>
														<div class="switch switch-sm switch-success mdn" style="float:right;">
															<input type="checkbox" name="s13" value="1" data-plugin-ios-switch="" <?php if($rs["s13"]=="1") {?>checked<?php }?>>
														</div>
													</td>
													<?php if($c7==1){?>
														<td class="w8 mdn">
															<input type="text" name="pb1" value="<?php echo wprice($rs["pb1"]);?>" class="form-control p5 mp5">
														</td>
													<?php }?>
													<td class="w6 mdn">
														<input type="text" name="s10" value="<?php echo $rs["s10"];?>" title="Sıra" class="form-control">
													</td>
													<td class="w6 mw33 tw15 mfl">
														<div class="input-group-btn">
															<button type="button" tabindex="-1" class="btn btn-warning  mr2 mmr2" id="b<?php echo $rs["id"];?>" onclick="Ajaxs('<?php echo $rs["id"];?>','#result','AjaxPost');" <?php if($e10==1 and $MSA<>"1"){?>disabled<?php }?>><i class="fa fa-refresh"></i></button>
															<?php if($e10==1 and $MSA<>"1"){?>
																<button type="button" tabindex="-1" class="btn btn-warning  mr2 mmr2" id=""><i class="fa fa-lock" aria-hidden="true"></i></button>
															<?php }else{?>
																<button type="button" tabindex="-1" class="btn btn-info mfrm  mr2 mmr2" data-toggle="modal" data-target="#myModal" data-url="../ecommerce/ecommerce_bank.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $rs["id"];?>" type="button" id="b<?php echo $rs["id"];?>" <?php if($e10==1 and $MSA<>"1"){?>disabled<?php }?>><i class="fa fa-pencil"></i></button>
																<button type="button" tabindex="-1" class="btn btn-danger" onclick="location.href='?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $rs["id"];?>&durum=sil'" <?php if($e10==1 and $MSA<>"1"){?>disabled<?php }?>><i class="fa fa-times"></i></button>
															<?php }?>
														</div>
													</td>
													<tr>
													</form>
													<script type="text/javascript">
														jQuery('#ut1_<?php echo $rs["id"];?>').on('change', function() {
															var selectedOption = jQuery(this).find('option:selected');
															jQuery("#us1_<?php echo $rs["id"];?>").val(selectedOption.data('id'));
															jQuery("#us4_<?php echo $rs["id"];?>").val(selectedOption.data('cc'));
															jQuery("#ut3_<?php echo $rs["id"];?>").val(selectedOption.data('cl'));
														});
													</script>
												<?php }?>
											</table>
										</div>
									</div>
								</div>
							</div>
						</div>
					</section>
				</body>
				</html>

				<script type="text/javascript">
					jQuery('#at1').on('change', function() {
						var selectedOption = jQuery(this).find('option:selected');
						jQuery("#as1").val(selectedOption.data('id'));
						jQuery("#as4").val(selectedOption.data('cc'));
						jQuery("#at3").val(selectedOption.data('cl'));
					});
				</script>

				<?php
				echo $footer;
				//-- Sol İşlemleri -->
				if($_POST["s1"]==""){$s1=0;}else{$s1=$_POST["s1"];}
				if($_POST["s4"]==""){$s4=0;}else{$s4=$_POST["s4"];}
				if($_POST["s13"]==""){$s13=0;}else{$s13=$_POST["s13"];}
				if($_POST["pb1"]<>""){$pb1=$_POST["pb1"];}else{$pb1="0";}

				if($_GET["durum"]=="ekle"){
					$ss2 = explode(',',$_POST["s2"]);
					$sql = $conn->query("insert into genel(s1,s2,s3,s4,s10,s13,t1,t2,t3,ne,pb1,s19) values ('".$s1."', '".$ss2[0]."', '".$ss2[1]."', '".$s4."', '".$_POST["s10"]."', '".$s13."', '".$_POST["t1"]."', '".$ss2[2]."', '".$_POST["t3"]."', '".$_POST["ne"]."', '".sprice($pb1)."', '".$_SESSION["user_id"]."')");
					echo "<SCRIPT LANGUAGE='JavaScript'>window.location='?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&durum=ok_1';</script>";

				}elseif($_GET["durum"]=="duzenle"){
					$ss2 = explode(',',$_POST["s2"]);
					$Rs = mysqli_query($conn, "update genel set t1='".$_POST["t1"]."', t2='".$ss2[2]."', s1='".$s1."', s2='".$ss2[0]."', s3='".$ss2[1]."', s4='".$s4."', s10='".$_POST["s10"]."', s13='".$s13."', pb1='".sprice($pb1)."' where id=".$_GET["id"]."");
					echo "<SCRIPT LANGUAGE='JavaScript'>window.location='?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&durum=ok_1';</script>";

				}elseif($_GET["durum"]=="sil"){
					$sql = mysqli_query($conn, "delete from genel where id=".$_GET["id"]."");
					$sql = mysqli_query($conn, "delete from genel where ne='taksit' and s1=".$_GET["id"]."");
					echo "<SCRIPT LANGUAGE='JavaScript'>window.location='?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&id=".$_GET["id"]."&durum=ok_1';</script>";
				}
			?>