+Anlage-Vertrag, Form Laser
authorBettina Schwarzer <schwarzer@fhi-berlin.mpg.de>
Fri, 23 Dec 2011 15:03:37 +0100
changeset 21 97dba0fe820c
parent 20 5877137431e4
child 22 aae5b0ecc47b
+Anlage-Vertrag, Form Laser
fhiiqm/alrisk_ed.php
fhiiqm/alvtr_ed.php
fhiiqm/alvtr_flist.php
fhiiqm/anlage_flist.php
fhiiqm/css/db.css
fhiiqm/css/db_print.css
fhiiqm/form/alvtr_form.inc.php
fhiiqm/form/anlage_form.inc.php
fhiiqm/form/laser_form.inc.php
fhiiqm/form/recht_form.inc.php
fhiiqm/img/document_final.png
fhiiqm/img/laser.png
fhiiqm/inc/alvertrag_list_ac.inc.php
fhiiqm/inc/func_lib.inc.php
fhiiqm/inc/menu.inc.php
fhiiqm/laser_ed.php
fhiiqm/partner_upd.php
fhiiqm/raum_upd.php
fhiiqm/recht_ed.php
fhiiqm/start.php
fhiiqm/vertrag_flist1.php
fhiiqm/vertrag_flist2.php
fhiiqm/vertrag_upd.php
--- a/fhiiqm/alrisk_ed.php	Thu Dec 15 16:42:56 2011 +0100
+++ b/fhiiqm/alrisk_ed.php	Fri Dec 23 15:03:37 2011 +0100
@@ -117,7 +117,7 @@
                	<tr><td>&nbsp;</td>\n
                 	<td><input  class=\"button\" type=\"submit\" name=\"eintragen\" value=\"  eintragen  \" />";
                 if ($arid)
