<?php
@session_start();



$_SESSION[ "title" ] = "&Uuml;bersicht Vertr&auml;ge";


// Welche Javascript-Dateien sollen geladen werden? Dateien müssen im js-Verzeichnis liegen
$_SESSION[ "javascript_dateien" ] = ""; //  "js_datei_1.js|js_datei_2.js"

// Welche Javascript-Befehle sollen beim Laden des Dokuments ausgeführt werden?
$_SESSION[ "javascript_startup" ] = '$(function() {
		$( ".date-pick" ).datepicker({ showAnim: "clip", buttonImageOnly: true,  showOn: "both", buttonImage: "img/kalender.png", showWeek: true });
		$( "#suchergebnis" ).accordion({collapsible: true, active: false, event: "click", autoHeight: false });
	});';

	
include( 'ssi_header.php' );
$_SESSION[ "title" ] = "";


echo "<div style='margin-left:2px; padding-bottom:30px;  min-height:550px;'>";

$status = liefere_wertemenge_elemente( $mandant_name, "vertragsmanagement_v_status" );
$art = liefere_wertemenge_elemente( $mandant_name, "vertragsmanagement_v_art" );

$status_options = "<option />";
foreach( $status[ 2 ] as $element )
{
	$status_options = $status_options."<option value='".$element[ "alpha_01" ]."'>".$element[ "alpha_01" ]."</option>";
}

$art_options = "<option />";
foreach( $art[ 2 ] as $element )
{
	$art_options = $art_options."<option value='".$element[ "alpha_01" ]."'>".$element[ "alpha_01" ]."</option>";
}

echo "<form name='vertraege_suchen' action='' method='post'>";

echo "<table border='0' style='margin-left:20px; ' >";

echo "<tr><td style='width:220px;'>Nummer</td><td ><input style='width:250px;' type='text' name='alpha_01' ></td></tr>";
echo "<tr><td style='width:220px;'>Vertragspartner</td><td ><input style='width:250px;' type='text' name='alpha_02' ></td></tr>";
echo "<tr><td style='width:220px;'>Gegenstand</td><td ><input style='width:250px;' type='text' name='alpha_02' ></td></tr>";
echo "<tr><td style='width:220px;'>Status</td><td ><select style='width:255px;'  name='alpha_03' >".$status_options."</select></td></tr>";
echo "<tr><td style='width:220px;'>Art</td><td ><select style='width:255px;'  name='alpha_04' >".$art_options."</select></td></tr>";
echo "<tr><td style='width:220px;'>Vertragsbeginn von-bis</td><td ><input style='width:100px;' type='text' name='datum_01_v' class='date-pick' > - <input style='width:100px;' type='text' name='datum_01_b' class='date-pick' ></td></tr>";


echo "</table>
<input type='button' value='Finden!' onclick='' style='margin-left:100px;width:170px;' /><input type='reset' style='width:170px;'  value='Eingabefelder leeren' />";



echo "</form>";

echo "<p />";

$e = variable_recherche( $mandant_name, "vertragsmanagement", $benutzer_anmeldename, array(  ) );
echo "<div id='suchergebnis'  >";
//xlog( 4, json_encode( $e ) );
if ( $e[ 0 ] > 0 )
{
	foreach( $e[ 2 ] as $element )
	{
		$liste = "";
		$k = liefere_verknuepfte_dokumente( $mandant_name, $element[ "dok_id" ] );
		foreach( $k[ 2 ] as $ele )
		{
			$liste = $liste.$ele." | ";
		}
		$liste = substr( $liste, 0, -3 );
		echo "<h3><a href='#'><table style='width:100%;'><tr><td style='width:150px;'>".$element[ "alpha_02" ]."</td><td style='width:150px;'>".$element[ "alpha_03" ]."</td><td style='width:150px;'>".$element[ "alpha_04" ]."</td><td style='align: right; width:200px;'><input type='button' value='&Ouml;ffnen'/></td></tr></table></a></h3>";
		echo "<div><table><tr><td>verknüpfte Dokumente (".$k[ 0 ].")</td><td>".$liste."</td></tr><tr><td>Erstellungsdatum</td><td>".date( "d.m.Y H:i", $element[ "archivierungsdatum" ] )." Uhr</tr></table></div>";
	}
	
}
/*<h3><a href="#">Section 1</a></h3>
	<div>
		<p>
		Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
		ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
		amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
		odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
		</p>
	</div>
*/


echo "</div>";
echo "</div>";

include( 'ssi_footer.php' );

?>