<?php

	include_once(__DIR__."/../../core.php");

	$module_name = 'Scadenzario';
	$iddocumento = $html->form('iddocumento');
	$id_record = $html->form('id_record');
	
	
	echo "<form id=\"link_form\" action=\"".$rootdir."/editor.php?id_module=".$modules_info[$module_name]['id']."&id_record=".$id_record."\" method=\"post\">\n";
	echo "	<input type='hidden' name='op' value='add_acconto'>\n";
	echo "	<input type='hidden' name='backto' value='record-edit'>\n";
	

	
	//Descrizione
	echo "	<div class='row'>\n";
	echo "		<div class='col-md-12'>\n";
	echo "			<label>Descrizione</label>\n";
	echo "			<textarea name='descrizione' id='descrizione' class='form-control'></textarea>\n";
	echo "		</div>\n";	
	echo "	</div>\n";

	echo "<br>";
	
	
	echo "<div class='panel panel-primary'>";
		echo "<div class='panel-body'>";
			//data
			echo "		<div class='col-md-3'>\n";	
				echo "		<label>Data </label>\n";	
				echo "		<div class='form-group'>\n";				
				echo "			<input type='text' class='form-control  datepicker text-center '  id='data_acconto' name='data_acconto' required=\"true\" value=\"".date("d")."/".date("m")."/".date("Y")."\">\n";												
				echo "		</div>\n";
			echo "	</div>\n";
			
			//Importo
			echo "		<div class='col-md-3'>\n";
				echo "			<div class='form-group'>\n";
				echo "				<label>Ricevuto</label>\n";
				echo "				<div class='input-group'>\n";
				echo "					<input type='text' class='form-control inputmask-decimal' id='subtot' name='subtot' value=\""."\"><span class='input-group-addon'>&euro;</span>\n";
				echo "				</div>\n";
				echo "			</div>\n";
			echo "		</div>\n";
				
			//Banca
				$query = "SELECT * FROM co_banche";
				$rs = $dbo->fetchArray($query);	
			echo "		<div class='col-md-4'>\n";
				echo "			<label>Banca</label>\n";
					echo "			<select id='idbanca' class='superselect' name=\"idbanca\">\n";														
					for( $i=0; $i<sizeof($rs); $i++ ){				
						echo "	<option value='".$rs[$i]['id']."' $attr>".$rs[$i]['nome']."</option>\n";
					}	
					echo "			</select>\n";	
				
			echo "		</div>\n";	

		echo "	</div>\n";
	echo "	</div>\n";
	
	

	?>


	<script type="text/javascript">
		
		$('.datepicker').datepicker();
		$('.timepicker').timepicker()
		
		function addriga(){
			if( $('#descrizione').val()!=''  ){
				$("#link_form").submit();
			}
		}
	</script>
	<script src="<?php echo $rootdir; ?>/lib/init.js"></script>


	<?php
	echo "	<a onclick=\"addriga();\" class=\"btn btn-primary pull-right\"><i class=\"fa fa-plus\"></i> Aggiorna</a>\n";
	echo "</form>\n";

	?>

	<div class="clearfix"></div>