-                    echo "&nbsp;&nbsp;&nbsp;<input class=\"button\" type=\"submit\" value=\"l&ouml;schen\" name=\"del\" title=\"delete\" />";
+                    echo "&nbsp;&nbsp;&nbsp;<input class=\"buttonr\" type=\"submit\" value=\"l&ouml;schen\" name=\"del\" title=\"delete\" />";
                	echo "</td></tr>\n";
             }
             echo "</table>\n";
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fhiiqm/alvtr_ed.php	Fri Dec 23 15:03:37 2011 +0100
@@ -0,0 +1,194 @@
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 12/2011
+ */
+
+    error_reporting(E_ALL ^ E_NOTICE);
+    
+    session_start();
+    if (! isset($_SESSION["userid"]))
+    { 
+        include_once ("inc/func_lib.inc.php");	
+        login($_SERVER["PHP_SELF"]);
+        exit;
+    }
+    
+    if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("ar",$_SESSION["recht"]) && !in_array("ae",$_SESSION["recht"])))
+    {
+        header("Location: start.php");
+        exit;
+    }    
+    
+    include_once($_SERVER["DOCUMENT_ROOT"]."/fhiiqm/inc/dbconnect.inc.php");
+    if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
+
+
+    $al     = $_POST["al"];
+    $alcid   = $_GET["i"];  // al_ID_c_ID (z.B. 1_24)
+//    $copy   = $_GET["c"];
+    $sub    = $_POST["eintragen"];
+    $del    = $_POST["del"];
+//    $dup    = $_POST["dup"];
+//    if (!$dup) $dup = $_GET["d"];
+	$ok		= $_POST["ok"];
+    if (!$al['okn']) $ok=false;
+
+?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+
+<head>
+	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
+    <link type="text/css" href="/fhiiqm/css/db.css" rel="Stylesheet" media="screen"/>	
+    <link type="text/css" href="/fhiiqm/css/db_print.css" rel="Stylesheet" media="print"/>	
+    <link type="text/css" href="/fhiiqm/css/jquery/ui-lightness/jquery-ui-1.8.16.custom.css" rel="Stylesheet" />	
+    <script type="text/javascript" src="/fhiiqm/js/jquery/jquery-1.6.2.min.js"></script>
+    <script type="text/javascript" src="/fhiiqm/js/jquery/jquery-ui-1.8.16.custom.min.js"></script>
+    <title>Anlage - Vertrag</title>
+ </head>
+ 
+ <body>
+
+<?php
+    echo "&nbsp;";  
+    echo "<div class=\"float-br smaller\" valign='top'>";
+    echo "&nbsp;&nbsp;&nbsp;user: " . $_SESSION["userid"];
+    echo "&nbsp;&nbsp;&nbsp;<a class='sc' href='/fhiiqm/logout.php' title='Session beenden'>logout</a></div>\n";
+    echo "<div class=\"float-r\"><img src=\"img/rotate_01.png\" border=\"0\" alt=\"Anlage\" title=\"Anlage\"/></div>\n";
+?>
+
+    <div align='center'>
+
+    <script>
+      $(document).ready(function() {
+        $("#albez").focus();
+        $("#albez").autocomplete({
+                source: "/fhiiqm/inc/al_list_ac.inc.php",
+    			minLength: 2,
+                select: function(event,ui){$("#alid").val(ui.item.id);}
+    		});
+        $("#alcon").autocomplete({
+                source: "/fhiiqm/inc/alvertrag_list_ac.inc.php",
+    			minLength: 2,
+                select: function(event,ui){$("#cid").val(ui.item.id);}
+    		});
+        $("input").albez("long20").addClass("long20");
+        $("input").alcon("long30").addClass("long20");
+        });
+    </script>
+
+    <?php
+//        print_r($al);
+        
+        if ($alcid) $text = "editieren"; else $text = "erfassen";
+        echo "<h3>Anlage - Vertrag $text<h3>";
+        
+        echo "</div>\n";
+        
+        if (!$ok || (!$sub && !$del ))
+        {
+            if ($alcid && !$sub && !$del )
+            {   // ausgewaehlte id-Kombination
+                $al["alid"] = substr($alcid,0,strpos($alcid,"_"));
+                $al["cid"]  = substr($alcid,strpos($alcid,"_")+1);
+                $sql = "SELECT al_bez FROM fhiiqm.Anlage WHERE al_ID = " . $al["alid"];
+                $al["bez"] = $dbc -> querySingleItem($sql);
+                $sql = "SELECT contract_name FROM fhiiqm.Vertrag WHERE contract_ID = " . $al["cid"];
+                $al["con"] = $dbc -> querySingleItem($sql);
+            }
+            include ($_SERVER["DOCUMENT_ROOT"]."/fhiiqm/form/alvtr_form.inc.php");     
+            if ($sub || $del)
+    		{
+    		  	if ($sub)
+                    $frage = "Alle Angaben ok?";
+                elseif ($del)
+                    $frage = "Anlage<->Vertrag wirklich l&ouml;schen?";
+    			echo "<tr>
+    			  <td class=\"red\" valign=\"top\" align=\"left\">$frage</td>
+    			        <td><input type=\"checkbox\" name=\"ok\" value=\"1\"";
+    			        if ($ok)  echo "checked"; 
+    			echo "></td>\n</tr>\n"; 
+    		}
+            if (!is_null($_SESSION["recht"]) && in_array("ae",$_SESSION["recht"]))
+            {
+                echo "
+               	<tr><td>&nbsp;</td>\n
+                	<td><input  class=\"button\" type=\"submit\" name=\"eintragen\" value=\"  eintragen  \" />";
+                if ($alcid)
+                {
+                    echo "&nbsp;&nbsp;&nbsp;<input class=\"buttonr\" type=\"submit\" value=\"l&ouml;schen\" name=\"del\" title=\"delete\" />";
+                   // echo "&nbsp;&nbsp;&nbsp;<input class=\"button\" type=\"submit\" value=\"duplizieren\" name=\"dup\" title=\"delete\" />";
+                }    
+               	echo "</td></tr>\n";
+            }
+            echo "</table>\n";
+            echo "</div>\n";
+            if (!is_null($_SESSION["recht"]) && !in_array("ae", $_SESSION["recht"]))
+                echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"alvtr_flist.php\" target=\"_self\" title=\"Anlage-Vertrag\">&laquo; zur Anlage-Vertrag-Liste</a></p>\n"; 
+            echo "</form>\n";   
+        }
+        else
+        {
+//        print_r($al);
+            echo "<div align='center'>\n";
+            if ($alcid)
+            {   // ausgewaehlte id-Kombination
+                $alid   = substr($alcid,0,strpos($alcid,"_"));
+                $cid    = substr($alcid,strpos($alcid,"_")+1);
+            }
+            if ($del)
+            {
+                // DELETE - angewaehlter Vertrag zu Anlage
+                $sql = "DELETE FROM fhiiqm.Anlage_Vertrag WHERE al_ID=$alid AND contract_ID=$cid";
+                $resd = $dbc -> execute($sql);
+                if ($resd)
+                    echo "<p class='green'><b>DELETE: Zuordnung  '".$al["bez"]."'zu  '". $al['con']."' wurde erfolgreich gel&ouml;scht.</b></p>\n";
+                else
+                {
+                    echo "<p class='red'><b>DELETE: L&ouml;schen Zuordnung  '".$al["bez"]."'zu  '". $al['con']."' ist fehlgeschlagen!</b></p>\n";
+                    echo "DELETE error:" . $dbc -> error;
+                }    
+            }
+            else
+            {
+                //INSERT oder UPDATE
+                if ($alcid)
+                {
+                    //UPDATE
+                    $txt = "UPDATE";
+                    //alte Zuordnung loeschen
+                    $sql = "DELETE FROM fhiiqm.Anlage_Vertrag WHERE al_ID=$alid AND contract_ID=$cid";
+                    if ($dbc -> execute($sql))
+                    {   // neue Zuordnung hinzufuegen
+                        $sql = "INSERT INTO fhiiqm.Anlage_Vertrag VALUES(" . $al["alid"] .", ". $al["cid"].")";
+                        $res = $dbc -> execute($sql);
+                    }
+                    else 
+                        echo "DELETE error:" . $dbc -> error;
+                    
+                }
+                else
+                {
+                    //INSERT
+                    $txt = "INSERT";
+                    $sql = "INSERT INTO fhiiqm.Anlage_Vertrag VALUES(" . $al["alid"] .", ". $al["cid"].")";
+                    $res = $dbc -> execute($sql);
+                }
+                if ($res)
+                    echo "<p class='green'><b>$txt: Zuordnung  '".$al["bez"]."'zu  '". $al['con']."' wurde erfolgreich gespeichert.</b></p>\n";
+                else
+                {
+                    echo "<p class='red'><b>$txt: Eintragen Zuordnung  '".$al["bez"]."'zu  '". $al['con']."' ist fehlgeschlagen!</b></p>\n";
+                    echo "$txt error:" . $dbc -> error;
+                }    
+            }
+            echo "</div>\n";            
+            echo "<p class=\"sc\">&nbsp;&nbsp;&nbsp;<a href=\"alvtr_flist.php\" target=\"_self\" title=\"Anlagen\">Anlage-Vertrag-Liste</a></p>\n";    
+            echo "<p class=\"sc\">&nbsp;&nbsp;&nbsp;<a href=\"alvtr_ed.php\" target=\"_self\" title=\"Anlage-Vertrag erfassen\">Weitere Zuordnung Anlage-Vertrag</a></p>";    
+        }
+    ?>
+ </body>
+ </html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fhiiqm/alvtr_flist.php	Fri Dec 23 15:03:37 2011 +0100
@@ -0,0 +1,206 @@
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 12/2011
+ * 
+ * Liste Anlagen-Vertraege (sortieren, filtern)
+ */
+
+    error_reporting(E_ALL ^ E_NOTICE);
+    
+    session_start();
+    if (! isset($_SESSION["userid"]))
+    { 
+        include_once ("inc/func_lib.inc.php");	
+        login($_SERVER["PHP_SELF"]);
+        exit;
+    }
+    
+    if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("ar",$_SESSION["recht"]) && !in_array("ae",$_SESSION["recht"])))
+    {
+        header("Location: start.php");
+        exit;
+    }    
+    
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+
+<head>
+	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
+   	<link href="css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen" /> 
+   	<link href="css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print" /> 
+
+	<title>Liste Anlagen-Vertr&auml;ge</title>
+</head>
+
+<body onload="document.ffilter.filter.focus();">
+    
+<?php
+    echo "&nbsp;";  
+    echo "<div class=\"float-br smaller\" valign='top'>";
+    echo "&nbsp;&nbsp;&nbsp;user: " . $_SESSION["userid"];
+    echo "&nbsp;&nbsp;&nbsp;<a class='sc' href='/fhiiqm/logout.php' title='Session beenden'>logout</a></div>\n";
+    echo "<div class=\"float-r\"><img src=\"img/rotate_01.png\" border=\"0\" alt=\"Anlage\" title=\"Anlage\"/></div>\n";
+
+    // Felder, nach denen gefiltert werden kann
+    $fields = array(1=>"Anlage-ID",3=>"Anlage",4=>"Vertrag",5=>"Vertragtyp");
+
+    $zeil = $_GET["z"];
+    if (!$zeil) $zeil = $_POST["z"];
+    if (!$zeil) $zeil = 25; // Anzahl der gezeigten Zeilen
+    $start = $_GET["st"];
+    if (!$start) $start=0;
+    
+	$sort   = $_GET["s"];   // Sortierung nach Spalte
+    if (!isset($sort) && !$sort) $sort = $_POST["s"];      
+
+    $dir    = $_GET["d"];   // Sortierrichtung
+    if (!isset($dir) && !$dir) $dir = $_POST["d"];
+
+    $fnum   = $_GET["f"];   // Spaltennummer, nach der aktuell gefiltert wird
+    if (!isset($fnum) && !$fnum) $fnum = $_POST["f"];
+
+    $filter = $_POST["filter"];
+    if (!isset($filter) && !$filter) $filter = $_GET["b"];   
+
+    $subf   = $_POST["subf"]; // submit
+    
+    if (!isset($fnum) && !$fnum) $fnum = 1;
+    if (!isset($filter) && !$filter) $filter = "";
+    if (!isset($sort) && !$sort) $sort = 2;
+    if (!isset($dir) && !$dir)  $dir = "";
+
+    include ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php");
+	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+	$dbc = new dbconnection();
+
+    $sql = "CALL alvtr_flist($sort,'" . $dir . "',$fnum, '" . $filter . "',$start,$zeil,@anz);"; 
+    // Parameter: Nr. Sortfeld, Sortierrichtung, Nr. Filterfeld, Filterbegriff, Anzahl gefundener Anlagen
+    // liefert: al_ID,contract_ID,al_bez,contract_name,vtyp_kurz,contract_begin,contract_end,verl,doc
+//    echo "sql = $sql<br />";  
+    $result = $dbc ->queryObjectArray($sql);
+
+    if ($result)
+    {
+		$bg1 = "#F8F8F8";
+		$bg2 = "#DEDFE1";
+		$bg = "#FFFFFF";
+     
+        echo "<div align='center'>\n";
+        echo "<p><b>Liste Vertr&auml;ge zu Anlagen</b></p>\n";
+        
+        echo "<table border='0' cellspacing='0'>\n";
+        echo "<tr><td class='bigger'>Mittels '<img src='/fhiiqm/img/auf.gif' border='0' width='11' hight='11' />' / '<img src='/fhiiqm/img/ab.gif' border='0' width='11' hight='11' />' 
+            können Sie nach relevanten Spalten auf- bzw. absteigend sortieren</td></tr>
+            <tr><td class='bigger'>'<img src='/fhiiqm/img/filter.gif' border='0' width='14' hight='11' />' erm&ouml;glicht das Filtern nach ausgew&auml;hlten Spalten der Liste</td></tr>
+            <tr><td class='bigger'>Klick auf '<img src='/fhiiqm/img/edit.gif' border='0' width='11' hight='11'>' - Bearbeiten Anlage-Vertrag</td>
+            </tr>\n";
+        echo "</table>\n";
+
+        $panz = $dbc -> querySingleItem("SELECT @anz");
+        printf ("<p>Anzahl Zuordnungen Anlage-Vertrag: %s</p>", $panz);
+        
+        if (isset($fnum) && $fnum>1 && !$filter && !$subf)
+        {
+            // Formular anzeigen fuer Filterbegriff
+            $text = $fields[$fnum];
+            echo "<form action=" . $_SERVER['PHP_SELF'] . " method='post' enctype='application/x-www-form-urlencoded' id='ffilter' name='ffilter' target='_self'>\n";
+            echo "<input type='hidden' name='s' value='$sort'>";
+            echo "<input type='hidden' name='d' value='$dir'>";
+            echo "<input type='hidden' name='f' value='$fnum'>";
+            echo "<table width=\"25%\" border=\"0\">\n";
+            echo "<tr><td>filtern nach $text: </td>";
+            echo "<td><input id='filter' name='filter' type=\"text\" size=\"10\" maxlength=\"30\" value=\"$filter\"/></td>";
+            
+            echo "<td><input class=\"button\" type=\"submit\" value=\"finden\" name=\"subf\" title=\"subf\" /></td></tr></table>\n";
+            echo "</form>\n";
+            echo "<p>&nbsp;&nbsp;&nbsp;</p>\n";
+        }
+        echo "<table width='70%'>\n";
+        
+        if ($filter>'!') echo "<tr><td class='bigger' colspan=6>Filter: ". $fields["$fnum"] . " wie '$filter'</td><tr>\n";
+
+        // Listenkopf generieren
+        echo "<tr bgcolor='#68ACBF'>";
+        tab_column(3,"Anlage",$sort,$dir,3,$fnum,$filter,$start,$zeil);
+        tab_column(4,"Vertrag",$sort,$dir,4,$fnum,$filter,$start,$zeil);
+        tab_column(5,"Vertragtyp",$sort,$dir,5,$fnum,$filter,$start,$zeil);
+        tab_column(6,"VBeginn",$sort,$dir,0,$fnum,$filter,$start,$zeil);
+        tab_column(7,"VEnde",$sort,$dir,0,$fnum,$filter,$start,$zeil);
+        echo "<th>VVerl&auml;ng.</th>";
+        echo "<th>VDokument</th>";
+
+        echo "<th>&nbsp;</th></tr>\n";
+        
+        foreach ($result as $row)
+        {
+			if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
+            echo "<tr bgcolor='" . $bg . "'><td>$row->al_bez</td>";
+            echo "<td>" .nl2br($row->contract_name)."</td>";    
+            echo "<td>$row->vtyp_kurz</td>";
+            if ($row->contract_begin)
+            {
+                $cb = new DateTime($row->contract_begin);    
+                echo "<td>". $cb->format('d.m.Y')."</td>";
+            }
+            else  echo "<td>&nbsp;</td>";       
+            if ($row->contract_end)
+            {
+                $ce = new DateTime($row->contract_end);
+                echo "<td>".$ce->format('d.m.Y')."</td>";
+            }    
+            else  echo "<td>&nbsp;</td>";
+            echo "<td>$row->verl</td>";       
+            if (file_exists("documents/".$row->doc))
+            {
+                $doc = substr($row->doc,strpos($row->doc,"_")+1); 
+                echo "<td><a href='documents/$row->doc'>$doc</a></td>";
+            }    
+            else    
+                echo "<td>$row->doc</td>";
+
+            $alcid = $row->al_ID."_".$row->contract_ID;
+            echo "<td><a href='/fhiiqm/alvtr_ed.php?i=$alcid'><img src=\"/fhiiqm/img/edit.gif\" alt='edit' title='edit' border='0'/></a></td></tr>\n";
+        }
+        echo "</table></div>\n";
+
+        echo "<br />&nbsp;&nbsp;&nbsp;";
+        
+        // Sortierung und Filter aus $_GET fuer weitere Seiten
+        foreach ($_GET as $key=>$val)
+        {
+            if ($key != "st") $liste .= "&" . $key ."=".$val;
+        }    
+        // Sortierung und Filter aus $_POST fuer weitere Seiten
+        if ($subf)
+        foreach ($_POST as $key=>$val)
+        {
+            if ($key != "st" && $key != "subf" && $key != "filter") $liste .= "&" . $key ."=".$val;
+            if ($key == "filter") $liste .= "&b=" . $val;
+        }    
+        
+        // Links auf andere Seiten generieren
+        liste_links($start,$zeil,$panz,$liste);
+
+    }
+    else
+    {
+        if ($dbc -> error)  
+            echo "error: " . $dbc -> error . "<br />\n";
+        else
+        {
+            echo "<p class='red'>&nbsp;&nbsp;&nbsp;Leider nichts gefunden f&uuml;r ". $fields["$fnum"] . " wie '$filter'!</p><br />";
+            echo "&nbsp;&nbsp;&nbsp;<a href=\"" . $_SERVER["PHP_SELF"] . "\" target=\"_self\" title=\"Anlagen-Vertr&auml;ge\" class=\"sc\">Liste Anlagen-Vertr&auml;ge</a></p>\n";
+        }
+        
+    }
+    $dbc -> close();
+    if (!is_null($_SESSION["recht"]) && in_array("ae",$_SESSION["recht"]))
+        echo "<p>&nbsp;&nbsp;&nbsp;<a href=\"/fhiiqm/anlage_ed.php\" target=\"_self\" title=\"Anlage-Vertrag erfassen\" class=\"sc\">Vertrag zu Anlage erfassen</a></p>\n";    
+    echo "<p>&nbsp;&nbsp;&nbsp;<a href=\"/fhiiqm/anlage_flist.php\" target=\"_self\" title=\"Anlagenliste\" class=\"sc\">Anlagenliste</a>";    
+    echo "&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href=\"/fhiiqm/vertrag_flist1.php\" target=\"_self\" title=\"Vertragsliste\" class=\"sc\">Vertragsliste</a></p>\n";    
+
+?>
+</body>
\ No newline at end of file
--- a/fhiiqm/anlage_flist.php	Thu Dec 15 16:42:56 2011 +0100
+++ b/fhiiqm/anlage_flist.php	Fri Dec 23 15:03:37 2011 +0100
@@ -95,10 +95,11 @@
         echo "<tr><td class='bigger'>Mittels '<img src='/fhiiqm/img/auf.gif' border='0' width='11' hight='11' />' / '<img src='/fhiiqm/img/ab.gif' border='0' width='11' hight='11' />' 
             können Sie nach relevanten Spalten auf- bzw. absteigend sortieren</td></tr>
             <tr><td class='bigger'>'<img src='/fhiiqm/img/filter.gif' border='0' width='14' hight='11' />' erm&ouml;glicht das Filtern nach ausgew&auml;hlten Spalten der Liste</td></tr>
