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
| function verifaffichagecase($nomcomref,$condition2,$condition,$orderby,$visuel)
{
$couleurtd='';
$sql = "SELECT t1.id
FROM rdv AS t1
INNER JOIN prospet AS t2
ON t2.id = t1.idclient AND (t1.idcomm='$nomcomref' OR t1.idcomm2='$nomcomref') $condition2
order BY t1.id DESC";
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$data = mysql_fetch_array($req);
$id=$data['id'];
$condition.="AND t1.id = '$id'";
affichagecase($nomcomref,$condition,$orderby,$visuel);
}
function affichagecase($nomcomref,$condition,$orderby,$visuel)
{
$couleurtd='';
$datejour = date("Ymd");
$sql = "SELECT t1.idclient, t2.nomclient, t2.prenomclient, t2.cp ,t2.ville, t2.telephone, t2.portable, t2.adresse, t4.couleur, t1.id, t1.rdvcommheure , t1.rdvcomm, t1.confirmcom, t1.resultatrdv, t2.rdv
FROM rdv AS t1
INNER JOIN prospet AS t2
ON t2.id = t1.idclient AND (t1.idcomm='$nomcomref' OR t1.idcomm2='$nomcomref') $condition
LEFT JOIN zone AS t3
ON t3.cp=t2.cp and t3.Idcomm='$nomcomref'
LEFT JOIN couleur AS t4
ON (t3.Idcouleurs=t4.Id OR ISNULL(t4.couleur))
order BY t1.$orderby ASC";
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
while($data = mysql_fetch_array($req))
{ ....}
verifaffichagecase($nomcomref,"AND t1.confirm = '3' and t1.resultatrdv ='0'","AND t1.confirmrappel = '$daterdvref' and t1.confirm = '3' and t1.resultatrdv ='0'","rdvcommheure","rappel");
verifaffichagecase($nomcomref,"AND t1.resultatrdv ='3'","AND t1.rappel = '$daterdvref' and t1.resultatrdv ='3'","rappel","rappel");
affichagecase($nomcomref,"AND t1.rdvcomm = '$daterdvref' and t1.resultatrdv !='4' and t1.resultatrdv !='8'and (t1.confirm = '0' or t1.confirm =1 or t1.confirm ='5')","rdvcommheure","rdv"); |