<html> 
 <head>
 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>DEBUG</title>
 </head>
<body>

<?php 
//Fichiers contenant les fonctions utilis&eacute;es dans le script.
require("../outils/gui.php");
require("../outils/session.php");
require("../outils/mise_en_page.php");


//V&eacute;rifier si la session est valide.
verifierSession($Bsession_id);

//V&eacute;rifier les droits de l'utilisateur.
$privilege_base = lirePrivilege($Bsession_id);
if ($privilege_base != 2)
	die("Vous n'avez pas les droits!");

	
	
//***********************************************************************************
// INITIALISATION DES VARIABLES *****************************************************
//***********************************************************************************	
$p4010=0;
$p4015=0;
$p4020=0;
$p4025=0;
$p4030=0;
$p4035=0;
$p4050=0;
$p4060=0;
$p4040=0;
$p4045=0;
$p4055=0;
$p4061=0;
	
	
print("<div align=left>");	
	
	
//***********************************************************************************
// BASE_CONTRAT *********************************************************************
//***********************************************************************************
$sql_contrat = "SELECT code_contrat, numero_contrat, num_client, date_emission, date_debut, date_fin, cal_debut, cal_fin, nuite, etat, depot, depot_lock 
        FROM base_contrat
		WHERE etat <> 'annul&eacute;'
		ORDER BY code_contrat;";
$result_contrat = mysql_query($sql_contrat)
	or die ("Ne peut lire dans la table des membres".$sql_contrat);
$num_contrat = mysql_numrows($result_contrat);



