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 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
|
session_start();
include 'connexion_db.php';
include 'prospect.js';
function afficher_ligne($cpt, $enr)
{ // alternance des couleurs des lignes de réponses
$couleur = ($cpt % 2)
? '#EEEEEE'
: '#FFFFFF';
echo "<tr id=".$cpt." bgcolor='#303030' align='center' onmouseover=setPointer(this,".$cpt.",'over'); onmouseout=setPointer(this,".$cpt.",'out'); onmousedown=setPointer(this,".$cpt.",'click');> ";
//echo "<form name=form".$cpt." method=post action='indexA.php?page=paramlettre'>";
// n° de réponse
// echo '<TD ALIGN="right" bgcolor="#303030" class="px12c" NOWRAP WIDTH="1%"> <B>'.$cpt.'</B>. </TD>';
// cod_prospect
echo '<TD ALIGN="left" bgcolor="#303030" class="px12c" NOWRAP WIDTH="1%"> ';
echo htmlspecialchars($enr['COD_PROSPECT']);
$codepros= htmlspecialchars($enr['COD_PROSPECT']);
echo "<input type=hidden name=code_prosp value='".$enr['COD_PROSPECT']."'>";
echo ' </TD>';
//date_prosect
echo '<TD ALIGN="left" bgcolor="#303030" class="px12c" NOWRAP WIDTH="1%"> ';
echo htmlspecialchars($enr['DATE_PROSPECT']);
echo ' </TD>';
//civilité
echo '<TD ALIGN="left" bgcolor="#303030" class="px12c" NOWRAP WIDTH="1%"> ';
echo htmlspecialchars($enr['CIVILITE']);
echo ' </TD>';
if ( isset($enr['CIVILITE']) && strtolower($enr['CIVILITE'])=="mlle") echo "<input name='Civilite' type=hidden value=1>\n" ;
if ( isset($enr['CIVILITE']) && strtolower($enr['CIVILITE'])=="mme") echo "<input name='Civilite' type=hidden value=2>\n" ;
if ( isset($enr['CIVILITE']) && strtolower($enr['CIVILITE'])=="mr") echo "<input name='Civilite' type=hidden value=3>\n" ;
// nom+email
echo '<TD ALIGN="left" bgcolor="#303030" class="px12c" NOWRAP WIDTH="1%"> ';
$nom = htmlspecialchars($enr['NOM']);
if ($enr['EMAIL'] != "")
{
$mail=$enr['EMAIL'];
// $mail = str_replace('@', '_at_', $enr['EMAIL']);
echo "<A href='javascript:form".$cpt.".submit();'>";
echo $nom;
echo "</A>";
echo "<input type=hidden name='mail' value='".htmlspecialchars($mail)."'/>";
}
else { echo $nom; }
echo ' </TD>';
echo "<input type=hidden name=nom value='$nom' />";
//prénom
echo '<TD ALIGN="left" bgcolor="#303030" class="px12c" NOWRAP WIDTH="1%"> ';
echo htmlspecialchars($enr['PRENOM']);
echo "<input type=hidden name=prenom value='".$enr['PRENOM']."' />";
$query="select nom_inst, doc from instrument, prospect_instrument where prospect_instrument.cod_prospect=".$enr['COD_PROSPECT']." and instrument.cod_inst=prospect_instrument.cod_inst";
$R=mysql_query($query);
if(mysql_num_rows($R)>0)
{
$ins=mysql_fetch_array($R);
echo "<input type=hidden name=instrument value='".$ins['doc']."+".$ins['nom_inst']."' />";
}
// echo $ins['doc']."+".$ins['nom_inst'];
echo ' </TD>';
echo '</form>';
//Téléphone
echo '<TD ALIGN="left" bgcolor="#303030" class="px12c" NOWRAP WIDTH="1%"> ';
echo htmlspecialchars($enr['TEL']);
echo ' </TD>';
//Adresse
echo '<TD ALIGN="left" bgcolor="#303030" class="px12c" NOWRAP WIDTH="1%"> ';
echo htmlspecialchars($enr['ADRESSE']);
echo ' </TD>';
//Cp
echo '<TD ALIGN="left" bgcolor="#303030" class="px12c" NOWRAP WIDTH="1%"> ';
echo htmlspecialchars($enr['CODE_POSTAL']);
echo ' </TD>';
//Ville
echo '<TD ALIGN="left" bgcolor="#303030" class="px12c" NOWRAP WIDTH="1%"> ';
echo htmlspecialchars($enr['VILLE']);
// echo ' </TD>';
echo'<TD ALIGN="center" bgcolor="#303030" class="px12c" NOWRAP WIDTH="1%"> ';
//echo"<form name='creation' method='post'>";
//echo '<a href="indexA.php?page=fichepros3&code='.$enr["COD_PROSPECT"].'" ><img src="loupe.png" border=0></a>    ';
echo"<form action='indexA?page=creationpdf' method=post>";
echo "<INPUT type=checkbox name=\"doc\" value=\"$codepros\"/>";
// echo '<a HREF="indexA.php?page=delprospect&code='.$enr["COD_PROSPECT"].'" onCLick="return confirm(\'ATTENTION : Êtes-vous sur de vouloir supprimer cet enregistrement ?\')">
//<img src="annul.png" border=0></A>';
}
// If current page number, use it
// if not, set one!
/*if (isset($_GET['sup']))
{
echo"<script>confirm('ATTENTION : Êtes-vous de vouloir supprimer cet enregistrement ')</script>";
}*/
/*if(isset($_POST['n_ch_prospect'])) $n_ch_prospect=$_POST['n_ch_prospect'];
else $n_ch_prospect="" ;
if(isset($_POST['p_ch_prospect'])) $p_ch_prospect=$_POST['p_ch_prospect'];
else $p_ch_prospect="";*/
if(isset($_POST['c_ch_prospect'])) $c_ch_prospect=$_POST['c_ch_prospect'];
else $c_ch_prospect="";
if(isset($_POST['v_ch_prospect'])) $v_ch_prospect=$_POST['v_ch_prospect'];
else $v_ch_prospect="";
if(isset($_POST['n_contact'])) $n_contact=$_POST['n_contact'];
else $n_contact="";
//recupération de la date fin
if(isset($_POST['jf'])) $jf=$_POST['jf'];
else $jf="" ;
if(isset($_POST['mf'])) $mf=$_POST['mf'];
else $mf="" ;
if(isset($_POST['af'])) $af=$_POST['af'];
else $af="" ;
$date_fin="$af-$mf-$jf";
// recupération de la date début
if(isset($_POST['jd'])) $jd=$_POST['jd'];
else $jd="" ;
if(isset($_POST['md'])) $md=$_POST['md'];
else $md="" ;
if(isset($_POST['ad'])) $ad=$_POST['ad'];
else $ad="" ;
$date_debut= "$ad-$md-$jd";
if(!isset($_GET['page2'])){
if ($_SESSION['3CHpage2']=="")//Dans ce cas nouvelle recherche
$page2 = 1;
else
$page2=$_SESSION['3CHpage2'];
} else {
$page2 = $_GET['page2'];
}
// Define the number of results per page
$max_results = 500;
// Figure out the limit for the query based
// on the current page number.
$from = (($page2 * $max_results) - $max_results);
if(!isset($_GET['ordre'])){
if ($_SESSION['3CHordre']=="")//Dans ce cas nouvelle recherche
$ordre = 'COD_PROSPECT';
else
$ordre = $_SESSION['3CHordre'];
} else {
$ordre = $_GET['ordre'];
}
if(!isset($_GET['critere'])){
if ($_SESSION['3CHcritere']=="")//Dans ce cas nouvelle recherche
$critere = $date_debut;
else
$critere = $_SESSION['3CHcritere'];
}
else
{
$critere=$_GET['critere'];
}
if(!isset($_GET['critere1'])){
if ($_SESSION['3CHcritere1']=="")//Dans ce cas nouvelle recherche
$critere1 = $date_fin;
else
$critere1 = $_SESSION['3CHcritere1'];
}
else
{
$critere1=$_GET['critere1'];
}
//Mise en session des infos pour le retour sur la recherche des prospects..
$_SESSION['3CHcritere2']=$critere2;
$_SESSION['3CHcritere1']=$critere1;
$_SESSION['3CHcritere']=$critere;
$_SESSION['3CHordre']=$ordre;
$_SESSION['3CHpage2']=$page2;
if(isset($_POST['n_contact'])or isset($_GET['critere3']) or ($_SESSION['3CHcritere3']!=""))
{
$controle="&critere3=vrai";
$_SESSION['3CHcritere3']="vrai";
$sql1 = "SELECT p.COD_PROSPECT,p.DATE_PROSPECT,p.NOM,p.PRENOM,p.TEL,p.EMAIL,p.CODE_POSTAL,p.CIVILITE,p.VILLE,p.ADRESSE FROM prospect p LEFT JOIN client_contact cc ON cc.cod_prospect = p.cod_prospect
WHERE p.DATE_PROSPECT>'$critere' and p.DATE_PROSPECT < '$critere1' AND cc.cod_contact IS NULL";
$sql2="SELECT COUNT(*) as Num FROM prospect p LEFT JOIN client_contact cc ON cc.cod_prospect = p.cod_prospect
WHERE p.DATE_PROSPECT >'$critere' and p.DATE_PROSPECT < ' $critere1' AND cc.cod_contact IS NULL";
}
else
{
echo $n_contact;
$controle='';
$sql1 = "SELECT * FROM prospect where prospect.date_prospect>' $critere' and prospect.date_prospect < ' $critere1'";
$sql2="SELECT COUNT(*) FROM prospect where prospect.date_prospect >' $critere' and prospect.date_prospect < ' $critere1'";
}
//LIMIT $from, $max_results
$sql1.=" order by '$ordre'";
$sql = mysql_query ($sql1);
if($total_results==0)
{
?>
<table border="1" width="43%" id="table1">
<tr>
<td bgcolor="#CCCCCC" height="63">
<p align="center"><b><font size="4">Aucun prospect ne correspond aux
critères recherchés.</font></b></td>
</tr>
<tr>
<td bgcolor="#CCCCCC">
<p align="center"><a href="indexA?page=ProsSearchP"><u><b>C</b></u><b><u>hanger les
paramètres de votre recherche</u></b></a></td>
</tr>
</table>
<?
}
else
{
$cpt = 0;
?>
<p align="center"><b><font color="#800000" size="4" face="Bookman Old Style">
LISTE DES PROSPECTS POUR LA PERIODE DU <?php echo $_SESSION['3CHcritere'];?> au <?php echo $_SESSION['3CHcritere1'];?></font></b></p>
<div id='tableau1' style='position:absolute; left:0px; overflow:auto;top:62px;height:23px; width:985px; visibility: visible'>
<table border="1" width="100%" bgcolor="#717171" CELLSPACING="1" cellpadding="1">
<tr>
<th width="5%" nowrap class="px12c">Code</A></th>
<th width="10%" nowrap class="px12c"><A href="<?php echo "$php_self?page=ch_prospect33&ordre=DATE_PROSPECT&critere=$critere&critere1=$critere1 ";?>">Date</A></th>
<th width="5%" nowrap class="px12c"><A href="<?php echo "$php_self?page=ch_prospect33&ordre=CIVILITE&critere=$critere&critere1=$critere1";?>">Civilité</A></th>
<th width="10%" nowrap class="px12c"><A href="<? echo "$php_self?page=ch_prospect33&ordre=NOM&critere=$critere&critere1=$critere1";?>">Nom</A></th>
<th width="10%" nowrap class="px12c"><A href="<? echo "$php_self?page=ch_prospect33&ordre=PRENOM&critere=$critere&critere1=$critere1 ";?>">Prénom</A></th>
<th width="10%" nowrap class="px12c">Téléphone</A> </th>
<th width="15%" nowrap class="px12c">Adresse</A></th>
<th width="5%" nowrap class="px12c"><A href="<? echo"$php_self?page=ch_prospect33&ordre=CODE_POSTAL&critere=$critere&critere1=$critere1";?>"> C.postal</A></th>
<th width="15%" nowrap class="px12c">Ville</A>
<th width="15%%" nowrap class="px12c">Actions</A>
</tr></table>
</div>
<?
echo "<div id='tableau2' style='position:absolute;scrollbar-base-color:#262626;scrollbar-face-color:#262626;scrollbar-arrow-color:#FFFFFF;scrollbar-3dlight-color:#262626;scrollbar-highlight-color:#FFFFFF;scrollbar-shadow-color:#FFFFFF;scrollbar-darkshadow-color:#262626; left:0px; overflow:auto;top:85px;height:300px; width:1000px; visibility: visible'>";
echo '<table cellspacing=1 cellpadding=3 cols=2 width="100%" bgcolor="#847977" border="0" >';
while ($enr = mysql_fetch_array($sql))
{
echo afficher_ligne($cpt + 1, $enr);
$cpt++;
echo "</tr>\n";
}
?>
</table>
</div>
<?
echo"<input type=submit value='Envoyer'>";
echo"</form>";
}
?> |
Partager