Location: PHPKode > projects > tbvs > tbvs-1.1/AusschreibungList.php
<? // this section is managed by php-mgr : you may change / enhance the part with the program versions
//
//  This php section is being managed by php-mgr ver 1, 
//  If you make changes in this section then your changes will be overwritten in later releases of this file !
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  File          : ./AusschreibungList.php ( 05/24/2010 )
//  Language      : php
//  Description   : Formular, um alle vorhandenen Ausschreibungen als Liste anzuzeigen 
//  Project       : tbvs - Das Tiefbauverwaltungssystem
//  Project Site  : http://tbvs.sourceforge.net/
//  Project wiki  : http://scratchpad.wikia.com/wiki/Tbvs
//  Created by    : Rainer Stötter ( hide@address.com ), 03/14/2008
//  Copyright (c) : 2007 - 2008, Rainer Stötter, All rights reserved
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  License
//
//  This file has been released under GNU GENERAL PUBLIC LICENSE
//  (see http://www.gnu.org/licenses/gpl.html)
//
//
// * GNU General Public License (Version 3, June 2009 )
// *
// * This program is free software; you can redistribute
// * it and/or modify it under the terms of the GNU
// * General Public License as published by the Free
// * Software Foundation; either version 3 of the License,
// * or (at your option) any later version.
// * 
// * This program is distributed in the hope that it will
// * be useful, but WITHOUT ANY WARRANTY; without even the
// * implied warranty of MERCHANTABILITY or FITNESS FOR A
// * PARTICULAR PURPOSE. See the GNU General Public License
// * for more details. 
//   
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  
//	[[Requests]]
//
//
//		_GET['bk']
//		_GET['filter']
//		_GET['mandant']
//		_GET['order']
//		_GET[filter]
//		_GET[order]
//
//	[[End of requests]]
//
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  
//	[[Functions]]
//
//
//		function CheckParameters()
//		function DisplayAusschreibungList($mandant,$bk)
//		function DisplayFilter($mandant,$bk)
//		function DisplayOrder($mandant,$bk)
//
//	[[End of functions]]
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  
//	[[Classes]]
//
//
//	no classes were found
//
//	[[End of classes]]
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  
//	[[Versions of file ./AusschreibungList.php]]
//
//	14.03.2008	Rainer Stötter (tbvs-0.93)
//			Module created
//	08.11.2008	Rainer Stötter (tbvs-1.01)
//	03.12.2008	Rainer Stötter (tbvs-1.02)
//	18.07.2009	Rainer Stötter (tbvs-1.033)
//	21.03.2010	Rainer Stötter (tbvs-1.08006)
//			a
//
//	[[End of versions]]
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  CVS
//
//  $Log:…$
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 
// here ends the section which is managed by php-mgr ver 1
//

//{TOOLVER=01,00000}{OLSTART=00495}{OLLEN=00067}
?><?php
/*

AusschreibungList.php

*/
require_once("./functions/checkuser.inc.php");	//	Login ist erforderlich
require_once("./functions/prolog.inc.php");	//	Datei mit vorgestellten Routinen
require_once("./functions/debug.inc.php");	//	Debugging-Funktionen
require_once("./functions/tbvs.inc.php");	//	systemweite Konstanten und Funktionen
require_once("./functions/tbvs-db.inc.php");	//	systemweite Datenbankfunktionen
require_once("./classes/cUserRights.class.inc");  // Zugangs&uuml;berpr&uuml;fung
require_once("./classes/cAusschreibung.class.inc.php");    //  Das Ausschreibungsmodul für existente Ausschreibungen

?>

<?php

// TODO : alle KALAUF : Report Massen : alle und Montage, Tiefbau, Material

