10 |
require_once "../dyn/locales.inc.php"; |
require_once "../dyn/locales.inc.php"; |
11 |
require_once "../dyn/version.inc.php"; |
require_once "../dyn/version.inc.php"; |
12 |
require_once "sitadel.inc"; |
require_once "sitadel.inc"; |
13 |
$f = new utils(NULL, "export", _("export SITADEL"), "ico_reqmo.png", "export"); |
$f = new utils(NULL, "export_sitadel", _("export SITADEL"), "ico_reqmo.png", "export"); |
14 |
$f->addHTMLHeadJs(array("../js/script.js")); |
$f->addHTMLHeadJs(array("../js/script.js")); |
15 |
// GET |
// GET |
16 |
if (isset ($_GET['validation'])){ |
if (isset ($_GET['validation'])){ |
67 |
substr($_POST["datefin"],0,2); |
substr($_POST["datefin"],0,2); |
68 |
if ($correct==true){ // *** |
if ($correct==true){ // *** |
69 |
// dossiers concern�s |
// dossiers concern�s |
70 |
$sql= "select * from dossier"; |
$sql= "select * from ".DB_PREFIXE."dossier"; |
71 |
$sql.= " where (nature='PC' or nature = 'PD' or nature = 'PA' or nature = 'DP')"; |
$sql.= " where (nature='PC' or nature = 'PD' or nature = 'PA' or nature = 'DP')"; |
72 |
$sql.= " AND ((date_depot >='".$datedebut."' AND date_depot<='".$datefin."')"; |
$sql.= " AND ((date_depot >='".$datedebut."' AND date_depot<='".$datefin."')"; |
73 |
$sql.= " OR (date_decision>='".$datedebut."' AND date_decision<='".$datefin."')"; |
$sql.= " OR (date_decision>='".$datedebut."' AND date_decision<='".$datefin."')"; |
83 |
// sitadel |
// sitadel |
84 |
$g->val=$val; |
$g->val=$val; |
85 |
// parametre |
// parametre |
86 |
$sql = "select parametre, valeur from statistique where dossier ='".$row['dossier']."'"; |
$sql = "select parametre, valeur from ".DB_PREFIXE."statistique where dossier ='".$row['dossier']."'"; |
87 |
$res1 = $f->db -> query ($sql); |
$res1 = $f->db -> query ($sql); |
88 |
$f->isDatabaseError($res1); |
$f->isDatabaseError($res1); |
89 |
while ($row1=& $res1->fetchRow(DB_FETCHMODE_ASSOC)){ |
while ($row1=& $res1->fetchRow(DB_FETCHMODE_ASSOC)){ |
163 |
if($row['avis']!=''){ |
if($row['avis']!=''){ |
164 |
$avis_sitadel = "0"; |
$avis_sitadel = "0"; |
165 |
$avis_sitadel_motif="0" ; |
$avis_sitadel_motif="0" ; |
166 |
$sql="select sitadel, sitadel_motif from avis where avis ='". |
$sql="select sitadel, sitadel_motif from ".DB_PREFIXE."avis where avis ='". |
167 |
$row['avis']."'"; |
$row['avis']."'"; |
168 |
$res1 = $f->db -> query ($sql); |
$res1 = $f->db -> query ($sql); |
169 |
$f->isDatabaseError($res1); |
$f->isDatabaseError($res1); |
184 |
$decision.= $g->amenagement(); |
$decision.= $g->amenagement(); |
185 |
if($row['travaux']!=''){ |
if($row['travaux']!=''){ |
186 |
$sql= "select codelascot,libelle |
$sql= "select codelascot,libelle |
187 |
from travaux where travaux=".$row['travaux']; |
from ".DB_PREFIXE."travaux where travaux=".$row['travaux']; |
188 |
$res2 = $f->db -> query ($sql); |
$res2 = $f->db -> query ($sql); |
189 |
$f->isDatabaseError($res2); |
$f->isDatabaseError($res2); |
190 |
|
$temp=$row['description']; |
191 |
|
// enlever les RC |
192 |
|
$temp = str_replace( chr(10), " ", $temp); |
193 |
|
$temp = str_replace( chr(13), " ", $temp); |
194 |
while ($row2=& $res2->fetchRow(DB_FETCHMODE_ASSOC)){ |
while ($row2=& $res2->fetchRow(DB_FETCHMODE_ASSOC)){ |
195 |
$travaux = $row2['libelle']; |
$travaux = $row2['libelle']." "; // *** |
196 |
$lascot = $row2['codelascot']; |
$lascot = $row2['codelascot']; |
197 |
} |
} |
198 |
|
$travaux.=" ".$temp; |
199 |
$decision.= $g->travaux($travaux,$lascot, $row['types']); |
$decision.= $g->travaux($travaux,$lascot, $row['types']); |
200 |
} |
} |
201 |
$sql3="select * from destination_shon where dossier = '". |
$sql3="select * from ".DB_PREFIXE."destination_shon where dossier = '". |
202 |
$row['dossier']."' order by destination"; |
$row['dossier']."' order by destination"; |
203 |
$res3 = $f->db -> query ($sql3); |
$res3 = $f->db -> query ($sql3); |
204 |
$f->isDatabaseError($res3); |
$f->isDatabaseError($res3); |
205 |
$temp = array(); |
// *** |
206 |
while ($row3=& $res3->fetchRow(DB_FETCHMODE_ASSOC)){ |
$temp = array(); |
207 |
$shonant[$row3['destination']]=$row3["shon_anterieure"]; |
$shonant = array(); |
208 |
$shondem[$row3['destination']]=$row3["shon_demolie"]; |
$shondem = array(); |
209 |
$shonanttr[$row3['destination']]=$row3["shon_anterieure_supprimee"]; |
$shonanttr = array(); |
210 |
$shonprojtr[$row3['destination']]=$row3["shon_nouvelle_transformee"]; |
$shonprojtr = array(); |
211 |
$shoncr1[$row3['destination']]=$row3["shon_nouvelle"]; |
$shoncr1 = array(); |
212 |
$shoncr2[$row3['destination']]=$row3["shon_shob_transformee"]; |
$shoncr2 = array(); |
213 |
} |
while ($row3=& $res3->fetchRow(DB_FETCHMODE_ASSOC)){ |
214 |
$decision.= $g->destination($shonant); |
// round(8.5, 0, PHP_ROUND_HALF_DOWN); |
215 |
$decision.= $g->destination($shondem); |
if(isset($row3["shon_anterieure"])) |
216 |
$decision.= $g->destination($shonanttr); |
$shonant[$row3['destination']]=round($row3["shon_anterieure"], 0); |
217 |
$decision.= $g->destination($shonprojtr); |
else |
218 |
$decision.= $g->destination($shoncr1); |
$shonant[$row3['destination']]=0; |
219 |
$decision.= $g->destination($shoncr2); |
if(isset($row3["shon_demolie"])) |
220 |
|
$shondem[$row3['destination']]=round($row3["shon_demolie"], 0); |
221 |
|
else |
222 |
|
$shondem[$row3['destination']]=0; |
223 |
|
if(isset($row3["shon_anterieure_supprimee"])) |
224 |
|
$shonanttr[$row3['destination']]=round($row3["shon_anterieure_supprimee"], 0); |
225 |
|
else |
226 |
|
$shonanttr[$row3['destination']]=0; |
227 |
|
if(isset($row3["shon_nouvelle_transformee"])) |
228 |
|
$shonprojtr[$row3['destination']]=round($row3["shon_nouvelle_transformee"], 0); |
229 |
|
else |
230 |
|
$shonprojtr[$row3['destination']]=0; |
231 |
|
if(isset($row3["shon_nouvelle"])) |
232 |
|
$shoncr1[$row3['destination']]=round($row3["shon_nouvelle"], 0); |
233 |
|
else |
234 |
|
$shoncr1[$row3['destination']]=0; |
235 |
|
if(isset($row3["shon_shob_transformee"])) |
236 |
|
$shoncr2[$row3['destination']]=round($row3["shon_shob_transformee"], 0); |
237 |
|
else |
238 |
|
$shoncr2[$row3['destination']]=0; |
239 |
|
|
240 |
|
//$shonant[$row3['destination']]=$row3["shon_anterieure"]; |
241 |
|
//$shondem[$row3['destination']]=$row3["shon_demolie"]; |
242 |
|
//$shonanttr[$row3['destination']]=$row3["shon_anterieure_supprimee"]; |
243 |
|
//$shonprojtr[$row3['destination']]=$row3["shon_nouvelle_transformee"]; |
244 |
|
//$shoncr1[$row3['destination']]=$row3["shon_nouvelle"]; |
245 |
|
//$shoncr2[$row3['destination']]=$row3["shon_shob_transformee"]; |
246 |
|
|
247 |
|
} |
248 |
|
$decision.= $g->destination($shonant); |
249 |
|
$decision.= $g->destination($shondem); |
250 |
|
$decision.= $g->destination($shonanttr); |
251 |
|
$decision.= $g->destination($shonprojtr); |
252 |
|
$decision.= $g->destination($shoncr1); |
253 |
|
$decision.= $g->destination($shoncr2); |
254 |
|
|
255 |
$decision.= $g->descriptif($row['types']); |
$decision.= $g->descriptif($row['types']); |
256 |
}else // decision defavorable ou pas de decision |
}else // decision defavorable ou pas de decision |
257 |
$decision.= $t10.$t10.$t10.$t10.$t10.$t10.$t10.$t10."|||"; //83 | + 12 | = 95 | pour 96 zones |
$decision.= $t10.$t10.$t10.$t10.$t10.$t10.$t10.$t10."|||"; //83 | + 12 | = 95 | pour 96 zones |
258 |
$decision.="\n"; |
$decision.="\n"; |
269 |
if($row['avis']!=''){ |
if($row['avis']!=''){ |
270 |
$avis_sitadel = 0; |
$avis_sitadel = 0; |
271 |
$avis_sitadel_motif=0 ; |
$avis_sitadel_motif=0 ; |
272 |
$sql="select sitadel, sitadel_motif from avis where avis ='". |
$sql="select sitadel, sitadel_motif from ".DB_PREFIXE."avis where avis ='". |
273 |
$row['avis']."'"; |
$row['avis']."'"; |
274 |
$res1 = $f->db -> query ($sql); |
$res1 = $f->db -> query ($sql); |
275 |
$f->isDatabaseError($res1); |
$f->isDatabaseError($res1); |
286 |
$modificatif.=$g->adresse_terrain(); //*** |
$modificatif.=$g->adresse_terrain(); //*** |
287 |
$modificatif.=$g->parcelle(); //*** |
$modificatif.=$g->parcelle(); //*** |
288 |
$modificatif.=$g->terrain(); //*** |
$modificatif.=$g->terrain(); //*** |
289 |
|
// enlever les RC |
290 |
|
$temp=$row['description']; |
291 |
|
$temp = str_replace( chr(10), " ", $temp); |
292 |
|
$temp = str_replace( chr(13), " ", $temp); |
293 |
if($row['travaux']!=''){ |
if($row['travaux']!=''){ |
294 |
$sql= "select codelascot,libelle |
$sql= "select codelascot,libelle |
295 |
from travaux where travaux=".$row['travaux']; |
from ".DB_PREFIXE."travaux where travaux=".$row['travaux']; |
296 |
$res2 = $f->db -> query ($sql); |
$res2 = $f->db -> query ($sql); |
297 |
$f->isDatabaseError($res2); |
$f->isDatabaseError($res2); |
298 |
while ($row2=& $res2->fetchRow(DB_FETCHMODE_ASSOC)){ |
while ($row2=& $res2->fetchRow(DB_FETCHMODE_ASSOC)){ |
299 |
$travaux = $row2['libelle']; |
$travaux = $row2['libelle']." ".$row['description']; // ***; |
300 |
$lascot = $row2['codelascot']; |
$lascot = $row2['codelascot']; |
301 |
} |
} |
302 |
|
$travaux.=" ".$temp; |
303 |
$modificatif.= $g->travaux($travaux,$lascot, $row['types']); |
$modificatif.= $g->travaux($travaux,$lascot, $row['types']); |
304 |
} |
} |
305 |
$sql3="select * from destination_shon where dossier = '". |
$sql3="select * from ".DB_PREFIXE."destination_shon where dossier = '". |
306 |
$row['dossier']."' order by destination"; |
$row['dossier']."' order by destination"; |
307 |
$res3 = $f->db -> query ($sql3); |
$res3 = $f->db -> query ($sql3); |
308 |
$f->isDatabaseError($res3); |
$f->isDatabaseError($res3); |
355 |
$longueurenregistrement= 0 ; // a calculer *** enregistrement le plus long |
$longueurenregistrement= 0 ; // a calculer *** enregistrement le plus long |
356 |
$entete = "SITADEL|".$pf_departement.$departement."|".$commune."|".$region."|".$fichiertransmis."|".$numero."|"; |
$entete = "SITADEL|".$pf_departement.$departement."|".$commune."|".$region."|".$fichiertransmis."|".$numero."|"; |
357 |
// calcul enregistrement le plus long |
// calcul enregistrement le plus long |
358 |
if(CHARSET=='UTF8'){ |
if(DBCHARSET=='UTF8'){ |
359 |
$export=utf8_decode($export); |
$export=utf8_decode($export); |
360 |
} |
} |
361 |
// nombreenrgistremment et longueurenregistrement |
// nombreenrgistremment et longueurenregistrement |
382 |
// $str = htmlentities($str, ENT_QUOTES); |
// $str = htmlentities($str, ENT_QUOTES); |
383 |
// ecriture des fichiers en tmp |
// ecriture des fichiers en tmp |
384 |
$fichier = "../tmp/SITADEL".substr($_POST["datedebut"],3,2). |
$fichier = "../tmp/SITADEL".substr($_POST["datedebut"],3,2). |
385 |
"".substr($_POST["datedebut"],8,4)."_test"; |
"".substr($_POST["datedebut"],8,4).""; |
386 |
$inf = fopen($fichier,"w"); |
$inf = fopen($fichier,"w"); |
387 |
fwrite($inf,$export); |
fwrite($inf,$export); |
388 |
fclose($inf); |
fclose($inf); |
389 |
echo "<br>"._("Fichier")." ".$fichier." "._("sauvegarde")."<br /><br /><br />"; |
echo "<br>"._("Fichier")." ".$fichier." "._("sauvegarde")."<br /><br /><br />"; |
390 |
// affichage |
// affichage |
391 |
echo "<br /><br />Pour telecharger le fichier, cliquer ici : <a href=\"".$fichier."\" target=\"_blank\">"; |
echo "<br /><br />Pour telecharger le fichier, cliquer ici : <a href=\"".$fichier."\" target=\"_blank\">"; |
392 |
echo "<img src=\"../app/img/ico_trace.png\" alt=\"Telecharger le fichier CNEN\" title=\"Telecharger le fichier CNEN\" />"; |
echo "<img src=\"../app/img/ico_trace.png\" alt=\"Telecharger le fichier CNEN\" title=\"Telecharger le fichier Sitadel\" />"; |
393 |
echo "</a>"._("avec le bouton droit et enregistrer la cible du lien sous.")."<br /><br />"; |
echo "</a>"._("avec le bouton droit et enregistrer la cible du lien sous.")."<br /><br />"; |
394 |
if($DEBUG==1){ |
if($DEBUG==1){ |
395 |
$affiche=""; |
$affiche=""; |