Forráskód Böngészése

Działające JPK_VAT

Mariusz Muszyński 9 éve
szülő
commit
f9e429ec78
2 módosított fájl, 600 hozzáadás és 198 törlés
  1. 518 0
      SE/schema/jpk/Schemat_JPK_VAT(2)_v1-0.xsd
  2. 82 198
      SE/se-lib/Route/UrlAction/JPK.php

+ 518 - 0
SE/schema/jpk/Schemat_JPK_VAT(2)_v1-0.xsd

@@ -0,0 +1,518 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- edited with XMLSpy v2015 sp2 (http://www.altova.com) by Jarosław Oleśniewicz (Ministerstwo Finansów) -->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:etd="http://crd.gov.pl/xml/schematy/dziedzinowe/mf/2016/01/25/eD/DefinicjeTypy/" xmlns:kck="http://crd.gov.pl/xml/schematy/dziedzinowe/mf/2013/05/23/eD/KodyCECHKRAJOW/" xmlns:tns="http://jpk.mf.gov.pl/wzor/2016/10/26/10261/" targetNamespace="http://jpk.mf.gov.pl/wzor/2016/10/26/10261/" elementFormDefault="qualified" attributeFormDefault="unqualified" xml:lang="pl">
+	<xsd:import namespace="http://crd.gov.pl/xml/schematy/dziedzinowe/mf/2016/01/25/eD/DefinicjeTypy/" schemaLocation="http://crd.gov.pl/xml/schematy/dziedzinowe/mf/2016/01/25/eD/DefinicjeTypy/StrukturyDanych_v4-0E.xsd"/>
+	<xsd:import namespace="http://crd.gov.pl/xml/schematy/dziedzinowe/mf/2013/05/23/eD/KodyCECHKRAJOW/" schemaLocation="http://crd.gov.pl/xml/schematy/dziedzinowe/mf/2013/05/23/eD/KodyCECHKRAJOW/KodyCechKrajow_v3-0E.xsd"/>
+	<xsd:simpleType name="TKodFormularza">
+		<xsd:annotation>
+			<xsd:documentation>Symbol wzoru formularza</xsd:documentation>
+		</xsd:annotation>
+		<xsd:restriction base="xsd:string">
+			<xsd:enumeration value="JPK_VAT"/>
+		</xsd:restriction>
+	</xsd:simpleType>
+	<xsd:complexType name="TNaglowek">
+		<xsd:annotation>
+			<xsd:documentation>Nagłówek JPK_VAT</xsd:documentation>
+		</xsd:annotation>
+		<xsd:sequence>
+			<xsd:element name="KodFormularza">
+				<xsd:complexType>
+					<xsd:simpleContent>
+						<xsd:extension base="tns:TKodFormularza">
+							<xsd:attribute name="kodSystemowy" type="xsd:string" use="required" fixed="JPK_VAT (2)"/>
+							<xsd:attribute name="wersjaSchemy" type="xsd:string" use="required" fixed="1-0"/>
+						</xsd:extension>
+					</xsd:simpleContent>
+				</xsd:complexType>
+			</xsd:element>
+			<xsd:element name="WariantFormularza">
+				<xsd:simpleType>
+					<xsd:restriction base="xsd:byte">
+						<xsd:enumeration value="2"/>
+					</xsd:restriction>
+				</xsd:simpleType>
+			</xsd:element>
+			<xsd:element name="CelZlozenia" type="etd:TCelZlozenia"/>
+			<xsd:element name="DataWytworzeniaJPK" type="etd:TDataCzas">
+				<xsd:annotation>
+					<xsd:documentation>Data i czas wytworzenia JPK_VAT</xsd:documentation>
+				</xsd:annotation>
+			</xsd:element>
+			<xsd:element name="DataOd" type="etd:TData">
+				<xsd:annotation>
+					<xsd:documentation>Data początkowa okresu, którego dotyczy JPK_VAT</xsd:documentation>
+				</xsd:annotation>
+			</xsd:element>
+			<xsd:element name="DataDo" type="etd:TData">
+				<xsd:annotation>
+					<xsd:documentation>Data końcowa okresu, którego dotyczy JPK_VAT</xsd:documentation>
+				</xsd:annotation>
+			</xsd:element>
+			<xsd:element name="DomyslnyKodWaluty" type="kck:currCode_Type">
+				<xsd:annotation>
+					<xsd:documentation>Trzyliterowy kod lokalnej waluty (ISO-4217), domyślny dla wytworzonego JPK_VAT</xsd:documentation>
+				</xsd:annotation>
+			</xsd:element>
+			<xsd:element name="KodUrzedu" type="etd:TKodUS"/>
+		</xsd:sequence>
+	</xsd:complexType>
+	<xsd:simpleType name="TKwotowy">
+		<xsd:annotation>
+			<xsd:documentation>Wartość numeryczna 18 znaków max, w tym 2 znaki po przecinku</xsd:documentation>
+		</xsd:annotation>
+		<xsd:restriction base="xsd:decimal">
+			<xsd:totalDigits value="18"/>
+			<xsd:fractionDigits value="2"/>
+		</xsd:restriction>
+	</xsd:simpleType>
+	<xsd:simpleType name="TNaturalnyJPK">
+		<xsd:annotation>
+			<xsd:documentation>Liczby naturalne większe od zera</xsd:documentation>
+		</xsd:annotation>
+		<xsd:restriction base="etd:TNaturalny">
+			<xsd:minExclusive value="0"/>
+		</xsd:restriction>
+	</xsd:simpleType>
+	<xsd:simpleType name="TZnakowyJPK">
+		<xsd:annotation>
+			<xsd:documentation>Typ znakowy ograniczony do 256 znaków</xsd:documentation>
+		</xsd:annotation>
+		<xsd:restriction base="xsd:token">
+			<xsd:minLength value="1"/>
+			<xsd:maxLength value="256"/>
+		</xsd:restriction>
+	</xsd:simpleType>
+	<xsd:complexType name="TAdresJPK">
+		<xsd:annotation>
+			<xsd:documentation>Informacje opisujące adres</xsd:documentation>
+		</xsd:annotation>
+		<xsd:sequence>
+			<xsd:element name="KodKraju" type="etd:TKodKraju">
+				<xsd:annotation>
+					<xsd:documentation>Kraj</xsd:documentation>
+				</xsd:annotation>
+			</xsd:element>
+			<xsd:element name="Wojewodztwo" type="etd:TJednAdmin" minOccurs="0">
+				<xsd:annotation>
+					<xsd:documentation>Województwo</xsd:documentation>
+				</xsd:annotation>
+			</xsd:element>
+			<xsd:element name="Powiat" type="etd:TJednAdmin" minOccurs="0">
+				<xsd:annotation>
+					<xsd:documentation>Powiat</xsd:documentation>
+				</xsd:annotation>
+			</xsd:element>
+			<xsd:element name="Gmina" type="etd:TJednAdmin" minOccurs="0">
+				<xsd:annotation>
+					<xsd:documentation>Gmina</xsd:documentation>
+				</xsd:annotation>
+			</xsd:element>
+			<xsd:element name="Ulica" type="etd:TUlica" minOccurs="0">
+				<xsd:annotation>
+					<xsd:documentation>Nazwa ulicy</xsd:documentation>
+				</xsd:annotation>
+			</xsd:element>
+			<xsd:element name="NrDomu" type="etd:TNrBudynku" minOccurs="0">
+				<xsd:annotation>
+					<xsd:documentation>Numer budynku</xsd:documentation>
+				</xsd:annotation>
+			</xsd:element>
+			<xsd:element name="NrLokalu" type="etd:TNrLokalu" minOccurs="0">
+				<xsd:annotation>
+					<xsd:documentation>Numer lokalu</xsd:documentation>
+				</xsd:annotation>
+			</xsd:element>
+			<xsd:element name="Miejscowosc" type="etd:TMiejscowosc">
+				<xsd:annotation>
+					<xsd:documentation>Nazwa miejscowości</xsd:documentation>
+				</xsd:annotation>
+			</xsd:element>
+			<xsd:element name="KodPocztowy" type="etd:TKodPocztowy" minOccurs="0">
+				<xsd:annotation>
+					<xsd:documentation>Kod pocztowy</xsd:documentation>
+				</xsd:annotation>
+			</xsd:element>
+			<xsd:element name="Poczta" type="etd:TMiejscowosc" minOccurs="0">
+				<xsd:annotation>
+					<xsd:documentation>Nazwa urzędu pocztowego</xsd:documentation>
+				</xsd:annotation>
+			</xsd:element>
+		</xsd:sequence>
+	</xsd:complexType>
+	<xsd:element name="JPK">
+		<xsd:annotation>
+			<xsd:documentation>Jednolity plik kontrolny dla ewidencji zakupu i sprzedaży VAT</xsd:documentation>
+		</xsd:annotation>
+		<xsd:complexType>
+			<xsd:sequence>
+				<xsd:element name="Naglowek" type="tns:TNaglowek">
+					<xsd:annotation>
+						<xsd:documentation>Nagłówek JPK_VAT</xsd:documentation>
+					</xsd:annotation>
+				</xsd:element>
+				<xsd:element name="Podmiot1">
+					<xsd:complexType>
+						<xsd:sequence>
+							<xsd:element name="IdentyfikatorPodmiotu" type="etd:TIdentyfikatorOsobyNiefizycznej">
+								<xsd:annotation>
+									<xsd:documentation>Dane identyfikujące podmiot</xsd:documentation>
+								</xsd:annotation>
+							</xsd:element>
+							<xsd:element name="AdresPodmiotu" type="tns:TAdresJPK">
+								<xsd:annotation>
+									<xsd:documentation>Adres podmiotu</xsd:documentation>
+								</xsd:annotation>
+							</xsd:element>
+						</xsd:sequence>
+					</xsd:complexType>
+				</xsd:element>
+				<xsd:sequence minOccurs="0">
+					<xsd:element name="SprzedazWiersz" maxOccurs="unbounded">
+						<xsd:annotation>
+							<xsd:documentation>Ewidencja sprzedaży oraz nabyć towarów i usług dla których podmiot obowiązany jest naliczyć podatek należny - tj. wewnątrzwspólnotowe nabycia towarów, import towarów podlegających rozliczeniu zgodnie z art. 33 a ustawy, import usług z wyłączeniem usług nabywanych od podatników podatku od wartości dodanej, do których stosuje się art. 28 b ustawy, import usług nabywanych od podatników podatku od wartości dodanej, do których stosuje się art. 28 b ustawy, dostawa towarów, dla których podatnikiem jest nabywca zgodnie z art. 17 ust. 1 pkt 5 ustawy (wypełnia nabywca), dostawa towarów, dla których podatnikiem jest nabywca zgodnie z art. 17 ust. 1 pkt 7 lub 8 ustawy (wypełnia nabywca)</xsd:documentation>
+						</xsd:annotation>
+						<xsd:complexType>
+							<xsd:sequence>
+								<xsd:element name="LpSprzedazy" type="tns:TNaturalnyJPK">
+									<xsd:annotation>
+										<xsd:documentation>Lp. wiersza ewidencji sprzedaży VAT</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="NrKontrahenta" type="etd:TNrIdentyfikacjiPodatkowej">
+									<xsd:annotation>
+										<xsd:documentation>Numer, za pomocą którego kontrahent jest zidentyfikowany na potrzeby podatku lub podatku od wartości dodanej</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="NazwaKontrahenta" type="tns:TZnakowyJPK">
+									<xsd:annotation>
+										<xsd:documentation>Imię i nazwisko lub nazwa kontrahenta</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="AdresKontrahenta" type="tns:TZnakowyJPK">
+									<xsd:annotation>
+										<xsd:documentation>Adres kontrahenta</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="DowodSprzedazy" type="tns:TZnakowyJPK">
+									<xsd:annotation>
+										<xsd:documentation>Numer dowodu sprzedaży</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="DataWystawienia" type="etd:TData">
+									<xsd:annotation>
+										<xsd:documentation>Data wystawienia dowodu sprzedaży</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="DataSprzedazy" type="etd:TData" minOccurs="0">
+									<xsd:annotation>
+										<xsd:documentation>Data sprzedaży, o ile jest określona i różni się od daty wystawienia dowodu sprzedaży. W przeciwnym przypadku - pole puste</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="K_10" type="tns:TKwotowy" minOccurs="0">
+									<xsd:annotation>
+										<xsd:documentation>Kwota netto - Dostawa towarów oraz świadczenie usług na terytorium kraju, zwolnione od podatku</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="K_11" type="tns:TKwotowy" minOccurs="0">
+									<xsd:annotation>
+										<xsd:documentation>Kwota netto - Dostawa towarów oraz świadczenie usług poza terytorium kraju</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="K_12" type="tns:TKwotowy" minOccurs="0">
+									<xsd:annotation>
+										<xsd:documentation>Kwota netto - w tym świadczenie usług, o których mowa w art. 100 ust. 1 pkt 4 ustawy</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="K_13" type="tns:TKwotowy" minOccurs="0">
+									<xsd:annotation>
+										<xsd:documentation>Kwota netto - Dostawa towarów oraz świadczenie usług na terytorium kraju, opodatkowane stawką 0%</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="K_14" type="tns:TKwotowy" minOccurs="0">
+									<xsd:annotation>
+										<xsd:documentation>Kwota netto - w tym dostawa towarów, o której mowa w art. 129 ustawy</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:sequence minOccurs="0">
+									<xsd:element name="K_15" type="tns:TKwotowy">
+										<xsd:annotation>
+											<xsd:documentation>Kwota netto - Dostawa towarów oraz świadczenie usług na terytorium kraju, opodatkowane stawką 5%</xsd:documentation>
+										</xsd:annotation>
+									</xsd:element>
+									<xsd:element name="K_16" type="tns:TKwotowy">
+										<xsd:annotation>
+											<xsd:documentation>Kwota podatku należnego - Dostawa towarów oraz świadczenie usług na terytorium kraju, opodatkowane stawką 5%</xsd:documentation>
+										</xsd:annotation>
+									</xsd:element>
+								</xsd:sequence>
+								<xsd:sequence minOccurs="0">
+									<xsd:element name="K_17" type="tns:TKwotowy">
+										<xsd:annotation>
+											<xsd:documentation>Kwota netto - Dostawa towarów oraz świadczenie usług na terytorium kraju, opodatkowane stawką 7% albo 8%</xsd:documentation>
+										</xsd:annotation>
+									</xsd:element>
+									<xsd:element name="K_18" type="tns:TKwotowy">
+										<xsd:annotation>
+											<xsd:documentation>Kwota podatku należnego - Dostawa towarów oraz świadczenie usług na terytorium kraju, opodatkowane stawką 7% albo 8%</xsd:documentation>
+										</xsd:annotation>
+									</xsd:element>
+								</xsd:sequence>
+								<xsd:sequence minOccurs="0">
+									<xsd:element name="K_19" type="tns:TKwotowy">
+										<xsd:annotation>
+											<xsd:documentation>Kwota netto - Dostawa towarów oraz świadczenie usług na terytorium kraju, opodatkowane stawką 22% albo 23%</xsd:documentation>
+										</xsd:annotation>
+									</xsd:element>
+									<xsd:element name="K_20" type="tns:TKwotowy">
+										<xsd:annotation>
+											<xsd:documentation>Kwota podatku należnego - Dostawa towarów oraz świadczenie usług na terytorium kraju, opodatkowane stawką 22% albo 23%</xsd:documentation>
+										</xsd:annotation>
+									</xsd:element>
+								</xsd:sequence>
+								<xsd:element name="K_21" type="tns:TKwotowy" minOccurs="0">
+									<xsd:annotation>
+										<xsd:documentation>Kwota netto - Wewnątrzwspólnotowa dostawa towarów</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="K_22" type="tns:TKwotowy" minOccurs="0">
+									<xsd:annotation>
+										<xsd:documentation>Kwota netto - Eksport towarów</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:sequence minOccurs="0">
+									<xsd:element name="K_23" type="tns:TKwotowy">
+										<xsd:annotation>
+											<xsd:documentation>Kwota netto - Wewnątrzwspólnotowe nabycie towarów</xsd:documentation>
+										</xsd:annotation>
+									</xsd:element>
+									<xsd:element name="K_24" type="tns:TKwotowy">
+										<xsd:annotation>
+											<xsd:documentation>Kwota podatku należnego - Wewnątrzwspólnotowe nabycie towarów</xsd:documentation>
+										</xsd:annotation>
+									</xsd:element>
+								</xsd:sequence>
+								<xsd:sequence minOccurs="0">
+									<xsd:element name="K_25" type="tns:TKwotowy">
+										<xsd:annotation>
+											<xsd:documentation>Kwota netto - Import towarów podlegający rozliczeniu zgodnie z art. 33a ustawy</xsd:documentation>
+										</xsd:annotation>
+									</xsd:element>
+									<xsd:element name="K_26" type="tns:TKwotowy">
+										<xsd:annotation>
+											<xsd:documentation>Kwota podatku należnego - Import towarów podlegający rozliczeniu zgodnie z art. 33a ustawy</xsd:documentation>
+										</xsd:annotation>
+									</xsd:element>
+								</xsd:sequence>
+								<xsd:sequence minOccurs="0">
+									<xsd:element name="K_27" type="tns:TKwotowy">
+										<xsd:annotation>
+											<xsd:documentation>Kwota netto - Import usług z wyłączeniem usług nabywanych od podatników podatku od wartości dodanej, do których stosuje się art. 28b ustawy</xsd:documentation>
+										</xsd:annotation>
+									</xsd:element>
+									<xsd:element name="K_28" type="tns:TKwotowy">
+										<xsd:annotation>
+											<xsd:documentation>Kwota podatku należnego - Import usług z wyłączeniem usług nabywanych od podatników podatku od wartości dodanej, do których stosuje się art. 28b ustawy</xsd:documentation>
+										</xsd:annotation>
+									</xsd:element>
+								</xsd:sequence>
+								<xsd:sequence minOccurs="0">
+									<xsd:element name="K_29" type="tns:TKwotowy">
+										<xsd:annotation>
+											<xsd:documentation>Kwota netto - Import usług nabywanych od podatników podatku od wartości dodanej, do których stosuje się art. 28b ustawy</xsd:documentation>
+										</xsd:annotation>
+									</xsd:element>
+									<xsd:element name="K_30" type="tns:TKwotowy">
+										<xsd:annotation>
+											<xsd:documentation>Kwota podatku należnego - Import usług nabywanych od podatników podatku od wartości dodanej, do których stosuje się art. 28b ustawy</xsd:documentation>
+										</xsd:annotation>
+									</xsd:element>
+								</xsd:sequence>
+								<xsd:element name="K_31" type="tns:TKwotowy" minOccurs="0">
+									<xsd:annotation>
+										<xsd:documentation>Kwota netto - Dostawa towarów oraz świadczenie usług, dla których podatnikiem jest nabywca zgodnie z art. 17 ust. 1 pkt 7 lub 8 ustawy (wypełnia dostawca)</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:sequence minOccurs="0">
+									<xsd:element name="K_32" type="tns:TKwotowy">
+										<xsd:annotation>
+											<xsd:documentation>Kwota netto - Dostawa towarów, dla których podatnikiem jest nabywca zgodnie z art. 17 ust. 1 pkt 5 ustawy (wypełnia nabywca)</xsd:documentation>
+										</xsd:annotation>
+									</xsd:element>
+									<xsd:element name="K_33" type="tns:TKwotowy">
+										<xsd:annotation>
+											<xsd:documentation>Kwota podatku należnego - Dostawa towarów, dla których podatnikiem jest nabywca zgodnie z art. 17 ust. 1 pkt 5 ustawy (wypełnia nabywca)</xsd:documentation>
+										</xsd:annotation>
+									</xsd:element>
+								</xsd:sequence>
+								<xsd:sequence minOccurs="0">
+									<xsd:element name="K_34" type="tns:TKwotowy">
+										<xsd:annotation>
+											<xsd:documentation>Kwota netto - Dostawa towarów oraz świadczenie usług, dla których podatnikiem jest nabywca zgodnie z art. 17 ust. 1 pkt 7 lub 8 ustawy (wypełnia nabywca)</xsd:documentation>
+										</xsd:annotation>
+									</xsd:element>
+									<xsd:element name="K_35" type="tns:TKwotowy">
+										<xsd:annotation>
+											<xsd:documentation>Kwota podatku należnego - Dostawa towarów oraz świadczenie usług, dla których podatnikiem jest nabywca zgodnie z art. 17 ust. 1 pkt 7 lub 8 ustawy (wypełnia nabywca)</xsd:documentation>
+										</xsd:annotation>
+									</xsd:element>
+								</xsd:sequence>
+								<xsd:element name="K_36" type="tns:TKwotowy" minOccurs="0">
+									<xsd:annotation>
+										<xsd:documentation>Kwota podatku należnego od towarów i usług objętych spisem z natury, o którym mowa w art. 14 ust. 5 ustawy</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="K_37" type="tns:TKwotowy" minOccurs="0">
+									<xsd:annotation>
+										<xsd:documentation>Zwrot odliczonej lub zwróconej kwoty wydatkowanej na zakup kas rejestrujących, o którym mowa w art. 111 ust. 6 ustawy</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="K_38" type="tns:TKwotowy" minOccurs="0">
+									<xsd:annotation>
+										<xsd:documentation>Kwota podatku należnego od wewnątrzwspólnotowego nabycia środków transportu, wykazanego w elemencie K_24, podlegająca wpłacie w terminie, o którym mowa w art. 103 ust. 3, w związku z ust. 4 ustawy</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="K_39" type="tns:TKwotowy" minOccurs="0">
+									<xsd:annotation>
+										<xsd:documentation>Kwota podatku od wewnątrzwspólnotowego nabycia paliw silnikowych, podlegająca wpłacie w terminach,
+o których mowa w art. 103 ust. 5a i 5b ustawy</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+							</xsd:sequence>
+							<xsd:attribute name="typ" use="required" fixed="G"/>
+						</xsd:complexType>
+					</xsd:element>
+					<xsd:element name="SprzedazCtrl">
+						<xsd:annotation>
+							<xsd:documentation>Sumy kontrolne dla ewidencji sprzedaży VAT</xsd:documentation>
+						</xsd:annotation>
+						<xsd:complexType>
+							<xsd:sequence>
+								<xsd:element name="LiczbaWierszySprzedazy" type="tns:TNaturalnyJPK">
+									<xsd:annotation>
+										<xsd:documentation>Liczba wierszy ewidencji sprzedaży, w okresie którego dotyczy JPK</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="PodatekNalezny" type="tns:TKwotowy">
+									<xsd:annotation>
+										<xsd:documentation>Podatek należny wg ewidencji sprzedaży w okresie, którego dotyczy JPK - suma kwot z elementów K_16, K_18, K_20, K_24, K_26, K_28, K_30, K_33, K_35, K_36 i K_37 pomniejszona o kwotę z elementów K_38 i K_39</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+							</xsd:sequence>
+						</xsd:complexType>
+					</xsd:element>
+				</xsd:sequence>
+				<xsd:sequence minOccurs="0">
+					<xsd:element name="ZakupWiersz" maxOccurs="unbounded">
+						<xsd:annotation>
+							<xsd:documentation>Ewidencja zakupu VAT</xsd:documentation>
+						</xsd:annotation>
+						<xsd:complexType>
+							<xsd:sequence>
+								<xsd:element name="LpZakupu" type="tns:TNaturalnyJPK">
+									<xsd:annotation>
+										<xsd:documentation>Lp. wiersza ewidencji zakupu VAT</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="NrDostawcy" type="etd:TNrIdentyfikacjiPodatkowej">
+									<xsd:annotation>
+										<xsd:documentation>Numer, za pomocą którego dostawca (kontrahent) jest zidentyfikowany na potrzeby podatku lub podatku od wartości dodanej</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="NazwaDostawcy" type="tns:TZnakowyJPK">
+									<xsd:annotation>
+										<xsd:documentation>Imię i nazwisko lub nazwa dostawcy (kontrahenta)</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="AdresDostawcy" type="tns:TZnakowyJPK">
+									<xsd:annotation>
+										<xsd:documentation>Adres dostawcy (kontrahenta)</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="DowodZakupu" type="tns:TZnakowyJPK">
+									<xsd:annotation>
+										<xsd:documentation>Numer dowodu zakupu</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="DataZakupu" type="etd:TData">
+									<xsd:annotation>
+										<xsd:documentation>Data wystawienia dowodu zakupu</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="DataWplywu" type="etd:TData" minOccurs="0">
+									<xsd:annotation>
+										<xsd:documentation>Data wpływu dowodu zakupu</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:sequence minOccurs="0">
+									<xsd:element name="K_43" type="tns:TKwotowy">
+										<xsd:annotation>
+											<xsd:documentation>Kwota netto - Nabycie towarów i usług zaliczanych u podatnika do środków trwałych</xsd:documentation>
+										</xsd:annotation>
+									</xsd:element>
+									<xsd:element name="K_44" type="tns:TKwotowy">
+										<xsd:annotation>
+											<xsd:documentation>Kwota podatku naliczonego - Nabycie towarów i usług zaliczanych u podatnika do środków trwałych</xsd:documentation>
+										</xsd:annotation>
+									</xsd:element>
+								</xsd:sequence>
+								<xsd:sequence minOccurs="0">
+									<xsd:element name="K_45" type="tns:TKwotowy">
+										<xsd:annotation>
+											<xsd:documentation>Kwota netto - Nabycie towarów i usług pozostałych</xsd:documentation>
+										</xsd:annotation>
+									</xsd:element>
+									<xsd:element name="K_46" type="tns:TKwotowy">
+										<xsd:annotation>
+											<xsd:documentation>Kwota podatku naliczonego - Nabycie towarów i usług pozostałych</xsd:documentation>
+										</xsd:annotation>
+									</xsd:element>
+								</xsd:sequence>
+								<xsd:element name="K_47" type="tns:TKwotowy" minOccurs="0">
+									<xsd:annotation>
+										<xsd:documentation>Korekta podatku naliczonego od nabycia środków trwałych</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="K_48" type="tns:TKwotowy" minOccurs="0">
+									<xsd:annotation>
+										<xsd:documentation>Korekta podatku naliczonego od pozostałych nabyć</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="K_49" type="tns:TKwotowy" minOccurs="0">
+									<xsd:annotation>
+										<xsd:documentation>Korekta podatku naliczonego, o której mowa w art. 89b ust. 1 ustawy</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="K_50" type="tns:TKwotowy" minOccurs="0">
+									<xsd:annotation>
+										<xsd:documentation>Korekta podatku naliczonego, o której mowa w art. 89b ust. 4 ustawy</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+							</xsd:sequence>
+							<xsd:attribute name="typ" use="required" fixed="G"/>
+						</xsd:complexType>
+					</xsd:element>
+					<xsd:element name="ZakupCtrl">
+						<xsd:annotation>
+							<xsd:documentation>Sumy kontrolne dla ewidencji zakupu VAT</xsd:documentation>
+						</xsd:annotation>
+						<xsd:complexType>
+							<xsd:sequence>
+								<xsd:element name="LiczbaWierszyZakupow" type="tns:TNaturalnyJPK">
+									<xsd:annotation>
+										<xsd:documentation>Liczba wierszy ewidencji zakupu, w okresie którego dotyczy JPK</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+								<xsd:element name="PodatekNaliczony" type="tns:TKwotowy">
+									<xsd:annotation>
+										<xsd:documentation>Razem kwota podatku naliczonego do odliczenia - suma kwot z elementów K_44, K_46, K_47, K_48, K_49 i K_50</xsd:documentation>
+									</xsd:annotation>
+								</xsd:element>
+							</xsd:sequence>
+						</xsd:complexType>
+					</xsd:element>
+				</xsd:sequence>
+			</xsd:sequence>
+		</xsd:complexType>
+	</xsd:element>
+</xsd:schema>

+ 82 - 198
SE/se-lib/Route/UrlAction/JPK.php

@@ -28,7 +28,7 @@ class Route_UrlAction_JPK extends RouteBase {
 			SE_Layout::alert('danger',$e->getMessage());
 ?>
 <div class="container" style="text-align:center">
-  <a href="<?php echo $this->REFERER?>" class="btn btn-primary">Powrót</a>
+  <a href="<?=$this->REFERER?>" class="btn btn-primary">Powrót</a>
 </div>
 <?php
 			SE_Layout::dol();
@@ -71,9 +71,9 @@ class Route_UrlAction_JPK extends RouteBase {
 ?>
 <div class="container" style="text-align:center">
   <form method="post">
-    <input type="hidden" name="REFERER" value="<?php echo $this->REFERER?>"/>
+    <input type="hidden" name="REFERER" value="<?=$this->REFERER?>"/>
     <button type="submit" class="btn btn-primary">Edytuj</button>
-    <a href="<?php echo $this->REFERER?>" class="btn btn-default">Powrót</a>
+    <a href="<?=$this->REFERER?>" class="btn btn-default">Powrót</a>
   </form>
 </div>
 <?php
@@ -82,7 +82,7 @@ class Route_UrlAction_JPK extends RouteBase {
 					SE_Layout::alert('warning','Wystąpił nieznany błąd podczas inicjalizowania deklaracji JPK.');
 ?>
 <div class="container" style="text-align:center">
-  <a href="<?php echo $this->REFERER?>" class="btn btn-primary">Powrót</a>
+  <a href="<?=$this->REFERER?>" class="btn btn-primary">Powrót</a>
 </div>
 <?php
 				}
@@ -93,11 +93,11 @@ class Route_UrlAction_JPK extends RouteBase {
     <legend>Inicjalizacja deklaracji JPK</legend>
     <div class="form-group">
       <label class="col-sm-3 control-label">Operator</label>
-      <div class="col-sm-9" style="margin-top:7px;"><?php echo $this->BO['name1']?></div>
+      <div class="col-sm-9" style="margin-top:7px;"><?=$this->BO['name1']?></div>
     </div>
     <div class="form-group">
       <label class="col-sm-3 control-label">Typ JPK</label>
-      <div class="col-sm-9" style="margin-top:7px;"><?php echo $this->JPK['TYPE']?></div>
+      <div class="col-sm-9" style="margin-top:7px;"><?=$this->JPK['TYPE']?></div>
     </div>
     <div class="form-group">
       <label class="col-sm-3 control-label">Miesiąc, którego dotyczy deklaracja</label>
@@ -123,10 +123,10 @@ class Route_UrlAction_JPK extends RouteBase {
     <div class="form-group">
       <div class="col-sm-offset-3 col-sm-9">
         <button type="submit" class="btn btn-primary" name="action" value="initialize">Zapisz</button>
-        <a href="<?php echo $this->REFERER?>" class="btn btn-default">Anuluj</a>
+        <a href="<?=$this->REFERER?>" class="btn btn-default">Anuluj</a>
       </div>
     </div>
-  <input type="hidden" name="REFERER" value="<?php echo $this->REFERER?>"/>
+  <input type="hidden" name="REFERER" value="<?=$this->REFERER?>"/>
   </form>
 </div>
 <script>
@@ -144,7 +144,7 @@ format: 'YYYY-MM'
 			SE_Layout::alert('danger', "Wystąpił problem z inicjalizacją deklaracji JPK - " . $e->getMessage());
 ?>
 <div class="container" style="text-align:center">
-  <a href="<?php echo $this->REFERER?>" class="btn btn-primary">Powrót</a>
+  <a href="<?=$this->REFERER?>" class="btn btn-primary">Powrót</a>
 </div>
 <?php
 		}
@@ -253,11 +253,41 @@ format: 'YYYY-MM'
 	}
 
 	private function show() {
-		SE_Layout::gora();
-		SE_Layout::menu();
+		if (V::get('action','',$_POST) == "getJPK") {
+			try {
+				if (!$this->JPK['OUT_MERGED']) throw new Exception("Błąd danych - nie wygenerowano wynikowego pliku JPK");
+				$xml = simplexml_load_string($this->JPK['OUT_MERGED']);
+				$ns = $xml->getNamespaces(true);
+				$this->validateJPK_VAT($xml);
+				$fileName = preg_replace("/[: \.]/", "_", "JPK_VAT_{$this->JPK['MONTH']}_" 
+					. str_replace('"', '', $xml->Podmiot1->IdentyfikatorPodmiotu->children($ns['etd'])->PelnaNazwa)
+					. "_" . str_replace("T", "_", $xml->Naglowek->DataWytworzeniaJPK)) . ".xml";
+				$output = $xml->asXml();
+				header("Content-Type: text/xml");
+				header("Content-Disposition: attachment; filename={$fileName};");
+				header("Content-Transfer-Encoding: binary");
+				header("Content-Length: " . strlen($output));
+				echo $output;
+			} catch (Exception $e) {
+				SE_Layout::gora();
+				SE_Layout::menu();
+				SE_Layout::alert('danger', $e->getMessage());
+?>
+<div class="container" style="text-align:center">
+  <form method="post" action="<?=$this->LAST_REFERER?>">
+    <input type="hidden" name="REFERER" value="<?=$this->REFERER?>"/>
+    <button type="submit" class="btn btn-primary">Powrót</button>
+  </form>
+</div>
+<?php
+				SE_Layout::dol();
+			}
+		} else {
+			SE_Layout::gora();
+			SE_Layout::menu();
 ?>
 <div class="container" style="margin-top:20px">
-  <form class="form-horizontal" method="post" enctype="multipart/form-data">
+  <form class="form-horizontal" method="post" target="_blank">
     <legend>
       Podgląd deklaracji JPK :: <?=$this->JPK['TYPE']?> - <?=$this->JPK['MONTH']." (".($this->JPK['PURPOSE'] == 1 ? "pierwsze złożenie" : "korekta").")"?>
       <span class="pull-right">
@@ -267,21 +297,21 @@ format: 'YYYY-MM'
     <div class="form-group">
     <div class="form-group">
       <div class="col-sm-10">
-	<a href="<?=$_SERVER['HTTP_REFERER']?>&dupa=test" target="_blank" class="btn-sm btn-primary">Pobierz plik JPK</a>
+	<button type="submit" class="btn-sm btn-primary" name="action" value="getJPK">Pobierz plik JPK</button>
       </div>
     </div>
 <?=$this->showTable();?>
     <div class="form-group" style="text-align:center">
       <div class="col-sm-12">
         <input type="hidden" name="REFERER" value="<?=$this->REFERER?>"/>
-        <input type="hidden" name="_task" value="edit">
-        <a href="<?=$this->REFERER?>" class="btn btn-primary">Powrót</a>
+        <a href="<?=$this->REFERER?>" class="btn btn-default">Powrót</a>
       </div>
     </div>
   </form>
 </div>
 <?php
-		SE_Layout::dol();
+			SE_Layout::dol();
+		}
 	}
 
 	private function edit() {
@@ -385,8 +415,8 @@ format: 'YYYY-MM'
 			SE_Layout::alert('danger', "Wykryto abuse! Wysłano informację do administratora.");
 ?>
 <div class="container" style="text-align:center">
-  <form method="post" action="<?php echo $this->LAST_REFERER?>">
-    <input type="hidden" name="REFERER" value="<?php echo $this->REFERER?>"/>
+  <form method="post" action="<?=$this->LAST_REFERER?>">
+    <input type="hidden" name="REFERER" value="<?=$this->REFERER?>"/>
     <button type="submit" class="btn btn-primary">Powrót</button>
   </form>
 </div>
@@ -464,6 +494,13 @@ format: 'YYYY-MM'
 		}
 		restore_error_handler();
 
+		libxml_use_internal_errors(true);
+		if (!$dom->schemaValidate(APP_PATH_SCHEMA . "/jpk/Schemat_JPK_VAT(2)_v1-0.xsd")) {
+			$errors = '';
+			foreach (libxml_get_errors() as $libxml_error) $errors .= "<br/>{$libxml_error->message}";
+			throw new Exception("Plik JPK niezgodny ze schematem XSD{$errors}");
+		}
+
 		$xml = simplexml_load_string($dom->saveXML());
 	}
 
@@ -488,8 +525,8 @@ format: 'YYYY-MM'
 			SE_Layout::alert('danger', $e->getMessage());
 ?>
 <div class="container" style="text-align:center">
-  <form method="post" action="<?php echo $this->LAST_REFERER?>">
-    <input type="hidden" name="REFERER" value="<?php echo $this->REFERER?>"/>
+  <form method="post" action="<?=$this->LAST_REFERER?>">
+    <input type="hidden" name="REFERER" value="<?=$this->REFERER?>"/>
     <button type="submit" class="btn btn-primary">Powrót</button>
   </form>
 </div>
@@ -517,8 +554,8 @@ format: 'YYYY-MM'
 			SE_Layout::alert('danger', $e->getMessage());
 ?>
 <div class="container" style="text-align:center">
-  <form method="post" action="<?php echo $this->LAST_REFERER?>">
-    <input type="hidden" name="REFERER" value="<?php echo $this->REFERER?>"/>
+  <form method="post" action="<?=$this->LAST_REFERER?>">
+    <input type="hidden" name="REFERER" value="<?=$this->REFERER?>"/>
     <button type="submit" class="btn btn-primary">Powrót</button>
   </form>
 </div>
@@ -630,14 +667,14 @@ EOT;
 			}
 
 			$xml = new SimpleXMLElement($xmlSchema);
-			$ns = $ns = $xml->getNamespaces(true);
+			$ns = $xml->getNamespaces(true);
 
 			$xml->Naglowek->CelZlozenia = $this->JPK['PURPOSE'];
 			$xml->Naglowek->DataWytworzeniaJPK = date("Y-m-d\TH:i:s");
 			$xml->Naglowek->DataOd = $this->JPK['MONTH'] . "-01";
 			$xml->Naglowek->DataDo = date("Y-m-d", strtotime($xml->Naglowek->DataOd . "+ 1 month - 1 day"));
 			if (!($xml->Naglowek->KodUrzedu = $this->BO['kodUrzeduSkarbowego'])) throw new Exception("blędne dane podmiotu - brak kodu urzędu skarbowego");
-			if (!($xml->Podmiot1->IdentyfikatorPodmiotu->children($ns['etd'])->NIP = $this->BO['nip'])) throw new Exception("blędne dane podmiotu - brak NIP");
+			if (!($xml->Podmiot1->IdentyfikatorPodmiotu->children($ns['etd'])->NIP = trim(str_replace("-", "", $this->BO['nip'])))) throw new Exception("blędne dane podmiotu - brak NIP");
 			if (!($xml->Podmiot1->IdentyfikatorPodmiotu->children($ns['etd'])->PelnaNazwa = $this->BO['name1'])) throw new Exception("blędne dane podmiotu - brak nazwy podmiotu");
 			if ($this->BO['name2']) $xml->Podmiot1->IdentyfikatorPodmiotu->children($ns['etd'])->PelnaNazwa .= " " . $this->BO['name2'];
 			if (!($xml->Podmiot1->IdentyfikatorPodmiotu->children($ns['etd'])->REGON = $this->BO['regon'])) unset($xml->Podmiot1->IdentyfikatorPodmiotu->children($ns['etd'])->REGON);
@@ -704,19 +741,30 @@ EOT;
 
 			ksort($data);
 
+ 
+			function addCdata(&$node, $value) {
+				$dom_node = dom_import_simplexml($node);
+				$dom_owner = $dom_node->ownerDocument;
+				$dom_node->appendChild($dom_owner->createCDATASection($value));
+			}
+
 			$i = 0;
 			foreach ($data as $pos) {
 				$x = $xml->addChild('SprzedazWiersz');
 				$x->addAttribute('typ', 'G');
 				$x->addChild('LpSprzedazy', ++$i);
 				ksort($pos[1]);
-				foreach ($pos as $subpos) foreach ($subpos as $key => $value) $x->addChild($key, $value);
+				foreach ($pos as $subpos) foreach ($subpos as $key => $value) {
+					$x->addChild($key, $value);
+					if (!strlen($x->$key)) addCdata($x->$key, $value);
+				}
 			}
 
 			$xml->SprzedazCtrl->LiczbaWierszySprzedazy = count($data);
 			$xml->SprzedazCtrl->PodatekNalezny = $allVAT;
 
 			$this->validateJPK_VAT($xml);
+
 			if ($this->JPK['IN_INSERT']) $info = "Zaimportowano dane z Insert i L1";
 			else $info = "Zaimportowano dane z L1";
 			$sqlObj = new stdClass();
@@ -729,11 +777,11 @@ EOT;
 		} catch (Exception $e) {
 			SE_Layout::gora();
 			SE_Layout::menu();
-			SE_Layout::alert('danger', "Błąd w trakcie importu danych z L1 ({$e->getMessage()})");
+			SE_Layout::alert('danger', "Błąd w trakcie importu danych z L1. {$e->getMessage()}");
 ?>
 <div class="container" style="text-align:center">
-  <form method="post" action="<?php echo $this->LAST_REFERER?>">
-    <input type="hidden" name="REFERER" value="<?php echo $this->REFERER?>"/>
+  <form method="post" action="<?=$this->LAST_REFERER?>">
+    <input type="hidden" name="REFERER" value="<?=$this->REFERER?>"/>
     <button type="submit" class="btn btn-primary">Powrót</button>
   </form>
 </div>
@@ -761,8 +809,8 @@ EOT;
 			SE_Layout::alert('danger', $e->getMessage());
 ?>
 <div class="container" style="text-align:center">
-  <form method="post" action="<?php echo $this->LAST_REFERER?>">
-    <input type="hidden" name="REFERER" value="<?php echo $this->REFERER?>"/>
+  <form method="post" action="<?=$this->LAST_REFERER?>">
+    <input type="hidden" name="REFERER" value="<?=$this->REFERER?>"/>
     <button type="submit" class="btn btn-primary">Powrót</button>
   </form>
 </div>
@@ -850,8 +898,8 @@ EOT;
 			SE_Layout::alert('danger', $e->getMessage());
 ?>
 <div class="container" style="text-align:center">
-  <form method="post" action="<?php echo $this->LAST_REFERER?>">
-    <input type="hidden" name="REFERER" value="<?php echo $this->REFERER?>"/>
+  <form method="post" action="<?=$this->LAST_REFERER?>">
+    <input type="hidden" name="REFERER" value="<?=$this->REFERER?>"/>
     <button type="submit" class="btn btn-primary">Powrót</button>
   </form>
 </div>
@@ -875,8 +923,8 @@ EOT;
 			SE_Layout::alert('danger', $e->getMessage());
 ?>
 <div class="container" style="text-align:center">
-  <form method="post" action="<?php echo $this->LAST_REFERER?>">
-    <input type="hidden" name="REFERER" value="<?php echo $this->REFERER?>"/>
+  <form method="post" action="<?=$this->LAST_REFERER?>">
+    <input type="hidden" name="REFERER" value="<?=$this->REFERER?>"/>
     <button type="submit" class="btn btn-primary">Powrót</button>
   </form>
 </div>
@@ -912,168 +960,4 @@ EOT;
 		}
 	}
 
