1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<?php
if (!empty($titre)) //Si le titre est indiqué, on l'affiche entre les balises <title>
{
echo '<title> '.$titre.' </title>';
}
else //Sinon, on écrit forum par défaut
{
echo '<title> dus region </title>';
}
?>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" media="screen" type="text/css" title="Design" href="#" />
</head>
<body>
<h2><center><b><u> Ventilation des montants par année d'origine</u></b></center></h2><br><br>
<a href="../index.php"> Retour à l'index</a><br>
<?php
include('../includes/inc_conexion.php');
$result = mysql_query("SELECT nom_region FROM region ORDER BY id ASC")or die(mysql_error());
echo '<form action="synthese_region.php" method="post">';
echo '<select name="frm_select_region">';
while ($row = mysql_fetch_array($result))
{
//si c'est le nom de la région qui est commun aux deux tables c'est le champ nom_region que tu dois mettre en value de ton select//
echo '<option value="'.$row['nom_region'].'">'.$row['nom_region'].'</option>';
}
echo '</select>';
echo '<input type="submit" value="Go" />';
echo '</form>';
$var = "";
$ligne = "<table width='100%' border=1 color=black'><tr>
<td bgcolor='#669999'><b><u>Numero</u></b></td>
<td bgcolor='#669999'><b><u>Societe</u></b></td>
<td bgcolor='#669999'><b><u>Adhérent</u></b></td>
<td bgcolor='#669999'><b><u>Montant</u></b></td>
<td bgcolor='#669999'><b><u>Anterieur à 2008</u></b></td>
<td bgcolor='#669999'><b><u>2008</u></b></td>
<td bgcolor='#669999'><b><u>2009</u></b></td>
<td bgcolor='#669999'><b><u>2010</u></b></td>
<td bgcolor='#669999'><b><u>- 1 mois</u></b></td>
<td bgcolor='#669999'><b><u>Vérif</u></b></td>
";
$total = 0;
if(isset($_POST["frm_select_region"]) AND $_POST["frm_select_region"] != NULL)
{
$var = $_POST["frm_select_region"];
$rqt2 = mysql_query("SELECT * FROM societe WHERE nom_region = '$var' ORDER BY societe")or die(mysql_error());
}
else
{
$rqt2 = mysql_query("SELECT * FROM societe ORDER BY societe")or die(mysql_error());
}
echo("Région selectionnée : $var </br></br>");
if(mysql_num_rows($rqt2) > 0)
{
while($tableau2 = mysql_fetch_array($rqt2))
{
$id = $tableau2['id_numero'];
$societe = $tableau2['societe'];
$adherent = $tableau2['adherent'];
$ville = $tableau2['ville'];
$region = $tableau2['nom_region'];
$enseigne = $tableau2['enseigne'];
$telephone = $tableau2['telephone'];
$fax = $tableau2['fax'];
$siret = $tableau2['siret'];
$rqt = mysql_query("SELECT * FROM facture WHERE id_numero = '$id' ORDER BY `id_numero`")or die(mysql_error());
$mont = 0;
while($tableau = mysql_fetch_array($rqt))
{
$mont += addslashes($tableau['montant']);
}
$total += $mont;
//**********************************************************************************************
//condition des repartition des montants selon l'année d'appartenance
//**********************************************************************************************
$mont_1 = 0; $total_1 = 0;
$mont_2 = 0; $total_2 = 0;
$mont_3 = 0; $total_3 = 0;
$mont_4 = 0; $total_4 = 0;
$mont_5 = 0; $total_5 = 0;
$mont_6 = 0; $total_6 = 0;
$sannee="";
if ($annee =2008 AND $mont_2 > 0)
{
$mont_2 += addslashes($tableau['montant']);
}
elseif ($annee = 2009 AND $mont_3 > 0)
{
$mont_3 += addslashes($tableau['montant']);
}
else
{
$mont_1 += addslashes($tableau['montant']);
}
//********************************************************************************************
if($mont > 0)
{
$ligne .= "<tr>
<td><a href='fiche_pdv.php?numero=$id' target='_self'>".$id."</a></td>
<td>".$societe."</td>
<td>".$adherent."</td>
<td align='right'>".$mont."</td>
<td align='right'>".$mont_1."</td>
<td align='right'>".$mont_2."</td>
<td align='right'>".$mont_3."</td>
<td align='right'>".$mont_4."</td>
<td align='right'>".$mont_5."</td>
<td align='right'>".$mont."</td>
</tr>";
}
}
$ligne .= "<tr><td colspan='3' font-color='yellow'>Total Final</td><td align='right'>".$total."</td>";
$ligne .= "<td colspan='1' align='right'>".$total_1."</td>";
$ligne .= "<td colspan='1' align='right'>".$total_2."</td>";
$ligne .= "<td colspan='1' align='right'>".$total_3."</td>";
$ligne .= "<td colspan='1' align='right'>".$total_4."</td>";
$ligne .= "<td colspan='1' align='right'>".$total_5."</td>";
$ligne .= "<td colspan='9' align='right'>".$total."</td></tr>";
$ligne .= "</table>";
}
echo $ligne;
mysql_close();
?> |
Partager