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