-            <tr><td class='bigger'>Klick auf '<img src='/fhiiqm/img/edit.gif' border='0' width='11' hight='11'>' - Bearbeiten der Anlage, 
-            '<img src='/fhiiqm/img/duplicate.gif' border='0' hight='11'>' - Duplizieren der Anlage, 
-            '<img src='/fhiiqm/img/details.gif' border='0' hight='11'>' - Pr&uuml;fungen der Anlage, 
-            '<img src='/fhiiqm/img/fire.png' border='0' hight='11'>' - Risiken der Anlage</td>
+            <tr><td class='bigger'>Klick auf '<img src='/fhiiqm/img/edit.gif' border='0' width='11' hight='11'>' - Bearbeiten , 
+            '<img src='/fhiiqm/img/duplicate.gif' border='0' hight='11'>' - Duplizieren  , 
+            '<img src='/fhiiqm/img/details.gif' border='0' hight='11'>' - Pr&uuml;fungen  , 
+            '<img src='/fhiiqm/img/fire.png' border='0' hight='11'>' - Risiken  ,
+            '<img src='/fhiiqm/img/document_final.png' border='0' hight='11'>' - Vertr&auml;ge der Anlage</td>
             </tr>\n";
         echo "</table>\n";
 
@@ -135,11 +136,12 @@
         tab_column(7,"Pr&uuml;fintervall",$sort,$dir,7,$fnum,$filter,$start,$zeil);
         tab_column(8,"Haus",$sort,$dir,8,$fnum,$filter,$start,$zeil);
         tab_column(9,"Raum-Nr.",$sort,$dir,9,$fnum,$filter,$start,$zeil);