function DisplayAusschreibungList($mandant, $bk) {

        $msgID = id2msg( 2320 );
        $msgNrAusschreibung = id2msg( 2321 );
        $msgTitel = id2msg( 2322 );
        $msgStatus = id2msg( 2323 );
        $msgAktionen = id2msg( 2324 );
        $msgEditTender = id2msg( 2325 );
        $msgDeleteTender = id2msg( 2326 );
        $msgHierList = id2msg( 2327 );
        $msgShowTender = id2msg( 2328 );
        $msgReports = id2msg( 2329 );

    $ueberschrift = "<h2>" . sprintf( id2msg( 2857 ) ) . "</h2><p>";    echo( $ueberschrift );

	/* Connect to a MySQL server */
	$mysqli = OpenTBVSDB();
	
	/* Send a query to the server
	* mysqli::query returns an object of class mysqli_result */

        $query="
SELECT 
    ID_AUSSCHREIBUNG, AUSSCHREIBUNG_NR, Titel, Start, ID_STATUS  
FROM 
    AUSSCHREIBUNG 
WHERE 
    ID_MANDANT='$mandant' AND ID_BUCHKR='$bk'
";
        
        // echo $query;

        if ($_GET['filter'] >0) { // falls der Filter gesetzt wurde
            $filter = " AND  ID_STATUS = ('$_GET[filter]' -1) ";
            
        } else {
            $filter = "";
        }

        if ($_GET['order'] >0) { // falls der Filter gesetzt wurde
            switch ($_GET[order]) {
                case 0 : $order = " "; break;
                case 1 : $order = " order by START, AUSSCHREIBUNG_NR"; break;
                case 2 : $order = " order by Titel, AUSSCHREIBUNG_NR"; break;
                case 3 : $order = " order by AUSSCHREIBUNG_NR"; break;
                case 4 : $order = " order by ID_STATUS, AUSSCHREIBUNG_NR"; break; 
            } 
            
        } else {
            $order = " order by AUSSCHREIBUNG_NR";    
        }
        
        // NOTE : TDO : sortieren nach Baubeginn bzw Bauende
        $query = $query . $filter . $order;

        // echo "<INPUT TYPE='hidden' NAME='order' VALUE='$order'>";
        // echo "<INPUT TYPE='hidden' NAME='filter' VALUE='$filter'>";

        // echo $query;

	$result = $mysqli->query($query);
	


	echo "<table border='1' >";
	echo "<tbody>";
	echo "<tr>";
	echo "	<th width=5%>$msgID</th>";
	echo "	<th width=20%>$msgNrAusschreibung<br>Start</th>";
	echo "	<th width=50%>$msgTitel<br>$msgStatus</th>";
	echo "	<th width=15%>$msgAktionen</th>";
	echo "</tr>";
	
	
	# dann zeige Ergebnisse an...

	while($row = $result->fetch_object()) {

//		$bk=$row->ID_BUCHKR;
//		$mandant=$row->ID_MANDANT;
                $aus=$row->ID_AUSSCHREIBUNG;

                $oAusschreibung = new cAusschreibung( $mandant, $bk, $aus );

            
                $params = "mandant=$mandant&bk=$bk&aus=$row->ID_AUSSCHREIBUNG";        // NOTE  : TODO : je nach Typ !
                    $doEdit = "";
                    $doDel = "";

                    if ( UserMayDo($mandant, $bk, "edit", "AUSSCHREIBUNG") ) {
                        $doEdit = "<A HREF=AusschreibungEdit.php?$params>
			         <IMG SRC='images/edit.gif' 
                                onmouseover=\"Tip('$msgEditTender')\" 
                                ALT='EDIT'>
                                </A>";
                    }

                    if ( UserMayDo($mandant, $bk, "adddel", "AUSSCHREIBUNG") ) {
                        if(activeUserMayDeleteAusschreibung( $mandant, $bk, $aus ))
                        $doDel = "<A HREF=AusschreibungDel.php?$params>
			     <IMG SRC='images/delete.gif' 
                                ALT='DEL' 
                                onmouseover=\"Tip('$msgDeleteTender')\" >                                
                              </A>";
                    }

                    $hierList = "<A HREF=HierList.php?mandant=$mandant&bk=$bk&prj=$prj>
			         <IMG SRC='images/browse.png' 
                                onmouseover=\"Tip('$msgHierList')\" 
                                ALT='Browse'>
                                </A>";
                
                    $doFirmen = "<A HREF=AusschreibungFirmen.php?$params>Firmen";
                    $doPreise = "<A HREF=AusschreibungPreise.php?$params>Preise";
                    $doTransfer = ( $oAusschreibung->AusschreibungTransferMoeglich( ) ) ? "<A HREF=AusschreibungTransfer.php?$params>Transfer" : '' ;
                    // $doTransfer = ( true ) ? "<A HREF=AusschreibungTransfer.php?$params>Transfer" : '' ;

                    $art = AusschreibungVertragsart( $mandant, $bk, $aus );

                $titel = hent($row->Titel);
		printf("<tr>\n  <td align=\"center\">%s</td><td>%s</td><td>%s</td></td> <td>  %s %s %s %s %s %s %s </td>\n</tr>\n",
			$row->ID_AUSSCHREIBUNG, 
			"$row->AUSSCHREIBUNG_NR<br>&nbsp &nbsp &nbsp $row->Start",
                        "$titel<br>$row->ID_STATUS - $art",
                        $doEdit,
			$doDel,
			"<A HREF=AusschreibungShow.php?$params>
			 <IMG SRC='images/show.gif' ALT='SHOW'
                                onmouseover=\"Tip('$msgShowTender')\" 
                        ></A>",
                        "<A HREF=ReportsAUS.php?$params>
                        <IMG SRC='images/reports.png' 
                                onmouseover=\"Tip('$msgReports')\" 
                        ALT='Reports'></A>",
                        $doFirmen,
                        ( AusschreibungAnzahlFirmen($mandant,$bk, $aus) ) ? $doPreise : "",
                        $doTransfer//( AusschreibungIsAbgeschlossen($mandant, $bk, $row->ID_AUSSCHREIBUNG) ? $doTransfer : "" )
		);
	}	
	
	/* Destroy the result set and free the memory used */
	$result->close();
	
	/* Close the connection and free the memory used*/
	$mysqli->close();
		

	
	echo"</tbody>";
	echo"</table>";
}	// function DisplayAusschreibungList

