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
| //je me connecte à la base de données, et je séléctionne tous les clients du commercial
<? include 'connection_ser.php';
$sql=" SELECT cli_client_id,
cli_dossier_id,
adr_nom,
sui_cc,
sui_priorite,
sui_objectif,
sui_vis_prevue,
sui_classification
FROM clients
LEFT JOIN SUIVI
ON cli_client_id=sui_cli_id
WHERE cli_cial_id='".$_SESSION['cial_id']."'";
$sql_result = mssql_query($sql,$connection);
$color=0;
while ($row = mssql_fetch_array($sql_result))
{
//pour chaque résultat, j'affiche une ligne
?>
<tr class="textePetit" <? if ($color==0) echo "bgcolor='#FFFFFF'";>>
<?
//je fais des sommes de commissions par chaque client
$num_client=$row["cli_client_id"];
$sql_com="SELECT pol_client_id,
sum(ligq_commission)AS somme_com
FROM QUITTANCES
where ligq_dtesaisie BETWEEN '01/01/2005' AND '31/12/2005'
and pol_client_id=$num_client
GROUP BY pol_client_id";
$sql_result_com = mssql_query($sql_com,$connection);
$row_com= mssql_fetch_array($sql_result_com);
//je fais une somme des potentiels de chaque client
$sql_pot="SELECT pot_cli_id,
sum(pot_potentiel)as somme_pot
FROM potentiel
WHERE pot_cli_id=$num_client
GROUP BY pot_cli_id";
$sql_result_pot = mssql_query($sql_pot,$connection);
$row_pot= mssql_fetch_array($sql_result_pot);
?>
//je post dans la même page et j'affiche les résultats dans les inputs
<form method="POST" action="suivi_cli.php">
<td height="30" align="left" class="textePetit" ><a href="qualification.php?OB_client=<? print $row["cli_client_id"] ?>" style="color:#646464"><? echo $row["cli_dossier_id"] ?>-<? echo $row["adr_nom"] ?></a></td>
<td align="right" ><? echo $row_com["somme_com"]; ?></td>
<td align="right"><? echo $row_pot["somme_pot"] ;?></td>
<td align="right" ><? if ($row_pot["somme_pot"]!="") echo number_format((($row_com["somme_com"]/$row_pot["somme_pot"])*100), 2, '.', ' '); ?> </td>
td align="center"></td>
<td align="center">
<input name="cc" type="checkbox" value="1" <? if (isset($row["sui_cc"]) && ($row["sui_cc"]==1)) Print 'checked';?>> </td>
<td align="center">
<select class="textePetit form" name="PC" >
<option <? if (isset($row["sui_priorite"]) && $row["sui_priorite"]=='Séléctionnez') Print 'selected' ; ?> value="0">
Séléctionner</option>
<option <? if (isset($row["sui_priorite"]) && $row["sui_priorite"]=='Fidélisation') Print 'selected' ; ?> value"Fidélisation">Fidélisation</option>
<option <? if (isset($row["sui_priorite"]) && $row["sui_priorite"]=='Développement') Print 'selected' ; ?> value="Développement">Développement</option>
<option <? if (isset($row["sui_priorite"]) && $row["sui_priorite"]=='Acquisition') Print 'selected' ; ?> value="Acquisition">Acquisition</option>
<option <? if (isset($row["sui_priorite"]) && $row["sui_priorite"]=='Qualification') Print 'selected' ; ?> value="Qualification">Qualification</option>
</select> </td>
<td align="center"><input type="text" name="OB" class="textePetit form" size="7" value="<? if (isset($row["sui_objectif"])) Print $row["sui_objectif"]; ?>"></td>
<td div align="center"><input type="text" name="NV" size="2" class="textePetit form" value="<? if (isset($row["sui_vis_prevue"])) Print $row["sui_vis_prevue"]; ?>"></td>
<input type="hidden" name="ID_CLI" value="<? print $row["cli_client_id"] ?>">
<td div align="center"><input type="image" src="images/puce.gif" width="19" height="12"></td>
</form>
</tr>
<?
//je fais un tableau avec une différence de couleur pour chaque ligne
if ($color==0)
{
$color=1;
}
else
{
$color=0;
}
}
include 'close_connect.php'; //je ferme ma connection
?> |
Partager