[315] | 1 | <?php |
---|
| 2 | /* Modul: alkisnamstruk.php |
---|
[123] | 3 | |
---|
[315] | 4 | ALKIS-Buchauskunft, Kommunales Rechenzentrum Minden-Ravensberg/Lippe (Lemgo). |
---|
| 5 | Namens- und Adressdaten fuer einen Eigentuemer aus ALKIS PostNAS |
---|
| 6 | |
---|
| 7 | Version: |
---|
| 8 | 2013-04-08 deprecated "import_request_variables" ersetzt |
---|
| 9 | 2013-11-22 Namensbestandteil ("von") in Kompakt-Adresse vor den Namen setzen |
---|
| 10 | 2014-02-06 Redundante Adressen kommen vor. Nur eine davon anzeigen. |
---|
[330] | 11 | 2014-09-04 PostNAS 0.8: ohne Tab. "alkis_beziehungen", mehr "endet IS NULL", Spalten varchar statt integer |
---|
| 12 | 2014-09-10 Bei Relationen den Timestamp abschneiden |
---|
[315] | 13 | |
---|
| 14 | ToDo: Sortierung der GrundbÃŒcher zum Namen |
---|
| 15 | */ |
---|
[132] | 16 | session_start(); |
---|
[315] | 17 | $cntget = extract($_GET); |
---|
| 18 | require_once("alkis_conf_location.php"); |
---|
| 19 | if ($auth == "mapbender") {require_once($mapbender);} |
---|
| 20 | include("alkisfkt.php"); |
---|
| 21 | if ($id == "j") { $idanzeige=true;} else {$idanzeige=false;} |
---|
| 22 | $keys = isset($_GET["showkey"]) ? $_GET["showkey"] : "n"; |
---|
[132] | 23 | if ($keys == "j") {$showkey=true;} else {$showkey=false;} |
---|
| 24 | |
---|
[315] | 25 | ?> |
---|
| 26 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
---|
| 27 | <html> |
---|
| 28 | <head> |
---|
| 29 | <meta name="author" content="b600352" > |
---|
| 30 | <meta http-equiv="cache-control" content="no-cache"> |
---|
| 31 | <meta http-equiv="pragma" content="no-cache"> |
---|
| 32 | <meta http-equiv="expires" content="0"> |
---|
| 33 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
---|
| 34 | <title>ALKIS Person und Adresse</title> |
---|
| 35 | <link rel="stylesheet" type="text/css" href="alkisauszug.css"> |
---|
[301] | 36 | <link rel="shortcut icon" type="image/x-icon" href="ico/Eigentuemer_2.ico"> |
---|
[315] | 37 | <script type="text/javascript"> |
---|
[301] | 38 | function ALKISexport() { |
---|
[306] | 39 | window.open(<?php echo "'alkisexport.php?gkz=".$gkz."&tabtyp=person&gmlid=".$gmlid."'"; ?>); |
---|
[315] | 40 | } |
---|
| 41 | </script> |
---|
| 42 | <style type='text/css' media='print'> |
---|
| 43 | .noprint {visibility: hidden;} |
---|
| 44 | </style> |
---|
| 45 | </head> |
---|
[301] | 46 | <body> |
---|
[315] | 47 | |
---|
| 48 | <?php |
---|
| 49 | $con = pg_connect("host=".$dbhost." port=".$dbport." dbname=".$dbname." user=".$dbuser." password=".$dbpass); |
---|
| 50 | // Balken |
---|
| 51 | echo "<p class='nakennz'>ALKIS Name id=".$gmlid." </p>\n"; |
---|
| 52 | |
---|
| 53 | echo "\n<h2><img src='ico/Eigentuemer.ico' width='16' height='16' alt=''> Person</h2>\n"; |
---|
| 54 | if (!$con) "\n<p class='err'>Fehler beim Verbinden der DB</p>\n"; |
---|
| 55 | |
---|
| 56 | $sql="SELECT nachnameoderfirma, anrede, vorname, geburtsname, geburtsdatum, namensbestandteil, akademischergrad "; |
---|
| 57 | $sql.="FROM ax_person WHERE gml_id= $1;"; |
---|
| 58 | |
---|
| 59 | $v = array($gmlid); |
---|
| 60 | $res = pg_prepare("", $sql); |
---|
| 61 | $res = pg_execute("", $v); |
---|
| 62 | |
---|
| 63 | if (!$res) {echo "\n<p class='err'>Fehler bei Zugriff auf Namensnummer</p>\n";} |
---|
[330] | 64 | if ($idanzeige) { linkgml($gkz, $gmlid, "Person", "ax_person"); } |
---|
[315] | 65 | if ($row = pg_fetch_array($res)) { |
---|
| 66 | $vor=htmlentities($row["vorname"], ENT_QUOTES, "UTF-8"); |
---|
| 67 | $nam=htmlentities($row["nachnameoderfirma"], ENT_QUOTES, "UTF-8"); |
---|
| 68 | $geb=htmlentities($row["geburtsname"], ENT_QUOTES, "UTF-8"); |
---|
| 69 | $anrk=$row["anrede"]; |
---|
| 70 | $anr=anrede($anrk); |
---|
| 71 | $nbest=$row["namensbestandteil"]; |
---|
| 72 | $aka=$row["akademischergrad"]; |
---|
| 73 | |
---|
| 74 | echo "<table>\n"; |
---|
| 75 | echo "\t<tr><td class='nhd'>Anrede:</td><td class='nam'>"; |
---|
| 76 | if ($showkey) {echo "<span class='key' title='Anredekennung'>(".$anrk.")</span> ";} |
---|
| 77 | echo $anr."</td></tr>\n"; |
---|
| 78 | echo "\t<tr><td class='nhd'>Nachname oder Firma:</td><td class='nam'>".$nam."</td></tr>\n"; |
---|
| 79 | echo "\t<tr><td class='nhd'>Vorname:</td><td class='nam'>".$vor." </td></tr>\n"; |
---|
| 80 | echo "\t<tr><td class='nhd'>Geburtsname:</td><td class='nam'>".$geb." </td></tr>\n"; |
---|
| 81 | echo "\t<tr><td class='nhd'>Geburtsdatum:</td><td class='nam'>".$row["geburtsdatum"]." </td></tr>\n"; |
---|
| 82 | echo "\t<tr><td class='nhd'>Namensbestandteil:</td><td class='nam'>".$nbest." </td></tr>\n"; |
---|
| 83 | echo "\t<tr><td class='nhd'>akademischer Grad:</td><td class='nam'>".$aka." </td></tr>\n"; |
---|
| 84 | echo "\n</table>\n<hr>\n"; |
---|
| 85 | |
---|
| 86 | // A d r e s s e |
---|
| 87 | echo "\n<h3><img src='ico/Strasse_mit_Haus.ico' width='16' height='16' alt=''> Adresse</h3>\n"; |
---|
| 88 | // Es können redundante Adressen vorhanden sein, z.B. aus Migration, temporÀr aus LBESAS. Die letzte davon anzeigen. |
---|
| 89 | |
---|
[330] | 90 | $sqla ="SELECT a.gml_id, a.ort_post, a.postleitzahlpostzustellung AS plz, a.strasse, a.hausnummer, a.bestimmungsland |
---|
| 91 | FROM ax_anschrift a JOIN ax_person p ON substring(a.gml_id,1,16)=ANY(p.hat) WHERE p.gml_id= $1 ORDER BY a.gml_id DESC ;"; |
---|
| 92 | |
---|
[315] | 93 | $v = array($gmlid); |
---|
| 94 | $resa = pg_prepare("", $sqla); |
---|
| 95 | $resa = pg_execute("", $v); |
---|
[123] | 96 | if (!$resa) { |
---|
| 97 | echo "\n<p class='err'>Fehler bei Adressen</p>\n"; |
---|
| 98 | if ($debug > 2) { |
---|
| 99 | echo "<p class='err'>SQL=<br>".$sqla."<br>$1=gml(Person)= '".$gmlid."'</p>\n"; |
---|
| 100 | } |
---|
[315] | 101 | } |
---|
[123] | 102 | |
---|
[315] | 103 | $j=0; |
---|
| 104 | // Parameter $multiadress = j zeigt alle Adressen an |
---|
| 105 | while($rowa = pg_fetch_array($resa)) { |
---|
| 106 | $j++; |
---|
| 107 | if ($multiadress == "j" OR $j == 1) { |
---|
| 108 | $gmla=$rowa["gml_id"]; |
---|
| 109 | $plz=$rowa["plz"]; |
---|
| 110 | $ort=htmlentities($rowa["ort_post"], ENT_QUOTES, "UTF-8"); |
---|
| 111 | $str=htmlentities($rowa["strasse"], ENT_QUOTES, "UTF-8"); |
---|
| 112 | $hsnr=$rowa["hausnummer"]; |
---|
| 113 | $land=htmlentities($rowa["bestimmungsland"], ENT_QUOTES, "UTF-8"); |
---|
[330] | 114 | if ($idanzeige) { linkgml($gkz, $gmla, "Adresse", "ax_adresse"); } |
---|
[123] | 115 | |
---|
[315] | 116 | echo "<table>\n"; |
---|
| 117 | echo "\t<tr><td class='nhd'>PLZ:</td><td class='nam'>".$plz."</td></tr>\n"; |
---|
| 118 | echo "\t<tr><td class='nhd'>Ort:</td><td class='nam'>".$ort."</td></tr>\n"; |
---|
| 119 | echo "\t<tr><td class='nhd'>Strasse:</td><td class='nam'>".$str."</td></tr>\n"; |
---|
| 120 | echo "\t<tr><td class='nhd'>Hausnummer:</td><td class='nam'>".$hsnr."</td></tr>\n"; |
---|
| 121 | echo "\t<tr><td class='nhd'>Land:</td><td class='nam'>".$land."</td></tr>\n"; |
---|
| 122 | echo "\n</table>\n<br>\n"; |
---|
| 123 | |
---|
| 124 | // Name und Adresse Kompakt (im Rahmen) - Alles was man fuer ein Anschreiben braucht |
---|
| 125 | echo "<img src='ico/Namen.ico' width='16' height='16' alt='Brief' title='Anschrift'>"; // Symbol "Brief" |
---|
| 126 | echo "\n<div class='adr' title='Anschrift'>".$anr." ".$aka." ".$vor." ".$nbest." ".$nam."<br>"; |
---|
| 127 | echo "\n".$str." ".$hsnr."<br>"; |
---|
| 128 | echo "\n".$plz." ".$ort."</div>"; |
---|
| 129 | } |
---|
| 130 | } |
---|
| 131 | pg_free_result($resa); |
---|
| 132 | if ($j == 0) { |
---|
| 133 | echo "\n<p class='err'>Keine Adressen.</p>\n"; |
---|
| 134 | } elseif ($j > 1) { |
---|
| 135 | echo "\n\t\t<p class='nwlink noprint'>"; |
---|
| 136 | echo "\n\t\t\t<a href='".$_SERVER['PHP_SELF']. "?gkz=".$gkz."&gmlid=".$gmlid; |
---|
| 137 | if ($idanzeige) {echo "&id=j";} |
---|
| 138 | if ($showkey) {echo "&showkey=j";} |
---|
| 139 | if ($multiadress == "j") { |
---|
| 140 | echo "&multiadress=n' title='mehrfache Adressen unterdrücken'>erste Adresse "; |
---|
| 141 | } else { |
---|
| 142 | echo "&multiadress=j' title='Adressen ggf. mehrfach vorhanden'>alle Adressen "; |
---|
| 143 | } |
---|
| 144 | echo "\n\t\t\t</a>"; |
---|
| 145 | echo "\n\t\t</p>"; |
---|
| 146 | } |
---|
| 147 | |
---|
| 148 | // *** G R U N D B U C H *** |
---|
| 149 | echo "\n<hr>\n<h3><img src='ico/Grundbuch_zu.ico' width='16' height='16' alt=''> Grundbücher</h3>\n"; |
---|
| 150 | // person <benennt< namensnummer >istBestandteilVon> Buchungsblatt |
---|
| 151 | // >bestehtAusRechtsverhaeltnissenZu> namensnummer (Nebenzweig/SonderfÀlle?) |
---|
| 152 | |
---|
[330] | 153 | $sqlg ="SELECT n.gml_id AS gml_n, n.laufendenummernachdin1421 AS lfd, n.zaehler, n.nenner, g.gml_id AS gml_g, g.bezirk, g.buchungsblattnummermitbuchstabenerweiterung as nr, g.blattart, b.bezeichnung AS beznam |
---|
| 154 | FROM ax_person p JOIN ax_namensnummer n ON substring(p.gml_id,1,16)=n.benennt JOIN ax_buchungsblatt g ON substring(g.gml_id,1,16)=n.istbestandteilvon |
---|
| 155 | LEFT JOIN ax_buchungsblattbezirk b ON g.land=b.land AND g.bezirk=b.bezirk |
---|
| 156 | WHERE p.gml_id= $1 ORDER BY g.bezirk, g.buchungsblattnummermitbuchstabenerweiterung;"; |
---|
[315] | 157 | // buchungsblatt... mal mit und mal ohne fuehrende Nullen, bringt die Sortierung durcheinander |
---|
| 158 | |
---|
| 159 | $v = array($gmlid); |
---|
| 160 | $resg = pg_prepare("", $sqlg); |
---|
| 161 | $resg = pg_execute("", $v); |
---|
| 162 | |
---|
[123] | 163 | if (!$resg) { |
---|
| 164 | echo "\n<p class='err'>Fehler bei Grundbuch</p>\n"; |
---|
[315] | 165 | if ($debug > 2) { |
---|
| 166 | echo "\n<p class='err'>SQL=".$sqlg."</p>\n"; |
---|
[123] | 167 | } |
---|
[315] | 168 | } |
---|
| 169 | $j=0; |
---|
| 170 | echo "<table class='eig'>"; |
---|
| 171 | echo "\n<tr>"; |
---|
| 172 | echo "\n\t<td class='head'>Bezirk</td>"; |
---|
| 173 | echo "\n\t<td class='head'>Blattart</td>"; |
---|
| 174 | echo "\n\t<td class='head'>Blatt</td>"; |
---|
| 175 | echo "\n\t<td class='head'>Namensnummer</td>"; |
---|
| 176 | echo "\n\t<td class='head'>Anteil</td>"; |
---|
| 177 | echo "\n\t<td class='head nwlink noprint' title='Link: weitere Auskunft'>weit. Auskunft</td>"; |
---|
| 178 | echo "\n</tr>"; |
---|
| 179 | |
---|
| 180 | while($rowg = pg_fetch_array($resg)) { |
---|
| 181 | $gmln=$rowg["gml_n"]; |
---|
| 182 | $gmlg=$rowg["gml_g"]; |
---|
| 183 | $namnum=kurz_namnr($rowg["lfd"]); |
---|
| 184 | $zae=$rowg["zaehler"]; |
---|
| 185 | $blattkey=$rowg["blattart"]; |
---|
| 186 | $blattart=blattart($blattkey); |
---|
| 187 | |
---|
| 188 | echo "\n<tr>"; |
---|
| 189 | |
---|
| 190 | echo "\n\t<td class='gbl'>"; // GB-Bezirk" |
---|
| 191 | if ($showkey) { |
---|
| 192 | echo "<span class='key'>".$rowg["bezirk"]."</span> "; |
---|
| 193 | } |
---|
| 194 | echo $rowg["beznam"]; |
---|
| 195 | echo "</td>"; |
---|
| 196 | |
---|
| 197 | echo "\n\t<td class='gbl'>"; // Blattart |
---|
| 198 | if ($showkey) { |
---|
| 199 | echo "<span class='key'>".$blattkey."</span> "; |
---|
| 200 | } |
---|
| 201 | echo $blattart; |
---|
| 202 | echo "</td>"; |
---|
| 203 | |
---|
| 204 | echo "\n\t<td class='gbl'>"; // Blatt |
---|
| 205 | echo "<span class='wichtig'>".$rowg["nr"]."</span>"; |
---|
| 206 | if ($idanzeige) { |
---|
[330] | 207 | linkgml($gkz, $gmlg, "Grundbuchblatt", ""); |
---|
[315] | 208 | } |
---|
| 209 | echo "</td>"; |
---|
| 210 | |
---|
| 211 | echo "\n\t<td class='gbl'>"; // Namensnummer |
---|
| 212 | If ($namnum == "") { |
---|
| 213 | echo " "; |
---|
| 214 | } else { |
---|
| 215 | echo $namnum; |
---|
| 216 | } |
---|
| 217 | if ($idanzeige) { |
---|
[330] | 218 | linkgml($gkz, $gmln, "Namensnummer", "ax_namensnummer"); |
---|
[315] | 219 | } |
---|
| 220 | echo "</td>"; |
---|
| 221 | |
---|
| 222 | echo "\n\t<td class='gbl'>"; // Anteil |
---|
| 223 | If ($zae == "") { |
---|
| 224 | echo " "; |
---|
| 225 | } else { |
---|
| 226 | echo $zae."/".$rowg["nenner"]." Anteil"; |
---|
| 227 | } |
---|
| 228 | echo "</td>"; |
---|
| 229 | |
---|
| 230 | echo "\n\t<td class='gbl'>"; |
---|
| 231 | echo "\n\t\t<p class='nwlink noprint'>"; |
---|
| 232 | echo "\n\t\t\t<a href='alkisbestnw.php?gkz=".$gkz."&gmlid=".$gmlg; |
---|
| 233 | if ($idanzeige) {echo "&id=j";} |
---|
| 234 | if ($showkey) {echo "&showkey=j";} |
---|
| 235 | echo "' title='Bestandsnachweis'>"; |
---|
| 236 | echo $blattart; |
---|
| 237 | echo "\n\t\t\t<img src='ico/GBBlatt_link.ico' width='16' height='16' alt=''></a>"; |
---|
| 238 | echo "\n\t\t</p>"; |
---|
| 239 | echo "\n\t</td>"; |
---|
| 240 | |
---|
| 241 | echo "\n</tr>"; |
---|
| 242 | // +++ >bestehtAusRechtsverhaeltnissenZu> namensnummer ? |
---|
| 243 | // z.B. eine Namennummer "Erbengemeinschaft" zeigt auf Namensnummern mit EigentÃŒmern |
---|
| 244 | $i++; |
---|
| 245 | } |
---|
| 246 | pg_free_result($resg); |
---|
| 247 | echo "</table>"; |
---|
| 248 | if ($i == 0) {echo "\n<p class='err'>Kein Grundbuch.</p>\n";} |
---|
| 249 | } else { |
---|
| 250 | echo "\n\t<p class='err'>Fehler! Kein Treffer für\n\t<a target='_blank' href='alkisrelationen.php?gkz=".$gkz."&gmlid=".$gmlid."'>".$gmlid."</a>\n</p>\n\n"; |
---|
| 251 | } |
---|
| 252 | ?> |
---|
| 253 | |
---|
| 254 | <form action=''> |
---|
| 255 | <div class='buttonbereich noprint'> |
---|
[198] | 256 | <hr> |
---|
[315] | 257 | <a title="zurück" href='javascript:history.back()'><img src="ico/zurueck.ico" width="16" height="16" alt="zurück"></a> |
---|
| 258 | <a title="Drucken" href='javascript:window.print()'><img src="ico/print.ico" width="16" height="16" alt="Drucken"></a> |
---|
| 259 | <a title="Export als CSV" href='javascript:ALKISexport()'><img src="ico/download.ico" width="32" height="16" alt="Export"></a> |
---|
| 260 | </div> |
---|
| 261 | </form> |
---|
| 262 | |
---|
| 263 | <?php footer($gmlid, $_SERVER['PHP_SELF']."?", ""); ?> |
---|
| 264 | |
---|
| 265 | </body> |
---|
[26] | 266 | </html> |
---|