--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/fhiiqm/test/vertrag_list2.php Wed Aug 31 14:22:19 2011 +0200
@@ -0,0 +1,127 @@
+<!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" />
+
+ <title>Liste Vertragsdaten, Teil 2</title>
+</head>
+
+<body>
+
+<?php
+
+/**
+ * @author Bettina Schwarzer, Fritz-Haber-Institut
+ * @copyright 7/2011
+ *
+ * Liste Vertragsdaten mit Sortierung
+ */
+
+ error_reporting(E_ALL ^ E_NOTICE);
+
+ $sort = $_GET["s"];
+ $dir = $_GET["d"];
+ if (!isset($sort) && !$sort) $sort = 2;
+ if (!isset($dir) && !$dir) $dir = "";
+
+ function tab_column($colnum=2,$bez,$sort,$dir)
+ {
+ if ($colnum == $sort)
+ if ($dir == 'DESC')
+ {
+ $auf = "auf";
+ $ab = "ab_activ";
+ }
+ else
+ {
+ $auf = "auf_activ";
+ $ab = "ab";
+ }
+ else
+ {
+ $auf = "auf";
+ $ab = "ab";
+ }
+ echo "<th>$bez <a href='".$_SERVER['PHP_SELF']."?s=$colnum'><img src='img/$auf.gif' border='0' width='9' hight='9' alt='sort aufsteigend' title='sort aufsteigend'></a>
+ <a href='".$_SERVER['PHP_SELF']."?s=$colnum&d=DESC'><img src='img/$ab.gif' border='0' width='9' hight='9' alt='sort absteigend' title='sort absteigend'></a></th>\n";
+
+ }
+
+ include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+ $dbc = new dbconnection();
+
+ $sql = "CALL fhiiqm.vertrag_list2(" . $sort . ",'" . $dir . "', @anz)";
+ $result = $dbc -> queryObjectArray($sql);
+ if ($result)
+ {
+ $bg1 = "#F8F8F8";
+ $bg2 = "#DEDFE1";
+ $bg = "#FFFFFF";
+
+ $ranz = $dbc -> querySingleItem("SELECT @anz");
+
+ echo "<div align='center'>\n";
+ echo "<p><b>Liste der erfassten Verträge, Teil 2</b></p>\n";
+ echo "<p>Mittels '<img src='img/auf.gif' border='0' width='9' hight='9'>' / '<img src='img/ab.gif' border='0' width='9' hight='9'>'
+ können Sie Spalten auf- bzw. absteigend sortieren<br />
+ Klick auf '<img src='img/edit.gif' border='0' width='11' hight='11'>' - Bearbeiten der Vertragsdaten</p>\n";
+ printf ("<p>Anzahl Verträge: %s </p>", $ranz);
+ echo "<table>\n";
+
+ echo "<tr bgcolor='#68ACBF'>";
+ tab_column(2,"Bezeichnung",$sort,$dir);
+ tab_column(3,"Beginn",$sort,$dir);
+ tab_column(4,"Ende",$sort,$dir);
+ tab_column(5,"Künd.frist",$sort,$dir);
+ tab_column(6,"Partner",$sort,$dir);
+ echo "<th>Kosten/Jahr(€)</th>";
+ echo "<th>Bemerkung</th>";
+
+ echo "<th> </th></tr>\n";
+ $cid=0;
+ foreach ($result as $row)
+ {
+ if ($row->contract_ID != $cid && $cid != 0)
+ {
+ echo "</td>";
+ echo "<td>$bem</td>";
+ echo "<td><a href='vertrag_upd.php?uid=$cid'><img src=\"img/edit.gif\" alt='edit' title='edit' border='0'/></a></td></tr>\n";
+ }
+ if ($row->contract_ID != $cid)
+ {
+ if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
+ echo "<tr bgcolor='" . $bg . "'><td><b>$row->cname</b></td>";
+ // echo "<td>$row->contract_s</td>";
+ if ($row->contract_begin)
+ {
+ $cb = new DateTime($row->contract_begin);
+ echo "<td>" . $cb->format('d.m.Y')."</td>";
+ }
+ else echo "<td> </td>";
+ if ($row->contract_end)
+ {
+ $ce = new DateTime($row->contract_end);
+ echo "<td>" . $ce->format('d.m.Y')."</td>";
+ }
+ else echo "<td> </td>";
+ echo "<td align='right'>$row->kmon</td>";
+ echo "<td>$row->part_firma</td>";
+ echo "<td>";
+ $bem = $row->Bemerkung;
+ }
+ if ($row->kosten) echo "$row->k_year: " . str_replace(' ',' ',str_replace('.',',',sprintf('%10.2f',$row->kosten))) . "<br />";
+ $cid = $row->contract_ID;
+ }
+ echo "</td>";
+ echo "<td>$bem</td>";
+ echo "<td><a href='vertrag_upd.php?uid=$cid'><img src=\"img/edit.gif\" alt='edit' title='edit' border='0'/></a></td></tr>\n";
+ echo "</table></div>\n";
+ }
+ $dbc -> close();
+ echo "<p> <a href=\"vertrag_ins.php\" target=\"_self\" title=\"Vertrag erfassen\">Weiteren Vertrag erfassen</a></p>\n";
+
+?>
+</body>
+</html>
\ No newline at end of file