<?php
header('Content-Type: text/html; charset=utf-8');
error_reporting(0);
$path="../../";
include("../../map.php");
include("../../scripts.php");
include("../../secure.php");
$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);
$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=".$_GET["id"]."");
$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);
$dpath="../../"; include("ecommerce_order_calc.php");
if($siparis["t5"]=="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 ($jso["Order_Bank_Id"]==12){
        $aurl="denizbank";
    }elseif ($jso["Order_Bank_Id"]==14){
        $aurl="finansbank";
    }elseif ($jso["Order_Bank_Id"]==16){
        $aurl="garanti";
    }elseif ($jso["Order_Bank_Id"]==20){
        $aurl="kuveytturk";
    }elseif ($jso["Order_Bank_Id"]==38){
        $aurl="vakifbank";
    }elseif ($jso["Order_Bank_Id"]==39){
        $aurl="yapikredi";
    }else{
        $aurl="est";
    }
}else{
    $aurl="fintech/".$siparis["t5"]."";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo ctranslate("Siparişler")?></title>
</head>
<body>
    <div class="qmodal">
        <div class="qmodal-content">
            <!-- Header with Action Buttons -->
            <div class="qmodal-header">
                <div class="header-title">
                    <nav aria-label="breadcrumb">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item"><a href="<?php echo $weburl?>" target="_blank"><i class="fa fa-home"></i></a></li>
                            <li class="breadcrumb-item"><a href="#"><?php echo ctranslate("Siparişler")?></a></li>
                            <li class="breadcrumb-item active" aria-current="page"><?php echo $siparis["t4"];?></li>
                        </ol>
                    </nav>
                </div>
                <button type="button" class="btn btn-warning" onclick="AjaxKaydet('','');"><i class="fas fa-save"></i><span class="mdn"> Kaydet</span></button>
                <button type="button" class="btn btn-danger" title="İptal notu Ekle" onclick="show('note')"><i class="far fa-sticky-note"></i></button>
                <button type="button" class="btn btn-warning mfrm" data-toggle="modal" data-target="#myModal" data-url="../print/print_order.php?mode=modal&id=<?php echo $siparis["id"];?>" data-title="Sipariş Yazdır" title="Sipariş Yazdır"><i class="fa fa-print"></i></button>
                <?php if($f3==1){?>
                    <button type="button" class="btn btn-warning mfrm" data-toggle="modal" data-target="#myModal" data-url="../print/print_ship.php?mode=modal&id=<?php echo $siparis["id"];?>"  data-title="Kargo Fişi Yazdır" title="Kargo Fişi Yazdır"><i class="fa fa-truck"></i></button>
                <?php }?>
                <?php if($module["order_invoice"]==1){?>
                    <button type="button" class="btn btn-default" onclick="window.open('../print/print_iinvoice.php?ne=<?php echo $_GET["ne"];?>&id=<?php echo $siparis["id"];?>&sip_no=<?php echo $siparis["t4"];?>')" title="Fatura Yazdır" <?php if($siparis["s4"]<>1 or $siparis["s4"]<>3){echo "disabled";}?>><i class="fa fa-print"></i></button>
                    <?php if($siparis["t1"]<>""){?>
                        <button type="button" class="btn btn-success" title="" onclick="alert('Bu İşlem Gib e Gönderilmiştir, Fatura Numarası : <?php echo $siparis["t1"]?>')">E-Fatura</button>
                    <?php }else{?>
                        <button type="button" class="btn btn-warning mfrm" data-toggle="modal" data-target="#myModal" data-title="E-Fatura {GiB}" data-url="../accounting/accounting_invoice_send.php?ne=siparis&type=efatura&id=<?php echo $siparis["id"];?>" title="">E-Fatura</button>
                    <?php }?>
                <?php }?>
                <form id="o<?php echo $siparis["id"];?>" style="float:left;" class="">
                    <div id="note" style="display:none;position: fixed; background: blanchedalmond; right: 40%; width: 20%; height: 150px; z-index: 999;">
                        <textarea name="note" class="v3-form-control" placeholder="İptal Nedeni" style="height:145px; margin-bottom:15px;"></textarea>
                        <button type="button" class="v3-btn-xs v3-btn-danger fr mfr" onclick="AjaxPResult('../ecommerce/ajax.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $siparis["id"];?>&durum=onay&s4=2&ototal=<?php echo wprice($gtoplam)?>','#o<?php echo $siparis["id"];?>','','');hide('note')"><?php echo translate("+#İptal")?></button>
                        <button type="button" class="v3-btn-xs v3-btn-warning fr mfr mr5 mmr5" onclick="hide('note')">Vazgeç</button>
                    </div>
                    <select class="form-control" id="s<?php echo $siparis["id"];?>" onchange="AjaxPResult(this.value,'#o<?php echo $siparis["id"];?>','','');" style="padding: 0px;">
                        <option data-bg="alert-warning" data-status="0" value="../ecommerce/ajax.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $siparis["id"];?>&durum=onay&s4=0&ototal=<?php echo wprice($gtoplam)?>" <?php if($siparis["s4"]==0){echo "Selected";}?>><i class="fa fa-pause" aria-hidden="true"></i> <?php echo translate("+#Beklemede")?></option>
                        <option data-bg="alert-success" data-status="1" value="../ecommerce/ajax.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $siparis["id"];?>&durum=onay&s4=1&ototal=<?php echo wprice($gtoplam)?>" <?php if($siparis["s4"]==1){echo "Selected";}?>><i class="fa fa-check" aria-hidden="true"></i> <?php echo translate("+#Onaylandı")?></option>
                        <?php if($f3>0){?>
                            <option data-bg="alert-info" data-status="3" value="../ecommerce/ajax.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $siparis["id"];?>&durum=onay&s4=3&ototal=<?php echo wprice($gtoplam)?>" <?php if($siparis["s4"]==3){echo "Selected";}?>><i class="fa fa-truck" aria-hidden="true"></i> <?php echo translate("+#Sevkiyatta")?></option>
                        <?php }?>
                        <option data-bg="alert-default" data-status="4" value="../ecommerce/ajax.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $siparis["id"];?>&durum=onay&s4=4&ototal=<?php echo wprice($gtoplam)?>" <?php if($siparis["s4"]==4){echo "Selected";}?>><i class="fa fa-check" aria-hidden="true"></i> <?php echo translate("+#Tamamlandı")?></option>
                        <option data-bg="alert-danger" data-status="2" value="../ecommerce/ajax.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $siparis["id"];?>&durum=onay&s4=2&ototal=<?php echo wprice($gtoplam)?>" <?php if($siparis["s4"]==2){echo "Selected";}?>><i class="fa fa-ban" aria-hidden="true"></i> <?php echo translate("+#İptal")?></option>
                        <?php if($module["order_return"]>0){?>
                            <option data-bg="alert-danger" data-status="5" value="../ecommerce/ajax.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $siparis["id"];?>&durum=onay&s4=5&ototal=<?php wprice($gtoplam)?>" <?php if($siparis["s4"]==5){echo "Selected";}?>><i class="fa fa-ban" aria-hidden="true"></i> <?php echo translate("+#İade")?></option>
                        <?php }?>
                        <?php if(translate("+#order_extra")<>""){?>
                            <option data-bg="alert-default" data-status="6" value="../ecommerce/ajax.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $siparis["id"];?>&durum=onay&s4=6&ototal=<?php wprice($gtoplam)?>" <?php if($siparis["s4"]==6){echo "Selected";}?>><i class="fa fa-life-ring" aria-hidden="true"></i> <?php echo translate("#order_extra")?></option>
                        <?php }?>
                    </select>
                </form>
            </div>
            <form class="form" id="asave" name="aform" method="post" action="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $_GET["id"];?>&durum=update_order">
                <!-- Left Tab Menu -->
                <div class="v8-columns">
                    <div class="v8-col200pxL-left">
                        <ul class="v8-side-tabs v8-js-tabs v8-same-height">
                            <li class="order_global"><a href="#tab-global"><i class="fa fa-file"></i><span> <?php echo $sdil[5]?></span></a></li>
                            <li class="ddn"><a href="#" onclick="show('switchs');window.scrollTo(0, 0);"><i class="fa fa-chevron-right" aria-hidden="true"></i></a></li>
                        </ul>
                        <div id="switchs">
                            <div class="v3-alert v3-alert-warning ddn">
                                <i class="fas fa-arrow-right" onclick="hide('switchs')"></i>
                            </div>
                                <!--
                                <fieldset class="grey-bg order_status">
                                    <legend><?php echo $sdil[5].$sdil[179]; //Sipariş Durumu?> <span style="font-size:8px; color:#ccc;">(s4)</span></legend>
                                    <select size="1" name="" class="form-control">
                                        <option value="0" <?php if($siparis["s4"]==0){?>Selected<?php }?>><?php echo translate("+#Beklemede")?></option>
                                        <option value="1" <?php if($siparis["s4"]==1){?>Selected<?php }?>><?php echo translate("+#Onaylandı")?></option>
                                        <option value="3" <?php if($siparis["s4"]==3){?>Selected<?php }?>><?php echo translate("+#Sevkiyatta")?></option>
                                        <option value="4" <?php if($siparis["s4"]==4){?>Selected<?php }?>><?php echo translate("+#Tamamlandı")?></option>
                                        <option value="2" <?php if($siparis["s4"]==2){?>Selected<?php }?>><?php echo translate("+#İptal")?></option>
                                        <option value="5" <?php if($siparis["s4"]==5){?>Selected<?php }?>><?php echo translate("+#İade")?></option>
                                        <option value="6" <?php if($siparis["s4"]==6){?>Selected<?php }?>><?php echo translate("+#order_extra")?></option>
                                    </select>
                                </fieldset>
                            -->
                            <fieldset class="grey-bg order_user">
                                <legend><?php echo $sdil[5]." ".ctranslate("Yetkilisi")?> <span style="font-size:8px; color:#ccc;">(s19)</span></legend>
                                <select size="1" name="s19" class="form-control populate" data-plugin-selecttwo="">
                                    <option value="0" <?php if($siparis["s19"]==0){?>Selected<?php }?>>Admin</option>
                                    <?php $sqlb = mysqli_query($conn, "select id,t1 from t5 where (s9=1 or s1=1) $luye order by t1 asc"); while($rsb=mysqli_fetch_assoc($sqlb)){?>
                                        <option value="<?php echo $rsb["id"]?>" <?php if($rsb["id"]==$siparis["s19"]){?>Selected<?php }?>><?php echo $rsb["t1"]?></option>
                                    <?php }?>
                                </select>
                            </fieldset>
                            <?php
                            if($e8<>0 or $c7==1){
                                $sqlc = mysqli_query($conn, "select * from t4 where ne='cari' and s5=".$siparis["id"].""); $cari=mysqli_fetch_assoc($sqlc);
                                ?>
                                <fieldset class="grey-bg">
                                    <legend>Ödeme Al<?php if($cari["pb3"]<>0){?>ındı<?php }?> <span style="font-size:8px; color:#ccc;"></span></legend>
                                    <select size="1" name="cari" class="form-control">
                                        <option value="0" <?php echo ($rs["pb3"] == 0) ? 'selected' : ''; ?>>...</option>
                                        <option value="1" <?php echo ($rs["pb3"] == 1) ? 'selected' : ''; ?>>Cariye İşle</option>
                                    </select>
                                    <input type="hidden" name="siptop" value="<?php echo number_format(($gtoplam),2, ',', '.')?>">
                                </span>
                            </fieldset>
                        <?php }?>
                        <fieldset class="grey-bg">
                            <legend><?php echo ctranslate("Sipariş QR")?></legend>
                            <img src="<?php echo qrCode("".$weburl."?view/order/".$siparis["t4"]."",140);?>" onclick="window.open('<?php echo "".$weburl."?view/order/".$siparis["t4"]."";?>')" style="cursor:pointer;">
                        </fieldset>
                    </div>
                </div>
                <div class="v8-col200pxL-right" ts1="<?php echo dtarih($siparis["ts1"],"gg.ka.yy time");?>" ts2="<?php echo dtarih($siparis["ts2"],"gg.ka.yy time");?>" ts3="<?php echo dtarih($siparis["ts3"],"gg.ka.yy time");?>">
                    <div id="tab-global" class="v8-tabs-content">
                        <div class="v3-row">
                            <fieldset class="v3-col-md-4" style="">
                                <i onclick="window.open('<?php echo $wlink;?>+90<?php echo telefon($rsm["t4"]);?>')" class="fab fa-whatsapp-square" style="cursor:pointer;top: 2px; position: absolute; z-index:9999; right: 10px; font-size: 36px; color: green;" title="+90<?php echo telefon($rsm["t4"]);?>"></i>
                                <i onclick="window.open('tel:+90<?php echo telefon($rsm["t4"]);?>')" class="fas fa-phone-square" style="cursor:pointer;top: 2px; position: absolute; z-index:9999; right: 47px; font-size: 36px; color: lightblue;" title="+90<?php echo telefon($rsm["t4"]);?>"></i>
                                <legend><?php echo $sdil[93]; //Adı Soyadı?> <span style="font-size:8px; color:#ccc;">(s1)</span></legend>
                                <b><a class="mfrm" data-width="90%" data-toggle="modal" data-target="#myModal" data-title="<?php echo ctranslate("Detay")?>" data-url="../clients/client.php?id=<?php echo $rsm["id"]?>"><?php echo $rsm["t1"]?></a></b> <?php if($jsmi["ifirma"]<>""){echo "<br>".$jsmi["ifirma"]."";}?>
                            </fieldset>
                            <fieldset class="v3-col-md-4" style="">
                                <legend><?php echo $sdil[115]; //Tarih?> <span style="font-size:8px; color:#ccc;">(ts1)</span></legend>
                                <input type="datetime-local" name="ts1" value="<?php echo dtarih($siparis["ts1"],"yyyy-aa-ggTtime");?>" placeholder="Sipariş Tarihi"><br>
                                <input type="datetime-local" name="ts2" value="<?php if($siparis["ts2"]<>""){echo dtarih($siparis["ts2"],"yyyy-aa-ggTtime");}else{echo date('Y-m-d H:i:s');}?>" placeholder="İşlem Tarihi">
                            </fieldset>
                            <fieldset class="v3-col-md-4" style="">
                                <legend><?php echo $sdil[143]; //Sipariş No?> <span style="font-size:8px; color:#ccc;">(t4-t1-t10)</span></legend>
                                <b><?php echo $siparis["t4"]?><br />
                                    <?php echo $siparis["t10"]?></b> {<?php echo $siparis["t5"]?>} 
                                    <?php if($siparis["t15"]<>""){?> {XXXX XXXX XXXX <?php echo substr($siparis["t15"], -4)?>}
                                    <?php if($module["delivery_datetime"]<>0){echo "<br>".$jsmi["Order_Delivery_Date"]." - ".$jsmi["Order_Delivery_Time"]."";}?>
                                <?php }?>
                            </fieldset>
                            <fieldset class="v3-col-md-4 <?php if($f3<>1){echo "dn";}?>" style="height: 180px !important;">
                                <legend><?php echo $sdil[105]; //Adres?> <span style="font-size:8px; color:#ccc;">(n5)</span></legend>
                                <div style="margin-top: -8px; height: 130px; overflow-y: auto; font-size:13px;" class="noshadow">
                                    <?php echo order_adress($siparis["id"],"delivery");?>
                                </div>
                            </fieldset>
                            
                            <fieldset class="v3-col-md-4" style="height: 180px !important;">
                                <legend><?php echo $sdil[24]; //Fatura Bilgileri?> <span class="bg-warning" style="position: absolute; right: 0px; padding: 5px; border-radius: 5px; top: 0px; background: beige;"><?php echo $siparis["t1"]?></span></legend>
                                <div style="margin-top: -8px; height: 150px; overflow-y: auto;" class="noshadow">
                                    <?php echo order_adress($siparis["id"],"invoice");?>
                                    <br><?php echo order_adress($siparis["id"],"invoice","fvdvn");?>
                                </div>
                            </fieldset>
                            <fieldset class="v3-col-md-4" style="height: 180px !important;">
                                <legend><?php echo $sdil[207]; //Açıklama?> <span style="font-size:8px; color:#ccc;">(n10)</span></legend>
                                <textarea rows="3" name="n10" class="form-control" style="height: 125px !important;"><?php echo $siparis["n10"]?></textarea>
                            </fieldset>
                            <fieldset class="v3-col-md-4 <?php if($f3<>1){echo "dn";}?>" style="">
                                <legend><?php echo $siparis["t12"]?> <?php echo translate("Sevkiyat No");?> <span style="font-size:8px; color:#ccc;">(t13)</span></legend>
                                <div class="v3-col-md-6 mp0">
                                    <select size="1" name="s9" id="s9" class="form-control <?php if($f3<>1){echo "dn";}?>">
                                        <?php $sqlc=mysqli_query($conn, "select * from genel where ne='kargo' order by s10 asc"); while($rsc=mysqli_fetch_assoc($sqlc)){ ?>
                                            <option value="<?php echo $rsc["id"];?>" <?php if($rsc["id"]==$siparis["s9"]){echo "Selected";}?> t1="<?php echo $rsc["t1"];?>"><?php echo $rsc["t1"];?><?php if($rsc["t2"]<>""){echo " / ".loc($rsc["t2"]);}?></option>
                                        <?php }?>
                                    </select>
                                    <input type="hidden" name="t12" id="t12" value="<?php echo $siparis["t12"]?>">
                                    <script language="javascript" type="text/javascript">
                                        jQuery(document).ready(function(){
                                            jQuery("#s9").on('change', function() {
                                                var t12 =jQuery(this).find(':selected').attr('t1');
                                                jQuery('#t12').val(t12);
                                            });
                                        });
                                    </script>
                                </div>
                                <div class="v3-col-md-6 mp0">
                                    <input type="text" name="t13" class="form-control" value="<?php echo $siparis["t13"]?>" placeholder="<?php echo ctranslate("Sevkiyat Kodu");?>">
                                    <?php if($siparis["t13"]<>"" and $f3==1){?>
                                        <a href="<?php echo cargotracking($siparis["t12"],$siparis["t13"])?>" target="_blank" style="float: right;"><?php echo ctranslate("Sevkiyat Takip");?></a>
                                    <?php }elseif($siparis["t13"]=="" and $f3==1){?>
                                        <a href="#" target="_blank" style="float: right;"><?php echo ctranslate("Sevkiyat Kodu Giriniz");?></a>
                                    <?php }?>
                                </div>
                            </fieldset>
                            <fieldset class="v3-col-md-4" style="<?php if($f3<>1){echo "height: 180px !important;";}?>">
                                
                                <legend><?php echo ctranslate("Sipariş Toplamı");?></legend>
                                <div class="fs30 mfs16 text-success">&nbsp;<?php echo wprice($gtoplam);?> <i class="fa fa-<?php echo strtolower($siparis["t2"]);?>"></i></div>
                                <?php if($siparis["t9"]<>""){?><div style="position:absolute;right: 10px; top: -10px;" class="btn btn-xs btn-success"><?php echo $siparis["t9"]?></div><?php }?>
                            </fieldset>
                            <div class="e" id="inputs">
                                <img src="../../assets/img/loading.gif">
                                <a class="v3-btn v3-btn-xs v3-btn-default sam" style="" target="_blank" href="?ne=ayarlar&islem=inputs&nedir=<?php echo $_GET["ne"]?>&kid=<?php echo $_GET["id"]?>"><i class="fa fa-wrench" aria-hidden="true"></i></a>
                            </div>
                            <script type="text/JavaScript" language="JavaScript">
                                jQuery(document).ready(function () { loadFunction('../ajax/ajax_inputs.php','#inputs'); });
                            </script>
                            <div class="msa">
                                <fieldset class="v3-col-md-12 collapsed" style="">
                                    <legend><a>Order jSon Data</a></legend>
                                    <?php
                                    $arrays = json_decode($siparis["n11"], true);
                                    foreach($arrays as $key=>$value){
                                        ?>
                                        <fieldset class="v3-col-md-4" style="">
                                            <legend><?php echo $key;?></legend>
                                            <input type="text" name="<?php echo $key;?>" id="<?php echo $key;?>" value="<?php echo $value;?>">
                                        </fieldset>
                                    <?php }?>
                                </fieldset>
                            </div>
                        </div>
                    </form>
                    <?php if(($_SESSION["kim"]=="Admin" or ($_SESSION["kim"]=="yonetici" and $_SESSION["y15"]==1))){?>
					<fieldset class="v3-col-md-4 <?php if($siparis["t5"]=="havale"){echo "dn";}?> mdn"  style="position: relative; left: 787px; margin-top: -176px;">
						<legend>İade Et</legend>
							<form action="<?php echo $weburl."/deppo/tools/vpos/".$aurl?>/refund.php" onsubmit="jQuery('#myModal').modal('show'); jQuery('#myModal').css('width','25%');" target="modal" method="post" class="">
								<input type="hidden" name="transid" value="<?php echo $siparis["t4"]?>">
								<input type="hidden" name="bankid" value="<?php echo $jso["Order_Bank_Id"]?>">
								<input type="text" name="Total" value="<?php echo sprice(wprice($gtoplam))?>" class="mw60 mfl">
								<button type="submit" onclick="return confirm('Ödeme iade edilecek onaylıyormusunuz?'); return false;" class="v3-btn-sm mfl" <?php //if($siparis["s4"]<>1){echo "disabled";}?>>İade Et</button>
							</form>
						</fieldset>
                    <?php }?>
                    <div class="v3-row">
                        
                        <table class="v3-table fs13 mfs12">
                            <thead class="mdn">
                                <tr>
                                    <th><?php echo $t24;?></th>
                                    <th style="text-align: right;" class="w10 tdn"><?php echo translate("Stok Kodu")?></th>
                                    <th style="text-align: right;" class="w10"><?php echo translate("Barkod Kodu")?></th>
                                    <th style="text-align: center;" class="w6 mdn"><?php echo translate("Vergi")?></th>
                                    <th style="text-align: center;" class="w6"><?php echo translate("Miktar")?></th>
                                    <th style="text-align: right;" class="w10"><?php echo $sdil[85]; //Fiyat?></th>
                                    <th style="text-align: right;" class="w10"><?php echo $sdil[144]; //Tutar?></th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                $sqls = mysqli_query($conn, "select * from eticaret where ne='sepet' and s5=".$_GET["id"].""); while($sepet=mysqli_fetch_assoc($sqls)){
                                    $sqlu = mysqli_query($conn, "select * from ".$_SESSION["lang"]." where ne='kayit' and id=".$sepet["s3"].""); $rsu=mysqli_fetch_assoc($sqlu);
                                    $sqlc = mysqli_query($conn, "select * from t5 where id=".$sepet["s19"].""); $rsc=mysqli_fetch_assoc($sqlc);
                                    $ufiyat=$sepet["pb1"];
                                    $jsi = json_decode($sepet["n17"], true);
                                    ?>
                                    <form action="../ecommerce/ajax.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $_GET["id"];?>&bid=<?php echo $sepet["id"];?>&durum=update_basket" id="xf<?php echo $sepet["id"];?>" class="xf<?php echo $sepet["id"];?>" name="xf<?php echo $sepet["id"];?>">
                                        <tr  data-id="<?php echo $sepet["id"];?>" style="clear: both;">
                                            <td class="">
                                                <img title="" src="<?php echo medya($sepet["s3"],1,"kresim","t1","",ssl($weburl,$f4))?>" style="border: 2px solid #2f3238; float:left; margin-right:5px; width: 45px; height: 45px;border-radius: 50%;"/> <?php echo kisalt($sepet["n1"],70)?> <?php if($sepet["n5"]<>""){echo "<a href=\"".$weburl."/deppo/dosya/".$sepet["n5"]."\" class=\"fa fa-download\"></a>";}?>
                                                <?php if($sepet["n17"]<>""){?>
                                                    <br><span style="font-size:10px;">
                                                        <?php
                                                        foreach($jsi as $key=>$value){
                                                            if($value[1]<>""){ $values = explode(',',$value); }else{ $values = explode(',',$value[0]); }
                                                            ?>
                                                            <?php echo $values[0];?> <?php if($values[1]<>0){echo "<b>+".$values[1]." ".$ikpb."</b>";}?>, 
                                                        <?php }?>
                                                    </span>
                                                <?php }?>
                                                <?php if(mysqli_num_rows($sqlc)>0 and $h3==1){?>
                                                    <span class="btn btn-warning btn-xs">
                                                        <a href="?ne=uye&islem=duye&id=<?php echo $rsc["id"]?>" target="_blank" class="cb"><?php echo $rsc["t1"]?></a> 
                                                    </span>
                                                    <span class="btn btn-info btn-xs">
                                                        <span class="cb">
                                                            <?php if($sepet["s14"]=="" or $sepet["s14"]=="0"){?> <?php echo translate("Mağaza Onayı Beklemede")?> <?php }elseif($sepet["s14"]=="1"){?> <?php echo translate("Mağaza Onayladı")?> <?php }elseif($sepet["s14"]=="3"){?> <?php echo translate("Mağaza Gönderdi")?><?php }elseif($sepet["s14"]=="4"){?> <?php echo translate("Mağaza Teslim Etti")?><?php }elseif($sepet["s14"]=="2"){?> <?php echo translate("Mağaza İptal Etti")?><?php }elseif($sepet["s14"]=="5"){?> <?php echo translate("Alıcı İade Talep Etti")?> <?php }?>
                                                        </span>
                                                    </span>
                                                    <?php if($sepet["s14"]>1 and $sepet["t13"]<>""){?><span class="v3-btn v3-btn-warning v3-btn-xs"><a data-toggle="modal" data-target="#myModal"  data-url="<?php echo cargotracking($siparis["t12"],$sepet["t13"])?>" data-title="<?php echo translate("Kargo Takip")?>" class="mfrm"><?php echo translate("Kargo Takip")?></a></span><?php }?>
                                                <?php }?>
                                            </td>
                                            <td style="text-align: right;" class="mdn"><?php echo $rsu["t4"];?></td>
                                            <td style="text-align: right;" class="mdn"><?php echo $rsu["t5"];?></td>
                                            <td style="text-align: right;" class="mdn"><input  onFocus="show('.btn<?php echo $sepet["id"];?>')" onBlur="hide('.btn<?php echo $sepet["id"];?>')" class="form-control" type="number" name="tax" old="<?php echo $sepet["s4"];?>" value="<?php echo $sepet["s4"]?>" style="text-align: right;"></td>
                                            <td style="text-align: center;" class=""><input  onFocus="show('.btn<?php echo $sepet["id"];?>')" onBlur="hide('.btn<?php echo $sepet["id"];?>')" class="form-control" type="number" name="qty" old="<?php echo $sepet["s2"]?>" value="<?php echo $sepet["s2"]?>" style="text-align: right;"></td>
                                            <td style="text-align: right;" class="">
                                                <input class="form-control" onFocus="show('.btn<?php echo $sepet["id"];?>')" onBlur="hide('.btn<?php echo $sepet["id"];?>')" type="text" name="price" old="<?php echo wprice($ufiyat)?>" value="<?php echo wprice($ufiyat)?>" style="text-align: right;">
                                            </td>
                                            <td style="text-align: right; position:relative;" class="">
                                                <button class="fas fa-refresh v3-btn-xs v3-btn-warning btn<?php echo $sepet["id"];?>" type="button" onclick="Ajaxs('<?php echo $sepet["id"];?>','#result','AjaxPost')" style="position: absolute; top: 15px; padding: 5px; left: 5px; display:none;"></button>
                                                <button class="fas fa-trash v3-btn-xs v3-btn-danger btn<?php echo $sepet["id"];?> btn-delete-row" type="button" data-href="../ecommerce/ajax.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $_GET["id"];?>&bid=<?php echo $sepet["id"];?>&durum=remove_item" style="position: absolute; top: 15px; padding: 5px; left: 35px; display:none;"></button>
                                                <input class="form-control" type="text" value="<?php echo wprice($ufiyat*$sepet["s2"])?>" style="text-align: right;" readonly>
                                            </td>
                                        </tr>
                                    </form>
                                <?php }?>
							</table>
							<table class="v3-table fs13 mfs12">
								<tr>
									<td colspan="5">&nbsp;</td>
									<td class="tar w75"><?php echo $sdil[175]; // Ara Toplam ?> :</td>
									<td class="tar w25">
										<input class="form-control" id="stutar" type="text" name="stutar" old="<?php echo wprice($stutar)?>" value="<?php echo wprice($stutar)?>" style="text-align: right;">
									</td>
								</tr>

								<?php if($kargof != 0): ?>
									<tr>
										<td colspan="5">&nbsp;</td>
										<td class="tar"><?php echo $sdil[7]; // Sevkiyat ?> :</td>
										<td class="tar">
											<input class="form-control" id="kargof" type="text" name="kargof" old="<?php echo wprice($kargof)?>" value="<?php echo wprice($kargof)?>" style="text-align: right;">
										</td>
									</tr>
								<?php endif; ?>

								<?php if($vadef != 0): ?>
									<tr>
										<td colspan="5">&nbsp;</td>
										<td class="tar">Komisyon :</td>
										<td class="tar">
											<input class="form-control" id="vadef" type="text" name="vadef" old="<?php echo wprice($vadef)?>" value="<?php echo wprice($vadef)?>" style="text-align: right;">
										</td>
									</tr>
								<?php endif; ?>

								<?php if($kdv > 0): ?>
									<tr>
										<td colspan="5">&nbsp;</td>
										<td class="tar"><?php echo $sdil[86]; ?> :</td>
										<td class="tar">
											<input class="form-control" id="kdv" type="text" name="kdv" old="<?php echo wprice($kdv)?>" value="<?php echo wprice($kdv)?>" style="text-align: right;">
										</td>
									</tr>
								<?php endif; ?>

								<?php if($kindirim > 0): ?>
									<tr>
										<td colspan="5">&nbsp;</td>
										<td class="tar"><?php echo translate("İndirim Kodu ile"); ?> :</td>
										<td class="tar">
											<input class="form-control" id="Order_Sale_Code_Price" type="text" name="Order_Sale_Code_Price" old="<?php echo wprice($kindirim)?>" value="<?php echo wprice($kindirim)?>" style="text-align: right;">
										</td>
									</tr>
								<?php endif; ?>

								<?php if($hindirim > 0): ?>
									<tr>
										<td colspan="5">&nbsp;</td>
										<td class="tar"><?php echo translate("Havale indirim"); ?> :</td>
										<td class="tar">
											<input class="form-control" id="indirim" type="text" name="indirim" old="<?php echo wprice($hindirim)?>" value="<?php echo wprice($hindirim)?>" style="text-align: right;">
										</td>
									</tr>
								<?php endif; ?>

								<?php if(!empty($jsO["Order_Rental_Days"])): ?>
									<tr>
										<td colspan="5">&nbsp;</td>
										<td class="tar"><?php echo translate("Kiralama Süresi"); ?> :</td>
										<td class="tar">
											<input class="form-control" id="Order_Rental_Days" type="text" name="Order_Rental_Days" old="<?php echo $jsO["Order_Rental_Days"]?>" value="<?php echo $jsO["Order_Rental_Days"].' '.translate("Gün"); ?>" style="text-align: right;">
										</td>
									</tr>
								<?php endif; ?>

								<?php if(!empty($jsO["Order_Rental_Discount"])): ?>
									<tr>
										<td colspan="5">&nbsp;</td>
										<td class="tar"><?php echo translate("İndirim Oranı"); ?> :</td>
										<td class="tar">&nbsp;%<?php echo $jsO["Order_Rental_Discount"]; ?></td>
									</tr>
								<?php endif; ?>

								<tr>
									<td colspan="5">&nbsp;</td>
									<td class="tar"><?php echo $sdil[176]; // G.Toplam ?> :</td>
									<td class="tar">
										<input class="form-control" id="gtoplam" type="text" name="gtoplam" old="<?php echo wprice($gtoplam);?>" value="<?php echo wprice($gtoplam);?>" style="text-align: right;">
									</td>
								</tr>
							</table>

                    </div>
                </div>
            </div>
        </div>
    </body>
    <script src="../../assets/js/tabs.js"></script>
    <?php echo $footer?>
    </html>
    <?php
    if($_GET["durum"]=="update_order"){
        if($siparis["s19"]<>$_POST["s19"]){
            $sql = mysqli_query($conn, "update t4 set s1='".$_POST["s19"]."' where s5=".$_GET["id"]."");
        }
        $iarr = array();
        foreach ($_POST as $key => $value){
            if(substr($key,0,1)=="i"){
                $iarr = $iarr + array( $key => $value);
            }
        }
        $jsi = json_encode($iarr, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
        $oarr = array();
        foreach ($_POST as $key => $value){
            if(substr($key,0,5)=="Order"){
                $oarr = $oarr + array($key => $value);
            }
        }
        $jso = json_encode($oarr, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
        $sql = mysqli_query($conn, "update eticaret set t8='".$_POST["t8"]."', s9='".$_POST["s9"]."', s19='".$_POST["s19"]."', n10='".$_POST["n10"]."', n11='".addslashes(stripslashes($jso))."', n17='".addslashes(stripslashes($jsi))."', t12='".$_POST["t12"]."', t13='".$_POST["t13"]."', ts2='".str_replace('T',' ',$_POST["ts2"])."' where ne='siparis' and id=".$_GET["id"]."");
        include("../sale/crm_extra.php");
//-- Cari -->
        if($c7==1){
            $sql = mysqli_query($conn, "select * from eticaret where id=".$_GET["id"].""); $siparis=mysqli_fetch_assoc($sql);
            if($siparis["t5"]=="pos" or $siparis["t5"]=="payu"){
                $t1="Pos";
                $pb3=$_POST["siptop"];
            }elseif($siparis["t5"]=="havale" or $siparis["t5"]=="kapida" or $siparis["t5"]=="morder"){
                $t1="Banka";
                $pb3="0";
            }elseif($siparis["t5"]=="modeme"){
                $t1="Nakit";
                $pb3="0";
            }
            if($_POST["cari"]==1){
                $pb3=$_POST["siptop"];
            }else{
                $pb3="0";
            }
            $sqlc = mysqli_query($conn, "select * from t4 where ne='cari' and s5=".$_GET["id"]." order by id desc"); $cari=mysqli_fetch_assoc($sqlc);
            if(mysqli_num_rows($sqlc)==0){
                $sql = $conn->query("insert into t4(t1,t2,ne,t4,t6,pb1,pb2,pb3,pb4,s1,s2,s3,s4,s5,n1,ts1) values ('".$t1."', 'siparis', 'cari', '".date("Y-m-d")."', 'TRY', '".$_POST["siptop"]."', '0', '".$pb3."', '0', '".$siparis["s1"]."', '".Date("d")."', '".Date("m")."', '".Date("Y")."', '".$siparis["id"]."', '".$siparis["t4"]." Nolu Sipariş', now())");
            }else{
                $sql = mysqli_query($conn, "update t4 set pb3='".$pb3."' where s5=".$_GET["id"]."");
            }
        }
//-- Cari -->
        echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&s4=".$_GET["s4"]."&id=".$_GET["id"]."&durum=ok",self,500,1);
    }
?>