-        tab_column(10,"Verantwortlicher",$sort,$dir,10,$fnum,$filter,$start,$zeil);
+        tab_column(10,"Verantwortl.",$sort,$dir,10,$fnum,$filter,$start,$zeil);
 
         echo "<th>&nbsp;</th>";
         echo "<th>&nbsp;</th>";
         echo "<th>&nbsp;</th>";
+        echo "<th>&nbsp;</th>";
         echo "<th>&nbsp;</th></tr>\n";
         
         foreach ($result as $row)
@@ -159,7 +161,9 @@
             echo "<td><a href='/fhiiqm/alpruef_flist.php?s=3&d=DESC&f=5&b=$row->al_ID&st=0&z=25'>
                 <img src=\"/fhiiqm/img/details.gif\" alt='Pr&uuml;fungen' title='Pr&uuml;fungen' border='0'/></a></td>";
             echo "<td><a href='/fhiiqm/alrisk_flist.php?s=2&d=&f=5&b=$row->al_ID&st=0&z=25'>
-                <img src=\"/fhiiqm/img/fire.png\" alt='Risiken' title='Risiken' border='0'/></a></td></tr>\n";
+                <img src=\"/fhiiqm/img/fire.png\" alt='Risiken' title='Risiken' border='0'/></a></td>";
+            echo "<td><a href='/fhiiqm/alvtr_flist.php?s=3&d=&f=1&b=$row->al_ID&st=0&z=25'>
+                <img src=\"/fhiiqm/img/document_final.png\" alt='Vertrag' title='Vertrag' border='0'/></a></td></tr>\n";
         }
         echo "</table></div>\n";
 
--- a/fhiiqm/css/db.css	Thu Dec 15 16:42:56 2011 +0100
+++ b/fhiiqm/css/db.css	Fri Dec 23 15:03:37 2011 +0100
@@ -187,7 +187,7 @@
     border-style:outset;
     border-color: #a5adbd; 
     text-decoration: none;
