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