<? include('lock.php');?> 
<? include('config.php');?>
<? include('welcome.php');?>
<? include('style.php');?> 
 <? 
$typos_domatio= $_POST['typos_domatio'];
$name         = $_POST['name'];
$afm          = $_POST['afm'];
$epitagi      = $_POST['epitagi'];
$amka         = $_POST['amka'];
$date_in      = $_POST['date_in'];
$date_out     = $_POST['date_out'];
$hotel        = $_POST['hotel'];
$periodos     = $_POST['periodos'];
$plithos_dom  = $_POST['plithos_dom'];
$typos_domatio= $_POST['typos_domatio'];
$ar_ofel      = $_POST['ar_ofel'];
$simf_simetox = $_POST['simf_simetox'];
$room         = $_POST['room'];
$katoikos     = $_POST['katoikos'];
$onoma_ex    = $_POST['onoma_ex'];
$im_ex        = $_POST['im_ex'];
$idiotita_ex   = $_POST['idiotita_ex'];
$atoma=$ar_ofel +1;

//----------------------------------------------------neos aa simbolaiou
 
 $resulta = $bd->query("SELECT * FROM `oaed_thea` ORDER BY `ar_symb` DESC LIMIT 1");

if ($resulta && $resulta->num_rows > 0) {
    $rowa = $resulta->fetch_assoc();
    $ar_symbol = $rowa['ar_symb'] + 1;
} 

//-----------------------------------  timi domatio

 $result = mysql_query("SELECT * FROM times_dom WHERE kat_dom='$typos_domatio' and hotel_a ='thea'");
 $row = mysql_fetch_array($result);


     $t = date("Y-m-d");
 if ($t < "2015-07-01") {
    $dom_timi = $row['poso_min'];
 }
 else
 {
    $dom_timi = $row['poso_max'];
    
 }
 
//-------------------------------------- dianiktereyseis - meres

$date1=date_create($date_in);
$date2=date_create($date_out);
$diff=date_diff($date1,$date2)->format("%a"); 
$dianikt = $diff; 
$imeres=$dianikt+1;
//---------------------------------------------- simmetoxes

$proino='6';  //  proino atomo
$ep='30'; // poso epid oaed kata atomo
$sm='6';  // simetoxh pelath

//-------------------------------synola epidotisis

$im_ep_oaed=$ep*$atoma; // imerisia epidotisi oaed synolika
$epid=$dianikt*$ep; //  synolo epidotisis oaed ana atomo


//--------------------------------------------------------------- xreosi domatio max

$xr_dom=($plithos_dom*$dom_timi)+($sm*$atoma);  // megisti xreosi ana imera
$epr_sim=($sm*$atoma)+($ep*$atoma); // megisti epitrepomeni xreosi gia oaed ana domatio

//--------------------------------------------------------------
$q=$epr_sim-$xr_dom;
$diafora_xreosis=$q;
$atomaa=$atoma*1;

 if ($diafora_xreosis > '0' && $diafora_xreosis <= '4')
    {
    $ekt_a='1';
    }

 if ($diafora_xreosis > '4' && $diafora_xreosis <= '8')
    {
    $ekt_a='2';
    }

 if ($diafora_xreosis > '8' && $diafora_xreosis <= '12')
    {
    $ekt_a='3';
    }

 if ($diafora_xreosis > '12' && $diafora_xreosis <= '16')
    {
    $ekt_a='4';
    }
    
 if ($diafora_xreosis > '16' && $diafora_xreosis <= '20')
    {
    $ekt_a='5';
    }  
     
 if ($diafora_xreosis > '10' && $diafora_xreosis <= '24')
    {
    $ekt_a='6';
    }    
    
$nea_sim=$sm-$ekt_a;

$im_sim_ana_pel=$nea_sim;
$simx= $dianikt*6; 
$aaa=$simf_simetox-$im_sim_ana_pel;
$sim_ap=$im_sim_ana_pel*$atoma;
$sin=$im_ep_oaed+$sim_ap;
$sinolo=$epid+$simx;

?><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <script language="javascript">
 
 
function getValues(val){

var numVal1=parseInt(document.getElementById("one").value);
var numVal2=parseInt(document.getElementById("two").value);
var numVal3=parseInt(document.getElementById("three").value);


var totalValue = numVal1 * 30.00;
document.getElementById("main").value = totalValue;

var totalValued = numVal1 * 6.00;
document.getElementById("maind").value = totalValued;

var totalValuet = totalValue + totalValued;
document.getElementById("mainx").value = totalValuet;

}
</script>
<style>
input.numbox{
	width:30px;
	height:20px;
}
textarea.mainbox{
	width:200px;
	height:100px;
	font-size:30;
	font-weight:bold;
}
</style>