-    color: #FF0000;
+    color: #EE1111;
     background-color: #a5adbd}
     
 .float{
--- a/fhiiqm/css/db_print.css	Thu Dec 15 16:42:56 2011 +0100
+++ b/fhiiqm/css/db_print.css	Fri Dec 23 15:03:37 2011 +0100
@@ -140,7 +140,7 @@
     border-style:outset;
     border-color: #a5adbd; 
     text-decoration: none;
-    color: #FF0000;
+    color: #EE1111;
     background-color: #a5adbd}
     
 .float{
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fhiiqm/form/alvtr_form.inc.php	Fri Dec 23 15:03:37 2011 +0100
@@ -0,0 +1,86 @@
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 12/2011
+ * 
+ * Form Anlage - Vertrag
+ */
+
+	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+	if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
+    $okn = true;
+
+?>
+<div align="center">
+<table>
+<tr><td class="bigger">Die Auswahl einer Anlage und eines Vertrages geschieht durch<br />Eingeben von mindesten 2 Zeichen in das entsprechende Feld.
+</td></tr>
+<tr><td class="bigger">Umlaute wie '&auml;', '&uuml;', '&ouml;', '&szlig;' werden nicht gefunden, bitte benachbarte Zeichen eingeben.</td></tr>
+<tr><td class="bigger">&nbsp;</td></tr>
+</table>
+</div>
+<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" enctype="application/x-www-form-urlencoded" name="fanl"> 
+<div align="center">
+    <table border="0" cellspacing="3" cellpadding="3">
+<!--        <div class="ui-widget"> -->
+        <tr><td>Anlagenbezeichnung *</td>
+            <td valign="top"><input type="text" name="al[bez]" id="albez" class="long20" value="<?php echo $al['bez']; ?>"/>
+            <?php 
+			     if (isset($al['bez']) && $al['bez']<'!')
+				{
+					echo "<br><span class=\"red\">Anlagenbezeichnung ist erforderlich!</span>\n";
+					$okn = false;
+				}
+				else
+					if ($okn) $okn = true; else $okn=false;
+             ?> 
+            </td>
+        </tr>
+        <tr><td>Vertragsbezeichnung *</td>
+            <td valign="top"><input type="text" name="al[con]" id="alcon" class="long30"  value="<?php echo $al['con']; ?>"/>
+            <?php 
+			     if (isset($al['con']) && $al['con']<'!')
+				{
+					echo "<br><span class=\"red\">Vertragsbezeichnung ist erforderlich!</span>\n";
+					$okn = false;
+				}
+				else
+					if ($okn) $okn = true; else $okn=false;
+             ?> 
+            </td>
+        </tr>
+        <?php
+            if ($al["cid"])
+            {
+                $sql = "SELECT contract_l,vtyp_kurz,contract_begin,contract_end,contract_autoend, 
+                            CASE contract_autoend WHEN 1 THEN 'automatisch' ELSE '' END AS verl 
+                    FROM fhiiqm.Vertrag v LEFT OUTER JOIN fhiiqm.Vertrag_Typ t ON v.vtyp_ID=t.vtyp_ID
+                    WHERE contract_ID = " . $al["cid"];
+                if ($result = $dbc ->queryObjectArray($sql))
+                {
+                    foreach ($result as $row)
+                    {
+                        echo "<tr><td>Vertrag Beschreibung</td><td>".nl2br($row->contract_l)."</td></tr>";
+                        echo "<tr><td>Vertragstyp</td><td>$row->vtyp_kurz</td></tr>\n";  
+                        if ($row->contract_begin)
+                        {
+                            $cb = new DateTime($row->contract_begin);    
+                            echo "<tr><td>Vertragsbeginn</td><td>". $cb->format('d.m.Y')."</td></tr>\n";
+                        }
+                        else  echo "<tr><td>Vertragsbeginn</td><td>&nbsp;</td></tr>\n";       
+                        if ($row->contract_end)
+                        {
+                            $ce = new DateTime($row->contract_end);
+                            echo "<tr><td>Vertragsende</td><td>".$ce->format('d.m.Y')."</td></tr>\n";
+                        }    
+                        else  echo "<tr><td>Vertragsende</td><td>&nbsp;</td></tr>\n";       
+                        echo "<tr><td>Vertragsverlängerung</td><td>$row->verl</td></tr>\n";  
+                   }
+                }
+            }        
+        ?>
+    <input type="hidden" name="al[alid]" id="alid" value="<?php echo $al['alid']; ?>"/>
+    <input type="hidden" name="al[cid]" id="cid" value="<?php echo $al['cid']; ?>"/>
+    <input type="hidden" name="al[okn]" value="<?php echo $okn; ?>"/>
+
--- a/fhiiqm/form/anlage_form.inc.php	Thu Dec 15 16:42:56 2011 +0100
+++ b/fhiiqm/form/anlage_form.inc.php	Fri Dec 23 15:03:37 2011 +0100
@@ -26,7 +26,7 @@
     <table border="0" cellspacing="3" cellpadding="3">
 <!--        <div class="ui-widget"> -->
         <tr><td>Anlagenbezeichnung *</td>
-            <td valign="top"><input type="text" name="al[bez]" id="albez" size="30" maxlength="50" value="<?php echo $al['bez']; ?>"/>
+            <td valign="top"><input type="text" name="al[bez]" id="albez" size="50" maxlength="50" value="<?php echo $al['bez']; ?>"/>
             <?php 
 			     if (isset($al['bez']) && $al['bez']<'!')
 				{
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fhiiqm/form/laser_form.inc.php	Fri Dec 23 15:03:37 2011 +0100
@@ -0,0 +1,274 @@
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 12/2011
+ * 
+ * Form Laser
+ */
+
+	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+	if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
+    $okn = true;
+    if (!$la["geb"]) $la["geb"]="A";
+
+?>
+<div align="center">
+<table>
+<tr><td class="bigger">Die Auswahl eines Verantwortlichen geschieht durch<br />Eingeben von mindesten 2 Zeichen in das entsprechende Feld.
+</td></tr>
+<tr><td class="bigger">Umlaute wie '&auml;', '&uuml;', '&ouml;', '&szlig;' werden nicht gefunden, bitte benachbarte Zeichen eingeben.</td></tr>
+<tr><td class="bigger">&nbsp;</td></tr>
+</table>
+</div>
+<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" enctype="application/x-www-form-urlencoded" name="fanl"> 
+<div align="center">
+    <table border="0" cellspacing="3" cellpadding="3">
+<!--        <div class="ui-widget"> -->
+        <tr><td>Laserbezeichnung *</td>
+            <td valign="top"><input type="text" name="la[lbez]" id="lbez" size="30" maxlength="250" value="<?php echo $la['lbez']; ?>"/>
+            <?php 
+			     if (isset($la['lbez']) && $la['lbez']<'!')
+				{
+					echo "<br><span class=\"red\">Laserbezeichnung ist erforderlich!</span>\n";
+					$okn = false;
+				}
+				else
+					if ($okn) $okn = true; else $okn=false;
+             ?> 
+            </td>
+        </tr>
+        <tr><td>Laserwelle von</td>
+            <td valign="top"><input type="text" name="la[wvon]" size="10" maxlength="7" value="<?php echo $la['wvon']; ?>"/>
+            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Laserwelle bis&nbsp;&nbsp;&nbsp;
+            <input type="text" name="la[wbis]" size="10" maxlength="7" value="<?php echo $la['wbis']; ?>"/></td>
+        </tr>
+        <tr><td>Schutzstufe</td>
+            <td><select name="la[suid]">
+                <?php
+                    if ($la['suid'] == -1) $select = " selected "; else $select = "";
+                    echo "<option $select value=\"-1\"></option>\n";
+                    $sql = "SELECT schutzst_ID, schutzst_bez FROM Schutzstufe ORDER BY 2";
+                    if ($res = $dbc -> queryObjectArray($sql))
+                    {
+                        $select = "";
+                        foreach ($res as $row)
+                        {
+                            if ($row->schutzst_ID == $la['suid']) $select="selected"; else $select="";
+                            echo "<option $select value='$row->schutzst_ID'>$row->schutzst_bez</option>\n";
+                        }
+                    }    
+                ?>
+            </select></td>
+        </tr>
+        <tr><td>Laserart</td>
+            <td><select name="la[lart]">
+                <?php
+                    if ($la['lart'] == -1) $select = " selected "; else $select = "";
+                    echo "<option $select value=\"-1\"></option>\n";
+                    $sql = "SELECT las_art_ID, las_art_bez FROM Laser_Art ORDER BY 2";
+                    if ($res = $dbc -> queryObjectArray($sql))
+                    {
+                        $select = "";
+                        foreach ($res as $row)
+                        {
+                            if ($row->las_art_ID == $la['lart']) $select="selected"; else $select="";
+                            echo "<option $select value='$row->las_art_ID'>$row->las_art_bez</option>\n";
+                        }
+                    }    
+                ?>
+            </select></td>
+        </tr>
+        <tr><td>Laserklasse</td>
+            <td><select name="la[lkla]">
+                <?php
+                    if ($la['lkla'] == -1) $select = " selected "; else $select = "";
+                    echo "<option $select value=\"-1\"></option>\n";
+                    $sql = "SELECT las_klasse_ID, las_klasse_bez FROM Laser_Klasse ORDER BY 2";
+                    if ($res = $dbc -> queryObjectArray($sql))
+                    {
+                        $select = "";
+                        foreach ($res as $row)
+                        {
+                            if ($row->las_klasse_ID == $la['lkla']) $select="selected"; else $select="";
+                            echo "<option $select value='$row->las_klasse_ID'>$row->las_klasse_bez</option>\n";
+                        }
+                    }    
+                ?>
+            </select></td>
+        </tr>
+        <tr><td>Lasertyp</td>
+            <td><select name="la[ltyp]">
+                <?php
+                    if ($la['ltyp'] == -1) $select = " selected "; else $select = "";
+                    echo "<option $select value=\"-1\"></option>\n";
+                    $sql = "SELECT las_typ_ID, las_typ_bez FROM Laser_Typ ORDER BY 2";
+                    if ($res = $dbc -> queryObjectArray($sql))
+                    {
+                        $select = "";
+                        foreach ($res as $row)
+                        {
+                            if ($row->las_typ_ID == $la['ltyp']) $select="selected"; else $select="";
+                            echo "<option $select value='$row->las_typ_ID'>$row->las_typ_bez</option>\n";
+                        }
+                    }    
+                ?>
+            </select></td>
+        </tr>
+        <tr><td>Leistung</td>
+            <td valign="top"><input type="text" name="la[leist]" size="10" maxlength="7" value="<?php echo $la['leist']; ?>"/>
+            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Einheit&nbsp;&nbsp;&nbsp;
+            <select name="la[eleist]">
+            <?php
+                $sql = "SELECT einheit_ID,einheit,einheit_beschr FROM Einheit WHERE laser=1 ORDER BY right(einheit,1),2";
+                    if ($ree = $dbc -> queryObjectArray($sql))
+                    {
+                        $select = "";
+                        foreach ($ree as $row)
+                        {
+                            if ($row->einheit_ID == $la['eleist']) $select="selected"; else $select="";
+                            echo "<option $select value='$row->einheit_ID'>$row->einheit&nbsp;&nbsp;&nbsp;($row->einheit_beschr)</option>\n";
+                        }
+                    }    
+            ?>
+            </select></td>
+        </tr>
+        <tr><td>Energie</td>
+            <td valign="top"><input type="text" name="la[eng]" size="10" maxlength="7" value="<?php echo $la['eng']; ?>"/>
+            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Einheit&nbsp;&nbsp;&nbsp;
+            <select name="la[eeng]">
+            <?php
+                    if ($ree)
+                    {
+                        $select = "";
+                        foreach ($ree as $row)
+                        {
+                            if ($row->einheit_ID == $la['eeng']) $select="selected"; else $select="";
+                            echo "<option $select value='$row->einheit_ID'>$row->einheit&nbsp;&nbsp;&nbsp;($row->einheit_beschr)</option>\n";
+                        }
+                    }    
+            ?>
+            </select></td>
+        </tr>
+        <tr><td>Apertur</td>
+            <td valign="top"><input type="text" name="la[apt]" size="10" maxlength="7" value="<?php echo $la['apt']; ?>"/>
+            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Einheit&nbsp;&nbsp;&nbsp;
+            <select name="la[eapt]">
+            <?php
+                    if ($ree)
+                    {
+                        $select = "";
+                        foreach ($ree as $row)
+                        {
+                            if ($row->einheit_ID == $la['eapt']) $select="selected"; else $select="";
+                            echo "<option $select value='$row->einheit_ID'>$row->einheit&nbsp;&nbsp;&nbsp;($row->einheit_beschr)</option>\n";
+                        }
+                    }    
+            ?>
+            </select></td>
+        </tr>
+        <tr><td>Frequenz</td>
+            <td valign="top"><input type="text" name="la[frq]" size="10" maxlength="7" value="<?php echo $la['frq']; ?>"/>
+            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Einheit&nbsp;&nbsp;&nbsp;
+            <select name="la[efrq]">
+            <?php
+                    if ($ree)
+                    {
+                        $select = "";
+                        foreach ($ree as $row)
+                        {
+                            if ($row->einheit_ID == $la['efrq']) $select="selected"; else $select="";
+                            echo "<option $select value='$row->einheit_ID'>$row->einheit&nbsp;&nbsp;&nbsp;($row->einheit_beschr)</option>\n";
+                        }
+                    }    
+            ?>
+            </select></td>
+        </tr>
+        <tr><td>Impulsbreite</td>
+            <td valign="top"><input type="text" name="la[ipb]" size="10" maxlength="7" value="<?php echo $la['ipb']; ?>"/>
+            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Einheit&nbsp;&nbsp;&nbsp;
+            <select name="la[eipb]">
+            <?php
+                    if ($ree)
+                    {
+                        $select = "";
+                        foreach ($ree as $row)
+                        {
+                            if ($row->einheit_ID == $la['eipb']) $select="selected"; else $select="";
+                            echo "<option $select value='$row->einheit_ID'>$row->einheit&nbsp;&nbsp;&nbsp;($row->einheit_beschr)</option>\n";
+                        }
+                    }    
+            ?>
+            </select></td>
+        </tr>
+        <tr><td>aktiv</td>
+            <td><input type="checkbox" name="la[akt] <?php echo ($la["akt"] )?  "checked" : "";?>"/></td>
+        </tr>
+        <tr>
+            <td>Hersteller (Firma)</td>
+            <td>
+                <select name="la[hstid]">
+                <?php 
+                    if ($la['hstid'] == -1) $select = " selected "; else $select = "";
+                    echo "<option $select value=\"-1\"></option>\n";
+                    $sql = "SELECT las_hersteller_ID, las_hersteller_bez FROM Hersteller ORDER BY 2";
+                    if ($result = $dbc->queryObjectArray($sql))
+                    {
+                        foreach ($result as $row)
+                        {
+                            if ($row->las_hersteller_ID == $la['hstid']) $select="selected"; else $select="";
+        					   echo "<option $select value=\"$row->las_hersteller_ID\">$row->las_hersteller_bez</option>\n";
+                        }
+                }
+                ?>
+                </select> oder neu
+                <input name="la[herst]" type="text" size="30" maxlength="50" value="<?php echo $la['herst']; ?>"/>        
+            </td>
+        </tr>
+        <tr><td>Standort</td>
+            <td valign="top">Haus&nbsp;
+                 <select name="la[geb]" onchange="this.form.submit();">
+                <?php 
+                    $sql = "SELECT geb_ID, geb_name FROM `fhiiqm`.`Haus` ORDER BY 1";
+                    if ($result = $dbc->queryObjectArray($sql))
+                    {
+                        foreach ($result as $row)
+                        {
+                            if ($row->geb_ID == $la['geb']) $select="selected"; else $select="";
+        					   echo "<option $select value=\"$row->geb_ID\">$row->geb_ID: $row->geb_name</option>\n";
+                        }
+                }
+                ?>
+                </select>
+                &nbsp;&nbsp;Raum&nbsp;            
+                 <select name="la[raum]">
+                <?php 
+                    if ($la['raum'] == -1) $select = " selected "; else $select = "";
+                    echo "<option $select value=\"-1\"></option>\n";
+                    $sql = "SELECT raum_ID, raum_nr, raum_name FROM `fhiiqm`.`Raum` WHERE geb_ID='" . $la['geb'] ."' ORDER BY 2";
+                    if ($result = $dbc->queryObjectArray($sql))
+                    {
+                        foreach ($result as $row)
+                        {
+                            if ($row->raum_ID == $la['raum']) $select="selected"; else $select="";
+        					   echo "<option $select value=\"$row->raum_ID\">$row->raum_nr $row->raum_name</option>\n";
+                        }
+                }
+                ?>
+                </select>
+            </td>
+        </tr>
+        <tr><td>Verantwortlicher</td>
+            <td valign="top"><input class="long20" type="text" name="la[persknr]" id="persknr" value="<?php echo $la['persknr']; ?>"/>
+            </td>
+        </tr>
+        <tr><td>Laser-Infos</td>
+            <td><textarea name="la[linfo]" cols="50" rows="4"><?php echo $la['linfo']; ?></textarea></td>
+        </tr>
+
+    <input type="hidden" name="la[pid]" id="pid" value="<?php echo $la['pid']; ?>"/>
+    <input type="hidden" name="la[okn]" value="<?php echo $okn; ?>"/>
+<!--
+</div>
+</form>
+</table>    -->
\ No newline at end of file
--- a/fhiiqm/form/recht_form.inc.php	Thu Dec 15 16:42:56 2011 +0100
+++ b/fhiiqm/form/recht_form.inc.php	Fri Dec 23 15:03:37 2011 +0100
@@ -105,7 +105,7 @@
             &nbsp;&nbsp;&nbsp;gewünschten Listeneinträge
         </td>
         <td>
-            <select name="rt[recht][]" size="16" multiple="multiple"<?php echo $da; ?>>
+            <select name="rt[recht][]" size="18" multiple="multiple"<?php echo $da; ?>>
                 <?php
 //                    $select = null;
 //                    if (is_array($rt['recht'])) $select = in_array( "-1", $rt['recht'] ) ? ' selected' : null;
Binary file fhiiqm/img/document_final.png has changed
Binary file fhiiqm/img/laser.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fhiiqm/inc/alvertrag_list_ac.inc.php	Fri Dec 23 15:03:37 2011 +0100
@@ -0,0 +1,33 @@
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 12/2011
+ *
+ * Autocomplete Vertraege Anlagen
+ */
+
+    header('Content-type: text/html; charset="iso-8859-1',true); //wg. jquery ui autocomplete
+    error_reporting(E_ALL ^ E_NOTICE);
+    
+    $q = strtolower($_GET["term"]); // wird in jquery in 'term' uebergeben
+
+    
+	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+	$dbc = new dbconnection();
+    // label = angezeigter ListenWert, val = Wert im Eingabefeld nach Klick
+    $sql = "SELECT contract_name as label, contract_name as val, contract_ID as id 
+            FROM fhiiqm.Vertrag
+            WHERE contract_name LIKE '%".$q."%' COLLATE latin1_general_ci 
+            ORDER BY 1";
+    $result = $dbc ->queryObjectArray($sql);
+    if ($result)
+    {
+        foreach ($result as $row)
+        {
+ 			$clist[] = "{\"label\": \"" . $row->label . "\",\"value\": \"" . $row->val . "\",\"id\": " . $row->id . "}";
+		}
+        echo "[" . implode(", ", $clist) . "]"; // Format, das jquery source erwartet
+    }
+    $dbc -> close();
+?>
\ No newline at end of file
--- a/fhiiqm/inc/func_lib.inc.php	Thu Dec 15 16:42:56 2011 +0100
+++ b/fhiiqm/inc/func_lib.inc.php	Fri Dec 23 15:03:37 2011 +0100
@@ -100,7 +100,7 @@
        /** zeigt Login-Form, prueft userid und passwort, leitet zu gewuenschter Seite weiter
         *   Parameter
         *   $target     Zieladresse
-        *   headl       Ueberschrift Loginform
+        *   $headl      Ueberschrift Loginform
         */
           
        session_start();
@@ -208,15 +208,22 @@
     
     function duplicate_record ($table, $key_name, $key_value) 
     {
+       /** dupliziert Datensatz in table
+        *   Parameter
+        *   $table      Tabellenname
+        *   $key_name   Name ID-Spalte
+        *   $key_value  Wert ID des DSes, der dupliziert werden soll
+        */
+         
     	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
         global $dbc; // Verbindung ist schon da? 
     	if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
 
-        // Get the names of all fields/columns in the table
+        // erfragen Namen aller Felder in $table
         $sql = 'SHOW COLUMNS FROM ' . $table . ';';
         $result = $dbc -> queryObjectArray($sql);
         
-        // Generate the duplication query with those fields except the key
+        // Generieren der INSERT-Abfrage mit allen Feldern ausser ID-Feld
         $query = 'INSERT INTO ' . $table . ' (SELECT ';
         
         foreach ($result as $row) 
@@ -234,7 +241,7 @@
         $ret = $dbc -> execute($query);
         if ($ret)
         { 
-            // Return the new id
+            // Return new id
             $new_id = $dbc -> insertId();
             return $new_id;
         }
--- a/fhiiqm/inc/menu.inc.php	Thu Dec 15 16:42:56 2011 +0100
+++ b/fhiiqm/inc/menu.inc.php	Fri Dec 23 15:03:37 2011 +0100
@@ -81,6 +81,10 @@
             		echo "<li><a href=\"/fhiiqm/alrisk_flist.php\" target=\"_blank\" title=\"Anlagenrisiken\">Anlagenrisiken sortieren, filtern, bearbeiten</a></li>\n";
           if (in_array("ae",$_SESSION["recht"]))
             		echo "<li><a href=\"/fhiiqm/alrisk_ed.php\" target=\"_blank\" title=\"Anlagenrisiko erfassen\">Anlagenrisiko erfassen</a></li>\n";
+          if (in_array("ar",$_SESSION["recht"]) || in_array("ae",$_SESSION["recht"]))
+            		echo "<li><a href=\"/fhiiqm/alvtr_flist.php\" target=\"_blank\" title=\"Anlagen-Vertr&auml;ge\">Anlagen-Vertr&auml;ge sortieren, filtern, bearbeiten</a></li>\n";
+          if (in_array("ae",$_SESSION["recht"]))
+            		echo "<li><a href=\"/fhiiqm/alvtr_ed.php\" target=\"_blank\" title=\"Anlage-Vertrag erfassen\">Anlage-Vertrag erfassen</a></li>\n";
     	  echo "   </ul>\n
                 </li>\n";
         }	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fhiiqm/laser_ed.php	Fri Dec 23 15:03:37 2011 +0100
@@ -0,0 +1,190 @@
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 12/2011
+ */
+
+    error_reporting(E_ALL ^ E_NOTICE);
+    
+    session_start();
+    if (! isset($_SESSION["userid"]))
+    { 
+        include_once ("inc/func_lib.inc.php");	
+        login($_SERVER["PHP_SELF"]);
+        exit;
+    }
+    
+    if (is_null($_SESSION["recht"]) || (!is_null($_SESSION["recht"]) && !in_array("lr",$_SESSION["recht"]) && !in_array("le",$_SESSION["recht"])))
+    {
+        header("Location: start.php");
+        exit;
+    }    
+    
+    include_once($_SERVER["DOCUMENT_ROOT"]."/fhiiqm/inc/dbconnect.inc.php");
+    if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
+
+
+    $la     = $_POST["la"];
+    $laid   = $_GET["i"];
+    $copy   = $_GET["c"];
+    $sub    = $_POST["eintragen"];
+    $del    = $_POST["del"];
+    $dup    = $_POST["dup"];
+    if (!$dup) $dup = $_GET["d"];
+	$ok		= $_POST["ok"];
+    if (!$la['okn']) $ok=false;
+    $duptext="";
+
+    if ($dup)
+    {   // Anlage duplizieren
+        include_once ($_SERVER["DOCUMENT_ROOT"]."/fhiiqm/inc/func_lib.inc.php");
+        $tab = "Laser";
+        $key = "las_ID";
+        $val =  $laid;
+//        $ret=1;
+        $ret = duplicate_record ($tab, $key, $val);
+        if ($ret)
+        { 
+            $laid=$ret;
+            $addr = $_SERVER["PHP_SELF"] . "?i=$laid&c=1";
+            header("Location: $addr");
+            exit;
+        }
+        else $duptext = " - Fehler beim Duplizieren von ". $al["bez"];    
+    }
+
+?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+
+<head>
+	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
+    <link type="text/css" href="/fhiiqm/css/db.css" rel="Stylesheet" media="screen"/>	
+    <link type="text/css" href="/fhiiqm/css/db_print.css" rel="Stylesheet" media="print"/>	
+    <link type="text/css" href="/fhiiqm/css/jquery/ui-lightness/jquery-ui-1.8.16.custom.css" rel="Stylesheet" />	
+    <script type="text/javascript" src="/fhiiqm/js/jquery/jquery-1.6.2.min.js"></script>
+    <script type="text/javascript" src="/fhiiqm/js/jquery/jquery-ui-1.8.16.custom.min.js"></script>
+    <title>Laser</title>
+ </head>
+ 
+ <body>
+
+<?php
+    echo "&nbsp;";  
+    echo "<div class=\"float-br smaller\" valign='top'>";
+    echo "&nbsp;&nbsp;&nbsp;user: " . $_SESSION["userid"];
+    echo "&nbsp;&nbsp;&nbsp;<a class='sc' href='/fhiiqm/logout.php' title='Session beenden'>logout</a></div>\n";
+    echo "<div class=\"float-r\"><img src=\"img/laser.png\" border=\"0\" alt=\"Laser\" title=\"Laser\"/></div>\n";
+?>
+
+    <div align='center'>
+
+    <script>
+      $(document).ready(function() {
+        $("#lbez").focus();
+        $("#persknr").autocomplete({
+                source: "/fhiiqm/inc/ma_list_ac.inc.php",
+    			minLength: 2,
+                select: function(event,ui){$("#pid").val(ui.item.id);}
+    		});
+        $("input").persknr("long20").addClass("long20");
+        });
+    </script>
+
+    <?php
+//        print_r($al);
+        
+        if ($laid) $text = "editieren"; else $text = "erfassen";
+        if ($copy) $duptext = " (Kopie)";
+        echo "<h3>Laser $text$duptext<h3>";
+        
+        echo "</div>\n";
+        
+        if (!$ok || (!$sub && !$del && !$dup))
+        {
+            if ($laid && (!$sub || !$del) && !isset($al))
+            { // update
+                $sql = "SELECT las_ID, las_bez, las_welle_von, las_welle_bis, 
+                            las_art_ID, las_klasse_ID, las_typ_ID, leistung, einheit_leistung, 
+                            apertur, einheit_apertur, energie, einheit_energie, frequenz, einheit_frequenz, 
+                            impulsbreite, einheit_impulsbreite, l.las_hersteller_ID, schutzst_ID, 
+                            l.aktiv, l.persknr, l.raum_ID, geb_ID, las_info,
+                            CONCAT(nachname,', ',vorname) AS vname, las_hersteller_bez
+                        FROM fhiiqm.Laser l LEFT OUTER JOIN fhiiqm.Mitarbeiter m 
+                            ON l.persknr=m.persknr LEFT OUTER JOIN fhiiqm.Laser_Hersteller h
+                            ON l.las_hersteller_ID=h.las_hersteller_ID LEFT OUTER JOIN fhiiqm.Raum r
+                            ON l.raum_ID=r.Raum_ID
+                        WHERE las_ID = $laid";
+                if ($result = $dbc -> queryObjectArray($sql))
+                {
+                    foreach ($result as $row)
+                    {
+                        $la["lbez"] = $row->las_bez;   
+                        $la['wvon'] = $row->las_welle_von;
+                        $la['wbis'] = $row->las_welle_bis;
+                        $la["lart"] = $row->las_art_ID;   
+                        $la['lkla'] = $row->las_klasse_ID;
+                        $la['ltyp'] = $row->las_typ_ID;
+                        $la['leist'] = $row->leistung;
+                        $la["apt"] = $row->apertur;
+                        $la["eapt"] = $row->einheit_apertur;
+                        $la["eng"]  = $row->energie;
+                        $la["eeng"] = $row->einheit_energie;
+                        $la["efrq"]  = $row->frequenz;
+                        $la["efrq"] = $row->einheit_frequenz;
+                        $la["ipb"]  = $row->impulsbreite;
+                        $la["eipb"] = $row->einheit_impulsbreite;
+                        $la["akt"] = $row->aktiv;
+                        $la["hstid"] = $row->las_hersteller_ID;
+                        $la["suid"] = $row->schutzst_ID;
+                        $la["persknr"] = $row->vname;
+                        $la["pid"] = $row->persknr;
+                        $la["geb"] = $row->geb->ID;    
+                        $la["raum"] = $row->raum_ID;
+                        $la["linfo"] = $row->las_info;
+                        
+                    }
+                }
+            }
+            include ($_SERVER["DOCUMENT_ROOT"]."/fhiiqm/form/laser_form.inc.php");     
+            if ($sub || $del)
+    		{
+    		  	if ($sub)
+                    $frage = "Alle Angaben ok?";
+                elseif ($del)
+                    $frage = "Laser wirklich l&ouml;schen?";
+    			echo "<tr>
+    			  <td class=\"red\" valign=\"top\" align=\"left\">$frage</td>
+    			        <td><input type=\"checkbox\" name=\"ok\" value=\"1\"";
+    			        if ($ok)  echo "checked"; 
+    			echo "></td>\n</tr>\n"; 
+    		}
+            if (!is_null($_SESSION["recht"]) && in_array("le",$_SESSION["recht"]))
+            {
+                echo "
+               	<tr><td>&nbsp;</td>\n
+                	<td><input  class=\"button\" type=\"submit\" name=\"eintragen\" value=\"  eintragen  \" />";
+                if ($laid)
+                {
+                    echo "&nbsp;&nbsp;&nbsp;<input class=\"buttonr\" type=\"submit\" value=\"l&ouml;schen\" name=\"del\" title=\"delete\" />";
+                    echo "&nbsp;&nbsp;&nbsp;<input class=\"button\" type=\"submit\" value=\"duplizieren\" name=\"dup\" title=\"delete\" />";
+                }    
+               	echo "</td></tr>\n";
+            }
+            echo "</table>\n";
+            echo "</div>\n";
+            if (!is_null($_SESSION["recht"]) && !in_array("le", $_SESSION["recht"]))
+                echo "<p class='sc'>&nbsp;&nbsp;&nbsp;<a href=\"laser_flist.php\" target=\"_self\" title=\"Laser\">&laquo; zur Laserliste</a></p>\n"; 
+            echo "</form>\n";   
+
+            
+        }
+        else
+        {
+            echo "speichern";
+        }
+    ?>
+ </body>
+ </html>
--- a/fhiiqm/partner_upd.php	Thu Dec 15 16:42:56 2011 +0100
+++ b/fhiiqm/partner_upd.php	Fri Dec 23 15:03:37 2011 +0100
@@ -108,7 +108,7 @@
     		echo "
     		  <td>&nbsp;</td>
     		  <td><input class=\"button\" type=\"submit\" value=\"&auml;ndern\" name=\"upd\" title=\"update\" />
-    		  &nbsp;&nbsp;&nbsp;<input class=\"button\" type=\"submit\" value=\"l&ouml;schen\" name=\"del\" title=\"delete\" /></td>\n";
+    		  &nbsp;&nbsp;&nbsp;<input class=\"buttonr\" type=\"submit\" value=\"l&ouml;schen\" name=\"del\" title=\"delete\" /></td>\n";
     		echo "</tr>\n";
         }
         echo "</table>\n";
--- a/fhiiqm/raum_upd.php	Thu Dec 15 16:42:56 2011 +0100
+++ b/fhiiqm/raum_upd.php	Fri Dec 23 15:03:37 2011 +0100
@@ -111,7 +111,7 @@
     		echo "
     		  <td>&nbsp;</td>
     		  <td><input class=\"button\" type=\"submit\" value=\"&auml;ndern\" name=\"upd\" title=\"update\" />
-    		  &nbsp;&nbsp;&nbsp;<input class=\"button\" type=\"submit\" value=\"l&ouml;schen\" name=\"del\" title=\"delete\" /></td>\n";
+    		  &nbsp;&nbsp;&nbsp;<input class=\"buttonr\" type=\"submit\" value=\"l&ouml;schen\" name=\"del\" title=\"delete\" /></td>\n";
     		echo "</tr>\n";
         }
         echo "</table>\n";
--- a/fhiiqm/recht_ed.php	Thu Dec 15 16:42:56 2011 +0100
+++ b/fhiiqm/recht_ed.php	Fri Dec 23 15:03:37 2011 +0100
@@ -115,7 +115,7 @@
     		  <td>&nbsp;</td>
     		  <td><input class=\"button\" type=\"submit\" value=\"$sub\" name=\"ins\" title=\"$sub\" />";
             if ($pget || $rt["pget"])
-                echo "&nbsp;&nbsp;&nbsp;<input class=\"button\" type=\"submit\" value=\"l&ouml;schen\" name=\"del\" title=\"delete\" />";         
+                echo "&nbsp;&nbsp;&nbsp;<input class=\"buttonr\" type=\"submit\" value=\"l&ouml;schen\" name=\"del\" title=\"delete\" />";         
             echo  "</td>\n";;
     		echo "</tr>\n";
         }
