fhiiqm/test/vertrag_list2.php
changeset 1 6288d5685bff
equal deleted inserted replaced
0:ef68113ff309 1:6288d5685bff
       
     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" /> 
       
     7 
       
     8 	<title>Liste Vertragsdaten, Teil 2</title>
       
     9 </head>
       
    10 
       
    11 <body>
       
    12 
       
    13 <?php
       
    14 
       
    15 /**
       
    16  * @author Bettina Schwarzer, Fritz-Haber-Institut
       
    17  * @copyright 7/2011
       
    18  * 
       
    19  * Liste Vertragsdaten mit Sortierung
       
    20  */
       
    21 
       
    22     error_reporting(E_ALL ^ E_NOTICE);
       
    23     
       
    24 	$sort   = $_GET["s"];
       
    25     $dir    = $_GET["d"];
       
    26     if (!isset($sort) && !$sort) $sort = 2;
       
    27     if (!isset($dir) && !$dir)  $dir = "";
       
    28     
       
    29     function tab_column($colnum=2,$bez,$sort,$dir)
       
    30     {
       
    31         if ($colnum == $sort)
       
    32             if ($dir == 'DESC')
       
    33             {
       
    34                 $auf = "auf";
       
    35                 $ab = "ab_activ";
       
    36             }
       
    37             else
       
    38             {
       
    39                 $auf = "auf_activ";
       
    40                 $ab = "ab";
       
    41             }
       
    42         else
       
    43         {
       
    44                 $auf = "auf";
       
    45                 $ab = "ab";
       
    46         }
       
    47         echo "<th>$bez&nbsp;<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>            
       
    48                   <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";
       
    49        
       
    50     }
       
    51     
       
    52     include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
       
    53 	$dbc = new dbconnection();
       
    54 
       
    55     $sql = "CALL fhiiqm.vertrag_list2(" . $sort . ",'" . $dir . "', @anz)";
       
    56     $result = $dbc -> queryObjectArray($sql);
       
    57     if ($result)
       
    58     {
       
    59 		$bg1 = "#F8F8F8";
       
    60 		$bg2 = "#DEDFE1";
       
    61 		$bg = "#FFFFFF";
       
    62         
       
    63         $ranz = $dbc -> querySingleItem("SELECT @anz");
       
    64         
       
    65         echo "<div align='center'>\n";
       
    66         echo "<p><b>Liste der erfassten Vertr&auml;ge, Teil 2</b></p>\n";
       
    67         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'>' 
       
    68             können Sie Spalten auf- bzw. absteigend sortieren<br />
       
    69             Klick auf '<img src='img/edit.gif' border='0' width='11' hight='11'>' - Bearbeiten der Vertragsdaten</p>\n";
       
    70         printf ("<p>Anzahl Vertr&auml;ge: %s </p>", $ranz);
       
    71         echo "<table>\n";
       
    72 
       
    73         echo "<tr bgcolor='#68ACBF'>";
       
    74         tab_column(2,"Bezeichnung",$sort,$dir);
       
    75         tab_column(3,"Beginn",$sort,$dir);
       
    76         tab_column(4,"Ende",$sort,$dir);
       
    77         tab_column(5,"K&uuml;nd.frist",$sort,$dir);
       
    78         tab_column(6,"Partner",$sort,$dir);
       
    79         echo "<th>Kosten/Jahr(&euro;)</th>";
       
    80         echo "<th>Bemerkung</th>";
       
    81 
       
    82         echo "<th>&nbsp;</th></tr>\n";
       
    83         $cid=0;
       
    84         foreach ($result as $row)
       
    85         {
       
    86             if ($row->contract_ID != $cid && $cid != 0)
       
    87             {
       
    88                 echo "</td>";
       
    89                 echo "<td>$bem</td>";    
       
    90                 echo "<td><a href='vertrag_upd.php?uid=$cid'><img src=\"img/edit.gif\" alt='edit' title='edit' border='0'/></a></td></tr>\n";
       
    91             }
       
    92             if ($row->contract_ID != $cid)
       
    93             {
       
    94     			if ($bg == $bg1) $bg = $bg2; else $bg = $bg1;
       
    95                 echo "<tr bgcolor='" . $bg . "'><td><b>$row->cname</b></td>";    
       
    96     //            echo "<td>$row->contract_s</td>";    
       
    97                 if ($row->contract_begin)
       
    98                 {
       
    99                     $cb = new DateTime($row->contract_begin);    
       
   100                     echo "<td>" . $cb->format('d.m.Y')."</td>";
       
   101                 }
       
   102                 else  echo "<td>&nbsp;</td>";       
       
   103                 if ($row->contract_end)
       
   104                 {
       
   105                     $ce = new DateTime($row->contract_end);    
       
   106                     echo "<td>" . $ce->format('d.m.Y')."</td>";    
       
   107                 }
       
   108                 else  echo "<td>&nbsp;</td>";       
       
   109                 echo "<td align='right'>$row->kmon</td>";    
       
   110                 echo "<td>$row->part_firma</td>";
       
   111                 echo "<td>"; 
       
   112                 $bem = $row->Bemerkung;   
       
   113             }
       
   114                 if ($row->kosten) echo "$row->k_year:&nbsp;&nbsp;&nbsp;" . str_replace(' ','&nbsp;',str_replace('.',',',sprintf('%10.2f',$row->kosten))) . "<br />";
       
   115             $cid = $row->contract_ID;    
       
   116        }
       
   117         echo "</td>";
       
   118         echo "<td>$bem</td>";    
       
   119         echo "<td><a href='vertrag_upd.php?uid=$cid'><img src=\"img/edit.gif\" alt='edit' title='edit' border='0'/></a></td></tr>\n";
       
   120         echo "</table></div>\n";
       
   121     }
       
   122     $dbc -> close();
       
   123     echo "<p>&nbsp;&nbsp;&nbsp;<a href=\"vertrag_ins.php\" target=\"_self\" title=\"Vertrag erfassen\">Weiteren Vertrag erfassen</a></p>\n";    
       
   124 
       
   125 ?>
       
   126 </body>
       
   127 </html>