<?php 
include'../css.php';
?>
 
 <?php
header ("Content-Type: text/html; charset=iso-8859-9");
session_start();
ob_start();

 

?>
<?php
include('../baglan.php');

if(isset($_GET['KONSINYE_ID'])) $KONSINYE_ID = $_GET['KONSINYE_ID'];
$baglan = mysql_query("select * from konsinyeler where KONSINYE_ID='$KONSINYE_ID'"); 


$yaz = mysql_fetch_assoc($baglan); // while dongsu icine almadim tek veri cekecegimiz icin. burda get methodunu da kullandık
 $tarih     = date('d.m.Y H:i:s');
?>

<div class="box box-success"><h3 class="box-title">Konsinye Sat</h3> </div>
<div class="box-body">
<form name="form1" method="post" action="konsinyesat_islem.php">


  <div id='tab-menu'>
  <div class='tab-menu'>
	<a href='#'>Konsinye Sat</a></div>
		<div class='tabmenuContent'>  


 <?php
$_SESSION["konsinye_id"] = $yaz["KONSINYE_ID"];
$_SESSION["konsinye_eczane"] = $yaz["KONSINYE_ECZANE"];
?>
<? echo $_SESSION["konsinye_id"] ;?><br>
<? echo $_SESSION["konsinye_eczane"] ;?><br>

<? echo $_SESSION["kullanici_adi"];?><br>

<? echo $_SESSION["personel_turu"];?>
 <table border="0"  cellpadding="0" cellspacing="3">
    


          <tr>
      <td ><strong>Satış Tarih</strong>  

<input name="KONSINYE_ISLEM_ID" type="hidden" id="KONSINYE_ISLEM_ID"  size="20" />
<input name="SATIS_DEPRESANT" type="hidden" id="SATIS_DEPRESANT" value="<? echo $_SESSION["kullanici_adi"];?>" size="20" />
<input name="KONSINYE_ECZANE" type="hidden" id="KONSINYE_ECZANE" value="<? echo $yaz["KONSINYE_ECZANE"];?>" size="20" />
<input name="KONSINYE_ID" type="hidden" id="KONSINYE_ID" size="20"  value="<? echo $yaz["KONSINYE_ID"];?>"  />
  <input name="SATIS_SEKLI" type="hidden" id="SATIS_SEKLI" size="20"  value="Konsinye_Satis"  />
  <input name="GIRIS_TARIHI" type="hidden" id="GIRIS_TARIHI" value="<? echo $tarih;?>" size="20" />

<input name="PERSONEL_SEKLI" type="hidden" id="PERSONEL_SEKLI" value="<? echo$_SESSION["personel_turu"];?>" size="20" />
</td>
      <td ><div class="input-group">
<input name="KONSINYE_TARIH" id="KONSINYE_TARIH" type="date" class="form-control"    size="63"  min="2025-01-01" max="2025-12-31" required />    </tr>

      </span></td>
    </tr>
    <tr>
      <td class="size12"><strong>Satılan Ürün Adı  </strong></td>
      <td><select name="SATIS_TUTARI" id="SATIS_TUTARI" class="form-control   select2-hidden-accessible"   aria-hidden="true"  onChange="update()" required />
      
        <option value="">Lütfen Önce Seçiminizi Yapınız</option>
        <?php include('baglan.php'); 
$sql = mysql_query("SELECT * FROM urunler where URUN_DURUM='Aktif' and URUN_DEPRESANT LIKE '%$sorumlu_kodu%' Order By URUN_ADI asc"); 
while ($a = mysql_fetch_array($sql)) { if ($yaz[SATIS_URUN_ADI] == $a[URUN_LINK]){ $durum=  'selected="selected"'; } else { $durum =''; }?>
        <option value="<?php echo $a['URUN_FIYAT']?>" <?php echo $durum; ?>  id="<?php echo $a['URUN_KULLANIM']?>2"><?php echo $a[URUN_LINK];?>
        <?php } ?>
        </option></td>
    </tr>
    <tr>
      <td class="size12"><label>Konsinye Ürün Kasa Tutarı</label></td>
      <td><span class="size12">
        <?php

 

 
session_start();
ob_start();
 $sorumlu_kodu=$_SESSION["kullanici_adi"];


if($sorumlu_kodu=='info@parkmed.com.tr'){

echo'	<input type="text" id="value" class="form-control   select2-hidden-accessible"  >';

}
else
{

echo ' 	<input type="text" id="value" class="form-control   select2-hidden-accessible "readonly > ';

}

?>
        <input type="text" name="KONSINYE_URUN_ADI" id="text" class="form-control   select2-hidden-accessible"  readonly>
      </span></td>
    </tr>
    <tr>
      <td class="size12">&nbsp;</td>
      <td><input name="SATIS_URUN_KULLANIM" type="text" class="form-control"  id="SATIS_URUN_KULLANIM" size="63"  value="<? echo $yaz["KONSINYE_KULLANIM"];?>" readonly  /></td>
    </tr>


     
    <tr>
      <td class="size12"><strong>Reçete Eden Dr</strong></td>
      <td><select name="KONSINYE_RECETE_EDEN_DOKTOR" id="KONSINYE_RECETE_EDEN_DOKTOR"  class="form-control   select2-hidden-accessible">
        <?php include('baglan.php'); 

 $sorumlu_kodu=$_SESSION["kullanici_adi"];
$sql = mysql_query("SELECT * FROM doktorlar WHERE DOKTOR_SORUMLU_KODU='$sorumlu_kodu' "); 
while ($a = mysql_fetch_array($sql)) {
if ($yaz[KONSINYE_ECZANE] == $a[DOKTOR_ADI]){ $durum=  'selected="selected"'; } else { $durum =''; }?>
      
<option value="<?php echo $a[DOKTOR_ADI];?>" <?php echo $durum; ?> ><?php echo $a[DOKTOR_ADI];?></option>

<?php } ?>
          </select></td>
    </tr>

 


 <tr>
      <td class="size12"><strong>Satış Adet</strong></td>
      <td><input name="SATIS_ADET" type="text" class="form-control"  id="SATIS_ADET" size="63"    required/></td>
    </tr>
    <tr>
      <td valign="top" class="size12">&nbsp;</td>
      <td><input name="button" type="submit" class="button_gri" id="button" value="Satış Tamamla" /></td>
    </tr>
    <tr>
      <td valign="top" class="size12">&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>














  </div>






</form>
  </div>


	