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
| <?php
require_once('../Connections/connexion.php');
if (isset($_GET['test'])) $payss=$_GET['test'];
else $payss="0";
#connexion à la BD
$connexion = mysql_connect($hostname_connexion, $username_connexion, $password_connexion);
#Sélection de la BD
mysql_select_db($database_connexion, $connexion);
// Fonction qui affiche les entreprises en fonction du texte saisie :
function AfficheEntreprise($valeure,$status,$paysss) {
$reponse = new xajaxResponse();// Création d'une instance de xajaxResponse
//création du tableau
if ($status=="") {
if ($paysss==0){
$sql="SELECT DISTINCT entreprise.mat_entreprise, entreprise.situation_actuelle, entreprise.raison_sociale, entreprise.sigle, entreprise.adresse, entreprise.telephone1, entreprise.telephone2, entreprise.code_pays, entreprise.url_site, entreprise.email, entreprise.fax, entreprise.observation, entreprise.situation_geographique, pays.intitule_pays
FROM entreprise, pays
WHERE entreprise.code_pays=pays.code_pays AND (entreprise.sigle LIKE \"%$valeure%\" OR entreprise.raison_sociale LIKE \"%$valeure%\") AND entreprise.situation_actuelle='active'";
}
else {
$sql="SELECT DISTINCT entreprise.mat_entreprise, entreprise.situation_actuelle, entreprise.raison_sociale, entreprise.sigle, entreprise.adresse, entreprise.telephone1, entreprise.telephone2, entreprise.code_pays, entreprise.url_site, entreprise.email, entreprise.fax, entreprise.observation, entreprise.situation_geographique, pays.intitule_pays
FROM entreprise, pays
WHERE entreprise.code_pays=pays.code_pays AND entreprise.code_pays='$paysss' AND (entreprise.sigle LIKE \"%$valeure%\" OR entreprise.raison_sociale LIKE \"%$valeure%\") AND entreprise.situation_actuelle='active'";
}
}
else {
if ($paysss==0){
$sql="SELECT DISTINCT entreprise.mat_entreprise, entreprise.situation_actuelle, entreprise.raison_sociale, entreprise.sigle, entreprise.adresse, entreprise.telephone1, entreprise.telephone2, entreprise.code_pays, entreprise.url_site, entreprise.email, entreprise.fax, entreprise.observation, entreprise.situation_geographique, pays.intitule_pays
FROM entreprise, pays
WHERE entreprise.code_pays=pays.code_pays AND (entreprise.sigle LIKE \"%$valeure%\" OR entreprise.raison_sociale LIKE \"%$valeure%\")";
}
else {
$sql="SELECT DISTINCT entreprise.mat_entreprise, entreprise.situation_actuelle, entreprise.raison_sociale, entreprise.sigle, entreprise.adresse, entreprise.telephone1, entreprise.telephone2, entreprise.code_pays, entreprise.url_site, entreprise.email, entreprise.fax, entreprise.observation, entreprise.situation_geographique, pays.intitule_pays
FROM entreprise, pays
WHERE entreprise.code_pays=pays.code_pays AND entreprise.code_pays='$paysss' AND (entreprise.sigle LIKE \"%$valeure%\" OR entreprise.raison_sociale LIKE \"%$valeure%\")";
}
}
///////////////////////////////////////////////////////
$query = mysql_query($sql) or die (mysql_error());
$nbr=mysql_num_rows($query);
$j=0;
$nbr='<div id="nbreEntr" style="font-size:14px; text-align:left; color:#F00; font-family:Verdana, Geneva, sans-serif">Nombre d\'entreprises: '.$nbr.'</div>';
$valeur = $nbr.'<table id="listeEntreprise" border=1 cellspacing=0 class="affich" >
<thead>
<tr>
<th width="10%">Matricule</th>
<th width="25%">Raison Sociale</th>
<th width="10%">Sigle</th>
<th width="15%">Adresse et Fax</th>
<th width="10%">Site et Email</th>
<th width="10%">Contacts</th>
<th width="10%">Situation Géographique</th>
<th width="10%">Pays</th>
</tr>
</thead>';
$valeur.="<tbody>";
while ($row = mysql_fetch_assoc($query)) {
$mat_entreprise=trim($row['mat_entreprise']);
$raison_sociale=htmlentities(trim($row['raison_sociale']), ENT_QUOTES);
$sigle=htmlentities(trim($row['sigle']), ENT_QUOTES);
$adr_fax='Adresse: '.htmlentities(trim($row['adresse']), ENT_QUOTES);
$adr_fax.='<br/>Fax: '.htmlentities(trim($row['fax']), ENT_QUOTES);
$contact='Contact1: '.trim($row['telephone1']);
$contact.='<br/>Contact2 :'.trim($row['telephone2']);
$sitemail='Site Web: '.htmlentities(trim($row['url_site']), ENT_QUOTES);
$sitemail.='<br/>Email: '.htmlentities(trim($row['email']), ENT_QUOTES);
$sitgeo=htmlentities(trim($row['situation_geographique']), ENT_QUOTES);
if (!empty($row['intitule_pays'])) $pay=htmlentities(trim($row['intitule_pays']), ENT_QUOTES);
//$valeur.='<tr class="row1"><td>'.$mat_entreprise.'</td><td>'.$raison_sociale.'</td><td>'.$sigle.'</td><td>'.$adr_fax.'</td><td>'.$sitemail.'</td><td>'.$contact.'</td><td>'.$sitgeo.'</td><td>'.$pay.'</td></tr>';
//cas 1 : l'entreprise est active alors on cherche dans la table produits_decision toutes ses décisions
if ($j % 2 == 0){
$valeur.="<tr class=\"row1\"><td>$mat_entreprise</td><td>$raison_sociale</td><td>$sigle</td><td>$adr_fax</td><td>$sitemail</td><td>$contact</td><td>$sitgeo</td><td>$pay</td></tr>"; }
else {$valeur.="<tr><td>$mat_entreprise</td><td>$raison_sociale</td><td>$sigle</td><td>$adr_fax</td><td>$sitemail</td><td>$contact</td><td>$sitgeo</td><td>$pay</td></tr>";}
$j++;
}
$valeur.='</tbody></table>';
$reponse->assign('resultat', 'innerHTML', $valeur);
return $reponse;
}
?>
############### le formulaire
<form name="formdec" method="post" action="">
<table width="100%" border="0">
<tr>
<td width="16%" align="right">Entreprise: </td>
<td width="20%"><input type="text" name="nomentreprise" id="nomentreprise" size="40" onkeyup="<?php echo 'xajax_AfficheEntreprise(document.getElementById(\'nomentreprise\').value,formdec.ferm.checked,\''.$payss.'\');'; ?>" /></td>
<td width="64%">Inclure les Entreprises Fermées : <input name="ferm" id="ferm" type="checkbox" onclick="<?php echo 'xajax_AfficheEntreprise(document.getElementById(\'nomentreprise\').value,formdec.ferm.checked,\''.$payss.'\');'; ?>" /></td>
</tr>
</table></form> |
Partager