addHTMLHeadJs(array("../js/script.js")); // GET ======================================================================== if (isset ($_GET['validation'])){ $validation=$_GET['validation']; }else{ $validation=0; } if (isset ($_GET['idx'])){ $idx=$_GET['idx']; }else{ $idx=0; } /** * Description de la page */ $description = _("Cette page vous permet de Transmettre les DP au cadastre DGI (procedure LASCOT."); $f->displayDescription($description); // ============================================================================= // validation = 0 // ============================================================================= if($validation==0){ $validation=1; echo "
"; echo " "._("DATE DEBUT DEPOT")." "; echo ""; echo " "._("DATE FIN DEPOT")." "; echo ""; echo "



"; echo "
"; }else { // ===================== extraction ================================= $correct=true; if($_POST["datedebut"]=="") $correct=false; if($_POST["datefin"]=="") $correct=false; if ($correct==true){ $departement =$f->collectivite["departement"]; $commune =$f->collectivite["commune"]; $sql= "select date_depot,annee, dossier.dossier, demandeur_civilite, dossier.nature, demandeur_nom,demandeur_societe,demandeur_adresse,demandeur_ville,demandeur_cp, parcelle, terrain_numero,terrain_numero_complement, terrain_adresse,terrain_adresse_complement, terrain_ville, shon,logement_nombre,travaux.libelle from dossier left join travaux on dossier.travaux=travaux.travaux"; $sql.= " where (dossier.nature = 'DP' or dossier.nature = 'PD')"; $sql.= " AND date_depot>='".substr($_POST["datedebut"],6,4). "-".substr($_POST["datedebut"],3,2)."-". substr($_POST["datedebut"],0,2)."'"; $sql.= " AND date_depot<='".substr($_POST["datefin"],6,4). "-".substr($_POST["datefin"],3,2)."-". substr($_POST["datefin"],0,2)."'"; $res = $f->db -> query ($sql); $f->isDatabaseError($res); $export=""; $bl=""; while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ $export.= $departement; $export.= $commune; $export.= $row['annee']; $export.=substr($row['dossier'],4,5);// numero dossier 5 // decision format yyyymm $temp= substr($row['date_depot'],0,4).substr($row['date_depot'],5,2); if($temp=='000000') $temp=' '; // date vide si 0000/00/00 $export.=$temp;// // label $export.= str_pad($row['nature'],2," ", STR_PAD_RIGHT); //label DP ou PD // maitre ouvrage $export.= str_pad(substr($row['demandeur_civilite'],0,5),5," ", STR_PAD_RIGHT); //nom du maitre d ouvrage $export.= str_pad(substr($row['demandeur_nom'],0,27),27," ", STR_PAD_RIGHT); //nom du maitre d ouvrage $export.= str_pad(substr($row['demandeur_societe'],0,32),32," ", STR_PAD_RIGHT); //1ere ligne $export.= str_pad(substr($row['demandeur_adresse'],0,32),32," ", STR_PAD_RIGHT); // adresse $export.= str_pad($bl,32," ", STR_PAD_RIGHT); //2eme ligne $export.= str_pad($bl,32," ", STR_PAD_RIGHT); //3eme Ligne $export.= str_pad($row['demandeur_cp'],5," ", STR_PAD_RIGHT); $export.= str_pad(substr($row['demandeur_ville'],0,26),26," ", STR_PAD_RIGHT); // terrain $export.= str_pad($bl,32," ", STR_PAD_RIGHT); $export.= str_pad(substr($row['terrain_numero']. " ".$row['terrain_numero_complement']." ". $row['terrain_adresse'],0,32),32," ", STR_PAD_RIGHT); $export.= str_pad(substr($row['terrain_adresse_complement'],0,32),32," ", STR_PAD_RIGHT); $export.= str_pad(substr($row['terrain_cp'],0,5),5," ", STR_PAD_RIGHT); $export.= str_pad(substr($row['terrain_ville'],0,26),26," ", STR_PAD_RIGHT); $export.= str_pad(substr($row['parcelle'],0,7),7," ", STR_PAD_RIGHT); //nom du maitre d ouvrage // destination = travaux libelle $export.= str_pad (substr($row['libelle'],0,30), 30, " ", STR_PAD_RIGHT); $export.="\n"; } } // ecriture des fichiers en tmp $fichier = "../tmp/LO".substr($_POST["datedebut"],3,2). "".substr($_POST["datedebut"],8,4)."DT.132"; $inf = fopen($fichier,"w"); //$export=substr($export,0,strlen($export)-1); // un \n en trop fwrite($inf,$export); fclose($inf); echo ""; echo "
"; echo "

Fichier ".$fichier."


"; //$affiche= str_replace("\n","
",$export); echo "

Pour telecharger le fichier, cliquer ici : "; echo "\"Telecharger"; echo " avec le bouton droit et enregistrer la cible du lien sous.

"; echo "
"; }//validation ?>