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