fhiiqm/form/vertrag_form.inc.php
changeset 8 908abe8cec4d
parent 1 6288d5685bff
child 13 741b35e9ebbe
--- a/fhiiqm/form/vertrag_form.inc.php	Thu Sep 08 15:25:25 2011 +0200
+++ b/fhiiqm/form/vertrag_form.inc.php	Mon Sep 12 10:34:07 2011 +0200
@@ -235,6 +235,10 @@
              ?>
         </td>
     </tr>
+    <tr>
+        <td>automatische Verl&auml;ngerung</td>
+        <td><input name="vertrag[cautoend]" type="checkbox" value="1" <?php if ($vtr["cautoend"]) echo "checked";?>/></td>
+    </tr>
 	<tr>
         <td>K&uuml;ndigungsfrist<br />(Monate vor Ablauf)</td>
         <td><input name="vertrag[cnot]" type="text" size="10" maxlength="3" value="<?php echo $vtr['cnot']; ?>"/></td>
@@ -272,6 +276,7 @@
         <td>
             <select name="vertrag[cpers][]" size="7" multiple="multiple">
                 <?php
+                    $select = null;
                     if (is_array($vtr['cpers'])) $select = in_array( "-1", $vtr['cpers'] ) ? ' selected' : null;
                     echo "<option $select value=\"-1\"></option>\n";
                     $sql = "SELECT persknr, CONCAT (nachname, ', ',vorname) as pname FROM fhiiqm.Mitarbeiter ORDER BY 2";
@@ -294,12 +299,18 @@
                     <td>j&auml;hrliche Kosten (&euro;)</td><br />
                     <td>";
                 $j=0;
-                if ($vtr['ejahr'])
+                if ($vtr['ejahr']) 
+                    $ejahr = $vtr['ejahr'];
+                elseif ($vtr["cautoend"] && !$vtr['ejahr']) // automatische Vertragsverlaengerung und kein Endjahr angegeben
+                    $ejahr = date("Y");
+                else 
+                    $ejahr = null;
+                if ($ejahr)
                 {
-                    for ($i=(int)$vtr['bjahr']; $i<(int)$vtr['ejahr']+1; $i++ )
+                    for ($i=(int)$vtr['bjahr']; $i<(int)$ejahr+1; $i++ )
                     {
                         echo "<input name=\"vertrag[kjahr][$j]\" type=\"text\" size=\"4\" value=\"$i\"/>&nbsp;&nbsp;&nbsp;";
-                        echo "<input name=\"vertrag[kost][$j]\" type=\"text\" value=\"" . $vtr['kost'][$j] . "\"/><br />";
+                        echo "<input name=\"vertrag[kost][$j]\" type=\"text\" value=\"" . $vtr['kost'][$j] . "\"/><br />\n";
                         $j++;
                     }
                 }