function DisplayFilter( $mandant, $bk ) {
// zeigt den Filter f&uuml;r den Ausschreibungstatus an
// NOTE : TODO : seected setzen in DisplayFilter(
    ;
echo "<FORM METHOD=GET ACTION=AusschreibungList.php>";

        echo "<INPUT TYPE='hidden' NAME='mandant' VALUE='$mandant'>";
        echo "<INPUT TYPE='hidden' NAME='bk' VALUE='$bk'>";
//TODO : Filter selektieren !

if ($_GET[filter] >0) {
    $filter = $_GET['filter'];
} else {
    $filter = "0";
// echo "<br>Filter gesetzt";
}

echo "Filter f&uuml;r Ausschreibungstatus :";
echo "<INPUT TYPE=RADIO NAME='filter' VALUE='0'";
if ( $filter=="0" ) echo " CHECKED ";
echo "> kein Filter ";

echo "<INPUT TYPE=RADIO NAME='filter' VALUE='1'";
if ( $filter=="1" ) echo " CHECKED ";
echo "> Vorbereitung ";

echo "<INPUT TYPE=RADIO NAME='filter' VALUE='2'";
if ( $filter=="2" ) echo " CHECKED ";
echo "> freigegeben ";

echo "<INPUT TYPE=RADIO NAME='filter' VALUE='3'";
if ( $filter=="3" ) echo " CHECKED ";
echo "> abgeschlossen";

echo "<INPUT TYPE=RADIO NAME='filter' VALUE='4'";
if ( $filter=="4" ) echo " CHECKED ";
echo "> geloescht";

echo "<INPUT TYPE=SUBMIT VALUE='Filter setzen'>";
echo "</FORM>";

}   // function DisplayFilter( )


