|
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|
3 |
|
4 <head> |
|
5 <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> |
|
6 <link href="css/db.css" rel="STYLESHEET" type="TEXT/CSS" media="screen "/> |
|
7 <link href="css/db_print.css" rel="STYLESHEET" type="TEXT/CSS" media="print" /> |
|
8 |
|
9 <title>Liste Vertragsdaten, Teil 2</title> |
|
10 </head> |
|
11 |
|
12 <body> |
|
13 <div class="float-r"><img src="img/document_mark_as_final.png" border="0" alt="Verträge" title="Verträge"/></div> |
|
14 |
|
15 <?php |
|
16 |
|
17 /** |
|
18 * @author Bettina Schwarzer, Fritz-Haber-Institut |
|
19 * @copyright 7/2011 |
|
20 * |
|
21 * Liste Vertragsdaten mit Sortierung |
|
22 */ |
|
23 |
|
24 error_reporting(E_ALL ^ E_NOTICE); |
|
25 |
|
26 $zeil = $_GET["z"]; |
|
27 if (!$zeil) $zeil = 25; // Anzahl der gezeigten Zeilen |
|
28 $start = $_GET["st"]; // Start bei DS $start+1 |
|
29 if (!$start) $start=0; |
|
30 |
|
31 // Felder, nach denen gefiltert werden kann |
|
32 $fields = array(2=>"Bezeichnung",4=>"Bearbeiter",6=>"Vertragstyp",7=>"Produkt"); |
|
33 |
|
34 $sort = $_GET["s"]; |
|
35 $dir = $_GET["d"]; |
|
36 if (!isset($sort) && !$sort) $sort = 2; |
|
37 if (!isset($dir) && !$dir) $dir = ""; |
|
38 |
|
39 $fnum = $_GET["f"]; // Spaltennummer, nach der aktuell gefiltert wird |
|
40 $filter = $_GET["b"]; |
|
41 if (!isset($fnum) && !$fnum) $fnum = 0; |
|
42 /* |
|
43 function tab_column($colnum=2,$bez,$sort,$dir) |
|
44 { |
|
45 if ($colnum == $sort) |
|
46 if ($dir == 'DESC') |
|
47 { |
|
48 $auf = "auf"; |
|
49 $ab = "ab_activ"; |
|
50 } |
|
51 else |
|
52 { |
|
53 $auf = "auf_activ"; |
|
54 $ab = "ab"; |
|
55 } |
|
56 else |
|
57 { |
|
58 $auf = "auf"; |
|
59 $ab = "ab"; |
|
60 } |
|
61 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> |
|
62 <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"; |
|
63 |
|
64 } |
|
65 */ |
|
66 include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php"); |
|
67 include ($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/func_lib.inc.php"); |
|
68 $dbc = new dbconnection(); |
|
69 |
|
70 $sql = "CALL fhiiqm.vertrag_flist2(" . $sort . ",'" . $dir . "', " . $fnum . ", '" . $filter . "',$start,$zeil, @anz, @ganz)"; |
|
71 // Parameter: Nr. Sortfelf, Sortierrichtung, Nr. Filterfeld, Filterbegriff, Start bei DS $start+1, Anzahl DS/Seite, Anzahl gefundener Vertraege, Anzahl DS gesamt |
|
72 // liefert Felder: contract_ID,cname,clong,bearb,doc,typ,prod,cbegin,cend,kmon,partfirmar,kyear,kosten,bem |
|
73 $result = $dbc -> queryObjectArray($sql); |
|
74 if ($result) |
|
75 { |
|
76 $bg1 = "#F8F8F8"; |
|
77 $bg2 = "#DEDFE1"; |
|
78 $bg = "#FFFFFF"; |
|
79 |
|
80 $vanz = $dbc -> querySingleItem("SELECT @anz"); |
|
81 $ganz = $dbc -> querySingleItem("SELECT @ganz"); |
|
82 |
|
83 echo "<div align='center'>\n"; |
|
84 echo "<p><b>Liste der erfassten Verträge, Teil 2</b></p>\n"; |
|
85 echo "<table border='0' cellspacing='0'>\n"; |
|
86 echo "<tr><td class='bigger'>Mittels '<img src='img/auf.gif' border='0' width='9' hight='9'>' / '<img src='img/ab.gif' border='0' width='9' hight='9'>' |
|
87 können Sie Spalten auf- bzw. absteigend sortieren</td></tr> |
|
88 <tr><td class='bigger'>Klick auf '<img src='img/edit.gif' border='0' width='11' hight='11'>' - Bearbeiten der Vertragsdaten</td></tr>\n"; |
|
89 echo "</table>\n"; |
|
90 printf ("<p>Anzahl Verträge: %s </p>", $vanz); |
|
91 echo "<table>\n"; |
|
92 |
|
93 if ($filter>'!') echo "<tr><td class='bigger' colspan=7>Filter: ". $fields["$fnum"] . " wie '$filter'</td><tr>\n"; |
|
94 |
|
95 echo "<tr bgcolor='#68ACBF'>"; |
|
96 tab_column(2,"Bezeichnung",$sort,$dir,0,$fnum,$filter,$start,$zeil); |
|
97 tab_column(8,"Beginn",$sort,$dir,0,$fnum,$filter,$start,$zeil); |
|
98 tab_column(9,"Ende",$sort,$dir,0,$fnum,$filter,$start,$zeil); |
|
99 tab_column(10,"Künd.frist",$sort,$dir,0,$fnum,$filter,$start,$zeil); |
|
100 tab_column(11,"Partner",$sort,$dir,0,$fnum,$filter,$start,$zeil); |
|
101 echo "<th>Kosten/Jahr(€)</th>"; |
|
102 echo "<th>Bemerkung</th>"; |
|
103 |
|
104 echo "<th> </th></tr>\n"; |
|
105 $cid=0; |
|
106 foreach ($result as $row) |
|
107 { |
|
108 if ($row->contract_ID != $cid && $cid != 0) |
|
109 { // nicht beim 1. Datensatz |
|
110 echo "</td>"; |
|
111 echo "<td>$bem</td>"; |
|
112 echo "<td><a href='vertrag_upd.php?uid=$cid'><img src=\"img/edit.gif\" alt='edit' title='edit' border='0'/></a></td></tr>\n"; |
|
113 } |
|
114 if ($row->contract_ID != $cid) |
|
115 { // Anzeigen der nur einmal relevanten Daten |
|
116 if ($bg == $bg1) $bg = $bg2; else $bg = $bg1; |
|
117 echo "<tr bgcolor='" . $bg . "'><td><b>$row->cname</b></td>"; |
|
118 // echo "<td>$row->contract_s</td>"; |
|
119 if ($row->cbegin) |
|
120 { |
|
121 $cb = new DateTime($row->cbegin); |
|
122 echo "<td>" . $cb->format('d.m.Y')."</td>"; |
|
123 } |
|
124 else echo "<td> </td>"; |
|
125 if ($row->cend) |
|
126 { |
|
127 $ce = new DateTime($row->cend); |
|
128 echo "<td>" . $ce->format('d.m.Y')."</td>"; |
|
129 } |
|
130 else echo "<td> </td>"; |
|
131 echo "<td align='right'>$row->kmon</td>"; |
|
132 echo "<td>$row->partfirma</td>"; |
|
133 echo "<td>"; |
|
134 $bem = nl2br($row->bem); |
|
135 } |
|
136 // Anzeigen Kosten pro Jahr -> 1 Zeile des Resultsets |
|
137 if ($row->kosten) echo "$row->kyear: " . str_replace(' ',' ',str_replace('.',',',sprintf('%10.2f',$row->kosten))) . "<br />"; |
|
138 $cid = $row->contract_ID; |
|
139 } |
|
140 echo "</td>"; |
|
141 echo "<td>$bem</td>"; |
|
142 echo "<td><a href='vertrag_upd.php?uid=$cid'><img src=\"img/edit.gif\" alt='edit' title='edit' border='0'/></a></td></tr>\n"; |
|
143 echo "</table></div>\n"; |
|
144 echo "<br /> "; |
|
145 |
|
146 // Sortierung und Filter aus $_GET fuer weitere Seiten |
|
147 foreach ($_GET as $key=>$val) |
|
148 { |
|
149 if ($key != "st") $liste .= "&" . $key ."=".$val; |
|
150 } |
|
151 // Sortierung und Filter aus $_POST fuer weitere Seiten |
|
152 if ($subf) |
|
153 foreach ($_POST as $key=>$val) |
|
154 { |
|
155 if ($key != "st" && $key != "subf" && $key != "filter") $liste .= "&" . $key ."=".$val; |
|
156 if ($key == "filter") $liste .= "&b=" . $val; |
|
157 } |
|
158 |
|
159 // Links auf andere Seiten generieren |
|
160 liste_links($start,$zeil,$ganz,$liste); |
|
161 } |
|
162 else |
|
163 { |
|
164 print_r ($dbc -> error); |
|
165 } |
|
166 $dbc -> close(); |
|
167 echo "<p> <a href=\"vertrag_ins.php\" class=\"sc\" target=\"_self\" title=\"Vertrag erfassen\">Weiteren Vertrag erfassen</a></p>\n"; |
|
168 |
|
169 ?> |
|
170 </body> |
|
171 </html> |