<?php
//-- Sipariş No -->
$ysn=date("dmYHis");
if (empty($_SESSION["Order_Crm_No"])){
  setcookie("Order_Crm_No", "$ysn", time()+3600);
  $_SESSION["Order_Crm_No"]=$ysn;
}else{
  $sqls=mysqli_query($conn, "select * from eticaret where ne='sepet' and t5='sepet' and t4='".$_SESSION["Order_Crm_No"]."'"); $rsg=mysqli_fetch_assoc($sqls);
  if(mysqli_num_rows($sqls)>0){ setcookie("Order_Crm_No", $rsg["t4"], time()+3600); $_SESSION["Order_Crm_No"]=$rsg["t4"];}
}
//-- Sipariş No -->
$sqlc=mysqli_query($conn, "select * from t5 where id='".$_SESSION["UyeID"]."'"); $rsc=mysqli_fetch_assoc($sqlc);
?>
<div class="inner-wrapper">
  <section role="main" class="content-body card-margin">
    <header class="page-header">
      <h2><?php echo translate("Hızlı Satış")?></h2>
      <div class="right-wrapper text-right">
        <ol class="breadcrumbs">
          <li>
            <a href=".">
              <i class="fa fa-home"></i>
            </a>
          </li>
          <li><?php echo translate("Hızlı Satış")?></span></li>
        </ol>
        <a class="sidebar-right-toggle" data-open="sidebar-right"><i class="fa fa-chevron-left"></i></a>
      </div>
    </header>
    <!-- start: page -->
    <div class="row">
      <div class="col">
        <section class="card form">
          <header class="card-header v3-bg-info" style="text-align: start">
            <div class="card-actions" id="v-<?php echo $_GET['islem'];?>">
              <a class="mb-1 mt-1 mr-1 btn btn-default" href="#" title="">#<?php echo $_SESSION["UyeID"];?> <?php echo $_SESSION["Cari"];?> > #<?php echo $_SESSION["s19ID"];?> <?php echo $_SESSION["s19Name"];?></a>
              <a class="mb-1 mt-1 mr-1 btn btn-default" href="#" title="">#<?php echo $_SESSION["Order_Crm_No"];?></a>
              <!--
                <a href="#" class="card-action card-action-toggle" data-card-toggle=""></a>
                <a href="#" class="card-action card-action-dismiss" data-card-dismiss=""></a>
              -->
            </div>
            <h2 class="card-title">E-<?php echo $sdil[148]; //Satış?></h2>
            <p class="card-subtitle">...</p>
          </header>
          <!--<form class="form" id="asave" name="rall" method="post" action="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $_GET["id"];?>&durum=kaydet">-->
            <?php //include("modules/public/control_bar.php")?>
            <?php if($_GET["durum"]=="ok"){?>
              <?php echo saveok();?>
              <div class="alert alert-success">
                <?php echo $sdil[212]; //islem Basariyla Gerçeklestirilmistir !?>
              </div>
            <?php }elseif($_GET["durum"]=="err"){?>
              <div class="alert alert-danger">
                <?php echo $sdil[9]; //Hata Oluştu !?>
              <?php }elseif($_GET["drm"]=="yok"){?>
                <div class="alert alert-danger">
                  <?php echo $sdil[9]; //Hata Oluştu !?>
                </div>
              <?php }?>
              <div class="alert alert-warning" id="err" style="display:none;"></div>
              <div class="v8-columns">
                <div class="v8-col200pxL-left">
                  <ul class="v8-side-tabs v8-js-tabs v8-same-height">
                    <li><a href="#tab1"><i class="fa fa-bookmark"></i><span> E-<?php echo $sdil[148]; //Satış?></span></a></li>
                  </ul>
                </div>
                <div class="v8-col200pxL-right">
                  <div id="tab1" class="v8-tabs-content">
                    <?php if($_GET["step"]=="" or $_GET["step"]=="1"){?>
                      <fieldset class="grey-bg">
                        <legend style=""><?php echo $t25;?></legend>
                        <form id="uID">
                          <div class="v3-col-md-3">
                            <select name="UyeID" data-placeholder="<?php echo $t25s[0]." ".$sdil[221];?>" style="width:100%;" onChange="AjaxPResult('modules/ecommerce/ajax.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>','#uID','#err')" class="populate" data-plugin-selecttwo="" tabindex="8">
                              <option value="0"><?php echo translate("Müşteri")?></option>
                              <?php $sql=mysqli_query($conn, "select * from t5 where t1 LIKE '%".$_GET["q"]."%' ".$luye.""); while($rsm=mysqli_fetch_assoc($sql)){?>
                                <option value="<?php echo $rsm["id"];?>" title="<?php echo $rsm["t1"];?>" alt="<?php echo $rsm["t1"];?>" style="color:#6699FF" <?php if ($rsm["id"]==$_SESSION["UyeID"]) {?>Selected<?php }?>><?php echo $rsm["t1"];?></option>
                              <?php }?>
                            </select>
                          </div>
                          <div class="v3-col-md-3">
                            <select name="s19ID" data-placeholder="<?php echo translate("İlgili")." ".$sdil[221];?>" style="width:100%;" onChange="AjaxPResult('modules/ecommerce/ajax.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>','#uID','#err')" class="populate" data-plugin-selecttwo="" tabindex="8">
                              <option value="0"><?php echo translate("Yetkili")?> (Admin)</option>
                              <?php $sql=mysqli_query($conn, "select * from t5 where t1 LIKE '%".$_GET["q"]."%' ".$luye.""); while($rsm=mysqli_fetch_assoc($sql)){?>
                                <option value="<?php echo $rsm["id"];?>" title="<?php echo $rsm["t1"];?>" alt="<?php echo $rsm["t1"];?>" style="color:#6699FF" <?php if ($rsm["id"]==$_SESSION["s19ID"]) {?>Selected<?php }?>><?php echo $rsm["t1"];?></option>
                              <?php }?>
                            </select>
                          </div>  
                        </form>
                      </fieldset>
<!--
                  <fieldset class="grey-bg">
                    <legend>Fatura No</legend>
                      <label for="simple-required">Fatura No</label>
                      <input type="text" name="Fatura_No" value="" class="form-control" placeholder="Fatura No" style="text-align: right;">
                  </fieldset>
                -->
                <fieldset class="no-margin">
                  <legend><?php echo $sdil[5];?></legend>
                  <table class="table table-no-more table-bordered table-striped mb-0">
                    <thead>
                      <tr>
                        <th class=""><?php echo $sdil[39];?></th>
                        <th class="w5 tac"><?php echo $sdil[88]; //Birim?></th>
                        <th class="w5 tar"><?php echo translate("Kdv")?></th>
                        <th class="w10 tar"><?php echo $sdil[85]; //Fiyat?></th>
                        <th class="w10 tar"><?php echo $sdil[144]; //Tutar?></th>
                        <th class="w8"><?php echo $sdil[213];?></th>
                      </tr>
                    </thead>
                    <tbody>
                      <form action="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&Sepet=ekle" method="post" id="Sform" name="Sform">
                        <tr class="addtr">
                          <td class="" style="position:relative;">
							<div id="at1_name" style="display:none; position: absolute; right: 15px; top: 12px; width: 50%; overflow: hidden; height: 18px;"></div>
							<input type="text" list="Pt4" id="at1" name="t1" class="form-control" value="" placeholder="<?php echo $t46;?>"  autofocus autocomplete="off">
							<datalist ID="Pt4" style="display: none;"></datalist>
							<select name="rb" data-placeholder="<?php echo $sdil[221]; //Varyasyon Seçiniz?>" style="display:none;" class="form-control chosen-select w30 fl ml10" tabindex="8" id="var_select">
							  <option value=""><?php echo $sdil[133]; //Varyasyon?></option>
							</select>
						  </td>
						  <td class="w7 mw7">
							<input type="number" class="form-control w45 mw50 fl tar mtal" style="border:0px;" value="1" onfocus="if(this.value == '1') { this.value = ''} " onblur="if(this.value == '') { this.value='1'; }" name="s5" id="as5">
							<select size=1 name="t10" id="at10" class="sna form-control w45 mw25 fr">
							  <?php if(!empty($t28)){$sbirim = explode(',',$t28); foreach($sbirim as $sbrm) {$s++; if($s > 20) {$s = 1;}?>
							  <option value="<?php echo $sbrm;?>"><?php echo $sbrm;?></option>
							<?php }}?>
						  </select>
						</td>
						<td class="w5 mw5">
						  <input type="text" class="form-control" style=" border:0px; text-align:right;" value="<?php echo $module["s12"]?>" onfocus="if(this.value == '<?php echo $module["s12"]?>') { this.value = ''} " onblur="if(this.value == '') { this.value='<?php echo $module["s12"]?>'; }" id="as4" name="s4">
						</td>
						<td class="p0 mp0 w10 mw10" style="<?php if($_GET["islem"]<>"dservice"){echo "display:none;";}?>">
						  <div class="input-group">
							<span class="input-group-addon" id="basic-addon1" style="padding: 5px;">
							  <select class="sfa sna" name="t6" id="at6" style="font-size: 16px; padding: 3px;">
								<option value="TRY" <?php if($kpb=="TRY"){echo "selected";}?>>&#xf195;</option>
								<option value="EUR" <?php if($kpb=="EUR"){echo "selected";}?>>&#xf153;</option>
								<option value="USD" <?php if($kpb=="USD"){echo "selected";}?>>&#xf155;</option>
								<option value="GBP" <?php if($kpb=="GBP"){echo "selected";}?>>&#xf154;</option>
							  </select>
							</span>
							<input type="text" name="fumaliyet" id="amaliyet" class="form-control repdot" style="border: 1px solid #ccc !important; text-align:right;" value="0.00" onfocus="if(this.value == '0.00') { this.value = ''} " onblur="if(this.value == '') { this.value='0.00'; }">
						  </div>
						</td>
						<td class="w10 mw10" style="<?php if($_GET["islem"]<>"dservice"){echo "display:none;";}?>">
						  <input type="text" name="fulfiyat" id="alprice" class="form-control repdot" style="border:0px; text-align:right;<?php if($rsfu["pb3"]<>0){echo "text-decoration: line-through;";}?>" value="0.00 " onfocus="if(this.value == '0.00') { this.value = ''} " onblur="if(this.value == '') { this.value='0.00'; }">
						</td>
						<td class="p0 mp0 w10 mw10">
						  <div class="input-group">
							<span class="input-group-addon" id="basic-addon1" style="padding: 5px;">
							  <select name="t2" class="sfa sna" style="font-size: 16px; padding: 3px;">
								<option value="TRY" <?php if($kpb=="TRY"){echo "selected";}?>>&#xf195;</option>
								<option value="EUR" <?php if($kpb=="EUR"){echo "selected";}?>>&#xf153;</option>
								<option value="USD" <?php if($kpb=="USD"){echo "selected";}?>>&#xf155;</option>
								<option value="GBP" <?php if($kpb=="GBP"){echo "selected";}?>>&#xf154;</option>
							  </select>
							</span>
							<input type="text" name="price" class="form-control repdot" style="border: 1px solid #ccc !important; text-align:right;" value="0.00" onfocus="if(this.value == '0.00 <?php echo $kpb?>') { this.value = ''} " onblur="if(this.value == '') { this.value='0.00'; }" id="aprice"  aria-describedby="basic-addon1">
						  </div>
						</td>
						<td class="w10 mw10">
						  <input type="text" name="y6" id="atotal" class="form-control" style="border:0px; text-align:right;" value="0.00">
						</td>
                          <td>
                            <button class="button with-tip" style="cursor:pointer;" type="button" onclick="AjaxPResult('modules/ecommerce/ajax.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&Sepet=ekle','#Sform','#err')"><i class="fa fa-plus" aria-hidden="true"></i></button>
                          </td>
                        </tr>
                      </form>
					<script type='text/javascript'>
					  jQuery(function() {
						jQuery("#at1").keyup(delay(function(e){
						  op();
						}, 100));
						jQuery("#at1").change(delay(function(e){
							op();
						}, 100));
						function op(){
						  var val = jQuery('#at1').val();
						  jQuery('#Pt4').load('modules/public/datalist.php?ne=kayit&val=t5&q='+val+'');
						  var price = jQuery('#Pt4 option').filter(function() { return this.value == val; }).data('price');
						  var pb = jQuery('#Pt4 option').filter(function() { return this.value == val; }).data('pb');
						  var unit = jQuery('#Pt4 option').filter(function() { return this.value == val; }).data('unit');
						  var lprice = jQuery('#Pt4 option').filter(function() { return this.value == val; }).data('lprice');
						  var mprice = jQuery('#Pt4 option').filter(function() { return this.value == val; }).data('mprice');
						  var tax = jQuery('#Pt4 option').filter(function() { return this.value == val; }).data('tax');
						  var id = jQuery('#Pt4 option').filter(function() { return this.value == val; }).data('id');
						  var attrvar = jQuery('#Pt4 option').filter(function() { return this.value == val; }).data('var');
						  var title = jQuery('#Pt4 option').filter(function() { return this.value == val; }).data('title');
						  var desc = jQuery('#Pt4 option').filter(function() { return this.value == val; }).data('desc');
						  if(attrvar=="1"){
							show('var_select');
							jQuery('#var_select').load('modules/public/products_var.php?id=' + id);
						  };
						  if(price !== undefined){
							jQuery('#at1_name').show(); jQuery('#at1_name').html(title);
							jQuery('#xaddtd').load('modules/services/attr.php?uid=' + id);
							jQuery( "#as5" ).prop( "disabled", false ); jQuery("#as5").val('1');
							jQuery( "#as4" ).prop( "disabled", false ); jQuery("#as4").val(tax);
							jQuery( "#aprice" ).prop( "disabled", false ); jQuery("#aprice").val(price);
							jQuery( "#alprice" ).prop( "disabled", false ); jQuery("#alprice").val(lprice);
							if(mprice !== undefined){
							  jQuery( "#amaliyet" ).prop( "disabled", false ); jQuery("#amaliyet").val(mprice);
							}else{
							  jQuery( "#amaliyet" ).prop( "disabled", false ); jQuery("#amaliyet").val(price);
							}
							jQuery('#atotal').prop('disabled', false); jQuery('#atotal').val(price);
							jQuery('#at6').prop('disabled', false); jQuery("#at6").val(pb);
							jQuery('#at10').prop('disabled', false); jQuery("#at10").val(unit);
							jQuery('#an2').val(desc);
						  }else{
							jQuery( "#as5" ).prop( "disabled", false ); jQuery("#as5").val('1');
							jQuery( "#as4" ).prop( "disabled", false ); jQuery("#as4").val('<?php echo $module["s12"]?>');
							jQuery( "#aprice" ).prop( "disabled", false ); jQuery("#aprice").val('0');
							jQuery( "#atotal" ).prop( "disabled", false ); jQuery("#atotal").val('0');
							jQuery("#an2").val(desc);
						  }
						}
						jQuery("#as5, #aprice").keyup(function(){
						  var s5 = jQuery('#as5').val();
						  var price = jQuery('#aprice').val();
						  jQuery("#atotal").val(price.replace(',','')*s5);
						});
						jQuery("#maliyet").keyup(function(){
						  var price = jQuery('#maliyet').val();
						  jQuery("#aprice").val(price.replace(',',''));
						});
						jQuery("#var_select").change(function(){
						  var price = jQuery('option:selected', this).data('price');
						  var id = jQuery('option:selected', this).data('id');
						  jQuery( "#as5" ).prop( "disabled", false ); jQuery("#as5").val('1');
						  jQuery( "#aprice" ).prop( "disabled", false ); jQuery("#aprice").val(price);
						  jQuery( "#atotal" ).prop( "disabled", false ); jQuery("#atotal").val(price);
						  jQuery("#an2").val(desc);
						});
						jQuery("#addtr").click(function(){
						  vtr('xaddtr');
						});
					  });
					</script>
                      <?php
                      $sqls = mysqli_query($conn, "select * from eticaret where ne='sepet' and t5='sepet' and t4='".$_SESSION["Order_Crm_No"]."' order by id desc");
                      //if(mysqli_num_rows($sqls)==0){echo $sdil[145];}
                      while($rsepet=mysqli_fetch_assoc($sqls)){
                        $ufiyat=$rsepet["pb1"];
                        $sqlu = mysqli_query($conn, "select * from ".$_SESSION['lang']." where id=".$rsepet["s3"].""); $rsu=mysqli_fetch_assoc($sqlu);
                        ?>
                        <form id="Sf<?php echo $rsepet["id"]?>" action="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&Sepet=guncelle" method="post" class="v3-col-md-12" style="padding:0px; margin:0px;">
                          <input type="hidden" name="id" value="<?php echo $rsepet["id"]?>" />
                          <input type="hidden" name="s2" value="<?php echo $rsepet["s2"]?>" />
                          <input type="hidden" name="s3" value="<?php echo $rsepet["s3"]?>" />
                          <input type="hidden" name="s5" value="<?php echo $rsepet["s5"]?>" />
                          <tr>
                            <td><input type="text" name="t1" class="form-control" placeholder="Adı" value="<?php echo $rsu["t1"]?>"></td>
                            <td>
								<input type="number" class="form-control w45 mw50 fl tar mtal" style="border:0px;" value="<?php echo $rsepet["s2"]?>" onfocus="if(this.value == '1') { this.value = ''} " onblur="if(this.value == '') { this.value='1'; }" name="adet">
								<select size=1 name="t10" id="at10" class="sna form-control w45 mw25 fr">
								  <?php if(!empty($t28)){$sbirim = explode(',',$t28); foreach($sbirim as $sbrm) {$s++; if($s > 20) {$s = 1;}?>
								  <option value="<?php echo $sbrm;?>"><?php echo $sbrm;?></option>
								<?php }}?>
							  </select>
							</td>
                            <td><input type="text" name="s4" id="" class="form-control" placeholder="Kdv" value="<?php echo $rsepet["s4"]?>" style="text-align: right;"></td>
                            <td class="p0 mp0 w10 mw10">
								<div class="input-group">
								<span class="input-group-addon" id="basic-addon1" style="padding: 5px;">
								  <select class="sfa sna" name="t6" id="at6" style="font-size: 16px; padding: 3px;">
								  <option value="TRY" <?php if($rsfu["t6"]=="TRY"){echo "selected";}?>>&#xf195;</option>
								  <option value="EUR" <?php if($rsfu["t6"]=="EUR"){echo "selected";}?>>&#xf153;</option>
								  <option value="USD" <?php if($rsfu["t6"]=="USD"){echo "selected";}?>>&#xf155;</option>
								  <option value="GBP" <?php if($rsfu["t6"]=="GBP"){echo "selected";}?>>&#xf154;</option>
								</select>
								</span>
								<input type="text" name="pb1" class="form-control repdot notranslate" style="border: 1px solid #ccc !important; text-align:right;" value="<?php echo wprice($rsepet["pb1"]);?>" onfocus="if(this.value == '0.00') { this.value = ''} " onblur="if(this.value == '') { this.value='0.00'; }">
							  </div>
							</td>
                            <td><input type="text" name="tfiyat" id="" class="form-control" placeholder="Tutar" value="<?php echo wprice($rsepet["pb1"]*$rsepet["s2"]);?>" style="text-align: right;"></td>
                            <td>
                              <button class="button with-tip" style="cursor:pointer;" type="button" onclick="AjaxPResult('modules/ecommerce/ajax.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&Sepet=guncelle','#Sf<?php echo $rsepet["id"]?>','#err')" title="<?php echo $sdil[203]; //Düzenle?>"><i class="fa fa-refresh" aria-hidden="true"></i></button>
                              <a style="padding:2px 5px 4px 5px; margin-left:2px;cursor:pointer;" title="<?php echo $sdil[204]; //Kaldir?>" class="button with-tip" onclick="AjaxGResult('modules/ecommerce/ajax.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&Sepet=cikar&id=<?php echo $rsepet["id"]?>','','')"><i class="fa fa-times" aria-hidden="true"></i></a>
                            </td>
                          </tr>
                        </form>
                        <?php
                        $skdv=$skdv+($rsepet["pb3"]*$rsepet["s2"]);
                        $sdesi=$sdesi+($rsepet["s6"]*$rsepet["s2"]);
                        $toplam2=$toplam2+($rsepet["pb4"]*$rsepet["s2"]);
                        $toplam1=$toplam1+($rsepet["pb2"]*$rsepet["s2"]);
                        if($_SESSION["UyeID"]<>""){
                          $rsepet = mysqli_query($conn, "update eticaret set s1='".$_SESSION["UyeID"]."' where id=".$rsepet["id"]."");
                        }
                      }
                      ?>
                      <tr class="mdfx">
                        <td colspan="3"></td>
                        <td class="tar mw50 mfl"><?php echo $adil[86]; //?></td>
                        <td class="tar mw50 mfr"><input style="text-align: right;" type="text" name="atoplam" class="form-control" placeholder="<?php echo $adil[86]; //?>" value="<?php echo wprice($toplam1-$skdv);?>"></td>
                        <td></td>
                      </tr>
                      <tr class="mdfx">
                        <td colspan="3"></td>
                        <td class="tar mw50 mfl"><?php echo $adil[87]; //?></td>
                        <td class="tar mw50 mfr"><input style="text-align: right;" type="text" name="ktoplam" class="form-control" placeholder="<?php echo $adil[86]; //?>" value="<?php echo wprice($skdv);?>"></td>
                        <td></td>
                      </tr>
                      <?php if($module["hizmet_ucreti"]<>""){?>
                        <tr class="mdfx">
                          <td colspan="3"></td>
                          <td class="tar mw50 mfl"><?php echo translate("Sevkiyat Ücreti");?></td>
                          <?php
                          if($module["hizmet_limit"]-$toplam1>0){
                            $toplam1=$module["hizmet_ucreti"]+$toplam1;
                            ?>
                            <td class="tar mw50 mfr"><input style="text-align: right;" type="text" name="" class="form-control" placeholder="" value="<?php echo wprice($module["hizmet_ucreti"]);?>"></td>
                          <?php }else{?>
                            <td class="tar mw50 mfr"><input style="text-align: right;" type="text" name="" class="form-control" placeholder="" value="<?php echo translate("+#Ücretsiz Servis")?>"></td>
                          <?php }?>
                          <td></td>
                        </tr>
                      <?php }?>
                      <tr class="mdfx">
                        <td colspan="3"></td>
                        <td class="tar mw50 mfl"><?php echo $adil[113]; //?></td>
                        <td class="tar mw50 mfr"><input style="text-align: right;" type="text" name="gtoplam" class="form-control" placeholder="<?php echo $adil[86]; //?>" value="<?php echo wprice($toplam1);?>"></td>
                        <td></td>
                      </tr>
                      <tr>
                        <td colspan="5" style="text-align: right;">
                          <a title="Kasaya Git" href="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&step=2" class="v3-btn v3-btn-sm v3-btn-success"><?php echo $adil[89]; //?> <i class="fa fa-chevron-right" aria-hidden="true"></i></a>
                        </td>
                        <td></td>
                      </tr>
                    </tbody>
                  </table>
                </fieldset>
                <script type='text/javascript'>
                  jQuery(function() {
                    jQuery("#at1").change(function(){
                      var val = jQuery('#at1').val();
                      var price = jQuery('#Pt4 option').filter(function() { return this.value == val; }).data('price');
                      var total = jQuery('#Pt4 option').filter(function() { return this.value == val; }).data('total');
                      var tax = jQuery('#Pt4 option').filter(function() { return this.value == val; }).data('tax');
                      var id = jQuery('#Pt4 option').filter(function() { return this.value == val; }).data('id');
                      jQuery( "#as5" ).prop( "disabled", false);
                      jQuery("#as5").val('1');
                      jQuery( "#as4" ).prop( "disabled", false);
                      jQuery("#as4").val(tax);
                      jQuery( "#aprice" ).prop( "disabled", false);
                      jQuery("#aprice").val(price);
                      jQuery( "#atotal" ).prop( "disabled", false);
                      jQuery("#atotal").val(total);
                      jQuery("#UrunID").val(id);
                      
                    });
                    jQuery("#as5").keyup(function(){
                      var s5 = jQuery('#as5').val();
                      var price = jQuery('#aprice').val();    
                      jQuery("#atotal").val(price*s5);
                    });
                  });
                </script>
              <?php }elseif($_GET["step"]=="2"){?>
                <form id="Oform" action="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&Siparis=odeme&step=2" method="post">
                  <table class="table " cellspacing="0" width="100%">
                    <thead>
                      <tr>
                        <th width=""><?php echo $t46;?></th>
                        <th width="15%"><?php echo $sdil[88]; //Birim?></th>
                        <th width="15%" class="tar"><?php echo $sdil[85]; //Fiyat?></th>
                        <th width="20%" style="text-align:right;"><?php echo $sdil[144]; //Tutar?></th>
                      </tr>
                    </thead>
                    <tbody>
                      <?php
                      $sqls = mysqli_query($conn, "select * from eticaret where ne='sepet' and t5='sepet' and t4='".$_SESSION["Order_Crm_No"]."' order by id desc");
                      if(mysqli_num_rows($sqls)==0){echo $sdil[145];}
                      while($rsepet=mysqli_fetch_assoc($sqls)){
                        $ufiyat=$rsepet["pb1"];
                        $sqlu = mysqli_query($conn, "select * from ".$_SESSION['lang']." where id=".$rsepet["s3"].""); $rsu=mysqli_fetch_assoc($sqlu);
                        ?>
                        <tr>
                          <td><?php echo $rsu["t1"]?></td>
                          <td><?php echo $rsepet["s2"]?></td>
                          <td class="tar"><?php echo number_format($ufiyat,2);?></td>
                          <td style="text-align:right;"><?php echo number_format(($ufiyat*$rsepet["s2"]),2);?></td>
                        </tr>
                        <?php 
                        $skdv=$skdv+($rsepet["pb3"]*$rsepet["s2"]);
                        $sdesi=$sdesi+($rsepet["s6"]*$rsepet["s2"]);
                        $toplam2=$toplam2+($rsepet["pb4"]*$rsepet["s2"]);
                        $toplam1=$toplam1+($rsepet["pb2"]*$rsepet["s2"]);
                      }
                      ?>
                      <tr>
                        <td colspan="2"></td>
                        <td style="text-align: right;"><?php echo $adil[86]; //?></td>
                        <td style="text-align: right;"><input type="text" name="atoplam" class="form-control" placeholder="<?php echo $adil[86]; //?>" value="<?php echo number_format(($toplam1-$skdv),2);?>" style="text-align:right;"></td>
                      </tr>
<!--
                      <tr>
                        <td colspan="2"></td>
                        <td style="text-align: right;"><?php echo $sdil[102]; //Sale?>
                        <select name="t5">
                          <option value="<?php echo $kpb?>" <?php if($rsf["t5"]==$kpb){echo "selected";}?>><?php echo $kpb?></option>
                          <option value="%" <?php if($rsf["t5"]=="%"){echo "selected";}?>>%</option>
                        </select>
                        </td>
                        <td style="text-align: right;"><input type="text" name="indirim" id="sale" class="form-control" placeholder="<?php echo $sdil[102]; //Sale?> " value="0" style="text-align:right;" total="<?php echo number_format(($toplam1-$skdv),2);?>"></td>
                      </tr>
                      <tr>
                        <td colspan="2"></td>
                        <td style="text-align: right;"><?php echo $sdil[159]; //Balance?> (<?php echo $kpb?>)</td>
                        <td style="text-align: right;"><input type="text" name="ntoplam" class="form-control" placeholder="<?php echo $sdil[159]; //Balance?>" value="<?php echo number_format(($toplam1-$skdv),2);?>" style="text-align:right;"></td>
                      </tr>
                    -->
                    <tr style="">
                      <td colspan="2"></td>
                      <td style="text-align: right;"><?php echo $adil[87]; //?></td>
                      <td style="text-align: right;"><input type="text" name="ktoplam" class="form-control" placeholder="<?php echo $adil[86]; //?>" value="<?php echo number_format(($skdv),2);?>" style="text-align:right;"></td>
                    </tr>
                    <?php if($module["hizmet_ucreti"]<>""){?>
                      <tr>
                        <td colspan="2"></td>
                        <td style="text-align: right;"><?php echo translate("Sevkiyat Ücreti");?></td>
                        <?php
                        if($module["hizmet_limit"]-$toplam1>0){
                          $toplam1=$toplam1+$module["hizmet_ucreti"];
                          $toplam2=$toplam1-$module["hizmet_ucreti"];
                          $kargof=$module["hizmet_ucreti"];
                          if($module["hizmet_oran"]<>100 and $module["hizmet_oran"]<>""){
                            $hizmet_komisyon=$module["hizmet_ucreti"] - ($module["hizmet_ucreti"] * ((100 - $module["hizmet_oran"]) / 100));
                          }else{
                            $hizmet_komisyon=0;
                          }
                          if($_SESSION["s19Komisyon"]<>"" or $hizmet_komisyon<>0){
                            $komisyon = $toplam2 - ($toplam2 * ((100 - $_SESSION["s19Komisyon"]) / 100)) + $hizmet_komisyon;
                          }else{
                            $komisyon = 0;
                          }
                          ?>
                          <td ><input style="text-align: right;" type="text" name="" class="form-control" placeholder="" value="<?php echo number_format(($module["hizmet_ucreti"]),2);?>"></td>
                        <?php }else{
                          $kargof=0;
                          ?>
                          <td ><input style="text-align: right;" type="text" name="" class="form-control" placeholder="" value="<?php echo translate("+#Ücretsiz Servis")?>"></td>
                        <?php }?>
                      </tr>
                    <?php }?>
                    <tr>
                      <td colspan="2"></td>
                      <td style="text-align: right;"><?php echo $adil[113]; //?></td>
                      <td style="text-align: right;"><input type="text" name="gtoplam" total="<?php echo number_format(($toplam1),2)?>" id="total" class="form-control" placeholder="<?php echo $adil[86]; //?>" value="<?php echo number_format(($toplam1),2);?>" style="text-align:right;"></td>
                    </tr>
                    <tr style="<?php if($komisyon==0){echo "display:none;";}?>">
                      <td colspan="2"></td>
                      <td style="text-align: right;"><?php echo translate("Komisyon"); //?></td>
                      <td style="text-align: right;"><input type="text" name="okomisyon" class="form-control" placeholder="<?php echo $adil[86]; //?>" value="<?php echo number_format(($komisyon),2);?>" style="text-align:right;"></td>
                    </tr>
                  </tbody>
                </table>
                <?php $i=0;$sqli=mysqli_query($conn, "select * from genel where ne='inputs' and (t2='".$_SESSION["lang"]."' or t2='All') and n3='siparis' and n7<>'0' and s1=0 order by s10 asc");?>
                <?php if(mysqli_num_rows($sqli)>0){?>
                  <div class="v3-row" style="<?php if($mobile<>""){?>margin-top:10px;<?php }else{?>margin-top:15px; padding-bottom: 0px;<?php }?>clear:both;">
                    <?php while($rsi=mysqli_fetch_assoc($sqli)){$i++;?>
                      <div class="v3-col-md-3" style="">
                        <label><?php echo $rsi["n1"];?> <span style="font-size:8px; color:#ccc;"> (i<?php echo $i;?>)</span></label>
                        <?php if($rsi["n4"]=="input"){?>
                          <input style="" class="v3-form-control i<?php echo $i;?>" type="<?php echo $rsi["n5"]?>" id="i<?php echo $i;?>" name="i<?php echo $i;?>" value="<?php echo $rs["i".$i.""];?>" style="" <?php echo $rsi["n8"]?> <?php echo $rsi["n6"]?>>
                        <?php }elseif($rsi["n4"]=="textarea"){?>
                          <textarea style="" class="v3-form-controli <?php echo $i;?>" id="i<?php echo $i;?>" name="i<?php echo $i;?>" <?php echo $rsi["n8"]?> <?php echo $rsi["n6"]?>><?php echo $rs["i".$i.""];?></textarea>
                        <?php }elseif($rsi["n4"]=="select"){?>
                          <select style="" class="v3-form-control i<?php echo $i;?>" id="i<?php echo $i;?>" name="i<?php echo $i;?>[]" <?php echo $rsi["n8"]?> <?php echo $rsi["n6"]?>>
                            <option value=""><?php echo $sdil[221]; //Lütfen Seçiniz?></option>
                            <?php $o=0;$sqlo=mysqli_query($conn, "select * from genel where ne='inputs' and s1=".$rsi["id"]." order by s10 asc"); while($rso=mysqli_fetch_assoc($sqlo)){$o++;?>
                              <option value="<?php echo $rso["n2"]?>" <?php if($rso["n2"]==$sayfa2 or $rso["n3"]==1){echo "selected";}?>><?php echo $rso["n1"]?></option>
                            <?php }?>
                          </select>
                        <?php }elseif($rsi["n4"]=="radio"){?>
                          <?php $o=0;$sqlo=mysqli_query($conn, "select * from genel where ne='inputs' and s1=".$rsi["id"]." order by s10 asc"); while($rso=mysqli_fetch_assoc($sqlo)){$o++;?>
                            <div style="float:left; margin-right: 5px;">
                              <label style="float:left; margin-right:5px;"><?php echo $rso["n1"];?>
                              <input type="radio" class="i<?php echo $i;?>" name="i<?php echo $i;?>" value="<?php echo $rso["n2"];?>" <?php echo $rsi["n8"]?> <?php if($rs["i".$i.""]==$rso["n2"] or $rso["n3"]==1){echo "checked";}?>>
                            </label>
                          </div>
                        <?php }?>
                      <?php }elseif($rsi["n4"]=="checkbox"){?>
                        <?php $o=0;$sqlo=mysqli_query($conn, "select * from genel where ne='inputs' and s1=".$rsi["id"]." order by s10 asc"); while($rso=mysqli_fetch_assoc($sqlo)){$o++;?>
                          <div style="float:left; margin-right: 5px;">
                            <label style="float:left; margin-right:5px;"><?php echo $rso["n1"];?>
                            <input type="checkbox" class="i<?php echo $i;?>" name="i<?php echo $i;?>[]" value="<?php echo $rso["n2"];?>" <?php echo $rsi["n8"]?> <?php foreach($jsi["i".$i.""] as $q){if($q==$rso["n2"] or $rso["n3"]==1){echo "checked";}}?>>
                          </label>
                        </div>
                      <?php }?>
                    <?php }?>
                    <p style="font-size:10px;"><?php echo $rsi["n9"];?></p>
                  </div>
                <?php }?>
              </div>
            <?php }?>
            <div class="v3-row">
              <div class="v3-panel v3-panel-default">
                <div class="v3-panel-body" style="padding:0px">
                  <?php $sql_dadress=mysqli_query($conn, "select * from t1 where ne='adress' and t1='uye' and s1=".$_SESSION["UyeID"]." order by s10 desc"); ?>
                  <div class="v3-col-md-6" style="height: 155px; overflow: auto;">
                    <?php if(mysqli_num_rows($sql_dadress)==0){?>
                      <center>
                        <a data-url="<?php echo $cpath?>account/account_adress_pop.php?ne=pay&islem=yeni" data-title="<?php echo translate("Adres(ler)")?>" data-ref="?eticaret/odeme/adres" style="clear:both; cursor:pointer; margin-bottom:30px;" class="mfrm v3-btn v3-btn-warning mbtn"><i class="fa fa-plus"></i> <?php echo $cdil[200].$cdil["103"].$cdil[201]; //ekle?></a>
                      </center>
                    <?php }?>
                    <div class="v3-row">
                      <div class="v3-panel-heading v3-bg-warning"><?php echo translate("Teslimat adresi")?> <a class="mfrm fa fa-pencil-square-o" data-toggle="modal" data-width="50%" data-target="#myModal" data-ref="<?php echo $weburl?>/<?php echo $crmpath?>/?ne=eticaret&islem=satis&step=2" data-url="../account/account_adress_pop.php?uid=<?php echo $_SESSION["UyeID"]?>" data-title="<?php echo translate("Adresler")?>" style="font-size: 20px; cursor:pointer;float:right;"></a></div>
                      <!--<label style="width:100%;" id=""><?php echo $sdil[32];?></label>-->
                      <div class="">
                        <?php
                        $a=0; while($nx=mysqli_fetch_assoc($sql_dadress)){$a++; $jsi = json_decode($nx["n16"],true);
                        if($nx["n16"]==""){
                          $n1=$nx["n1"]; $n6=$nx["n6"];
                        }else{
                          $n1=$jsi["n1"]; $n6=$jsi["n6"];
                        }
                        ?>
                        <div class="" style="padding:5px;">
                          <label for="dc<?php echo $nx["id"]?>" style="width:100%; border:1px solid #ccc; padding:10px; border-radius:10px; font-weight:100; cursor:pointer;">
                            <input type="radio" id="dc<?php echo $nx["id"]?>" name="Delivery_AdressID" value="<?php echo $nx["id"]?>" style="float: left; margin-right: 5px;" <?php if($a==1){echo "checked";}?>>
                            <?php echo translate("Teslimat adresi")?> > <b><?php echo $n1;?></b><br><?php echo $n6;?>
                          </label>
                        </div>
                      <?php }?>
                    </div>
                  </div>
                </div>
                <div class="v3-col-md-6" style="height: 155px; overflow: auto;">
                  <div class="v3-row">
                    <div class="v3-panel-heading v3-bg-warning"><?php echo translate("Fatura adresi")?> <a class="mfrm fa fa-pencil-square-o" data-toggle="modal" data-width="50%" data-target="#myModal" data-ref="<?php echo $weburl?>/<?php echo $crmpath?>/?ne=eticaret&islem=satis&step=2" data-url="../account/account_adress_pop.php?uid=<?php echo $_SESSION["UyeID"]?>" data-title="<?php echo translate("Adresler")?>" style="font-size: 20px; cursor:pointer;float:right;"></a></div>
                    <!--<label style="width:100%;"><?php echo translate("Fatura Adresi");?></label>-->
                    <div class="">
                      <?php $a=0; $sql_dadress=mysqli_query($conn, "select * from t1 where ne='adress' and t1='uye' and s1=".$_SESSION["UyeID"]." order by s10 desc"); ?>
                      <?php
                      $a=0; while($nx=mysqli_fetch_assoc($sql_dadress)){$a++; $jsi = json_decode($nx["n16"],true);
                      if($nx["n16"]==""){
                        $n1=$nx["n1"]; $n6=$nx["n6"];
                      }else{
                        $n1=$jsi["n1"]; $n6=$jsi["n6"];
                      }
                      ?>
                      <div class="" style="padding:5px;">
                        <label for="ic<?php echo $nx["id"]?>" style="width:100%; border:1px solid #ccc; padding:10px; border-radius:10px; font-weight:100; cursor:pointer;">
                          <input type="radio" id="ic<?php echo $nx["id"]?>" name="Invoice_AdressID" value="<?php echo $nx["id"]?>" style="float: left; margin-right: 5px;" <?php if($a==1){echo "checked";}?>>
                          <?php echo translate("Fatura adresi")?> > <b><?php echo $n1;?></b><br><?php echo $n6;?>
                        </label>
                      </div>
                    <?php }?>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="v3-col-md-3" style="">
            <fieldset style="height: 100px;">
              <legend><?php echo translate("Sevkiyat Ücreti");?></legend>
              <select name="sevkiyat" class="form-control" id="sevkiyat">
                <?php if($kargof==0){?>
                  <option value=""><?php echo $sdil[221];?></option>
                <?php }else{?>
                  <option value="0+<?php echo $kargof;?>+<?php echo translate("Sevkiyat Ücreti");?>"><?php echo translate("Sevkiyat Ücreti");?> {<?php echo $module["hizmet_ucreti"]?> <?php echo $kpb?>}</option>
                  <option value="0+0+<?php echo translate("Ücretsiz Servis")?>"><?php echo translate("Ücretsiz Servis")?></option>
                <?php }?>
                <?php
                $sqlk = mysqli_query($conn, "select * from genel where ne='kargo' order by s10 asc"); while($rsk = mysqli_fetch_assoc($sqlk)){$n++;
                  $sqld = mysqli_query($conn, "select * from genel where ne='desi' and s1=".$rsk["id"]." and s2 <= intval(".$sdesi.") and s3 >= intval(".$sdesi.") order by s10 asc"); $rsd = mysqli_fetch_assoc($sqld);
                  if(mysqli_num_rows($sqld)>0){ $kargof=$rsd["pb1"]; }else{ $kargof="0"; } $kargo=$rsk["t1"];
                  ?>
                  <option value="<?php echo $rsk["id"];?>+<?php echo $kargof;?>+<?php echo $kargo;?>"><?php echo $rsk["t1"];?> [<?php if($kargof==0){?> <?php echo $adil[41];?> <?php }else{?> <?php echo $kargof;?> <?php }?>]</option>
                <?php }?>
              </select>
            </fieldset>
          </div>
          
          <div class="v3-col-md-3" style="">
            <fieldset style="height: 100px;">
              <legend><?php echo translate("Ödeme Tipi")?></legend>
              <select name="odeme" class="form-control" onchange="diger(this);" id="odeme">
                <option value="" selected><?php echo $sdil[221];?></option>
                <option value="nakit+0+Nakit"><?php echo translate("Nakit")?></option>
                <?php $sql = mysqli_query($conn, "select * from genel where ne='banka' and s2=0 order by s10 asc"); if(mysqli_num_rows($sql)>0){ ?>
                  <optgroup label="<?php echo translate("Havale")?>">
                    <?php while($rs = mysqli_fetch_assoc($sql)){?>
                      <option value="havale+<?php echo $rs["s1"];?>+<?php echo $rs["t1"];?>"><?php echo $rs["t1"];?></option>
                    <?php }?>
                  </optgroup>
                <?php }?>
                <option value="pos+0+Pos"><?php echo translate("Pos")?></option>
                <option value="cari+0+Cari"><?php echo translate("Cari")?></option>
                <option value="diger+0+Diger"><?php echo translate("Diğer")?></option>
              </select>
            </fieldset>
          </div>
          <div class="v3-col-md-3" style="">
            <fieldset style="height: 100px;">
              <legend><?php echo translate("Fatura Adresi")?></legend>
              <input type="text" name="fno" value="" class="form-control" placeholder="<?php echo translate("Fatura No")?>" style="position: absolute; text-align: right; right: 15px; top: -3px; background: white !important; width: 60%; border: 1px solid grey !important; height: 25px;">
              <textarea name="n2" rows="3" class="form-control"></textarea>
            </fieldset>
          </div>
          <?php if($f3==1){?>
            <div class="v3-col-md-3" style="">
              <fieldset style="height: 100px;">
                <legend><?php echo translate("Teslimat Adresi")?></legend>
                <textarea name="n3" rows="3" class="form-control"></textarea>
              </fieldset>
            </div>
          <?php }?>
          <div class="v3-col-md-12" style="">
            <fieldset style="height: 150px;">
              <legend><?php echo translate("Not")?></legend>
              <textarea name="n10" rows="3" style="height:100%;" class="form-control"></textarea>
            </fieldset>
          </div>
          <div class="v3-col-md-12" style="text-align: right;">
            <button id="kasabtn" title="Kasaya Git" type="button" onclick="AjaxPResult('modules/ecommerce/ajax.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&Siparis=odeme&step=2','#Oform','#err')" class="v3-btn v3-btn-sm v3-btn-success" style="margin-top: 35px;"><?php echo $adil[89]; //?> <i class="fa fa-chevron-right" aria-hidden="true"></i></button>
          </div>
        </div>
        <input type="hidden" name="okdv" value="<?php echo $skdv?>">
        <input type="hidden" name="odesi" value="<?php echo $sdesi?>">
        <input type="hidden" name="otoplam" value="<?php echo $toplam1?>">
      </form>
      <script type='text/javascript'>
        jQuery(document).ready(function(){
          if( !jQuery('#odeme,#sevkiyat').val() ) {
            jQuery('#kasabtn').prop('disabled', true);
          }
        });
        jQuery('#odeme,#sevkiyat').change(function() {
          if( !jQuery('#odeme,#sevkiyat').val() ) {
            jQuery('#kasabtn').prop('disabled', true);
          }else{
            jQuery('#kasabtn').prop('disabled', false);
          }
        });
        jQuery(function() {
          jQuery("#total").keyup(function(){
            var old_total = $(this).attr("total");
            var new_total = $(this).val();
            var number0 = Number(old_total.replace(/[^0-9.-]+/g,""));
            var number1 = Number(new_total.replace(/[^0-9.-]+/g,""));
            var stotal = number0-number1;
            var gtotal = stotal/<?php echo ($s12+100)/100?>;  
            $("#sale").val(gtotal.toFixed(2));
          });
          jQuery("#sale").keyup(function(){
            var old_total = $(this).attr("total");
            var sale = $(this).val();
            var number0 = Number(old_total.replace(/[^0-9.-]+/g,""));
            var number1 = Number(sale.replace(/[^0-9.-]+/g,""));
            var stotal = number0-number1;
            var gtotal = stotal*<?php echo ($s12+100)/100?>;
            $("#total").val(gtotal.toFixed(2));
          });
        });
      </script>
      <?php
    }elseif($_GET["step"]=="3"){
      echo location("?ne=eticaret&islem=siparisler",self,500,1);
      ?>
      <div style="width:50%; margin-left: auto; margin-right: auto; padding: 50px; text-align: center; font-size: 40px;">
        <img src="../deppo/tools/img/saved.gif" style="background: transparent; box-shadow: none; margin-top:30px;"><br><br><br> <?php echo translate("Sipariş oluşturuldu")?>
      </div>
    <?php }?>
    <div class="alert alert-info v3-row" style=" font-size:9px;"></div>
  </div>
</div>
</div>
</div>
</div>
</div>
<!--</form>-->
</section>
</div>
</div>
</section>
<script>
  function diger(that) {
    if (that.value == "diger+0+Diger") {
      //document.getElementById("diger").style.display = "block";
    } else {
      //document.getElementById("diger").style.display = "none";
    }
  }
</script>
<aside id="sidebar-right" class="sidebar-right">
  <div class="nano">
    <div class="nano-content">
      <a href="#" class="mobile-close d-md-none">
        Collapse <i class="fa fa-chevron-right"></i>
      </a>
      <div class="sidebar-right-wrapper">
        ...
      </div>
    </div>
  </div>
</aside>
</div>
</section>