<div class="data-entry">
	<form method="post" id="izracun_form" class="ajaxform">
		<div class="row"><label>Datum od:</label>
			<input name="datum_od" class="datepicker"/>
		</div>
		<div class="row"><label>Datum do:</label>
			<input name="datum_do" class="datepicker"/>
		</div>
		<!--div class="row"><label>Kilometrov:</label>
			<input name="kilometrov" class=""/> km
		</div-->
		<div class="row"><label>Znesek:</label>
			<input name="znesek" class=""/> €
		</div>
		<div class="row"><label>Kilometrina:</label>
			<input name="kilometrina" class=""/> €/km
		</div>
		<div class="row"><label>Avto:</label>
			<?php print generate_select("SELECT opis AS value, id FROM tbl_avto", "name='avto_id'")?>
		</div>
		<!--div class="row"><label>Tudi prazniki:</label>
			<input name="tudi_prazniki" type="checkbox" checked="checked"/>
		</div-->
		<div class="row last">
			<input type="submit" value="Generiraj"/>
		</div>
	</form>
</div>
<div class="data-output">
	<div class="generation-info">
		<div class="od"><label>Izpis: </label>
		<span><select id="izpis" onchange="izpis()">
		<?php 
		$izpisi=getIzpisi();
		foreach ( $izpisi as $option ) : ?>
          <option value="<?php echo $option->serija; ?>"><?php echo $option->serija; ?></option>
		<?php endforeach; ?>
		</select></span></div>
		<!--div class="od"><label>Od: </label>						<span><?php print (isset($_POST['datum_od'])) ? 	$_POST['datum_od']: ''; ?></span></div>
		<div class="do"><label>Do: </label>						<span><?php print (isset($_POST['datum_do'])) ? 	$_POST['datum_do'] : '';?></span></div>
		<div class="znesek"><label>Znesek: </label>				<span><?php print (isset($_POST['znesek'])) ? 		$_POST['znesek'] : ''; ?> €</span></div>
		<div class="kilometrina"><label>Kilometrina: </label>	<span><?php print (isset($_POST['kilometrina'])) ? 	$_POST['kilometrina'] : ''; ?> €/km</span></div>
		<div class="avto_id"><label>Skupni znesek: </label>			<span><?php print $cena; ?></span></div>
		<div class="avto_id"><label>Kilometrov: </label>		<span><?php print (isset($last_elt['distance_sum'])) ? 		$last_elt['distance_sum'] : ''; ?></span></div>
		<div class="avto_id"><label>Kilometrina: </label>		<span><?php print (isset($last_elt['price_sum'])) ? 		$last_elt['price_sum'] : ''; ?></span></div-->
	</div>
	
	<div id="data-preview">
	
	<?php //if (isset($final_array) && is_array($final_array) && !empty($final_array)): ?>
	<!--table class="list no-zebra wide izracunstroskov">
		<thead><tr>
			<td>Datum</th>
			<td>Pot</th>
			<td>km</th>
			<td>€</th>
			<td>St. izpisa</th>
			<td>#</th>
		</tr></thead>
		<tbody-->
	<?php //$serija=1; 
		include "/scripts/izpis.php"; ?>
	<br>
	<!--a href="javascript:dodajNalog();">Dodaj nalog</a><br>
	<div id="dodaj_nalog" style="display:hidden">
	<form name="input" action="" method="POST" autocomplete="off">Datum: <input type="text" name="datum" class="datepicker"> Pot: <select name="pot"><option>Senožeti - Ljubljana</option><option>Ljubljana - Koper</option></select><input type="submit" name="shraniNalog" value="Shrani"></form></div-->
	<script type="text/javascript">
	function dodajNalog() 
    {
        var div = document.getElementById("dodaj_nalog");
        if (div.style.display == "block") 
        {
            div.style.display = "none";
        }
        else 
        {
            div.style.display = "block";
        }
    }
	
	function izpis(){
		var serija=document.getElementById("izpis").value;
		if (window.XMLHttpRequest){	
		xmlhttp=new XMLHttpRequest();
		}
		else{	
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange=function(){
			if (xmlhttp.readyState==4 && xmlhttp.status==200){
				document.getElementById("data-preview").innerHTML=xmlhttp.responseText;
			}
		}
		xmlhttp.open("GET","../scripts/izpis.php?serija="+serija, false);
		xmlhttp.send();
	}	
	</script>
	</div>
</div>
