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 | 02.11.2011 $sqla, $sqlg, Meldungen mit $debug steuern |
---|
15 | |
---|
16 | ToDo:
|
---|
17 | Sortierung der GrundbÃŒcher zum Namen |
---|
18 | Mehrere Adressen zum Namen? Historische ausblenden/markieren?
|
---|
19 | */
|
---|
20 | ini_set('error_reporting', 'E_ALL & ~ E_NOTICE');
|
---|
21 | session_start();
|
---|
22 | $gkz=urldecode($_REQUEST["gkz"]);
|
---|
23 | require_once("alkis_conf_location.php");
|
---|
24 | if ($auth == "mapbender") {require_once($mapbender);}
|
---|
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 | // Balken
|
---|
59 | echo "<p class='nakennz'>ALKIS Name id=".$gmlid." </p>\n";
|
---|
60 |
|
---|
61 | echo "\n<h2><img src='ico/Eigentuemer.ico' width='16' height='16' alt=''> Person</h2>\n";
|
---|
62 | if (!$con) "\n<p class='err'>Fehler beim Verbinden der DB</p>\n";
|
---|
63 |
|
---|
64 | $sql="SELECT nachnameoderfirma, anrede, vorname, geburtsname, geburtsdatum, namensbestandteil, akademischergrad ";
|
---|
65 | $sql.="FROM ax_person WHERE gml_id= $1;";
|
---|
66 |
|
---|
67 | $v = array($gmlid);
|
---|
68 | $res = pg_prepare("", $sql);
|
---|
69 | $res = pg_execute("", $v);
|
---|
70 |
|
---|
71 | if (!$res) {echo "\n<p class='err'>Fehler bei Zugriff auf Namensnummer</p>\n";}
|
---|
72 | if ($idanzeige) { linkgml($gkz, $gmlid, "Person"); }
|
---|
73 | if ($row = pg_fetch_array($res)) {
|
---|
74 | $vor=htmlentities($row["vorname"], ENT_QUOTES, "UTF-8");
|
---|
75 | $nam=htmlentities($row["nachnameoderfirma"], ENT_QUOTES, "UTF-8");
|
---|
76 | $geb=htmlentities($row["geburtsname"], ENT_QUOTES, "UTF-8");
|
---|
77 | $anr=anrede($row["anrede"]);
|
---|
78 | $aka=$row["akademischergrad"];
|
---|
79 |
|
---|
80 | echo "<table>\n";
|
---|
81 | echo "\t<tr><td class='nhd'>Anrede:</td><td class='nam'>".$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'>".$row["namensbestandteil"]." </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.ico' width='16' height='16' alt=''> Adresse</h3>\n";
|
---|
92 | $sqla ="SELECT a.gml_id, a.ort_post, a.postleitzahlpostzustellung AS plz, a.strasse, a.hausnummer, a.bestimmungsland ";
|
---|
93 | $sqla.="FROM ax_anschrift a ";
|
---|
94 | $sqla.="JOIN alkis_beziehungen b ON a.gml_id=b.beziehung_zu ";
|
---|
95 | $sqla.="WHERE b.beziehung_von= $1 ";
|
---|
96 | $sqla.="AND b.beziehungsart='hat';"; //"ORDER BY ?;";
|
---|
97 |
|
---|
98 | $v = array($gmlid);
|
---|
99 | $resa = pg_prepare("", $sqla);
|
---|
100 | $resa = pg_execute("", $v);
|
---|
101 |
|
---|
102 | if (!$resa) { |
---|
103 | echo "\n<p class='err'>Fehler bei Adressen</p>\n"; |
---|
104 | if ($debug > 2) { |
---|
105 | echo "<p class='err'>SQL=<br>".$sqla."<br>$1=gml(Person)= '".$gmlid."'</p>\n"; |
---|
106 | } |
---|
107 | }
|
---|
108 | |
---|
109 | $j=0;
|
---|
110 | while($rowa = pg_fetch_array($resa)) {
|
---|
111 | $gmla=$rowa["gml_id"];
|
---|
112 | $plz=$rowa["plz"];
|
---|
113 | $ort=htmlentities($rowa["ort_post"], ENT_QUOTES, "UTF-8");
|
---|
114 | $str=htmlentities($rowa["strasse"], ENT_QUOTES, "UTF-8");
|
---|
115 | $hsnr=$rowa["hausnummer"];
|
---|
116 | $land=htmlentities($rowa["bestimmungsland"], ENT_QUOTES, "UTF-8");
|
---|
117 | if ($idanzeige) { linkgml($gkz, $gmla, "Adresse"); }
|
---|
118 |
|
---|
119 | echo "<table>\n";
|
---|
120 | echo "\t<tr><td class='nhd'>PLZ:</td><td class='nam'>".$plz."</td></tr>\n";
|
---|
121 | echo "\t<tr><td class='nhd'>Ort:</td><td class='nam'>".$ort."</td></tr>\n";
|
---|
122 | echo "\t<tr><td class='nhd'>Strasse:</td><td class='nam'>".$str."</td></tr>\n";
|
---|
123 | echo "\t<tr><td class='nhd'>Hausnummer:</td><td class='nam'>".$hsnr."</td></tr>\n";
|
---|
124 | echo "\t<tr><td class='nhd'>Land:</td><td class='nam'>".$land."</td></tr>\n";
|
---|
125 | echo "\n</table>\n<br>\n";
|
---|
126 | $j++;
|
---|
127 |
|
---|
128 | // Name und Adresse Kompakt (im Rahmen)
|
---|
129 | // Alles was man fuer ein Anschreiben braucht
|
---|
130 | echo "<img src='ico/Namen.ico' width='16' height='16' alt='Brief' title='Anschrift'>"; // Symbol "Brief"
|
---|
131 | echo "\n<div class='adr' title='Anschrift'>".$anr." ".$aka." ".$vor." ".$nam."<br>";
|
---|
132 | echo "\n".$str." ".$hsnr."<br>";
|
---|
133 | echo "\n".$plz." ".$ort."</div>";
|
---|
134 | }
|
---|
135 | if ($j == 0) {echo "\n<p class='err'>Keine Adressen.</p>\n";}
|
---|
136 |
|
---|
137 | // *** G R U N D B U C H ***
|
---|
138 | echo "\n<hr>\n<h3><img src='ico/Grundbuch_zu.ico' width='16' height='16' alt=''> Grundbücher</h3>\n";
|
---|
139 | // person <benennt< namensnummer >istBestandteilVon> Buchungsblatt
|
---|
140 | // >bestehtAusRechtsverhaeltnissenZu> namensnummer (Nebenzweig/SonderfÀlle?)
|
---|
141 |
|
---|
142 | $sqlg ="SELECT n.gml_id AS gml_n, n.laufendenummernachdin1421 AS lfd, n.zaehler, n.nenner, ";
|
---|
143 | $sqlg.="g.gml_id AS gml_g, g.bezirk, g.buchungsblattnummermitbuchstabenerweiterung as nr, g.blattart, ";
|
---|
144 | $sqlg.="b.bezeichnung AS beznam ";
|
---|
145 | $sqlg.="FROM alkis_beziehungen bpn ";
|
---|
146 | $sqlg.="JOIN ax_namensnummer n ON bpn.beziehung_von=n.gml_id ";
|
---|
147 | $sqlg.="JOIN alkis_beziehungen bng ON n.gml_id=bng.beziehung_von ";
|
---|
148 | $sqlg.="JOIN ax_buchungsblatt g ON bng.beziehung_zu=g.gml_id ";
|
---|
149 | $sqlg.="LEFT JOIN ax_buchungsblattbezirk b ON g.land = b.land AND g.bezirk = b.bezirk ";
|
---|
150 | $sqlg.="WHERE bpn.beziehung_zu= $1 ";
|
---|
151 | $sqlg.="AND bpn.beziehungsart='benennt' AND bng.beziehungsart='istBestandteilVon' ";
|
---|
152 | $sqlg.="ORDER BY g.bezirk, g.buchungsblattnummermitbuchstabenerweiterung;";
|
---|
153 | // buchungsblatt... mal mit und mal ohne fuehrende Nullen, bringt die Sortierung durcheinander
|
---|
154 | |
---|
155 | $v = array($gmlid);
|
---|
156 | $resg = pg_prepare("", $sqlg);
|
---|
157 | $resg = pg_execute("", $v);
|
---|
158 |
|
---|
159 | if (!$resg) { |
---|
160 | echo "\n<p class='err'>Fehler bei Grundbuch</p>\n"; |
---|
161 | if ($debug > 2) {
|
---|
162 | echo "\n<p class='err'>SQL=".$sqlg."</p>\n";
|
---|
163 | } |
---|
164 | }
|
---|
165 | $j=0;
|
---|
166 | echo "<table class='eig'>";
|
---|
167 | echo "\n<tr>";
|
---|
168 | echo "\n\t<td class='head'>Bezirk</td>";
|
---|
169 | echo "\n\t<td class='head'>Blattart</td>";
|
---|
170 | echo "\n\t<td class='head'>Blatt</td>";
|
---|
171 | echo "\n\t<td class='head'>Namensnummer</td>";
|
---|
172 | echo "\n\t<td class='head'>Anteil</td>";
|
---|
173 | echo "\n\t<td class='head nwlink noprint' title='Link: weitere Auskunft'>weit. Auskunft</td>";
|
---|
174 | echo "\n</tr>";
|
---|
175 |
|
---|
176 | while($rowg = pg_fetch_array($resg)) {
|
---|
177 | $gmln=$rowg["gml_n"];
|
---|
178 | $gmlg=$rowg["gml_g"];
|
---|
179 | $namnum=kurz_namnr($rowg["lfd"]);
|
---|
180 | $zae=$rowg["zaehler"];
|
---|
181 | $blattkey=$rowg["blattart"];
|
---|
182 | $blattart=blattart($blattkey);
|
---|
183 |
|
---|
184 | echo "\n<tr>";
|
---|
185 |
|
---|
186 | echo "\n\t<td class='gbl'>"; // GB-Bezirk"
|
---|
187 | if ($showkey) {
|
---|
188 | echo "<span class='key'>".$rowg["bezirk"]."</span> ";
|
---|
189 | }
|
---|
190 | echo $rowg["beznam"];
|
---|
191 | echo "</td>";
|
---|
192 |
|
---|
193 | echo "\n\t<td class='gbl'>"; // Blattart
|
---|
194 | if ($showkey) {
|
---|
195 | echo "<span class='key'>".$blattkey."</span> ";
|
---|
196 | }
|
---|
197 | echo $blattart;
|
---|
198 | echo "</td>";
|
---|
199 |
|
---|
200 | echo "\n\t<td class='gbl'>"; // Blatt
|
---|
201 | echo "<span class='wichtig'>".$rowg["nr"]."</span>";
|
---|
202 | if ($idanzeige) {
|
---|
203 | linkgml($gkz, $gmlg, "Grundbuchblatt");
}
|
---|
204 | echo "</td>";
|
---|
205 |
|
---|
206 | echo "\n\t<td class='gbl'>"; // Namensnummer
|
---|
207 | If ($namnum == "") {
|
---|
208 | echo " ";
|
---|
209 | } else {
|
---|
210 | echo $namnum;
|
---|
211 | }
|
---|
212 | if ($idanzeige) {
|
---|
213 | linkgml($gkz, $gmln, "Namensnummer");
|
---|
214 | }
|
---|
215 | echo "</td>";
|
---|
216 |
|
---|
217 | echo "\n\t<td class='gbl'>"; // Anteil
|
---|
218 | If ($zae == "") {
|
---|
219 | echo " ";
|
---|
220 | } else {
|
---|
221 | echo $zae."/".$rowg["nenner"]." Anteil";
|
---|
222 | }
|
---|
223 | echo "</td>";
|
---|
224 |
|
---|
225 | echo "\n\t<td class='gbl'>";
|
---|
226 | echo "\n\t\t<p class='nwlink noprint'>";
|
---|
227 | echo "\n\t\t\t<a href='alkisbestnw.php?gkz=".$gkz."&gmlid=".$gmlg;
|
---|
228 | if ($idanzeige) {echo "&id=j";}
|
---|
229 | if ($showkey) {echo "&showkey=j";}
|
---|
230 | echo "' title='Bestandsnachweis'>";
|
---|
231 | echo $blattart;
|
---|
232 | echo "\n\t\t\t<img src='ico/GBBlatt_link.ico' width='16' height='16' alt=''></a>";
|
---|
233 | echo "\n\t\t</p>";
echo "\n\t</td>";
|
---|
234 |
|
---|
235 | echo "\n</tr>";
|
---|
236 | // +++ >bestehtAusRechtsverhaeltnissenZu> namensnummer ??
|
---|
237 | // z.B. eine Namennummer "Erbengemeinschaft" zeigt auf Namensnummern mit EigentÃŒmern
|
---|
238 | $i++;
|
---|
239 | }
|
---|
240 | echo "</table>";
|
---|
241 | if ($i == 0) {echo "\n<p class='err'>Kein Grundbuch.</p>\n";}
|
---|
242 | } else {
|
---|
243 | 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";
|
---|
244 | }
|
---|
245 | ?>
|
---|
246 |
|
---|
247 | <form action=''>
|
---|
248 | <div class='buttonbereich noprint'><hr>
|
---|
249 | <input type='button' name='back' value='<<' title='Zurück' onClick='javascript:history.back()'>
|
---|
250 | <input type='button' name='print' value='Druck' title='Seite Drucken' onClick='window.print()'>
|
---|
251 | <input type='button' name='close' value='X' title='Fenster schließen' onClick='window.close()'>
|
---|
252 | </div>
|
---|
253 | </form>
|
---|
254 |
|
---|
255 | <?php footer($gkz, $gmlid, $idumschalter, $idanzeige, $_SERVER['PHP_SELF']."?", $hilfeurl, "", $showkey); ?>
|
---|
256 |
|
---|
257 | </body>
|
---|
258 | </html> |
---|