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