--- a/fhiiqm/start.php	Thu Dec 15 16:42:56 2011 +0100
+++ b/fhiiqm/start.php	Fri Dec 23 15:03:37 2011 +0100
@@ -39,7 +39,8 @@
         $heute = new DateTime();
         $weih = new DateTime('2011-12-24');
         $tage = $weih -> diff($heute)->days+1;
-        echo "noch $tage Tage bis <em>Weihnachten</em>!</p>";
+        if ($tage <2) $tag = "Tag"; else $tag="Tage";
+        echo "noch $tage $tag bis <em>Weihnachten</em>!</p>";
     }
 
 ?>
--- a/fhiiqm/vertrag_flist1.php	Thu Dec 15 16:42:56 2011 +0100
+++ b/fhiiqm/vertrag_flist1.php	Fri Dec 23 15:03:37 2011 +0100
@@ -58,7 +58,7 @@
     if (!$start) $start=0;
     
     // Felder, nach denen gefiltert werden kann
-    $fields = array(2=>"Bezeichnung",4=>"Bearbeiter",6=>"Vertragstyp",7=>"Produkt");
+    $fields = array(2=>"Bezeichnung",4=>"Bearbeiter",6=>"Vertragstyp",7=>"Produkt",8=>"Partner");
     
 	$sort   = $_GET["s"];   // Sortierung nach Spalte
     if (!isset($sort) && !$sort) $sort = $_POST["s"];      
