25 |
$f->displayDescription($description); |
$f->displayDescription($description); |
26 |
//controle |
//controle |
27 |
$DEBUG=1; |
$DEBUG=1; |
|
//$pf_departement="0"; |
|
28 |
$t10 = "||||||||||"; // 10 | |
$t10 = "||||||||||"; // 10 | |
29 |
|
|
30 |
// parametres collectivite |
// parametres collectivite |
|
|
|
31 |
// ============================================================================= |
// ============================================================================= |
32 |
// validation = 0 |
// validation = 0 |
33 |
// ============================================================================= |
// ============================================================================= |
65 |
$datefin = substr($_POST["datefin"],6,4). |
$datefin = substr($_POST["datefin"],6,4). |
66 |
"-".substr($_POST["datefin"],3,2)."-". |
"-".substr($_POST["datefin"],3,2)."-". |
67 |
substr($_POST["datefin"],0,2); |
substr($_POST["datefin"],0,2); |
|
//$correct=true; // a enlever apres test |
|
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)){ |
148 |
//decision |
//decision |
149 |
// type different de modificatif |
// type different de modificatif |
150 |
$decision=""; |
$decision=""; |
151 |
if($row['types']!='Modificatif' and $row['types']!='Transfert'){ |
if($row['types']!='Modificatif' |
152 |
|
and $row['types']!='Transfert' |
153 |
|
and (($row['date_depot'] >= $datedebut and $row['date_depot']<=$datefin) |
154 |
|
or ($row['date_decision'] >= $datedebut and $row['date_decision']<=$datefin))){ |
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 |
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); |
171 |
$avis_sitadel = $row1['sitadel']; |
$avis_sitadel = $row1['sitadel']; |
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,$structure); |
175 |
}else{ |
}else{ |
176 |
$decision.= $g->decision_groupe1("0",""); // pas d avis |
$decision.= $g->decision_groupe1("0","",$structure); // pas d avis |
177 |
$decision.= $t10.$t10.$t10.$t10.$t10.$t10.$t10.$t10.$t10.$t10."|||"; //83 |
//$decision.= "***".$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 |
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); |
219 |
$decision.= $g->destination($shoncr2); |
$decision.= $g->destination($shoncr2); |
220 |
|
|
221 |
$decision.= $g->descriptif($row['types']); |
$decision.= $g->descriptif($row['types']); |
222 |
}else // decision defavorable |
}else // decision defavorable ou pas de decision |
223 |
$decision.= $t10.$t10.$t10.$t10.$t10.$t10.$t10.$t10.$t10.$t10."|||"; //83 |
$decision.= $t10.$t10.$t10.$t10.$t10.$t10.$t10.$t10."|||"; //83 | + 12 | = 95 | pour 96 zones |
224 |
$decision.="\n"; |
$decision.="\n"; |
225 |
} |
} |
226 |
|
|
235 |
if($row['avis']!=''){ |
if($row['avis']!=''){ |
236 |
$avis_sitadel = 0; |
$avis_sitadel = 0; |
237 |
$avis_sitadel_motif=0 ; |
$avis_sitadel_motif=0 ; |
238 |
$sql="select sitadel, sitadel_motif from avis where avis ='". |
$sql="select sitadel, sitadel_motif from ".DB_PREFIXE."avis where avis ='". |
239 |
$row['avis']."'"; |
$row['avis']."'"; |
240 |
$res1 = $f->db -> query ($sql); |
$res1 = $f->db -> query ($sql); |
241 |
$f->isDatabaseError($res1); |
$f->isDatabaseError($res1); |
243 |
$avis_sitadel = $row1['sitadel']; |
$avis_sitadel = $row1['sitadel']; |
244 |
$avis_sitadel_motif = $row1['sitadel_motif']; |
$avis_sitadel_motif = $row1['sitadel_motif']; |
245 |
} |
} |
246 |
$modificatif.= $g->decision_groupe1($avis_sitadel,$avis_sitadel_motif); |
$modificatif.= $g->decision_groupe1($avis_sitadel,$avis_sitadel_motif,$structure); |
247 |
} |
} |
248 |
// si la decision est favorable, envoi des informations statistiques |
// si la decision est favorable, envoi des informations statistiques |
249 |
if($avis_sitadel==2 or $avis_sitadel==4 |
if($avis_sitadel==2 or $avis_sitadel==4 |
252 |
$modificatif.=$g->adresse_terrain(); //*** |
$modificatif.=$g->adresse_terrain(); //*** |
253 |
$modificatif.=$g->parcelle(); //*** |
$modificatif.=$g->parcelle(); //*** |
254 |
$modificatif.=$g->terrain(); //*** |
$modificatif.=$g->terrain(); //*** |
255 |
|
// enlever les RC |
256 |
|
$temp=$row['description']; |
257 |
|
$temp = str_replace( chr(10), " ", $temp); |
258 |
|
$temp = str_replace( chr(13), " ", $temp); |
259 |
if($row['travaux']!=''){ |
if($row['travaux']!=''){ |
260 |
$sql= "select codelascot,libelle |
$sql= "select codelascot,libelle |
261 |
from travaux where travaux=".$row['travaux']; |
from ".DB_PREFIXE."travaux where ".DB_PREFIXE."travaux=".$row['travaux']; |
262 |
$res2 = $f->db -> query ($sql); |
$res2 = $f->db -> query ($sql); |
263 |
$f->isDatabaseError($res2); |
$f->isDatabaseError($res2); |
264 |
while ($row2=& $res2->fetchRow(DB_FETCHMODE_ASSOC)){ |
while ($row2=& $res2->fetchRow(DB_FETCHMODE_ASSOC)){ |
265 |
$travaux = $row2['libelle']; |
$travaux = $row2['libelle']." ".$row['description']; // ***; |
266 |
$lascot = $row2['codelascot']; |
$lascot = $row2['codelascot']; |
267 |
} |
} |
268 |
|
$travaux.=" ".$temp; |
269 |
$modificatif.= $g->travaux($travaux,$lascot, $row['types']); |
$modificatif.= $g->travaux($travaux,$lascot, $row['types']); |
270 |
} |
} |
271 |
$sql3="select * from destination_shon where dossier = '". |
$sql3="select * from ".DB_PREFIXE."destination_shon where dossier = '". |
272 |
$row['dossier']."' order by destination"; |
$row['dossier']."' order by destination"; |
273 |
$res3 = $f->db -> query ($sql3); |
$res3 = $f->db -> query ($sql3); |
274 |
$f->isDatabaseError($res3); |
$f->isDatabaseError($res3); |
294 |
} |
} |
295 |
} |
} |
296 |
|
|
297 |
// suivi DOC |
// suivi DOC |
298 |
$suivi1=""; |
$suivi1=""; |
299 |
if($row['date_chantier'] >= $datedebut and $row['date_chantier']<=$datefin){ |
if($row['date_chantier'] >= $datedebut and $row['date_chantier']<=$datefin){ |
300 |
$suivi1.=$g->entete("SUIVI",$departement,$commune,$pf_departement); |
$suivi1.=$g->entete("SUIVI",$departement,$commune,$pf_departement); |
342 |
$datemodification = date('y').str_pad (DATE('m'), 2, "0", STR_PAD_LEFT).str_pad (DATE('j'), 2, "0", STR_PAD_LEFT); |
$datemodification = date('y').str_pad (DATE('m'), 2, "0", STR_PAD_LEFT).str_pad (DATE('j'), 2, "0", STR_PAD_LEFT); |
343 |
// export |
// export |
344 |
$version = substr($version,0,8); |
$version = substr($version,0,8); |
345 |
$entete.= $longueurenregistrement."|".$datemodification."|".$nombreenregistrement."|openFoncier|".$version."\n"; |
$entete.= $longueurenregistrement."|".$datemodification."|". |
346 |
|
$nombreenregistrement."|openFoncier|".$version."\n"; |
347 |
$export=$entete.$export; |
$export=$entete.$export; |
348 |
// $str = htmlentities($str, ENT_QUOTES); |
// $str = htmlentities($str, ENT_QUOTES); |
349 |
// ecriture des fichiers en tmp |
// ecriture des fichiers en tmp |
350 |
$fichier = "../tmp/SITADEL".substr($_POST["datedebut"],3,2). |
$fichier = "../tmp/SITADEL".substr($_POST["datedebut"],3,2). |
351 |
"".substr($_POST["datedebut"],8,4)."_test"; |
"".substr($_POST["datedebut"],8,4)."_test"; |
352 |
$inf = fopen($fichier,"w"); |
$inf = fopen($fichier,"w"); |
|
//$export=substr($export,0,strlen($export)-1); // un \n en trop |
|
353 |
fwrite($inf,$export); |
fwrite($inf,$export); |
354 |
fclose($inf); |
fclose($inf); |
355 |
echo "<br>Fichier ".$fichier." sauvegarde<br><br><br>"; |
echo "<br>"._("Fichier")." ".$fichier." "._("sauvegarde")."<br /><br /><br />"; |
|
|
|
356 |
// affichage |
// affichage |
357 |
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\">"; |
358 |
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 CNEN\" />"; |
359 |
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 />"; |
|
|
|
360 |
if($DEBUG==1){ |
if($DEBUG==1){ |
361 |
$affiche=""; |
$affiche=""; |
362 |
$affiche= str_replace("\n","<br>",$export); |
$affiche= str_replace("\n","<br>",$export); |
363 |
echo $affiche; |
echo $affiche; |
364 |
} |
} |
|
|
|
|
|
|
365 |
}else // correct = false |
}else // correct = false |
366 |
echo "remplissez les 2 dates"; |
echo _("remplissez les 2 dates"); |
367 |
}//validation |
}//validation |
|
?> |
|
368 |
|
?> |