Location: PHPKode > projects > paperasse > paperasse/liste_factures.php
<?php
# ---------------------------------------
# Paperasse (c) 2006 Guillaume BETTAYEB
# mail and documents management web page
# hide@address.com
# ---------------------------------------

function DonneesContact($id){
	$res = false;
	$sql 	= "SELECT * FROM `contacts` WHERE `id`=$id";
	$query 	= mysql_query($sql) OR die(mysql_error());
	$array	= mysql_fetch_array($query);
	extract($array);
	$res	= "<a href=\"index.php?page=ajouter_contact&id=$id\">[$id]</a> $nom<br>$num $rue<br>boite postale $bp<br>cedex $cdx<br>$cp $ville";
	return $res;
}

function DonneesUtilisateur($id){
	$res 	= false;
	$sql 	= "SELECT * FROM `utilisateurs` WHERE `id`=$id";
	$query 	= mysql_query($sql) OR die(mysql_error());
	$array	= mysql_fetch_array($query);
	extract($array);
	$res	= "<a href=\"index.php?page=ajouter_utilisateur&id=$id\">$nom</a>";
	return $res;
}

function DonneesDossier($id){
	$res 	= false;
	$sql 	= "SELECT * FROM `dossiers` WHERE `id`=$id";
	$query 	= mysql_query($sql) OR die(mysql_error());
	$array	= mysql_fetch_array($query);
	extract($array);
	$res	= "<a href=\"index.php?page=ajouter_dossier&id=$id\"><font color=\"$couleur\">$nom</font></a>";
	return $res;
}

function ListeFactures($sort){
	$res = false;
	$sql = "SELECT * FROM `factures` ORDER BY $sort";
	$query = mysql_query($sql) OR die(mysql_error());
	while($array = mysql_fetch_array($query,MYSQL_ASSOC)){
		extract($array);
		$res.="<tr><td class=\"texte\"><a href=\"index.php?page=ajouter_facture&id=$id\">$id</a></td><td class=\"texte\">".DonneesContact($contact)."</td><td class=\"texte\">".DonneesUtilisateur($utilisateur)."</td><td class=\"texte\">".DonneesDossier($dossier)."</td><td class=\"texte\">$montant &euro;</td><td class=\"texte\">".InverserDate(str_replace('-','/',$date))."</td><td class=\"texte\">".InverserDate(str_replace('-','/',$datefacture))."</td></tr>";
	}
	return $res;
}
?>
<!-- Feuille de style--> 
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tableau">
  <tr> 
    <td colspan="7"><div align="center" class="texte">FACTURES</div></td>
  </tr>
  <tr> 
    <td width="3%" class="texte"><div align="center"><a href="index.php?page=liste_factures&sort=id">Id</a></div></td>
    <td width="48%" class="texte">
<div align="center"><a href="index.php?page=liste_factures&sort=contact">contact</a></div></td>
    <td width="16%" class="texte">
<div align="center"><a href="index.php?page=liste_factures&sort=utilisateur">utilisateur</a></div></td>
    <td width="9%" class="texte">
<div align="center"><a href="index.php?page=liste_factures&sort=dossier">dossier</a></div></td>
    <td width="10%" class="texte">
<div align="center"><a href="index.php?page=liste_factures&sort=montant">montant</a></div></td>
    <td width="6%" class="texte">
<div align="center"><a href="index.php?page=liste_factures&sort=date">date</a></div></td>
    <td width="8%" class="texte">
<div align="center"><a href="index.php?page=liste_factures&sort=datefacture">date 
        facture</a></div></td>
  </tr>
<?php 
if(!isset($HTTP_GET_VARS['sort'])){
	$sort = 'id';
}
else{
	$sort = $HTTP_GET_VARS['sort'];
}
echo ListeFactures($sort); 
?>
</table>
Return current item: paperasse