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 | 06.09.2010 Schluessel anschaltbar |
---|
9 | 15.09.2010 Function "buchungsart" durch JOIN ersetzt, Tabelle GB einzeilig |
---|
10 | 14.12.2010 Pfad zur Conf
|
---|
11 | 17.12.2010 Astrid Emde: Prepared Statements (pg_query -> pg_prepare + pg_execute)
|
---|
12 | 26.01.2011 Space in leere td |
---|
13 | 01.02.2011 *Left* Join - Fehlertoleranz bei unvollstaendigen Schluesseltabellen
|
---|
14 | ToDo: |
---|
15 | Sortierung der GrundbÃŒcher zum Namen
|
---|
16 | */
|
---|
17 | ini_set('error_reporting', 'E_ALL & ~ E_NOTICE');
|
---|
18 | session_start(); |
---|
19 | $gkz=urldecode($_REQUEST["gkz"]);
|
---|
20 | require_once("alkis_conf_location.php"); |
---|
21 | if ($auth == "mapbender") { |
---|
22 | // Bindung an Mapbender-Authentifizierung
|
---|
23 | require_once($mapbender);
|
---|
24 | }
|
---|
25 | include("alkisfkt.php");
|
---|
26 | ?>
|
---|
27 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
---|
28 | <html>
|
---|
29 | <head>
|
---|
30 | <meta name="author" content="F. Jaeger krz" >
|
---|
31 | <meta http-equiv="cache-control" content="no-cache">
|
---|
32 | <meta http-equiv="pragma" content="no-cache">
|
---|
33 | <meta http-equiv="expires" content="0">
|
---|
34 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
---|
35 | <title>ALKIS Person und Adresse</title>
|
---|
36 | <link rel="stylesheet" type="text/css" href="alkisauszug.css"> |
---|
37 | <link rel="shortcut icon" type="image/x-icon" href="ico/Eigentuemer_2.ico"> |
---|
38 | <style type='text/css' media='print'>
|
---|
39 | .noprint {visibility: hidden;}
|
---|
40 | </style>
|
---|
41 | </head>
|
---|
42 | <body>
|
---|
43 | <?php
|
---|
44 | $gmlid=urldecode($_REQUEST["gmlid"]);
|
---|
45 | $id = isset($_GET["id"]) ? $_GET["id"] : "n"; |
---|
46 | if ($id == "j") { |
---|
47 | $idanzeige=true; |
---|
48 | } else { |
---|
49 | $idanzeige=false; |
---|
50 | }
|
---|
51 | $keys = isset($_GET["showkey"]) ? $_GET["showkey"] : "n";
|
---|
52 | if ($keys == "j") { |
---|
53 | $showkey=true; |
---|
54 | } else { |
---|
55 | $showkey=false; |
---|
56 | }
|
---|
57 | $con = pg_connect("host=".$dbhost." port=".$dbport." dbname=".$dbname." user=".$dbuser." password=".$dbpass);
|
---|
58 | if (!$con) echo "<p class='err'>Fehler beim Verbinden der DB</p>\n"; |
---|
59 | |
---|
60 | // Balken |
---|
61 | echo "<p class='nakennz'>ALKIS Name id=".$gmlid." </p>\n";
|
---|
62 | |
---|
63 | echo "\n<h2><img src='ico/Eigentuemer.ico' width='16' height='16' alt=''> Person</h2>\n";
|
---|
64 | if (!$con) "\n<p class='err'>Fehler beim Verbinden der DB</p>\n";
|
---|
65 | |
---|
66 | $sql="SELECT nachnameoderfirma, anrede, vorname, geburtsname, geburtsdatum, namensbestandteil, akademischergrad ";
|
---|
67 | $sql.="FROM ax_person WHERE gml_id= $1;";
|
---|
68 |
|
---|
69 | $v = array($gmlid);
|
---|
70 | $res = pg_prepare("", $sql);
|
---|
71 | $res = pg_execute("", $v); |
---|
72 |
|
---|
73 | if (!$res) {echo "\n<p class='err'>Fehler bei Zugriff auf Namensnummer</p>\n";}
|
---|
74 | if ($idanzeige) { linkgml($gkz, $gmlid, "Person"); }
|
---|
75 | if ($row = pg_fetch_array($res)) {
|
---|
76 | $vor=htmlentities($row["vorname"], ENT_QUOTES, "UTF-8");
|
---|
77 | $nam=htmlentities($row["nachnameoderfirma"], ENT_QUOTES, "UTF-8");
|
---|
78 | $geb=htmlentities($row["geburtsname"], ENT_QUOTES, "UTF-8");
|
---|
79 | $anr=anrede($row["anrede"]);
|
---|
80 | $aka=$row["akademischergrad"];
|
---|
81 | |
---|
82 | echo "<table>\n";
|
---|
83 | echo "\t<tr><td class='nhd'>Anrede:</td><td class='nam'>".$anr."</td></tr>\n";
|
---|
84 | echo "\t<tr><td class='nhd'>Nachname oder Firma:</td><td class='nam'>".$nam."</td></tr>\n";
|
---|
85 | echo "\t<tr><td class='nhd'>Vorname:</td><td class='nam'>".$vor."</td></tr>\n";
|
---|
86 | echo "\t<tr><td class='nhd'>Geburtsname:</td><td class='nam'>".$geb."</td></tr>\n";
|
---|
87 | echo "\t<tr><td class='nhd'>Geburtsdatum:</td><td class='nam'>".$row["geburtsdatum"]." </td></tr>\n";
|
---|
88 | echo "\t<tr><td class='nhd'>Namensbestandteil:</td><td class='nam'>".$row["namensbestandteil"]." </td></tr>\n";
|
---|
89 | echo "\t<tr><td class='nhd'>akademischer Grad:</td><td class='nam'>".$aka." </td></tr>\n";
|
---|
90 | echo "\n</table>\n<hr>\n";
|
---|
91 |
|
---|
92 | // A d r e s s e
|
---|
93 | echo "\n<h3><img src='ico/Strasse_mit_Haus.ico' width='16' height='16' alt=''> Adresse</h3>\n";
|
---|
94 | $sql ="SELECT a.gml_id, a.ort_post, a.postleitzahlpostzustellung AS plz, a.strasse, a.hausnummer, a.bestimmungsland ";
|
---|
95 | $sql.="FROM ax_anschrift a ";
|
---|
96 | $sql.="JOIN alkis_beziehungen b ON a.gml_id=b.beziehung_zu ";
|
---|
97 | $sql.="WHERE b.beziehung_von= $1 ";
|
---|
98 | $sql.="AND b.beziehungsart='hat';"; //"ORDER BY ?;";
|
---|
99 | //echo "\n<p class='err'>".$sql."</p>\n";
|
---|
100 |
|
---|
101 | $v = array($gmlid);
|
---|
102 | $resa = pg_prepare("", $sql);
|
---|
103 | $resa = pg_execute("", $v);
|
---|
104 |
|
---|
105 | if (!$resa) echo "\n<p class='err'>Fehler bei Adressen.<br>\nSQL= ".$sql."</p>\n";
|
---|
106 | $j=0;
|
---|
107 | while($rowa = pg_fetch_array($resa)) {
|
---|
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");
|
---|
114 | if ($idanzeige) { linkgml($gkz, $gmla, "Adresse"); }
|
---|
115 |
|
---|
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 | $j++;
|
---|
124 | |
---|
125 | // Name und Adresse Kompakt (im Rahmen) |
---|
126 | // Alles was man fuer ein Anschreiben braucht
|
---|
127 | echo "<img src='ico/Namen.ico' width='16' height='16' alt='Brief' title='Anschrift'>"; // Symbol "Brief" |
---|
128 | echo "\n<div class='adr' title='Anschrift'>".$anr." ".$aka." ".$vor." ".$nam."<br>"; |
---|
129 | echo "\n".$str." ".$hsnr."<br>"; |
---|
130 | echo "\n".$plz." ".$ort."</div>";
|
---|
131 | }
|
---|
132 | if ($j == 0) {echo "\n<p class='err'>Keine Adressen.</p>\n";}
|
---|
133 |
|
---|
134 | // *** G R U N D B U C H ***
|
---|
135 | echo "\n<hr>\n<h3><img src='ico/Grundbuch_zu.ico' width='16' height='16' alt=''> Grundbücher</h3>\n";
|
---|
136 | // person <benennt< namensnummer >istBestandteilVon> Buchungsblatt
|
---|
137 | // >bestehtAusRechtsverhaeltnissenZu> namensnummer (Nebenzweig/SonderfÀlle?)
|
---|
138 |
|
---|
139 | $sql ="SELECT n.gml_id AS gml_n, n.laufendenummernachdin1421 AS lfd, n.zaehler, n.nenner, ";
|
---|
140 | $sql.="g.gml_id AS gml_g, g.bezirk, g.buchungsblattnummermitbuchstabenerweiterung as nr, g.blattart, "; |
---|
141 | $sql.="b.bezeichnung AS beznam ";
|
---|
142 | $sql.="FROM alkis_beziehungen bpn ";
|
---|
143 | $sql.="JOIN ax_namensnummer n ON bpn.beziehung_von=n.gml_id ";
|
---|
144 | $sql.="JOIN alkis_beziehungen bng ON n.gml_id=bng.beziehung_von ";
|
---|
145 | $sql.="JOIN ax_buchungsblatt g ON bng.beziehung_zu=g.gml_id ";
|
---|
146 | $sql.="LEFT JOIN ax_buchungsblattbezirk b ON g.land = b.land AND g.bezirk = b.bezirk "; |
---|
147 | $sql.="WHERE bpn.beziehung_zu= $1 ";
|
---|
148 | $sql.="AND bpn.beziehungsart='benennt' AND bng.beziehungsart='istBestandteilVon' ";
|
---|
149 | $sql.="ORDER BY g.bezirk, g.buchungsblattnummermitbuchstabenerweiterung;";
|
---|
150 | // buchungsblatt... mal mit und mal ohne fuehrende Nullen, bringt die Sortierung durcheinander |
---|
151 |
|
---|
152 | //echo "\n<p class='err'>".$sql."</p>\n";
|
---|
153 | $v = array($gmlid);
|
---|
154 | $resg = pg_prepare("", $sql);
|
---|
155 | $resg = pg_execute("", $v); |
---|
156 |
|
---|
157 | if (!$resg) echo "\n<p class='err'>Fehler bei Grundbuch.<br>\nSQL= ".$sql."</p>\n";
|
---|
158 | $j=0;
|
---|
159 | echo "<table class='eig'>"; |
---|
160 | |
---|
161 | echo "\n<tr>"; |
---|
162 | echo "\n\t<td class='head'>Bezirk</td>";
|
---|
163 | echo "\n\t<td class='head'>Blattart</td>"; |
---|
164 | echo "\n\t<td class='head'>Blatt</td>";
|
---|
165 | echo "\n\t<td class='head'>Namensnummer</td>"; |
---|
166 | echo "\n\t<td class='head'>Anteil</td>";
|
---|
167 | echo "\n\t<td class='head nwlink noprint' title='Link: weitere Auskunft'>weit. Auskunft</td>"; |
---|
168 | echo "\n</tr>"; |
---|
169 |
|
---|
170 | while($rowg = pg_fetch_array($resg)) {
|
---|
171 | $gmln=$rowg["gml_n"];
|
---|
172 | $gmlg=$rowg["gml_g"];
|
---|
173 | $namnum=kurz_namnr($rowg["lfd"]);
|
---|
174 | $zae=$rowg["zaehler"];
|
---|
175 | $blattkey=$rowg["blattart"]; |
---|
176 | $blattart=blattart($blattkey); |
---|
177 |
|
---|
178 | echo "\n<tr>";
|
---|
179 | |
---|
180 | echo "\n\t<td class='gbl'>"; // GB-Bezirk" |
---|
181 | if ($showkey) { |
---|
182 | echo "<span class='key'>".$rowg["bezirk"]."</span> "; |
---|
183 | } |
---|
184 | echo $rowg["beznam"]; |
---|
185 | echo "</td>";
|
---|
186 | |
---|
187 | echo "\n\t<td class='gbl'>"; // Blattart |
---|
188 | if ($showkey) { |
---|
189 | echo "<span class='key'>".$blattkey."</span> "; |
---|
190 | } |
---|
191 | echo $blattart; |
---|
192 | echo "</td>"; |
---|
193 | |
---|
194 | echo "\n\t<td class='gbl'>"; // Blatt |
---|
195 | echo "<span class='wichtig'>".$rowg["nr"]."</span>"; |
---|
196 | if ($idanzeige) {
|
---|
197 | linkgml($gkz, $gmlg, "Grundbuchblatt");
} |
---|
198 | echo "</td>";
|
---|
199 | |
---|
200 | echo "\n\t<td class='gbl'>"; // Namensnummer |
---|
201 | If ($namnum == "") { |
---|
202 | echo " "; |
---|
203 | } else { |
---|
204 | echo $namnum; |
---|
205 | } |
---|
206 | if ($idanzeige) {
|
---|
207 | linkgml($gkz, $gmln, "Namensnummer");
|
---|
208 | } |
---|
209 | echo "</td>";
|
---|
210 | |
---|
211 | echo "\n\t<td class='gbl'>"; // Anteil |
---|
212 | If ($zae == "") { |
---|
213 | echo " "; |
---|
214 | } else { |
---|
215 | echo $zae."/".$rowg["nenner"]." Anteil"; |
---|
216 | } |
---|
217 | echo "</td>"; |
---|
218 |
|
---|
219 | echo "\n\t<td class='gbl'>";
|
---|
220 | echo "\n\t\t<p class='nwlink noprint'>"; |
---|
221 | echo "\n\t\t\t<a href='alkisbestnw.php?gkz=".$gkz."&gmlid=".$gmlg;
|
---|
222 | if ($idanzeige) {echo "&id=j";} |
---|
223 | if ($showkey) {echo "&showkey=j";}
|
---|
224 | echo "' title='Bestandsnachweis'>"; |
---|
225 | echo $blattart; |
---|
226 | echo "\n\t\t\t<img src='ico/GBBlatt_link.ico' width='16' height='16' alt=''></a>"; |
---|
227 | echo "\n\t\t</p>";
echo "\n\t</td>";
|
---|
228 |
|
---|
229 | echo "\n</tr>";
|
---|
230 | // +++ >bestehtAusRechtsverhaeltnissenZu> namensnummer ??
|
---|
231 | // z.B. eine Namennummer "Erbengemeinschaft" zeigt auf Namensnummern mit EigentÃŒmern
|
---|
232 | $i++;
|
---|
233 | }
|
---|
234 | echo "</table>";
|
---|
235 | if ($i == 0) {echo "\n<p class='err'>Kein Grundbuch.</p>\n";}
|
---|
236 | } else {
|
---|
237 | 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";
|
---|
238 | }
|
---|
239 | ?>
|
---|
240 |
|
---|
241 | <form action=''>
|
---|
242 | <div class='buttonbereich noprint'><hr>
|
---|
243 | <input type='button' name='back' value='<<' title='Zurück' onClick='javascript:history.back()'>
|
---|
244 | <input type='button' name='print' value='Druck' title='Seite Drucken' onClick='window.print()'>
|
---|
245 | <input type='button' name='close' value='X' title='Fenster schließen' onClick='window.close()'>
|
---|
246 | </div>
|
---|
247 | </form>
|
---|
248 |
|
---|
249 | <?php footer($gkz, $gmlid, $idumschalter, $idanzeige, $_SERVER['PHP_SELF']."?", $hilfeurl, "", $showkey); ?>
|
---|
250 |
|
---|
251 | </body>
|
---|
252 | </html> |
---|