58 |
$longueurenregistrement= 0 ; // a calculer |
$longueurenregistrement= 0 ; // a calculer |
59 |
// entete |
// entete |
60 |
$nombreenregistrement=1; // l entete est compt�e dans le nombre enregistrement |
$nombreenregistrement=1; // l entete est compt�e dans le nombre enregistrement |
61 |
if($_POST["datedebut"]=="") |
if($_POST["datedebut"]=="")$correct=false; |
|
$correct=false; |
|
62 |
if($_POST["datefin"]=="") $correct=false; |
if($_POST["datefin"]=="") $correct=false; |
63 |
|
$correct=true; // a enlever apres test |
64 |
if ($correct==true){ // *** |
if ($correct==true){ // *** |
65 |
// dossiers concern�s |
// dossiers concern�s |
66 |
$sql= "select * from dossier"; |
$sql= "select * from dossier"; |
120 |
// type different de modificatif |
// type different de modificatif |
121 |
if($row['types']!='Modificatif'){ |
if($row['types']!='Modificatif'){ |
122 |
$decision=""; |
$decision=""; |
123 |
|
$avis_sitadel=""; |
124 |
|
$avis_sitadel_motif=""; |
125 |
// enregistrement decision dans tous les cas |
// enregistrement decision dans tous les cas |
126 |
$decision.=$g->entete("DECISION",$departement,$commune); |
$decision.=$g->entete("DECISION",$departement,$commune); |
127 |
//if ($row['date_decision']== '0000-00-00' |
//if ($row['date_decision']== '0000-00-00' |
128 |
// or !isset($row['date_decision'])){ |
// or !isset($row['date_decision'])){ |
129 |
//if(!isset($row['date_decision']) or $row['date_decision']==""){ |
if(isset($row['date_decision']) or $row['date_decision']==""){ |
130 |
// avis_sitadel et avis_sitadel_motif |
// avis_sitadel et avis_sitadel_motif |
131 |
if($row['avis']!=''){ |
if($row['avis']!=''){ |
132 |
$avis_sitadel = 0; |
$avis_sitadel = 0; |
134 |
$sql="select sitadel, sitadel_motif from avis where avis ='".$row['avis']."'"; |
$sql="select sitadel, sitadel_motif from avis where avis ='".$row['avis']."'"; |
135 |
$res1 = $f->db -> query ($sql); |
$res1 = $f->db -> query ($sql); |
136 |
$f->isDatabaseError($res1); |
$f->isDatabaseError($res1); |
137 |
|
|
138 |
while ($row1=& $res1->fetchRow(DB_FETCHMODE_ASSOC)){ |
while ($row1=& $res1->fetchRow(DB_FETCHMODE_ASSOC)){ |
139 |
$avis_sitadel = $row1['sitadel']; |
$avis_sitadel = $row1['sitadel']; |
140 |
$avis_sitadel_motif = $row1['sitadel_motif']; |
$avis_sitadel_motif = $row1['sitadel_motif']; |
141 |
} |
} |
142 |
|
echo $avis_sitadel."***"; |
143 |
$decision.= $g->decision_groupe1($avis_sitadel,$avis_sitadel_motif); |
$decision.= $g->decision_groupe1($avis_sitadel,$avis_sitadel_motif); |
144 |
} |
} |
145 |
|
// si la decision est favorable, envoi des informations statistiques |
146 |
if($avis_sitadel==2 or $avis_sitadel==4 |
if($avis_sitadel==2 or $avis_sitadel==4 |
147 |
or $avis_sitadel==5){ |
or $avis_sitadel==5){ |
148 |
// si decision favorable, expresse ou tacite GROUPE 2 |
// si decision favorable, expresse ou tacite GROUPE 2 |
149 |
$decision.= $g->amenagement(); |
$decision.= $g->amenagement(); |
150 |
if($row['travaux']!=''){ |
if($row['travaux']!=''){ |
151 |
$sql= "select codelascot as lascot,libelle |
$sql= "select codelascot,libelle |
152 |
from travaux where travaux=".$row['travaux']; |
from travaux where travaux=".$row['travaux']; |
153 |
$res2 = $f->db -> query ($sql); |
$res2 = $f->db -> query ($sql); |
154 |
$f->isDatabaseError($res2); |
$f->isDatabaseError($res2); |
155 |
while ($row2=& $res2->fetchRow(DB_FETCHMODE_ASSOC)){ |
while ($row2=& $res2->fetchRow(DB_FETCHMODE_ASSOC)){ |
156 |
$travaux = $row2['libelle']; |
$travaux = $row2['libelle']; |
157 |
$lascot = $row2['lascot']; |
$lascot = $row2['codelascot']; |
158 |
} |
} |
159 |
$decision.= $g->travaux($travaux,$lascot); |
$decision.= $g->travaux($travaux,$lascot); |
160 |
} |
} |
179 |
$decision.= $g->destination($shoncr2); |
$decision.= $g->destination($shoncr2); |
180 |
|
|
181 |
$decision.= $g->descriptif(); |
$decision.= $g->descriptif(); |
182 |
|
$decision.="\n"; |
183 |
|
} |
184 |
} |
} |
|
//} |
|
185 |
} |
} |
186 |
|
|
187 |
|
// suivi DOC : mettre le test date |
188 |
|
$suivi1=""; |
189 |
|
// enregistrement decision dans tous les cas |
190 |
|
// $nombreenregistrement++; |
191 |
|
$suivi1.=$g->entete("SUIVI",$departement,$commune); |
192 |
|
$suivi1.=$g->chantier(); |
193 |
|
$suivi1.="\n"; |
194 |
|
|
195 |
|
// suivi DAT : mettre le test date |
196 |
|
$suivi2=""; |
197 |
|
// enregistrement decision dans tous les cas |
198 |
|
// $nombreenregistrement++; |
199 |
|
$suivi2.=$g->entete("SUIVI",$departement,$commune); |
200 |
|
$suivi2.=$g->achevement(); |
201 |
|
$suivi2.="\n"; |
202 |
|
|
203 |
|
|
204 |
|
|
205 |
|
|
206 |
|
|
207 |
|
|
208 |
|
|
209 |
|
|
210 |
|
|
211 |
if($DEBUG==1){ |
if($DEBUG==1){ |
212 |
echo $depot."<br>"; |
echo $depot."<br>"; |
213 |
echo $decision."<br>"; |
echo $decision."<br>"; |
214 |
|
echo $suivi1."<br>"; |
215 |
|
echo $suivi2."<br>"; |
216 |
} |
} |
217 |
|
|
218 |
|
|
249 |
echo "<BR><br><font style='background-color:#ffffff;border : 1px solid #000000'>DECISION</font> ".$sql; |
echo "<BR><br><font style='background-color:#ffffff;border : 1px solid #000000'>DECISION</font> ".$sql; |
250 |
$res = $f->db -> query ($sql); |
$res = $f->db -> query ($sql); |
251 |
$f->isDatabaseError($res); |
$f->isDatabaseError($res); |
252 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
|
|
$nombreenregistrement++; |
|
|
$cpt_decision++; |
|
|
// Decision GROUPE 1 |
|
|
// sitadel : mouv|typpermis|equivalence|dep|commune|andepnumpc|indmod |
|
|
$decision.="DECISION|".$row['nature']."||".$departement."|".$commune."|".$row['annee']."|".substr($row['dossier'],4,5)."|".substr($row['dossier'],9,2)."|"; |
|
|
// sitadel : collectivite|natdec|datedec|motifann |
|
|
|
|
|
// ================================================== |
|
|
/ |
|
|
// ================================================== |
|
|
//avis sitadel |
|
|
if($row['avis_sitadel']==2 |
|
|
or $row['avis_sitadel']==4 |
|
|
or $row['avis_sitadel']==5){ |
|
|
// renseignement du groupe 2 *** |
|
|
//sitadel : terrain|lotissement|zac|afu|libnattrav|natproj| |
|
|
$decision.= "|".floor($row['terrain_surface'])."|"; |
|
|
if($row['amenagement']!='') |
|
|
$decision.= "1|"; |
|
|
else |
|
|
$decision.= "0|"; |
|
|
$decision.= "0|0|"; // zac afu -> non renseignee |
|
|
$decision.= maj($row['travaux_libelle'])."|"; |
|
|
// aout 2010 ????????????????? $decision.= "0|"; |
|
|
if($row['lascot']=='1' |
|
|
or $row['lascot']=='2' |
|
|
or $row['lascot']=='3') |
|
|
$decision.= $row['lascot']."|"; // natproj 1:construction 2:extension ou 3:surelevation |
|
|
else |
|
|
$decision.= "|"; |
|
|
// natdp|nattrav|*annexe*|*nivmax* ========================= |
|
|
//natdp |
|
|
$natdp='00000'; |
|
|
if($row['lascot']=='1') $natdp="10000"; // nouvelle construction |
|
|
if($row['lascot']=='2') $natdp="01000"; // travaux sur construction existante |
|
|
if($row['lascot']=='3') $natdp="01000"; // |
|
|
if($row['lascot']=='X') $natdp="00001"; // cloture |
|
|
$decision.= $natdp."|"; |
|
|
// nattrav |
|
|
$nattrav = "0000"; |
|
|
if($row['lascot']=='2') $nattrav="1000"; |
|
|
if($row['lascot']=='3') $nattrav="0100"; |
|
|
$decision.= $nattrav."|"; |
|
|
// annexe non renseigner defaut 00000 |
|
|
$decision.= "00000|"; |
|
|
//nivmax non saisi |
|
|
// ajout nivmax aout 2010 |
|
|
$decision.="|"; |
|
|
// S H O N / DESTINATION ======================================== |
|
|
//shonant1 - shonnant9|shondem1 � 9| shonanttr1 � 9| shonprojtr 1 � 9|shoncr1 a 9 |shon2cr1 a 9 |
|
|
// 1 habitation, 2 hotel , 3 bureau ... 9 ... |
|
|
// les shon sont exprimees sans decimales |
|
|
$decision.= "|||||||||";// shon avant travaux -> non renseigne |
|
|
// table destination |
|
|
$sql1="select destination, shon from destination_shon where dossier = '". $row['dossier']."'"; |
|
|
$res1 = $f->db -> query ($sql1); |
|
|
$f->isDatabaseError($res1); |
|
|
// |
|
|
$tmpPD = array(); // shon existante demolie |
|
|
for($i=0;$i<=9;$i++) |
|
|
{ |
|
|
$tmpPD[$i]=''; |
|
|
} |
|
|
// |
|
|
$tmplascot4 = array(); // shon changement de destination |
|
|
for($i=0;$i<=9;$i++) |
|
|
{ |
|
|
$tmplascot4[$i]=''; |
|
|
} |
|
|
// |
|
|
$tmplascot1 = array(); // shon nouvellement construite |
|
|
for($i=0;$i<=9;$i++) |
|
|
{ |
|
|
$tmplascot1[$i]=''; |
|
|
} |
|
|
// |
|
|
$tmplascot2 = array(); // shon cree par transformation |
|
|
for($i=0;$i<=9;$i++) |
|
|
{ |
|
|
$tmplascot2[$i]=''; |
|
|
} |
|
|
while ($row1=& $res1->fetchRow(DB_FETCHMODE_ASSOC)){ |
|
|
// shonprojtr1 a 9 / shoncr1 a 9 / |
|
|
if($row['nature']== 'PD') { |
|
|
$tmpPD[$row1['destination']] = $row1['shon']; // shon existante demolie -> a remplir |
|
|
} |
|
|
if($row['lascot']== '4') { |
|
|
$tmplascot4[$row1['destination']] = $row1['shon'];// shon changement de destination -> a remplir |
|
|
} |
|
|
if($row['lascot']== '1'){ |
|
|
$tmplascot1[$row1['destination']] = $row1['shon'];// shon nouvellement construite -> a remplir |
|
|
} |
|
|
if($row['lascot']== '2') { |
|
|
$tmplascot2[$row1['destination']] = $row1['shon'];// shon cree par transformation -> a remplir |
|
|
} |
|
|
} |
|
|
// shon existante demolie -> a remplir |
|
|
for($i=1;$i<=9;$i++) |
|
|
{ |
|
|
$decision.=$tmpPD[$i].'|'; |
|
|
} |
|
|
// |
|
|
$decision.= "|||||||||";// shon supprimmee par changement de destination -> non renseigne |
|
|
// |
|
|
//$row['lascot']== '4' shon changement de destination |
|
|
for($i=1;$i<=9;$i++) |
|
|
{ |
|
|
$decision.=$tmplascot4[$i].'|'; |
|
|
} |
|
|
//shon nouvellement construite |
|
|
for($i=1;$i<=9;$i++) |
|
|
{ |
|
|
$decision.=$tmplascot1[$i].'|'; |
|
|
} |
|
|
//shon cree par transformation |
|
|
for($i=1;$i<=9;$i++) |
|
|
{ |
|
|
$decision.=$tmplascot2[$i].'|'; |
|
|
} |
|
|
// fin destination_shon ==================================== |
|
|
// cpublic : non renseignee N par defaut |
|
|
// O/N transport/enseignement/sante/social/special/culture |
|
|
$decision.= "000000"; //* supp| |
|
|
// nblogdem |
|
|
$decision.= "|".$row['logement_nombre']; |
|
|
// nbmaison : nombre de maison |
|
|
$decision.= "|"; |
|
|
// nblogcoll : nombre de logement collectif |
|
|
$decision.= "|"; |
|
|
// nbtotlog : nombre de logement total |
|
|
$decision.= "|"; |
|
|
// natres : nature des residences |
|
|
// O/N 1=ages, 2=etudiant, 3=tourisme, 4=hotel, 5=social, 6= handicap, 7=autres |
|
|
$decision.= "|0000000"; |
|
|
// libres= si autre residence (long max 1000 c) |
|
|
$decision.= "|"; |
|
|
// util : O/N personnel, principale, secondaire, vente, location |
|
|
$decision.= "|00000"; |
|
|
//chambres |
|
|
$decision.= "|"; |
|
|
// nb logement sociaux |
|
|
$decision.= "|"; |
|
|
// nb logt financt aides |
|
|
$decision.= "|"; |
|
|
// nb de logt pret a taux 0 |
|
|
$decision.= "|"; |
|
|
// nb de logt finances autrt |
|
|
$decision.= "|"; |
|
|
// nb pieces en maison individuelle |
|
|
$decision.= "|".$row['piece_nombre']; // voir si 0 |
|
|
// chambre (num capacite accueil locaux hebergement) |
|
|
$decision.= "|"; |
|
|
// nb de logement 1piece |
|
|
$decision.= "|"; |
|
|
// nb de logement 2 pieces |
|
|
$decision.= "|"; |
|
|
// nb de logement 3 pieces |
|
|
$decision.= "|"; |
|
|
// nb de logement 4 pieces |
|
|
$decision.= "|"; |
|
|
// nb de logement 5 pieces |
|
|
$decision.= "|"; |
|
|
// nb de logement 6 pieces |
|
|
$decision.= ""; |
|
|
}// fin decision favorable |
|
|
$decision.="\n"; |
|
|
} // end while decision |
|
|
if($DEBUG==1){ |
|
|
$temp=explode("\n",$decision); |
|
|
$temp1=sizeof($temp)-1; |
|
|
for($g=0;$g<$temp1;$g++){ |
|
|
$temp2=array(); |
|
|
$temp2 = explode("|",$temp[$g]); |
|
|
$v=$g+1; |
|
|
echo "<br><br>decision : ".$v." ============== <br>"; |
|
|
for($k=0;$k<sizeof($temp2);$k++){ |
|
|
$t=$k+1; |
|
|
echo $t." : ".$temp2[$k]."<br>"; |
|
|
} |
|
|
} |
|
|
} // fin debug decision |
|
253 |
// ================================================================================== |
// ================================================================================== |
254 |
// suivi DOC *** suivi DOC *** |
// suivi DOC *** suivi DOC *** |
255 |
// ================================================================================== |
// ================================================================================== |