--- a/fhiiqm/vertrag_flist2.php	Thu Dec 15 16:42:56 2011 +0100
+++ b/fhiiqm/vertrag_flist2.php	Fri Dec 23 15:03:37 2011 +0100
@@ -51,7 +51,7 @@
     if (!$start) $start=0;
     
     // Felder, nach denen gefiltert werden kann
-    $fields = array(2=>"Bezeichnung",4=>"Bearbeiter",6=>"Vertragstyp",7=>"Produkt");
+    $fields = array(2=>"Bezeichnung",4=>"Bearbeiter",6=>"Vertragstyp",7=>"Produkt",8=>"Partner");
 
 	$sort   = $_GET["s"];
     $dir    = $_GET["d"];
--- a/fhiiqm/vertrag_upd.php	Thu Dec 15 16:42:56 2011 +0100
+++ b/fhiiqm/vertrag_upd.php	Fri Dec 23 15:03:37 2011 +0100
@@ -167,7 +167,7 @@
     		echo "
     		  <td>&nbsp;</td>
     		  <td><input class=\"button\" type=\"submit\" value=\"&auml;ndern\" name=\"upd\" title=\"update\" />
-    		  &nbsp;&nbsp;&nbsp;<input class=\"button\" type=\"submit\" value=\"l&ouml;schen\" name=\"del\" title=\"delete\" /></td>\n";
+    		  &nbsp;&nbsp;&nbsp;<input class=\"buttonr\" type=\"submit\" value=\"l&ouml;schen\" name=\"del\" title=\"delete\" /></td>\n";
     		echo "</tr>\n";
         }
         echo "</table>\n";