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