function DisplayOrder( $mandant, $bk ) {
// zeigt den Filter f&uuml;r den Ausschreibungstatus an
// NOTE : TODO : seected setzen in DisplayFilter(

  $msgOrder = id2msg( 2330 );
  $msgChrono = id2msg( 2331 );
  $msgStartDate = id2msg( 2332 );
  $msgTitel = id2msg( 2333 );
  $msgNummer = id2msg( 2334 );
  $msgState = id2msg( 2335 );
  $msgSetOrder = id2msg( 2336 );
    ;

echo "<FORM METHOD=GET ACTION=AusschreibungList.php>";

        echo "<INPUT TYPE='hidden' NAME='mandant' VALUE='$mandant'>";
        echo "<INPUT TYPE='hidden' NAME='bk' VALUE='$bk'>";
//TODO : Filter selektieren !

if ($_GET[order] >0) {
    $order = $_GET['order'];
} else {
    $order = "0";
}

echo $msgOrder;
echo "<INPUT TYPE=RADIO NAME='order' VALUE='0'";
if ( $order =="0" ) echo " CHECKED ";
echo "> $msgChrono ";

echo "<INPUT TYPE=RADIO NAME='order' VALUE='1'";
if ( $order =="1" ) echo " CHECKED ";
echo ">  $msgStartDate";

echo "<INPUT TYPE=RADIO NAME='order' VALUE='2'";
if ( $order =="2" ) echo " CHECKED ";
echo ">  $msgTitel";

echo "<INPUT TYPE=RADIO NAME='order' VALUE='3'";
if ( $order =="3" ) echo " CHECKED ";
echo ">  $msgNummer";

echo "<INPUT TYPE=RADIO NAME='order' VALUE='4'";
if ( $order =="4" ) echo " CHECKED ";
echo ">  $msgStatus";

echo "<INPUT TYPE=SUBMIT VALUE='$msgSetOrder'>";
echo "</FORM>";
}   // function DisplayOrder( )

function CheckParameters ( ) {
    
    if (! isset($_GET['mandant'])) 
            die( id2msg( 1103 ) );
    if (! isset($_GET['bk'])) 
            die( id2msg( 1104 ) );

}   // function CheckParameters


// ShowAllParameters();

CheckParameters ();

$mandant=$_GET['mandant'];
$bk=$_GET['bk'];

$msgBuchungskreis = id2msg( 2337 );
$msgNeuerJahresvertrag = id2msg( 2338 );
$msgZugangsdaten = id2msg( 2339 );

$MandName = hent(ID2NameMandant($mandant));
$bkName = hent(ID2NameBuchungskreis($mandant,$bk));

DisplayHeader();
display_title( sprintf( id2msg( 2336 ), $bkName, $MandName ) );
display_logo();

echo "<br><a href=BuchungskreisList.php?mandant=$mandant>$msgBuchungskreis</a>  ";
echo "<a href=AusschreibungAdd.php?mandant=$mandant&bk=$bk>$msgNeuerJahresvertrag </a>  ";
echo "<a href=AusschreibungZugangList.php?mandant=$mandant&bk=$bk>$msgZugangsdaten</a>  ";
echo "<p>";


DisplayFilter( $mandant, $bk );
DisplayOrder( $mandant, $bk );
DisplayAusschreibungList($mandant, $bk);


/*
echo "<br><h2>Testergebnisse : </h2>";
 __tstPreiseJV( );
*/

require_once("./functions/epilog.inc.php");	//	Datei mit nachgestellten Routinen

?>

<body>
<script type="text/javascript" src="functions/wz_tooltip.js"></script>
</body>

Return current item: tbvs