<style type="text/css">
<!--
.style1 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px;
	font-weight: bold;
	color: #333;
}
.style7 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 22px;
	font-weight: bold;
	color: #333;
}
.style4 {font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; }
body {
	background-color: #E5E5E5;
}
.style8 {color: #003366}
a:link {
	color: #19315E;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #19315E;
}
a:hover {
	text-decoration: none;
	color: #19315E;
}
a:active {
	text-decoration: none;
	color: #19315E;
}
body {
	background-color: #FFFFFF;
}
mark { 
    background-color: #ffffcc;
    color: black;
    font-size: 14px;
}
input {
    text-align:center;
}
input[type=text] {
    padding: 0;
    height: 30px;
    position: relative;
    left: 0;
    outline: none;
    border: 1px solid #cdcdcd;
    border-color: rgba(0,0,0,.15);
    background-color: white;
    font-size: 14px;
}
input[type=date] {
    padding: 0;
    height: 30px;
    position: relative;
    left: 0;
    outline: none;
    border: 1px solid #cdcdcd;
    border-color: rgba(0,0,0,.15);
    background-color: white;
    font-size: 14px;
}
marka {
    background-color: red;
    color: black;
     font-size: 14px;
}
markb {
    background-color: #FFCCFF;
    color: black;
     font-size: 14px;
}
markt {
    background-color: #66ff99;
    color: black;
     font-size: 14px;
}
-->
</style>

<p align="center" class="style7">Καταχώρηση 1 ατομο ΟΑΕΔ</p>
<p align="center" class="style4"><a href="home.php" >επιστροφή στην αρχική σελίδα</a></p>
	 <table border="0" align="center">
	 
	 
	  
  <form method="post" action="in_1.php">
            
        <tr class="style1" bgcolor="#FFFFFF">
          <td width="100" align="right" >Ονοματεπωνυνο</td>
          <td width=""><input type="text" name="name" size="50" class="inputbox" value="<? echo $name;?>" hidden> : <mark><? echo $name;?></mark></td>
        <td width="15"> </td>
          <td align="right" >Α.Φ.Μ. </td>
          <td width=""><input type="text" name="afm" size="25" class="inputbox" value="<? echo $afm;?>"  hidden> : <mark><? echo $afm;?></mark></td>
        </tr>
                
	<tr class="style1" bgcolor="#FFFFFF">
          <td align="right" >Αρ. επιταγης </td>
      <td width=""><input type="text" name="epitagi" size="25" class="inputbox" value="<? echo $epitagi;?>" hidden> : <mark><? echo $epitagi;?></mark></td>
           <td width="15"> </td>
        <td align="right" >ΑΜΚΑ </td>
      <td width=""><input type="text" name="amka" size="25" class="inputbox" value="<?  echo $amka ; ?>" hidden> : <mark><? echo $amka;?></mark></td>
       </tr>
        <tr class="style1" bgcolor="#FFFFFF">
		<td align="right" >Κατοικος </td>
         <td width="15"><input type="text" name="katoikos" size="25" class="inputbox" value="<?  echo $katoikos ; ?>" hidden> : <mark><? echo $katoikos;?></mark></td> </td>
		
          <td align="right" >
          <td width=""><input type="text" name="dik_ofel" size="25" class="inputbox" value="1" hidden></td>
           
            <td align="" > </td>
            
 
       <tr class="style1" bgcolor="#FFFFFF">
         <td width="" align="right"  >Ημ.αφιξης</td>
         <td width=""><input type="date" name="date_in" size="10" class="inputboxb" value="<?  echo $date_in ; ?>"  readonly></td>
         
         <td width="15"> </td>
         
          <td width="100" align="right" >Ημ.αναχωρ</td>
         <td width=""><input type="date" name="date_out" size="10" class="inputboxb" value="<?  echo $date_out ; ?>"  readonly></td>
       </tr>
  <tr class="style1" bgcolor="#FFFFFF">
          <td align="right" >&nbsp;</td>
          <td width=""> </td>
         <td width="15"> </td>
       <tr class="style1" bgcolor="#FFFFFF">
  
          <td width="100" align="right" >Διαν/σεις </td>
         <td width=""><input type="text" name="dianiktere" size="1" class="inputboxa"  value="<?  echo $dianikt ; ?>" readonly></td>
           <td width="50"></td>
          <td width="" align="right"  >περιοδος</td>
         <td width=""><input class="inputboxa" name="periodos" size="1" type="text"  value="<?  echo $periodos ; ?>" readonly></td>
       </tr>
          
          <tr class="style1" bgcolor="#FFFFFF">  
          <td width="100" align="right" >Δωμάτια </td>
          <td width=""><input type="text" name="plithos_dom" size="1" class="inputboxa"  value="<?  echo $plithos_dom ; ?>" readonly></td>
           <td width="50"></td>
          <td width="" align="right"  >άτομα συνολικά</td>
          <td width=""><input class="inputboxa" name="atoma" size="1" type="text"  value="<?  echo $atoma ; ?>" readonly></td>
          </tr>
           <tr bgcolor="#FFFFFF"><td>&nbsp;</td> 
           </tr>
          <tr class="style1" bgcolor="#FFFFFF">
          <td width="" align="right"  >hotel </td>
          <td width=""><input type="text" name="hotel" size="25" class="inputbox" value="<?  echo $hotel ; ?>" hidden><?  echo $hotel ; ?></td>
           <td width="50"></td>
          <td width="" align="right" >Room No</td>  
          <td width="" align="left" ><input type="text" name="room" size="25" class="inputbox" value="<?  echo $room ; ?>" hidden><?  echo $room ; ?></td>
          <td width="" align="left" ><input type="text" name="typos_domatio" size="25" class="inputbox" value="<?  echo $typos_domatio ; ?>" hidden></td>
          <td width=""><input type="text" name="ar_ofel" size="25" class="inputbox" value="<?  echo $ar_ofel ; ?>" hidden></td>
          <td width=""><input type="text" name="$typos_domatio" size="25" class="inputbox" value="<?  echo $typos_domatio ; ?>" hidden></td>
           <td width=""><input type="text" name="ar_symb" size="25" class="inputbox" value="<?  echo $ar_symbol ; ?>" hidden></td>
   
        
          <td width=""><input type="text" name="imeres" size="25" class="inputbox" value="<?  echo $imeres ; ?>" hidden></td>
        </tr>
           <tr class="style1" bgcolor="#FFFFFF">
          <td align="right" >&nbsp;</td>
          <td width=""> </td>
         <td width="15"> </td>
        <tr class="style1" bgcolor="#E5E5E5">
       <tr class="style1" bgcolor="#FFFFFF">
         <td width="" align="right"  >Εξουσιοδοτουμενος</td>
         <td width="" alidn="left"><input type="text" name="onoma_ex" size="10" class="inputbox" value="<?  echo $onoma_ex; ?>"  readonly></td>
         
         <td width="15"> </td>
         
          <td width="100" align="right" >Ημ.εξουσιοδότησης</td>
         <td width=""><input type="date" name="im_ex" size="10" class="inputboxb" value="<?  echo $im_ex ; ?>"  readonly></td>
       </tr>
         
         
         <tr class="style1" bgcolor="#FFFFFF">
         <td width="" align="right"  >Ιδιοτητα</td>
          <td width="" alidn="left"><input type="text" name="idiotita_ex" size="10" class="inputbox" value="<?  echo $idiotita_ex; ?>"  readonly></td>
         
         <td width="15"> </td>
         
          <td width="100" align="right" ></td>
          <td width=""></td>
       </tr>
         
        <tr bgcolor="#FFFFFF"><td></td> 
        </tr>
        <tr class="style1" bgcolor="#FFFFFF">
          <td width="" align="right" ></td>
          <td width=""><input class="inputbox" name="epidotisi"  size="5" type="text" id="main" value="<?  echo number_format((float)$epid, 2, '.', ''); ?>" hidden> </td>
        <td width="50"></td>
          <td width="" align="right"  ><b>συνολικό ποσό ποσο συμμετοχής</td>
          <td width="" ><input class="inputboxa"  name="simetoxi"  size="5" type="text" id="maind" value="<?  echo number_format((float)$simx, 2, '.', ''); ?>"  </td>€ (άτομο)
        </tr>
       <tr class="style1" bgcolor="#FFFFFF">
          <td width="" align="right"  > </td>
         <td width=""><input type="text" name="hotel" size="25" class="inputbox" value="<?  echo $hotel ; ?>" hidden></td>
    <td width="50"></td>
          <td width="" align="right" ></td>
         <td width=""><input class="inputbox" name="total" size="5" type="text" id="mainx" value="<?  echo number_format((float)$sinolo, 2, '.', '');?> " hidden></td>
       </tr>
       <tr class="style1" bgcolor="#FFFFFF">
          <td width="" align="right"  ></td>
         <td width=""><input class="inputbox"  name="simf_simetox"  size="5" type="text" id="maind" value=" <? echo number_format((float)$simf_simetox, 2, '.', '');?> " hidden></td>
       
        <td width="50"></td>
          <td width="" align="right"  ></td>
          <td width=""></td>
       </tr>
        
        
        
        
       
        
</table>    <p align="center"><input type="submit" name="submit" value="καταχώρηση δικαιουχου" class="button"/></p>
    </form>
   
      <p align="center">-</button></p>
	<p align="center"><button id="myButton" class="float-left submit-button" >ακύρωση</button></p>

<script type="text/javascript">
    document.getElementById("myButton").onclick = function () {
        location.href = "home.php";
    };
</script> 