1 |
<?php |
<?php |
2 |
// $Id: export_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 |
25 |
$f->displayDescription($description); |
$f->displayDescription($description); |
26 |
//controle |
//controle |
27 |
$DEBUG=1; |
$DEBUG=1; |
28 |
|
//$pf_departement="0"; |
29 |
|
$t10 = "||||||||||"; // 10 | |
30 |
|
|
31 |
// parametres collectivite |
// parametres collectivite |
32 |
|
|
51 |
echo "<br><br></form>"; |
echo "<br><br></form>"; |
52 |
}else{ // ===================== extraction ================================= |
}else{ // ===================== extraction ================================= |
53 |
$correct=true; |
$correct=true; |
54 |
$longueurenregistrement= 0 ; // a calculer |
$longueurenregistrement= 0 ; |
55 |
//$nombreenregistrement=1; // l entete est compt�e dans le nombre enregistrement |
$t10 = "||||||||||"; // 10 | |
56 |
|
$datedebut =''; |
57 |
|
$datefin=''; |
58 |
if($_POST["datedebut"]=="") |
if($_POST["datedebut"]=="") |
59 |
$correct=false; |
$correct=false; |
60 |
else |
else |
76 |
$sql.= " OR (date_decision>='".$datedebut."' AND date_decision<='".$datefin."')"; |
$sql.= " OR (date_decision>='".$datedebut."' AND date_decision<='".$datefin."')"; |
77 |
$sql.= " OR (date_chantier>='".$datedebut."' AND date_chantier<='".$datefin."'))"; |
$sql.= " OR (date_chantier>='".$datedebut."' AND date_chantier<='".$datefin."'))"; |
78 |
$sql.= " order by date_depot"; |
$sql.= " order by date_depot"; |
|
//$sql.= " and dossier = 'PC11R000402'"; |
|
79 |
$res = $f->db -> query ($sql); |
$res = $f->db -> query ($sql); |
80 |
$f->isDatabaseError($res); |
$f->isDatabaseError($res); |
81 |
$export=""; |
$export=""; |
103 |
and $row['date_depot']<=$datefin) |
and $row['date_depot']<=$datefin) |
104 |
or ($row['date_decision'] >= $datedebut |
or ($row['date_decision'] >= $datedebut |
105 |
and $row['date_decision']<=$datefin))){ |
and $row['date_decision']<=$datefin))){ |
106 |
$depot.=$g->entete("DEPOT",$departement,$commune); |
$depot.=$g->entete("DEPOT",$departement,$commune,$pf_departement); |
107 |
$depot.=$g->etatcivil(); |
$depot.=$g->etatcivil(); |
108 |
$depot.=$g->adresse(); |
$depot.=$g->adresse(); |
109 |
$depot.=$g->delegataire(); |
$depot.=$g->delegataire(); |
140 |
if($row['types']=='Transfert' |
if($row['types']=='Transfert' |
141 |
and $row['date_depot'] >= $datedebut |
and $row['date_depot'] >= $datedebut |
142 |
and $row['date_depot']<=$datefin){ |
and $row['date_depot']<=$datefin){ |
143 |
$transfert.=$g->entete("TRANSFERT",$departement,$commune); |
$transfert.=$g->entete("TRANSFERT",$departement,$commune,$pf_departement); |
144 |
$transfert.=$g->etatcivil(); |
$transfert.=$g->etatcivil(); |
145 |
$transfert.=$g->adresse(); |
$transfert.=$g->adresse(); |
146 |
$transfert.=$g->meltel($row['types']); |
$transfert.=$g->meltel($row['types']); |
155 |
$avis_sitadel=""; |
$avis_sitadel=""; |
156 |
$avis_sitadel_motif=""; |
$avis_sitadel_motif=""; |
157 |
// enregistrement decision dans tous les cas |
// enregistrement decision dans tous les cas |
158 |
$decision.=$g->entete("DECISION",$departement,$commune); |
$decision.=$g->entete("DECISION",$departement,$commune,$pf_departement); |
159 |
//if ($row['date_decision']== '0000-00-00' |
//if ($row['date_decision']== '0000-00-00' |
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']!=""){ |
172 |
$avis_sitadel_motif = $row1['sitadel_motif']; |
$avis_sitadel_motif = $row1['sitadel_motif']; |
173 |
} |
} |
174 |
$decision.= $g->decision_groupe1($avis_sitadel,$avis_sitadel_motif); |
$decision.= $g->decision_groupe1($avis_sitadel,$avis_sitadel_motif); |
175 |
}else |
}else{ |
176 |
$decision.= $g->decision_groupe1("0",""); // pas d avis |
$decision.= $g->decision_groupe1("0",""); // pas d avis |
177 |
|
$decision.= $t10.$t10.$t10.$t10.$t10.$t10.$t10.$t10.$t10.$t10."|||"; //83 |
178 |
|
} |
179 |
// si la decision est favorable, envoi des informations statistiques |
// si la decision est favorable, envoi des informations statistiques |
180 |
if($avis_sitadel==2 or $avis_sitadel==4 |
if($avis_sitadel==2 or $avis_sitadel==4 |
181 |
or $avis_sitadel==5){ |
or $avis_sitadel==5){ |
214 |
$decision.= $g->destination($shoncr2); |
$decision.= $g->destination($shoncr2); |
215 |
|
|
216 |
$decision.= $g->descriptif($row['types']); |
$decision.= $g->descriptif($row['types']); |
217 |
} |
}else // decision defavorable |
218 |
//}else |
$decision.= $t10.$t10.$t10.$t10.$t10.$t10.$t10.$t10.$t10.$t10."|||"; //83 |
|
// $decison.= "|0***"; // avis = 0 si pas de decision |
|
219 |
$decision.="\n"; |
$decision.="\n"; |
220 |
} |
} |
221 |
|
|
224 |
if($row['types']=='Modificatif' |
if($row['types']=='Modificatif' |
225 |
and $row['date_depot'] >= $datedebut |
and $row['date_depot'] >= $datedebut |
226 |
and $row['date_depot']<=$datefin){ |
and $row['date_depot']<=$datefin){ |
227 |
$modificatif.=$g->entete("MODIFICATIF",$departement,$commune); |
$modificatif.=$g->entete("MODIFICATIF",$departement,$commune,$pf_departement); |
228 |
if(isset($row['date_decision']) or $row['date_decision']==""){ |
if(isset($row['date_decision']) or $row['date_decision']==""){ |
229 |
// avis_sitadel et avis_sitadel_motif |
// avis_sitadel et avis_sitadel_motif |
230 |
if($row['avis']!=''){ |
if($row['avis']!=''){ |
287 |
// suivi DOC |
// suivi DOC |
288 |
$suivi1=""; |
$suivi1=""; |
289 |
if($row['date_chantier'] >= $datedebut and $row['date_chantier']<=$datefin){ |
if($row['date_chantier'] >= $datedebut and $row['date_chantier']<=$datefin){ |
290 |
$suivi1.=$g->entete("SUIVI",$departement,$commune); |
$suivi1.=$g->entete("SUIVI",$departement,$commune,$pf_departement); |
291 |
$suivi1.=$g->chantier(); |
$suivi1.=$g->chantier(); |
292 |
$suivi1.="\n"; |
$suivi1.="\n"; |
293 |
} |
} |
294 |
// suivi DAT |
// suivi DAT |
295 |
$suivi2=""; |
$suivi2=""; |
296 |
if($row['date_achevement'] >= $datedebut and $row['date_achevement']<=$datefin){ |
if($row['date_achevement'] >= $datedebut and $row['date_achevement']<=$datefin){ |
297 |
$suivi2.=$g->entete("SUIVI",$departement,$commune); |
$suivi2.=$g->entete("SUIVI",$departement,$commune,$pf_departement); |
298 |
$suivi2.=$g->achevement(); |
$suivi2.=$g->achevement(); |
299 |
$suivi2.="\n"; |
$suivi2.="\n"; |
300 |
} |
} |
307 |
// numero |
// numero |
308 |
// $numero= $db -> nextId('sitadel'); |
// $numero= $db -> nextId('sitadel'); |
309 |
$numero=$_POST["numero"]; |
$numero=$_POST["numero"]; |
310 |
$fichiertransmis = date('ymj').$departement.$commune; |
$fichiertransmis = date('ymj').$pf_departement.$departement.$commune; |
311 |
$longueurenregistrement= 0 ; // a calculer *** enregistrement le plus long |
$longueurenregistrement= 0 ; // a calculer *** enregistrement le plus long |
312 |
$entete = "SITADEL|".$departement."|".$commune."|".$region."|".$fichiertransmis."|".$numero."|"; |
$entete = "SITADEL|".$pf_departement.$departement."|".$commune."|".$region."|".$fichiertransmis."|".$numero."|"; |
313 |
// calcul enregistrement le plus long |
// calcul enregistrement le plus long |
314 |
if(CHARSET=='UTF8'){ |
if(CHARSET=='UTF8'){ |
315 |
$export=utf8_decode($export); |
$export=utf8_decode($export); |
334 |
$version = substr($version,0,8); |
$version = substr($version,0,8); |
335 |
$entete.= $longueurenregistrement."|".$datemodification."|".$nombreenregistrement."|openFoncier|".$version."\n"; |
$entete.= $longueurenregistrement."|".$datemodification."|".$nombreenregistrement."|openFoncier|".$version."\n"; |
336 |
$export=$entete.$export; |
$export=$entete.$export; |
337 |
//$str = htmlentities($str, ENT_QUOTES); |
// $str = htmlentities($str, ENT_QUOTES); |
338 |
// ecriture des fichiers en tmp |
// ecriture des fichiers en tmp |
339 |
$fichier = "../tmp/SITADEL".substr($_POST["datedebut"],3,2). |
$fichier = "../tmp/SITADEL".substr($_POST["datedebut"],3,2). |
340 |
"".substr($_POST["datedebut"],8,4)."_test"; |
"".substr($_POST["datedebut"],8,4)."_test"; |