while ($row_contrat = mysql_fetch_row ($result_contrat))
{

	if ($num_contrat)
	{
		$i = 0;
		$code_contrat = ($row_contrat[$i++]);
		$numero_contrat = ($row_contrat[$i++]);
		$num_client = ($row_contrat[$i++]);
		$date_emission = ($row_contrat[$i++]);
		$date_debut = ($row_contrat[$i++]);
		$date_fin = ($row_contrat[$i++]);
		$cal_debut = ($row_contrat[$i++]);
		$cal_fin = ($row_contrat[$i++]);
		$nuite = ($row_contrat[$i++]);
		$etat = ($row_contrat[$i++]);
		$depot = ($row_contrat[$i++]);
		$depot_lock = ($row_contrat[$i++]);
	}
	else
	{
		die ("Il y a un probl&egrave;me dans la base de donn&eacute;es !".$sql_contrat);
	}
	
	//***********************************************************************************
	// BASE_CLIENT **********************************************************************
	//***********************************************************************************
	$sql_client = "SELECT type
	       	FROM base_clients
		    WHERE base_clients.code_client = '$num_client';";
	$result_client = mysql_query($sql_client) or die ("Ne peut lire dans la table des clients".$sql_client);
	$num_client = mysql_numrows($result_client);
	if ($num_client)
	{
		$h = 0;
		$row_client = mysql_fetch_row ($result_client);
		$type = ($row_client[$h++]);
	}
	else
	{
		die ("Il y a un probl&egrave;me dans la base de donn&eacute;es !".$sql_client);
	}
	mysql_free_result ($result_client);
	
	print("<table cellspacing=0 cellpadding=0 border=1><tr>");
	print("<td rowspan=2><img src=icon_contrat.gif></td>");
	print("<td bgcolor=#A2A400><B>code_contrat</B></td>");
	print("<td bgcolor=#A2A400><B>numero_contrat</B></td>");
	print("<td bgcolor=#A2A400 width=70px><B>type</B></td>");
	print("<td bgcolor=#A2A400><B>date_emission</B></td>");
	print("<td bgcolor=#A2A400><B>date_debut</B></td>");
	print("<td bgcolor=#A2A400><B>date_fin</B></td>");
	print("<td bgcolor=#A2A400><B>cal_debut</B></td>");
	print("<td bgcolor=#A2A400><B>cal_fin</B></td>");
	print("<td bgcolor=#A2A400><B>nuite</B></td>");
	print("<td bgcolor=#A2A400 width=40px><B>etat</B></td>");
	print("<td bgcolor=#A2A400 width=60px><B>depot</B></td>");
	print("<td bgcolor=#A2A400><B>depot_lock</B></td>");
		
	print("</tr><tr>");
	
	print("<td bgcolor=#A2A400>".$code_contrat."</td>");
	print("<td bgcolor=#A2A400>".$numero_contrat."</td>");
	print("<td bgcolor=#A2A400>".$type."</td>");
	print("<td bgcolor=#A2A400>".$date_emission."</td>");
	print("<td bgcolor=#A2A400>".$date_debut."</td>");
	print("<td bgcolor=#A2A400>".$date_fin."</td>");
	print("<td bgcolor=#A2A400>".$cal_debut."</td>");
	print("<td bgcolor=#A2A400>".$cal_fin."</td>");
	print("<td bgcolor=#A2A400>".$nuite."</td>");
	print("<td bgcolor=#A2A400>".$etat."</td>");
	print("<td bgcolor=#A2A400>".$depot."</td>");
	print("<td bgcolor=#A2A400>".$depot_lock."</td>");
	
	print("</tr></table>");


	
	
	//***********************************************************************************
	// BASE_CHALET **********************************************************************
	//***********************************************************************************
	$sql_chalet = "SELECT base_ref1chalets.nom, base_chalets.num_chalet, base_chalets.prix_par_jour, base_chalets.prix_plein, base_chalets.prix_rabais,
	               base_chalets.actif, base_chalets.date_modif
	   		  FROM base_ref1chalets, base_chalets
			 WHERE base_chalets.code_contrat = '$code_contrat'
	 			  AND base_chalets.actif = 'O'
				  AND base_chalets.reservation = 'N'
	              AND base_ref1chalets.num_chalet = base_chalets.num_chalet;";
	$result_chalet = mysql_query($sql_chalet) or die ("Ne peut lire dans la table base_ref1chalets<br><br>".$sql_chalet);
	$num_chalet = mysql_numrows($result_chalet);
	while ($row_chalet = mysql_fetch_row ($result_chalet))
	{	
	
		if ($num_chalet)
		{
			$j = 0;
			$chalet_nom = ($row_chalet[$j++]);
			$chalet_num_chalet = ($row_chalet[$j++]);
			$chalet_prix_par_jour = ($row_chalet[$j++]);
			$chalet_prix_plein = ($row_chalet[$j++]);
			$chalet_prix_rabais = ($row_chalet[$j++]);
			$chalet_actif = ($row_chalet[$j++]);
			$chalet_date_modif = ($row_chalet[$j++]);
			//incrementation des variables calculatrices
			if ($type == "SMM")	       $p4010 = $p4010 + $chalet_prix_rabais;
			if ($type == "Trio")       $p4015 = $p4015 + $chalet_prix_rabais;
			if ($type == "Ext")		   $p4020 = $p4020 + $chalet_prix_rabais;
			if ($type == "District")   $p4025 = $p4025 + $chalet_prix_rabais;	
			if ($type == "Famille")    $p4030 = $p4030 + $chalet_prix_rabais;	
			if ($type == "Autres")     $p4035 = $p4035 + $chalet_prix_rabais;	
		}
		else
		{
			die ("Il y a un probl&egrave;me dans la base de donn&eacute;es !".$sql_chalet);
		}	
		print("<table cellspacing=0 cellpadding=0 border=1><tr>");
		print("<td rowspan=2><img src=icon_chalet.gif></td>");
		print("<td bgcolor=#D4D600 width=200px><B>chalet_nom</B></td>");
		print("<td bgcolor=#D4D600><B>num_chalet</B></td>");
		print("<td bgcolor=#D4D600><B>prix_par_jour</B></td>");
		print("<td bgcolor=#D4D600><B>prix_plein</B></td>");
		print("<td bgcolor=#D4D600><B>prix_rabais</B></td>");
		print("<td bgcolor=#D4D600><B>actif</B></td>");
		print("<td bgcolor=#D4D600><B>date_modif</B></td>");
			
		print("</tr><tr>");
	
		print("<td bgcolor=#D4D600>".$chalet_nom."</td>");
		print("<td bgcolor=#D4D600>".$chalet_num_chalet."</td>");
		print("<td bgcolor=#D4D600>".$chalet_prix_par_jour."</td>");
		print("<td bgcolor=#D4D600>".$chalet_prix_plein."</td>");
		print("<td bgcolor=#D4D600>".$chalet_prix_rabais."</td>");
		print("<td bgcolor=#D4D600>".$chalet_actif."</td>");
		print("<td bgcolor=#D4D600>".$chalet_date_modif."</td>");
			
		print("</tr></table>");
	}

	
	
	//***********************************************************************************
	// BASE_CAFETERIA *******************************************************************
	//***********************************************************************************
	$sql_cafe = "SELECT nb_pers, nb_repas, prix_par_repas, lunchpm, prix_lunchpm, prix_plein, prix_rabais, date_modif
	   	    FROM base_cafeteria
	       WHERE code_contrat ='$code_contrat'
		   AND actif ='O';";
	$result_cafe = mysql_query($sql_cafe) or die ("Ne peut lire dans la table des base_nb_clients".$sql_cafe);
	$num_cafe = mysql_numrows($result_cafe);		
	
	if ($num_cafe)
	{
		$k = 0;
		$row_cafe = mysql_fetch_row ($result_cafe);
		$cafe_nb_pers = ($row_cafe[$k++]);
		$cafe_nb_repas = ($row_cafe[$k++]);
		$cafe_prix_par_repas = ($row_cafe[$k++]);
		$cafe_lunchpm = ($row_cafe[$k++]);
		$cafe_prix_lunchpm = ($row_cafe[$k++]);
		$cafe_prix_plein = ($row_cafe[$k++]);
		$cafe_prix_rabais = ($row_cafe[$k++]);
		$cafe_date_modif = ($row_cafe[$k++]);
		//incrementation des variables calculatrices
		$p4060 = $p4060 + $cafe_prix_rabais;
		
		print("<table cellspacing=0 cellpadding=0 border=1><tr>");
		print("<td rowspan=2><img src=icon_cafe.gif></td>");
		print("<td bgcolor=#6A8EFE><B>nb_pers</B></td>");
		print("<td bgcolor=#6A8EFE><B>nb_repas</B></td>");	
		print("<td bgcolor=#6A8EFE><B>prix_par_repas</B></td>");
		print("<td bgcolor=#6A8EFE><B>lunchpm</B></td>");
		print("<td bgcolor=#6A8EFE><B>prix_lunchpm</B></td>");
		print("<td bgcolor=#6A8EFE><B>prix_plein</B></td>");
		print("<td bgcolor=#6A8EFE><B>prix_rabais</B></td>");
		print("<td bgcolor=#6A8EFE><B>date_modif</B></td>");
					
		print("</tr><tr>");
	
		print("<td bgcolor=#6A8EFE>".$cafe_nb_pers."</td>");
		print("<td bgcolor=#6A8EFE>".$cafe_nb_repas."</td>");
		print("<td bgcolor=#6A8EFE>".$cafe_prix_par_repas."</td>");
		print("<td bgcolor=#6A8EFE>".$cafe_lunchpm."</td>");
		print("<td bgcolor=#6A8EFE>".$cafe_prix_lunchpm."</td>");
		print("<td bgcolor=#6A8EFE>".$cafe_prix_plein."</td>");
		print("<td bgcolor=#6A8EFE>".$cafe_prix_rabais."</td>");
		print("<td bgcolor=#6A8EFE>".$cafe_date_modif."</td>");
					
		print("</tr></table>");
	}
	
	
	//***********************************************************************************
	// BASE_ACTIVITE ********************************************************************
	//***********************************************************************************
	$sql_activite = "SELECT base_ref1activites.nom, base_activites.prix_plein, base_activites.prix_rabais,
	                base_activites.num_activite, base_activites.inclu, base_activites.date_modif, base_ref1activites.compte_budget
	   		  FROM base_ref1activites, base_activites
			 WHERE base_activites.code_contrat = '$code_contrat'	   
               AND base_ref1activites.num_activite = base_activites.num_activite
			   AND base_activites.actif = 'O';";
	$result_activite = mysql_query($sql_activite) or die ("Ne peut lire dans la table base_activites<br><br>".$sql_activite);
	$num_activite = mysql_numrows($result_activite);	
	while ($row_activite = mysql_fetch_row ($result_activite))
	{	
	
		if ($num_activite)
		{
			$l = 0;
			$activite_nom = ($row_activite[$l++]);
			$activite_prix_plein = ($row_activite[$l++]);
			$activite_prix_rabais = ($row_activite[$l++]);
			$activite_num_activite = ($row_activite[$l++]);
			$activite_inclu = ($row_activite[$l++]);
			$activite_date_modif = ($row_activite[$l++]);
			$activite_compte_budget = ($row_activite[$l++]);
			//incrementation des variables calculatrices
			if ($activite_compte_budget == "4010") $p4010 = $p4010 + $activite_prix_rabais;
			if ($activite_compte_budget == "4015") $p4015 = $p4015 + $activite_prix_rabais;
			if ($activite_compte_budget == "4020") $p4020 = $p4020 + $activite_prix_rabais;
			if ($activite_compte_budget == "4025") $p4025 = $p4025 + $activite_prix_rabais;
			if ($activite_compte_budget == "4030") $p4030 = $p4030 + $activite_prix_rabais;
			if ($activite_compte_budget == "4035") $p4035 = $p4035 + $activite_prix_rabais;
			if ($activite_compte_budget == "4050") $p4050 = $p4050 + $activite_prix_rabais;
			if ($activite_compte_budget == "4060") $p4060 = $p4060 + $activite_prix_rabais;
			if ($activite_compte_budget == "4040") $p4040 = $p4040 + $activite_prix_rabais;
			if ($activite_compte_budget == "4045") $p4045 = $p4045 + $activite_prix_rabais;
			if ($activite_compte_budget == "4055") $p4055 = $p4055 + $activite_prix_rabais;
			if ($activite_compte_budget == "4061") $p4061 = $p4061 + $activite_prix_rabais;	
		}
		else
		{
			die ("Il y a un probl&egrave;me dans la base de donn&eacute;es !".$sql_activite);
		}	
		print("<table cellspacing=0 cellpadding=0 border=1><tr>");
		print("<td rowspan=2><img src=icon_act.gif></td>");
		print("<td bgcolor=#FDFF41><B>nom</B></td>");
		print("<td bgcolor=#FDFF41><B>prix_plein</B></td>");
		print("<td bgcolor=#FDFF41><B>prix_rabais</B></td>");
		print("<td bgcolor=#FDFF41><B>num_activite</B></td>");
		print("<td bgcolor=#FDFF41><B>inclu</B></td>");
		print("<td bgcolor=#FDFF41><B>date_modif</B></td>");
			
		print("</tr><tr>");
	
		print("<td bgcolor=#FDFF41>".$activite_nom."</td>");
		print("<td bgcolor=#FDFF41>".$activite_prix_plein."</td>");
		print("<td bgcolor=#FDFF41>".$activite_prix_rabais."</td>");
		print("<td bgcolor=#FDFF41>".$activite_num_activite."</td>");
		print("<td bgcolor=#FDFF41>".$activite_inclu."</td>");
		print("<td bgcolor=#FDFF41>".$activite_date_modif."</td>");
			
		print("</tr></table>");
	}	
	
	
	
	
	//***********************************************************************************
	// BASE_LOCATION ********************************************************************
	//***********************************************************************************
	$sql_loc = "SELECT base_ref1materiels.nom, base_loc_materiels.num_materiel, base_loc_materiels.quantite, base_loc_materiels.prix_plein, base_loc_materiels.prix_rabais,
	               base_loc_materiels.inclu,base_loc_materiels.date_modif, base_ref1materiels.compte_budget
	   		  FROM base_ref1materiels, base_loc_materiels
			 WHERE base_loc_materiels.code_contrat = '$code_contrat'
			   AND base_loc_materiels.actif = 'O'	   
               AND base_ref1materiels.num_materiel = base_loc_materiels.num_materiel;";
	$result_loc = mysql_query($sql_loc) or die ("Ne peut lire dans la table base_loc_materiels<br><br>".$sql_loc);
	$num_loc = mysql_numrows($result_loc);		
	while ($row_loc = mysql_fetch_row ($result_loc))
	{	
	
		if ($num_loc)
		{
			$m = 0;
			$loc_nom = ($row_loc[$m++]);
			$loc_num_materiel = ($row_loc[$m++]);
			$loc_quantite = ($row_loc[$m++]);
			$loc_prix_plein = ($row_loc[$m++]);
			$loc_prix_rabais = ($row_loc[$m++]);
			$loc_inclu = ($row_loc[$m++]);
			$loc_date_modif = ($row_loc[$m++]);
			$loc_compte_budget = ($row_loc[$m++]);
			//incrementation des variables calculatrices
			if ($loc_compte_budget == "4010") $p4010 = $p4010 + $loc_prix_rabais;
			if ($loc_compte_budget == "4015") $p4015 = $p4015 + $loc_prix_rabais;
			if ($loc_compte_budget == "4020") $p4020 = $p4020 + $loc_prix_rabais;
			if ($loc_compte_budget == "4025") $p4025 = $p4025 + $loc_prix_rabais;
			if ($loc_compte_budget == "4030") $p4030 = $p4030 + $loc_prix_rabais;
			if ($loc_compte_budget == "4035") $p4035 = $p4035 + $loc_prix_rabais;
			if ($loc_compte_budget == "4050") $p4050 = $p4050 + $loc_prix_rabais;
			if ($loc_compte_budget == "4060") $p4060 = $p4060 + $loc_prix_rabais;
			if ($loc_compte_budget == "4040") $p4040 = $p4040 + $loc_prix_rabais;
			if ($loc_compte_budget == "4045") $p4045 = $p4045 + $loc_prix_rabais;
			if ($loc_compte_budget == "4055") $p4055 = $p4055 + $loc_prix_rabais;
			if ($loc_compte_budget == "4061") $p4061 = $p4061 + $loc_prix_rabais;	
		}
		else
		{
			die ("Il y a un probl&egrave;me dans la base de donn&eacute;es !".$sql_loc);
		}	
		print("<table cellspacing=0 cellpadding=0 border=1><tr>");
		print("<td rowspan=2><img src=icon_loc.gif></td>");
		print("<td bgcolor=#FFA943><B>nom</B></td>");
		print("<td bgcolor=#FFA943><B>num_materiel</B></td>");
		print("<td bgcolor=#FFA943><B>quantite</B></td>");
		print("<td bgcolor=#FFA943><B>prix_plein</B></td>");
		print("<td bgcolor=#FFA943><B>prix_rabais</B></td>");
		print("<td bgcolor=#FFA943><B>inclu</B></td>");
		print("<td bgcolor=#FFA943><B>date_modif</B></td>");
			
		print("</tr><tr>");
	
		print("<td bgcolor=#FFA943>".$loc_nom."</td>");
		print("<td bgcolor=#FFA943>".$loc_num_materiel."</td>");
		print("<td bgcolor=#FFA943>".$loc_quantite."</td>");
		print("<td bgcolor=#FFA943>".$loc_prix_plein."</td>");
		print("<td bgcolor=#FFA943>".$loc_prix_rabais."</td>");
		print("<td bgcolor=#FFA943>".$loc_inclu."</td>");
		print("<td bgcolor=#FFA943>".$loc_date_modif."</td>");
			
		print("</tr></table>");
	}	
	
	
	
	//***********************************************************************************
	// BASE_ACHAT ***********************************************************************
	//***********************************************************************************
	$sql_achat = "SELECT base_ref1materiels.nom, base_vente_materiels.num_materiel, base_vente_materiels.quantite, base_vente_materiels.prix_plein, base_vente_materiels.prix_rabais,
	               base_vente_materiels.inclu, base_vente_materiels.date_modif, base_ref1materiels.compte_budget
	   		  FROM base_ref1materiels, base_vente_materiels
			 WHERE base_vente_materiels.code_contrat = '$code_contrat'	
			   AND base_vente_materiels.actif = 'O'   
               AND base_ref1materiels.num_materiel = base_vente_materiels.num_materiel;";
	$result_achat = mysql_query($sql_achat) or die ("Ne peut lire dans la table base_loc_materiels<br><br>".$sql_achat);
	$num_achat = mysql_numrows($result_achat);		
	while ($row_achat = mysql_fetch_row ($result_achat))
	{	
		if ($num_achat)
		{
			$n = 0;
			$achat_nom = ($row_achat[$n++]);
			$achat_num_materiel = ($row_achat[$n++]);
			$achat_quantite = ($row_achat[$n++]);
			$achat_prix_plein = ($row_achat[$n++]);
			$achat_prix_rabais = ($row_achat[$n++]);
			$achat_inclu = ($row_achat[$n++]);
			$achat_date_motif = ($row_achat[$n++]);		
			$achat_compte_budget = ($row_achat[$n++]);
			//incrementation des variables calculatrices
			if ($achat_compte_budget == "4010") $p4010 = $p4010 + $achat_prix_rabais;
			if ($achat_compte_budget == "4015") $p4015 = $p4015 + $achat_prix_rabais;
			if ($achat_compte_budget == "4020") $p4020 = $p4020 + $achat_prix_rabais;
			if ($achat_compte_budget == "4025") $p4025 = $p4025 + $achat_prix_rabais;
			if ($achat_compte_budget == "4030") $p4030 = $p4030 + $achat_prix_rabais;
			if ($achat_compte_budget == "4035") $p4035 = $p4035 + $achat_prix_rabais;
			if ($achat_compte_budget == "4050") $p4050 = $p4050 + $achat_prix_rabais;
			if ($achat_compte_budget == "4060") $p4060 = $p4060 + $achat_prix_rabais;
			if ($achat_compte_budget == "4040") $p4040 = $p4040 + $achat_prix_rabais;
			if ($achat_compte_budget == "4045") $p4045 = $p4045 + $achat_prix_rabais;
			if ($achat_compte_budget == "4055") $p4055 = $p4055 + $achat_prix_rabais;
			if ($achat_compte_budget == "4061") $p4061 = $p4061 + $achat_prix_rabais;	
		}
		else
		{
			die ("Il y a un probl&egrave;me dans la base de donn&eacute;es !".$sql_achat);
		}	
		
	
		print("<table cellspacing=0 cellpadding=0 border=1><tr>");
		print("<td rowspan=2><img src=icon_achat.gif></td>");
		print("<td bgcolor=#FFD19B><B>nom</B></td>");
		print("<td bgcolor=#FFD19B><B>num_materiel</B></td>");
		print("<td bgcolor=#FFD19B><B>quantite</B></td>");
		print("<td bgcolor=#FFD19B><B>prix_plein</B></td>");
		print("<td bgcolor=#FFD19B><B>prix_rabais</B></td>");
		print("<td bgcolor=#FFD19B><B>inclu</B></td>");
		print("<td bgcolor=#FFD19B><B>date_modif</B></td>");
					
		print("</tr><tr>");
	
		print("<td bgcolor=#FFD19B>".$achat_nom."</td>");
		print("<td bgcolor=#FFD19B>".$achat_num_materiel."</td>");
		print("<td bgcolor=#FFD19B>".$achat_quantite."</td>");
		print("<td bgcolor=#FFD19B>".$achat_prix_plein."</td>");
		print("<td bgcolor=#FFD19B>".$achat_prix_rabais."</td>");
		print("<td bgcolor=#FFD19B>".$achat_inclu."</td>");
		print("<td bgcolor=#FFD19B>".$achat_date_motif."</td>");
					
		print("</tr></table>");
	}	
	
	
	//***********************************************************************************
	// BASE_RABAIS **********************************************************************
	//***********************************************************************************
	$sql_rabais = "SELECT code_rabais, code_contrat, prix_rabais, poste_budget, actif
	 	   		     FROM base_rabais
			        WHERE base_rabais.code_contrat = '$code_contrat'	
			          AND base_rabais.actif = 'O';";
	$result_rabais = mysql_query($sql_rabais) or die ("Ne peut lire dans la table base_rabais<br><br>".$sql_rabais);
	$num_rabais = mysql_numrows($result_rabais);		
	while ($row_rabais = mysql_fetch_row ($result_rabais))
	{	
		if ($num_rabais)
		{
			$n = 0;
			$rabais_code = ($row_rabais[$n++]);
			$rabais_code_contrat = ($row_rabais[$n++]);
			$rabais_prix = ($row_rabais[$n++]);
			$rabais_compte_budget = ($row_rabais[$n++]);
			$rabais_actif = ($row_rabais[$n++]);
			//incrementation des variables calculatrices
			if ($rabais_compte_budget == "4010") $p4010 = $p4010 - $rabais_prix;
			if ($rabais_compte_budget == "4015") $p4015 = $p4015 - $rabais_prix;
			if ($rabais_compte_budget == "4020") $p4020 = $p4020 - $rabais_prix;
			if ($rabais_compte_budget == "4025") $p4025 = $p4025 - $rabais_prix;
			if ($rabais_compte_budget == "4030") $p4030 = $p4030 - $rabais_prix;
			if ($rabais_compte_budget == "4035") $p4035 = $p4035 - $rabais_prix;
			if ($rabais_compte_budget == "4050") $p4050 = $p4050 - $rabais_prix;
			if ($rabais_compte_budget == "4060") $p4060 = $p4060 - $rabais_prix;
			if ($rabais_compte_budget == "4040") $p4040 = $p4040 - $rabais_prix;
			if ($rabais_compte_budget == "4045") $p4045 = $p4045 - $rabais_prix;
			if ($rabais_compte_budget == "4055") $p4055 = $p4055 - $rabais_prix;
			if ($rabais_compte_budget == "4061") $p4061 = $p4061 - $rabais_prix;
		}
		else
		{
			die ("Il y a un probl&egrave;me dans la base de donn&eacute;es !".$sql_rabais);
		}	
		
	
		print("<table cellspacing=0 cellpadding=0 border=1><tr>");
		print("<td rowspan=2><img src=icon_rabais.gif></td>");
		print("<td bgcolor=white><B>code</B></td>");
		print("<td bgcolor=white><B>prix</B></td>");
		print("<td bgcolor=white><B>poste_budget</B></td>");
		print("<td bgcolor=white><B>actif</B></td>");
					
		print("</tr><tr>");
	
		print("<td bgcolor=white>".$rabais_code."</td>");
		print("<td bgcolor=white>".$rabais_prix."</td>");
		print("<td bgcolor=white>".$rabais_compte_budget."</td>");
		print("<td bgcolor=white>".$rabais_actif."</td>");
					
		print("</tr></table>");
	}
	
	
	

	print("<BR><BR>");	
}

