1 |
fraynaud |
88 |
<?php |
2 |
|
|
// $Id: recherchedossier.php,v 1.26 2010-06-21 11:46:38 jbastide Exp $ |
3 |
|
|
// version 1.02 stage julien Boyer |
4 |
|
|
/** |
5 |
|
|
* Fichiers requis |
6 |
|
|
*/ |
7 |
|
|
require_once "../obj/utils.class.php"; |
8 |
|
|
$f = new utils(NULL, NULL, _("Recherche dossier")); |
9 |
|
|
$f->addHTMLHeadJs(array("../js/script.js")); |
10 |
|
|
$condition='where'; |
11 |
|
|
|
12 |
|
|
|
13 |
|
|
function entre2dates($zone){ |
14 |
|
|
echo "<table border='0px'><tr><td>"; |
15 |
|
|
echo "<div class='choice ui-corner-all ui-widget-content'>"; |
16 |
|
|
echo "<fieldset class=\"cadre ui-corner-all ui-widget-content startClosed\">\n"; |
17 |
|
|
echo "<legend align='center' class=\"ui-corner-all ui-widget-content ui-state-active\">"; |
18 |
|
|
echo "<b>"._($zone)."</b>"; |
19 |
|
|
echo "</legend>"; |
20 |
|
|
echo "\t<div class=\"list\">\n"; |
21 |
|
|
echo ""._("Debut").":"; |
22 |
|
|
echo "<input type='text' name='".$zone."_debut' id=\"".$zone."_debut\" value=\""; |
23 |
|
|
echo "\" size=\"10\" class=\"champFormulaire datepicker\" onchange='fdate(this)' onkeyup=\"\" onclick=\"\" />\n"; |
24 |
|
|
echo "<br>"._("Fin")."__:"; |
25 |
|
|
echo "<input type='text' name='".$zone."_fin' id=\"".$zone."_fin\" value=\""; |
26 |
|
|
echo "\" size=\"10\" class=\"champFormulaire datepicker\" onchange='fdate(this)' onkeyup=\"\" onclick=\"\" />\n"; |
27 |
|
|
echo "</div>"; |
28 |
|
|
echo"</fieldset>"; |
29 |
|
|
echo "</div>"; |
30 |
|
|
echo "</td></tr></table>"; |
31 |
|
|
} |
32 |
|
|
|
33 |
|
|
function rtext($zone){ |
34 |
|
|
echo "<table border='0px'><tr><td>"; |
35 |
|
|
echo "<div class='choice ui-corner-all ui-widget-content'>"; |
36 |
|
|
|
37 |
|
|
echo "<fieldset class=\"cadre ui-corner-all ui-widget-content startClosed\">\n"; |
38 |
|
|
echo "<legend align='center' class=\"ui-corner-all ui-widget-content ui-state-active\">"; |
39 |
|
|
echo "<b>"._($zone)."</b><br>"; |
40 |
|
|
echo "</legend>"; |
41 |
|
|
echo "\t<div class=\"list\">\n"; |
42 |
|
|
//echo "<br>"; |
43 |
|
|
echo "<input type='text' name='".$zone."' size='20' maxlength='30' class='champFormulaire'>"; |
44 |
|
|
//echo "<br><br><br>"; |
45 |
|
|
echo "</div>"; |
46 |
|
|
echo"</fieldset>"; |
47 |
|
|
echo "</div>"; |
48 |
|
|
echo "</td></tr></table>"; |
49 |
|
|
} |
50 |
|
|
|
51 |
|
|
function ouinon($zone){ |
52 |
|
|
echo "<table border='0px'><tr><td>"; |
53 |
|
|
echo "<div class='choice ui-corner-all ui-widget-content'>"; |
54 |
|
|
|
55 |
|
|
echo "<fieldset class=\"cadre ui-corner-all ui-widget-content startClosed\">\n"; |
56 |
|
|
echo "<legend align='center' class=\"ui-corner-all ui-widget-content ui-state-active\">"; |
57 |
|
|
echo "<b>"._($zone)."</b><br>"; |
58 |
|
|
echo "</legend>"; |
59 |
|
|
echo "\t<div class=\"list\">\n"; |
60 |
|
|
echo "<select name='".$zone."' class='champFormulaire' SIZE='1'>"; |
61 |
|
|
echo"<option value=''>"._("votre_choix")."</option>"; |
62 |
|
|
echo"<option value='Oui'>"._("Oui")."</option>"; |
63 |
|
|
echo"<option value='Non'>"._("Non")."</option>"; |
64 |
|
|
echo "</select>"; |
65 |
|
|
echo "</div>"; |
66 |
|
|
echo"</fieldset>"; |
67 |
|
|
echo "</div>"; |
68 |
|
|
echo "</td></tr></table>"; |
69 |
|
|
} |
70 |
|
|
|
71 |
|
|
function rselect($zone,$sql,&$db){ |
72 |
|
|
echo "<table border='0px'><tr><td>"; |
73 |
|
|
echo "<div class='choice ui-corner-all ui-widget-content'>"; |
74 |
|
|
|
75 |
|
|
echo "<fieldset class=\"cadre ui-corner-all ui-widget-content startClosed\">\n"; |
76 |
|
|
echo "<legend align='center' class=\"ui-corner-all ui-widget-content ui-state-active\">"; |
77 |
|
|
echo "<b>"._($zone)."</b><br>"; |
78 |
|
|
echo "</legend>"; |
79 |
|
|
echo "\t<div class=\"list\">\n"; |
80 |
|
|
//echo "<br>"; |
81 |
|
|
echo "<select name='".$zone."' class='champFormulaire' width='20px' SIZE='1'>"; |
82 |
|
|
$res = $db->query($sql); |
83 |
|
|
if (database::isError($res)) |
84 |
|
|
die($res->getDebugInfo()." ".$sql); |
85 |
|
|
else |
86 |
|
|
{ |
87 |
|
|
echo"<option value=''>"._("votre choix")."</option>"; |
88 |
|
|
while ($row=& $res->fetchRow()) |
89 |
|
|
echo "<option value='".$row[0]."'>".$row[1]. |
90 |
|
|
"</option>"; |
91 |
|
|
} |
92 |
|
|
$res->free(); |
93 |
|
|
echo "</select><br>"; |
94 |
|
|
echo "</div>"; |
95 |
|
|
echo"</fieldset>"; |
96 |
|
|
echo "</div>"; |
97 |
|
|
echo "</td></tr></table>"; |
98 |
|
|
} |
99 |
|
|
|
100 |
|
|
// validation ==1 |
101 |
|
|
|
102 |
|
|
function rtext1($zone,$condition){ |
103 |
|
|
global $condition; |
104 |
|
|
$req= ""; |
105 |
|
|
if($_POST[$zone]!=""){ |
106 |
|
|
//$req=" ".$condition." "." ".$zone." like '%".$_POST[$zone]."%'"; |
107 |
|
|
$req=" ".$condition." "." ".$zone." like '".$_POST[$zone]."'"; |
108 |
|
|
$condition = "and"; |
109 |
|
|
} |
110 |
|
|
return $req; |
111 |
|
|
} |
112 |
|
|
|
113 |
|
|
function rselect1($zone,$condition){ |
114 |
|
|
global $condition; |
115 |
|
|
$req= ""; |
116 |
|
|
if($_POST[$zone]!=""){ |
117 |
|
|
$req=" ".$condition." "." ".$zone." = '".$_POST[$zone]."'"; |
118 |
|
|
$condition = "and"; |
119 |
|
|
} |
120 |
|
|
return $req; |
121 |
|
|
} |
122 |
|
|
|
123 |
|
|
function entre2dates1($zone,$condition){ |
124 |
|
|
global $condition; |
125 |
|
|
$req= ""; |
126 |
|
|
if($_POST[$zone."_debut"]!=""){ |
127 |
|
|
$req=" ".$condition." "." ".$zone." >= '".$_POST[$zone."_debut"]."'"; |
128 |
|
|
$condition = "and"; |
129 |
|
|
} |
130 |
|
|
if($_POST[$zone."_fin"]!=""){ |
131 |
|
|
$req.=" ".$condition." "." ".$zone." <= '".$_POST[$zone."_fin"]."'"; |
132 |
|
|
$condition = "and"; |
133 |
|
|
} |
134 |
|
|
return $req; |
135 |
|
|
} |
136 |
|
|
|
137 |
|
|
|
138 |
|
|
// variables |
139 |
|
|
$DEBUG=0; |
140 |
|
|
$annee = (int)date("Y"); //----> retourne l'annee actuelle |
141 |
|
|
// GET |
142 |
|
|
if (isset ($_GET['validation'])){ |
143 |
|
|
$validation=$_GET['validation']; |
144 |
|
|
}else{ |
145 |
|
|
$validation=0; |
146 |
|
|
} |
147 |
|
|
if($validation==0){ |
148 |
|
|
$validation=1; |
149 |
|
|
// requete sur table |
150 |
|
|
$sql_instructeur=" SELECT om_utilisateur,nom from om_utilisateur where instructeur='Oui' order by nom"; |
151 |
|
|
$sql_nature=" SELECT nature,libelle FROM nature order by libelle"; |
152 |
|
|
$sql_destination=" SELECT destination,libelle FROM destination order by libelle"; |
153 |
|
|
$sql_architecte=" SELECT architecte,nom,prenom FROM architecte order by nom,prenom"; |
154 |
|
|
$sql_travaux=" SELECT travaux,substring(libelle,0,30) FROM travaux order by libelle"; |
155 |
|
|
$sql_avis=" SELECT avis,libelle FROM avis order by libelle"; |
156 |
|
|
$sql_etat=" SELECT etat,libelle FROM etat order by libelle"; |
157 |
|
|
echo "<form method='post' name='f1' action='recherchedossier.php?validation=".$validation."'>"; |
158 |
|
|
|
159 |
|
|
echo "<table class='ui-corner-all' style='border:1px solid #000000' WIDTH='100%' cellspacing='0' cellpadding='0px'>"; |
160 |
|
|
echo "<tr><td valign='middle' align='middle'class='fd_haut_rechdossier' colspan='3'>"; |
161 |
|
|
echo "<input type='submit' name='boutonrecherche' value=' OK ' width='20px' >  "; |
162 |
|
|
echo "</tr><tr><td class='fd_rechdossier' valign='top' align='right'>"; |
163 |
|
|
rtext("dossier"); |
164 |
|
|
rtext("delegataire_nom"); |
165 |
|
|
rtext("demandeur_nom"); |
166 |
|
|
rtext("demandeur_societe"); |
167 |
|
|
rtext("parcelle"); |
168 |
|
|
rtext("rivoli"); |
169 |
|
|
rtext("terrain_adresse"); |
170 |
|
|
rtext("terrain_adresse_complement"); |
171 |
|
|
echo "</td><td class='fd_rechdossier' valign='top' align='center'>"; |
172 |
|
|
rselect("nature",$sql_nature,$f->db); |
173 |
|
|
rselect("etat",$sql_etat,$f->db); |
174 |
|
|
ouinon("accord_tacite"); |
175 |
|
|
rselect("travaux",$sql_travaux,$f->db); |
176 |
|
|
entre2dates('date_depot'); |
177 |
|
|
entre2dates('date_validite'); |
178 |
|
|
entre2dates('date_complet'); |
179 |
|
|
echo "</td><td valign='top' align='right' class='fd_rechdossier'>"; |
180 |
|
|
entre2dates('date_rejet'); |
181 |
|
|
entre2dates('date_decision'); |
182 |
|
|
entre2dates('date_limite'); |
183 |
|
|
entre2dates('date_chantier'); |
184 |
|
|
entre2dates('date_achevement'); |
185 |
|
|
entre2dates('date_conformite'); |
186 |
|
|
rselect("instructeur",$sql_instructeur,$f->db); |
187 |
|
|
rselect("architecte",$sql_architecte,$f->db); |
188 |
|
|
echo "</td></tr><tr><td class='fd_bas_rechdossier'colspan='3' valign='top' align='center'>"; |
189 |
|
|
// commentaires |
190 |
|
|
echo "<div class='both'></div>"; // pas de float a gauche et a droite |
191 |
|
|
|
192 |
|
|
echo "<i><b>"._("Utilisation de % pour zones de saisie")." : </b>"; |
193 |
|
|
//echo "</legend>"; |
194 |
|
|
echo" <img src='../img/punaise.png' valign='top' vspace='0' hspace='5' border='0' alt='aide'>"; |
195 |
|
|
echo " %BAS "._("finit par 'BAS'").""; |
196 |
|
|
echo" <img src='../img/punaise.png' valign='top' vspace='0' hspace='5' border='0' alt='aide'>"; |
197 |
|
|
echo " BAS% "._("commence par 'BAS'").""; |
198 |
|
|
echo" <img src='../img/punaise.png' valign='top' vspace='0' hspace='5' border='0' alt='aide'>"; |
199 |
|
|
echo " %BAS% "._("contient 'BAS'").""; |
200 |
|
|
echo "</i></div>"; |
201 |
|
|
echo "</td></tr></table>"; |
202 |
|
|
echo "</form>"; |
203 |
|
|
|
204 |
|
|
}else { |
205 |
|
|
$sql = "select * from dossier "; |
206 |
|
|
$sql.=rtext1("dossier", $condition); |
207 |
|
|
$sql.=rselect1("etat", $condition); |
208 |
|
|
$sql.=rtext1("parcelle", $condition); |
209 |
|
|
$sql.=rtext1("rivoli", $condition); |
210 |
|
|
$sql.=rselect1("nature", $condition); |
211 |
|
|
$sql.=rtext1("delegataire_nom", $condition); |
212 |
|
|
$sql.=rtext1("demandeur_nom", $condition); |
213 |
|
|
$sql.=rtext1("demandeur_societe", $condition); |
214 |
|
|
$sql.=rselect1("accord_tacite", $condition); |
215 |
|
|
$sql.=rtext1("terrain_adresse", $condition); |
216 |
|
|
$sql.=rtext1("terrain_adresse_complement", $condition); |
217 |
|
|
$sql.=rselect1("instructeur", $condition); |
218 |
|
|
$sql.=rselect1("travaux", $condition); |
219 |
|
|
$sql.=rselect1("architecte", $condition); |
220 |
|
|
$sql.=entre2dates1('date_depot', $condition); |
221 |
|
|
$sql.=entre2dates1('date_complet', $condition); |
222 |
|
|
$sql.=entre2dates1('date_achevement', $condition); |
223 |
|
|
$sql.=entre2dates1('date_rejet', $condition); |
224 |
|
|
$sql.=entre2dates1('date_decision', $condition); |
225 |
|
|
$sql.=entre2dates1('date_conformite', $condition); |
226 |
|
|
$sql.=entre2dates1('date_chantier', $condition); |
227 |
|
|
$sql.=entre2dates1('date_limite', $condition); |
228 |
|
|
$res= $f -> db->query($sql); |
229 |
|
|
$f->isDatabaseError($res); |
230 |
|
|
echo "<fieldset class=\"cadre ui-corner-all ui-widget-content startClosed\">\n"; |
231 |
|
|
echo "<legend align='center' class=\"ui-corner-all ui-widget-content ui-state-active\">"; |
232 |
|
|
echo _("Nombre de dossier ")." ".$res->numrows()."<br>"; |
233 |
|
|
echo "</legend>"; |
234 |
|
|
echo "\t<div class=\"list\">\n"; |
235 |
|
|
echo "requete : ".$sql; |
236 |
|
|
echo "</div>"; |
237 |
|
|
echo"</fieldset>"; |
238 |
|
|
if($res->numrows() < 100){ |
239 |
|
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
240 |
|
|
echo "<div class='choice ui-corner-all ui-widget-content'>"; |
241 |
|
|
echo "<fieldset class=\"cadre ui-corner-all ui-widget-content\">\n"; |
242 |
|
|
echo "<legend align='center' class=\"ui-corner-all ui-widget-content ui-state-active\">"; |
243 |
fraynaud |
90 |
echo "<a href=\"../app/dossier.php?menu=1&id=".$row['dossier']."\">".$row['dossier']."</a><br>"; |
244 |
fraynaud |
88 |
echo "</legend>"; |
245 |
|
|
echo "\t<div class=\"list\">\n"; |
246 |
|
|
echo $row['demandeur_nom']."<br>"; |
247 |
|
|
echo $row['demandeur_societe']."<br>"; |
248 |
|
|
echo $row['terrain_numero']." ".$row['terrain_adresse']." ".$row['terrain_cp']." ". |
249 |
|
|
$row['terrain_ville']."<br>"; |
250 |
|
|
echo "</div>"; |
251 |
|
|
echo"</fieldset>"; |
252 |
|
|
echo "</div>"; |
253 |
|
|
} |
254 |
|
|
}else |
255 |
|
|
echo _("Precisez votre question, affichage supérieur à 100 dossiers"); |
256 |
|
|
echo "<div class='both'></div>"; // pas de float a gauche et a droite |
257 |
|
|
|
258 |
|
|
} |
259 |
|
|
|
260 |
|
|
//echo "</div>"; |
261 |
|
|
|
262 |
|
|
?> |