1 |
<?php |
<?php |
2 |
// $Id: sitadel.php,v 1.20 2010-11-15 14:50:40 fraynaud Exp $ |
// $Id: sitadel.php,v 1.20 2010-11-15 14:50:40 fraynaud Exp $ |
3 |
/* |
/* |
4 |
transfert de dossier � SITADEL |
transfert de dossier � SITADEL |
5 |
realis� ville arles par fr+jlb |
realis� ville arles par fr+jlb |
6 |
voir parametrage trt/sitadel.inc |
voir parametrage trt/sitadel.inc |
7 |
*/ |
*/ |
8 |
require_once "../obj/utils.class.php"; |
require_once "../obj/utils.class.php"; |
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'])){ |
66 |
"-".substr($_POST["datefin"],3,2)."-". |
"-".substr($_POST["datefin"],3,2)."-". |
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 ".DB_PREFIXE."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."')"; |
160 |
// or !isset($row['date_decision'])){ |
// or !isset($row['date_decision'])){ |
161 |
//if(isset($row['date_decision']) and $row['date_decision']!=""){ |
//if(isset($row['date_decision']) and $row['date_decision']!=""){ |
162 |
// avis_sitadel et avis_sitadel_motif |
// avis_sitadel et avis_sitadel_motif |
163 |
if($row['avis']!=''){ |
if($row['avis_decision']!=''){ |
164 |
$avis_sitadel = "0"; |
$avis_sitadel = "0"; |
165 |
$avis_sitadel_motif="0" ; |
$avis_sitadel_motif="0" ; |
166 |
$sql="select sitadel, sitadel_motif from ".DB_PREFIXE."avis where avis ='". |
$sql="select sitadel, sitadel_motif from ".DB_PREFIXE."avis_decision where avis_decision ='". |
167 |
$row['avis']."'"; |
$row['avis_decision']."'"; |
168 |
$res1 = $f->db -> query ($sql); |
$res1 = $f->db -> query ($sql); |
169 |
$f->isDatabaseError($res1); |
$f->isDatabaseError($res1); |
170 |
while ($row1=& $res1->fetchRow(DB_FETCHMODE_ASSOC)){ |
while ($row1=& $res1->fetchRow(DB_FETCHMODE_ASSOC)){ |
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"; |
266 |
$modificatif.=$g->entete("MODIFICATIF",$departement,$commune,$pf_departement); |
$modificatif.=$g->entete("MODIFICATIF",$departement,$commune,$pf_departement); |
267 |
if(isset($row['date_decision']) or $row['date_decision']==""){ |
if(isset($row['date_decision']) or $row['date_decision']==""){ |
268 |
// avis_sitadel et avis_sitadel_motif |
// avis_sitadel et avis_sitadel_motif |
269 |
if($row['avis']!=''){ |
if($row['avis_decision']!=''){ |
270 |
$avis_sitadel = 0; |
$avis_sitadel = 0; |
271 |
$avis_sitadel_motif=0 ; |
$avis_sitadel_motif=0 ; |
272 |
$sql="select sitadel, sitadel_motif from ".DB_PREFIXE."avis where avis ='". |
$sql="select sitadel, sitadel_motif from ".DB_PREFIXE."avis_decision where avis_decision ='". |
273 |
$row['avis']."'"; |
$row['avis_decision']."'"; |
274 |
$res1 = $f->db -> query ($sql); |
$res1 = $f->db -> query ($sql); |
275 |
$f->isDatabaseError($res1); |
$f->isDatabaseError($res1); |
276 |
while ($row1=& $res1->fetchRow(DB_FETCHMODE_ASSOC)){ |
while ($row1=& $res1->fetchRow(DB_FETCHMODE_ASSOC)){ |
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 |
364 |
$cpt=0; |
$cpt=0; |
365 |
for($i=0;$i<sizeof($nbenr);$i++){ |
for($i=0;$i<sizeof($nbenr);$i++){ |
366 |
// mb_strlen( variable,encoding) PHP 4 >= 4.0.6, PHP 5 |
// mb_strlen( variable,encoding) PHP 4 >= 4.0.6, PHP 5 |
367 |
// Le param�tre encoding est l'encodage des caract�res. |
// Le param�tre encoding est l'encodage des caract�res. |
368 |
// S'il est omis, l'encodage de caracteres interne sera utilis�. |
// S'il est omis, l'encodage de caracteres interne sera utilis�. |
369 |
$tmp[$i] = strlen($nbenr[$i]); |
$tmp[$i] = strlen($nbenr[$i]); |
370 |
//echo strlen($nbenr[$i])." ".$nbenr[$i]."<br>"; |
//echo strlen($nbenr[$i])." ".$nbenr[$i]."<br>"; |
371 |
$cpt++; |
$cpt++; |
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=""; |