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
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Recherche</title>
<style>
table{width:100%;border-collapse:collapse}
table tr,table th,table td{border:1px solid black;}
table tr td{text-align:center;padding:1em;}
</style>
</head>
<body>
<?php include('include/db_inc_pdo.php');?>
<form method='post'>
<input type='text' placeholder='recherche' name="recherche_valeur"/>
<input type='submit' value="Rechercher"/>
</form>
<table>
<thead>
<tr><th>Annee</th></tr>
</thead>
<tbody>
<?php
$sql='SELECT
DATE_FORMAT( datearrive, "%d/%m/%Y" ) AS datea, DATE_FORMAT( datedepart, "%d/%m/%Y" ) AS dated, DATE_FORMAT( datearrive, "%Y" ) AS annee, DATEDIFF(datedepart,datearrive ) AS datediff, dateloca.nombre, dateloca.prixlocation, dateloca.caution, (dateloca.prixlocation+dateloca.caution+dateloca.linge+dateloca.litbaby) as PT, (dateloca.apaiement+dateloca.bpaiement+dateloca.cpaiement) as Totalpaye, (dateloca.prixlocation+dateloca.caution+dateloca.linge+dateloca.litbaby-dateloca.apaiement-dateloca.bpaiement-dateloca.bpaiement) as Reste, (dateloca.apaiement+dateloca.bpaiement+dateloca.cpaiement-dateloca.caution) as Totalrevenu, dateloca.apaiement, DATE_FORMAT( dateapaiement, "%d/%m/%Y" ) AS dateunp, dateloca.bpaiement, DATE_FORMAT( datebpaiement, "%d/%m/%Y" ) AS datedeuxp, dateloca.cpaiement, DATE_FORMAT( datecpaiement, "%d/%m/%Y" ) AS datetroisp, dateloca.linge, dateloca.litbaby, dateloca.degatspayes, dateloca.nonpaye, dateloca.remarques, dateloca.restitution, DATE_FORMAT( datelettre, "%d/%m/%Y" ) AS datel, (dateloca.prixlocation+dateloca.caution+dateloca.linge+dateloca.litbaby-dateloca.apaiement-dateloca.bpaiement-dateloca.cpaiement) as Reste, dateloca.appart, dateloca.envoitarifs, dateloca.envoidescriptif, dateloca.paragraphesup, dateloca.confirmation, dateloca.annul, dateloca.enfants, locataires.nom, locataires.prenom
FROM dateloca
INNER JOIN locataires ON dateloca.idnoms = locataires.idnoms WHERE locataires.reserve = "oui" AND dateloca.annul =2 AND dateloca.prixlocation >0';
$params=[];
if(isset($_POST['recherche_valeur'])){
$sql.=' where annee like :annee';
$params[':annee']="%".addcslashes($_POST['recherche_valeur'],'_')."%";
}
$resultats=$pdo->prepare($sql);
$resultats->execute($params);
if($resultats->rowCount()>0){
while($d=$resultats->fetch(PDO::FETCH_ASSOC)){
?>
<tr><td><?=$d['annee']?></td><td><?=$d['nom']?></td><td><?=$d['prenom']?></td></tr>
<?php
}
$resultats->closeCursor();
}
else echo '<tr><td colspan=4>aucun résultat trouvé</td></tr>'.
$connect=null;
?>
</tbody>
</table>
</body>
</html> |
Partager