print("nombre de contrat=".$num_contrat."<BR><BR>");


print("<table><tr><td valign=top>");
print("<font color=blue>CALCUL AVEC DONN&Eacute;ES<BR>");
print("poste 4010 = ");
printf('%01.2f',$p4010);
print("<BR>poste 4015 = ");
printf('%01.2f',$p4015);
print("<BR>poste 4020 = ");
printf('%01.2f',$p4020);
print("<BR>poste 4025 = ");
printf('%01.2f',$p4025);
print("<BR>poste 4030 = ");
printf('%01.2f',$p4030);
print("<BR>poste 4035 = ");
printf('%01.2f',$p4035);
print("<BR>poste 4050 = ");
printf('%01.2f',$p4050);
print("<BR>poste 4060 = ");
printf('%01.2f',$p4060);
print("<BR>poste 4040 = ");
printf('%01.2f',$p4040);
print("<BR>poste 4045 = ");
printf('%01.2f',$p4045);
print("<BR>poste 4055 = ");
printf('%01.2f',$p4055);
print("<BR>poste 4061 = ");
printf('%01.2f',$p4061);

print("</font></td><td>");

$sql_poste = "SELECT base_poste.montant
	   		  FROM base_poste;";
	$result_poste = mysql_query($sql_poste) or die ("Ne peut lire dans la table _poste<br><br>".$sql_poste);
	
	print("<font color=red>DONN&Eacute;ES DANS TABLE<BR>");
	while ($row_poste = mysql_fetch_row ($result_poste))
	{	
		print(" ".$row_poste[0]."<BR>");
	}	

print("</td></tr></table>");
	










?>

</body>
</html>	
