Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
7.2 kB
1
Indexable
Never
<!-- GÜNCELLE Modal -->	
		<?php
	

                $sql="select * from siparis_detay,siparis_genel WHERE siparis_genel.id = siparis_detay.firma_id";
                $res=mysqli_query($baglanti,$sql);
                while ($row=mysqli_fetch_assoc($res)) {
					
		?>
	

<div class="modal fade" id="<?='siparisGuncelle'.$row['id']?>"  tabindex="-1" role="dialog" aria-labelledby="<?='siparisGuncelle'.$row['firma_id']?>"  aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
       <!-- <h5 class="modal-title" id="exampleModalLabel">Güncelle</h5>-->
        <button type="button" class="close" data-dismiss="modal" aria-label="Close" onclick="res()">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
  <form action="guncelle.php" method="post" id="guncelleSiparisForm">
  <div class="form-group">
    <label for="formGroupExampleInput1">Firma Adı</label>
    <input type="text" class="form-control" id="formGroupExampleInput1" name="firma_isim" placeholder="Firma Adı" value="<?=$row["firma_adi"];?>" required autofocus>
  </div>
  <div class="form-group">
    <label for="formGroupExampleInput2">Müşteri Adı Soyadı</label>
    <input type="text" class="form-control" id="formGroupExampleInput2"  name="musteri_tam_isim" placeholder="Müşteri Adı Soyadı"  value="<?=$row["musteri_adi_soyadi"];?>" required>
  </div>
  <div class="form-group">
    <label for="formGroupExampleInput3">Müşteri Tel.</label>
    <input type="tel" class="form-control" id="formGroupExampleInput3"  name="musteri_tel_no" placeholder="Müşteri Telefon Numarası" value="<?=$row["musteri_tel_no"];?>" required>
  </div>
  <div class="form-group">
    <label for="formGroupExampleInput4">Teslim Alan Personel</label>
    <input type="text" class="form-control" id="formGroupExampleInput4" name="personel_tam_isim" placeholder="Teslim Alan Personel" value="<?=$row["personel_adi_soyadi"];?>" required>
  </div>
  
<div class="form-group">
    <label for="formGroupExampleInput5">İşin Adı</label>
    <input type="text" class="form-control" id="formGroupExampleInput5" name="is_adi" placeholder="İşin Adı" value="<?=$row["is_adi"];?>" required>
  </div>
  <div class="form-group">
    <label for="formGroupExampleInput6">Sipariş Tarihi</label>
    <input type="date" class="form-control" id="formGroupExampleInput6" name="tarih_siparis" placeholder="Sipariş Tarihi" value="<?=$row["tarih_siparis"];?>" required>
  </div>
  <div class="form-group">
    <label for="formGroupExampleInput7">Teslim Tarihi</label>
    <input type="date" class="form-control" id="formGroupExampleInput7" name="tarih_teslim" placeholder="Teslim Tarihi" value="<?=$row["tarih_teslim"];?>" required>
  </div>
  <div class="form-group">
    <label for="formGroupExampleInput8">Baskı Türü</label>
    <input type="text" class="form-control" id="baski_turu_bir" name="baski_turu_iki" placeholder="Baskı Türü" value="<?=$row["baski_turu"];?>" required>
  </div>
  <div class="form-group">
    <label for="formGroupExampleInput9">Adet/Metrekare</label>
    <input type="text" class="form-control" id="adet_iki" name="adet_iki" placeholder="Adet/Metrekare" onchange="tutar_bir()" value="<?=$row["adet"];?>" required>
  </div>
  <div class="form-group">
    <label for="formGroupExampleInput11">Birim Fiyatı</label>
    <input type="text" class="form-control" id="birim_fiyat_iki" name="birim_fiyat_iki" placeholder="Birim Fiyatı" onchange="tutar_bir()" value="<?=$row["birim_fiyat"];?>" required>
  </div>
  <div class="form-group">
    <label for="formGroupExampleInput12">KDV'siz Tutar</label>
    <input type="text" class="form-control" id="kdvsiz_tutar_iki" name="kdvsiz_tutar_iki" placeholder="KDV'siz Tutar" value="<?=$row["kdvsiz_tutar"];?>" readonly>
  </div>
  <div class="form-group">
    <label for="formGroupExampleInput13">KDV'li Tutar</label>
    <input type="text" class="form-control" id="kdvli_tutar_iki" name="kdvli_tutar_iki" placeholder="KDV'li Tutar" value="<?=$row["kdvli_tutar"];?>" readonly>
  </div>
  <div class="form-group">
    <label for="formGroupExampleInput14">KDV Oranı</label>
    <input type="text" class="form-control" id="kdv_orani_iki" name="kdv_orani_iki" placeholder="KDV Oranı (KDV oranı yok ise 0 değerini giriniz.)" onchange="tutar_bir()" value="<?=$row["kdv_orani"];?>" required>
  </div>
  <div class="form-group">
    <label for="formGroupExampleInput15">Ödenen Tutar</label>
    <input type="text" class="form-control" id="odenen_tutar_iki"  name="odenen_tutar_iki" placeholder="Ödenen Tutar" onchange="tutar_bir()" value="<?=$row["odenen_tutar"];?>" >
  </div>
  <div class="form-group">
    <label for="formGroupExampleInput15">Kalan Tutar</label>
    <input type="text" class="form-control" id="kalan_tutar_iki"  name="kalan_tutar_iki" placeholder="Kalan Tutar" value="<?=$row["kalan_tutar"];?>" readonly>
  </div>
<div class="mb-3">
  <label for="aciklama" class="form-label">Açıklama</label>
  <textarea class="form-control" id="aciklama2" rows="3" style="max-width: 570px;" name="aciklama" ><?=$row["aciklama"];?></textarea>
</div>
        <script>
            function tutar_bir(){
                var miktar = document.getElementById('adet_iki').value;
                var fiyat =  document.getElementById('birim_fiyat_iki').value;
                var kdvsiz = document.getElementById('kdvsiz_tutar_iki').value;

                kdvsiz = parseFloat(miktar) * parseFloat(fiyat);

                document.getElementById('kdvsiz_tutar_iki').value= kdvsiz.toFixed(2);
                
                var kdv_orani = document.getElementById('kdv_orani_iki').value;
                var kdvli_tutar = parseFloat(kdvsiz) * parseFloat(kdv_orani);  
                document.getElementById('kdvli_tutar_iki').value = kdvli_tutar.toFixed(2);
				
				var odenen = document.getElementById('odenen_tutar_iki').value;
				
				
				
				if(kdv_orani == 0 || kdv_orani == null){
					document.getElementById('kalan_tutar_iki').value = kdvsiz - odenen;
				}else{
					document.getElementById('kalan_tutar_iki').value = kdvli_tutar.toFixed(2) - odenen;
				 }
				
				var kalan = document.getElementById('kalan_tutar_iki').value;
				
				var odeme_sorgu = null;
				if(odenen==0 || odenen==null){
					odeme_sorgu = "Ödeme yapılmadı. ";
				}else{
					odeme_sorgu = odenen+" TL tutarında ödeme yapıldı. "
				}
				
				document.getElementById('aciklama2').value =odeme_sorgu + "Kalan tutar: "+ kalan + " TL."
				
            }

 </script>
	  
	    <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal" onclick="res()">Kapat</button>
        <button type="submit" class="btn btn-primary" name="guncelle" value="<?=$row['id'];?>" formmethod="post">Değişiklikleri Kaydet</button>		  
		  <script language="javascript">
			  
			  function res(){window.location.reload();}
		  
		  </script>
      </div>
      </form>	  
      </div>
    </div>
  </div>
</div>