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 |
jbastide |
167 |
echo ""._("Debut")." : "; |
22 |
fraynaud |
88 |
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 |
jbastide |
167 |
echo "<br>"._("Fin")."..... : "; |
25 |
fraynaud |
88 |
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 |
jbastide |
167 |
$req=" ".$condition." "." upper(".$zone.") like upper('".$_POST[$zone]."')"; |
108 |
fraynaud |
88 |
$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 |
fraynaud |
121 |
// substr($_POST['date_envoi_debut'],6,4).'-'.substr($_POST['date_envoi_debut'],3,2).'-'.substr($_POST['date_envoi_debut'],0,2); |
128 |
|
|
$req=" ".$condition." "." ".$zone." >= '".substr($_POST[$zone."_debut"],6,4)."-" |
129 |
|
|
.substr($_POST[$zone."_debut"],3,2)."-" |
130 |
|
|
.substr($_POST[$zone."_debut"],0,2).""."'"; |
131 |
|
|
$condition = "and"; |
132 |
fraynaud |
88 |
} |
133 |
|
|
if($_POST[$zone."_fin"]!=""){ |
134 |
fraynaud |
121 |
$req.=" ".$condition." "." ".$zone." <= '".substr($_POST[$zone."_fin"],6,4)."-" |
135 |
|
|
.substr($_POST[$zone."_fin"],3,2)."-" |
136 |
|
|
.substr($_POST[$zone."_fin"],0,2).""."'"; |
137 |
fraynaud |
88 |
$condition = "and"; |
138 |
|
|
} |
139 |
|
|
return $req; |
140 |
|
|
} |
141 |
|
|
|
142 |
|
|
|
143 |
|
|
// variables |
144 |
|
|
$DEBUG=0; |
145 |
|
|
$annee = (int)date("Y"); //----> retourne l'annee actuelle |
146 |
|
|
// GET |
147 |
|
|
if (isset ($_GET['validation'])){ |
148 |
|
|
$validation=$_GET['validation']; |
149 |
|
|
}else{ |
150 |
|
|
$validation=0; |
151 |
|
|
} |
152 |
|
|
if($validation==0){ |
153 |
|
|
$validation=1; |
154 |
|
|
// requete sur table |
155 |
|
|
$sql_instructeur=" SELECT om_utilisateur,nom from om_utilisateur where instructeur='Oui' order by nom"; |
156 |
|
|
$sql_nature=" SELECT nature,libelle FROM nature order by libelle"; |
157 |
|
|
$sql_destination=" SELECT destination,libelle FROM destination order by libelle"; |
158 |
|
|
$sql_architecte=" SELECT architecte,nom,prenom FROM architecte order by nom,prenom"; |
159 |
|
|
$sql_travaux=" SELECT travaux,substring(libelle,0,30) FROM travaux order by libelle"; |
160 |
|
|
$sql_avis=" SELECT avis,libelle FROM avis order by libelle"; |
161 |
|
|
$sql_etat=" SELECT etat,libelle FROM etat order by libelle"; |
162 |
|
|
echo "<form method='post' name='f1' action='recherchedossier.php?validation=".$validation."'>"; |
163 |
|
|
|
164 |
jbastide |
164 |
echo "<table class='ui-corner-all' style='border:0px solid #000000' WIDTH='100%' cellspacing='0px' cellpadding='0px'>"; |
165 |
|
|
/*echo "<tr><td valign='middle' align='middle' class='fd_haut_rechdossier' colspan='3'>"; |
166 |
|
|
echo "<input type='submit' name='boutonrecherche' value=' OK ' style='width:30%' >  "; |
167 |
|
|
echo "</tr>"; */ |
168 |
|
|
/* echo "<tr style='border:1px solid #000000'>"; |
169 |
|
|
echo "<th valign='middle' align='left' class='fd_haut_rechdossier' rowspan='8'>"; |
170 |
|
|
echo "<input type='submit' name='boutonrecherche' value=' OK ' style='height:100%;width:35px' >"; |
171 |
|
|
echo "</th>";*/ |
172 |
|
|
echo "<td class='fd_rechdossier' valign='top' align='center'>"; |
173 |
fraynaud |
88 |
rtext("dossier"); |
174 |
|
|
rtext("delegataire_nom"); |
175 |
|
|
rtext("demandeur_nom"); |
176 |
|
|
rtext("demandeur_societe"); |
177 |
|
|
rtext("parcelle"); |
178 |
|
|
rtext("rivoli"); |
179 |
|
|
rtext("terrain_adresse"); |
180 |
|
|
rtext("terrain_adresse_complement"); |
181 |
jbastide |
167 |
echo "</td><td class='fd_rechdossier' valign='top' align='center'>"; |
182 |
fraynaud |
88 |
rselect("nature",$sql_nature,$f->db); |
183 |
|
|
rselect("etat",$sql_etat,$f->db); |
184 |
|
|
ouinon("accord_tacite"); |
185 |
|
|
rselect("travaux",$sql_travaux,$f->db); |
186 |
|
|
entre2dates('date_depot'); |
187 |
|
|
entre2dates('date_validite'); |
188 |
|
|
entre2dates('date_complet'); |
189 |
jbastide |
164 |
echo "<input type='submit' name='boutonrecherche' value=' OK ' style='width:50%' >  "; |
190 |
|
|
echo "</td><td valign='top' align='right' class='fd_rechdossier'>"; |
191 |
fraynaud |
88 |
entre2dates('date_rejet'); |
192 |
jbastide |
164 |
entre2dates('date_decision'); |
193 |
fraynaud |
88 |
entre2dates('date_limite'); |
194 |
|
|
entre2dates('date_chantier'); |
195 |
|
|
entre2dates('date_achevement'); |
196 |
|
|
entre2dates('date_conformite'); |
197 |
|
|
rselect("instructeur",$sql_instructeur,$f->db); |
198 |
|
|
rselect("architecte",$sql_architecte,$f->db); |
199 |
jbastide |
164 |
echo "</td>"; |
200 |
|
|
|
201 |
|
|
echo "</tr><tr><td class='fd_bas_rechdossier'colspan='3' valign='top' align='center'>"; |
202 |
fraynaud |
88 |
// commentaires |
203 |
|
|
echo "<div class='both'></div>"; // pas de float a gauche et a droite |
204 |
|
|
|
205 |
|
|
echo "<i><b>"._("Utilisation de % pour zones de saisie")." : </b>"; |
206 |
|
|
//echo "</legend>"; |
207 |
fraynaud |
116 |
echo" <img src='../app/img/punaise.png' valign='top' vspace='0' hspace='5' border='0' alt='aide'>"; |
208 |
fraynaud |
88 |
echo " %BAS "._("finit par 'BAS'").""; |
209 |
fraynaud |
116 |
echo" <img src='../app/img/punaise.png' valign='top' vspace='0' hspace='5' border='0' alt='aide'>"; |
210 |
fraynaud |
88 |
echo " BAS% "._("commence par 'BAS'").""; |
211 |
fraynaud |
116 |
echo" <img src='../app/img/punaise.png' valign='top' vspace='0' hspace='5' border='0' alt='aide'>"; |
212 |
fraynaud |
88 |
echo " %BAS% "._("contient 'BAS'").""; |
213 |
|
|
echo "</i></div>"; |
214 |
jbastide |
164 |
echo "</td>"; |
215 |
|
|
echo "</tr></table>"; |
216 |
fraynaud |
88 |
echo "</form>"; |
217 |
|
|
|
218 |
|
|
}else { |
219 |
|
|
$sql = "select * from dossier "; |
220 |
|
|
$sql.=rtext1("dossier", $condition); |
221 |
|
|
$sql.=rselect1("etat", $condition); |
222 |
|
|
$sql.=rtext1("parcelle", $condition); |
223 |
|
|
$sql.=rtext1("rivoli", $condition); |
224 |
|
|
$sql.=rselect1("nature", $condition); |
225 |
|
|
$sql.=rtext1("delegataire_nom", $condition); |
226 |
|
|
$sql.=rtext1("demandeur_nom", $condition); |
227 |
|
|
$sql.=rtext1("demandeur_societe", $condition); |
228 |
|
|
$sql.=rselect1("accord_tacite", $condition); |
229 |
|
|
$sql.=rtext1("terrain_adresse", $condition); |
230 |
|
|
$sql.=rtext1("terrain_adresse_complement", $condition); |
231 |
|
|
$sql.=rselect1("instructeur", $condition); |
232 |
|
|
$sql.=rselect1("travaux", $condition); |
233 |
|
|
$sql.=rselect1("architecte", $condition); |
234 |
|
|
$sql.=entre2dates1('date_depot', $condition); |
235 |
|
|
$sql.=entre2dates1('date_complet', $condition); |
236 |
|
|
$sql.=entre2dates1('date_achevement', $condition); |
237 |
|
|
$sql.=entre2dates1('date_rejet', $condition); |
238 |
|
|
$sql.=entre2dates1('date_decision', $condition); |
239 |
|
|
$sql.=entre2dates1('date_conformite', $condition); |
240 |
|
|
$sql.=entre2dates1('date_chantier', $condition); |
241 |
|
|
$sql.=entre2dates1('date_limite', $condition); |
242 |
|
|
$res= $f -> db->query($sql); |
243 |
|
|
$f->isDatabaseError($res); |
244 |
|
|
echo "<fieldset class=\"cadre ui-corner-all ui-widget-content startClosed\">\n"; |
245 |
|
|
echo "<legend align='center' class=\"ui-corner-all ui-widget-content ui-state-active\">"; |
246 |
|
|
echo _("Nombre de dossier ")." ".$res->numrows()."<br>"; |
247 |
|
|
echo "</legend>"; |
248 |
|
|
echo "\t<div class=\"list\">\n"; |
249 |
|
|
echo "requete : ".$sql; |
250 |
|
|
echo "</div>"; |
251 |
|
|
echo"</fieldset>"; |
252 |
|
|
if($res->numrows() < 100){ |
253 |
|
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
254 |
|
|
echo "<div class='choice ui-corner-all ui-widget-content'>"; |
255 |
|
|
echo "<fieldset class=\"cadre ui-corner-all ui-widget-content\">\n"; |
256 |
|
|
echo "<legend align='center' class=\"ui-corner-all ui-widget-content ui-state-active\">"; |
257 |
fraynaud |
160 |
echo "<a href=\"../app/dossier.php?menu=2&id=".$row['dossier']."\">".$row['dossier']."</a><br>"; |
258 |
fraynaud |
88 |
echo "</legend>"; |
259 |
|
|
echo "\t<div class=\"list\">\n"; |
260 |
|
|
echo $row['demandeur_nom']."<br>"; |
261 |
|
|
echo $row['demandeur_societe']."<br>"; |
262 |
|
|
echo $row['terrain_numero']." ".$row['terrain_adresse']." ".$row['terrain_cp']." ". |
263 |
|
|
$row['terrain_ville']."<br>"; |
264 |
|
|
echo "</div>"; |
265 |
|
|
echo"</fieldset>"; |
266 |
|
|
echo "</div>"; |
267 |
|
|
} |
268 |
|
|
}else |
269 |
fraynaud |
232 |
echo _("Precisez votre question, resltat superieur a 100 dossiers"); |
270 |
fraynaud |
88 |
echo "<div class='both'></div>"; // pas de float a gauche et a droite |
271 |
|
|
|
272 |
|
|
} |
273 |
|
|
|
274 |
|
|
//echo "</div>"; |
275 |
|
|
|
276 |
|
|
?> |