-	public function reinstallAction() {
-		$this->reinstall();
-		die('OK');
-	}
-
-	public function reinstall() {
-		$sqlList = array();
-/*		$sqlList['InstallLayerTable'] = <<<SQL
-CREATE TABLE IF NOT EXISTS `WMS_LAYERS` (
-  `ID` int(11) NOT NULL AUTO_INCREMENT,
-  `the_geom` polygon NOT NULL,
-  `ID_PROJECT` int(11) NOT NULL,
-  `LAYER_NAME` varchar(100) NOT NULL,
-  `LAYER_TYPE` enum('GeoTIFF','QGIS') NOT NULL DEFAULT 'GeoTIFF',
-  `OLD_LAYER_TYPE` enum('GeoTIFF','QGIS') NOT NULL,
-  `LAYER_DESC` text NOT NULL,
-  `ID_WMS_MAPS` int(11) NOT NULL,
-  `OLD_ID_WMS_MAPS` int(11) NOT NULL,
-  `FILE_NAME` varchar(255) NOT NULL,
-  `FILE_STATUS` enum('NONE','TO_GENERATE','IN_PROGRESS','GENERATED','ERROR') NOT NULL DEFAULT 'NONE',
-  `FILE_STATUS_INFO` varchar(255) NOT NULL,
-  `EPSG` int(11) NOT NULL,
-  `EXTENT` varchar(100) NOT NULL,
-  `MAP_STATUS` enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'INACTIVE',
-  `FILE_MD5` varchar(32) NOT NULL,
-  `A_RECORD_CREATE_DATE` datetime NOT NULL,
-  `A_RECORD_CREATE_AUTHOR` varchar(40) NOT NULL,
-  `A_RECORD_UPDATE_DATE` varchar(18) NOT NULL,
-  `A_RECORD_UPDATE_AUTHOR` varchar(40) NOT NULL,
-  `L_APPOITMENT_DATE` datetime NOT NULL,
-  `L_APPOITMENT_USER` varchar(40) NOT NULL,
-  `L_APPOITMENT_PERIOD` varchar(30) NOT NULL,
-  `L_APPOITMENT_INFO` varchar(200) NOT NULL,
-  `L_APPOITMENT_TYPE` enum('','ARRANGED','TO_ARRANGE','CANCELLED','TO_CANCEL','RELATE','WAIT') NOT NULL,
-  `A_PROBLEM` enum('','WARNING','PROBLEM','SERIOUS','UNVERIFIED') NOT NULL,
-  `A_PROBLEM_DESC` varchar(200) NOT NULL,
-  `A_PROBLEM_DATE` datetime NOT NULL,
-  `A_STATUS` enum('DELETED','MONITOR','NORMAL','OFF_HARD','OFF_SOFT','WAITING','WARNING') NOT NULL DEFAULT 'WAITING',
-  `A_STATUS_INFO` varchar(100) NOT NULL,
-  `A_STATUS_LASTCHANGE_DATE` datetime NOT NULL,
-  `A_ADM_COMPANY` varchar(100) NOT NULL,
-  `A_CLASSIFIED` varchar(100) NOT NULL,
-  `SYNC_SQIX_STATUS` varchar(100) NOT NULL,
-  PRIMARY KEY (`ID`)
-) ENGINE=MyISAM  DEFAULT CHARSET=latin2;
-SQL;
-
-                $sqlList['InstallLayerHistTable'] = <<<SQL
-CREATE TABLE IF NOT EXISTS `WMS_LAYERS_HIST` (
-  `ID` int(11) NOT NULL AUTO_INCREMENT,
-  `ID_USERS2` int(11) NOT NULL,
-  `the_geom` text,
-  `ID_PROJECT` varchar(20) DEFAULT 'N/S;',
-  `LAYER_NAME` varchar(100) DEFAULT 'N/S;',
-  `LAYER_TYPE` varchar(10) DEFAULT 'N/S;',
-  `OLD_LAYER_TYPE` varchar(10) DEFAULT 'N/S;',
-  `LAYER_DESC` varchar(10000) DEFAULT 'N/S;',
-  `ID_WMS_MAPS` varchar(20) DEFAULT 'N/S;',
-  `OLD_ID_WMS_MAPS` varchar(20) DEFAULT 'N/S;',
-  `FILE_NAME` varchar(255) DEFAULT 'N/S;',
-  `FILE_STATUS` varchar(20) DEFAULT 'N/S;',
-  `FILE_STATUS_INFO` varchar(255) DEFAULT 'N/S;',
-  `EPSG` varchar(10) DEFAULT 'N/S;',
-  `EXTENT` varchar(100) DEFAULT 'N/S;',
-  `MAP_STATUS` varchar(20) DEFAULT 'N/S;',
-  `FILE_MD5` varchar(32) DEFAULT 'N/S;',
-  `A_RECORD_CREATE_DATE` varchar(30) DEFAULT 'N/S;',
-  `A_RECORD_CREATE_AUTHOR` varchar(40) DEFAULT 'N/S;',
-  `A_RECORD_UPDATE_DATE` varchar(18) DEFAULT 'N/S;',
-  `A_RECORD_UPDATE_AUTHOR` varchar(40) DEFAULT 'N/S;',
-  `L_APPOITMENT_DATE` varchar(30) DEFAULT 'N/S;',
-  `L_APPOITMENT_USER` varchar(40) DEFAULT 'N/S;',
-  `L_APPOITMENT_PERIOD` varchar(30) DEFAULT 'N/S;',
-  `L_APPOITMENT_INFO` varchar(200) DEFAULT 'N/S;',
-  `L_APPOITMENT_TYPE` varchar(255) DEFAULT 'N/S;',
-  `A_PROBLEM` varchar(255) DEFAULT 'N/S;',
-  `A_PROBLEM_DESC` varchar(200) DEFAULT 'N/S;',
-  `A_PROBLEM_DATE` varchar(255) DEFAULT 'N/S;',
-  `A_STATUS` varchar(255) DEFAULT 'N/S;',
-  `A_STATUS_INFO` varchar(100) DEFAULT 'N/S;',
-  `A_STATUS_LASTCHANGE_DATE` varchar(255) DEFAULT 'N/S;',
-  `A_ADM_COMPANY` varchar(100) DEFAULT 'N/S;',
-  `A_CLASSIFIED` varchar(100) DEFAULT 'N/S;',
-  `SYNC_SQIX_STATUS` varchar(100) DEFAULT 'N/S;',
-  PRIMARY KEY (`ID`)
-) ENGINE=MyISAM  DEFAULT CHARSET=latin2;
-SQL;
-
-		$sqlList['InstallMapTable'] = <<<SQL
-CREATE TABLE IF NOT EXISTS `WMS_MAPS` (
-  `ID` int(11) NOT NULL AUTO_INCREMENT,
-  `MAP_NAME` varchar(100) NOT NULL,
-  `MAP_DESC` text NOT NULL,
-  `MAP_STATUS` enum('NONE','TO_GENERATE','IN_PROGRESS','GENERATED','ERROR') NOT NULL DEFAULT 'NONE',
-  `MAP_STATUS_INFO` varchar(255) NOT NULL,
-  `MAP_URL` varchar(100) NOT NULL,
-  `MAP_FILE` varchar(100) NOT NULL,
-  `A_RECORD_CREATE_DATE` datetime NOT NULL,
-  `A_RECORD_CREATE_AUTHOR` varchar(40) NOT NULL,
-  `A_RECORD_UPDATE_DATE` varchar(18) NOT NULL,
-  `A_RECORD_UPDATE_AUTHOR` varchar(40) NOT NULL,
-  `L_APPOITMENT_DATE` datetime NOT NULL,
-  `L_APPOITMENT_USER` varchar(40) NOT NULL,
-  `L_APPOITMENT_PERIOD` varchar(30) NOT NULL,
-  `L_APPOITMENT_INFO` varchar(200) NOT NULL,
-  `L_APPOITMENT_TYPE` enum('','ARRANGED','TO_ARRANGE','CANCELLED','TO_CANCEL','RELATE','WAIT') NOT NULL,
-  `A_PROBLEM` enum('','WARNING','PROBLEM','SERIOUS','UNVERIFIED') NOT NULL,
-  `A_PROBLEM_DESC` varchar(200) NOT NULL,
-  `A_PROBLEM_DATE` datetime NOT NULL,
-  `A_STATUS` enum('DELETED','MONITOR','NORMAL','OFF_HARD','OFF_SOFT','WAITING','WARNING') NOT NULL DEFAULT 'WAITING',
-  `A_STATUS_INFO` varchar(100) NOT NULL,
-  `A_STATUS_LASTCHANGE_DATE` datetime NOT NULL,
-  `A_ADM_COMPANY` varchar(100) NOT NULL,
-  `A_CLASSIFIED` varchar(100) NOT NULL,
-  `SYNC_SQIX_STATUS` varchar(100) NOT NULL,
-  PRIMARY KEY (`ID`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin2;
-SQL;
-
-		$sqlList['InstallMapHistTable'] = <<<SQL
-CREATE TABLE IF NOT EXISTS `WMS_MAPS_HIST` (
-  `ID` int(11) NOT NULL AUTO_INCREMENT,
-  `ID_USERS2` int(11) NOT NULL,
-  `MAP_NAME` varchar(100) DEFAULT 'N/S;',
-  `MAP_DESC` varchar(10000) NOT NULL DEFAULT 'N/S;',
-  `MAP_STATUS` varchar(20) NOT NULL DEFAULT 'N/S;',
-  `MAP_STATUS_INFO` varchar(255) NOT NULL DEFAULT 'N/S;',
-  `MAP_URL` varchar(100) NOT NULL DEFAULT 'N/S;',
-  `MAP_FILE` varchar(100) NOT NULL DEFAULT 'N/S;',
-  `A_RECORD_CREATE_DATE` varchar(30) DEFAULT 'N/S;',
-  `A_RECORD_CREATE_AUTHOR` varchar(40) DEFAULT 'N/S;',
-  `A_RECORD_UPDATE_DATE` varchar(18) DEFAULT 'N/S;',
-  `A_RECORD_UPDATE_AUTHOR` varchar(40) DEFAULT 'N/S;',
-  `L_APPOITMENT_DATE` varchar(30) DEFAULT 'N/S;',
-  `L_APPOITMENT_USER` varchar(40) DEFAULT 'N/S;',
-  `L_APPOITMENT_PERIOD` varchar(30) DEFAULT 'N/S;',
-  `L_APPOITMENT_INFO` varchar(200) DEFAULT 'N/S;',
-  `L_APPOITMENT_TYPE` varchar(255) DEFAULT 'N/S;',
-  `A_PROBLEM` varchar(255) DEFAULT 'N/S;',
-  `A_PROBLEM_DESC` varchar(200) DEFAULT 'N/S;',
-  `A_PROBLEM_DATE` varchar(255) DEFAULT 'N/S;',
-  `A_STATUS` varchar(255) DEFAULT 'N/S;',
-  `A_STATUS_INFO` varchar(100) DEFAULT 'N/S;',
-  `A_STATUS_LASTCHANGE_DATE` varchar(255) DEFAULT 'N/S;',
-  `A_ADM_COMPANY` varchar(100) DEFAULT 'N/S;',
-  `A_CLASSIFIED` varchar(100) DEFAULT 'N/S;',
-  `SYNC_SQIX_STATUS` varchar(100) DEFAULT 'N/S;',
-  PRIMARY KEY (`ID`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin2;
-SQL;
-*/
-		$db = DB::getDB();
-		if ($db->has_errors()) {
-			throw new Exception("DB Errors: " . implode("\n<br>", $db->get_errors()));
-		}
-		foreach ($sqlList as $sqlName => $sql) {
-			$res = $db->query($sql);
-			if ($db->has_errors()) {
-				throw new Exception("DB Errors at sql '{$sqlName}': " . implode("\n<br>", $db->get_errors()));
-			}
-		}
-	}
-
-
 }