<?xml version="1.0" encoding="UTF-8"?>
<Export generator="Cache" version="25" zv="Cache for Windows (x86-32) 2011.1.2 (Build 701U)" ts="2011-12-14 14:59:07">
<Class name="DBAdressen.AF.AdresseAF">
<Description>
</Description>
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61010,40905.174586</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, 
		AdressNrAlt, 
		Adresscode, 
		Adressnummer, 
		Adressstatus, 
		Aktiv, 
		Anrede, 
		BearbeiterBenutzername, 
		BearbeiterName, 
		BearbeiterNr, 
		BearbeiterVorname, 
		Bearbeitungsdatum, 
		Bemerkung1, 
		Bemerkung2, 
		Bemerkung3, 
		Benutzername, 
		BonitaetBemerkung, 
		BonitaetInd3, 
		BonitaetInd4, 
		BonitaetInd5, 
		EMail, 
		EinkSteuerungstyp, 
		ErfasserBenutzername, 
		ErfasserName, 
		ErfasserNr, 
		ErfasserVorname, 
		Erfassungsdatum, 
		FaktAuftragSteuerung, 
		FaktEKBestSteuerung, 
		Fax, 
		FreieSelektion1, 
		FreieSelektion2, 
		FreierText1, 
		FreierText2, 
		FreiesDatum1, 
		FreiesDatum2, 
		Gebietscode, 
		Hausnummer, 
		IndDate1, 
		IndDate2, 
		IndDate3, 
		IndDate4, 
		IndDate5, 
		IndSel1, 
		IndSel2, 
		IndSel3, 
		IndSel4, 
		IndSel5, 
		IndSelBoni1, 
		IndSelBoni2, 
		KundenSpezRueckvergAktiv, 
		Kundengruppe, 
		Kundenkategorie, 
		Kurzname, 
		Lieferantengruppe,
		Mandant, 
		Mobil, 
		Name, 
		Ort, 
		Passwort, 
		PersAnrede, 
		Plz, 
		PlzInklZusatz, 
		Preiskategorie, 
		Sprachcode, 
		Strasse, 
		Telefon1, 
		Telefon2, 
		VerkSteuerungstyp, 
		Vertretercode, 
		VornameZusatz1, 
		Web, 
		ZuHanden, 
		Zusatz2, 
		ZusatzInfoText, 
		ZusatzInfoTextStream, 
		sdxCity, 
		sdxName, 
		sdxStreet1, 
		sdxStreet2, 
		sdxStreet3, 
		sdxStreetNo, 
		sdxZip 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid 
	ORDER BY Adressnummer</SqlQuery>
</Query>

<Query name="ListeIdsGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid</SqlQuery>
</Query>

<Query name="ListeNachOid">
<Type>%SQLQuery</Type>
<FormalSpec>Oid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Adresscode, Name, VornameZusatz1, Plz, Ort 
	FROM DBAdressen.Adresse 
	WHERE ID = :Oid</SqlQuery>
</Query>

<Query name="ListeRootZahlenAUTO6">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT DISTINCT {fn CONVERT(Adressnummer / 100000, SQL_INTEGER)} As Ziffer 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid 
	ORDER BY Ziffer</SqlQuery>
</Query>

<Query name="ListeVonRootZahlAUTO6">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Ziffer:%Integer,OnlyAktive:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Adressnummer, Adresscode, Name, VornameZusatz1, Plz, Ort 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid AND {fn CONVERT(Adressnummer / 100000, SQL_INTEGER)} = :Ziffer AND (:OnlyAktive = 0 OR Aktiv = 1) 
	ORDER BY Adressnummer</SqlQuery>
</Query>

<Query name="ListeRootZahlenAUTO8">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT DISTINCT {fn CONVERT(Adressnummer / 10000000, SQL_INTEGER)} As Ziffer 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid 
	ORDER BY Ziffer</SqlQuery>
</Query>

<Query name="ListeVonRootZahlAUTO8">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Ziffer:%Integer,OnlyAktive:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Adressnummer, Adresscode, Name, VornameZusatz1, Plz, Ort 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid AND {fn CONVERT(Adressnummer / 10000000, SQL_INTEGER)} = :Ziffer AND (:OnlyAktive = 0 OR Aktiv = 1) 
	ORDER BY Adressnummer</SqlQuery>
</Query>

<Query name="ListeRootZahlenFortlaufend">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT DISTINCT {fn CONVERT(Adressnummer / 100, SQL_INTEGER)} As Ziffer 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid 
	ORDER BY Ziffer</SqlQuery>
</Query>

<Query name="ListeVonRootZahlFortlaufend">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Ziffer:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Adressnummer, Adresscode, Name, VornameZusatz1, Plz, Ort 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid AND {fn CONVERT(Adressnummer / 100, SQL_INTEGER)} = :Ziffer 
	ORDER BY Name, Ort, VornameZusatz1</SqlQuery>
</Query>

<Query name="ListeRootZahlenManuell">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT DISTINCT {fn CONVERT(Adressnummer / 100000, SQL_INTEGER)} As Ziffer 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid 
	ORDER BY Ziffer</SqlQuery>
</Query>

<Query name="ListeVonRootZahlManuell">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Ziffer:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Adressnummer, Adresscode, Name, VornameZusatz1, Plz, Ort 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid AND {fn CONVERT(Adressnummer / 100000, SQL_INTEGER)} = :Ziffer 
	ORDER BY Name, Ort, VornameZusatz1</SqlQuery>
</Query>

<Query name="ListeFortlaufendeManuelleAdrnr">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,OnlyAktive:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Adressnummer, Adresscode, Name, VornameZusatz1, Plz, Ort 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid AND (:OnlyAktive = 0 OR Aktiv = 1) 
	ORDER BY Adressnummer</SqlQuery>
</Query>

<Query name="ListeNachNormalBuchstaben">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Letter:%String,OnlyAktive:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Adresscode, Name, VornameZusatz1, Plz, Ort 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid AND {fn LEFT({fn UCASE(Name)},1)} = :Letter AND (:OnlyAktive = 0 OR Aktiv = 1) 
	ORDER BY Name, Ort, VornameZusatz1</SqlQuery>
</Query>

<Query name="ListeNachLetterA">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,OnlyAktive:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, Adresscode, Name, VornameZusatz1, Plz, Ort 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid AND (ASCII({fn UCASE(Name)}) = 65 OR (ASCII({fn UCASE(Name)}) >=192 AND ASCII({fn UCASE(Name)}) <=198)) AND (:OnlyAktive = 0 OR Aktiv = 1) 
	ORDER BY Name, Ort, VornameZusatz1]]></SqlQuery>
</Query>

<Query name="ListeNachLetterE">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,OnlyAktive:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, Adresscode, Name, VornameZusatz1, Plz, Ort 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid AND ({fn ASCII({fn UCASE(Name)})} = 69 OR (ASCII({fn UCASE(Name)}) >=200 AND ASCII({fn UCASE(Name)}) <=203)) AND (:OnlyAktive = 0 OR Aktiv = 1) 
	ORDER BY Name, Ort, VornameZusatz1]]></SqlQuery>
</Query>

<Query name="ListeNachLetterI">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,OnlyAktive:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, Adresscode, Name, VornameZusatz1, Plz, Ort 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid AND ({fn ASCII({fn UCASE(Name)})} = 73 OR (ASCII({fn UCASE(Name)}) >=204 AND ASCII({fn UCASE(Name)}) <=207)) AND (:OnlyAktive = 0 OR Aktiv = 1) 
	ORDER BY Name, Ort, VornameZusatz1]]></SqlQuery>
</Query>

<Query name="ListeNachLetterO">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,OnlyAktive:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, Adresscode, Name, VornameZusatz1, Plz, Ort 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid AND ({fn ASCII({fn UCASE(Name)})} = 79 OR (ASCII({fn UCASE(Name)}) >=210 AND ASCII({fn UCASE(Name)}) <=214)) AND (:OnlyAktive = 0 OR Aktiv = 1) 
	ORDER BY Name, Ort, VornameZusatz1]]></SqlQuery>
</Query>

<Query name="ListeNachLetterU">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,OnlyAktive:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, Adresscode, Name, VornameZusatz1, Plz, Ort 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid AND ({fn ASCII({fn UCASE(Name)})} = 85 OR (ASCII({fn UCASE(Name)}) >=217 AND ASCII({fn UCASE(Name)}) <=220)) AND (:OnlyAktive = 0 OR Aktiv = 1) 
	ORDER BY Name, Ort, VornameZusatz1]]></SqlQuery>
</Query>

<Query name="ListeNachNummern">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,OnlyAktive:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, Adresscode, Name, VornameZusatz1, Plz, Ort 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid AND ({fn ASCII({fn UCASE(Name)})} > 47 AND {fn ASCII({fn UCASE(Name)})} < 58) AND (:OnlyAktive = 0 OR Aktiv = 1) 
	ORDER BY Name, Ort, VornameZusatz1]]></SqlQuery>
</Query>

<Query name="ListeRootEintraegeStandard">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT DISTINCT {fn LEFT({fn UCASE(Name)},1)} As Ziffer 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid	AND (({fn ASCII({fn UCASE(Name)})} > 47 AND {fn ASCII({fn UCASE(Name)})} < 58) OR ({fn ASCII({fn UCASE(Name)})} >= 65 AND {fn ASCII({fn UCASE(Name)})} <= 90)) 
	ORDER BY Ziffer]]></SqlQuery>
</Query>

<Query name="GetAnzAdressen">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT COUNT(ID) 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid</SqlQuery>
</Query>

<Query name="GetAdresseByAdressnr">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Adressnr:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID 
	FROM DBAdressen.Adresse
	WHERE Mandant = :MandantOid AND Adressnummer = :Adressnr</SqlQuery>
</Query>

<Query name="GetFirstAdressId">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT TOP 1 ID 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid 
	ORDER BY Adressnummer</SqlQuery>
</Query>

<Query name="ListeNachKurzname">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Kurzname:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Adressnummer, Name, VornameZusatz1, Strasse, Plz, Ort, Telefon1, Hausnummer 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid AND { fn LCASE(Kurzname)} LIKE { fn LCASE(:Kurzname)} 
	ORDER BY Name, Ort, VornameZusatz1</SqlQuery>
</Query>

<Query name="ListeNachName">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Name:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Adressnummer, Name, VornameZusatz1, Strasse, Plz, Ort, Telefon1, Hausnummer 
	FROM DBAdressen.Adresse
	WHERE Mandant = :MandantOid AND { fn LCASE(Name)} LIKE { fn LCASE(:Name)} 
	ORDER BY Name, Ort, VornameZusatz1</SqlQuery>
</Query>

<Query name="ListeNachAltAdrNr">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,AltNr:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Adressnummer, Name, VornameZusatz1, Strasse, Plz, Ort, Telefon1, Hausnummer 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid AND { fn LCASE(AdressNrAlt)} LIKE { fn LCASE(:AltNr)} 
	ORDER BY Name, Ort, VornameZusatz1</SqlQuery>
</Query>

<Query name="GetEntryByAdrNr">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,AdrNr:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Adressnummer, Name, VornameZusatz1, Adresscode, Plz, Ort, Kurzname, Strasse, Hausnummer
	FROM DBAdressen.Adresse
	WHERE Mandant = :MandantOid	AND Adressnummer %STARTSWITH :AdrNr
	ORDER BY Adressnummer</SqlQuery>
</Query>

<Query name="GetEntryByAdrNrKleiner">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,AdrNr:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, Adressnummer, Name, VornameZusatz1, Adresscode, Plz, Ort, Kurzname, Strasse, Hausnummer
	FROM DBAdressen.Adresse
	WHERE Mandant = :MandantOid	AND Adressnummer <= :AdrNr
	ORDER BY Adressnummer DESC]]></SqlQuery>
</Query>

<Query name="GetEntryByAdrNrGroesser">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,AdrNr:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, Adressnummer, Name, VornameZusatz1, Adresscode, Plz, Ort, Kurzname, Strasse, Hausnummer
	FROM DBAdressen.Adresse
	WHERE Mandant = :MandantOid	AND Adressnummer >= :AdrNr
	ORDER BY Adressnummer]]></SqlQuery>
</Query>

<Query name="GetEntryByKurzname">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Kurzname:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT TOP 1 ID, Adressnummer, Kurzname, Name, VornameZusatz1, Adresscode, Plz, Ort , Strasse, Hausnummer
	FROM DBAdressen.Adresse
	WHERE Mandant = :MandantOid
	AND Kurzname LIKE :Kurzname ORDER BY Kurzname</SqlQuery>
</Query>

<Query name="GetEntryByName">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Name:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT TOP 1 ID, Adressnummer, Kurzname, Name, VornameZusatz1, Adresscode, Plz, Ort , Strasse, Hausnummer
	FROM DBAdressen.Adresse
	WHERE Mandant = :MandantOid
	AND Name LIKE :Name ORDER BY Name</SqlQuery>
</Query>

<Query name="GetEntryByOid">
<Description>
Ich brauche in dieser Abfrage die ID als double, für Relation in PrintPreisliste
 NICHT ändern! dh 12.12.2009</Description>
<Type>%SQLQuery</Type>
<FormalSpec>Oid:%String,DebiMandant:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT TOP 1 +ID AS ID, Adressnummer, Anrede, EMail, Fax, Mobil, PersAnrede, Telefon1, Telefon2,
	VornameZusatz1 As AdrZeile1, ZuHanden, Web, Kurzname, Name, Plz, Ort , Strasse, Hausnummer, DBDebiKredi.Debitor_GetFirmaTextByAdrOid(ID, :DebiMandant) AS KundenIdentifikation
	FROM DBAdressen.Adresse
	WHERE ID = :Oid</SqlQuery>
</Query>

<Query name="ListeNachKG">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,vonKgNr:%Integer,bisKgNr:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, Adressnummer, Name, Kurzname, VornameZusatz1, Strasse, Plz, Ort, Telefon1, Hausnummer
	FROM DBAdressen.Adresse 
	WHERE Mandant=:MandantOid AND Kundengruppe->Code>=:vonKgNr AND Kundengruppe->Code<=:bisKgNr 
	ORDER BY Kurzname]]></SqlQuery>
</Query>

<Query name="ListeNachLG">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,vonLgNr:%Integer,bisLgNr:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, Adressnummer, Name, Kurzname, VornameZusatz1, Strasse, Plz, Ort, Telefon1, Hausnummer
	FROM DBAdressen.Adresse 
	WHERE Mandant=:MandantOid AND Lieferantengruppe->Code>=:vonLgNr AND Lieferantengruppe->Code<=:bisLgNr 
	ORDER BY Kurzname]]></SqlQuery>
</Query>

<Query name="ListeByKG">
<Type>%SQLQuery</Type>
<FormalSpec>KgOid:%String,DebiMandant:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT+ID AS ID, Adressnummer, Anrede, EMail, Fax, Mobil, PersAnrede, Telefon1, Telefon2, Sprachcode,
		VornameZusatz1 As AdrZeile1, ZuHanden, Web, Kurzname, Name, Plz, Ort , Strasse, Hausnummer, DBDebiKredi.Debitor_GetFirmaTextByAdrOid(ID, :DebiMandant) AS KundenIdentifikation
	FROM DBAdressen.Adresse 
	WHERE Kundengruppe =:KgOid 
	ORDER BY Kurzname</SqlQuery>
</Query>

<Query name="ListeByTelNr">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,telNr:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT 0 As Typ, 
			Adresse->ID, Adresse->Adressnummer, Adresse->Kurzname, Adresse->Name, 
			Adresse->VornameZusatz1, Adresse->Zusatz2, Adresse->Strasse, Adresse->Plz, 
			Adresse->Ort, Adresse->Sprachcode, Adresse->Adresscode, Adresse->Bemerkung1, 
			Adresse->Bemerkung2, Adresse->Bemerkung3, Adresse->EMail,
			ID As "MA.ID", Mitarbeiternr As "MA.Mitarbeiternr", Anrede As "MA.Anrede", 
			Name As "MA.Name", Vorname As "MA.Vorname", Position As "MA.Position", 
			EMail As "MA.EMail", Info1 As "MA.Info1", Info2 As "MA.Info2", Info3 As "MA.Info3" 
	FROM DBAdressen.Mitarbeiter m 
	WHERE m.Adresse->Mandant=:MandantOid AND (	
			DBUtils.StringUtils_StripPhoneNumber(m.TelefonDirekt) like '%' || DBUtils.StringUtils_StripPhoneNumber(:telNr) || '%' OR 
			DBUtils.StringUtils_StripPhoneNumber(m.Intern) like '%' || DBUtils.StringUtils_StripPhoneNumber(:telNr) || '%' OR 
			DBUtils.StringUtils_StripPhoneNumber(m.Mobil) like '%' || DBUtils.StringUtils_StripPhoneNumber(:telNr) || '%' OR 
			DBUtils.StringUtils_StripPhoneNumber(m.Fax) like '%' || DBUtils.StringUtils_StripPhoneNumber(:telNr) || '%'
		)
		
	UNION ALL SELECT 1 As Typ, ID, Adressnummer, Kurzname, Name, VornameZusatz1, 
			Zusatz2, Strasse, Plz, Ort, Sprachcode, Adresscode, 
			Bemerkung1, Bemerkung2, Bemerkung3, EMail,
			'' As "MA.ID", '' As "MA.Mitarbeiternr", '' As "MA.Anrede", 
			'' As "MA.Name", '' As "MA.Vorname", '' As "MA.Position", '' As "MA.EMail", 
			'' As "MA.Info1", '' As "MA.Info2", '' As "MA.Info3"
	FROM DBAdressen.Adresse a 
	WHERE a.Mandant=:MandantOid AND (	
			DBUtils.StringUtils_StripPhoneNumber(a.Telefon1) like '%' || DBUtils.StringUtils_StripPhoneNumber(:telNr) || '%' OR 
			DBUtils.StringUtils_StripPhoneNumber(a.Telefon2) like '%' || DBUtils.StringUtils_StripPhoneNumber(:telNr) || '%' OR 
			DBUtils.StringUtils_StripPhoneNumber(a.Mobil) like '%' || DBUtils.StringUtils_StripPhoneNumber(:telNr) || '%' OR 
			DBUtils.StringUtils_StripPhoneNumber(a.Fax) like '%' || DBUtils.StringUtils_StripPhoneNumber(:telNr) || '%'
		)]]></SqlQuery>
</Query>

<Query name="ListeByTelNrExact">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,telNr:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT 0 As Typ, 
			Adresse->ID, Adresse->Adressnummer, Adresse->Kurzname, Adresse->Name, 
			Adresse->VornameZusatz1, Adresse->Zusatz2, Adresse->Strasse, Adresse->Plz, 
			Adresse->Ort, Adresse->Sprachcode, Adresse->Adresscode, Adresse->Bemerkung1, 
			Adresse->Bemerkung2, Adresse->Bemerkung3, Adresse->EMail,
			ID As "MA.ID", Mitarbeiternr As "MA.Mitarbeiternr", Anrede As "MA.Anrede", 
			Name As "MA.Name", Vorname As "MA.Vorname", Position As "MA.Position", 
			EMail As "MA.EMail", Info1 As "MA.Info1", Info2 As "MA.Info2", Info3 As "MA.Info3" 
	FROM DBAdressen.Mitarbeiter m 
	WHERE m.Adresse->Mandant=:MandantOid AND (	
			DBUtils.StringUtils_StripPhoneNumber(m.TelefonDirekt) like DBUtils.StringUtils_StripPhoneNumber(:telNr) OR 
			DBUtils.StringUtils_StripPhoneNumber(m.Intern) like DBUtils.StringUtils_StripPhoneNumber(:telNr) OR 
			DBUtils.StringUtils_StripPhoneNumber(m.Mobil) like DBUtils.StringUtils_StripPhoneNumber(:telNr) OR 
			DBUtils.StringUtils_StripPhoneNumber(m.Fax) like DBUtils.StringUtils_StripPhoneNumber(:telNr)
		)
		
	UNION ALL SELECT 1 As Typ, ID, Adressnummer, Kurzname, Name, VornameZusatz1, 
			Zusatz2, Strasse, Plz, Ort, Sprachcode, Adresscode, 
			Bemerkung1, Bemerkung2, Bemerkung3, EMail,
			'' As "MA.ID", '' As "MA.Mitarbeiternr", '' As "MA.Anrede", 
			'' As "MA.Name", '' As "MA.Vorname", '' As "MA.Position", '' As "MA.EMail", 
			'' As "MA.Info1", '' As "MA.Info2", '' As "MA.Info3"
	FROM DBAdressen.Adresse a 
	WHERE a.Mandant=:MandantOid AND (	
			DBUtils.StringUtils_StripPhoneNumber(a.Telefon1) like DBUtils.StringUtils_StripPhoneNumber(:telNr) OR 
			DBUtils.StringUtils_StripPhoneNumber(a.Telefon2) like DBUtils.StringUtils_StripPhoneNumber(:telNr) OR 
			DBUtils.StringUtils_StripPhoneNumber(a.Mobil) like DBUtils.StringUtils_StripPhoneNumber(:telNr) OR 
			DBUtils.StringUtils_StripPhoneNumber(a.Fax) like DBUtils.StringUtils_StripPhoneNumber(:telNr)
		)]]></SqlQuery>
</Query>

<Query name="GetAdressIdsByKundenkatCode">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID FROM DBAdressen.Adresse WHERE Mandant = :MandantOid 
		AND Kundenkategorie->Code = :Code]]></SqlQuery>
</Query>

<Query name="GetAdressIdsByGebiet">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID FROM DBAdressen.Adresse WHERE Mandant = :MandantOid 
		AND Gebietscode->Code = :Code]]></SqlQuery>
</Query>

<Query name="GetAdressIdsByPreiskatCode">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID FROM DBAdressen.Adresse WHERE Mandant = :MandantOid 
		AND Preiskategorie->Code = :Code]]></SqlQuery>
</Query>

<Query name="GetAdressIdsBySel1">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID FROM DBAdressen.Adresse WHERE Mandant = :MandantOid 
		AND FreieSelektion1->Code = :Code]]></SqlQuery>
</Query>

<Query name="GetAdressIdsBySel2">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID FROM DBAdressen.Adresse WHERE Mandant = :MandantOid 
		AND FreieSelektion2->Code = :Code]]></SqlQuery>
</Query>

<Query name="GetAdressIdsByIndSel1">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID FROM DBAdressen.Adresse WHERE Mandant = :MandantOid 
		AND IndSel1->Code = :Code]]></SqlQuery>
</Query>

<Query name="GetAdressIdsByIndSel2">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID FROM DBAdressen.Adresse WHERE Mandant = :MandantOid 
		AND IndSel2->Code = :Code ORDER BY Name]]></SqlQuery>
</Query>

<Query name="GetAdressIdsByIndSel3">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID FROM DBAdressen.Adresse WHERE Mandant = :MandantOid 
		AND IndSel3->Code = :Code]]></SqlQuery>
</Query>

<Query name="GetAdressIdsByIndSel4">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID FROM DBAdressen.Adresse WHERE Mandant = :MandantOid 
		AND IndSel4->Code = :Code]]></SqlQuery>
</Query>

<Query name="GetAdressIdsByIndSel5">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID FROM DBAdressen.Adresse WHERE Mandant = :MandantOid 
		AND IndSel5->Code = :Code]]></SqlQuery>
</Query>

<Query name="GetAdressIdsByKundengrOid">
<Type>%SQLQuery</Type>
<FormalSpec>KgOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID FROM DBAdressen.Adresse WHERE Kundengruppe =:KgOid</SqlQuery>
</Query>

<Query name="GetAdressByIndSel2VonBis">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,CodeVon:%Integer,CodeBis:%Integer,MultiSel:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, IndSel2, IndSel2->Code AS IndSel2Code
		FROM DBAdressen.Adresse WHERE Mandant = :MandantOid 
		AND IndSel2->Code BETWEEN :CodeVon AND :CodeBis
		AND DBAdressen.MultiSelAdresse_GetAdrInMultiSel(%ID, :MultiSel) = 1]]></SqlQuery>
</Query>

<Query name="ListeNachAdrNrByKG">
<Type>%SQLQuery</Type>
<FormalSpec>KgOid:%String,AdrNrVon:%Integer,AdrNrBis:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Adressnummer, Anrede, EMail, Fax, Mobil, PersAnrede, Telefon1, Telefon2,
		VornameZusatz1 As AdrZeile1, ZuHanden, Web, Kurzname, Name, Plz, Ort , Strasse, Benutzername, Passwort
	FROM DBAdressen.Adresse 
	WHERE Adressnummer BETWEEN :AdrNrVon AND :AdrNrBis AND Kundengruppe =:KgOid 
	ORDER BY Kurzname</SqlQuery>
</Query>

<Query name="ListeNachKurznameVerkauf">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Kurzname:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Adressnummer, Name, VornameZusatz1, Strasse, Plz, Ort, Telefon1, Hausnummer 
	FROM DBAdressen.Adresse a
	WHERE Mandant = :MandantOid 
		AND { fn LCASE(Kurzname)} LIKE { fn LCASE(:Kurzname)} 
		AND NVL(Aktiv,0) = 1 
		AND NVL((Select AuftragErfassungInaktiv FROM DBDebiKredi.Debitor d where a.ID = d.Adresse),0) = 0
	ORDER BY Kurzname</SqlQuery>
</Query>

<Query name="ListeNachKurznameEinkauf">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Kurzname:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Adressnummer, Name, VornameZusatz1, Strasse, Plz, Ort, Telefon1, Hausnummer 
	FROM DBAdressen.Adresse a
	WHERE Mandant = :MandantOid 
		AND { fn LCASE(Kurzname)} LIKE { fn LCASE(:Kurzname)} 
		AND NVL(Aktiv,0) = 1 
		AND NVL((Select AuftragErfassungInaktiv FROM DBDebiKredi.Kreditor k where a.ID = k.Adresse),0) = 0
	ORDER BY Kurzname</SqlQuery>
</Query>

<Query name="ListeNachAdressNrVerkauf">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,AdressNr:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Adressnummer, Name, VornameZusatz1, Strasse, Plz, Ort, Telefon1, Hausnummer 
	FROM DBAdressen.Adresse a
	WHERE Mandant = :MandantOid 
		AND Adressnummer LIKE :AdressNr 
		AND NVL(Aktiv,0) = 1 
		AND NVL((Select AuftragErfassungInaktiv FROM DBDebiKredi.Debitor d where a.ID = d.Adresse),0) = 0
	ORDER BY Adressnummer</SqlQuery>
</Query>

<Query name="ListeNachAdressNrEinkauf">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,AdressNr:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Adressnummer, Name, VornameZusatz1, Strasse, Plz, Ort, Telefon1, Hausnummer 
	FROM DBAdressen.Adresse a
	WHERE Mandant = :MandantOid 
		AND Adressnummer LIKE :AdressNr 
		AND NVL(Aktiv,0) = 1 
		AND NVL((Select AuftragErfassungInaktiv FROM DBDebiKredi.Kreditor k where a.ID = k.Adresse),0) = 0
	ORDER BY Adressnummer</SqlQuery>
</Query>

<Query name="ListeRootEintraegeKurzname">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT DISTINCT {fn LEFT({fn UCASE(Kurzname)},1)} As Ziffer 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid AND (({fn ASCII({fn UCASE(Kurzname)})} > 47 AND {fn ASCII({fn UCASE(Kurzname)})} < 58) OR ({fn ASCII({fn UCASE(Kurzname)})} >= 65 AND {fn ASCII({fn UCASE(Kurzname)})} <= 90)) 
	ORDER BY Ziffer]]></SqlQuery>
</Query>

<Query name="ListeNachKurznameByBuchstaben">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Letter:%String,OnlyAktive:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Adresscode, Kurzname, Name, VornameZusatz1, Plz, Ort 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid AND {fn LEFT({fn UCASE(Kurzname)},1)} = :Letter AND (:OnlyAktive = 0 OR Aktiv = 1) 
	ORDER By Kurzname, Name, Ort, VornameZusatz1</SqlQuery>
</Query>

<Query name="ListeKurznameNachLetterA">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,OnlyAktive:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, Adresscode, Kurzname, Name, VornameZusatz1, Plz, Ort 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid AND (ASCII({fn UCASE(Kurzname)}) = 65 OR (ASCII({fn UCASE(Kurzname)}) >=192 AND ASCII({fn UCASE(Kurzname)}) <=198)) AND (:OnlyAktive = 0 OR Aktiv = 1) 
	ORDER BY Kurzname, Name, Ort, VornameZusatz1]]></SqlQuery>
</Query>

<Query name="ListeKurznameNachLetterE">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,OnlyAktive:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, Adresscode, Kurzname, Name, VornameZusatz1, Plz, Ort 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid AND ({fn ASCII({fn UCASE(Kurzname)})} = 69 OR (ASCII({fn UCASE(Kurzname)}) >=200 AND ASCII({fn UCASE(Kurzname)}) <=203)) AND (:OnlyAktive = 0 OR Aktiv = 1) 
	ORDER BY Kurzname, Name, Ort, VornameZusatz1]]></SqlQuery>
</Query>

<Query name="ListeKurznameNachLetterI">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,OnlyAktive:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, Adresscode, Kurzname, Name, VornameZusatz1, Plz, Ort 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid AND ({fn ASCII({fn UCASE(Kurzname)})} = 73 OR (ASCII({fn UCASE(Kurzname)}) >=204 AND ASCII({fn UCASE(Kurzname)}) <=207)) AND (:OnlyAktive = 0 OR Aktiv = 1) 
	ORDER BY Kurzname, Name, Ort, VornameZusatz1]]></SqlQuery>
</Query>

<Query name="ListeKurznameNachLetterO">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,OnlyAktive:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, Adresscode, Kurzname, Name, VornameZusatz1, Plz, Ort 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid AND ({fn ASCII({fn UCASE(Kurzname)})} = 79 OR (ASCII({fn UCASE(Kurzname)}) >=210 AND ASCII({fn UCASE(Kurzname)}) <=214)) AND (:OnlyAktive = 0 OR Aktiv = 1) 
	ORDER BY Kurzname, Name, Ort, VornameZusatz1]]></SqlQuery>
</Query>

<Query name="ListeKurznameNachLetterU">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,OnlyAktive:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, Adresscode, Kurzname, Name, VornameZusatz1, Plz, Ort 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid AND ({fn ASCII({fn UCASE(Kurzname)})} = 85 OR (ASCII({fn UCASE(Kurzname)}) >=217 AND ASCII({fn UCASE(Kurzname)}) <=220)) AND (:OnlyAktive = 0 OR Aktiv = 1) 
	ORDER BY Kurzname, Name, Ort, VornameZusatz1]]></SqlQuery>
</Query>

<Query name="ListeKurznameNachNummern">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,OnlyAktive:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, Adresscode, Kurzname, Name, VornameZusatz1, Plz, Ort 
	FROM DBAdressen.Adresse 
	WHERE Mandant = :MandantOid AND ({fn ASCII({fn UCASE(Kurzname)})} > 47 AND {fn ASCII({fn UCASE(Kurzname)})} < 58) AND (:OnlyAktive = 0 OR Aktiv = 1) 
	ORDER BY Kurzname, Name, Ort, VornameZusatz1]]></SqlQuery>
</Query>

<Query name="ListeNachAdrNr">
<Type>%SQLQuery</Type>
<FormalSpec>AdrNrVon:%Integer,AdrNrBis:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, 
			Adressnummer, 
			Anrede, 
			EMail, 
			Fax, 
			Mobil, 
			PersAnrede, 
			Telefon1, 
			Telefon2,
			VornameZusatz1, 
			ZuHanden, 
			Web, 
			Kurzname, 
			Name, 
			Plz, 
			Ort, 
			Strasse
		FROM DBAdressen.Adresse 
		WHERE Adressnummer BETWEEN :AdrNrVon AND :AdrNrBis 
		ORDER BY Adressnummer</SqlQuery>
</Query>

<Query name="ListeDublettenkontrolle">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, Adressnummer, Telefon1, VornameZusatz1, Name, Plz, Ort, AdressNrAlt
	FROM DBAdressen.Adresse
	WHERE Mandant = :MandantOid AND
		AdressNrAlt IN(
			SELECT  AdressNrAlt 
           	FROM DBAdressen.Adresse 
           	WHERE Mandant = :MandantOid	AND AdressNrAlt <> ''
 			GROUP BY AdressNrAlt
			HAVING (COUNT(AdressNrAlt) > 1))
	ORDER BY AdressNrAlt]]></SqlQuery>
</Query>

<Query name="ListeNachAdrCode">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Adresscode:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID
	FROM DBAdressen.Adresse
	WHERE Mandant = :MandantOid
	AND Adresscode = :Adresscode</SqlQuery>
</Query>

<Query name="ListeAlleAnreden">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT Anrede
	FROM DBAdressen.Adresse
	WHERE Mandant = :MandantOid
	GROUP BY Anrede</SqlQuery>
</Query>

<Query name="GetEntryByAdrNrAlt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,AdrNrAlt:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Adressnummer, Name, Plz, Ort, Kurzname, Strasse, Hausnummer, AdressNrAlt
	FROM DBAdressen.Adresse
	WHERE Mandant = :MandantOid	AND AdressNrAlt %STARTSWITH :AdrNrAlt
	ORDER BY Adressnummer</SqlQuery>
</Query>

<Query name="ListeGrid">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, 
			Adressnummer, 
			Kurzname, 
	       	Name, VornameZusatz1,
	       	(Adressnummer || ' - ' || DBAdressen.Adresse_GetName(Adresscode, Name, VornameZusatz1, 0)) As DisplayText,
	       	(Adressnummer || ' - ' || Kurzname) As DisplayKurzName
	FROM DBAdressen.Adresse
	WHERE Mandant = :MandantOid
	ORDER BY Adressnummer</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.BesuchsRapportAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61760,38934.275329</TimeCreated>

<Query name="ListeKopf">
<Type>%SQLQuery</Type>
<FormalSpec>AdresseOid:%String,MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, 
			Nummer, TO_CHAR(Erfassung, 'DD.MM.YYYY') as Erfassung, TO_CHAR(Nachfassen, 'DD.MM.YYYY') as Nachfassen,
			Sachbearbeiter->Name || ' ' || Sachbearbeiter->Vorname as "Sachbearbeiter",0 AS Typ,
			DBAdressen_SD.StatusBesuch_GetTextClass(Status->ID, :MandantOid, :Lang) As StatusText,
			DBAdressen_SD.Prioritaet_GetTextClass(Prioritaet->ID, :MandantOid, :Lang) As PrioritaetText
	FROM DBAdressen.Besuchsrapport
	WHERE Adresse = :AdresseOid
	ORDER BY Nummer]]></SqlQuery>
</Query>

<Query name="ListeDetail">
<Type>%SQLQuery</Type>
<FormalSpec>AdresseOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Bemerkung, 1 AS Typ, ID As KopfID
	FROM DBAdressen.Besuchsrapport
	WHERE Adresse = :AdresseOid
	ORDER BY Nummer</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>VonAdresse:%String,BisAdresse:%String,Sachbearbeiter:%String,Status:%String,Prio:%String,VonDatum:%Date,BisDatum:%Date,MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT Nummer, Erfassung, Nachfassen, 
			Sachbearbeiter->Name as "Sachbearbeiter.Name", Sachbearbeiter->Vorname as "Sachbearbeiter.Vorname",
			Adresse->Name as "Adresse.Name", Adresse->Strasse as "Adresse.Strasse", Adresse->Plz as "Adresse.Plz", Adresse->Ort as "Adresse.Ort",
			Adresse->Adressnummer as "Adresse.Adressnummer",
			DBAdressen_SD.StatusBesuch_GetTextClass(Status->ID, :MandantOid, :Lang) As Status,
			DBAdressen_SD.Prioritaet_GetTextClass(Prioritaet->ID, :MandantOid, :Lang) As Prio,
			Adresse->Hausnummer as "Adresse.Hausnummer",
			Bemerkung
	FROM DBAdressen.Besuchsrapport
	WHERE Adresse->Mandant = :MandantOid
			AND (Adresse->Adressnummer BETWEEN :VonAdresse AND :BisAdresse)
			AND (Sachbearbeiter = :Sachbearbeiter OR :Sachbearbeiter = '')
			AND (Status = :Status OR :Status = '')
			AND (Prioritaet = :Prio OR :Prio = '')
			AND Nachfassen BETWEEN {d :VonDatum} AND {d :BisDatum}
	ORDER BY Adresse->Adressnummer]]></SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.BrancheAdresseAF">
<Description>
</Description>
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61030,56668.596642</TimeCreated>

<Query name="GetBranchenByAdresse">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,AdressOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID As "ID", Branche->ID As "BrancheId" FROM DBAdressen.BrancheAdresse WHERE Branche->AktMandant = :MandantOid AND Adresse = :AdressOid ORDER BY Branche->Kuerzel]]></SqlQuery>
</Query>

<Query name="GetValueByBrancheAdresse">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,AdressOid:%String,BrancheOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID FROM DBAdressen.BrancheAdresse WHERE Branche->AktMandant = :MandantOid AND Adresse = :AdressOid AND Branche = :BrancheOid ORDER BY Branche->Kuerzel]]></SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.DokumentAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>62340,35617.861858</TimeCreated>

<Query name="ListeNachTyp">
<Type>%SQLQuery</Type>
<FormalSpec>DokTypOid:%String,UserId:%String,UserNr:%String,IsSupport:%Boolean,MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, Bezeichnung, Bemerkung, Dokumententyp, 
		DBAdressen_SD.Dokumententyp_GetBezeichnungClass(Dokumententyp->ID, :MandantOid, :Lang) As DokumententypText, 
		Dokumententyp->Nummer as DokumententypNr, 
		DateiTyp, Erfassungsdatum, Nachfassdatum, 
		Status, DBAdressen_SD.Status_GetStatusTextClass(Status->ID, :MandantOid, :Lang) As StatusText, 
		Status->Code as StatusCode, SachbearbeiterNr, Sachbearbeitername, Sachbearbeitervorname
	FROM DBAdressen.Dokument d
	WHERE Dokumententyp = :DokTypOid 
	AND ((:IsSupport = 1) OR(ID IN (SELECT Dokument FROM DBAdressen.DokumentRecht 
					WHERE Dokument = d.ID AND Rolle IN (SELECT Rolle FROM DBCore.Rollenvergabe WHERE Benutzer = :UserId))) 
	OR (SachbearbeiterNr = :UserNr))
	ORDER BY Erfassungsdatum DESC]]></SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.DokumentRechtAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>62346,50308.69026</TimeCreated>

<Query name="ListeDokumentgrpGrid">
<Type>%SQLQuery</Type>
<FormalSpec>Dokumentgrp:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, Rolle, Typ, Rolle->Nr AS RolleNr,
	DBCore.Rolle_GetBezeichnungClass(Rolle, :Lang) As RolleBez
	FROM DBAdressen.DokumentRecht
	WHERE Dokumentgrp = :Dokumentgrp
	UNION ALL SELECT '' AS ID, ID AS Rolle, 0, Nr AS RolleNr,
	DBCore.Rolle_GetBezeichnungClass(ID, :Lang) As RolleBez
	FROM DBCore.Rolle
	WHERE ID NOT IN (SELECT Rolle FROM DBAdressen.DokumentRecht WHERE Dokumentgrp = :Dokumentgrp)
	ORDER BY RolleNr]]></SqlQuery>
</Query>

<Query name="ListeDokumenttypGrid">
<Type>%SQLQuery</Type>
<FormalSpec>Dokumenttyp:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, Rolle, Typ, Rolle->Nr AS RolleNr,
	DBCore.Rolle_GetBezeichnungClass(Rolle, :Lang) As RolleBez
	FROM DBAdressen.DokumentRecht
	WHERE Dokumenttyp = :Dokumenttyp
	UNION ALL SELECT '' AS ID, ID AS Rolle, 0, Nr AS RolleNr,
	DBCore.Rolle_GetBezeichnungClass(ID, :Lang) As RolleBez
	FROM DBCore.Rolle
	WHERE ID NOT IN (SELECT Rolle FROM DBAdressen.DokumentRecht WHERE Dokumenttyp = :Dokumenttyp)
	ORDER BY RolleNr]]></SqlQuery>
</Query>

<Query name="ListeDokumentGrid">
<Type>%SQLQuery</Type>
<FormalSpec>Dokument:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, Rolle, Typ, Rolle->Nr AS RolleNr,
	DBCore.Rolle_GetBezeichnungClass(Rolle, :Lang) As RolleBez
	FROM DBAdressen.DokumentRecht
	WHERE Dokument = :Dokument
	UNION ALL SELECT '' AS ID, ID AS Rolle, 0, Nr AS RolleNr,
	DBCore.Rolle_GetBezeichnungClass(ID, :Lang) As RolleBez
	FROM DBCore.Rolle
	WHERE ID NOT IN (SELECT Rolle FROM DBAdressen.DokumentRecht WHERE Dokument = :Dokument)
	ORDER BY RolleNr]]></SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.EMailAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>62348,61844.625346</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, Nummer, DBAdressen.EMail_GetBetreffClass(%ID, :MandantOid, :Lang) AS Betreff, KorrTyp, DBAdressen_SD.KorrTyp_GetKorrTypTextClass(KorrTyp->ID, :MandantOid, :Lang) As KorrTypText FROM DBAdressen.EMail WHERE AktMandant = :MandantOid ORDER BY Nummer]]></SqlQuery>
</Query>

<Query name="ListeNachCode">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, Nummer, DBAdressen.EMail_GetBetreffClass(%ID, :MandantOid, :Lang) AS Betreff, KorrTyp, DBAdressen_SD.KorrTyp_GetKorrTypTextClass(KorrTyp->ID, :MandantOid, :Lang) As KorrTypText FROM DBAdressen.EMail WHERE Nummer = :Code AND AktMandant = :MandantOid ORDER BY Nummer]]></SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.EMailAnhang">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>62348,62030.329408</TimeCreated>

<Query name="ListeByMail">
<Type>%SQLQuery</Type>
<FormalSpec>EMailOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>		SELECT ID, DateiName, DateiTyp, DateiEndung FROM DBAdressen.EMailAnhang WHERE EMail = :EMailOid ORDER BY DateiName</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.KorrespondenzAF">
<Super>%Persistent</Super>
<TimeChanged>62438,40799.201577</TimeChanged>
<TimeCreated>61458,36037.2779</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID, Bezeichnung, 
 	KorrTyp, DBAdressen_SD.KorrTyp_GetKorrTypTextClass(KorrTyp->ID, :MandantOid, :Lang) As KorrTypText, KorrTyp->Code as KorrTypCode,
	DokumentTyp, Erfassungsdatum, Nachfassdatum, 
	Status, DBAdressen_SD.Status_GetStatusTextClass(Status->ID, :MandantOid, :Lang) As StatusText, Status->Code as StatusCode, 
 	Mitarbeiter AS Sachbearbeiter, Mitarbeiter->Name AS Name  
 FROM DBAdressen.Korrespondenz
 WHERE Adresse->Mandant = :MandantOid ORDER BY Erfassungsdatum DESC]]></SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>AdresseVon:%Integer,AdresseBis:%Integer,DatumVon:%Date,DatumBis:%Date,StatusOid:%String,NotArchiv:%Boolean,KorrTypOid:%String,MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID, Bezeichnung, Bemerkung,
	KorrTyp, DBAdressen_SD.KorrTyp_GetKorrTypTextClass(KorrTyp->ID, :MandantOid, :Lang) As KorrTypText, KorrTyp->Code as KorrTypCode, 
	DokumentTyp, Erfassungsdatum, Nachfassdatum, 
	Status, DBAdressen_SD.Status_GetStatusTextClass(Status->ID, :MandantOid, :Lang) As StatusText, Status->Code as StatusCode, 
	Adresse->Name as "Adresse.Name", Adresse->VornameZusatz1 as "Adresse.Vorname", Adresse->Strasse as "Adresse.Strasse", Adresse->Plz as "Adresse.PLZ", Adresse->Ort as "Adresse.Ort",
	Mitarbeiter AS Sachbearbeiter, Mitarbeiter->Name as Sachbearbeitername, Mitarbeiter->Vorname as Sachbearbeitervorname, Adresse->Hausnummer as "Adresse.Hausnummer"
FROM DBAdressen.Korrespondenz
WHERE Adresse->Adressnummer >= :AdresseVon and Adresse->Adressnummer <= :AdresseBis 
	and Erfassungsdatum >= {d :DatumVon} and Erfassungsdatum <= {d :DatumBis}
	and (Status = :StatusOid or :StatusOid = "")
	and (0 = :NotArchiv OR Status->Code <> DBAdressen.Konst_StatusErledigt())
	and (KorrTyp = :KorrTypOid or :KorrTypOid = "")
	and Adresse->Mandant = :MandantOid 
ORDER BY Adresse->Adressnummer ASC, Erfassungsdatum DESC]]></SqlQuery>
</Query>

<Query name="ListeNachAdresse">
<Type>%SQLQuery</Type>
<FormalSpec>AdresseOid:%String,UserId:%String,IsSupport:%Boolean,MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID, Bezeichnung, Bemerkung,
	KorrTyp, DBAdressen_SD.KorrTyp_GetKorrTypTextClass(KorrTyp->ID, :MandantOid, :Lang) As KorrTypText, KorrTyp->Code as KorrTypCode, 
	DokumentTyp, Erfassungsdatum, Nachfassdatum, 
	Status, DBAdressen_SD.Status_GetStatusTextClass(Status->ID, :MandantOid, :Lang) As StatusText, Status->Code as StatusCode, 
	Mitarbeiter AS Sachbearbeiter, Mitarbeiter->Name as Sachbearbeitername, Mitarbeiter->Vorname as Sachbearbeitervorname
FROM DBAdressen.Korrespondenz k
WHERE Adresse = :AdresseOid 
AND ((:IsSupport = 1) OR 
	(ID IN (SELECT Korrespondenz FROM DBAdressen.KorrespondenzRecht 
					WHERE Korrespondenz = k.ID AND Rolle IN (SELECT Rolle FROM DBCore.Rollenvergabe WHERE Benutzer = :UserId))) 
	OR (Mitarbeiter->Benutzer = :UserId))
ORDER BY Erfassungsdatum DESC]]></SqlQuery>
</Query>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.AF.KorrespondenzAFD</DataLocation>
<DefaultData>KorrespondenzAFDefaultData</DefaultData>
<IdLocation>^DBAdressen.AF.KorrespondenzAFD</IdLocation>
<IndexLocation>^DBAdressen.AF.KorrespondenzAFI</IndexLocation>
<StreamLocation>^DBAdressen.AF.KorrespondenzAFS</StreamLocation>
<Data name="KorrespondenzAFDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
</Data>
</Storage>
</Class>


<Class name="DBAdressen.AF.KorrespondenzRechtAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>62347,33992.363565</TimeCreated>

<Query name="ListeKorrespondenztypGrid">
<Type>%SQLQuery</Type>
<FormalSpec>Korrespondenztyp:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, Rolle, Typ, Rolle->Nr AS RolleNr,
	DBCore.Rolle_GetBezeichnungClass(Rolle, :Lang) As RolleBez
	FROM DBAdressen.KorrespondenzRecht
	WHERE Korrespondenztyp = :Korrespondenztyp
	UNION ALL SELECT '' AS ID, ID AS Rolle, 0, Nr AS RolleNr,
	DBCore.Rolle_GetBezeichnungClass(ID, :Lang) As RolleBez
	FROM DBCore.Rolle
	WHERE ID NOT IN (SELECT Rolle FROM DBAdressen.KorrespondenzRecht WHERE Korrespondenztyp = :Korrespondenztyp)
	ORDER BY RolleNr]]></SqlQuery>
</Query>

<Query name="ListeKorrespondenzGrid">
<Type>%SQLQuery</Type>
<FormalSpec>Korrespondenz:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, Rolle, Typ, Rolle->Nr AS RolleNr,
	DBCore.Rolle_GetBezeichnungClass(Rolle, :Lang) As RolleBez
	FROM DBAdressen.KorrespondenzRecht
	WHERE Korrespondenz = :Korrespondenz
	UNION ALL SELECT '' AS ID, ID AS Rolle, 0, Nr AS RolleNr,
	DBCore.Rolle_GetBezeichnungClass(ID, :Lang) As RolleBez
	FROM DBCore.Rolle
	WHERE ID NOT IN (SELECT Rolle FROM DBAdressen.KorrespondenzRecht WHERE Korrespondenz = :Korrespondenz)
	ORDER BY RolleNr]]></SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.MitarbeiterAF">
<Description>
</Description>
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61010,40905.174586</TimeCreated>

<Query name="ListeNachAdresse">
<Type>%SQLQuery</Type>
<FormalSpec>AdressOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Mitarbeiternr, Anrede, Name, Vorname, Position, TelefonDirekt, Mobil, Fax, EMail FROM DBAdressen.Mitarbeiter WHERE Adresse = :AdressOid ORDER BY Mitarbeiternr</SqlQuery>
</Query>

<Query name="ListeDruckNachAdresse">
<Type>%SQLQuery</Type>
<FormalSpec>AdressOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT TOP 6 ID, Mitarbeiternr, Anrede, Name, Vorname, Position, TelefonDirekt, Mobil, Fax, EMail FROM DBAdressen.Mitarbeiter WHERE Adresse = :AdressOid ORDER BY Mitarbeiternr</SqlQuery>
</Query>

<Query name="ListeNachOid">
<Type>%SQLQuery</Type>
<FormalSpec>Oid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Name, Vorname, TelefonDirekt FROM DBAdressen.Mitarbeiter WHERE ID = :Oid</SqlQuery>
</Query>

<Query name="GetAnzMitarbeiterNachAdresse">
<Type>%SQLQuery</Type>
<FormalSpec>AdressOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT COUNT(*) FROM DBAdressen.Mitarbeiter WHERE Adresse = :AdressOid</SqlQuery>
</Query>

<Query name="GetMaxMitarbeiterNrNachAdresse">
<Type>%SQLQuery</Type>
<FormalSpec>AdressOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT MAX(Mitarbeiternr) As MNr FROM DBAdressen.Mitarbeiter WHERE Adresse = :AdressOid</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.MitarbeiterMultiSelAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>62164,31196.69833</TimeCreated>

<Query name="GetMultiSelByMitarbeiter">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,MitarbeiterOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID As "ID", MAMultiSel->ID As "MAMultiSelId" 
FROM DBAdressen.MitarbeiterMultiSel 
WHERE MAMultiSel->AktMandant = :MandantOid AND Mitarbeiter = :MitarbeiterOid 
ORDER BY MAMultiSel->Code]]></SqlQuery>
</Query>

<Query name="GetValueByMultiSelMitarbeiter">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,MitarbeiterOid:%String,MAMultiSelOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID 
FROM DBAdressen.MitarbeiterMultiSel 
WHERE MAMultiSel->AktMandant = :MandantOid 
AND Mitarbeiter = :MitarbeiterOid 
AND MAMultiSel = :MAMultiSelOid 
ORDER BY MAMultiSel->Code]]></SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.MultiSelAdresseAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61297,67445.595368</TimeCreated>

<Query name="GetSelektionByAdresse">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,AdressOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID As "ID", IndMultiSel->ID As "SelId" FROM DBAdressen.MultiSelAdresse WHERE IndMultiSel->AktMandant = :MandantOid AND Adresse = :AdressOid ORDER BY IndMultiSel->Code]]></SqlQuery>
</Query>

<Query name="GetValueBySelektionAdresse">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,AdressOid:%String,MultiSelOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID FROM DBAdressen.MultiSelAdresse WHERE IndMultiSel->AktMandant = :MandantOid AND Adresse = :AdressOid AND IndMultiSel = :MultiSelOid ORDER BY IndMultiSel->Code]]></SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.MultiSelZAAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61920,41537.555289</TimeCreated>

<Query name="GetSelektionByZusatzAdresse">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,ZusatzAdressOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID As "ID", MultiSel->ID As "SelId" FROM DBAdressen.MultiSelZA WHERE MultiSel->AktMandant = :MandantOid AND ZusatzAdresse = :ZusatzAdressOid ORDER BY MultiSel->Code]]></SqlQuery>
</Query>

<Query name="GetValueBySelZusatzAdresse">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,ZusatzAdressOid:%String,MultiSelOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID FROM DBAdressen.MultiSelZA WHERE MultiSel->AktMandant = :MandantOid AND ZusatzAdresse = :ZusatzAdressOid AND MultiSel = :MultiSelOid ORDER BY MultiSel->Code]]></SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.PendenzAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>62115,56327.642797</TimeCreated>

<Query name="ListeUebersichtTermin">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Sachbearbeiter:%String,Status:%Integer,Lang:%String,Adresse:%String,Rolle:%String,Projekt:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[    SELECT ID,Erfassungsdatum, Termin, Sachbearbeiter, 
    Projekt, Status, Text, "" AS ProjektText,
    Sachbearbeiter->Name || ' ' || Sachbearbeiter->Vorname AS SachbearbeiterName,
    DBIntrap_SD.Projekt_GetBezeichnungClass(Projekt, :MandantOid, :Lang) AS ProjektName,
    Adresse
    FROM DBAdressen.Pendenz
    WHERE Mandant = :MandantOid
    AND ((:Sachbearbeiter = '') OR (Sachbearbeiter = :Sachbearbeiter))
    AND ((:Status = DBAdressen.Konst_PendenzStatusAlle()) 
    OR (Status = :Status) OR ((:Status = DBAdressen.Konst_PendenzStatusEfasstBearbeitung()) 
    AND ((DBAdressen.Konst_PendenzStatusErfasst() = Status) 
    OR (DBAdressen.Konst_PendenzStatusInBearbeitung() = Status)))) 
    AND ((:Adresse = '') OR (Adresse = :Adresse))
    AND ((:Rolle = '') OR (NVL((SELECT COUNT(ID) FROM DBCore.Rollenvergabe WHERE Rolle = :Rolle AND Benutzer = Sachbearbeiter->Benutzer),0) <> 0))
	AND ((:Projekt = '') OR (NVL((SELECT COUNT(ID) FROM DBIntrap_SD.Projekt WHERE Projekt = :Projekt),0) <> 0))
    ORDER BY Termin DESC]]></SqlQuery>
</Query>

<Query name="DruckUebersichtTerminNeuAlt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Sachbearbeiter:%String,Status:%Integer,Lang:%String,VonAdresseNr:%Integer,BisAdresseNr:%Integer,VonDatum:%Date,BisDatum:%Date,Rolle:%String,VonProjekt:%String,BisProjekt:%String,ProjektAlpha:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[    SELECT ID,Erfassungsdatum, Termin, Sachbearbeiter, 
    Projekt, Status, Text, "" AS ProjektText,
    Sachbearbeiter->Name || ' ' || Sachbearbeiter->Vorname AS SachbearbeiterName,
    Projekt->HauptNummer AS ProjektNr,
    DBIntrap_SD.Projekt_GetBezeichnungClass(Projekt, :MandantOid, :Lang) AS ProjektName,
    Adresse
    FROM DBAdressen.Pendenz
    WHERE Mandant = :MandantOid
    AND ((:Sachbearbeiter = '') OR (Sachbearbeiter = :Sachbearbeiter))
    AND ((:Status = DBAdressen.Konst_PendenzStatusAlle()) 
    OR (Status = :Status) OR ((:Status = DBAdressen.Konst_PendenzStatusEfasstBearbeitung()) 
    AND ((DBAdressen.Konst_PendenzStatusErfasst() = Status) 
    OR (DBAdressen.Konst_PendenzStatusInBearbeitung() = Status)))) 
    AND ((Adresse->Adressnummer BETWEEN :VonAdresseNr AND :BisAdresseNr) OR ((:VonAdresseNr <> :BisAdresseNr) AND Adresse IS NULL))
    AND Termin BETWEEN :VonDatum AND :BisDatum
    AND ((:Rolle = '') OR (NVL((SELECT COUNT(ID) FROM DBCore.Rollenvergabe WHERE Rolle = :Rolle AND Benutzer = Sachbearbeiter->Benutzer),0) <> 0))
    AND (((:ProjektAlpha = 1) AND (Projekt->Nummer BETWEEN :VonProjekt AND :BisProjekt)) 
    	OR ((:ProjektAlpha = 0) AND (+Projekt->NummerNum BETWEEN CAST(:VonProjekt AS INT) AND CAST(:BisProjekt AS INT))) 
    	OR ((:VonProjekt <> :BisProjekt) AND Projekt IS NULL))
    ORDER BY Termin DESC]]></SqlQuery>
</Query>

<Query name="DruckUebersichtDatumNeuAlt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Sachbearbeiter:%String,Status:%Integer,Lang:%String,VonAdresseNr:%Integer,BisAdresseNr:%Integer,VonDatum:%Date,BisDatum:%Date,Rolle:%String,VonProjekt:%String,BisProjekt:%String,ProjektAlpha:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[    SELECT ID,Erfassungsdatum, Termin, Sachbearbeiter, 
    Projekt, Status, Text, "" AS ProjektText,
    Sachbearbeiter->Name || ' ' || Sachbearbeiter->Vorname AS SachbearbeiterName,
    Projekt->HauptNummer AS ProjektNr,
    DBIntrap_SD.Projekt_GetBezeichnungClass(Projekt, :MandantOid, :Lang) AS ProjektName,
    Adresse
    FROM DBAdressen.Pendenz
    WHERE Mandant = :MandantOid
    AND ((:Sachbearbeiter = '') OR (Sachbearbeiter = :Sachbearbeiter))
    AND ((:Status = DBAdressen.Konst_PendenzStatusAlle()) 
    OR (Status = :Status) OR ((:Status = DBAdressen.Konst_PendenzStatusEfasstBearbeitung()) 
    AND ((DBAdressen.Konst_PendenzStatusErfasst() = Status) 
    OR (DBAdressen.Konst_PendenzStatusInBearbeitung() = Status)))) 
    AND ((Adresse->Adressnummer BETWEEN :VonAdresseNr AND :BisAdresseNr) OR ((:VonAdresseNr <> :BisAdresseNr) AND Adresse IS NULL))
    AND Erfassungsdatum BETWEEN :VonDatum AND :BisDatum
    AND ((:Rolle = '') OR (NVL((SELECT COUNT(ID) FROM DBCore.Rollenvergabe WHERE Rolle = :Rolle AND Benutzer = Sachbearbeiter->Benutzer),0) <> 0))
    AND (((:ProjektAlpha = 1) AND (Projekt->Nummer BETWEEN :VonProjekt AND :BisProjekt)) 
    	OR ((:ProjektAlpha = 0) AND (+Projekt->NummerNum BETWEEN CAST(:VonProjekt AS INT) AND CAST(:BisProjekt AS INT))) 
    	OR ((:VonProjekt <> :BisProjekt) AND Projekt IS NULL))
    ORDER BY Erfassungsdatum DESC]]></SqlQuery>
</Query>

<Query name="DruckUebersichtTerminAltNeu">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Sachbearbeiter:%String,Status:%Integer,Lang:%String,VonAdresseNr:%Integer,BisAdresseNr:%Integer,VonDatum:%Date,BisDatum:%Date,Rolle:%String,VonProjekt:%String,BisProjekt:%String,ProjektAlpha:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[    SELECT ID,Erfassungsdatum, Termin, Sachbearbeiter, 
    Projekt, Status, Text, "" AS ProjektText,
    Sachbearbeiter->Name || ' ' || Sachbearbeiter->Vorname AS SachbearbeiterName,
    Projekt->HauptNummer AS ProjektNr,
    DBIntrap_SD.Projekt_GetBezeichnungClass(Projekt, :MandantOid, :Lang) AS ProjektName,
    Adresse
    FROM DBAdressen.Pendenz
    WHERE Mandant = :MandantOid
    AND ((:Sachbearbeiter = '') OR (Sachbearbeiter = :Sachbearbeiter))
    AND ((:Status = DBAdressen.Konst_PendenzStatusAlle()) 
    OR (Status = :Status) OR ((:Status = DBAdressen.Konst_PendenzStatusEfasstBearbeitung()) 
    AND ((DBAdressen.Konst_PendenzStatusErfasst() = Status) 
    OR (DBAdressen.Konst_PendenzStatusInBearbeitung() = Status)))) 
    AND ((Adresse->Adressnummer BETWEEN :VonAdresseNr AND :BisAdresseNr) OR ((:VonAdresseNr <> :BisAdresseNr) AND Adresse IS NULL))
    AND Termin BETWEEN :VonDatum AND :BisDatum
    AND ((:Rolle = '') OR (NVL((SELECT COUNT(ID) FROM DBCore.Rollenvergabe WHERE Rolle = :Rolle AND Benutzer = Sachbearbeiter->Benutzer),0) <> 0))
    AND (((:ProjektAlpha = 1) AND (Projekt->Nummer BETWEEN :VonProjekt AND :BisProjekt)) 
    	OR ((:ProjektAlpha = 0) AND (+Projekt->NummerNum BETWEEN CAST(:VonProjekt AS INT) AND CAST(:BisProjekt AS INT))) 
    	OR ((:VonProjekt <> :BisProjekt) AND Projekt IS NULL))
    ORDER BY Termin]]></SqlQuery>
</Query>

<Query name="DruckUebersichtDatumAltNeu">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Sachbearbeiter:%String,Status:%Integer,Lang:%String,VonAdresseNr:%Integer,BisAdresseNr:%Integer,VonDatum:%Date,BisDatum:%Date,Rolle:%String,VonProjekt:%String,BisProjekt:%String,ProjektAlpha:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[    SELECT ID,Erfassungsdatum, Termin, Sachbearbeiter, 
    Projekt, Status, Text, "" AS ProjektText,
    Sachbearbeiter->Name || ' ' || Sachbearbeiter->Vorname AS SachbearbeiterName,
    Projekt->HauptNummer AS ProjektNr,
    DBIntrap_SD.Projekt_GetBezeichnungClass(Projekt, :MandantOid, :Lang) AS ProjektName,
    Adresse
    FROM DBAdressen.Pendenz
    WHERE Mandant = :MandantOid
    AND ((:Sachbearbeiter = '') OR (Sachbearbeiter = :Sachbearbeiter))
    AND ((:Status = DBAdressen.Konst_PendenzStatusAlle()) 
    OR (Status = :Status) OR ((:Status = DBAdressen.Konst_PendenzStatusEfasstBearbeitung()) 
    AND ((DBAdressen.Konst_PendenzStatusErfasst() = Status) 
    OR (DBAdressen.Konst_PendenzStatusInBearbeitung() = Status)))) 
    AND ((Adresse->Adressnummer BETWEEN :VonAdresseNr AND :BisAdresseNr) OR ((:VonAdresseNr <> :BisAdresseNr) AND Adresse IS NULL))
    AND Erfassungsdatum BETWEEN :VonDatum AND :BisDatum
    AND ((:Rolle = '') OR (NVL((SELECT COUNT(ID) FROM DBCore.Rollenvergabe WHERE Rolle = :Rolle AND Benutzer = Sachbearbeiter->Benutzer),0) <> 0))
    AND (((:ProjektAlpha = 1) AND (Projekt->Nummer BETWEEN :VonProjekt AND :BisProjekt)) 
    	OR ((:ProjektAlpha = 0) AND (+Projekt->NummerNum BETWEEN CAST(:VonProjekt AS INT) AND CAST(:BisProjekt AS INT))) 
    	OR ((:VonProjekt <> :BisProjekt) AND Projekt IS NULL))
    ORDER BY Erfassungsdatum]]></SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.RgInfoPosAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62433,37510.00256</TimeChanged>
<TimeCreated>61508,52893.862895</TimeCreated>

<Query name="ListeNachAdresse">
<Type>%SQLQuery</Type>
<FormalSpec>FaktMandantOid:%String,AgrofreshMandantOid:%String,AdressOid:%String,abDatum:%Date</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT Kopf->ID As KID,
			Kopf->AuftragsNr, 
			Kopf->Auftragsdatum, 
			Kopf->Lieferdatum,
			Kopf->LieferscheinNr, 
			Kopf->RechnungsNr, 
			Kopf->Rechnungsdatum, 
			Kopf->Text As Kopftext,
			Kopf->Typ, 
			Kopf->BetragInklMwst As KopfBetragInklMwst,
			ID,
			ArtikelNr, 
			BetragInklMwst, 
			Einheit, 
			Menge, 
			MwstBetrag, 
			PositionsNr, 
			Preis, 
			RabattBetrag, 
			Text,
			Lieferdatum As "LieferdatumPos"
		FROM DBAdressen.RgInfoPos 
		WHERE (Kopf->Mandant = :FaktMandantOid OR Kopf->Mandant = :AgrofreshMandantOid)
		AND Kopf->Adresse=:AdressOid
		AND Kopf->Rechnungsdatum>={d :abDatum}
		ORDER BY Kopf->Rechnungsdatum DESC, Kopf->RechnungsNr DESC]]></SqlQuery>
</Query>

<Query name="ListeNachAdresseTyp">
<Type>%SQLQuery</Type>
<FormalSpec>FaktMandantOid:%String,AgrofreshMandantOid:%String,AdressOid:%String,abDatum:%Date,typ:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT Kopf->ID As KID,
			Kopf->AuftragsNr, 
			Kopf->Auftragsdatum, 
			Kopf->Lieferdatum,
			Kopf->LieferscheinNr, 
			Kopf->RechnungsNr, 
			Kopf->Rechnungsdatum, 
			Kopf->Text As Kopftext,
			Kopf->Typ, 
			Kopf->BetragInklMwst As KopfBetragInklMwst,
			ID,
			ArtikelNr, 
			BetragInklMwst, 
			Einheit, 
			Menge, 
			MwstBetrag, 
			PositionsNr, 
			Preis, 
			RabattBetrag, 
			Text,
			Lieferdatum
		FROM DBAdressen.RgInfoPos 
		WHERE 
		(((:typ = DBAdressen.Konst_RgInfoRGFakt() 
		  OR :typ = DBAdressen.Konst_RgInfoBEFaktEK()) 
		  AND Kopf->Mandant = :FaktMandantOid
		) 
		OR (
		 (:typ = DBAdressen.Konst_RgInfoRGAgrofresh() 
		  OR :typ = DBAdressen.Konst_RgInfoBEAgrofreshEK())
		  AND Kopf->Mandant = :AgrofreshMandantOid
		))
		AND Kopf->Adresse=:AdressOid 
		AND Kopf->Typ=:typ 
		AND Kopf->Rechnungsdatum>={d :abDatum}
		ORDER BY Kopf->Rechnungsdatum DESC, Kopf->RechnungsNr DESC]]></SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.AdrReportAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61305,39035.485479</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Nummer, DBAdressen_SD.AdressReport_GetBezeichnungClass(%ID, :MandOid, :Lang) As Bezeichnung, Format
	FROM DBAdressen_SD.AdressReport WHERE AktMandant = :MandOid
	ORDER BY Nummer</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.AdressSelAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61313,54804.433438</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Nummer, DBAdressen_SD.Adresselektion_GetBezeichnungClass(%ID, :MandOid, :Lang) As Bezeichnung
	FROM DBAdressen_SD.Adresselektion WHERE AktMandant = :MandOid
	ORDER BY Nummer</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.AdressgruppeAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61613,31694.281638</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Adressgruppe_GetBezeichnungClass(%ID, :MandantOid, :Lang) As Bezeichnung, KurzBezeichnung FROM DBAdressen_SD.Adressgruppe WHERE AktMandant = :MandantOid ORDER BY %SQLSTRING(Code)</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Adressgruppe_GetBezeichnungClass(%ID, :MandantOid, :Lang) As wert1, KurzBezeichnung as wert2 FROM DBAdressen_SD.Adressgruppe WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeForDropDowns">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID, Code, DBAdressen_SD.Adressgruppe_GetBezeichnungClass(%ID, :MandantOid, :Lang) As Bezeichnung, KurzBezeichnung FROM DBAdressen_SD.Adressgruppe WHERE AktMandant = :MandantOid AND Code >= 10 ORDER BY Code]]></SqlQuery>
</Query>

<Query name="ListeNachCode">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Adressgruppe_GetBezeichnungClass(%ID, :MandantOid, :Lang) As Bezeichnung, KurzBezeichnung FROM DBAdressen_SD.Adressgruppe WHERE AktMandant = :MandantOid AND Code = :Code ORDER BY %SQLSTRING(Code)</SqlQuery>
</Query>

<Query name="GetEntryByNr">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Code:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Code, DBAdressen_SD.Adressgruppe_GetBezeichnungClass(%ID, :MandantOid, :Lang) As Bezeichnung, KurzBezeichnung
	FROM DBAdressen_SD.Adressgruppe
	WHERE AktMandant = :MandantOid
	AND Code %StartsWith :Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.AnredeAF">
<Description>
</Description>
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>60954,59906.490378</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Anrede_GetAnredentextClass(%ID, :MandantOid, :Lang) As Anredentext FROM DBAdressen_SD.Anrede WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Anrede_GetAnredentextClass(%ID, :MandantOid, :Lang) AS wert1, "" AS wert2 FROM DBAdressen_SD.Anrede WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeNachCode">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Anrede_GetAnredentextClass(%ID, :MandantOid, :Lang) As Anredentext FROM DBAdressen_SD.Anrede WHERE AktMandant = :MandantOid AND Code = :Code ORDER BY Code</SqlQuery>
</Query>

<Query name="GetEntryByAnrede">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Anrede:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT TOP 1 ID, Code, DBAdressen_SD.Anrede_GetAnredentextClass(%ID, :MandantOid, :Lang) As Anredentext
	FROM DBAdressen_SD.Anrede
	WHERE AktMandant = :MandantOid
	AND DBAdressen_SD.Anrede_GetAnredentextClass(%ID, :MandantOid, :Lang) LIKE :Anrede ORDER BY DBAdressen_SD.Anrede_GetAnredentextClass(%ID, :MandantOid, :Lang)</SqlQuery>
</Query>

<Query name="GetOidByAnrede">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Anrede:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT TOP 1 ID, Code
	FROM DBAdressen_SD.Anrede
	WHERE AktMandant = :MandantOid
	AND DBAdressen_SD.Anrede_GetAnredentextClass(%ID, :MandantOid, :Lang) LIKE :Anrede ORDER BY DBAdressen_SD.Anrede_GetAnredentextClass(%ID, :MandantOid, :Lang)</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.BrancheAF">
<Description>
</Description>
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>60954,59906.490378</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, Kuerzel, DBAdressen_SD.Branche_GetBranchenbeschreibungClass(%ID, :MandantOid, :Lang) AS Branchenbeschreibung, Betrag FROM DBAdressen_SD.Branche WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, Kuerzel AS wert1, DBAdressen_SD.Branche_GetBranchenbeschreibungClass(%ID, :MandantOid, :Lang) as wert2, Betrag FROM DBAdressen_SD.Branche AS Stammdate WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeNachCode">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, Kuerzel, DBAdressen_SD.Branche_GetBranchenbeschreibungClass(%ID, :MandantOid, :Lang) AS Branchenbeschreibung, Betrag FROM DBAdressen_SD.Branche WHERE Code = :Code AND AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeNachKuerzel">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Kuerzel:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, Kuerzel, DBAdressen_SD.Branche_GetBranchenbeschreibungClass(%ID, :MandantOid, :Lang) AS Branchenbeschreibung, Betrag FROM DBAdressen_SD.Branche WHERE Kuerzel = :Kuerzel AND AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.BriefanredeAF">
<Description>
</Description>
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>60954,59906.490378</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Briefanrede_GetBriefanredentextClass(%ID, :MandantOid, :Lang) As Briefanredentext FROM DBAdressen_SD.Briefanrede WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Briefanrede_GetBriefanredentextClass(%ID, :MandantOid, :Lang) As wert1, "" AS wert2 FROM DBAdressen_SD.Briefanrede AS Stammdate WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeNachCode">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Briefanrede_GetBriefanredentextClass(%ID, :MandantOid, :Lang) As Briefanredentext FROM DBAdressen_SD.Briefanrede WHERE AktMandant = :MandantOid AND Code = :Code ORDER BY Code</SqlQuery>
</Query>

<Query name="GetEntryByBriefanrede">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Briefanrede:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT TOP 1 ID, DBAdressen_SD.Briefanrede_GetBriefanredentextClass(%ID, :MandantOid, :Lang) As Briefanredentext
	FROM DBAdressen_SD.Briefanrede
	WHERE AktMandant = :MandantOid
	AND DBAdressen_SD.Briefanrede_GetBriefanredentextClass(%ID, :MandantOid, :Lang) LIKE :Briefanrede ORDER BY DBAdressen_SD.Briefanrede_GetBriefanredentextClass(%ID, :MandantOid, :Lang)</SqlQuery>
</Query>

<Query name="GetOidByBriefanrede">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Briefanrede:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT TOP 1 ID
	FROM DBAdressen_SD.Briefanrede
	WHERE AktMandant = :MandantOid
	AND DBAdressen_SD.Briefanrede_GetBriefanredentextClass(%ID, :MandantOid, :Lang) LIKE :Briefanrede ORDER BY DBAdressen_SD.Briefanrede_GetBriefanredentextClass(%ID, :MandantOid, :Lang)</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.DokumentengrpAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>62340,30604.547265</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,UserId:%String,IsSupport:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Nummer, DBAdressen_SD.Dokumentengrp_GetBezeichnungClass(%ID, :MandantOid, :Lang) As Bezeichnung
FROM DBAdressen_SD.Dokumentengrp g
WHERE AktMandant = :MandantOid 
AND ((:IsSupport = 1) OR(ID IN (SELECT Dokumentgrp FROM DBAdressen.DokumentRecht 
		WHERE Dokumentgrp = g.ID AND Rolle IN (SELECT Rolle FROM DBCore.Rollenvergabe WHERE Benutzer = :UserId))))
ORDER BY Nummer</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Nummer AS Code,
DBAdressen_SD.Dokumentengrp_GetBezeichnungClass(%ID, :MandantOid, :Lang) AS wert1, "" AS wert2
FROM DBAdressen_SD.Dokumentengrp
WHERE AktMandant = :MandantOid
ORDER BY Nummer</SqlQuery>
</Query>

<Query name="ListeNachNummer">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Nummer:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Nummer, DBAdressen_SD.Dokumentengrp_GetBezeichnungClass(%ID, :MandantOid, :Lang) As Bezeichnung
FROM DBAdressen_SD.Dokumentengrp WHERE AktMandant = :MandantOid AND Nummer = :Nummer ORDER BY Nummer</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.DokumententypAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>62339,60615.384126</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,UserId:%String,IsSupport:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Nummer, DBAdressen_SD.Dokumententyp_GetBezeichnungClass(%ID, :MandantOid, :Lang) As Bezeichnung,
Pfad, Bemerkung, Ablageart, Gruppe,
DBAdressen_SD.Dokumentengrp_GetBezeichnungClass(Gruppe, :MandantOid, :Lang) As GruppeText
FROM DBAdressen_SD.Dokumententyp t
WHERE AktMandant = :MandantOid 
AND ((:IsSupport = 1) OR(ID IN (SELECT Dokumenttyp FROM DBAdressen.DokumentRecht 
					WHERE Dokumenttyp = t.ID AND Rolle IN (SELECT Rolle FROM DBCore.Rollenvergabe WHERE Benutzer = :UserId))))
ORDER BY Nummer</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID, Nummer, Gruppe, 
DBAdressen_SD.Dokumententyp_GetBezeichnungClass(%ID, :MandantOid, :Lang) AS Bez,
DBAdressen_SD.Dokumentengrp_GetBezeichnungClass(Gruppe, :MandantOid, :Lang) AS GruppenBez,
Ablageart, Pfad, Bemerkung, Gruppe -> Nummer AS GruppenNr
FROM DBAdressen_SD.Dokumententyp
WHERE AktMandant = :MandantOid
ORDER BY Gruppe -> Nummer]]></SqlQuery>
</Query>

<Query name="ListeNachNummer">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Nummer:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Nummer, DBAdressen_SD.Dokumententyp_GetBezeichnungClass(%ID, :MandantOid, :Lang) As Bezeichnung,
Pfad, Bemerkung, Ablageart, Gruppe
FROM DBAdressen_SD.Dokumententyp WHERE AktMandant = :MandantOid AND Nummer = :Nummer ORDER BY Nummer</SqlQuery>
</Query>

<Query name="ListeByGruppe">
<Type>%SQLQuery</Type>
<FormalSpec>GruppeOid:%String,MandantOid:%String,Lang:%String,UserId:%String,IsSupport:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Nummer, DBAdressen_SD.Dokumententyp_GetBezeichnungClass(%ID, :MandantOid, :Lang) As Bezeichnung,
Pfad, Bemerkung, Ablageart, Gruppe
FROM DBAdressen_SD.Dokumententyp t
WHERE AktMandant = :MandantOid AND Gruppe = :GruppeOid
AND ((:IsSupport = 1) OR(ID IN (SELECT Dokumenttyp FROM DBAdressen.DokumentRecht 
					WHERE Dokumenttyp = t.ID AND Rolle IN (SELECT Rolle FROM DBCore.Rollenvergabe WHERE Benutzer = :UserId))))
ORDER BY Nummer</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.GebietAF">
<Description>
</Description>
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>60954,59906.490378</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Gebiet_GetGebietstextClass(%ID, :MandantOid, :Lang) As Gebietstext, DBAdressen_SD.Gebiet_GetBeschreibungClass(%ID, :MandantOid, :Lang) As Beschreibung FROM DBAdressen_SD.Gebiet WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Gebiet_GetGebietstextClass(%ID, :MandantOid, :Lang) As wert1, DBAdressen_SD.Gebiet_GetBeschreibungClass(%ID, :MandantOid, :Lang) As wert2 FROM DBAdressen_SD.Gebiet WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeNachCode">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Gebiet_GetGebietstextClass(%ID, :MandantOid, :Lang) As Gebietstext, DBAdressen_SD.Gebiet_GetBeschreibungClass(%ID, :MandantOid, :Lang) As Beschreibung FROM DBAdressen_SD.Gebiet WHERE AktMandant = :MandantOid AND Code = :Code ORDER BY Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.IndMultiSelAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61297,40474.667029</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, Kuerzel, DBAdressen_SD.IndMultiSel_GetText1Class(%ID, :MandantOid, :Lang) As Text1, 
	DBAdressen_SD.IndMultiSel_GetText2Class(%ID, :MandantOid, :Lang) As Text2 
	FROM DBAdressen_SD.IndMultiSel WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code,
DBAdressen_SD.IndMultiSel_GetText1Class(%ID, :MandantOid, :Lang) As wert1,
DBAdressen_SD.IndMultiSel_GetText2Class(%ID, :MandantOid, :Lang) As wert2 
FROM DBAdressen_SD.IndMultiSel WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.IndSel1AF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61297,36487.273185</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.IndSelektion1_GetText1Class(%ID, :MandantOid, :Lang) As Text1, 
	DBAdressen_SD.IndSelektion1_GetText2Class(%ID, :MandantOid, :Lang) As Text2, Betrag
	FROM DBAdressen_SD.IndSelektion1 WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code,
DBAdressen_SD.IndSelektion1_GetText1Class(%ID, :MandantOid, :Lang) As wert1,
DBAdressen_SD.IndSelektion1_GetText2Class(%ID, :MandantOid, :Lang) As wert2, Betrag
FROM DBAdressen_SD.IndSelektion1 WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.IndSel2AF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61297,36888.016136</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.IndSelektion2_GetText1Class(%ID, :MandantOid, :Lang) As Text1, 
	DBAdressen_SD.IndSelektion2_GetText2Class(%ID, :MandantOid, :Lang) As Text2, Betrag 
	FROM DBAdressen_SD.IndSelektion2 WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code,
DBAdressen_SD.IndSelektion2_GetText1Class(%ID, :MandantOid, :Lang) As wert1,
DBAdressen_SD.IndSelektion2_GetText2Class(%ID, :MandantOid, :Lang) As wert2, Betrag 
FROM DBAdressen_SD.IndSelektion2 WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.IndSel3AF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61297,36888.155145</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.IndSelektion3_GetText1Class(%ID, :MandantOid, :Lang) As Text1, 
	DBAdressen_SD.IndSelektion3_GetText2Class(%ID, :MandantOid, :Lang) As Text2, Betrag 
	FROM DBAdressen_SD.IndSelektion3 WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code,
DBAdressen_SD.IndSelektion3_GetText1Class(%ID, :MandantOid, :Lang) As wert1,
DBAdressen_SD.IndSelektion3_GetText2Class(%ID, :MandantOid, :Lang) As wert2, Betrag 
FROM DBAdressen_SD.IndSelektion3 WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.IndSel4AF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61297,36888.293581</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.IndSelektion4_GetText1Class(%ID, :MandantOid, :Lang) As Text1, 
	DBAdressen_SD.IndSelektion4_GetText2Class(%ID, :MandantOid, :Lang) As Text2, Betrag 
	FROM DBAdressen_SD.IndSelektion4 WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code,
DBAdressen_SD.IndSelektion4_GetText1Class(%ID, :MandantOid, :Lang) As wert1,
DBAdressen_SD.IndSelektion4_GetText2Class(%ID, :MandantOid, :Lang) As wert2, Betrag 
FROM DBAdressen_SD.IndSelektion4 WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.IndSel5AF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61438,56256.483556</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.IndSelektion5_GetText1Class(%ID, :MandantOid, :Lang) As Text1, 
	DBAdressen_SD.IndSelektion5_GetText2Class(%ID, :MandantOid, :Lang) As Text2, Betrag 
	FROM DBAdressen_SD.IndSelektion5 WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code,
DBAdressen_SD.IndSelektion5_GetText1Class(%ID, :MandantOid, :Lang) As wert1,
DBAdressen_SD.IndSelektion5_GetText2Class(%ID, :MandantOid, :Lang) As wert2, Betrag 
FROM DBAdressen_SD.IndSelektion5 WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.IndSelBoni1AF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>62130,51626.180926</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code As Nummer, DBAdressen_SD.IndSelBoni1_GetText1Class(%ID, :MandantOid, :Lang) As Text1
	FROM DBAdressen_SD.IndSelBoni1 WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code As Nr,
DBAdressen_SD.IndSelBoni1_GetText1Class(%ID, :MandantOid, :Lang) As wert1
FROM DBAdressen_SD.IndSelBoni1 WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.IndSelBoni2AF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>62130,51858.500571</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code As Nummer, DBAdressen_SD.IndSelBoni2_GetText1Class(%ID, :MandantOid, :Lang) As Text1
	FROM DBAdressen_SD.IndSelBoni2 WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code As Nr,
DBAdressen_SD.IndSelBoni2_GetText1Class(%ID, :MandantOid, :Lang) As wert1
FROM DBAdressen_SD.IndSelBoni2 WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.KorrTypAF">
<Description>
</Description>
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61445,50681.8196</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, Kuerzel, DBAdressen_SD.KorrTyp_GetKorrTypTextClass(%ID, :MandantOid, :Lang) AS Text, Nachfassen FROM DBAdressen_SD.KorrTyp WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, Kuerzel AS wert1, DBAdressen_SD.KorrTyp_GetKorrTypTextClass(%ID, :MandantOid, :Lang) as wert2, Nachfassen as wert3 FROM DBAdressen_SD.KorrTyp AS Stammdate WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeNachCode">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, Kuerzel, DBAdressen_SD.KorrTyp_GetKorrTypTextClass(%ID, :MandantOid, :Lang) AS Text, Nachfassen FROM DBAdressen_SD.KorrTyp WHERE Code = :Code AND AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeNachKuerzel">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Kuerzel:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, Kuerzel, DBAdressen_SD.KorrTyp_GetKorrTypTextClass(%ID, :MandantOid, :Lang) AS Text, Nachfassen FROM DBAdressen_SD.KorrTyp WHERE Kuerzel = :Kuerzel AND AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.KundengruppeAF">
<Description>
</Description>
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>60954,59906.490378</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Kundengruppe_GetKundengruppentextClass(%ID, :MandantOid, :Lang) As Kundengruppentext, Steuerungstyp FROM DBAdressen_SD.Kundengruppe WHERE AktMandant = :MandantOid ORDER BY %SQLSTRING(Code)</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Kundengruppe_GetKundengruppentextClass(%ID, :MandantOid, :Lang) As wert1, "" as wert2 FROM DBAdressen_SD.Kundengruppe WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeForDropDowns">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID, Code, DBAdressen_SD.Kundengruppe_GetKundengruppentextClass(%ID, :MandantOid, :Lang) As Kundengruppentext FROM DBAdressen_SD.Kundengruppe WHERE AktMandant = :MandantOid AND Code >= 10 ORDER BY Code]]></SqlQuery>
</Query>

<Query name="ListeNachCode">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Kundengruppe_GetKundengruppentextClass(%ID, :MandantOid, :Lang) As Kundengruppentext, Steuerungstyp FROM DBAdressen_SD.Kundengruppe WHERE AktMandant = :MandantOid AND Code = :Code ORDER BY %SQLSTRING(Code)</SqlQuery>
</Query>

<Query name="GetEntryByNr">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Code:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Code, DBAdressen_SD.Kundengruppe_GetKundengruppentextClass(%ID, :MandantOid, :Lang) As Kundengruppentext
	FROM DBAdressen_SD.Kundengruppe
	WHERE AktMandant = :MandantOid
	AND Code %StartsWith :Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.KundenkategorieAF">
<Description>
</Description>
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>60954,59906.490378</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID, Code, DBAdressen_SD.Kundenkategorie_GetKategorieClass(%ID, :MandantOid, :Lang) As Kategorie, VKFibuKonto->KontoNr As VKKontoNr, EKFibuKonto->KontoNr As EKKontoNr FROM DBAdressen_SD.Kundenkategorie WHERE AktMandant = :MandantOid ORDER BY Code]]></SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID, Code,DBAdressen_SD.Kundenkategorie_GetKategorieClass(%ID, :MandantOid, :Lang) AS wert1, "" as wert2, VKFibuKonto->KontoNr As VKKontoNr, EKFibuKonto->KontoNr As EKKontoNr FROM DBAdressen_SD.Kundenkategorie WHERE AktMandant = :MandantOid ORDER BY Code]]></SqlQuery>
</Query>

<Query name="ListeNachCode">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Kundenkategorie_GetKategorieClass(%ID, :MandantOid, :Lang) As Kategorie FROM DBAdressen_SD.Kundenkategorie WHERE AktMandant = :MandantOid AND Code = :Code ORDER BY Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.LieferantengrpAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>62235,34646.75594</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Lieferantengrp_GetBezeichnungClass(%ID, :MandantOid, :Lang) As Bezeichnung FROM DBAdressen_SD.Lieferantengrp WHERE AktMandant = :MandantOid ORDER BY %SQLSTRING(Code)</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Lieferantengrp_GetBezeichnungClass(%ID, :MandantOid, :Lang) As wert1, "" as wert2 FROM DBAdressen_SD.Lieferantengrp WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeForDropDowns">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID, Code, DBAdressen_SD.Lieferantengrp_GetBezeichnungClass(%ID, :MandantOid, :Lang) As Bezeichnung FROM DBAdressen_SD.Lieferantengrp WHERE AktMandant = :MandantOid AND Code >= 10 ORDER BY Code]]></SqlQuery>
</Query>

<Query name="ListeNachCode">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Lieferantengrp_GetBezeichnungClass(%ID, :MandantOid, :Lang) As Bezeichnung FROM DBAdressen_SD.Lieferantengrp WHERE AktMandant = :MandantOid AND Code = :Code ORDER BY %SQLSTRING(Code)</SqlQuery>
</Query>

<Query name="GetEntryByNr">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Code:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, Code, DBAdressen_SD.Lieferantengrp_GetBezeichnungClass(%ID, :MandantOid, :Lang) As Bezeichnung
	FROM DBAdressen_SD.Lieferantengrp
	WHERE AktMandant = :MandantOid
	AND Code %StartsWith :Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.MAMultiSelAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>62164,30432.369112</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Nummer, Code, DBAdressen_SD.MAMultiSel_GetBezeichnungClass(%ID, :MandantOid, :Lang) AS Bezeichnung
FROM DBAdressen_SD.MAMultiSel WHERE AktMandant = :MandantOid ORDER BY Nummer</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Nummer, Code AS wert1, DBAdressen_SD.MAMultiSel_GetBezeichnungClass(%ID, :MandantOid, :Lang) as wert2
FROM DBAdressen_SD.MAMultiSel AS Stammdate WHERE AktMandant = :MandantOid ORDER BY Nummer</SqlQuery>
</Query>

<Query name="ListeNachNummer">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Nummer:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Nummer, Code, DBAdressen_SD.MAMultiSel_GetBezeichnungClass(%ID, :MandantOid, :Lang) AS Bezeichnung
FROM DBAdressen_SD.MAMultiSel WHERE Nummer = :Nummer AND AktMandant = :MandantOid ORDER BY Nummer</SqlQuery>
</Query>

<Query name="ListeNachCode">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Code:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Nummer, Code, DBAdressen_SD.MAMultiSel_GetBezeichnungClass(%ID, :MandantOid, :Lang) AS Bezeichnung
FROM DBAdressen_SD.MAMultiSel WHERE Code = :Code AND AktMandant = :MandantOid ORDER BY Nummer</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.PreiskategorieAF">
<Description>
</Description>
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>60954,59906.490378</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Preiskategorie_GetKategorieClass(%ID, :MandantOid, :Lang) As Kategorie,
 DBAdressen_SD.Preiskategorie_GetBeschreibungClass(%ID, :MandantOid, :Lang) As  Beschreibung FROM DBAdressen_SD.Preiskategorie WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Preiskategorie_GetKategorieClass(%ID, :MandantOid, :Lang) AS wert1,
 DBAdressen_SD.Preiskategorie_GetBeschreibungClass(%ID, :MandantOid, :Lang) As wert2 FROM DBAdressen_SD.Preiskategorie WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeNachCode">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Preiskategorie_GetKategorieClass(%ID, :MandantOid, :Lang) As Kategorie,
DBAdressen_SD.Preiskategorie_GetBeschreibungClass(%ID, :MandantOid, :Lang) As Beschreibung FROM DBAdressen_SD.Preiskategorie WHERE AktMandant = :MandantOid AND Code = :Code ORDER BY Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.PrioritaetAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61753,31720.16595</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Prioritaet_GetTextClass(%ID, :MandantOid, :Lang) As Text FROM DBAdressen_SD.Prioritaet WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Prioritaet_GetTextClass(%ID, :MandantOid, :Lang) AS wert1, "" AS wert2 FROM DBAdressen_SD.Prioritaet WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeNachCode">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Prioritaet_GetTextClass(%ID, :MandantOid, :Lang) As Text FROM DBAdressen_SD.Prioritaet WHERE AktMandant = :MandantOid AND Code = :Code ORDER BY Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.Selektion1AF">
<Description>
</Description>
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>60954,59906.490378</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Selektion1_GetText1Class(%ID, :MandantOid, :Lang) As Text1,
DBAdressen_SD.Selektion1_GetText2Class(%ID, :MandantOid, :Lang) As Text2 FROM DBAdressen_SD.Selektion1 WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Selektion1_GetText1Class(%ID, :MandantOid, :Lang) As wert1,
 DBAdressen_SD.Selektion1_GetText2Class(%ID, :MandantOid, :Lang) As wert2 FROM DBAdressen_SD.Selektion1 WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeNachCode">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Selektion1_GetText1Class(%ID, :MandantOid, :Lang) As Text1,
 DBAdressen_SD.Selektion1_GetText2Class(%ID, :MandantOid, :Lang) As Text2 FROM DBAdressen_SD.Selektion1 WHERE AktMandant = :MandantOid AND Code = :Code ORDER BY Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.Selektion2AF">
<Description>
</Description>
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>60954,59906.490378</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Selektion2_GetText1Class(%ID, :MandantOid, :Lang) As Text1,
DBAdressen_SD.Selektion2_GetText2Class(%ID, :MandantOid, :Lang) As Text2 FROM DBAdressen_SD.Selektion2 WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Selektion2_GetText1Class(%ID, :MandantOid, :Lang) As wert1,
 DBAdressen_SD.Selektion2_GetText2Class(%ID, :MandantOid, :Lang) As wert2 FROM DBAdressen_SD.Selektion2 WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeNachCode">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Selektion2_GetText1Class(%ID, :MandantOid, :Lang) As Text1,
 DBAdressen_SD.Selektion2_GetText2Class(%ID, :MandantOid, :Lang) As Text2 FROM DBAdressen_SD.Selektion2 WHERE AktMandant = :MandantOid AND Code = :Code ORDER BY Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.StatusAF">
<Description>
</Description>
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>60954,59906.490378</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Status_GetStatustextClass(%ID, :MandantOid, :Lang) As Statustext FROM DBAdressen_SD.Status WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Status_GetStatustextClass(%ID, :MandantOid, :Lang) As wert1, "" AS wert2 FROM DBAdressen_SD.Status AS Stammdate WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeNachCode">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Status_GetStatustextClass(%ID, :MandantOid, :Lang) As Statustext FROM DBAdressen_SD.Status WHERE AktMandant = :MandantOid AND Code = :Code ORDER BY Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.StatusBesuchAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61753,50253.7471</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.StatusBesuch_GetTextClass(%ID, :MandantOid, :Lang) As Text FROM DBAdressen_SD.StatusBesuch WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.StatusBesuch_GetTextClass(%ID, :MandantOid, :Lang) AS wert1, "" AS wert2 FROM DBAdressen_SD.StatusBesuch WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeNachCode">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.StatusBesuch_GetTextClass(%ID, :MandantOid, :Lang) As Text FROM DBAdressen_SD.StatusBesuch WHERE AktMandant = :MandantOid AND Code = :Code ORDER BY Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.VertreterAF">
<Description>
</Description>
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>60954,59906.490378</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Vertreter_GetNameClass(ID, :MandantOid, :Lang) As Name,
 DBAdressen_SD.Vertreter_GetBeschreibungClass(ID, :MandantOid, :Lang) As Beschreibung FROM DBAdressen_SD.Vertreter WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Vertreter_GetNameClass(ID, :MandantOid, :Lang) As wert1,
 DBAdressen_SD.Vertreter_GetBeschreibungClass(ID, :MandantOid, :Lang) As wert2 FROM DBAdressen_SD.Vertreter WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeNachCode">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.Vertreter_GetNameClass(ID, :MandantOid, :Lang) As Name,
DBAdressen_SD.Vertreter_GetBeschreibungClass(ID, :MandantOid, :Lang) As Beschreibung FROM DBAdressen_SD.Vertreter WHERE AktMandant = :MandantOid AND Code = :Code ORDER BY Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.VorlageAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61451,30388.739439</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID, Nummer, DBAdressen_SD.Vorlage_GetBezeichnungClass(%ID, :MandantOid, :Lang) AS Text, KorrTyp, DBAdressen_SD.KorrTyp_GetKorrTypTextClass(KorrTyp->ID, :MandantOid, :Lang) As KorrTypText, DokumentTyp FROM DBAdressen_SD.Vorlage WHERE AktMandant = :MandantOid ORDER BY Nummer]]></SqlQuery>
</Query>

<Query name="ListeSerienbriefe">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID, Nummer, DBAdressen_SD.Vorlage_GetBezeichnungClass(%ID, :MandantOid, :Lang) AS Text, KorrTyp, DBAdressen_SD.KorrTyp_GetKorrTypTextClass(KorrTyp->ID, :MandantOid, :Lang) As KorrTypText, KorrTyp->Code as KorrTypCode, DokumentTyp FROM DBAdressen_SD.Vorlage WHERE AktMandant = :MandantOid and KorrTyp->Code <= DBAdressen.Konst_SerienbriefStd() ORDER BY Nummer]]></SqlQuery>
</Query>

<Query name="ListeMitgliederbriefe">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID, Nummer, DBAdressen_SD.Vorlage_GetBezeichnungClass(%ID, :MandantOid, :Lang) AS Text, KorrTyp, DBAdressen_SD.KorrTyp_GetKorrTypTextClass(KorrTyp->ID, :MandantOid, :Lang) As KorrTypTex, KorrTyp->Code as KorrTypCode, DokumentTyp FROM DBAdressen_SD.Vorlage WHERE AktMandant = :MandantOid and KorrTyp->Code = DBAdressen.Konst_SerienbriefMitglied() ORDER BY Nummer]]></SqlQuery>
</Query>

<Query name="ListeVerbandbriefe">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID, Nummer, DBAdressen_SD.Vorlage_GetBezeichnungClass(%ID, :MandantOid, :Lang) AS Text, KorrTyp, DBAdressen_SD.KorrTyp_GetKorrTypTextClass(KorrTyp->ID, :MandantOid, :Lang) As KorrTypText, KorrTyp->Code as KorrTypCode, DokumentTyp FROM DBAdressen_SD.Vorlage WHERE AktMandant = :MandantOid and KorrTyp->Code = DBAdressen.Konst_SerienbriefVerband() ORDER BY Nummer]]></SqlQuery>
</Query>

<Query name="ListeBegleitzettel">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID, Nummer, DBAdressen_SD.Vorlage_GetBezeichnungClass(%ID, :MandantOid, :Lang) AS Text, KorrTyp, DBAdressen_SD.KorrTyp_GetKorrTypTextClass(KorrTyp->ID, :MandantOid, :Lang) As KorrTypText, KorrTyp->Code as KorrTypCode, DokumentTyp FROM DBAdressen_SD.Vorlage WHERE AktMandant = :MandantOid and KorrTyp->Code = DBAdressen.Konst_Begleitzettel() ORDER BY Nummer]]></SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID, Nummer, DBAdressen_SD.Vorlage_GetBezeichnungClass(%ID, :MandantOid, :Lang) as Text, KorrTyp, DBAdressen_SD.KorrTyp_GetKorrTypTextClass(KorrTyp->ID, :MandantOid, :Lang) As KorrTypText, KorrTyp->Code as KorrTypCode, DokumentTyp FROM DBAdressen_SD.Vorlage AS Stammdaten WHERE AktMandant = :MandantOid ORDER BY Nummer]]></SqlQuery>
</Query>

<Query name="ListeNachCode">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID, Nummer, DBAdressen_SD.Vorlage_GetBezeichnungClass(%ID, :MandantOid, :Lang) AS Text, KorrTyp, DBAdressen_SD.KorrTyp_GetKorrTypTextClass(KorrTyp->ID, :MandantOid, :Lang) As KorrTypText, DokumentTyp FROM DBAdressen_SD.Vorlage WHERE Nummer = :Code AND AktMandant = :MandantOid ORDER BY Nummer]]></SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.ZAMultiSelAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61920,48980.492443</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, Kuerzel, DBAdressen_SD.ZAMultiSel_GetText1Class(%ID, :MandantOid, :Lang) As Text1, 
	DBAdressen_SD.ZAMultiSel_GetText2Class(%ID, :MandantOid, :Lang) As Text2 
	FROM DBAdressen_SD.ZAMultiSel WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code,
DBAdressen_SD.ZAMultiSel_GetText1Class(%ID, :MandantOid, :Lang) As wert1,
DBAdressen_SD.ZAMultiSel_GetText2Class(%ID, :MandantOid, :Lang) As wert2 
FROM DBAdressen_SD.ZAMultiSel WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.ZASelektion1AF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61920,39274.28928</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.ZASelektion1_GetText1Class(%ID, :MandantOid, :Lang) As Text1, 
	DBAdressen_SD.ZASelektion1_GetText2Class(%ID, :MandantOid, :Lang) As Text2
	FROM DBAdressen_SD.ZASelektion1 WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code,
DBAdressen_SD.ZASelektion1_GetText1Class(%ID, :MandantOid, :Lang) As wert1,
DBAdressen_SD.ZASelektion1_GetText2Class(%ID, :MandantOid, :Lang) As wert2
FROM DBAdressen_SD.ZASelektion1 WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.ZASelektion2AF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61920,39311.994559</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.ZASelektion2_GetText1Class(%ID, :MandantOid, :Lang) As Text1, 
	DBAdressen_SD.ZASelektion2_GetText2Class(%ID, :MandantOid, :Lang) As Text2
	FROM DBAdressen_SD.ZASelektion2 WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code,
DBAdressen_SD.ZASelektion2_GetText1Class(%ID, :MandantOid, :Lang) As wert1,
DBAdressen_SD.ZASelektion2_GetText2Class(%ID, :MandantOid, :Lang) As wert2
FROM DBAdressen_SD.ZASelektion2 WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SD.ZASelektion3AF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61920,39340.813892</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code, DBAdressen_SD.ZASelektion3_GetText1Class(%ID, :MandantOid, :Lang) As Text1, 
	DBAdressen_SD.ZASelektion3_GetText2Class(%ID, :MandantOid, :Lang) As Text2
	FROM DBAdressen_SD.ZASelektion3 WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>

<Query name="ListeDruck">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>SELECT ID, Code,
DBAdressen_SD.ZASelektion3_GetText1Class(%ID, :MandantOid, :Lang) As wert1,
DBAdressen_SD.ZASelektion3_GetText2Class(%ID, :MandantOid, :Lang) As wert2
FROM DBAdressen_SD.ZASelektion3 WHERE AktMandant = :MandantOid ORDER BY Code</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.SerienbriefAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>62348,61788.691142</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID, Nummer, DBAdressen.Serienbrief_GetBezeichnungClass(%ID, :MandantOid, :Lang) AS Text, KorrTyp, DBAdressen_SD.KorrTyp_GetKorrTypTextClass(KorrTyp->ID, :MandantOid, :Lang) As KorrTypText, DokumentTyp FROM DBAdressen.Serienbrief WHERE AktMandant = :MandantOid ORDER BY Nummer]]></SqlQuery>
</Query>

<Query name="ListeNachCode">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,Code:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID, Nummer, DBAdressen.Serienbrief_GetBezeichnungClass(%ID, :MandantOid, :Lang) AS Text, KorrTyp, DBAdressen_SD.KorrTyp_GetKorrTypTextClass(KorrTyp->ID, :MandantOid, :Lang) As KorrTypText, DokumentTyp FROM DBAdressen.Serienbrief WHERE Nummer = :Code AND AktMandant = :MandantOid ORDER BY Nummer]]></SqlQuery>
</Query>

<Query name="ListeSerienbriefe">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID, Nummer, DBAdressen.Serienbrief_GetBezeichnungClass(%ID, :MandantOid, :Lang) AS Text, KorrTyp, DBAdressen_SD.KorrTyp_GetKorrTypTextClass(KorrTyp->ID, :MandantOid, :Lang) As KorrTypText, KorrTyp->Code as KorrTypCode, DokumentTyp FROM DBAdressen.Serienbrief WHERE AktMandant = :MandantOid and KorrTyp->Code <= DBAdressen.Konst_SerienbriefStd() ORDER BY Nummer]]></SqlQuery>
</Query>

<Query name="ListeMitgliederbriefe">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID, Nummer, DBAdressen.Serienbrief_GetBezeichnungClass(%ID, :MandantOid, :Lang) AS Text, KorrTyp, DBAdressen_SD.KorrTyp_GetKorrTypTextClass(KorrTyp->ID, :MandantOid, :Lang) As KorrTypTex, KorrTyp->Code as KorrTypCode, DokumentTyp FROM DBAdressen.Serienbrief WHERE AktMandant = :MandantOid and KorrTyp->Code = DBAdressen.Konst_SerienbriefMitglied() ORDER BY Nummer]]></SqlQuery>
</Query>

<Query name="ListeVerbandbriefe">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID, Nummer, DBAdressen.Serienbrief_GetBezeichnungClass(%ID, :MandantOid, :Lang) AS Text, KorrTyp, DBAdressen_SD.KorrTyp_GetKorrTypTextClass(KorrTyp->ID, :MandantOid, :Lang) As KorrTypText, KorrTyp->Code as KorrTypCode, DokumentTyp FROM DBAdressen.Serienbrief WHERE AktMandant = :MandantOid and KorrTyp->Code = DBAdressen.Konst_SerienbriefVerband() ORDER BY Nummer]]></SqlQuery>
</Query>

<Query name="ListeBegleitzettel">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[SELECT ID, Nummer, DBAdressen.Serienbrief_GetBezeichnungClass(%ID, :MandantOid, :Lang) AS Text, KorrTyp, DBAdressen_SD.KorrTyp_GetKorrTypTextClass(KorrTyp->ID, :MandantOid, :Lang) As KorrTypText, KorrTyp->Code as KorrTypCode, DokumentTyp FROM DBAdressen.Serienbrief WHERE AktMandant = :MandantOid and KorrTyp->Code = DBAdressen.Konst_Begleitzettel() ORDER BY Nummer]]></SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.TelefonatAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61566,51621.06492</TimeCreated>

<Query name="ListeGesamt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, 
			Kopf->Adresse As "Adresse.ID",
			Kopf->Adresse->KurzName As "Adresse.Kurzname",
			Kopf->Erfasser As "Erfasser.ID",
			Kopf->Erfasser->Kurzname As "Erfasser.Kurzname",
			Kopf->Erfasser->Name || ' ' || Kopf->Erfasser->Vorname as "Erfasser.Name",
			Bearbeiter As "Bearbeiter.ID",
			Bearbeiter->Kurzname As "Bearbeiter.Kurzname",
			Bearbeiter->Name || ' ' || Bearbeiter->Vorname as "Bearbeiter.Name",
			Kopf->Erfassung,
			Erledigung,
			Meldung,
			MeldungIntern,
			Kopf->Ansprechsperson,
			Kopf->RueckrufTelefonnr,
			Kopf->NatelRueckruf,
			Eingang,
			Verrechnen,
			Erledigt,
			Beginn,
			Ende,
			Menge,
			TarifIntern,
			TarifExtern,
			BetragExtern,
			IsFirstDetail,
			CASE WHEN VerbuchtIntrap = 1 Then 'V' ELSE '' END AS VerbuchtIntrap,
			Projekt As "Projekt.ID",
			Projekt->Kurzbezeichnung As "Projekt.Kurzbezeichnung",
			Arbeitsposition->ID As "Arbeitsposition.ID",
			Arbeitsposition->Kurzbezeichnung As "Arbeitsposition.Kurzbezeichnung",
			Problemtyp As "Problemtyp.ID",
			DBIntrap_SD.Problemtyp_GetBezeichnungClass(Problemtyp, :MandantOid, :Lang) As "Problemtyp.Bezeichnung",
			Kopf->AnsprechspersMitarbeiter->ID As "AnsprechspersMitarbeiter.ID",
			Kopf->ID as "KopfID"
	FROM DBAdressen.TelefonatDetail 
	WHERE Kopf->Adresse->Mandant = :MandantOid
	ORDER BY Kopf->Erfassung, Beginn]]></SqlQuery>
</Query>

<Query name="ListeKopf">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,ErfasserOid:%String,AdresseOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, 
			Adresse As "Adresse.ID",
			DBAdressen.Adresse_GetName(Adresse->Adresscode, Adresse->Name, Adresse->VornameZusatz1, 0) || ', '||
			Adresse->PLZ || ' ' || Adresse->Ort as "DisplayText"
	FROM DBAdressen.TelefonatKopf
	WHERE Adresse->Mandant = :MandantOid AND
	(Adresse = :AdresseOid or :AdresseOid = '') AND
	(Erfasser = :ErfasserOid or :ErfasserOid = '')
	ORDER BY Erfassung]]></SqlQuery>
</Query>

<Query name="ListeKopfPerDatum">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,ErfasserOid:%String,AdresseOid:%String,PerDatum:%Date</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, 
			Adresse As "Adresse.ID",
			DBAdressen.Adresse_GetName(Adresse->Adresscode, Adresse->Name, Adresse->VornameZusatz1, 0) || ', '||
			Adresse->PLZ || ' ' || Adresse->Ort as "DisplayText"
	FROM DBAdressen.TelefonatKopf
	WHERE Adresse->Mandant = :MandantOid AND
	(Adresse = :AdresseOid or :AdresseOid = '') AND
	(Erfasser = :ErfasserOid or :ErfasserOid = '') AND
	Erfassung = :PerDatum
	ORDER BY Erfassung]]></SqlQuery>
</Query>

<Query name="ListeKopfAbDatum">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,ErfasserOid:%String,AdresseOid:%String,BisDatum:%Date</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, 
			Adresse As "Adresse.ID",
			DBAdressen.Adresse_GetName(Adresse->Adresscode, Adresse->Name, Adresse->VornameZusatz1, 0) || ', '||
			Adresse->PLZ || ' ' || Adresse->Ort as "DisplayText"
	FROM DBAdressen.TelefonatKopf
	WHERE Adresse->Mandant = :MandantOid AND
	(Adresse = :AdresseOid or :AdresseOid = '') AND
	(Erfasser = :ErfasserOid or :ErfasserOid = '') AND
	 Erfassung >= :BisDatum
	ORDER BY Erfassung]]></SqlQuery>
</Query>

<Query name="ListeSelektion">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,BenutzerOid:%String,ErfasserOid:%String,AdresseOid:%String,Erledigte:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, 
			Kopf->Adresse As "Adresse.ID",
			Kopf->Adresse->KurzName As "Adresse.Kurzname",
			Kopf->Erfasser As "Erfasser.ID",
			Kopf->Erfasser->Kurzname As "Erfasser.Kurzname",
			Kopf->Erfasser->Name || ' ' || Kopf->Erfasser->Vorname as "Erfasser.Name",
			Bearbeiter As "Bearbeiter.ID",
			Bearbeiter->Kurzname As "Bearbeiter.Kurzname",
			Bearbeiter->Name || ' ' || Bearbeiter->Vorname as "Bearbeiter.Name",
			Kopf->Erfassung,
			Erledigung,
			Meldung,
			MeldungIntern,
			Kopf->Ansprechsperson,
			Kopf->RueckrufTelefonnr,
			Kopf->NatelRueckruf,
			Eingang,
			Verrechnen,
			Erledigt,
			Beginn,
			Ende,
			Menge,
			TarifIntern,
			TarifExtern,
			BetragExtern,
			IsFirstDetail,
			CASE WHEN VerbuchtIntrap = 1 Then 'V' ELSE '' END AS VerbuchtIntrap,
			Projekt As "Projekt.ID",
			Projekt->Kurzbezeichnung As "Projekt.Kurzbezeichnung",
			Arbeitsposition->ID As "Arbeitsposition.ID",
			Arbeitsposition->Kurzbezeichnung As "Arbeitsposition.Kurzbezeichnung",
			Problemtyp As "Problemtyp.ID",
			DBIntrap_SD.Problemtyp_GetBezeichnungClass(Problemtyp, :MandantOid, :Lang) As "Problemtyp.Bezeichnung",
			Kopf->AnsprechspersMitarbeiter->ID As "AnsprechspersMitarbeiter.ID",
			Kopf->ID as "KopfID"
	FROM DBAdressen.TelefonatDetail 
	WHERE Kopf->Adresse->Mandant = :MandantOid and 
	(Kopf->Adresse = :AdresseOid or :AdresseOid = '') and
	(Bearbeiter = :BenutzerOid or :BenutzerOid = '') and
	(Kopf->Erfasser = :ErfasserOid or :ErfasserOid = '') and
	(Erledigt = 0 or :Erledigte = 1 or DBAdressen.TelefonatKopf_HasOpenDetails(Kopf, :BenutzerOid, :ErfasserOid) = 1)
	ORDER BY Kopf->Erfassung, Beginn]]></SqlQuery>
</Query>

<Query name="ListeSelektionPerDatum">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,BenutzerOid:%String,ErfasserOid:%String,PerDatum:%Date,AdresseOid:%String,Erledigte:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, 
			Kopf->Adresse As "Adresse.ID",
			Kopf->Adresse->KurzName As "Adresse.Kurzname",
			Kopf->Erfasser As "Erfasser.ID",
			Kopf->Erfasser->Kurzname As "Erfasser.Kurzname",
			Kopf->Erfasser->Name || ' ' || Kopf->Erfasser->Vorname as "Erfasser.Name",
			Bearbeiter As "Bearbeiter.ID",
			Bearbeiter->Kurzname As "Bearbeiter.Kurzname",
			Bearbeiter->Name || ' ' || Bearbeiter->Vorname as "Bearbeiter.Name",
			Kopf->Erfassung,
			Erledigung,
			Meldung,
			MeldungIntern,
			Kopf->Ansprechsperson,
			Kopf->RueckrufTelefonnr,
			Kopf->NatelRueckruf,
			Eingang,
			Verrechnen,
			Erledigt,
			Beginn,
			Ende,
			Menge,
			TarifIntern,
			TarifExtern,
			BetragExtern,
			IsFirstDetail,
			CASE WHEN VerbuchtIntrap = 1 Then 'V' ELSE '' END AS VerbuchtIntrap,
			Projekt As "Projekt.ID",
			Projekt->Kurzbezeichnung As "Projekt.Kurzbezeichnung",
			Arbeitsposition->ID As "Arbeitsposition.ID",
			Arbeitsposition->Kurzbezeichnung As "Arbeitsposition.Kurzbezeichnung",
			Problemtyp As "Problemtyp.ID",
			DBIntrap_SD.Problemtyp_GetBezeichnungClass(Problemtyp, :MandantOid, :Lang) As "Problemtyp.Bezeichnung",
			Kopf->AnsprechspersMitarbeiter->ID As "AnsprechspersMitarbeiter.ID",
			Kopf->ID as "KopfID"
	FROM DBAdressen.TelefonatDetail 
	WHERE Kopf->Adresse->Mandant = :MandantOid and 
	(Kopf->Adresse = :AdresseOid or :AdresseOid = '') and 
     Kopf->Erfassung = :PerDatum and 
	(Bearbeiter = :BenutzerOid or :BenutzerOid = '') and
	(Kopf->Erfasser = :ErfasserOid or :ErfasserOid = '') and
	(Erledigt = 0 or :Erledigte = 1 or DBAdressen.TelefonatKopf_HasOpenDetails(Kopf, :BenutzerOid, :ErfasserOid) = 1)
	ORDER BY Kopf->Erfassung, Beginn]]></SqlQuery>
</Query>

<Query name="ListeSelektionAbDatum">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,BenutzerOid:%String,ErfasserOid:%String,BisDatum:%Date,AdresseOid:%String,Erledigte:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, 
			Kopf->Adresse As "Adresse.ID",
			Kopf->Adresse->KurzName As "Adresse.Kurzname",
			Kopf->Erfasser As "Erfasser.ID",
			Kopf->Erfasser->Kurzname As "Erfasser.Kurzname",
			Kopf->Erfasser->Name || ' ' || Kopf->Erfasser->Vorname as "Erfasser.Name",
			Bearbeiter As "Bearbeiter.ID",
			Bearbeiter->Kurzname As "Bearbeiter.Kurzname",
			Bearbeiter->Name || ' ' || Bearbeiter->Vorname as "Bearbeiter.Name",
			Kopf->Erfassung,
			Erledigung,
			Meldung,
			MeldungIntern,
			Kopf->Ansprechsperson,
			Kopf->RueckrufTelefonnr,
			Kopf->NatelRueckruf,
			Eingang,
			Verrechnen,
			Erledigt,
			Beginn,
			Ende,
			Menge,
			TarifIntern,
			TarifExtern,
			BetragExtern,
			IsFirstDetail,
			CASE WHEN VerbuchtIntrap = 1 Then 'V' ELSE '' END AS VerbuchtIntrap,
			Projekt As "Projekt.ID",
			Projekt->Kurzbezeichnung As "Projekt.Kurzbezeichnung",
			Arbeitsposition->ID As "Arbeitsposition.ID",
			Arbeitsposition->Kurzbezeichnung As "Arbeitsposition.Kurzbezeichnung",
			Problemtyp As "Problemtyp.ID",
			DBIntrap_SD.Problemtyp_GetBezeichnungClass(Problemtyp, :MandantOid, :Lang) As "Problemtyp.Bezeichnung",
			Kopf->AnsprechspersMitarbeiter->ID As "AnsprechspersMitarbeiter.ID",
			Kopf->ID as "KopfID"
	FROM DBAdressen.TelefonatDetail 
	WHERE Kopf->Adresse->Mandant = :MandantOid and 
	(Kopf->Adresse = :AdresseOid or :AdresseOid = '') and 
	 Kopf->Erfassung >= :BisDatum  and 
	(Bearbeiter = :BenutzerOid or :BenutzerOid = '') and
	(Kopf->Erfasser = :ErfasserOid or :ErfasserOid = '') and
	(Erledigt = 0 or :Erledigte = 1 or DBAdressen.TelefonatKopf_HasOpenDetails(Kopf, :BenutzerOid, :ErfasserOid) = 1)
	ORDER BY Kopf->Erfassung, Beginn]]></SqlQuery>
</Query>

<Query name="ListeNichtVerbuchte">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,BenutzerOid:%String,VonDatum:%Date,BisDatum:%Date</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, 
			Kopf->Adresse As AdresseID,
			Bearbeiter As BearbeiterID,
			Kopf->Erfasser As ErfasserID,
			Kopf->Erfassung,
			Erledigung,
			Meldung,
			MeldungIntern,
			Eingang,
			Erledigt,
			Beginn,
			Ende,
			Menge,
			TarifIntern,
			TarifExtern,
			BetragExtern,
			Kategorie,
			Berechnungsart,
			IsFirstDetail,
			Projekt As ProjektID,
			Arbeitsposition->ID As ArbeitspositionID,
			Arbeitsposition->Einheit As Einheit,			
			DBIntrap_SD.Arbeitsposition_GetBezeichnungClass(Arbeitsposition->ID, :MandantOid, :Lang) As ArbeitspositionBez,
			Kopf->ID as "KopfID"
	FROM DBAdressen.TelefonatDetail
	WHERE Kopf->Adresse->Mandant = :MandantOid and 
	((Bearbeiter = :BenutzerOid) or (:BenutzerOid = '')) and
	Erledigt = 1 and (NVL(VerbuchtIntrap,0) = 0) AND
	Erledigung BETWEEN {d :VonDatum} AND {d :BisDatum}
	ORDER BY Kopf->Erfassung, Beginn]]></SqlQuery>
</Query>

<Query name="ListeQMeldungen">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,VonAdressNr:%Integer,BisAdressNr:%Integer,VonDatum:%Date,BisDatum:%Date,VonProjektNr:%String,BisProjektNr:%String,VonQMeldNr:%Integer,BisQMeldNr:%Integer,ProjektAlphaNum:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, 
			Kopf->Adresse As "Adresse.Adresse",
			Kopf->Adresse->Adressnummer As "Adresse.Adressnummer",
			Kopf->Erfassung, Meldung, MeldungIntern,
			Projekt As "Projekt.ID", Projekt->Hauptnummer As "Projekt.Nummer",
			DBIntrap_SD.Projekt_GetBezeichnungClass(Projekt, :MandantOid, :Lang) AS "Projekt.Bezeichnung",
			DBIntrap_SD.QMeldung_GetBezeichnungClass(QMeldung, :MandantOid, :Lang) AS "QMeldung.Bezeichnung",
			QMeldung->Nummer AS "QMeldung.Nummer",
			Kopf->Erfasser->Name || ' ' || Kopf->Erfasser->Vorname as "Erfasser.Name",
			Bearbeiter->Name || ' ' || Bearbeiter->Vorname as "Bearbeiter.Name"			
	FROM DBAdressen.TelefonatDetail 
	WHERE Kopf->Adresse->Mandant = :MandantOid and 
	(Kopf->Adresse->Adressnummer BETWEEN :VonAdressNr AND :BisAdressNr) and
	((Projekt->Nummer BETWEEN :VonProjektNr AND :BisProjektNr AND :ProjektAlphaNum = 1) OR
	(Projekt->NummerNum BETWEEN +:VonProjektNr AND +:BisProjektNr AND :ProjektAlphaNum = 0)) AND
	(Kopf->Erfassung BETWEEN :VonDatum AND :BisDatum) and
	(QMeldung->Nummer BETWEEN :VonQMeldNr AND :BisQMeldNr)
	ORDER BY QMeldung->Nummer, Kopf->Adresse->Adressnummer, Projekt->Nummer, Kopf->Erfassung]]></SqlQuery>
</Query>

<Query name="ListeQMeldungenDatum">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,VonAdressNr:%Integer,BisAdressNr:%Integer,VonDatum:%Date,BisDatum:%Date,VonProjektNr:%String,BisProjektNr:%String,VonQMeldNr:%Integer,BisQMeldNr:%Integer,ProjektAlphaNum:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, 
			Kopf->Adresse As "Adresse.Adresse",
			Kopf->Adresse->Adressnummer As "Adresse.Adressnummer",
			Kopf->Erfassung, Meldung, MeldungIntern,
			Projekt As "Projekt.ID", Projekt->Hauptnummer As "Projekt.Nummer",
			DBIntrap_SD.Projekt_GetBezeichnungClass(Projekt, :MandantOid, :Lang) AS "Projekt.Bezeichnung",
			DBIntrap_SD.QMeldung_GetBezeichnungClass(QMeldung, :MandantOid, :Lang) AS "QMeldung.Bezeichnung",
			QMeldung->Nummer AS "QMeldung.Nummer",
			Kopf->Erfasser->Name || ' ' || Kopf->Erfasser->Vorname as "Erfasser.Name",
			Bearbeiter->Name || ' ' || Bearbeiter->Vorname as "Bearbeiter.Name"				
	FROM DBAdressen.TelefonatDetail 
	WHERE Kopf->Adresse->Mandant = :MandantOid and 
	(Kopf->Adresse->Adressnummer BETWEEN :VonAdressNr AND :BisAdressNr) and
	((Projekt->Nummer BETWEEN :VonProjektNr AND :BisProjektNr AND :ProjektAlphaNum = 1) OR
	(Projekt->NummerNum BETWEEN +:VonProjektNr AND +:BisProjektNr AND :ProjektAlphaNum = 0)) AND
	(Kopf->Erfassung BETWEEN :VonDatum AND :BisDatum) and
	(QMeldung->Nummer BETWEEN :VonQMeldNr AND :BisQMeldNr)
	ORDER BY Kopf->Erfassung, Kopf->Adresse->Adressnummer, Projekt->Nummer]]></SqlQuery>
</Query>

<Query name="ListeQMeldungenProjekt">
<Type>%SQLQuery</Type>
<FormalSpec>MandantOid:%String,Lang:%String,VonAdressNr:%Integer,BisAdressNr:%Integer,VonDatum:%Date,BisDatum:%Date,VonProjektNr:%String,BisProjektNr:%String,VonQMeldNr:%Integer,BisQMeldNr:%Integer,ProjektAlphaNum:%Boolean</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, 
			Kopf->Adresse As "Adresse.Adresse",
			Kopf->Adresse->Adressnummer As "Adresse.Adressnummer",
			Kopf->Erfassung, Meldung, MeldungIntern,
			Projekt As "Projekt.ID", Projekt->Hauptnummer As "Projekt.Nummer",
			DBIntrap_SD.Projekt_GetBezeichnungClass(Projekt, :MandantOid, :Lang) AS "Projekt.Bezeichnung",
			DBIntrap_SD.QMeldung_GetBezeichnungClass(QMeldung, :MandantOid, :Lang) AS "QMeldung.Bezeichnung",
			QMeldung->Nummer AS "QMeldung.Nummer",
			Kopf->Erfasser->Name || ' ' || Kopf->Erfasser->Vorname as "Erfasser.Name",
			Bearbeiter->Name || ' ' || Bearbeiter->Vorname as "Bearbeiter.Name"				
	FROM DBAdressen.TelefonatDetail 
	WHERE Kopf->Adresse->Mandant = :MandantOid and 
	(Kopf->Adresse->Adressnummer BETWEEN :VonAdressNr AND :BisAdressNr) and
	((Projekt->Nummer BETWEEN :VonProjektNr AND :BisProjektNr AND :ProjektAlphaNum = 1) OR
	(Projekt->NummerNum BETWEEN +:VonProjektNr AND +:BisProjektNr AND :ProjektAlphaNum = 0)) AND
	(Kopf->Erfassung BETWEEN :VonDatum AND :BisDatum) and
	(QMeldung->Nummer BETWEEN :VonQMeldNr AND :BisQMeldNr)
	ORDER BY Projekt->Nummer, Kopf->Erfassung, Kopf->Adresse->Adressnummer]]></SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.TourDetailAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61948,57827.232799</TimeCreated>

<Query name="ListeNachGebiet">
<Type>%SQLQuery</Type>
<FormalSpec>GebietOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, PosNr, Aktiv, Adresse FROM DBAdressen.TourDetail WHERE Tour = :GebietOid ORDER BY PosNr</SqlQuery>
</Query>

<Query name="ListeNachGebietSelPosNr">
<Type>%SQLQuery</Type>
<FormalSpec>GebietOid:%String,VonPosNr:%Integer,BisPosNr:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, PosNr, Aktiv, Adresse FROM DBAdressen.TourDetail 
	WHERE Tour = :GebietOid AND PosNr between :VonPosNr AND :BisPosNr ORDER BY PosNr</SqlQuery>
</Query>

<Query name="ListeNachGebietSelPosNrDesc">
<Type>%SQLQuery</Type>
<FormalSpec>GebietOid:%String,VonPosNr:%Integer,BisPosNr:%Integer</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery>	SELECT ID, PosNr, Aktiv, Adresse FROM DBAdressen.TourDetail 
	WHERE Tour = :GebietOid AND PosNr between :VonPosNr AND :BisPosNr ORDER BY PosNr Desc</SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.AF.ZusatzAdresseAF">
<Super>%RegisteredObject</Super>
<TimeChanged>62417,30829</TimeChanged>
<TimeCreated>61928,43007.063216</TimeCreated>

<Query name="ListeByAdresse">
<Type>%SQLQuery</Type>
<FormalSpec>HauptadresseOid:%String</FormalSpec>
<SqlProc>1</SqlProc>
<SqlQuery><![CDATA[	SELECT ID, 
			Adresse->Name As Name,
			Adresse->VornameZusatz1 As Vorname,
			Adresse->Telefon1 As Telefon,
			Adresse->Fax As Fax,
			Adresse->Mobil As Mobil,			
			Adresse->Strasse As Strasse,
			Adresse->Hausnummer As Hausnummer,
			Adresse->Plz As Plz,
			Adresse->Ort As Ort,
			Adresse->Adressnummer As Adressnummer,
			Adresse->ID As AdressID
	FROM DBAdressen.ZusatzAdresse
	WHERE Hauptadresse = :HauptadresseOid
	ORDER BY Adresse->Name]]></SqlQuery>
</Query>
</Class>


<Class name="DBAdressen.Adresse">
<Description>
</Description>
<Super>%Persistent,%Populate,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40831.029014</TimeChanged>
<TimeCreated>61002,31445.52006</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Adressnummer">
<Type>%Library.Integer</Type>
<Required>1</Required>
<Parameter name="MAXVAL" value="99999999"/>
<Parameter name="MINVAL" value="1"/>
<Parameter name="POPSPEC" value="Integer(1,99999999)"/>
</Property>

<Index name="AdressnummerIndex">
<Data>%%ID,Adressnummer,Kurzname,Name,Adresscode,VornameZusatz1,Strasse,Hausnummer,Plz,Ort</Data>
<Properties>Mandant,Adressnummer</Properties>
<Unique>1</Unique>
</Index>

<Property name="AdressNrAlt">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Index name="AdressNrAltIndex">
<Data>%%ID,Adressnummer,Kurzname,Name,Adresscode,VornameZusatz1,Strasse,Hausnummer,Plz,Ort,AdressNrAlt</Data>
<Properties>Mandant,AdressNrAlt</Properties>
</Index>

<Property name="Kurzname">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Index name="KurznameIndex">
<Type>bitmap</Type>
<Properties>Kurzname:Exact</Properties>
</Index>

<Index name="KurznameMoveIndex">
<Data>%%ID,Adressnummer,Kurzname,Name,Adresscode,VornameZusatz1,Strasse,Hausnummer,Plz,Ort</Data>
<Properties>Mandant,Kurzname</Properties>
</Index>

<Property name="Anrede">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Name">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="POPSPEC" value="Company()"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Index name="NameIndex">
<Type>bitmap</Type>
<Properties>Name:Exact</Properties>
</Index>

<Index name="NameMoveIndex">
<Data>%%ID,Adressnummer,Kurzname,Name,Adresscode,VornameZusatz1,Strasse,Hausnummer,Plz,Ort</Data>
<Properties>Mandant,Name</Properties>
</Index>

<Property name="VornameZusatz1">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="POPSPEC" value="FirstName()"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Zusatz2">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Strasse">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="POPSPEC" value="Street()"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Ort">
<Type>%Library.String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="POPSPEC" value="City()"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Plz">
<Type>%Library.String</Type>
<Parameter name="MAXLEN" value="15"/>
<Parameter name="POPSPEC" value="USZip()"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="PlzInklZusatz">
<Type>%Library.String</Type>
<Parameter name="MAXLEN" value="15"/>
<Parameter name="POPSPEC" value="USZip()"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="PersAnrede">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="ZuHanden">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Telefon1">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="POPSPEC" value="USPhone()"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Telefon2">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="POPSPEC" value="USPhone()"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Fax">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="POPSPEC" value="USPhone()"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Mobil">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="POPSPEC" value="USPhone()"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="EMail">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Web">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Bemerkung1">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Bemerkung2">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Bemerkung3">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Sprachcode">
<Type>%String</Type>
<Parameter name="MAXLEN" value="2"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<UDLText name="T">
<Content><![CDATA[
//1 - Firma, 2 - Privat

]]></Content>
</UDLText>

<Property name="Adresscode">
<Type>%Library.Integer</Type>
<Parameter name="VALUELIST" value=",1,2"/>
</Property>

<Property name="Aktiv">
<Type>%Boolean</Type>
</Property>

<Property name="FreiesDatum1">
<Type>%Date</Type>
</Property>

<Property name="FreiesDatum2">
<Type>%Date</Type>
</Property>

<Property name="FreierText1">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="FreierText2">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Erfassungsdatum">
<Type>%Date</Type>
</Property>

<Property name="Bearbeitungsdatum">
<Type>%Date</Type>
</Property>

<Property name="Adressstatus">
<Type>%Library.Integer</Type>
</Property>

<Property name="Gebietscode">
<Type>DBAdressen.SD.Gebiet</Type>
<Cardinality>one</Cardinality>
<Inverse>AdresseGebietscode</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Gebietscode"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="GebietscodeIndex">
<Properties>Gebietscode</Properties>
</Index>

<Property name="Vertretercode">
<Type>DBAdressen.SD.Vertreter</Type>
<Cardinality>one</Cardinality>
<Inverse>AdresseVertretercode</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Vertretercode"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="VertretercodeIndex">
<Properties>Vertretercode</Properties>
</Index>

<Property name="Preiskategorie">
<Type>DBAdressen.SD.Preiskategorie</Type>
<Cardinality>one</Cardinality>
<Inverse>AdressePreiskategorie</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Preiskategorie"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="PreiskategorieIndex">
<Properties>Preiskategorie</Properties>
</Index>

<Property name="Kundenkategorie">
<Type>DBAdressen.SD.Kundenkategorie</Type>
<Cardinality>one</Cardinality>
<Inverse>AdresseKundenkategorie</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Kundenkategorie"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="KundenkategorieIndex">
<Properties>Kundenkategorie</Properties>
</Index>

<Property name="Kundengruppe">
<Type>DBAdressen.SD.Kundengruppe</Type>
<Cardinality>one</Cardinality>
<Inverse>AdresseKundengruppe</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Kundengruppe"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="KundengruppeIndex">
<Properties>Kundengruppe</Properties>
</Index>

<Property name="FreieSelektion1">
<Type>DBAdressen.SD.Selektion1</Type>
<Cardinality>one</Cardinality>
<Inverse>AdresseSelektion1</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="FreieSelektion1"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="FreieSelektion1Index">
<Properties>FreieSelektion1</Properties>
</Index>

<Property name="FreieSelektion2">
<Type>DBAdressen.SD.Selektion2</Type>
<Cardinality>one</Cardinality>
<Inverse>AdresseSelektion2</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="FreieSelektion2"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="FreieSelektion2Index">
<Properties>FreieSelektion2</Properties>
</Index>

<UDLText name="T">
<Content><![CDATA[
//***********************

]]></Content>
</UDLText>

<UDLText name="T">
<Content><![CDATA[
// Bearbeiter und Erfasser wurden extra nicht als Relation abgebildet

]]></Content>
</UDLText>

<UDLText name="T">
<Content><![CDATA[
// -> haben nur informativen Charakter und wÃ¼rden bei einem Datenaustausch

]]></Content>
</UDLText>

<UDLText name="T">
<Content><![CDATA[
// verloren gehen, da die Benutzerinformationen auf dem Zielsystem nicht vorhanden

]]></Content>
</UDLText>

<UDLText name="T">
<Content><![CDATA[
// wÃ¤ren

]]></Content>
</UDLText>

<UDLText name="T">
<Content><![CDATA[
//***********************

]]></Content>
</UDLText>

<Property name="BearbeiterNr">
<Type>%Library.Integer</Type>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
</Property>

<Property name="BearbeiterBenutzername">
<Type>%Library.String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="BearbeiterVorname">
<Type>%Library.String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="POPSPEC" value="FirstName()"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="BearbeiterName">
<Type>%Library.String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="POPSPEC" value="Name()"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="ErfasserNr">
<Type>%Library.Integer</Type>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
</Property>

<Property name="ErfasserBenutzername">
<Type>%Library.String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="ErfasserVorname">
<Type>%Library.String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="POPSPEC" value="FirstName()"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="ErfasserName">
<Type>%Library.String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="POPSPEC" value="Name()"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Mandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKMandant">
<Properties>Mandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="MandantIdx">
<Properties>Mandant</Properties>
</Index>

<Property name="AdresseBrancheAdresse">
<Type>DBAdressen.BrancheAdresse</Type>
<Cardinality>many</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="MitarbeiterAdresse">
<Type>DBAdressen.Mitarbeiter</Type>
<Cardinality>many</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="DebitorAdresse">
<Type>DBDebiKredi.Debitor</Type>
<Cardinality>many</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="KreditorAdresse">
<Type>DBDebiKredi.Kreditor</Type>
<Cardinality>many</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="ArtikelLieferant1">
<Type>DBAgrofresh.Artikel</Type>
<Cardinality>many</Cardinality>
<Inverse>Lieferant1</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="ArtikelLieferant2">
<Type>DBAgrofresh.Artikel</Type>
<Cardinality>many</Cardinality>
<Inverse>Lieferant2</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="ArtikelLieferant3">
<Type>DBAgrofresh.Artikel</Type>
<Cardinality>many</Cardinality>
<Inverse>Lieferant3</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="GKKunde">
<Type>DBAgrofresh.GebKontr</Type>
<Cardinality>many</Cardinality>
<Inverse>Kunde</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="VPreisLieferant">
<Type>DBAgrofresh.Preis</Type>
<Cardinality>many</Cardinality>
<Inverse>Lieferant</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="VPreisProduzent">
<Type>DBAgrofresh.Preis</Type>
<Cardinality>many</Cardinality>
<Inverse>Produzent</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="VPreisZulieferant">
<Type>DBAgrofresh.Preis</Type>
<Cardinality>many</Cardinality>
<Inverse>Zulieferant</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="KundenRabattKunde">
<Type>DBAgrofresh.KundenRabatt</Type>
<Cardinality>many</Cardinality>
<Inverse>Kunde</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="KundenStrgKunde">
<Type>DBAgrofresh.KundenStrg</Type>
<Cardinality>many</Cardinality>
<Inverse>Kunde</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="LagerbewKundeLieferant">
<Type>DBAgrofresh.Lagerbew</Type>
<Cardinality>many</Cardinality>
<Inverse>KundeLieferant</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="AuftragspositionLieferant">
<Type>DBAgrofresh.Auftragspos</Type>
<Cardinality>many</Cardinality>
<Inverse>Lieferant</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="GKLieferant">
<Type>DBAgrofreshEK.GebKontr</Type>
<Cardinality>many</Cardinality>
<Inverse>Lieferant</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="sdxName">
<Description>
Soundex-Codes for Names</Description>
<Type>%String</Type>
<Parameter name="MAXLEN" value="250"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="sdxStreet1">
<Description>
1st Soundex-Code of Street Name</Description>
<Type>%String</Type>
<Parameter name="MAXLEN" value="4"/>
</Property>

<Property name="sdxStreet2">
<Description>
2nd Soundex-Code of Street Name</Description>
<Type>%String</Type>
<Parameter name="MAXLEN" value="4"/>
</Property>

<Property name="sdxStreet3">
<Description>
3rd Soundex-Code of Street Name</Description>
<Type>%String</Type>
<Parameter name="MAXLEN" value="4"/>
</Property>

<Property name="sdxStreetNo">
<Description>
Numeric value of Street number</Description>
<Type>%String</Type>
<Parameter name="MAXLEN" value="12"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="sdxZip">
<Description>
Numeric Value of ZIP-Code</Description>
<Type>%String</Type>
<Parameter name="MAXLEN" value="12"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="sdxCity">
<Description>
Soundex-Codes of City Names</Description>
<Type>%Text</Type>
<Parameter name="MAXLEN" value="250"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Index name="idxStreet1">
<Description>
Soundex-Indexes</Description>
<Type>bitmap</Type>
<Properties>sdxStreet1</Properties>
</Index>

<Index name="idxStreet2">
<Type>bitmap</Type>
<Properties>sdxStreet2</Properties>
</Index>

<Index name="idxStreet3">
<Type>bitmap</Type>
<Properties>sdxStreet3</Properties>
</Index>

<Index name="sdxCityIndex">
<Properties>sdxCity(KEYS)</Properties>
</Index>

<Index name="idxZip">
<Type>bitmap</Type>
<Properties>sdxZip</Properties>
</Index>

<Property name="IndSel1">
<Type>DBAdressen.SD.IndSelektion1</Type>
<Cardinality>one</Cardinality>
<Inverse>AdresseIndSel1</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="IndSel1"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Property name="IndSel2">
<Type>DBAdressen.SD.IndSelektion2</Type>
<Cardinality>one</Cardinality>
<Inverse>AdresseIndSel2</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="IndSel2"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Property name="IndSel3">
<Type>DBAdressen.SD.IndSelektion3</Type>
<Cardinality>one</Cardinality>
<Inverse>AdresseIndSel3</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="IndSel3"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Property name="IndSel4">
<Type>DBAdressen.SD.IndSelektion4</Type>
<Cardinality>one</Cardinality>
<Inverse>AdresseIndSel4</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="IndSel4"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Property name="IndMultiSelAdresse">
<Type>DBAdressen.MultiSelAdresse</Type>
<Cardinality>many</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="IndDate1">
<Type>%Date</Type>
</Property>

<Property name="IndDate2">
<Type>%Date</Type>
</Property>

<Property name="IndDate3">
<Type>%Date</Type>
</Property>

<Property name="IndDate4">
<Type>%Date</Type>
</Property>

<Property name="IndDate5">
<Type>%Date</Type>
</Property>

<Property name="VerkSteuerungstyp">
<Type>DBAgrofresh.SD.StrgAuftrag</Type>
<Cardinality>one</Cardinality>
<Inverse>Kunde</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="VerkSteuerungstyp"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="VerkSteuerungstypIndex">
<Properties>VerkSteuerungstyp</Properties>
</Index>

<Property name="TransporteurAdresse">
<Type>DBAgrofresh.SD.Lieferart</Type>
<Cardinality>many</Cardinality>
<Inverse>Transporteur</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="BPLieferant">
<Type>DBAgrofreshEK.Bestellungspos</Type>
<Cardinality>many</Cardinality>
<Inverse>Lieferant</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="KundenRueckverg">
<Type>DBAgrofresh.KundenRueckverg</Type>
<Cardinality>many</Cardinality>
<Inverse>Kunde</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="KundenSpezRueckvergAktiv">
<Type>%Boolean</Type>
<InitialExpression>"0"</InitialExpression>
</Property>

<Property name="LieferantenStrgLieferant">
<Type>DBAgrofreshEK.LieferantenStrg</Type>
<Cardinality>many</Cardinality>
<Inverse>Lieferant</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="EinkSteuerungstyp">
<Type>DBAgrofreshEK.SD.StrgBest</Type>
<Cardinality>one</Cardinality>
<Inverse>Lieferant</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="EinkSteuerungstyp"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="EinkSteuerungstypIndex">
<Properties>EinkSteuerungstyp</Properties>
</Index>

<Property name="EKPreisLieferant">
<Type>DBAgrofreshEK.Preis</Type>
<Cardinality>many</Cardinality>
<Inverse>LieferantEtikette</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="EKPreisProduzent">
<Type>DBAgrofreshEK.Preis</Type>
<Cardinality>many</Cardinality>
<Inverse>Produzent</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="EKPreisZulieferant">
<Type>DBAgrofreshEK.Preis</Type>
<Cardinality>many</Cardinality>
<Inverse>Zulieferant</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="IndSel5">
<Type>DBAdressen.SD.IndSelektion5</Type>
<Cardinality>one</Cardinality>
<Inverse>AdresseIndSel5</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="IndSel5"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Property name="TransporteurEKLieferart">
<Type>DBAgrofreshEK.SD.Lieferart</Type>
<Cardinality>many</Cardinality>
<Inverse>Transporteur</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="AdressVorschlagEKLieferart">
<Type>DBAgrofreshEK.SD.Lieferart</Type>
<Cardinality>many</Cardinality>
<Inverse>AdressVorschlag</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="ChargenEingangZulieferant">
<Type>DBAgrofreshEK.ChargenEingang</Type>
<Cardinality>many</Cardinality>
<Inverse>Zulieferant</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="RgInfoKopf">
<Type>DBAdressen.RgInfoKopf</Type>
<Cardinality>many</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="LagerbewFaktKundeLiefer">
<Type>DBFakturierung.Lagerbew</Type>
<Cardinality>many</Cardinality>
<Inverse>KundeLieferant</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Method name="%OnAfterSave">
<FormalSpec>Insert:%Boolean</FormalSpec>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
	/*Set strName1=+..Name
	Set strName2=+..VornameZusatz1
	Set strName3=+..Zusatz2
	Set strName=$ZStrip(strName1_" "_ strName2_" "_strName3,"<>W")
    Set strStreet=+..Strasse
	Set strPlz=+..Plz
	&sql(SELECT Plz, Ort InTo :strZip, :strCity 
	     FROM DBCore.Postleitzahl 
	     WHERE ID=:strPlz)
	Set sdxStr1=""
	Set sdxStr2=""
	Set sdxStr3=""
	Set sdxStrNo=""
  	If (strStreet'="") {
		Set Status=##Class(DBAdressen.Soundex).sdxStreet(strStreet,.sdxStr1,.sdxStr2,.sdxStr3) 
		Set sdxStrNo=##Class(DBAdressen.Soundex).sdxStreetNo(strStreet)
    }
	If (strZip'="") {
		Set intZip=##Class(DBAdressen.Soundex).sdxZip(strZip)
	}
	If (strCity'="") {
		Set strCity=##Class(DBAdressen.Soundex).sdxCity(strCity)
	}
	If (strName'="") {
		Set strName=##Class(DBAdressen.Soundex).sdxName(strName)
	}
	Set ..sdxStreet1=sdxStr1
	Set ..sdxStreet2=sdxStr2
	Set ..sdxStreet3=sdxStr3
	Set ..sdxStreetNo= sdxStrNo
	Set ..sdxZip=intZip
	Set ..sdxCity=strCity
	Set ..sdxName=strName*/
	Quit $$$OK
]]></Implementation>
</Method>

<Trigger name="InsertAfterNewAddress">
<Code><![CDATA[    /*Set strStreet={Strasse*N}
	Set strPlz={Plz*N}
	Set strName1={Name*N}
	Set strName2={VornameZusatz1*N}
	Set strName3={Zusatz2*N}
	Set strName=$ZStrip(strName1_" "_ strName2_" "_strName3,"<>W")
	Set sdxStr1=""
	Set sdxStr2=""
	Set sdxStr3=""
	Set sdxStrNo=""
    Set ID={ID}
	&sql(SELECT Plz, Ort InTo :strZip, :strCity 
	     FROM DBCore.Postleitzahl 
	     WHERE ID=:strPlz)
  	If (strStreet'="") {
		Set Status=##Class(DBAdressen.Soundex).sdxStreet(strStreet,.sdxStr1,.sdxStr2,.sdxStr3) 
		Set sdxStrNo=##Class(DBAdressen.Soundex).sdxStreetNo(strStreet)
    }
	If (strZip'="") {
		Set intZip=##Class(DBAdressen.Soundex).sdxZip(strZip)
	}
	If (strCity'="") {
		Set strCity=##Class(DBAdressen.Soundex).sdxCity(strCity)
	}
	If (strName'="") {
		Set strName=##Class(DBAdressen.Soundex).sdxName(strName)
	}
    &sql(Update DBAdressen.Adresse 
         Set sdxStreet1=:sdxStr1, sdxStreet2=:sdxStr2, sdxStreet3=:sdxStr3, 
             sdxStreetNo=:sdxStrNo, sdxZip=:intZip, sdxCity=:strCity, 
             sdxName=:strName 
         Where ID=:ID)*/]]></Code>
<Event>INSERT</Event>
<Time>AFTER</Time>
</Trigger>

<Trigger name="UpdateAfterChangeAddress">
<Description>
Soundex-Coding after changing the value of Street</Description>
<Code><![CDATA[    /*Set strStreet={Strasse*N}
	Set strPlz={Plz*N}
	Set strName1={Name*N}
	Set strName2={VornameZusatz1*N}
	Set strName3={Zusatz2*N}
  	If ((strStreet'={Strasse*O})||
  	   ({PLZ*N}'={PLZ*O})||
  	   (strName1'={Name*O})||
  	   (strName2'={VornameZusatz1*O})||
  	   (strName3'={Zusatz2*O}))
  	{
		Set ID={ID}
		&sql(SELECT Plz, Ort InTo :strZip, :strCity 
		     FROM DBCore.Postleitzahl 
		     WHERE ID=:strPlz)
	  	If (strStreet'={Strasse*O}) {
			Set sdxStr1=""
			Set sdxStr2=""
			Set sdxStr3=""
			Set sdxStrNo=""
		  	If (strStreet'="") {
				Set Status=##Class(DBAdressen.Soundex).sdxStreet(strStreet,.sdxStr1,.sdxStr2,.sdxStr3)
				Set sdxStrNo=##Class(DBAdressen.Soundex).sdxStreetNo(strStreet)
		  	}
	    } Else {
			Set sdxStr1={sdxStreet1*O}
			Set sdxStr2={sdxStreet2*O}
			Set sdxStr3={sdxStreet3*O}
			Set sdxStrNo={sdxStreetNo*O}
	    }
		If ({PLZ*N}'={PLZ*O}) {
			Set intZip=##Class(DBAdressen.Soundex).sdxZip(strZip)
			If ((strCity'="")) {
				Set strCity=##Class(DBAdressen.Soundex).sdxCity(strCity)
			}
		} Else { 
			Set intZip={sdxZip*O} 
			Set strCity={sdxCity*O} 
		}
		If ((strName1'={Name*O})||
		    (strName2'={VornameZusatz1*O})||
		    (strName3'={Zusatz2*O}))
		{
			Set strName=$ZStrip(strName1_" "_ strName2_" "_strName3,"<>W")
			If (strName'="") {
				Set strName=##Class(DBAdressen.Soundex).sdxName(strName)
			}
  		} Else {
  			Set strName={sdxName*O}
  		}
	    &sql(Update DBAdressen.Adresse 
	         Set sdxStreet1=:sdxStr1, sdxStreet2=:sdxStr2, sdxStreet3=:sdxStr3, 
	             sdxStreetNo=:sdxStrNo, sdxZip=:intZip, sdxCity=:strCity,
	             sdxName=:strName 
	         Where ID=:ID)
  	}*/]]></Code>
<Event>UPDATE</Event>
<Time>AFTER</Time>
</Trigger>

<Method name="ReGenSoundex">
<Description>
Regeneriert alle Soundex-Felder neu</Description>
<ClassMethod>1</ClassMethod>
<Implementation><![CDATA[
	/*Set strSQL = "SELECT ID, Name, VornameZusatz1, Zusatz2, Strasse, Plz->Plz, Plz->Ort FROM DBAdressen.Adresse"
	Set rs=##class(%ResultSet).%New("%DynamicQuery:SQL")
	Set sc=rs.Prepare(strSQL)
	Set:$$$ISOK(sc) sc=rs.Execute()
	If $$$ISERR(sc) {
		Do $System.Status.DisplayError(sc)
		Quit
	}
	While rs.Next(.sc) {
		Set strName1=rs.Data("Name")
		Set strName2=rs.Data("VornameZusatz1")
		Set strName3=rs.Data("Zusatz2")
		Set strName=$ZStrip(strName1_" "_ strName2_" "_strName3,"<>W")
	    Set strStreet=rs.Data("Strasse")
		Set strZip=rs.Data("Plz")
		Set strCity=rs.Data("Ort")
		Set sdxStr1="", sdxStr2="", sdxStr3="", sdxStrNo=""
	  	If (strStreet'="") {
			Set Status=##Class(DBAdressen.Soundex).sdxStreet(strStreet,.sdxStr1,.sdxStr2,.sdxStr3) 
			Set sdxStrNo=##Class(DBAdressen.Soundex).sdxStreetNo(strStreet)
	    }
		Set:(strZip'="") intZip=##Class(DBAdressen.Soundex).sdxZip(strZip)
		Set:(strCity'="") strCity=##Class(DBAdressen.Soundex).sdxCity(strCity)
		Set:(strName'="") strName=##Class(DBAdressen.Soundex).sdxName(strName)
		Set ID=rs.Data("ID")
		Set a=..%OpenId(ID)
		Set a.sdxName=strName
		Set a.sdxStreet1=sdxStr1
		Set a.sdxStreet2=sdxStr2
		Set a.sdxStreet3=sdxStr3
		Set a.sdxStreetNo=sdxStrNo
		Set a.sdxZip=intZip
		Set a.sdxCity=strCity
		Set sc=a.%Save()
	    Quit:$$$ISERR(sc)
    }
    Do:$$$ISERR(sc) $System.Status.DisplayError(sc)*/
]]></Implementation>
</Method>

<Method name="%OnDelete">
<Description><![CDATA[
This callback method is invoked by the <METHOD>%Delete</METHOD> method to 
provide notification that the object specified by <VAR>oid</VAR> is being deleted.

<P>If this method returns an error then the object will not be deleted.
[Previously private]]]></Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>oid:%ObjectIdentity</FormalSpec>
<ReturnType>%Status</ReturnType>
<ServerOnly>1</ServerOnly>
<Implementation><![CDATA[
    set adrOid = $lg(oid,1)
    set adr = ##class(DBAdressen.Adresse).%OpenId(adrOid)
    set mandOid = adr.Mandant
    
    do ..DeleteRelations(mandOid, adrOid)	
	
	Quit $$$OK
]]></Implementation>
</Method>

<Method name="DeleteRelations">
<ClassMethod>1</ClassMethod>
<FormalSpec>mandOid:%String,adrOid:%String</FormalSpec>
<Implementation><![CDATA[
	

	// Branchen der Adresse lÃ¶schen
	set result = ##class(%Library.ResultSet).%New("DBAdressen.AF.BrancheAdresseAF:GetBranchenByAdresse")
	set branchen = result.%Execute(mandOid, adrOid)
	
	
	while result.Next(.branchen) {
		set id = result.Data("ID")
		do ##class(DBAdressen.BrancheAdresse).%DeleteId(id)
	}	
	
	
	// Mitarbeiter der Adresse lÃ¶schen
	set result = ##class(%Library.ResultSet).%New("DBAdressen.AF.MitarbeiterAF:ListeNachAdresse")
	set mitarbeiter = result.%Execute(adrOid)
	
	while result.Next(.mitarbeiter) {
		set id = result.Data("ID")
		do ##class(DBAdressen.Mitarbeiter).%DeleteId(id)
	}
	
	// Zusatzadresse der Adresse löschen
	set resultZA = ##class(%Library.ResultSet).%New("DBAdressen.AF.ZusatzAdresseAF:ListeByAdresse")
	set zusatzadr = resultZA.%Execute(adrOid)
	
	while resultZA.Next(.zusatzadr) {
		set id = resultZA.Data("ID")
		do ##class(DBAdressen.ZusatzAdresse).%DeleteId(id)
	}
	
	// Debitor suchen und probieren zu lÃ¶schen
	// falls ein Auftrag bzw. OP auf den Debitor erfasst ist, schlÃ¤gt dies fehl
	// womit dann auch die Adresse nicht gelÃ¶scht werden darf
	set debId = ""
	&sql(SELECT ID INTO :debId 
	     FROM DBDebiKredi.Debitor 
	     WHERE Adresse = :adrOid)
	if (debId '= "") {
		do ##class(DBDebiKredi.Debitor).%DeleteId(debId)	
	}
	
	// Versuch, den Kreditor zu lÃ¶schen
	set kredId = ""
	&sql(SELECT ID INTO :kredId 
	     FROM DBDebiKredi.Kreditor
	     WHERE Adresse = :adrOid)
	if (kredId '= "") {
		do ##class(DBDebiKredi.Kreditor).%DeleteId(kredId)	
	}
	
	set rgInfoKopfId = ""
	&sql(DECLARE AdrDelRgInfoKopf CURSOR FOR
		 SELECT ID INTO :rgInfoKopfId 
	     FROM DBAdressen.RgInfoKopf
	     WHERE Adresse = :adrOid)
	     
	&sql(OPEN AdrDelRgInfoKopf)
	&sql(FETCH AdrDelRgInfoKopf)
	while (SQLCODE = 0) {
		set s = ##class(DBAdressen.RgInfoKopf).%DeleteId(rgInfoKopfId)	
		if ($$$ISERR(s)) {
			w "Error: ", s, !
		}
		&sql(FETCH AdrDelRgInfoKopf)
	}
	&sql(CLOSE AdrDelRgInfoKopf)
]]></Implementation>
</Method>

<Method name="DeleteAllAdresses">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
	Set rs = ##class(%Library.ResultSet).%New("DBAdressen.AF.AdresseAF:ListeIdsGesamt")
    Set sc=rs.%Execute(MandantOid)
    
    while rs.Next(.sc) {
		set id = rs.Data("ID")
		do ##class(DBAdressen.Adresse).%DeleteId(id)
	}	
	Quit sc
	/*&sql(DELETE FROM DBAdressen.Adresse WHERE Mandant = :MandantOid)
	Quit SQLCODE*/
	
	/*Set strSQL="DELETE FROM DBAdressen.Adresse WHERE Mandant = "_MandantOid
	write strSQL
	Set rs = ##class(%Library.ResultSet).%New("%DynamicQuery:SQL")
    Do rs.Prepare(strSQL)
    Set sc=rs.Execute()*/
]]></Implementation>
</Method>

<Trigger name="trgBeforeDelete">
<Code>	write "Trigger ID: "
	Set myId = {ID}
	
	set adr = ##class(DBAdressen.Adresse).%OpenId(myId)
    set mandOid = adr.Mandant
    
	do ..DeleteRelations(mandOid, myId)</Code>
<Event>DELETE</Event>
<Foreach>row</Foreach>
</Trigger>

<Method name="MoveFirstOnAdrNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
	set MandantOid = " "_MandantOid
	set adr = $Order(^DBAdressen.AdresseI("AdressnummerIndex",MandantOid,""),1)
	if (adr '= ""){
		set id = $Order(^DBAdressen.AdresseI("AdressnummerIndex",MandantOid,adr,""),1,list)
	} else {
		Quit ""	
	}
	Quit list
]]></Implementation>
</Method>

<Method name="MoveLastOnAdrNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
	set MandantOid = " "_MandantOid
	set adr = $Order(^DBAdressen.AdresseI("AdressnummerIndex",MandantOid,""),-1)
	if (adr '= ""){
		set id = $Order(^DBAdressen.AdresseI("AdressnummerIndex",MandantOid,adr,""),-1,list)
	} else {
		Quit ""	
	}
	Quit list
]]></Implementation>
</Method>

<Method name="MoveNextOnAdrNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,AdrNr:%Integer</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
	set MandantOid = " "_MandantOid
    set nextAdrNr = $Order(^DBAdressen.AdresseI("AdressnummerIndex",MandantOid,AdrNr))
	if (nextAdrNr '= "") {
		set res = $Order(^DBAdressen.AdresseI("AdressnummerIndex",MandantOid,nextAdrNr,""),1,list)
	} else {
		set list = ##class(DBAdressen.Adresse).MoveLastOnAdrNr(MandantOid)
	}
	
	Quit list
]]></Implementation>
</Method>

<Method name="MovePrevOnAdrNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,AdrNr:%Integer</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
	set MandantOid = " "_MandantOid
    set nextAdrNr = $Order(^DBAdressen.AdresseI("AdressnummerIndex",MandantOid,AdrNr),-1)
	if (nextAdrNr '= "") {
		set res = $Order(^DBAdressen.AdresseI("AdressnummerIndex",MandantOid,nextAdrNr,""),-1,list)
	} else {
		set list = ##class(DBAdressen.Adresse).MoveFirstOnAdrNr(MandantOid)
	}
	
	Quit list
]]></Implementation>
</Method>

<Method name="MoveFirstOnKurzname">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
	set MandantOid = " "_MandantOid
	set adr = $Order(^DBAdressen.AdresseI("KurznameMoveIndex",MandantOid,""),1)
	if (adr '= ""){
		set id = $Order(^DBAdressen.AdresseI("KurznameMoveIndex",MandantOid,adr,""),1,list)
	} else {
		Quit ""	
	}
	Quit list
]]></Implementation>
</Method>

<Method name="MoveLastOnKurzname">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
	set MandantOid = " "_MandantOid
	set adr = $Order(^DBAdressen.AdresseI("KurznameMoveIndex",MandantOid,""),-1)
	if (adr '= ""){
		set id = $Order(^DBAdressen.AdresseI("KurznameMoveIndex",MandantOid,adr,""),-1,list)
	} else {
		Quit ""	
	}
	Quit list
]]></Implementation>
</Method>

<Method name="MoveNextOnKurzname">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Kurzname:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
	set MandantOid = " "_MandantOid
    set nextAdrNr = $Order(^DBAdressen.AdresseI("KurznameMoveIndex",MandantOid,Kurzname))
	if (nextAdrNr '= "") {
		set res = $Order(^DBAdressen.AdresseI("KurznameMoveIndex",MandantOid,nextAdrNr,""),1,list)
	} else {
		set list = ##class(DBAdressen.Adresse).MoveLastOnKurzname(MandantOid)
	}
	
	Quit list
]]></Implementation>
</Method>

<Method name="MovePrevOnKurzname">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Kurzname:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
	set MandantOid = " "_MandantOid
    set nextAdrNr = $Order(^DBAdressen.AdresseI("KurznameMoveIndex",MandantOid,Kurzname),-1)
	if (nextAdrNr '= "") {
		set res = $Order(^DBAdressen.AdresseI("KurznameMoveIndex",MandantOid,nextAdrNr,""),-1,list)
	} else {
		set list = ##class(DBAdressen.Adresse).MoveFirstOnKurzname(MandantOid)
	}
	
	Quit list
]]></Implementation>
</Method>

<Method name="MoveFirstOnName">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
	set MandantOid = " "_MandantOid
	set adr = $Order(^DBAdressen.AdresseI("NameMoveIndex",MandantOid,""),1)
	if (adr '= ""){
		set id = $Order(^DBAdressen.AdresseI("NameMoveIndex",MandantOid,adr,""),1,list)
	} else {
		Quit ""	
	}
	Quit list
]]></Implementation>
</Method>

<Method name="MoveLastOnName">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
	set MandantOid = " "_MandantOid
	set adr = $Order(^DBAdressen.AdresseI("NameMoveIndex",MandantOid,""),-1)
	if (adr '= ""){
		set id = $Order(^DBAdressen.AdresseI("NameMoveIndex",MandantOid,adr,""),-1,list)
	} else {
		Quit ""	
	}
	Quit list
]]></Implementation>
</Method>

<Method name="MoveNextOnName">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Kurzname:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
	set MandantOid = " "_MandantOid
    set nextAdrNr = $Order(^DBAdressen.AdresseI("NameMoveIndex",MandantOid,Kurzname))
	if (nextAdrNr '= "") {
		set res = $Order(^DBAdressen.AdresseI("NameMoveIndex",MandantOid,nextAdrNr,""),1,list)
	} else {
		set list = ##class(DBAdressen.Adresse).MoveLastOnName(MandantOid)
	}
	
	Quit list
]]></Implementation>
</Method>

<Method name="MovePrevOnName">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Kurzname:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
	set MandantOid = " "_MandantOid
    set nextAdrNr = $Order(^DBAdressen.AdresseI("NameMoveIndex",MandantOid,Kurzname),-1)
	if (nextAdrNr '= "") {
		set res = $Order(^DBAdressen.AdresseI("NameMoveIndex",MandantOid,nextAdrNr,""),-1,list)
	} else {
		set list = ##class(DBAdressen.Adresse).MoveFirstOnName(MandantOid)
	}
	
	Quit list
]]></Implementation>
</Method>

<Method name="GetAdresseByKurznameOrName">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Bezeichnung:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	set id = ""
	set bez = Bezeichnung_"%"
	&sql(SELECT TOP 1 ID INTO :id 
		 FROM DBAdressen.Adresse 
		 WHERE Mandant = :MandantOid
		 AND Kurzname LIKE :bez)
	
	if (id '= "") {
		Quit id
	
		// keine Daten gefunden -> nach Bezeichnung suchen	
	} else {
		set nId = ""
		&sql(SELECT TOP 1 ID INTO :nId 
		 	 FROM DBAdressen.Adresse
		 	 WHERE Mandant = :MandantOid
		 	 AND Name LIKE :bez)
		 if (nId '= "") {
			Quit nId 
		 
		 } else {
			 Quit ""
		 }
	}
]]></Implementation>
</Method>

<Method name="GetIdByAdrNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,AdrNr:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	set id = ""
	&sql(SELECT ID INTO :id FROM DBAdressen.Adresse WHERE Mandant = :MandantOid
		 AND Adressnummer = :AdrNr)
	Quit id
]]></Implementation>
</Method>

<Method name="GetIdByOldAdrNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,AdrNr:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	set id = ""
	&sql(SELECT ID INTO :id FROM DBAdressen.Adresse WHERE Mandant = :MandantOid
		 AND AdressNrAlt = :AdrNr)
	Quit id
]]></Implementation>
</Method>

<Method name="GetIdByAgriconNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,GemeindePart:%String,BetriebsPart:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	set id = ""
	&sql(SELECT ID INTO :id FROM DBAdressen.Adresse WHERE Mandant = :MandantOid
		 AND SUBSTRING(AdressNrAlt,1,4) = :GemeindePart AND SUBSTRING(AdressNrAlt,7,3) = :BetriebsPart)
	Quit id
]]></Implementation>
</Method>

<Method name="GetAdrNrById">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,id:%String</FormalSpec>
<ReturnType>%Integer</ReturnType>
<Implementation><![CDATA[
	set adrNr = ""
	&sql(SELECT Adressnummer INTO :adrNr FROM DBAdressen.Adresse WHERE Mandant = :MandantOid
		 AND ID = :id)
	Quit adrNr
]]></Implementation>
</Method>

<Method name="GetFirstObidByAdrNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	set id = ""
	&sql(SELECT TOP 1 ID INTO :id FROM DBAdressen.Adresse WHERE Mandant = :MandantOid
			ORDER BY Adressnummer)
	Quit id
]]></Implementation>
</Method>

<Method name="GetLastObidByAdrNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	set id = ""
	set MandantOid = " "_MandantOid
	set adr = $Order(^DBAdressen.AdresseI("AdressnummerIndex",MandantOid,""),-1)
	if (adr '= ""){
		set id = $Order(^DBAdressen.AdresseI("AdressnummerIndex",MandantOid,adr,""),-1,list)
	} else {
		Quit ""	
	}
	Quit id
]]></Implementation>
</Method>

<Method name="GetNextObidByAdrNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,AdrNr:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	set id = ""
	set MandantOid = " "_MandantOid
    set nextAdrNr = $Order(^DBAdressen.AdresseI("AdressnummerIndex",MandantOid,AdrNr))
	if (nextAdrNr '= "") {
		set id = $Order(^DBAdressen.AdresseI("AdressnummerIndex",MandantOid,nextAdrNr,""),1,list)
	}
	Quit id
]]></Implementation>
</Method>

<Method name="GetPrevtObidByAdrNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,AdrNr:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	set id = ""
	set MandantOid = " "_MandantOid
    set nextAdrNr = $Order(^DBAdressen.AdresseI("AdressnummerIndex",MandantOid,AdrNr),-1)
	if (nextAdrNr '= "") {
		set id = $Order(^DBAdressen.AdresseI("AdressnummerIndex",MandantOid,nextAdrNr,""),-1,list)
	}
	Quit id
]]></Implementation>
</Method>

<Method name="GetName">
<ClassMethod>1</ClassMethod>
<FormalSpec>Adresscode:%Integer,Name:%String,Zusatz1:%String,firstVorname:%Boolean</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	if ((Adresscode = 2) && (Zusatz1 '= "") && (Zusatz1 '= $C(0))) {
		if (firstVorname) {
			w "Fsd3"_Zusatz1_" "_Name,!
			Quit Zusatz1_" "_Name
		} else {
			Quit Name_" "_Zusatz1
		}
	} else {
		Quit Name
	}
]]></Implementation>
</Method>

<Method name="GetZusatz1">
<ClassMethod>1</ClassMethod>
<FormalSpec>Adresscode:%Integer,Zusatz1:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	if (Adresscode = 2) {
		Quit ""
	} else {
		Quit Zusatz1
	}
]]></Implementation>
</Method>

<Property name="Korrespondenz">
<Type>DBAdressen.Korrespondenz</Type>
<Cardinality>many</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="TelefonatAdresse">
<Type>DBAdressen.TelefonatKopf</Type>
<Cardinality>many</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="LeistungAdresse">
<Type>DBIntrap.Leistung</Type>
<Cardinality>many</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="SubProgramm">
<Type>DBProduktQS.SubProgramm</Type>
<Cardinality>many</Cardinality>
<Inverse>Kunde</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="FehlerReport">
<Type>DBProduktQS.FehlerReport</Type>
<Cardinality>many</Cardinality>
<Inverse>Kunde</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="ArtikelFaktLieferant1">
<Type>DBFakturierung.Artikel</Type>
<Cardinality>many</Cardinality>
<Inverse>Lieferant1</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="ArtikelFaktLieferant2">
<Type>DBFakturierung.Artikel</Type>
<Cardinality>many</Cardinality>
<Inverse>Lieferant2</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="ArtikelFaktLieferant3">
<Type>DBFakturierung.Artikel</Type>
<Cardinality>many</Cardinality>
<Inverse>Lieferant3</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="LieferantenGrLieferant">
<Type>DBFakturierung.SD.Liefgrp</Type>
<Cardinality>many</Cardinality>
<Inverse>Lieferant</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="GeraetFaktLieferant">
<Type>DBFakturierung.Geraet</Type>
<Cardinality>many</Cardinality>
<Inverse>Lieferant</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="GeraetFaktKunde">
<Type>DBFakturierung.TempAusgang</Type>
<Cardinality>many</Cardinality>
<Inverse>Kunde</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="FaktTransporteurAdr">
<Type>DBFakturierung.SD.Lieferart</Type>
<Cardinality>many</Cardinality>
<Inverse>Transporteur</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="AustauschFaktLieferant">
<Type>DBFakturierung.Vorabtausch</Type>
<Cardinality>many</Cardinality>
<Inverse>Lieferant</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="Benutzername">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Passwort">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="BonitaetInd3">
<Type>%String</Type>
</Property>

<Property name="BonitaetInd4">
<Type>%String</Type>
</Property>

<Property name="BonitaetInd5">
<Type>%String</Type>
</Property>

<Property name="BonitaetBemerkung">
<Type>%String</Type>
</Property>

<Method name="ResetKundenkategorieOnAdressen">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[

	&sql(UPDATE DBAdressen.Adresse SET Kundenkategorie = null WHERE Mandant = :MandantOid)
]]></Implementation>
</Method>

<Method name="ResetGebietscodeOnAdressen">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[

	&sql(UPDATE DBAdressen.Adresse SET Gebietscode = null WHERE Mandant = :MandantOid)
]]></Implementation>
</Method>

<Method name="ResetPreiskategorieOnAdressen">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[

	&sql(UPDATE DBAdressen.Adresse SET Preiskategorie = null WHERE Mandant = :MandantOid)
]]></Implementation>
</Method>

<Method name="ResetSelektion1OnAdressen">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[

	&sql(UPDATE DBAdressen.Adresse SET FreieSelektion1 = null WHERE Mandant = :MandantOid)
]]></Implementation>
</Method>

<Method name="ResetSelektion2OnAdressen">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[

	&sql(UPDATE DBAdressen.Adresse SET FreieSelektion2 = null WHERE Mandant = :MandantOid)
]]></Implementation>
</Method>

<Method name="ResetIndSel1OnAdressen">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[

	&sql(UPDATE DBAdressen.Adresse SET IndSel1 = null WHERE Mandant = :MandantOid)
]]></Implementation>
</Method>

<Method name="ResetIndSel2OnAdressen">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[

	&sql(UPDATE DBAdressen.Adresse SET IndSel2 = null WHERE Mandant = :MandantOid)
]]></Implementation>
</Method>

<Method name="ResetIndSel3OnAdressen">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[

	&sql(UPDATE DBAdressen.Adresse SET IndSel3 = null WHERE Mandant = :MandantOid)
]]></Implementation>
</Method>

<Method name="ResetIndSel4OnAdressen">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[

	&sql(UPDATE DBAdressen.Adresse SET IndSel4 = null WHERE Mandant = :MandantOid)
]]></Implementation>
</Method>

<Method name="ResetIndSel5OnAdressen">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[

	&sql(UPDATE DBAdressen.Adresse SET IndSel5 = null WHERE Mandant = :MandantOid)
]]></Implementation>
</Method>

<Property name="Projekt">
<Type>DBIntrap.SD.Projekt</Type>
<Cardinality>many</Cardinality>
<Inverse>Kunde</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="RepAufFaktKunde">
<Type>DBFakturierung.RepAuftrag</Type>
<Cardinality>many</Cardinality>
<Inverse>Kunde</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="LieferanteilKunde">
<Type>DBPlattform.Lieferanteil</Type>
<Cardinality>many</Cardinality>
<Inverse>Kunde</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="LieferanteilLieferant">
<Type>DBPlattform.LieferanteilDet</Type>
<Cardinality>many</Cardinality>
<Inverse>Lieferant</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="QMeldung">
<Type>DBTQM.QMeldung</Type>
<Cardinality>many</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="FaktVPreisLieferant">
<Type>DBFakturierung.Preis</Type>
<Cardinality>many</Cardinality>
<Inverse>Lieferant</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="FaktVPreisProduzent">
<Type>DBFakturierung.Preis</Type>
<Cardinality>many</Cardinality>
<Inverse>Produzent</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="FaktVPreisZulieferant">
<Type>DBFakturierung.Preis</Type>
<Cardinality>many</Cardinality>
<Inverse>Zulieferant</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="FaktKundenRabattKunde">
<Type>DBFakturierung.KundenRabatt</Type>
<Cardinality>many</Cardinality>
<Inverse>Kunde</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="FaktKundenStrgKunde">
<Type>DBFakturierung.KundenStrg</Type>
<Cardinality>many</Cardinality>
<Inverse>Kunde</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="FaktAuftragspositionLieferant">
<Type>DBFakturierung.Auftragspos</Type>
<Cardinality>many</Cardinality>
<Inverse>Lieferant</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="FaktKundenRueckverg">
<Type>DBFakturierung.KundenRueckverg</Type>
<Cardinality>many</Cardinality>
<Inverse>Kunde</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="Kontrakt">
<Type>DBFakturierung.Kontrakt</Type>
<Cardinality>many</Cardinality>
<Inverse>Kunde</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="ArtGrKundeRabatt">
<Type>DBAgrofresh.SD.ArtGrKundeRabatt</Type>
<Cardinality>many</Cardinality>
<Inverse>Kunde</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="BesuchsRapportAdresse">
<Type>DBAdressen.Besuchsrapport</Type>
<Cardinality>many</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Method name="GetFirstMwstCodeByMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	set id = ""
	&sql(SELECT TOP 1 ID INTO :id FROM DBAdressen.Adresse WHERE Mandant = :MandantOid
			ORDER BY Adressnummer)
	Quit id
]]></Implementation>
</Method>

<Method name="GetLastMwstCodeByMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	set id = ""
	set MandantOid = " "_MandantOid
	set adr = $Order(^DBAdressen.AdresseI("AdressnummerIndex",MandantOid,""),-1)
	if (adr '= ""){
		set id = $Order(^DBAdressen.AdresseI("AdressnummerIndex",MandantOid,adr,""),-1,list)
	} else {
		Quit ""	
	}
	Quit id
]]></Implementation>
</Method>

<Property name="Hausnummer">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="WZaehlerEignetuemer">
<Type>DBSpezial.Wasser.Zaehler</Type>
<Cardinality>many</Cardinality>
<Inverse>Eigentuemer</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="WZaehlerRechnung">
<Type>DBSpezial.Wasser.Zaehler</Type>
<Cardinality>many</Cardinality>
<Inverse>Rechnungsadresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="WZaehlerMieter">
<Type>DBSpezial.Wasser.Zaehler</Type>
<Cardinality>many</Cardinality>
<Inverse>Mieteradresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="ZAHaupt">
<Type>DBAdressen.ZusatzAdresse</Type>
<Cardinality>many</Cardinality>
<Inverse>Hauptadresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="Zusatzadresse">
<Type>DBAdressen.ZusatzAdresse</Type>
<Cardinality>many</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="TourDetail">
<Type>DBAdressen.TourDetail</Type>
<Cardinality>many</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Method name="GetIdByNameStrassePlz">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Name:%String,Strasse:%String,Hausnummer:%String,Plz:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	set id = ""
	&sql(SELECT ID INTO :id FROM DBAdressen.Adresse WHERE Mandant = :MandantOid
		 AND Name = :Name AND Strasse = :Strasse AND Hausnummer = :Hausnummer AND Plz = :Plz)
	Quit id
]]></Implementation>
</Method>

<Property name="OPDebiZusatzProjektleitung">
<Type>DBDebiKredi.OPDebiZusatz</Type>
<Cardinality>many</Cardinality>
<Inverse>Projektleitung</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="LeitungProjekt">
<Type>DBIntrap.SD.Projekt</Type>
<Cardinality>many</Cardinality>
<Inverse>ProjektleitungExtern</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="Kontrolle">
<Type>DBSpezial.Label.KontrollKopf</Type>
<Cardinality>many</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="OrthoBestKopf">
<Type>DBSpezial.Ortho.BestKopf</Type>
<Cardinality>many</Cardinality>
<Inverse>Lieferant</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="PlattformBudgetKunde">
<Type>DBPlattform.Budget</Type>
<Cardinality>many</Cardinality>
<Inverse>Kunde</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="OrthoAdresse">
<Type>DBSpezial.Ortho.Adresse</Type>
<Cardinality>children</Cardinality>
<Inverse>AdresseAdresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="ZusatzInfoText">
<Type>%String</Type>
<Parameter name="MAXLEN" value="6000"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="VerarbAuftrag">
<Type>DBAgrofreshEK.VerarbAuftrag</Type>
<Cardinality>many</Cardinality>
<Inverse>Verarbeiter</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="Wartungsvertrag">
<Type>DBSpezial.Wartung.Kopf</Type>
<Cardinality>many</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="WartungZahladresse">
<Type>DBSpezial.Wartung.Kopf</Type>
<Cardinality>many</Cardinality>
<Inverse>Zahladresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="ParzellenEigentuemer">
<Type>DBAgrofresh.SD.Parzelle</Type>
<Cardinality>many</Cardinality>
<Inverse>Lieferant</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="Mandatskontrolle">
<Type>DBIntrap.Mandatskontrolle</Type>
<Cardinality>many</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="Pendenz">
<Type>DBAdressen.Pendenz</Type>
<Cardinality>many</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="IndSelBoni1">
<Type>DBAdressen.SD.IndSelBoni1</Type>
<Cardinality>one</Cardinality>
<Inverse>AdresseIndSelBoni1</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="BonitaetIndSel1"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Property name="IndSelBoni2">
<Type>DBAdressen.SD.IndSelBoni2</Type>
<Cardinality>one</Cardinality>
<Inverse>AdresseIndSelBoni2</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="BonitaetIndSel2"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Property name="TransportDst">
<Type>DBPlattform.Transportschein</Type>
<Cardinality>many</Cardinality>
<Inverse>DstAdresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="TransportSrc">
<Type>DBPlattform.Transportschein</Type>
<Cardinality>many</Cardinality>
<Inverse>SrcAdresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="Lagerort">
<Type>DBAgrofresh.SD.Lagerort</Type>
<Cardinality>many</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="AufbereitungsKopf">
<Type>DBSpezial.Fakt.AufbereitKopf</Type>
<Cardinality>many</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="Fahrzeug">
<Type>DBSpezial.Fzv.Fahrzeug</Type>
<Cardinality>many</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="FaktAuftragSteuerung">
<Type>DBFakturierung.SD.StrgAuftrag</Type>
<Cardinality>one</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="Transportauftrag">
<Type>DBSpezial.Logistik.TransAuftrag</Type>
<Cardinality>many</Cardinality>
<Inverse>Kunde</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="TransportLadestelle">
<Type>DBSpezial.Logistik.TransAuftrag</Type>
<Cardinality>many</Cardinality>
<Inverse>LadestelleAdresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="TransportAbladestelle">
<Type>DBSpezial.Logistik.TransAuftrag</Type>
<Cardinality>many</Cardinality>
<Inverse>AbladestelleAdresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="WerkzeugBestellt">
<Type>DBSpezial.Mecano.Werkzeug</Type>
<Cardinality>many</Cardinality>
<Inverse>LieferantBestellt</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="WerkzeugLieferant1">
<Type>DBSpezial.Mecano.Werkzeug</Type>
<Cardinality>many</Cardinality>
<Inverse>Lieferant1</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="WerkzeugLieferant2">
<Type>DBSpezial.Mecano.Werkzeug</Type>
<Cardinality>many</Cardinality>
<Inverse>Lieferant2</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="WerkzeugLieferant3">
<Type>DBSpezial.Mecano.Werkzeug</Type>
<Cardinality>many</Cardinality>
<Inverse>Lieferant3</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="ZusatzInfoTextStream">
<Type>%GlobalBinaryStream</Type>
</Property>

<Property name="FaktEKBestSteuerung">
<Type>DBFaktEK.SD.StrgBestellung</Type>
<Cardinality>one</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="FaktEKBestSteuerung"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Property name="FaktEKStrgLieferant">
<Type>DBFaktEK.LieferantenStrg</Type>
<Cardinality>many</Cardinality>
<Inverse>Lieferant</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="Lieferantengruppe">
<Type>DBAdressen.SD.Lieferantengrp</Type>
<Cardinality>one</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Lieferantengruppe"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Property name="Vorbestellung">
<Type>DBSpezial.Eier.VorbestellungKopf</Type>
<Cardinality>many</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="AgrofreshFahrzeug">
<Type>DBAgrofresh.SD.Fahrzeug</Type>
<Cardinality>many</Cardinality>
<Inverse>Transporteur</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="EinsatzPos">
<Type>DBSpezial.Lohn.EinsatzPos</Type>
<Cardinality>many</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="Vertragsdaten">
<Type>DBTQM.SD.Vertragsdaten</Type>
<Cardinality>many</Cardinality>
<Inverse>AdressNr</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="KundeAbzug">
<Type>DBSpezial.Vieh.SD.KundeAbzug</Type>
<Cardinality>many</Cardinality>
<Inverse>KundeLieferant</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="Rueckerstattung">
<Type>DBSpezial.Fakt.SD.Rueckerst</Type>
<Cardinality>many</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="Dossier">
<Type>DBSpezial.Versich.Dossier</Type>
<Cardinality>many</Cardinality>
<Inverse>Adresse</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="VersichObjekt">
<Type>DBSpezial.Versich.VersichObjekt</Type>
<Cardinality>many</Cardinality>
<Inverse>Versicherer</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="ViehhandelAnkauf">
<Type>DBSpezial.Vieh.Auftrag</Type>
<Cardinality>many</Cardinality>
<Inverse>AnkaufAdresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="ViehhandelVerkauf">
<Type>DBSpezial.Vieh.Auftrag</Type>
<Cardinality>many</Cardinality>
<Inverse>VerkaufAdresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Method name="MoveFirstOnAdressNrAlt">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
	set MandantOid = " "_MandantOid
	set adr = $Order(^DBAdressen.AdresseI("AdressNrAltIndex",MandantOid,""),1)
	if (adr '= ""){
		set id = $Order(^DBAdressen.AdresseI("AdressNrAltIndex",MandantOid,adr,""),1,list)
	} else {
		Quit ""	
	}
	Quit list
]]></Implementation>
</Method>

<Method name="MoveLastOnAdressNrAlt">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
	set MandantOid = " "_MandantOid
	set adr = $Order(^DBAdressen.AdresseI("AdressNrAltIndex",MandantOid,""),-1)
	if (adr '= ""){
		set id = $Order(^DBAdressen.AdresseI("AdressNrAltIndex",MandantOid,adr,""),-1,list)
	} else {
		Quit ""	
	}
	Quit list
]]></Implementation>
</Method>

<Method name="MoveNextOnAdressNrAlt">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,AdressNrAlt:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
	set MandantOid = " "_MandantOid
    set nextAdrNr = $Order(^DBAdressen.AdresseI("AdressNrAltIndex",MandantOid,AdressNrAlt))
	if (nextAdrNr '= "") {
		set res = $Order(^DBAdressen.AdresseI("AdressNrAltIndex",MandantOid,nextAdrNr,""),1,list)
	} else {
		set list = ##class(DBAdressen.Adresse).MoveLastOnAdressNrAlt(MandantOid)
	}
	
	Quit list
]]></Implementation>
</Method>

<Method name="MovePrevOnAdressNrAlt">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,AdressNrAlt:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
	set MandantOid = " "_MandantOid
    set nextAdrNr = $Order(^DBAdressen.AdresseI("AdressNrAltIndex",MandantOid,AdressNrAlt),-1)
	if (nextAdrNr '= "") {
		set res = $Order(^DBAdressen.AdresseI("AdressNrAltIndex",MandantOid,nextAdrNr,""),-1,list)
	} else {
		set list = ##class(DBAdressen.Adresse).MoveFirstOnAdressNrAlt(MandantOid)
	}
	
	Quit list
]]></Implementation>
</Method>

<Method name="CountOldAdrNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,AdrNr:%String</FormalSpec>
<ReturnType>%Integer</ReturnType>
<Implementation><![CDATA[
	set count = 0
	&sql(SELECT COUNT(ID) INTO :count FROM DBAdressen.Adresse WHERE Mandant = :MandantOid
		 AND AdressNrAlt = :AdrNr)
	if (SQLCODE '= 0) {
		QUIT 0
	} else {
		Quit count
	}
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.AdresseD</DataLocation>
<DefaultData>AdresseDefaultData</DefaultData>
<IdLocation>^DBAdressen.AdresseD</IdLocation>
<IndexLocation>^DBAdressen.AdresseI</IndexLocation>
<StreamLocation>^DBAdressen.AdresseS</StreamLocation>
<Data name="AdresseDefaultData">
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Adresscode</Value>
</Value>
<Value name="3">
<Value>Adressnummer</Value>
</Value>
<Value name="4">
<Value>Adressstatus</Value>
</Value>
<Value name="5">
<Value>Aktiv</Value>
</Value>
<Value name="6">
<Value>Anrede</Value>
</Value>
<Value name="7">
<Value>Bearbeitungsdatum</Value>
</Value>
<Value name="8">
<Value>Bemerkung1</Value>
</Value>
<Value name="9">
<Value>Bemerkung2</Value>
</Value>
<Value name="10">
<Value>Bemerkung3</Value>
</Value>
<Value name="11">
<Value>BenutzerBearbeiter</Value>
</Value>
<Value name="12">
<Value>BenutzerErfasser</Value>
</Value>
<Value name="13">
<Value>EMail</Value>
</Value>
<Value name="14">
<Value>Erfassungsdatum</Value>
</Value>
<Value name="15">
<Value>Fax</Value>
</Value>
<Value name="16">
<Value>FreieSelektion1</Value>
</Value>
<Value name="17">
<Value>FreieSelektion2</Value>
</Value>
<Value name="18">
<Value>FreierText1</Value>
</Value>
<Value name="19">
<Value>FreierText2</Value>
</Value>
<Value name="20">
<Value>FreiesDatum1</Value>
</Value>
<Value name="21">
<Value>FreiesDatum2</Value>
</Value>
<Value name="22">
<Value>Gebietscode</Value>
</Value>
<Value name="23">
<Value>Kundengruppe</Value>
</Value>
<Value name="24">
<Value>Kundenkategorie</Value>
</Value>
<Value name="25">
<Value>Kurzname</Value>
</Value>
<Value name="26">
<Value>Mandant</Value>
</Value>
<Value name="27">
<Value>Mobil</Value>
</Value>
<Value name="28">
<Value>Name</Value>
</Value>
<Value name="29">
<Value>PersAnrede</Value>
</Value>
<Value name="30">
<Value>Plz</Value>
</Value>
<Value name="31">
<Value>Preiskategorie</Value>
</Value>
<Value name="32">
<Value>Sprachcode</Value>
</Value>
<Value name="33">
<Value>Strasse</Value>
</Value>
<Value name="34">
<Value>Telefon1</Value>
</Value>
<Value name="35">
<Value>Telefon2</Value>
</Value>
<Value name="36">
<Value>Vertretercode</Value>
</Value>
<Value name="37">
<Value>VornameZusatz1</Value>
</Value>
<Value name="38">
<Value>Web</Value>
</Value>
<Value name="39">
<Value>ZuHanden</Value>
</Value>
<Value name="40">
<Value>Zusatz2</Value>
</Value>
<Value name="41">
<Value>sdxName</Value>
</Value>
<Value name="42">
<Value>sdxStreet1</Value>
</Value>
<Value name="43">
<Value>sdxStreet2</Value>
</Value>
<Value name="44">
<Value>sdxStreet3</Value>
</Value>
<Value name="45">
<Value>sdxStreetNo</Value>
</Value>
<Value name="46">
<Value>sdxZip</Value>
</Value>
<Value name="47">
<Value>sdxCity</Value>
</Value>
<Value name="48">
<Value>BearbeiterNr</Value>
</Value>
<Value name="49">
<Value>BearbeiterBenutzername</Value>
</Value>
<Value name="50">
<Value>BearbeiterVorname</Value>
</Value>
<Value name="51">
<Value>BearbeiterName</Value>
</Value>
<Value name="52">
<Value>ErfasserNr</Value>
</Value>
<Value name="53">
<Value>ErfasserBenutzername</Value>
</Value>
<Value name="54">
<Value>ErfasserVorname</Value>
</Value>
<Value name="55">
<Value>ErfasserName</Value>
</Value>
<Value name="56">
<Value>Ort</Value>
</Value>
<Value name="57">
<Value>PlzInklZusatz</Value>
</Value>
<Value name="58">
<Value>AdressNrAlt</Value>
</Value>
<Value name="59">
<Value>UstIdNr</Value>
</Value>
<Value name="60">
<Value>Kundenidentifikation</Value>
</Value>
<Value name="61">
<Value>SkontoBarzahlung</Value>
</Value>
<Value name="62">
<Value>IndSel1</Value>
</Value>
<Value name="63">
<Value>IndSel2</Value>
</Value>
<Value name="64">
<Value>IndSel3</Value>
</Value>
<Value name="65">
<Value>IndSel4</Value>
</Value>
<Value name="66">
<Value>IndMultiSel</Value>
</Value>
<Value name="67">
<Value>IndDate1</Value>
</Value>
<Value name="68">
<Value>IndDate2</Value>
</Value>
<Value name="69">
<Value>IndDate3</Value>
</Value>
<Value name="70">
<Value>IndDate4</Value>
</Value>
<Value name="71">
<Value>IndDate5</Value>
</Value>
<Value name="72">
<Value>VerkSteuerungstyp</Value>
</Value>
<Value name="73">
<Value>Lieferart</Value>
</Value>
<Value name="74">
<Value>SpezArtikelAnsicht</Value>
</Value>
<Value name="75">
<Value>KundenSpezRueckvergAktiv</Value>
</Value>
<Value name="76">
<Value>EinkSteuerungstyp</Value>
</Value>
<Value name="77">
<Value>IndSel5</Value>
</Value>
<Value name="78">
<Value>Benutzername</Value>
</Value>
<Value name="79">
<Value>Passwort</Value>
</Value>
<Value name="80">
<Value>FaktVerkSteuerungstyp</Value>
</Value>
<Value name="81">
<Value>FaktEinkSteuerungstyp</Value>
</Value>
<Value name="82">
<Value>Hausnummer</Value>
</Value>
<Value name="83">
<Value>ZusatzInfoText</Value>
</Value>
<Value name="84">
<Value>BonitalInd3</Value>
</Value>
<Value name="85">
<Value>BonitalInd4</Value>
</Value>
<Value name="86">
<Value>BonitalInd5</Value>
</Value>
<Value name="87">
<Value>BonitalBemerkung</Value>
</Value>
<Value name="88">
<Value>BonitaetInd3</Value>
</Value>
<Value name="89">
<Value>BonitaetInd4</Value>
</Value>
<Value name="90">
<Value>BonitaetInd5</Value>
</Value>
<Value name="91">
<Value>BonitaetBemerkung</Value>
</Value>
<Value name="92">
<Value>IndSelBoni1</Value>
</Value>
<Value name="93">
<Value>IndSelBoni2</Value>
</Value>
<Value name="94">
<Value>AuftragSteuerung</Value>
</Value>
<Value name="95">
<Value>FaktAuftragSteuerung</Value>
</Value>
<Value name="96">
<Value>ZusatzInfoTextStream</Value>
</Value>
<Value name="97">
<Value>FaktEKBestSteuerung</Value>
</Value>
<Value name="98">
<Value>FaktEKStrgLieferant</Value>
</Value>
<Value name="99">
<Value>Lieferantengruppe</Value>
</Value>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="AdressNrAlt">
</Property>
<Property name="Adresscode">
</Property>
<Property name="Adressnummer">
</Property>
<Property name="Adressstatus">
</Property>
<Property name="Aktiv">
</Property>
<Property name="Anrede">
</Property>
<Property name="BearbeiterBenutzername">
</Property>
<Property name="BearbeiterName">
</Property>
<Property name="BearbeiterNr">
</Property>
<Property name="BearbeiterVorname">
</Property>
<Property name="Bearbeitungsdatum">
</Property>
<Property name="Bemerkung1">
</Property>
<Property name="Bemerkung2">
</Property>
<Property name="Bemerkung3">
</Property>
<Property name="BenutzerBearbeiter"/>
<Property name="BenutzerErfasser"/>
<Property name="Benutzername">
</Property>
<Property name="BonitaetBemerkung">
</Property>
<Property name="BonitaetInd3">
</Property>
<Property name="BonitaetInd4">
</Property>
<Property name="BonitaetInd5">
</Property>
<Property name="EMail">
</Property>
<Property name="EinkSteuerungstyp">
</Property>
<Property name="ErfasserBenutzername">
</Property>
<Property name="ErfasserName">
</Property>
<Property name="ErfasserNr">
</Property>
<Property name="ErfasserVorname">
</Property>
<Property name="Erfassungsdatum">
</Property>
<Property name="FaktAuftragSteuerung">
</Property>
<Property name="FaktEKBestSteuerung">
</Property>
<Property name="FaktEinkSteuerungstyp"/>
<Property name="FaktVerkSteuerungstyp"/>
<Property name="Fax">
</Property>
<Property name="FreieSelektion1">
</Property>
<Property name="FreieSelektion2">
</Property>
<Property name="FreierText1">
</Property>
<Property name="FreierText2">
</Property>
<Property name="FreiesDatum1">
</Property>
<Property name="FreiesDatum2">
</Property>
<Property name="Gebietscode">
</Property>
<Property name="Hausnummer">
</Property>
<Property name="IndDate1">
</Property>
<Property name="IndDate2">
</Property>
<Property name="IndDate3">
</Property>
<Property name="IndDate4">
</Property>
<Property name="IndDate5">
</Property>
<Property name="IndSel1">
</Property>
<Property name="IndSel2">
</Property>
<Property name="IndSel3">
</Property>
<Property name="IndSel4">
</Property>
<Property name="IndSel5">
</Property>
<Property name="IndSelBoni1">
</Property>
<Property name="IndSelBoni2">
</Property>
<Property name="KundenSpezRueckvergAktiv">
</Property>
<Property name="Kundengruppe">
</Property>
<Property name="Kundenidentifikation"/>
<Property name="Kundenkategorie">
</Property>
<Property name="Kurzname">
</Property>
<Property name="Lieferantengruppe">
</Property>
<Property name="Lieferart"/>
<Property name="Mandant">
</Property>
<Property name="Mobil">
</Property>
<Property name="Name">
</Property>
<Property name="Ort">
</Property>
<Property name="Passwort">
</Property>
<Property name="PersAnrede">
</Property>
<Property name="Plz">
</Property>
<Property name="PlzInklZusatz">
</Property>
<Property name="Preiskategorie">
</Property>
<Property name="SkontoBarzahlung"/>
<Property name="SpezArtikelAnsicht"/>
<Property name="Sprachcode">
</Property>
<Property name="Strasse">
</Property>
<Property name="Telefon1">
</Property>
<Property name="Telefon2">
</Property>
<Property name="UstIdNr"/>
<Property name="VerkSteuerungstyp">
</Property>
<Property name="Vertretercode">
</Property>
<Property name="VornameZusatz1">
</Property>
<Property name="Web">
</Property>
<Property name="ZuHanden">
</Property>
<Property name="Zusatz2">
</Property>
<Property name="ZusatzInfoText">
</Property>
<Property name="ZusatzInfoTextStream">
</Property>
<Property name="sdxCity">
</Property>
<Property name="sdxName">
</Property>
<Property name="sdxStreet1">
</Property>
<Property name="sdxStreet2">
</Property>
<Property name="sdxStreet3">
</Property>
<Property name="sdxStreetNo">
</Property>
<Property name="sdxZip">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.Besuchsrapport">
<Super>%Persistent,%XML.Adaptor</Super>
<TimeChanged>62438,40800.108692</TimeChanged>
<TimeCreated>61766,29232.811945</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Adresse">
<Type>DBAdressen.Adresse</Type>
<Cardinality>one</Cardinality>
<Inverse>BesuchsRapportAdresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Adresse"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="AdresseIndex">
<Properties>Adresse</Properties>
</Index>

<Property name="Erfassung">
<Type>%Date</Type>
</Property>

<Property name="Nachfassen">
<Type>%Date</Type>
</Property>

<Property name="Woche">
<Type>%Integer</Type>
</Property>

<Property name="Nummer">
<Type>%Integer</Type>
</Property>

<Property name="Sachbearbeiter">
<Type>DBCore.Mitarbeiter</Type>
<Cardinality>one</Cardinality>
<Inverse>RapportSachbearbeiter</Inverse>
<Relationship>1</Relationship>
</Property>

<Index name="SachbearbeiterIndex">
<Properties>Sachbearbeiter</Properties>
</Index>

<Property name="Status">
<Type>DBAdressen.SD.StatusBesuch</Type>
<Cardinality>one</Cardinality>
<Inverse>Rapport</Inverse>
<Relationship>1</Relationship>
</Property>

<Index name="StatusIndex">
<Properties>Status</Properties>
</Index>

<Property name="Prioritaet">
<Type>DBAdressen.SD.Prioritaet</Type>
<Cardinality>one</Cardinality>
<Inverse>Rapport</Inverse>
<Relationship>1</Relationship>
</Property>

<Index name="PrioritaetIndex">
<Properties>Prioritaet</Properties>
</Index>

<Property name="Bemerkung">
<Type>%String</Type>
<Parameter name="MAXLEN" value="32000"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Method name="GetNextNumber">
<ClassMethod>1</ClassMethod>
<FormalSpec>AdresseOid:%String</FormalSpec>
<ReturnType>%Integer</ReturnType>
<Implementation><![CDATA[
	Set number = 0
	&sql(SELECT Max(Nummer) INTO :number FROM DBAdressen.Besuchsrapport WHERE Adresse = :AdresseOid)
	if (number = 0) {
		Quit 1
	}else {
		Quit number + 5
	}
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.BesuchsrapportD</DataLocation>
<DefaultData>BesuchsrapportDefaultData</DefaultData>
<IdLocation>^DBAdressen.BesuchsrapportD</IdLocation>
<IndexLocation>^DBAdressen.BesuchsrapportI</IndexLocation>
<StreamLocation>^DBAdressen.BesuchsrapportS</StreamLocation>
<Data name="BesuchsrapportDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Adresse</Value>
</Value>
<Value name="3">
<Value>Erfassung</Value>
</Value>
<Value name="4">
<Value>Nachfassen</Value>
</Value>
<Value name="5">
<Value>Woche</Value>
</Value>
<Value name="6">
<Value>Nummer</Value>
</Value>
<Value name="7">
<Value>Sachbearbeiter</Value>
</Value>
<Value name="8">
<Value>Status</Value>
</Value>
<Value name="9">
<Value>Prioritaet</Value>
</Value>
<Value name="10">
<Value>Bemerkung</Value>
</Value>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="Adresse">
</Property>
<Property name="Bemerkung">
</Property>
<Property name="Erfassung">
</Property>
<Property name="Nachfassen">
</Property>
<Property name="Nummer">
</Property>
<Property name="Prioritaet">
</Property>
<Property name="Sachbearbeiter">
</Property>
<Property name="Status">
</Property>
<Property name="Woche">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.BrancheAdresse">
<Description>
</Description>
<Super>%Persistent,%XML.Adaptor</Super>
<TimeChanged>62438,40800.090059</TimeChanged>
<TimeCreated>61030,55625.576215</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Adresse">
<Type>DBAdressen.Adresse</Type>
<Cardinality>one</Cardinality>
<Inverse>AdresseBrancheAdresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Adresse"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="AdresseIndex">
<Properties>Adresse</Properties>
</Index>

<Property name="Branche">
<Type>DBAdressen.SD.Branche</Type>
<Cardinality>one</Cardinality>
<Inverse>BrancheAdresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Branche"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="BrancheIndex">
<Properties>Branche</Properties>
</Index>

<Index name="AdresseBrancheIndex">
<Properties>Adresse,Branche</Properties>
</Index>

<Method name="GetAdrInBranche">
<ClassMethod>1</ClassMethod>
<FormalSpec>Adresse:%String,Branchen:%String</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set ret = 0
	set branche = ""
	For index = 1:1:($Length(Branchen, "-") && ret=0) {
		set branche = $Piece(Branchen, "-", +index)
		&sql(SELECT COUNT(ID) INTO :ret FROM DBAdressen.BrancheAdresse WHERE Adresse = :Adresse AND Branche->Kuerzel LIKE :branche)
		if (ret > 0) {
			set res = 1
		} else {
			set res = 0	
		}
	}
	quit res
]]></Implementation>
</Method>

<Method name="GetArtikelByAdresse">
<ClassMethod>1</ClassMethod>
<FormalSpec>Adresse:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	set artikel = ""
	&SQL(SELECT TOP 1 Branche->Artikel INTO :artikel FROM DBAdressen.BrancheAdresse WHERE Adresse = :Adresse ORDER BY Branche->Artikel->Basispreis ASC)
	quit artikel
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.BrancheAdresseD</DataLocation>
<DefaultData>BrancheAdresseDefaultData</DefaultData>
<IdLocation>^DBAdressen.BrancheAdresseD</IdLocation>
<IndexLocation>^DBAdressen.BrancheAdresseI</IndexLocation>
<StreamLocation>^DBAdressen.BrancheAdresseS</StreamLocation>
<Data name="BrancheAdresseDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Zugewiesen</Value>
</Value>
<Value name="3">
<Value>Adresse</Value>
</Value>
<Value name="4">
<Value>Branche</Value>
</Value>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="Adresse">
</Property>
<Property name="Branche">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.Dokument">
<Super>%Persistent,%XML.Adaptor</Super>
<TimeChanged>62438,40800.324857</TimeChanged>
<TimeCreated>62340,34821.481352</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Bezeichnung">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="DateiTyp">
<Type>%Library.Integer</Type>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
</Property>

<Property name="DateiEndung">
<Type>%String</Type>
<Parameter name="MAXLEN" value="10"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Erfassungsdatum">
<Type>%Date</Type>
</Property>

<Property name="Nachfassdatum">
<Type>%Date</Type>
</Property>

<Property name="File">
<Type>DBAdressen.DokumentStream</Type>
<Cardinality>one</Cardinality>
<Inverse>Dokument</Inverse>
<Relationship>1</Relationship>
</Property>

<Index name="FileIndex">
<Properties>File</Properties>
<Unique>1</Unique>
</Index>

<Property name="Status">
<Type>DBAdressen.SD.Status</Type>
<Cardinality>one</Cardinality>
<Inverse>Dokument</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="Bemerkung">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="SachbearbeiterNr">
<Type>%Library.Integer</Type>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
</Property>

<Property name="SachbearbeiterBenutzername">
<Type>%Library.String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="SachbearbeiterVorname">
<Type>%Library.String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="SachbearbeiterName">
<Type>%Library.String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Dokumententyp">
<Type>DBAdressen.SD.Dokumententyp</Type>
<Cardinality>one</Cardinality>
<Inverse>Dokument</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="Recht">
<Type>DBAdressen.DokumentRecht</Type>
<Cardinality>many</Cardinality>
<Inverse>Dokument</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="InEdit">
<Type>%Boolean</Type>
</Property>

<Property name="EditStart">
<Type>%TimeStamp</Type>
</Property>

<Property name="EditSachbearbeiterNr">
<Type>%Library.Integer</Type>
</Property>

<Method name="OutputStream">
<ReturnType>%Library.GlobalBinaryStream</ReturnType>
<Implementation><![CDATA[
	Set tmpStream=##class(%Library.GlobalBinaryStream).%New()
	Set f = ..File
	Set Ret=""
	If (f'="") {
		Set Size=f.DataStream.Size
		Set Ret=tmpStream.CopyFromAndSave(f.DataStream)
	}
	Quit tmpStream
]]></Implementation>
</Method>

<Method name="InputStream">
<FormalSpec>Stream:%Library.GlobalBinaryStream</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	Set res=0
	Set f = ..File
	Set sID = ""
	
		Set Cnt=0
		if (f ="" ) {
			w "NewFile",!
			Set myId=..%Id()
			Set v=##Class(DBAdressen.Dokument).%OpenId(myId)
			Set n=##Class(DBAdressen.DokumentStream).%New()
			Set Ret=n.%Save()
			Set v.File=n
			Set Ret=v.%Save()
			if (Ret=1) {
				do n.DataStream.CopyFromAndSave(Stream)
				Set Ret=n.%Save()
			}
			Set n=""
			Set v=""
			Set res=(Ret=1)
			Quit res
		} else {
			Set Ret= f.DataStream.CopyFromAndSave(Stream)
			Set RetS = f.%Save()
			Set f = ""
			Set res=((Ret=1) && (RetS=1))
		}
	
	Quit res
]]></Implementation>
</Method>

<Method name="IsInEditClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	set edit = 0
	if (myID '= "") {
		Set rs=##Class(DBAdressen.Dokument).%OpenId(myID)
		set edit = rs.InEdit
		Set rs = ""
	}
	Quit edit
]]></Implementation>
</Method>

<Method name="IsEditAllowed">
<ClassMethod>1</ClassMethod>
<FormalSpec>DokumentOid:%String,UserNr:%Integer,UserId:%String</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	set count = 0
	
	set dok = ##class(DBAdressen.Dokument).%OpenId(DokumentOid)
	if (dok.SachbearbeiterNr = UserNr) {
		set count = 1	
	}
	set dok = ""
	
	if (count = 0) {
		&sql(SELECT COUNT(ID) INTO :count FROM DBAdressen.DokumentRecht WHERE Dokument = :DokumentOid AND TYP = DBAdressen.Konst_RechtOffen() 
			 AND Rolle IN (SELECT Rolle FROM DBCore.Rollenvergabe WHERE Benutzer = :UserId))
	}
	
	if (count > 0) {
		quit 1	
	} else {
		quit 0	
	}
]]></Implementation>
</Method>

<Method name="%OnDelete">
<Description><![CDATA[
This callback method is invoked by the <METHOD>%Delete</METHOD> method to 
provide notification that the object specified by <VAR>oid</VAR> is being deleted.

<P>If this method returns an error then the object will not be deleted.
[Previously private]]]></Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>oid:%ObjectIdentity</FormalSpec>
<ReturnType>%Status</ReturnType>
<ServerOnly>1</ServerOnly>
<Implementation><![CDATA[
		set reportOid = $lg(oid,1)
		set rep = ##class(DBAdressen.Dokument).%OpenId(reportOid)
		if (rep.File '= "") {
			set fileOid = rep.File.%Id()
			Set ^DokumentFileOid(reportOid) = fileOid
		}
		kill rep
		&sql(DELETE FROM DBAdressen.DokumentRecht WHERE Dokument = :reportOid)
		Quit $$$OK
]]></Implementation>
</Method>

<Trigger name="trgOnDelete">
<Code><![CDATA[	new myId 
	new fOld
	set myId = {ID*O}
	set fOld = {File*O}
	&sql(DELETE FROM DBAdressen.DokumentRecht WHERE Dokument = :myId)
	Set ^DokumentFileOid(myId) = fOld]]></Code>
<Event>DELETE</Event>
</Trigger>

<Method name="%OnAfterDelete">
<Description><![CDATA[
This callback method is invoked by the <METHOD>%Delete</METHOD> method to 
provide notification that the object specified by <VAR>oid</VAR> has been deleted.
The callback occurs immediately after %DeleteData has been called. If %DeleteData returns
an error then %OnAfterDelete is not called.

<P>If %OnAfterDelete returns an error (%Status) then the transaction is rolled back.
[Previously private]]]></Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>oid:%ObjectIdentity</FormalSpec>
<ReturnType>%Status</ReturnType>
<ServerOnly>1</ServerOnly>
<Implementation><![CDATA[
	Set oldFileOid = $GET(^DokumentFileOid($lg(oid,1)),"")
	if (oldFileOid'="") {
		KILL ^DokumentFileOid($lg(oid,1))
		set status = ##Class(DBAdressen.DokumentStream).%DeleteId(oldFileOid)
	}
	Quit $$$OK
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.DokumentD</DataLocation>
<DefaultData>DokumentDefaultData</DefaultData>
<IdLocation>^DBAdressen.DokumentD</IdLocation>
<IndexLocation>^DBAdressen.DokumentI</IndexLocation>
<StreamLocation>^DBAdressen.DokumentS</StreamLocation>
<Data name="DokumentDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Bezeichnung</Value>
</Value>
<Value name="3">
<Value>DokumentTyp</Value>
</Value>
<Value name="4">
<Value>DateiEndung</Value>
</Value>
<Value name="5">
<Value>Erfassungsdatum</Value>
</Value>
<Value name="6">
<Value>Nachfassdatum</Value>
</Value>
<Value name="7">
<Value>File</Value>
</Value>
<Value name="8">
<Value>Status</Value>
</Value>
<Value name="9">
<Value>Bemerkung</Value>
</Value>
<Value name="10">
<Value>SachbearbeiterNr</Value>
</Value>
<Value name="11">
<Value>SachbearbeiterBenutzername</Value>
</Value>
<Value name="12">
<Value>SachbearbeiterVorname</Value>
</Value>
<Value name="13">
<Value>SachbearbeiterName</Value>
</Value>
<Value name="14">
<Value>Dokumententyp</Value>
</Value>
<Value name="15">
<Value>DateiTyp</Value>
</Value>
<Value name="16">
<Value>InEdit</Value>
</Value>
<Value name="17">
<Value>EditStart</Value>
</Value>
<Value name="18">
<Value>EditSachbearbeiterNr</Value>
</Value>
</Data>
<Property name="Bemerkung"/>
<Property name="Bezeichnung"/>
<Property name="DateiEndung"/>
<Property name="DateiTyp"/>
<Property name="Dokumententyp"/>
<Property name="EditSachbearbeiterNr"/>
<Property name="EditStart"/>
<Property name="Erfassungsdatum"/>
<Property name="File"/>
<Property name="InEdit"/>
<Property name="Nachfassdatum"/>
<Property name="SachbearbeiterBenutzername"/>
<Property name="SachbearbeiterName"/>
<Property name="SachbearbeiterNr"/>
<Property name="SachbearbeiterVorname"/>
<Property name="Status"/>
</Storage>
</Class>


<Class name="DBAdressen.DokumentRecht">
<Super>%Persistent</Super>
<TimeChanged>62438,40800.27024</TimeChanged>
<TimeCreated>62346,42514.955859</TimeCreated>

<Property name="Rolle">
<Type>DBCore.Rolle</Type>
<Cardinality>one</Cardinality>
<Inverse>DokumentRecht</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="Dokument">
<Type>DBAdressen.Dokument</Type>
<Cardinality>one</Cardinality>
<Inverse>Recht</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="Dokumenttyp">
<Type>DBAdressen.SD.Dokumententyp</Type>
<Cardinality>one</Cardinality>
<Inverse>Recht</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="Typ">
<Type>%Integer</Type>
</Property>

<Property name="Dokumentgrp">
<Type>DBAdressen.SD.Dokumentengrp</Type>
<Cardinality>one</Cardinality>
<Inverse>Recht</Inverse>
<Relationship>1</Relationship>
</Property>

<Method name="CopyRechteToDokument">
<ClassMethod>1</ClassMethod>
<FormalSpec>Dokumenttyp:%String,Dokument:%String</FormalSpec>
<Implementation><![CDATA[
	&sql(DELETE FROM DBAdressen.DokumentRecht WHERE Dokument = :Dokument)
	
	set sourceId = ""
 	&sql(DECLARE SourceCur CURSOR FOR
    		SELECT ID 
    				Into :sourceId
    		FROM DBAdressen.DokumentRecht 
    		WHERE Dokumenttyp=:Dokumenttyp)
	
 	&sql(OPEN SourceCur)
 	&sql(FETCH SourceCur)
 	
	set dokument = ##class(DBAdressen.Dokument).%OpenId(Dokument)
	
 	While (SQLCODE = 0) {
	 	set source = ##class(DBAdressen.DokumentRecht).%OpenId(sourceId)
	 	set newObj = ##class(DBAdressen.DokumentRecht).%New()
	 	set newObj.Dokument = dokument
	 	set newObj.Rolle = source.Rolle
	 	set newObj.Typ = source.Typ
	 	set s = newObj.%Save()
	 	if ($$$ISERR(s)) {
		 	set status = s
		}
		set source = ""
		set newObj = ""
		&sql(FETCH SourceCur)
 	}
 	
 	set dokument = ""
 	
    &sql(CLOSE SourceCur)
]]></Implementation>
</Method>

<Method name="CopyRechteToDokumenttyp">
<ClassMethod>1</ClassMethod>
<FormalSpec>Dokumentgrp:%String,Dokumenttyp:%String</FormalSpec>
<Implementation><![CDATA[
	&sql(DELETE FROM DBAdressen.DokumentRecht WHERE Dokumenttyp = :Dokumenttyp)
	
	set sourceId = ""
 	&sql(DECLARE Source2Cur CURSOR FOR
    		SELECT ID 
    				Into :sourceId
    		FROM DBAdressen.DokumentRecht 
    		WHERE Dokumentgrp=:Dokumentgrp)
	
 	&sql(OPEN Source2Cur)
 	&sql(FETCH Source2Cur)
 	
	set dokumenttyp = ##class(DBAdressen.SD.Dokumententyp).%OpenId(Dokumenttyp)
	
 	While (SQLCODE = 0) {
	 	set source = ##class(DBAdressen.DokumentRecht).%OpenId(sourceId)
	 	set newObj = ##class(DBAdressen.DokumentRecht).%New()
	 	set newObj.Dokumenttyp = dokumenttyp
	 	set newObj.Rolle = source.Rolle
	 	set newObj.Typ = source.Typ
	 	set s = newObj.%Save()
	 	if ($$$ISERR(s)) {
		 	set status = s
		}
		set source = ""
		set newObj = ""
		&sql(FETCH Source2Cur)
 	}
 	
 	set dokumenttyp = ""
 	
    &sql(CLOSE Source2Cur)
]]></Implementation>
</Method>

<Method name="CopyRechte">
<ClassMethod>1</ClassMethod>
<FormalSpec>VonDokument:%String,NachDokument:%String</FormalSpec>
<Implementation><![CDATA[
	&sql(DELETE FROM DBAdressen.DokumentRecht WHERE Dokument = :NachDokument)
	
	set sourceId = ""
 	&sql(DECLARE SourceDokCur CURSOR FOR
    		SELECT ID 
    				Into :sourceId
    		FROM DBAdressen.DokumentRecht 
    		WHERE Dokument=:VonDokument)
	
 	&sql(OPEN SourceDokCur)
 	&sql(FETCH SourceDokCur)
 	
	set dokument = ##class(DBAdressen.Dokument).%OpenId(NachDokument)
	
 	While (SQLCODE = 0) {
	 	set source = ##class(DBAdressen.DokumentRecht).%OpenId(sourceId)
	 	set newObj = ##class(DBAdressen.DokumentRecht).%New()
	 	set newObj.Dokument = dokument
	 	set newObj.Rolle = source.Rolle
	 	set newObj.Typ = source.Typ
	 	set s = newObj.%Save()
	 	if ($$$ISERR(s)) {
		 	set status = s
		}
		set source = ""
		set newObj = ""
		&sql(FETCH SourceDokCur)
 	}
 	
 	set dokument = ""
 	
    &sql(CLOSE SourceDokCur)
]]></Implementation>
</Method>

<Method name="CopyRechteToDokTyp">
<ClassMethod>1</ClassMethod>
<FormalSpec>VonDokTyp:%String,NachDokTyp:%String</FormalSpec>
<Implementation><![CDATA[
	&sql(DELETE FROM DBAdressen.DokumentRecht WHERE Dokumenttyp = :NachDokTyp)
	
	set sourceId = ""
 	&sql(DECLARE SourceTypCur CURSOR FOR
    		SELECT ID 
    				Into :sourceId
    		FROM DBAdressen.DokumentRecht 
    		WHERE Dokumenttyp=:VonDokTyp)
	
 	&sql(OPEN SourceTypCur)
 	&sql(FETCH SourceTypCur)
 	
	set typ = ##class(DBAdressen.SD.Dokumententyp).%OpenId(NachDokTyp)
	
 	While (SQLCODE = 0) {
	 	set source = ##class(DBAdressen.DokumentRecht).%OpenId(sourceId)
	 	set newObj = ##class(DBAdressen.DokumentRecht).%New()
	 	set newObj.Dokumenttyp = typ
	 	set newObj.Rolle = source.Rolle
	 	set newObj.Typ = source.Typ
	 	set s = newObj.%Save()
	 	if ($$$ISERR(s)) {
		 	set status = s
		}
		set source = ""
		set newObj = ""
		&sql(FETCH SourceTypCur)
 	}
 	
 	set typ = ""
 	
    &sql(CLOSE SourceTypCur)
]]></Implementation>
</Method>

<Method name="SetAlleRechtOffen">
<ClassMethod>1</ClassMethod>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set rolleId = ""
 	&sql(DECLARE RolleCur CURSOR FOR
    		SELECT ID 
    				Into :rolleId
    		FROM DBCore.Rolle)
	
 	&sql(OPEN RolleCur)
 	&sql(FETCH RolleCur)
 	
	
 	While (SQLCODE = 0) {
	 	set rolle = ##class(DBCore.Rolle).%OpenId(rolleId)
	 	
	 	set dokumentId = ""
 		&sql(DECLARE DokCur CURSOR FOR
    		SELECT ID 
    				Into :dokumentId
    		FROM DBAdressen.Dokument)
	
 		&sql(OPEN DokCur)
 		&sql(FETCH DokCur)
 		
 		While (SQLCODE = 0) {
	 		set dokument = ##class(DBAdressen.Dokument).%OpenId(dokumentId)
	 		set newObj = ##class(DBAdressen.DokumentRecht).%New()	
	 		set newObj.Dokument = dokument
	 		set newObj.Rolle = rolle
	 		set newObj.Typ = ##class(DBAdressen.Konst).RechtOffen()
	 		set s = newObj.%Save()
	 		set dokument = ""
			set newObj = ""
			&sql(FETCH DokCur)
 		}
    	&sql(CLOSE DokCur)
    	
    	set dokumentTypId = ""
 		&sql(DECLARE DokTypCur CURSOR FOR
    		SELECT ID 
    				Into :dokumentTypId
    		FROM DBAdressen_SD.Dokumententyp)
	
 		&sql(OPEN DokTypCur)
 		&sql(FETCH DokTypCur)
 		
 		While (SQLCODE = 0) {
	 		set dokumentTyp = ##class(DBAdressen.SD.Dokumententyp).%OpenId(dokumentTypId)
	 		set newObj = ##class(DBAdressen.DokumentRecht).%New()	
	 		set newObj.Dokumenttyp = dokumentTyp
	 		set newObj.Rolle = rolle
	 		set newObj.Typ =  ##class(DBAdressen.Konst).RechtOffen()
	 		set s = newObj.%Save()
	 		set dokumentTyp = ""
			set newObj = ""
			&sql(FETCH DokTypCur)
 		}
    	&sql(CLOSE DokTypCur)
		
		set dokumentGrpId = ""
 		&sql(DECLARE DokGrpCur CURSOR FOR
    		SELECT ID 
    				Into :dokumentGrpId
    		FROM DBAdressen_SD.Dokumentengrp)
	
 		&sql(OPEN DokGrpCur)
 		&sql(FETCH DokGrpCur)
 		
 		While (SQLCODE = 0) {
	 		set dokumentGrp = ##class(DBAdressen.SD.Dokumentengrp).%OpenId(dokumentGrpId)
	 		set newObj = ##class(DBAdressen.DokumentRecht).%New()	
	 		set newObj.Dokumentgrp = dokumentGrp
	 		set newObj.Rolle = rolle
	 		set newObj.Typ =  ##class(DBAdressen.Konst).RechtOffen()
	 		set s = newObj.%Save()
	 		set dokumentGrp = ""
			set newObj = ""
			&sql(FETCH DokGrpCur)
 		}
    	&sql(CLOSE DokGrpCur)
    	
 		set rolle = ""
		&sql(FETCH RolleCur)
 	}	
 	
    &sql(CLOSE RolleCur)
    quit ""
]]></Implementation>
</Method>

<Method name="SetAlleGruppenRechtOffen">
<ClassMethod>1</ClassMethod>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set rolleId = ""
 	&sql(DECLARE Rolle2Cur CURSOR FOR
    		SELECT ID 
    				Into :rolleId
    		FROM DBCore.Rolle)
	
 	&sql(OPEN Rolle2Cur)
 	&sql(FETCH Rolle2Cur)
 		
 	While (SQLCODE = 0) {
	 	set rolle = ##class(DBCore.Rolle).%OpenId(rolleId)
		
		set dokumentGrpId = ""
 		&sql(DECLARE DokGrp2Cur CURSOR FOR
    		SELECT ID 
    				Into :dokumentGrpId
    		FROM DBAdressen_SD.Dokumentengrp)
	
 		&sql(OPEN DokGrp2Cur)
 		&sql(FETCH DokGrp2Cur)
 		
 		While (SQLCODE = 0) {
	 		set dokumentGrp = ##class(DBAdressen.SD.Dokumentengrp).%OpenId(dokumentGrpId)
	 		set newObj = ##class(DBAdressen.DokumentRecht).%New()	
	 		set newObj.Dokumentgrp = dokumentGrp
	 		set newObj.Rolle = rolle
	 		set newObj.Typ =  ##class(DBAdressen.Konst).RechtOffen()
	 		set s = newObj.%Save()
	 		set dokumentGrp = ""
			set newObj = ""
			&sql(FETCH DokGrp2Cur)
 		}
    	&sql(CLOSE DokGrp2Cur)
    	
 		set rolle = ""
		&sql(FETCH Rolle2Cur)
 	}	
 	
    &sql(CLOSE Rolle2Cur)
    quit ""
]]></Implementation>
</Method>

<Method name="SetGruppeRechtOffen">
<ClassMethod>1</ClassMethod>
<FormalSpec>DokGrpId:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set rolleId = ""
 	&sql(DECLARE Rolle3Cur CURSOR FOR
    		SELECT ID 
    				Into :rolleId
    		FROM DBCore.Rolle)
	
 	&sql(OPEN Rolle3Cur)
 	&sql(FETCH Rolle3Cur)
 	
	set dokumentGrp = ##class(DBAdressen.SD.Dokumentengrp).%OpenId(DokGrpId)
 		
 	While (SQLCODE = 0) {
	 	set rolle = ##class(DBCore.Rolle).%OpenId(rolleId)
		
	 		set newObj = ##class(DBAdressen.DokumentRecht).%New()	
	 		set newObj.Dokumentgrp = dokumentGrp
	 		set newObj.Rolle = rolle
	 		set newObj.Typ =  ##class(DBAdressen.Konst).RechtOffen()
	 		set s = newObj.%Save()
	 		set newObj = ""
 		
 		set rolle = ""
		&sql(FETCH Rolle3Cur)
 	}	
 	set dokumentGrp = ""
			
    &sql(CLOSE Rolle3Cur)
    quit ""
]]></Implementation>
</Method>

<Method name="SetTypRechtOffen">
<ClassMethod>1</ClassMethod>
<FormalSpec>DokTypId:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set rolleId = ""
 	&sql(DECLARE Rolle4Cur CURSOR FOR
    		SELECT ID 
    				Into :rolleId
    		FROM DBCore.Rolle)
	
 	&sql(OPEN Rolle4Cur)
 	&sql(FETCH Rolle4Cur)
 	
	set dokumentTyp = ##class(DBAdressen.SD.Dokumententyp).%OpenId(DokTypId)
 		
 	While (SQLCODE = 0) {
	 	set rolle = ##class(DBCore.Rolle).%OpenId(rolleId)
		
	 		set newObj = ##class(DBAdressen.DokumentRecht).%New()	
	 		set newObj.Dokumenttyp = dokumentTyp
	 		set newObj.Rolle = rolle
	 		set newObj.Typ =  ##class(DBAdressen.Konst).RechtOffen()
	 		set s = newObj.%Save()
	 		set newObj = ""
 		
 		set rolle = ""
		&sql(FETCH Rolle4Cur)
 	}	
 	set dokumentTyp = ""
			
    &sql(CLOSE Rolle4Cur)
    quit ""
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.DokumentRechtD</DataLocation>
<DefaultData>DokumentRechtDefaultData</DefaultData>
<IdLocation>^DBAdressen.DokumentRechtD</IdLocation>
<IndexLocation>^DBAdressen.DokumentRechtI</IndexLocation>
<StreamLocation>^DBAdressen.DokumentRechtS</StreamLocation>
<Data name="DokumentRechtDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Rolle</Value>
</Value>
<Value name="3">
<Value>Dokument</Value>
</Value>
<Value name="4">
<Value>Dokumenttyp</Value>
</Value>
<Value name="5">
<Value>Typ</Value>
</Value>
<Value name="6">
<Value>Dokumentgrp</Value>
</Value>
</Data>
<Property name="Dokument"/>
<Property name="Dokumentgrp"/>
<Property name="Dokumenttyp"/>
<Property name="Rolle"/>
<Property name="Typ"/>
</Storage>
</Class>


<Class name="DBAdressen.DokumentStream">
<Super>%Persistent</Super>
<TimeChanged>62438,40800.41371</TimeChanged>
<TimeCreated>61450,57599.333608</TimeCreated>

<Property name="DataStream">
<Type>%GlobalBinaryStream</Type>
</Property>

<Property name="Vorlage">
<Type>DBAdressen.SD.Vorlage</Type>
<Cardinality>many</Cardinality>
<Inverse>File</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="Korrespondenz">
<Type>DBAdressen.Korrespondenz</Type>
<Cardinality>many</Cardinality>
<Inverse>File</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="Dokument">
<Type>DBAdressen.Dokument</Type>
<Cardinality>many</Cardinality>
<Inverse>File</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="Serienbrief">
<Type>DBAdressen.Serienbrief</Type>
<Cardinality>many</Cardinality>
<Inverse>File</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="EMailAnhang">
<Type>DBAdressen.EMailAnhang</Type>
<Cardinality>many</Cardinality>
<Inverse>File</Inverse>
<Relationship>1</Relationship>
</Property>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.DokumentStreamD</DataLocation>
<DefaultData>DokumentStreamDefaultData</DefaultData>
<IdLocation>^DBAdressen.DokumentStreamD</IdLocation>
<IndexLocation>^DBAdressen.DokumentStreamI</IndexLocation>
<StreamLocation>^DBAdressen.DokumentStreamS</StreamLocation>
<Data name="DateiEndung">
<Attribute>DateiEndung</Attribute>
<Structure>subnode</Structure>
<Subscript>"DateiEndung"</Subscript>
</Data>
<Data name="DokumentStreamDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>DataStream</Value>
</Value>
<Value name="3">
<Value>Vorlage</Value>
</Value>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="DataStream">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.EMail">
<Super>%Persistent,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40830.512631</TimeChanged>
<TimeCreated>62348,61281.921118</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Nummer">
<Type>%Library.Integer</Type>
<Required>1</Required>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
</Property>

<Index name="NummerIndex">
<Properties>AktMandant,Nummer</Properties>
<Unique>1</Unique>
</Index>

<Property name="Betreff">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Body">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="65000"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="KorrTyp">
<Type>DBAdressen.SD.KorrTyp</Type>
<Cardinality>one</Cardinality>
<Inverse>EMail</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="AktMandantIdx">
<Properties>AktMandant</Properties>
</Index>

<Property name="Anhang">
<Type>DBAdressen.EMailAnhang</Type>
<Cardinality>many</Cardinality>
<Inverse>EMail</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="Korrespondenz">
<Type>DBAdressen.Korrespondenz</Type>
<Cardinality>many</Cardinality>
<Inverse>EMail</Inverse>
<Relationship>1</Relationship>
</Property>

<Method name="GetBetreff">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Betreff, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetBetreffClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID '= "") {
		Set rs=##Class(DBAdressen.EMail).%OpenId(myID)
		set text = rs.GetBetreff(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetBetreff">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Betreff, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetBody">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Body, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetBodyClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID '= "") {
		Set rs=##Class(DBAdressen.EMail).%OpenId(myID)
		set text = rs.GetBody(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetBody">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Body, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetNextFreeNumber">
<ClassMethod>1</ClassMethod>
<ReturnType>%Integer</ReturnType>
<Implementation><![CDATA[
	set nr = 0
	&sql(Select max(Nummer) into :nr From DBAdressen.EMail)
	Quit +nr +1
]]></Implementation>
</Method>

<Method name="GetEMailOidByNummer">
<ClassMethod>1</ClassMethod>
<FormalSpec>Nummer:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	QUIT:(VorlageNr<0)
	Set oid = ""
	&sql(SELECT ID INTO :oid
		 FROM DBAdressen.EMail
		 WHERE Nummer = :Nummer)
	Quit oid
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.EMailD</DataLocation>
<DefaultData>EMailDefaultData</DefaultData>
<IdLocation>^DBAdressen.EMailD</IdLocation>
<IndexLocation>^DBAdressen.EMailI</IndexLocation>
<StreamLocation>^DBAdressen.EMailS</StreamLocation>
<Data name="Betreff">
<Attribute>Betreff</Attribute>
<Structure>subnode</Structure>
<Subscript>"Betreff"</Subscript>
</Data>
<Data name="Body">
<Attribute>Body</Attribute>
<Structure>subnode</Structure>
<Subscript>"Body"</Subscript>
</Data>
<Data name="EMailDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Nummer</Value>
</Value>
<Value name="3">
<Value>KorrTyp</Value>
</Value>
<Value name="4">
<Value>AktMandant</Value>
</Value>
</Data>
</Storage>
</Class>


<Class name="DBAdressen.EMailAnhang">
<Super>%Persistent,%XML.Adaptor</Super>
<TimeChanged>62438,40800.738585</TimeChanged>
<TimeCreated>62348,61505.130647</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="DateiName">
<Type>%String</Type>
<Parameter name="MAXLEN" value="10"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="DateiTyp">
<Type>%Library.Integer</Type>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
</Property>

<Property name="DateiEndung">
<Type>%String</Type>
<Parameter name="MAXLEN" value="10"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="File">
<Type>DBAdressen.DokumentStream</Type>
<Cardinality>one</Cardinality>
<Inverse>EMailAnhang</Inverse>
<Relationship>1</Relationship>
</Property>

<Index name="FileIndex">
<Properties>File</Properties>
<Unique>1</Unique>
</Index>

<Property name="EMail">
<Type>DBAdressen.EMail</Type>
<Cardinality>one</Cardinality>
<Inverse>Anhang</Inverse>
<Relationship>1</Relationship>
</Property>

<Index name="EMailIndex">
<Properties>EMail</Properties>
</Index>

<Method name="OutputStream">
<ReturnType>%Library.GlobalBinaryStream</ReturnType>
<Implementation><![CDATA[
	Set tmpStream=##class(%Library.GlobalBinaryStream).%New()
	Set f = ..File
	Set Ret=""
	If (f'="") {
		Set Size=f.DataStream.Size
		Set Ret=tmpStream.CopyFromAndSave(f.DataStream)
	}
	Quit tmpStream
]]></Implementation>
</Method>

<Method name="InputStream">
<FormalSpec>Stream:%Library.GlobalBinaryStream</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	Set res=0
	Set f = ..File
	Set sID = ""
	
		Set Cnt=0
		if (f ="" ) {
			w "NewFile",!
			Set myId=..%Id()
			Set v=##Class(DBAdressen.EMailAnhang).%OpenId(myId)
			Set n=##Class(DBAdressen.DokumentStream).%New()
			Set Ret=n.%Save()
			Set v.File=n
			Set Ret=v.%Save()
			if (Ret=1) {
				do n.DataStream.CopyFromAndSave(Stream)
				Set Ret=n.%Save()
			}
			Set n=""
			Set v=""
			Set res=(Ret=1)
			Quit res
		} else {
			Set Ret= f.DataStream.CopyFromAndSave(Stream)
			Set RetS = f.%Save()
			Set f = ""
			Set res=((Ret=1) && (RetS=1))
		}
	
	Quit res
]]></Implementation>
</Method>

<Method name="%OnDelete">
<Description><![CDATA[
This callback method is invoked by the <METHOD>%Delete</METHOD> method to 
provide notification that the object specified by <VAR>oid</VAR> is being deleted.

<P>If this method returns an error then the object will not be deleted.
[Previously private]]]></Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>oid:%ObjectIdentity</FormalSpec>
<ReturnType>%Status</ReturnType>
<ServerOnly>1</ServerOnly>
<Implementation><![CDATA[
		set reportOid = $lg(oid,1)
		set rep = ##class(DBAdressen.EMailAnhang).%OpenId(reportOid)
		if (rep.File '= "") {
			set fileOid = rep.File.%Id()
			Set ^EMailAnhangFileOid(reportOid) = fileOid
		}
		kill rep
		Quit $$$OK
]]></Implementation>
</Method>

<Trigger name="trgOnDelete">
<Code>	new myId 
	new fOld
	set myId = {ID*O}
	set fOld = {File*O}
	Set ^EMailAnhangFileOid(myId) = fOld</Code>
<Event>DELETE</Event>
</Trigger>

<Method name="%OnAfterDelete">
<Description><![CDATA[
This callback method is invoked by the <METHOD>%Delete</METHOD> method to 
provide notification that the object specified by <VAR>oid</VAR> has been deleted.
The callback occurs immediately after %DeleteData has been called. If %DeleteData returns
an error then %OnAfterDelete is not called.

<P>If %OnAfterDelete returns an error (%Status) then the transaction is rolled back.
[Previously private]]]></Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>oid:%ObjectIdentity</FormalSpec>
<ReturnType>%Status</ReturnType>
<ServerOnly>1</ServerOnly>
<Implementation><![CDATA[
	Set oldFileOid = $GET(^EMailAnhangFileOid($lg(oid,1)),"")
	if (oldFileOid'="") {
		KILL ^EMailAnhangFileOid($lg(oid,1))
		set status = ##Class(DBAdressen.DokumentStream).%DeleteId(oldFileOid)
	}
	Quit $$$OK
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.EMailAnhangD</DataLocation>
<DefaultData>EMailAnhangDefaultData</DefaultData>
<IdLocation>^DBAdressen.EMailAnhangD</IdLocation>
<IndexLocation>^DBAdressen.EMailAnhangI</IndexLocation>
<StreamLocation>^DBAdressen.EMailAnhangS</StreamLocation>
<Data name="EMailAnhangDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>DateiName</Value>
</Value>
<Value name="3">
<Value>DateiTyp</Value>
</Value>
<Value name="4">
<Value>DateiEndung</Value>
</Value>
<Value name="5">
<Value>File</Value>
</Value>
<Value name="6">
<Value>EMail</Value>
</Value>
</Data>
</Storage>
</Class>


<Class name="DBAdressen.ImportDouble">
<Super>%Persistent</Super>
<TimeChanged>62438,40800.768273</TimeChanged>
<TimeCreated>61184,23845.45474</TimeCreated>

<UDLText name="T">
<Content><![CDATA[
// Gruppen-Nummer aller identischen gefunden Doubletten

]]></Content>
</UDLText>

<Property name="GroupNo">
<Type>%Integer</Type>
</Property>

<UDLText name="T">
<Content><![CDATA[
// ID der gefundenen doppelten Adresse

]]></Content>
</UDLText>

<Property name="AddressID">
<Type>%Integer</Type>
</Property>

<UDLText name="T">
<Content><![CDATA[
// ID der importierten Adresse

]]></Content>
</UDLText>

<Property name="ImportID">
<Type>%Integer</Type>
</Property>

<UDLText name="T">
<Content><![CDATA[
// Flag zum merken, ob schon vom Programm verarbeitet

]]></Content>
</UDLText>

<Property name="Finished">
<Type>%Boolean</Type>
<InitialExpression>0</InitialExpression>
</Property>

<Index name="idxGroupNo">
<Type>bitmap</Type>
<Properties>GroupNo</Properties>
</Index>

<Index name="idxImportID">
<Type>bitmap</Type>
<Properties>ImportID</Properties>
</Index>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.ImportDoubleD</DataLocation>
<DefaultData>ImportDoubleDefaultData</DefaultData>
<IdLocation>^DBAdressen.ImportDoubleD</IdLocation>
<IndexLocation>^DBAdressen.ImportDoubleI</IndexLocation>
<StreamLocation>^DBAdressen.ImportDoubleS</StreamLocation>
<Data name="ImportDoubleDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>GroupNo</Value>
</Value>
<Value name="3">
<Value>AddressID</Value>
</Value>
<Value name="4">
<Value>ImportID</Value>
</Value>
<Value name="5">
<Value>Finished</Value>
</Value>
</Data>
</Storage>
</Class>


<Class name="DBAdressen.ImportFile">
<Description>
TemporÃ¤re Tabelle zum importieren von Fremdadressen mit Soundex-Generierung
Aufbau dieses Import-Streams: 
Felder werden mit Tabulator getrennt
Feld-Nummer		Bedeutung   
---------------------------
		1		ID etc.
		2		Anrede
		3		Titel
		4		Vorname
		5		Nachname
		6		Firma
		7		Strasse
		8		Land
		9		PLZ / ZIP
		10		Ort</Description>
<Super>%Persistent</Super>
<TimeChanged>62438,40800.97057</TimeChanged>
<TimeCreated>61184,23091.127847</TimeCreated>

<Property name="sdxName">
<Type>%String</Type>
<Parameter name="MAXLEN" value="250"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="sdxStreet1">
<Type>%Text</Type>
<Parameter name="MAXLEN" value="4"/>
</Property>

<Property name="sdxStreet2">
<Type>%Text</Type>
<Parameter name="MAXLEN" value="4"/>
</Property>

<Property name="sdxStreet3">
<Type>%Text</Type>
<Parameter name="MAXLEN" value="4"/>
</Property>

<Index name="idxStreet1">
<Type>bitmap</Type>
<Properties>sdxStreet1</Properties>
</Index>

<Index name="idxStreet2">
<Type>bitmap</Type>
<Properties>sdxStreet2</Properties>
</Index>

<Index name="idxStreet3">
<Type>bitmap</Type>
<Properties>sdxStreet3</Properties>
</Index>

<Property name="sdxStreetNo">
<Type>%String</Type>
<Parameter name="MAXLEN" value="25"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="sdxZip">
<Type>%String</Type>
<Parameter name="MAXLEN" value="25"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Index name="idxZip">
<Type>bitmap</Type>
<Properties>sdxZip</Properties>
</Index>

<Property name="sdxCity">
<Type>%Text</Type>
<Parameter name="MAXLEN" value="250"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Index name="idxCity">
<Properties>sdxCity(KEYS)</Properties>
</Index>

<UDLText name="T">
<Content><![CDATA[
// Diese Eigenschaft kann durch die entsprechnenden Eigenschaften 

]]></Content>
</UDLText>

<UDLText name="T">
<Content><![CDATA[
// der Import-Felder ersetzt werden und dient hier nur ersatzweise 

]]></Content>
</UDLText>

<UDLText name="T">
<Content><![CDATA[
// als Beispiel

]]></Content>
</UDLText>

<Property name="OriginAddressLine">
<Type>%String</Type>
<Parameter name="MAXLEN" value="2028"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Method name="ImportStream">
<Description>
Diese Methode erhÃ¤lt einen Stream von der Anwendung 
mit dem Datei-Inhalt des Import-Files (s.a. DBCore-Reports)</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>stream:%Library.GlobalBinaryStream</FormalSpec>
<Implementation><![CDATA[
	// Cancel if not 
	Quit:stream.Size=0
	Set tab=$C(9)
	TStart
    Kill ^DBAdressen.ImportFileD
    // Read Header-Line
    Set line=stream.ReadLine()
    While 'stream.AtEnd {
	    // Read Data-Line
    	Set line=stream.ReadLine()
    	Set strName="",strStr1="",strStr2="",strStr3="",strStrNo=""
	    Set strName=$ZStrip(strName_" "_$P(line,tab,2),"<>W")
	    Set strName=$ZStrip(strName_" "_$P(line,tab,4),"<>W")
	    Set strName=$ZStrip(strName_" "_$P(line,tab,5),"<>W")
	    Set strName=$ZStrip(strName_" "_$P(line,tab,6),"<>W")
	    Set strStreet=$ZStrip($P(line,tab,7),"<>W")
	    Set strZip=$ZStrip($P(line,tab,9),"<>W")
	    Set strCity=$ZStrip($P(line,tab,10),"<>W")
	    If (strName'="") {
			Set strName=##Class(DBAdressen.Soundex).Cyrill2Latin(strName)
	    	Set strName=##Class(DBAdressen.Soundex).sdxName(strName)
	    }
		If (strStreet'="") {
			Set strStreet=##Class(DBAdressen.Soundex).Cyrill2Latin(strStreet)
			Set Status=##Class(DBAdressen.Soundex).sdxStreet(strStreet,.strStr1,.strStr2,.strStr3) 
			Set strStrNo=$ZStrip(##Class(DBAdressen.Soundex).sdxStreetNo(strStreet),"*W")
			Set strStrNo=$P(strStrNo," ")
		}
		Set:(strZip'="") strZip=$ZStrip(##Class(DBAdressen.Soundex).sdxZip(strZip),"*W")
		If (strCity'="") {
			Set strCity=##Class(DBAdressen.Soundex).Cyrill2Latin(strCity)
			Set strCity=##Class(DBAdressen.Soundex).sdxCity(strCity)
		}
		Set rs=..%New()
		Set rs.OriginAddressLine=line // Ersatz fÃ¼r Felder-Eigenschaft!!! (siehe oben)
		Set rs.sdxName=strName
		Set rs.sdxStreet1=strStr1
		Set rs.sdxStreet2=strStr2
		Set rs.sdxStreet3=strStr3
		Set rs.sdxStreetNo=strStrNo
		Set rs.sdxZip=strZip
		Set rs.sdxCity=strCity
		Set sc=rs.%Save()
		Quit:$$$ISERR(sc)
	}
	If $$$ISOK(sc) { 
		TCommit
	} Else { 
		TRollBack 
	}
	Set stream=""
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.ImportFileD</DataLocation>
<DefaultData>ImportFileDefaultData</DefaultData>
<IdLocation>^DBAdressen.ImportFileD</IdLocation>
<IndexLocation>^DBAdressen.ImportFileI</IndexLocation>
<StreamLocation>^DBAdressen.ImportFileS</StreamLocation>
<Data name="ImportFileDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>sdxName</Value>
</Value>
<Value name="3">
<Value>sdxStreet1</Value>
</Value>
<Value name="4">
<Value>sdxStreet2</Value>
</Value>
<Value name="5">
<Value>sdxStreet3</Value>
</Value>
<Value name="6">
<Value>sdxStreetNo</Value>
</Value>
<Value name="7">
<Value>sdxZip</Value>
</Value>
<Value name="8">
<Value>sdxCity</Value>
</Value>
<Value name="9">
<Value>OriginAddressLine</Value>
</Value>
</Data>
</Storage>
</Class>


<Class name="DBAdressen.ImportNew">
<Super>%Persistent</Super>
<TimeChanged>62438,40800.904815</TimeChanged>
<TimeCreated>61184,23979.740461</TimeCreated>

<UDLText name="T">
<Content><![CDATA[
// ID der Import-Adresse, zu der keine vergleichbare 

]]></Content>
</UDLText>

<UDLText name="T">
<Content><![CDATA[
// Adresse im System gefunden wurde, die also direkt

]]></Content>
</UDLText>

<UDLText name="T">
<Content><![CDATA[
// importiert werden kann.

]]></Content>
</UDLText>

<Property name="ImportID">
<Type>%Integer</Type>
<Required>1</Required>
</Property>

<Index name="ImportIDIndex">
<Properties>ImportID</Properties>
<Unique>1</Unique>
</Index>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.ImportNewD</DataLocation>
<DefaultData>ImportNewDefaultData</DefaultData>
<IdLocation>^DBAdressen.ImportNewD</IdLocation>
<IndexLocation>^DBAdressen.ImportNewI</IndexLocation>
<StreamLocation>^DBAdressen.ImportNewS</StreamLocation>
<Data name="ImportNewDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>ImportID</Value>
</Value>
</Data>
</Storage>
</Class>


<Class name="DBAdressen.Konst">
<Super>%RegisteredObject</Super>
<TimeChanged>62346,50871.683295</TimeChanged>
<TimeCreated>61465,63799.336543</TimeCreated>

<Method name="SerienbriefStd">
<ClassMethod>1</ClassMethod>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[	Quit 80
]]></Implementation>
</Method>

<Method name="SerienbriefVerband">
<ClassMethod>1</ClassMethod>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[	Quit 81
]]></Implementation>
</Method>

<Method name="SerienbriefMitglied">
<ClassMethod>1</ClassMethod>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[	Quit 82
]]></Implementation>
</Method>

<Method name="Begleitzettel">
<ClassMethod>1</ClassMethod>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[	Quit 83
]]></Implementation>
</Method>

<Method name="StatusErfasst">
<ClassMethod>1</ClassMethod>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[	Quit 1
]]></Implementation>
</Method>

<Method name="StatusNachfassen">
<ClassMethod>1</ClassMethod>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[	Quit 2
]]></Implementation>
</Method>

<Method name="StatusErledigt">
<ClassMethod>1</ClassMethod>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[	Quit 9
]]></Implementation>
</Method>

<Method name="StatusArchiv">
<ClassMethod>1</ClassMethod>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[	Quit 99
]]></Implementation>
</Method>

<Method name="RgInfoRechnung">
<Description>
Depricated</Description>
<ClassMethod>1</ClassMethod>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[	Quit 1
]]></Implementation>
</Method>

<Method name="RgInfoBestellung">
<Description>
Depricated</Description>
<ClassMethod>1</ClassMethod>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[	Quit 2
]]></Implementation>
</Method>

<Method name="RgInfoManuell">
<ClassMethod>1</ClassMethod>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[	Quit 3
]]></Implementation>
</Method>

<Method name="RgInfoRGFakt">
<ClassMethod>1</ClassMethod>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[	Quit 10
]]></Implementation>
</Method>

<Method name="RgInfoBEFaktEK">
<ClassMethod>1</ClassMethod>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[	Quit 11
]]></Implementation>
</Method>

<Method name="RgInfoRGAgrofresh">
<ClassMethod>1</ClassMethod>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[	Quit 12
]]></Implementation>
</Method>

<Method name="RgInfoBEAgrofreshEK">
<ClassMethod>1</ClassMethod>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[	Quit 13
]]></Implementation>
</Method>

<Method name="PendenzStatusAlle">
<ClassMethod>1</ClassMethod>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[	Quit 0
]]></Implementation>
</Method>

<Method name="PendenzStatusErfasst">
<ClassMethod>1</ClassMethod>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[	Quit 1
]]></Implementation>
</Method>

<Method name="PendenzStatusInBearbeitung">
<ClassMethod>1</ClassMethod>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[	Quit 2
]]></Implementation>
</Method>

<Method name="PendenzStatusEfasstBearbeitung">
<ClassMethod>1</ClassMethod>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[	Quit 3
]]></Implementation>
</Method>

<Method name="PendenzStatusErledigt">
<ClassMethod>1</ClassMethod>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[	Quit 9
]]></Implementation>
</Method>

<Method name="RechtOffen">
<ClassMethod>1</ClassMethod>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[	Quit 1
]]></Implementation>
</Method>

<Method name="RechtLesen">
<ClassMethod>1</ClassMethod>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[	Quit 2
]]></Implementation>
</Method>
</Class>


<Class name="DBAdressen.Korrespondenz">
<Super>%Persistent,%XML.Adaptor</Super>
<TimeChanged>62438,40801.126047</TimeChanged>
<TimeCreated>61458,34032.769313</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Bezeichnung">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="DokumentTyp">
<Type>%Library.Integer</Type>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
</Property>

<Property name="DateiEndung">
<Type>%String</Type>
<Parameter name="MAXLEN" value="10"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Erfassungsdatum">
<Type>%Date</Type>
</Property>

<Property name="Nachfassdatum">
<Type>%Date</Type>
</Property>

<Property name="File">
<Type>DBAdressen.DokumentStream</Type>
<Cardinality>one</Cardinality>
<Inverse>Korrespondenz</Inverse>
<Relationship>1</Relationship>
</Property>

<Index name="FileIndex">
<Properties>File</Properties>
<Unique>1</Unique>
</Index>

<Property name="KorrTyp">
<Type>DBAdressen.SD.KorrTyp</Type>
<Cardinality>one</Cardinality>
<Inverse>Korrespondenz</Inverse>
<Relationship>1</Relationship>
</Property>

<Index name="KorrTypIndex">
<Properties>KorrTyp</Properties>
</Index>

<Property name="Adresse">
<Type>DBAdressen.Adresse</Type>
<Cardinality>one</Cardinality>
<Inverse>Korrespondenz</Inverse>
<Relationship>1</Relationship>
</Property>

<Index name="AdresseIndex">
<Properties>Adresse</Properties>
</Index>

<Property name="Status">
<Type>DBAdressen.SD.Status</Type>
<Cardinality>one</Cardinality>
<Inverse>Korrespondenz</Inverse>
<Relationship>1</Relationship>
</Property>

<Index name="StatusIndex">
<Properties>Status</Properties>
</Index>

<Property name="Recht">
<Type>DBAdressen.KorrespondenzRecht</Type>
<Cardinality>many</Cardinality>
<Inverse>Korrespondenz</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="EMail">
<Type>DBAdressen.EMail</Type>
<Cardinality>one</Cardinality>
<Inverse>Korrespondenz</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="Serienbrief">
<Type>DBAdressen.Serienbrief</Type>
<Cardinality>one</Cardinality>
<Inverse>Korrespondenz</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="Bemerkung">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Mitarbeiter">
<Type>DBCore.Mitarbeiter</Type>
<Cardinality>one</Cardinality>
<Inverse>Korrespondenz</Inverse>
<Relationship>1</Relationship>
</Property>

<Index name="MitarbeiterIndex">
<Properties>Mitarbeiter</Properties>
</Index>

<Property name="InEdit">
<Type>%Boolean</Type>
</Property>

<Property name="EditStart">
<Type>%TimeStamp</Type>
</Property>

<Property name="EditSachbearbeiterNr">
<Type>%Library.Integer</Type>
</Property>

<Method name="GetBezeichnung">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Bezeichnung, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetBezeichnungClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID '= "") {
		Set rs=##Class(DBAdressen.Korrespondenz).%OpenId(myID)
		set text = rs.GetBezeichnung(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetBezeichnung">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Bezeichnung, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="OutputStream">
<ReturnType>%Library.GlobalBinaryStream</ReturnType>
<Implementation><![CDATA[
	Set tmpStream=##class(%Library.GlobalBinaryStream).%New()
	Set f = ..File
	Set Ret=""
	If (f'="") {
		Set Size=f.DataStream.Size
		Set Ret=tmpStream.CopyFromAndSave(f.DataStream)
	}
	Quit tmpStream
]]></Implementation>
</Method>

<Method name="InputStream">
<FormalSpec>Stream:%Library.GlobalBinaryStream</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	Set res=0
	Set f = ..File
	Set sID = ""
	
		Set Cnt=0
		if (f ="" ) {
			w "NewFile",!
			Set myId=..%Id()
			Set v=##Class(DBAdressen.Korrespondenz).%OpenId(myId)
			Set n=##Class(DBAdressen.DokumentStream).%New()
			Set Ret=n.%Save()
			Set v.File=n
			Set Ret=v.%Save()
			if (Ret=1) {
				do n.DataStream.CopyFromAndSave(Stream)
				Set Ret=n.%Save()
			}
			Set n=""
			Set v=""
			Set res=(Ret=1)
			Quit res
		} else {
			Set Ret= f.DataStream.CopyFromAndSave(Stream)
			Set RetS = f.%Save()
			Set f = ""
			Set res=((Ret=1) && (RetS=1))
		}
	
	Quit res
]]></Implementation>
</Method>

<Method name="IsInEditClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	set edit = 0
	if (myID '= "") {
		Set rs=##Class(DBAdressen.Korrespondenz).%OpenId(myID)
		set edit = rs.InEdit
		Set rs = ""
	}
	Quit edit
]]></Implementation>
</Method>

<Method name="GetAnzKorrespondenzen">
<ClassMethod>1</ClassMethod>
<FormalSpec>AdressOid:%String</FormalSpec>
<ReturnType>%Integer</ReturnType>
<Implementation><![CDATA[
	Set anzahl = 0
	&sql(SELECT COUNT(ID) INTO :anzahl FROM DBAdressen.Korrespondenz WHERE Adresse = :AdresseOid)
	Quit anzahl
]]></Implementation>
</Method>

<Method name="IsEditAllowed">
<ClassMethod>1</ClassMethod>
<FormalSpec>KorrespondezOid:%String,UserId:%String</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	set count = 0
	
	set dok = ##class(DBAdressen.Korrespondenz).%OpenId(KorrespondezOid)
	if ((dok.Mitarbeiter '= "") && (dok.Mitarbeiter.Benutzer '= "") && (dok.Mitarbeiter.Benutzer.%Id() = UserId)) {
		set count = 1	
	}
	set dok = ""
	
	if (count = 0) {
		&sql(SELECT COUNT(ID) INTO :count FROM DBAdressen.KorrespondenzRecht WHERE Korrespondenz = :KorrespondezOid AND TYP = DBAdressen.Konst_RechtOffen() 
			 AND Rolle IN (SELECT Rolle FROM DBCore.Rollenvergabe WHERE Benutzer = :UserId))
	}
	
	if (count > 0) {
		quit 1	
	} else {
		quit 0	
	}
]]></Implementation>
</Method>

<Method name="%OnDelete">
<Description><![CDATA[
This callback method is invoked by the <METHOD>%Delete</METHOD> method to 
provide notification that the object specified by <VAR>oid</VAR> is being deleted.

<P>If this method returns an error then the object will not be deleted.
[Previously private]]]></Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>oid:%ObjectIdentity</FormalSpec>
<ReturnType>%Status</ReturnType>
<ServerOnly>1</ServerOnly>
<Implementation><![CDATA[
		set reportOid = $lg(oid,1)
		set rep = ##class(DBAdressen.Korrespondenz).%OpenId(reportOid)
		if (rep.File '= "") {
			set fileOid = rep.File.%Id()
			Set ^KorrespondentFileOid(reportOid) = fileOid
		}
		kill rep
		&sql(DELETE FROM DBAdressen.KorrespondenzRecht WHERE Korrespondenz = :reportOid)
		Quit $$$OK
]]></Implementation>
</Method>

<Trigger name="trgOnDelete">
<Code><![CDATA[	new myId 
	new fOld
	set myId = {ID*O}
	set fOld = {File*O}
	&sql(DELETE FROM DBAdressen.KorrespondenzRecht WHERE Korrespondenz = :myId)
	Set ^KorrespondentFileOid(myId) = fOld]]></Code>
<Event>DELETE</Event>
</Trigger>

<Method name="%OnAfterDelete">
<Description><![CDATA[
This callback method is invoked by the <METHOD>%Delete</METHOD> method to 
provide notification that the object specified by <VAR>oid</VAR> has been deleted.
The callback occurs immediately after %DeleteData has been called. If %DeleteData returns
an error then %OnAfterDelete is not called.

<P>If %OnAfterDelete returns an error (%Status) then the transaction is rolled back.
[Previously private]]]></Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>oid:%ObjectIdentity</FormalSpec>
<ReturnType>%Status</ReturnType>
<ServerOnly>1</ServerOnly>
<Implementation><![CDATA[
	Set oldFileOid = $GET(^KorrespondentFileOid($lg(oid,1)),"")
	if (oldFileOid'="") {
		KILL ^KorrespondentFileOid($lg(oid,1))
		set status = ##Class(DBAdressen.DokumentStream).%DeleteId(oldFileOid)
	}
	Quit $$$OK
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.KorrespondenzD</DataLocation>
<DefaultData>KorrespondenzDefaultData</DefaultData>
<IdLocation>^DBAdressen.KorrespondenzD</IdLocation>
<IndexLocation>^DBAdressen.KorrespondenzI</IndexLocation>
<StreamLocation>^DBAdressen.KorrespondenzS</StreamLocation>
<Data name="Bezeichnung">
<Attribute>Bezeichnung</Attribute>
<Structure>subnode</Structure>
<Subscript>"Bezeichnung"</Subscript>
</Data>
<Data name="KorrespondenzDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Nummer</Value>
</Value>
<Value name="3">
<Value>DokumentTyp</Value>
</Value>
<Value name="4">
<Value>DateiEndung</Value>
</Value>
<Value name="5">
<Value>Erfassungsdatum</Value>
</Value>
<Value name="6">
<Value>Nachfassdatum</Value>
</Value>
<Value name="7">
<Value>File</Value>
</Value>
<Value name="8">
<Value>KorrTyp</Value>
</Value>
<Value name="9">
<Value>Adresse</Value>
</Value>
<Value name="10">
<Value>Status</Value>
</Value>
<Value name="11">
<Value>Sachbearbeiter</Value>
</Value>
<Value name="12">
<Value>EMail</Value>
</Value>
<Value name="13">
<Value>Serienbrief</Value>
</Value>
<Value name="14">
<Value>Bemerkung</Value>
</Value>
<Value name="15">
<Value>Mitarbeiter</Value>
</Value>
<Value name="16">
<Value>InEdit</Value>
</Value>
<Value name="17">
<Value>EditStart</Value>
</Value>
<Value name="18">
<Value>EditSachbearbeiterNr</Value>
</Value>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="Adresse">
</Property>
<Property name="Bemerkung">
</Property>
<Property name="Bezeichnung">
</Property>
<Property name="DateiEndung">
</Property>
<Property name="DokumentTyp">
</Property>
<Property name="EMail">
</Property>
<Property name="EditSachbearbeiterNr">
</Property>
<Property name="EditStart">
</Property>
<Property name="Erfassungsdatum">
</Property>
<Property name="File">
</Property>
<Property name="InEdit">
</Property>
<Property name="KorrTyp">
</Property>
<Property name="Mitarbeiter">
</Property>
<Property name="Nachfassdatum">
</Property>
<Property name="Sachbearbeiter"/>
<Property name="Serienbrief">
</Property>
<Property name="Status">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.KorrespondenzRecht">
<Super>%Persistent</Super>
<TimeChanged>62438,40801.14542</TimeChanged>
<TimeCreated>62346,42697.001179</TimeCreated>

<Property name="Rolle">
<Type>DBCore.Rolle</Type>
<Cardinality>one</Cardinality>
<Inverse>KorrespondenzRecht</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="Korrespondenz">
<Type>DBAdressen.Korrespondenz</Type>
<Cardinality>one</Cardinality>
<Inverse>Recht</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="Korrespondenztyp">
<Type>DBAdressen.SD.KorrTyp</Type>
<Cardinality>one</Cardinality>
<Inverse>Recht</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="Typ">
<Type>%Integer</Type>
</Property>

<Index name="KorrTypRolle">
<Properties>Rolle,Korrespondenz,Korrespondenztyp</Properties>
<Unique>1</Unique>
</Index>

<Method name="CopyRechteToKorrespondenz">
<ClassMethod>1</ClassMethod>
<FormalSpec>Korrtyp:%String,Korrespondenz:%String</FormalSpec>
<Implementation><![CDATA[
	&sql(DELETE FROM DBAdressen.KorrespondenzRecht WHERE Korrespondenz = :Korrespondenz)
	
	set sourceId = ""
 	&sql(DECLARE SourceCur CURSOR FOR
    		SELECT ID 
    				Into :sourceId
    		FROM DBAdressen.KorrespondenzRecht 
    		WHERE Korrespondenztyp=:Korrtyp)
	
 	&sql(OPEN SourceCur)
 	&sql(FETCH SourceCur)
 	
	set korrespondenz = ##class(DBAdressen.Korrespondenz).%OpenId(Korrespondenz)
	
 	While (SQLCODE = 0) {
	 	set source = ##class(DBAdressen.KorrespondenzRecht).%OpenId(sourceId)
	 	set newObj = ##class(DBAdressen.KorrespondenzRecht).%New()
	 	set newObj.Korrespondenz = korrespondenz
	 	set newObj.Rolle = source.Rolle
	 	set newObj.Typ = source.Typ
	 	set s = newObj.%Save()
	 	if ($$$ISERR(s)) {
		 	set status = s
		}
		set source = ""
		set newObj = ""
		&sql(FETCH SourceCur)
 	}
 	
 	set korrespondenz = ""
 	
    &sql(CLOSE SourceCur)
]]></Implementation>
</Method>

<Method name="CopyRechte">
<ClassMethod>1</ClassMethod>
<FormalSpec>VonKorrespondenz:%String,NachKorrespondenz:%String</FormalSpec>
<Implementation><![CDATA[
	&sql(DELETE FROM DBAdressen.KorrespondenzRecht WHERE Korrespondenz = :NachKorrespondenz)
	
	set sourceId = ""
 	&sql(DECLARE SourceDokCur CURSOR FOR
    		SELECT ID 
    				Into :sourceId
    		FROM DBAdressen.KorrespondenzRecht 
    		WHERE Korrespondenz=:VonKorrespondenz)
	
 	&sql(OPEN SourceDokCur)
 	&sql(FETCH SourceDokCur)
 	
	set korrespondenz = ##class(DBAdressen.Korrespondenz).%OpenId(NachKorrespondenz)
	
 	While (SQLCODE = 0) {
	 	set source = ##class(DBAdressen.KorrespondenzRecht).%OpenId(sourceId)
	 	set newObj = ##class(DBAdressen.KorrespondenzRecht).%New()
	 	set newObj.Korrespondenz = korrespondenz
	 	set newObj.Rolle = source.Rolle
	 	set newObj.Typ = source.Typ
	 	set s = newObj.%Save()
	 	if ($$$ISERR(s)) {
		 	set status = s
		}
		set source = ""
		set newObj = ""
		&sql(FETCH SourceDokCur)
 	}
 	
 	set korrespondenz = ""
 	
    &sql(CLOSE SourceDokCur)
]]></Implementation>
</Method>

<Method name="SetAlleRechtOffen">
<ClassMethod>1</ClassMethod>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set rolleId = ""
 	&sql(DECLARE RolleCur CURSOR FOR
    		SELECT ID 
    				Into :rolleId
    		FROM DBCore.Rolle)
	
 	&sql(OPEN RolleCur)
 	&sql(FETCH RolleCur)
 	
	
 	While (SQLCODE = 0) {
	 	set rolle = ##class(DBCore.Rolle).%OpenId(rolleId)
	 	
	 	set korrespondenzId = ""
 		&sql(DECLARE DokCur CURSOR FOR
    		SELECT ID 
    				Into :korrespondenzId
    		FROM DBAdressen.Korrespondenz)
	
 		&sql(OPEN DokCur)
 		&sql(FETCH DokCur)
 		
 		While (SQLCODE = 0) {
	 		set korrespondenz = ##class(DBAdressen.Korrespondenz).%OpenId(korrespondenzId)
	 		set newObj = ##class(DBAdressen.KorrespondenzRecht).%New()	
	 		set newObj.Korrespondenz = korrespondenz
	 		set newObj.Rolle = rolle
	 		set newObj.Typ = ##class(DBAdressen.Konst).RechtOffen()
	 		set s = newObj.%Save()
	 		set korrespondenz = ""
			set newObj = ""
			&sql(FETCH DokCur)
 		}
    	&sql(CLOSE DokCur)
    	
    	set korrTypId = ""
 		&sql(DECLARE DokTypCur CURSOR FOR
    		SELECT ID 
    				Into :korrTypId
    		FROM DBAdressen_SD.KorrTyp)
	
 		&sql(OPEN DokTypCur)
 		&sql(FETCH DokTypCur)
 		
 		While (SQLCODE = 0) {
	 		set korrTyp = ##class(DBAdressen.SD.KorrTyp).%OpenId(korrTypId)
	 		set newObj = ##class(DBAdressen.KorrespondenzRecht).%New()	
	 		set newObj.Korrespondenztyp = korrTyp
	 		set newObj.Rolle = rolle
	 		set newObj.Typ =  ##class(DBAdressen.Konst).RechtOffen()
	 		set s = newObj.%Save()
	 		set korrTyp = ""
			set newObj = ""
			&sql(FETCH DokTypCur)
 		}
    	&sql(CLOSE DokTypCur)
    	
 		set rolle = ""
		&sql(FETCH RolleCur)
 	}	
 	
    &sql(CLOSE RolleCur)
    quit ""
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.KorrespondenzRechtD</DataLocation>
<DefaultData>KorrespondenzRechtDefaultData</DefaultData>
<IdLocation>^DBAdressen.KorrespondenzRechtD</IdLocation>
<IndexLocation>^DBAdressen.KorrespondenzRechtI</IndexLocation>
<StreamLocation>^DBAdressen.KorrespondenzRechtS</StreamLocation>
<Data name="KorrespondenzRechtDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Rolle</Value>
</Value>
<Value name="3">
<Value>Korrespondenz</Value>
</Value>
<Value name="4">
<Value>Korrespondenztyp</Value>
</Value>
<Value name="5">
<Value>Typ</Value>
</Value>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="Korrespondenz">
</Property>
<Property name="Korrespondenztyp">
</Property>
<Property name="Rolle">
</Property>
<Property name="Typ">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.Mitarbeiter">
<Description>
</Description>
<Super>%Persistent,%Populate,%XML.Adaptor</Super>
<TimeChanged>62438,40801.397261</TimeChanged>
<TimeCreated>61002,31445.52006</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Mitarbeiternr">
<Type>%Library.Integer</Type>
<Required>1</Required>
<Parameter name="MAXVAL" value="9999"/>
<Parameter name="MINVAL" value="1"/>
<Parameter name="POPSPEC" value="Integer(1,9999)"/>
</Property>

<Index name="MitarbeiternrIndex">
<Properties>Adresse,Mitarbeiternr</Properties>
<Unique>1</Unique>
</Index>

<Property name="Anrede">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Vorname">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="POPSPEC" value="FirstName()"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Name">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="POPSPEC" value="Name()"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Index name="NameIndex">
<Type>bitmap</Type>
<Properties>Name:Exact</Properties>
</Index>

<Property name="Position">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="TelefonDirekt">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="POPSPEC" value="USPhone()"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Fax">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="POPSPEC" value="USPhone()"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Mobil">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="POPSPEC" value="USPhone()"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="EMail">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Geburtsdatum">
<Type>%Date</Type>
</Property>

<Property name="Info1">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Info2">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Info3">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Adresse">
<Type>DBAdressen.Adresse</Type>
<Cardinality>one</Cardinality>
<Inverse>MitarbeiterAdresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Adresse"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="AdresseIndex">
<Properties>Adresse</Properties>
</Index>

<Property name="Intern">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="TelefonatMitarbeiter">
<Type>DBAdressen.TelefonatKopf</Type>
<Cardinality>many</Cardinality>
<Inverse>AnsprechspersMitarbeiter</Inverse>
<Relationship>1</Relationship>
</Property>

<Method name="GetNextNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>AdressOid:%String</FormalSpec>
<ReturnType>%Library.Integer</ReturnType>
<Implementation><![CDATA[
	set retval = 0
	&sql(SELECT Max(Mitarbeiternr) INTO :retval FROM DBAdressen.Mitarbeiter WHERE Adresse = :AdressOid)
	Set retval = +retval + 1
	Quit retval
]]></Implementation>
</Method>

<Property name="QMeldAnsprechsperson">
<Type>DBTQM.QMeldung</Type>
<Cardinality>many</Cardinality>
<Inverse>AnsprechspersMitarbeiter</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="AuftragskopfAgrofresh">
<Type>DBAgrofresh.Auftragskopf</Type>
<Cardinality>many</Cardinality>
<Inverse>Mitarbeiter</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="DebitorVorschlag">
<Type>DBDebiKredi.Debitor</Type>
<Cardinality>many</Cardinality>
<Inverse>VorschlagMitarbeiter</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="MultiSelMitarbeiter">
<Type>DBAdressen.MitarbeiterMultiSel</Type>
<Cardinality>many</Cardinality>
<Inverse>Mitarbeiter</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Method name="%OnDelete">
<Description><![CDATA[
This callback method is invoked by the <METHOD>%Delete</METHOD> method to 
provide notification that the object specified by <VAR>oid</VAR> is being deleted.

<P>If this method returns an error then the object will not be deleted.
[Previously private]]]></Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>oid:%ObjectIdentity</FormalSpec>
<ReturnType>%Status</ReturnType>
<ServerOnly>1</ServerOnly>
<Implementation><![CDATA[
	Set status = $$$OK
	set mitarbeiterId = $lg(oid,1)
	
	set telefonatKopfId = ""
 	&sql(DECLARE CurMaTelefon CURSOR FOR
    		SELECT ID 
    				Into :telefonatKopfId
    		FROM DBAdressen.TelefonatKopf 
    		WHERE AnsprechspersMitarbeiter=:mitarbeiterId)
	
 	&sql(OPEN CurMaTelefon)
 	&sql(FETCH CurMaTelefon)
 	While (SQLCODE = 0) {
	 	set tk = ##class(DBAdressen.TelefonatKopf).%OpenId(telefonatKopfId)
	 	set tk.AnsprechspersMitarbeiter = ""
	 	set s = tk.%Save()
	 	if ($$$ISERR(s)) {
		 	set status = s
		 	w "DBAdressen.Mitarbeiter.%OnDelete - TelefonatKopf:", telefonatKopfId, " Status:",s,!
	 	}
		&sql(FETCH CurMaTelefon)
 	}
    &sql(CLOSE CurMaTelefon)
    
    
    set QMeldAnsprechspersonId = ""
 	&sql(DECLARE CurQMeldung CURSOR FOR
    		SELECT ID 
    				Into :QMeldAnsprechspersonId
    		FROM DBTQM.QMeldung 
    		WHERE AnsprechspersMitarbeiter=:mitarbeiterId)
	
 	&sql(OPEN CurQMeldung)
 	&sql(FETCH CurQMeldung)
 	While (SQLCODE = 0) {
	 	set qm = ##class(DBTQM.QMeldung).%OpenId(QMeldAnsprechspersonId)
	 	set qm.AnsprechspersMitarbeiter = ""
	 	set s = qm.%Save()
	 	if ($$$ISERR(s)) {
		 	set status = s
		 	w "DBAdressen.Mitarbeiter.%OnDelete - QMeldung:", QMeldAnsprechspersonId, " Status:",s,!
	 	}
		&sql(FETCH CurQMeldung)
 	}
    &sql(CLOSE CurQMeldung)
    
    
    set AuftragskopfAgrofreshId = ""
 	&sql(DECLARE CurAgrofreshAuftragskopf CURSOR FOR
    		SELECT ID 
    				Into :AuftragskopfAgrofreshId
    		FROM DBAgrofresh.Auftragskopf 
    		WHERE Mitarbeiter=:mitarbeiterId)
	
 	&sql(OPEN CurAgrofreshAuftragskopf)
 	&sql(FETCH CurAgrofreshAuftragskopf)
 	While (SQLCODE = 0) {
	 	do ##class(DBAgrofresh.Auftragskopf).SetFlagAutoMutiert(AuftragskopfAgrofreshId, 1)
	 	set ak = ##class(DBAgrofresh.Auftragskopf).%OpenId(AuftragskopfAgrofreshId)
	 	set ak.Mitarbeiter = ""
	 	set s = ak.%Save()
	 	if ($$$ISERR(s)) {
		 	set status = s
		 	w "DBAdressen.Mitarbeiter.%OnDelete - Agrofresh-Auftragskopf:", AuftragskopfAgrofreshId, " Status:",s,!
	 	}
	 	do ##class(DBAgrofresh.Auftragskopf).SetFlagAutoMutiert(AuftragskopfAgrofreshId, 0)
		&sql(FETCH CurAgrofreshAuftragskopf)
 	}
    &sql(CLOSE CurAgrofreshAuftragskopf)
    
    
    set VorschlagMitarbeiterId = ""
 	&sql(DECLARE CurDebitor CURSOR FOR
    		SELECT ID 
    				Into :VorschlagMitarbeiterId
    		FROM DBDebiKredi.Debitor 
    		WHERE VorschlagMitarbeiter=:mitarbeiterId)
    		
 	&sql(OPEN CurDebitor)
 	&sql(FETCH CurDebitor)
 	While (SQLCODE = 0) {
	 	set debi = ##class(DBDebiKredi.Debitor).%OpenId(VorschlagMitarbeiterId)
	 	set debi.VorschlagMitarbeiter = ""
	 	set s = debi.%Save()
	 	if ($$$ISERR(s)) {
		 	set status = s
		 	w "DBAdressen.Mitarbeiter.%OnDelete - Debitor:", VorschlagMitarbeiterId, " Status:",s,!
	 	}
	 	&sql(FETCH CurDebitor)
 	}
    &sql(CLOSE CurDebitor)
    

 	set maMultiSelId = ""
 	&sql(DECLARE CurMaMultiSel CURSOR FOR
    		SELECT ID 
    				Into :maMultiSelId
    		FROM DBAdressen.MitarbeiterMultiSel 
    		WHERE Mitarbeiter=:mitarbeiterId)
    		
 	&sql(OPEN CurMaMultiSel)
 	&sql(FETCH CurMaMultiSel)
 	While (SQLCODE = 0) {
	 	set s = ##class(DBAdressen.MitarbeiterMultiSel).%DeleteId(maMultiSelId)
	 	if ($$$ISERR(s)) {
		 	set status = s
		 	w "DBAdressen.Mitarbeiter.%OnDelete - Mitarbeiter MultiSelektion:", maMultiSelId, " Status:",s,!
	 	}
	 	&sql(FETCH CurMaMultiSel)
 	}
    &sql(CLOSE CurMaMultiSel)
    
    Quit status
]]></Implementation>
</Method>

<Method name="GetOidByNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>AdressOid:%String,MitarbeiterNr:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	set id = ""
	&sql(SELECT ID INTO :id FROM DBAdressen.Mitarbeiter
	WHERE Adresse = :AdressOid
	AND Mitarbeiternr = :MitarbeiterNr)

	if (SQLCODE '= 0) {
		set id=""
	}
	Quit id
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.MitarbeiterD</DataLocation>
<DefaultData>MitarbeiterDefaultData</DefaultData>
<IdLocation>^DBAdressen.MitarbeiterD</IdLocation>
<IndexLocation>^DBAdressen.MitarbeiterI</IndexLocation>
<StreamLocation>^DBAdressen.MitarbeiterS</StreamLocation>
<Data name="MitarbeiterDefaultData">
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Mitarbeiternr</Value>
</Value>
<Value name="3">
<Value>Anrede</Value>
</Value>
<Value name="4">
<Value>Vorname</Value>
</Value>
<Value name="5">
<Value>Name</Value>
</Value>
<Value name="6">
<Value>Position</Value>
</Value>
<Value name="7">
<Value>TelefonDirekt</Value>
</Value>
<Value name="8">
<Value>Fax</Value>
</Value>
<Value name="9">
<Value>Mobil</Value>
</Value>
<Value name="10">
<Value>EMail</Value>
</Value>
<Value name="11">
<Value>Geburtsdatum</Value>
</Value>
<Value name="12">
<Value>Info1</Value>
</Value>
<Value name="13">
<Value>Info2</Value>
</Value>
<Value name="14">
<Value>Info3</Value>
</Value>
<Value name="15">
<Value>Adresse</Value>
</Value>
<Value name="16">
<Value>Intern</Value>
</Value>
<Value name="17">
<Value>Mailing</Value>
</Value>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="Adresse">
</Property>
<Property name="Anrede">
</Property>
<Property name="EMail">
</Property>
<Property name="Fax">
</Property>
<Property name="Geburtsdatum">
</Property>
<Property name="Info1">
</Property>
<Property name="Info2">
</Property>
<Property name="Info3">
</Property>
<Property name="Intern">
</Property>
<Property name="Mitarbeiternr">
</Property>
<Property name="Mobil">
</Property>
<Property name="Name">
</Property>
<Property name="Position">
</Property>
<Property name="TelefonDirekt">
</Property>
<Property name="Vorname">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.MitarbeiterMultiSel">
<Description>
</Description>
<Super>%Persistent,%XML.Adaptor</Super>
<TimeChanged>62438,40801.364607</TimeChanged>
<TimeCreated>62164,30966.829649</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="MAMultiSel">
<Type>DBAdressen.SD.MAMultiSel</Type>
<Cardinality>one</Cardinality>
<Inverse>MitarbeiterMultiSel</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="MAMultiSel"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="MAMultiSelIndex">
<Properties>MAMultiSel</Properties>
</Index>

<Property name="Mitarbeiter">
<Type>DBAdressen.Mitarbeiter</Type>
<Cardinality>one</Cardinality>
<Inverse>MultiSelMitarbeiter</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Mitarbeiter"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="MitarbeiterIndex">
<Properties>Mitarbeiter</Properties>
</Index>

<Index name="MitarbeiterMultiSelIndex">
<Properties>Mitarbeiter,MAMultiSel</Properties>
</Index>

<Method name="GetMitarbeiterInMAMultiSel">
<ClassMethod>1</ClassMethod>
<FormalSpec>Mitarbeiter:%String,MAMultiSel:%String</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set ret = 0
	set mamultisel = ""
	For index = 1:1:($Length(MAMultiSel, "-") && ret=0) {
		set mamultisel = $Piece(MAMultiSel, "-", +index)
		&sql(SELECT COUNT(ID) INTO :ret FROM DBAdressen.MitarbeiterMultiSel 
		WHERE Mitarbeiter = :Mitarbeiter AND MAMultiSel->Code 
		LIKE :mamultisel)
		if (ret > 0) {
			set res = 1
		} else {
			set res = 0	
		}
	}
	quit res
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.MitarbeiterFAB6D</DataLocation>
<DefaultData>MitarbeiterMultiSelDefaultData</DefaultData>
<IdLocation>^DBAdressen.MitarbeiterFAB6D</IdLocation>
<IndexLocation>^DBAdressen.MitarbeiterFAB6I</IndexLocation>
<StreamLocation>^DBAdressen.MitarbeiterFAB6S</StreamLocation>
<Data name="MitarbeiterMultiSelDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>MAMultiSel</Value>
</Value>
<Value name="3">
<Value>Mitarbeiter</Value>
</Value>
</Data>
<Property name="MAMultiSel"/>
<Property name="Mitarbeiter"/>
</Storage>
</Class>


<Class name="DBAdressen.MultiSelAdresse">
<Super>%Persistent,%XML.Adaptor</Super>
<TimeChanged>62438,40801.533755</TimeChanged>
<TimeCreated>61297,65778.112409</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Adresse">
<Type>DBAdressen.Adresse</Type>
<Cardinality>one</Cardinality>
<Inverse>IndMultiSelAdresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Adresse"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="AdresseIndex">
<Properties>Adresse</Properties>
</Index>

<Property name="IndMultiSel">
<Type>DBAdressen.SD.IndMultiSel</Type>
<Cardinality>one</Cardinality>
<Inverse>MultiSelAdresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="IndMultiSel"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="IndMultiSelIndex">
<Properties>IndMultiSel</Properties>
</Index>

<Index name="AdresseMultiSelIndex">
<Properties>Adresse,IndMultiSel</Properties>
<Unique>1</Unique>
</Index>

<Method name="GetAdrInMultiSel">
<ClassMethod>1</ClassMethod>
<FormalSpec>Adresse:%String,Multisel:%String</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set ret = 0
	set res = 0
	set multisel = ""
	For index = 1:1:($Length(Multisel, "-")) {
		set multisel = $Piece(Multisel, "-", +index)
		&sql(SELECT COUNT(ID) INTO :ret FROM DBAdressen.MultiSelAdresse WHERE Adresse = :Adresse AND IndMultiSel->Kuerzel LIKE :multisel)
		if (ret > 0) {
			set res = ret
		}
	}
	quit res
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.MultiSelAdresseD</DataLocation>
<DefaultData>MultiSelAdresseDefaultData</DefaultData>
<IdLocation>^DBAdressen.MultiSelAdresseD</IdLocation>
<IndexLocation>^DBAdressen.MultiSelAdresseI</IndexLocation>
<StreamLocation>^DBAdressen.MultiSelAdresseS</StreamLocation>
<Data name="MultiSelAdresseDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Zugewiesen</Value>
</Value>
<Value name="3">
<Value>Adresse</Value>
</Value>
<Value name="4">
<Value>IndMultiSel</Value>
</Value>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="Adresse">
</Property>
<Property name="IndMultiSel">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.MultiSelZA">
<Super>%Persistent,%XML.Adaptor</Super>
<TimeChanged>62438,40801.626043</TimeChanged>
<TimeCreated>61920,41311.103095</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Zusatzadresse">
<Type>DBAdressen.ZusatzAdresse</Type>
<Cardinality>one</Cardinality>
<Inverse>MutliSel</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Zusatzadresse"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="ZusatzadresseIndex">
<Properties>Zusatzadresse</Properties>
</Index>

<Property name="MultiSel">
<Type>DBAdressen.SD.ZAMultiSel</Type>
<Cardinality>one</Cardinality>
<Inverse>ZusatzAdresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="MultiSel"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="MultiSelIndex">
<Properties>MultiSel</Properties>
</Index>

<Method name="GetZAInMultiSel">
<ClassMethod>1</ClassMethod>
<FormalSpec>ZusatzAdresse:%String,Multisel:%String</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set ret = 0
	set res = 0
	set multisel = ""
	For index = 1:1:($Length(Multisel, "-")) {
		set multisel = $Piece(Multisel, "-", +index)
		&sql(SELECT COUNT(ID) INTO :ret FROM DBAdressen.MultiSelZA WHERE Zusatzadresse = :ZusatzAdresse AND MultiSel->Kuerzel LIKE :multisel)
		if (ret > 0) {
			set res = ret
		}
	}
	quit res
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.MultiSelZAD</DataLocation>
<DefaultData>MultiSelZADefaultData</DefaultData>
<IdLocation>^DBAdressen.MultiSelZAD</IdLocation>
<IndexLocation>^DBAdressen.MultiSelZAI</IndexLocation>
<StreamLocation>^DBAdressen.MultiSelZAS</StreamLocation>
<Data name="MultiSelZADefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Zusatzadresse</Value>
</Value>
<Value name="3">
<Value>MultiSel</Value>
</Value>
</Data>
<Property name="MultiSel"/>
<Property name="Zusatzadresse"/>
</Storage>
</Class>


<Project name="DBAdressen" Target="##class(DBAdressen.MultiSelAdresse).GetAdrInMultiSel(&quot;1&quot;, &quot;T1-T2-T3&quot;)" TargetType="0">
  <Items>
    <ProjectItem name="DBAdressen.AF.AdresseAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.BesuchsRapportAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.BrancheAdresseAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.DokumentAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.DokumentRechtAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.EMailAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.EMailAnhang" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.KorrespondenzAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.KorrespondenzRechtAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.MitarbeiterAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.MitarbeiterMultiSelAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.MultiSelAdresseAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.MultiSelZAAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.PendenzAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.RgInfoPosAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.AdrReportAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.AdressSelAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.AdressgruppeAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.AnredeAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.BrancheAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.BriefanredeAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.DokumentengrpAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.DokumententypAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.GebietAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.IndMultiSelAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.IndSel1AF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.IndSel2AF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.IndSel3AF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.IndSel4AF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.IndSel5AF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.IndSelBoni1AF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.IndSelBoni2AF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.KorrTypAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.KundengruppeAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.KundenkategorieAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.LieferantengrpAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.MAMultiSelAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.PreiskategorieAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.PrioritaetAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.Selektion1AF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.Selektion2AF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.StatusAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.StatusBesuchAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.VertreterAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.VorlageAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.ZAMultiSelAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.ZASelektion1AF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.ZASelektion2AF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SD.ZASelektion3AF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.SerienbriefAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.TelefonatAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.TourDetailAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.AF.ZusatzAdresseAF" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.Adresse" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.Besuchsrapport" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.BrancheAdresse" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.Dokument" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.DokumentRecht" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.DokumentStream" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.EMail" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.EMailAnhang" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.ImportDouble" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.ImportFile" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.ImportNew" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.Konst" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.Korrespondenz" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.KorrespondenzRecht" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.Mitarbeiter" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.MitarbeiterMultiSel" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.MultiSelAdresse" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.MultiSelZA" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.Pendenz" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.RgInfoKopf" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.RgInfoPos" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.AdressReport" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.Adresselektion" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.Adressgruppe" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.Anrede" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.Branche" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.Briefanrede" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.Dokumentengrp" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.Dokumententyp" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.Gebiet" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.IndMultiSel" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.IndSelBoni" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.IndSelBoni1" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.IndSelBoni2" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.IndSelektion" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.IndSelektion1" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.IndSelektion2" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.IndSelektion3" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.IndSelektion4" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.IndSelektion5" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.KorrTyp" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.Kundengruppe" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.Kundenkategorie" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.Lieferantengrp" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.MAMultiSel" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.Preiskategorie" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.Prioritaet" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.Selektion1" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.Selektion2" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.Status" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.StatusBesuch" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.Vertreter" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.Vorlage" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.ZAMultiSel" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.ZASelektion" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.ZASelektion1" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.ZASelektion2" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SD.ZASelektion3" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.SearchDouble" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.Serienbrief" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.Soundex" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.TelefonatDetail" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.TelefonatKopf" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.TourDetail" type="CLS"></ProjectItem>
    <ProjectItem name="DBAdressen.ZusatzAdresse" type="CLS"></ProjectItem>
  </Items>
</Project>


<Class name="DBAdressen.Pendenz">
<Super>%Persistent,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40830.716663</TimeChanged>
<TimeCreated>62115,55954.823627</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Mandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKMandant">
<Properties>Mandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="MandantIdx">
<Properties>Mandant</Properties>
</Index>

<Property name="Erfassungsdatum">
<Type>%Date</Type>
</Property>

<Property name="Termin">
<Type>%Date</Type>
</Property>

<Property name="Status">
<Type>%Integer</Type>
</Property>

<Property name="Text">
<Type>%String</Type>
<Parameter name="MAXLEN" value="1024"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Sachbearbeiter">
<Type>DBCore.Mitarbeiter</Type>
<Cardinality>one</Cardinality>
<Inverse>BearbeiterPendenz</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Sachbearbeiter"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Property name="Projekt">
<Type>DBIntrap.SD.Projekt</Type>
<Cardinality>one</Cardinality>
<Inverse>ProjektPendenz</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Projekt"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Property name="Adresse">
<Type>DBAdressen.Adresse</Type>
<Cardinality>one</Cardinality>
<Inverse>Pendenz</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Adresse"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="SachbearbeiterIdx">
<Properties>Sachbearbeiter</Properties>
</Index>

<Property name="Prioritaet">
<Type>DBIntrap.SD.Prio</Type>
<Cardinality>one</Cardinality>
<Inverse>PendenzPrioritaet</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Prioritaet"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Property name="Benutzer">
<Type>%String</Type>
</Property>

<Property name="Erledigung">
<Type>%Date</Type>
</Property>

<Method name="CopyPendenz">
<ClassMethod>1</ClassMethod>
<FormalSpec>oid:%String,mandOid:%String,sprache:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	Set srcPendenz = ##class(DBAdressen.Pendenz).%OpenId(oid)
	Set newObj = srcPendenz.%ConstructClone(-1)
	if ((mandOid '= "") && (mandOid '= $c(0))) {
		set newObj.Mandant = mandOid
	}	
	Set newObj.Termin = srcPendenz.Termin
	Set newObj.Sachbearbeiter = srcPendenz.Sachbearbeiter
	Set newObj.Status = srcPendenz.Status
	Set newObj.Prioritaet = srcPendenz.Prioritaet
	Set newObj.Adresse = srcPendenz.Adresse
	Set newObj.Projekt = srcPendenz.Projekt
	/*Do newObj.%Save()*/
	set srcPendenz = ""
	set id = newObj.%Id()
	set newObj = ""
	Quit id
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.PendenzD</DataLocation>
<DefaultData>PendenzDefaultData</DefaultData>
<IdLocation>^DBAdressen.PendenzD</IdLocation>
<IndexLocation>^DBAdressen.PendenzI</IndexLocation>
<StreamLocation>^DBAdressen.PendenzS</StreamLocation>
<Data name="PendenzDefaultData">
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Mandant</Value>
</Value>
<Value name="3">
<Value>Erfassungsdatum</Value>
</Value>
<Value name="4">
<Value>Termin</Value>
</Value>
<Value name="5">
<Value>Status</Value>
</Value>
<Value name="6">
<Value>Text</Value>
</Value>
<Value name="7">
<Value>Sachbearbeiter</Value>
</Value>
<Value name="8">
<Value>Projekt</Value>
</Value>
<Value name="9">
<Value>Adresse</Value>
</Value>
<Value name="10">
<Value>Problemtyp</Value>
</Value>
<Value name="11">
<Value>Prioritaet</Value>
</Value>
<Value name="12">
<Value>Benutzer</Value>
</Value>
<Value name="13">
<Value>Erledigung</Value>
</Value>
</Data>
<Property name="Adresse"/>
<Property name="Benutzer"/>
<Property name="Erfassungsdatum"/>
<Property name="Erledigung"/>
<Property name="Mandant"/>
<Property name="Prioritaet"/>
<Property name="Projekt"/>
<Property name="Sachbearbeiter"/>
<Property name="Status"/>
<Property name="Termin"/>
<Property name="Text"/>
</Storage>
</Class>


<Class name="DBAdressen.RgInfoKopf">
<Description>
</Description>
<Super>%Persistent,%XML.Adaptor</Super>
<TimeChanged>62439,53527.744209</TimeChanged>
<TimeCreated>61508,32417.231151</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Mandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKMandant">
<Properties>Mandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="MandantIdx">
<Properties>Mandant</Properties>
</Index>

<Property name="AuftragsNr">
<Description>
Auftags-Nummer</Description>
<Type>%Integer</Type>
</Property>

<Property name="LieferscheinNr">
<Description>
Lieferschein-Nr</Description>
<Type>%Integer</Type>
</Property>

<Property name="RechnungsNr">
<Description>
Rechnungs-Nr</Description>
<Type>%Integer</Type>
</Property>

<Property name="Auftragsdatum">
<Description>
Auftragsdatum</Description>
<Type>%Date</Type>
</Property>

<Property name="Lieferdatum">
<Description>
Lieferdatum</Description>
<Type>%Date</Type>
</Property>

<Property name="Rechnungsdatum">
<Description>
Rechnungsdatum</Description>
<Type>%Date</Type>
</Property>

<Property name="Text">
<Description>
Text</Description>
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Typ">
<Description>
Typ</Description>
<Type>%Integer</Type>
</Property>

<Property name="Adresse">
<Type>DBAdressen.Adresse</Type>
<Cardinality>one</Cardinality>
<Inverse>RgInfoKopf</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Adresse"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="AdresseIndex">
<Properties>Adresse</Properties>
</Index>

<Property name="Positionen">
<Type>DBAdressen.RgInfoPos</Type>
<Cardinality>children</Cardinality>
<Inverse>Kopf</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="BetragInklMwst">
<Type>%Decimal</Type>
<Calculated>1</Calculated>
<SqlComputeCode> Set {BetragInklMwst}=##class(DBAdressen.RgInfoKopf).GetBetragInklMwstClass({ID}) </SqlComputeCode>
<SqlComputed>1</SqlComputed>
<Parameter name="SCALE" value="5"/>
</Property>

<Method name="GetBetragInklMwstClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>Oid:%String</FormalSpec>
<ReturnType>%Decimal</ReturnType>
<ReturnTypeParams>SCALE=5</ReturnTypeParams>
<Implementation><![CDATA[
	set betrag = 0
	&sql(SELECT SUM(BetragInklMwst) INTO :betrag FROM DBAdressen.RgInfoPos
	     WHERE Kopf = :Oid)
	Quit betrag
]]></Implementation>
</Method>

<Method name="CreateRgInfoFromFakturierung">
<Description>
TODO: Umbau und in .Net zügeln, da Agrofresh/EK auch in .Net gemacht wird</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>RgNr:%Integer,MandantOid:%String,textLieferung:%String,textRechnung:%String,textGebinde:%String,textzeilenVerbuchen:%Boolean</FormalSpec>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
	Set strSQL = "SELECT ID FROM DBFakturierung.Auftragskopf WHERE RechnungsNr="_RgNr_
					" AND Mandant="_MandantOid
	Set rs = ##class(%Library.ResultSet).%New("%DynamicQuery:SQL")
	
	Do rs.Prepare(strSQL)
	Set sc=rs.Execute()
	
	IF $$$ISOK(sc) {
		
		while (rs.Next(.sc)) {
			
			Set auftrag = ##class(DBFakturierung.Auftragskopf).%OpenId(rs.Data("ID"))
	
			Set kopf = ##class(DBAdressen.RgInfoKopf).%New()
			Set kopf.Adresse = auftrag.ZahlAdresse.Adresse
			Set kopf.Auftragsdatum = auftrag.Auftragsdatum
			Set kopf.AuftragsNr = auftrag.AuftragsNr
			Set kopf.Lieferdatum = auftrag.Lieferdatum
			Set kopf.LieferscheinNr = auftrag.LieferscheinNr
			Set kopf.Rechnungsdatum = auftrag.Rechnungsdatum
			Set kopf.RechnungsNr = auftrag.RechnungsNr
			Set kopf.Text = textLieferung_" "_auftrag.LieferscheinNr_", "_textRechnung_" "_auftrag.RechnungsNr_", "_$REPLACE($ZDATE(auftrag.Rechnungsdatum,4),"/",".")
			Set kopf.Typ = ##class(DBAdressen.Konst).RgInfoRGFakt()
			Set kopf.Mandant = MandantOid
	
			Set sc = kopf.%Save()
			IF $$$ISOK(sc) {
				if (auftrag.IsGarantieAuftrag '= 0) {
					Set pos = ##class(DBAdressen.RgInfoPos).%New()
					Set pos.ArtikelNr = ""
					Set pos.BetragInklMwst = 0
					Set pos.Einheit = ""
					Set pos.Kopf = kopf
					Set pos.Menge = 0
					Set pos.MwstBetrag = 0
					Set pos.PositionsNr = 0
					Set pos.Preis = 0
					Set pos.RabattBetrag = 0
					Set pos.Text = "Garantieauftrag"
		
					Set scPos = pos.%Save()
				}
				
				Set strSQL = "SELECT PositionsNr, Artikel->ArtikelNr, DetailText, "_
							 "Menge, DBFakturierung_SD.Mengencode_GetTextClass(Mengeneinheit, "_MandantOid_", 'de') As Einheit, "_
							 "Preis, RabattBetrag, MwstBetrag, BetragInklMwst, Lieferdatum "_
							 "FROM DBFakturierung.Auftragspos "_
							 "WHERE Auftragskopf->RechnungsNr="_RgNr_
							 " AND Auftragskopf->Mandant="_MandantOid_
							 " AND NVL(Artikelcode, 0) <> 8"_
							 " AND (NVL(Artikelcode, 0) < 10"_
							 " OR NVL(Artikelcode, 0) = 21"_
							 " OR NVL(Artikelcode, 0) = 23"_
							 " OR (NVL(Artikelcode, 0) >= 30"_
							 " AND NVL(Artikelcode, 0) <= 33)"_
							 " OR NVL(Artikelcode,0) = DBFakturierung.Konst_AcRabattZwischentotal()"_
							 " OR NVL(Artikelcode,0) = DBFakturierung.Konst_AcRabattGesamttotal())"_ 
							 " ORDER BY Auftragskopf->AuftragsNr, PositionsNr"
				
				if (textzeilenVerbuchen = 1) {
					Set strSQL = "SELECT PositionsNr, Artikel->ArtikelNr, DetailText, "_
								 "Menge, DBFakturierung_SD.Mengencode_GetTextClass(Mengeneinheit, "_MandantOid_", 'de') As Einheit, "_
								 "Preis, RabattBetrag, MwstBetrag, BetragInklMwst, Lieferdatum "_
								 "FROM DBFakturierung.Auftragspos "_
								 "WHERE Auftragskopf->RechnungsNr="_RgNr_
								 " AND Auftragskopf->Mandant="_MandantOid_
								 " AND (NVL(Artikelcode, 0) < 19 AND DetailText<>''"_
								 " OR NVL(Artikelcode, 0) = 21"_
								 " OR NVL(Artikelcode, 0) = 23"_
								 " OR (NVL(Artikelcode, 0) >= 30"_
							 	 " AND NVL(Artikelcode, 0) <= 34)"_
							 	 " OR NVL(Artikelcode,0) = DBFakturierung.Konst_AcRabattZwischentotal()"_
								 " OR NVL(Artikelcode,0) = DBFakturierung.Konst_AcRabattGesamttotal())"_ 
								 " ORDER BY Auftragskopf->AuftragsNr, PositionsNr"
				}
					 
				Set rs = ##class(%Library.ResultSet).%New("%DynamicQuery:SQL")
				Do rs.Prepare(strSQL)
				Set sc=rs.Execute()
		
				Set posNr = 0
				IF $$$ISOK(sc) {
					while (rs.Next(.sc)) {
						Set pos = ##class(DBAdressen.RgInfoPos).%New()
						Set pos.ArtikelNr = rs.Data("ArtikelNr")
						Set pos.BetragInklMwst = rs.Data("BetragInklMwst")
						Set pos.Einheit = rs.Data("BetragInklMwst")
						Set pos.Kopf = kopf
						Set pos.Menge = rs.Data("Menge")
						Set pos.MwstBetrag = rs.Data("MwstBetrag")
						Set pos.PositionsNr = rs.Data("PositionsNr")
						Set pos.Preis = rs.Data("Preis")
						Set pos.RabattBetrag = rs.Data("RabattBetrag")
						Set pos.Text = rs.Data("DetailText")
						Set pos.Lieferdatum = ##class(%Library.Date).OdbcToLogical(rs.Data("Lieferdatum"))
			
						Set scPos = pos.%Save()
				
						If (posNr < pos.PositionsNr) {
							Set posNr = pos.PositionsNr
						}
					}
				}
			}
		}
	}
	Quit sc
]]></Implementation>
</Method>

<Method name="CreateRgInfoFromFaktEK">
<ClassMethod>1</ClassMethod>
<FormalSpec>ArNr:%Integer,MandantOid:%String,textAnlieferung:%String,textAbrechnung:%String,textzeilenVerbuchen:%Boolean</FormalSpec>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
	Set strSQL = "SELECT ID FROM DBFaktEK.Bestellungskopf WHERE AbrechnungsNr="_ArNr_
					" AND Mandant="_MandantOid
	Set rs = ##class(%Library.ResultSet).%New("%DynamicQuery:SQL")
	
	Do rs.Prepare(strSQL)
	Set sc=rs.Execute()
	
	IF $$$ISOK(sc) {
		
		while (rs.Next(.sc)) {
			
			Set auftrag = ##class(DBFaktEK.Bestellungskopf).%OpenId(rs.Data("ID"))
	
			Set kopf = ##class(DBAdressen.RgInfoKopf).%New()
			Set kopf.Adresse = auftrag.ZahlAdresse.Adresse
			Set kopf.Auftragsdatum = auftrag.Bestellungsdatum
			Set kopf.AuftragsNr = auftrag.BestellungsNr
			Set kopf.Lieferdatum = auftrag.Annahmedatum
			Set kopf.LieferscheinNr = auftrag.AnnahmescheinNr
			Set kopf.Rechnungsdatum = auftrag.Abrechnungsdatum
			Set kopf.RechnungsNr = auftrag.AbrechnungsNr
			Set kopf.Text = textAnlieferung_" "_auftrag.AnnahmescheinNr_", "_textAbrechnung_" "_auftrag.AbrechnungsNr_", "_$REPLACE($ZDATE(auftrag.Abrechnungsdatum,4),"/",".")
			Set kopf.Typ = ##class(DBAdressen.Konst).RgInfoBEFaktEK()
			Set kopf.Mandant = MandantOid
	
			Set sc = kopf.%Save()
			w sc,!
			IF $$$ISOK(sc) {
								
				Set strSQL = "SELECT PositionsNr, Artikel->ArtikelNr, DetailText, "_
							 "Menge, DBFakturierung_SD.Mengencode_GetTextClass(Mengeneinheit, "_MandantOid_", 'de') As Einheit, "_
							 "Preis, RabattBetrag, MwstBetrag, BetragInklMwst "_
							 "FROM DBFaktEK.Bestellungspos "_
							 "WHERE Bestellungskopf->AbrechnungsNr="_ArNr_
							 " AND Bestellungskopf->Mandant="_MandantOid_
							 " AND NVL(Artikelcode, 0) <> 8"_
							 " AND(NVL(Artikelcode, 0) < 10"_
							 " OR NVL(Artikelcode, 0) = 21 OR NVL(Artikelcode, 0) = 23 OR NVL(Artikelcode,0) = DBFaktEK.Konst_AcRabattZwischentotal() OR NVL(Artikelcode,0) = DBFaktEK.Konst_AcRabattGesamttotal())"_ 
							 " ORDER BY Bestellungskopf->BestellungsNr, PositionsNr"
				
				if (textzeilenVerbuchen = 1) {
					Set strSQL = "SELECT PositionsNr, Artikel->ArtikelNr, DetailText, "_
								 "Menge, DBFakturierung_SD.Mengencode_GetTextClass(Mengeneinheit, "_MandantOid_", 'de') As Einheit, "_
								 "Preis, RabattBetrag, MwstBetrag, BetragInklMwst "_
								 "FROM DBFaktEK.Bestellungspos "_
								 "WHERE Bestellungskopf->AbrechnungsNr="_ArNr_
							 	 " AND Bestellungskopf->Mandant="_MandantOid_
								 " AND(NVL(Artikelcode, 0) < 19 AND DetailText<>''"_
								 " OR NVL(Artikelcode, 0) = 21 OR NVL(Artikelcode, 0) = 23 OR NVL(Artikelcode,0) = DBFaktEK.Konst_AcRabattZwischentotal() OR NVL(Artikelcode,0) = DBFaktEK.Konst_AcRabattGesamttotal())"_ 
								 " ORDER BY Bestellungskopf->BestellungsNr, PositionsNr"
				}
					 
				Set rs = ##class(%Library.ResultSet).%New("%DynamicQuery:SQL")
				Do rs.Prepare(strSQL)
				Set sc=rs.Execute()
		
				Set posNr = 0
				IF $$$ISOK(sc) {
					while (rs.Next(.sc)) {
						Set pos = ##class(DBAdressen.RgInfoPos).%New()
						Set pos.ArtikelNr = rs.Data("ArtikelNr")
						Set pos.BetragInklMwst = rs.Data("BetragInklMwst")
						Set pos.Einheit = rs.Data("BetragInklMwst")
						Set pos.Kopf = kopf
						Set pos.Menge = rs.Data("Menge")
						Set pos.MwstBetrag = rs.Data("MwstBetrag")
						Set pos.PositionsNr = rs.Data("PositionsNr")
						Set pos.Preis = rs.Data("Preis")
						Set pos.RabattBetrag = rs.Data("RabattBetrag")
						Set pos.Text = rs.Data("DetailText")
			
						Set scPos = pos.%Save()
						w scPos, !
						If (posNr < pos.PositionsNr) {
							Set posNr = pos.PositionsNr
						}
					}
				}
			}
		}
	}
	Quit sc
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.RgInfoKopfD</DataLocation>
<DefaultData>RgInfoKopfDefaultData</DefaultData>
<IdLocation>^DBAdressen.RgInfoKopfD</IdLocation>
<IndexLocation>^DBAdressen.RgInfoKopfI</IndexLocation>
<StreamLocation>^DBAdressen.RgInfoKopfS</StreamLocation>
<Data name="RgInfoKopfDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>AuftragsNr</Value>
</Value>
<Value name="3">
<Value>LieferscheinNr</Value>
</Value>
<Value name="4">
<Value>RechnungsNr</Value>
</Value>
<Value name="5">
<Value>Auftragsdatum</Value>
</Value>
<Value name="6">
<Value>Lieferdatum</Value>
</Value>
<Value name="7">
<Value>Rechnungsdatum</Value>
</Value>
<Value name="8">
<Value>Text</Value>
</Value>
<Value name="9">
<Value>Typ</Value>
</Value>
<Value name="10">
<Value>Adresse</Value>
</Value>
<Value name="11">
<Value>Mandant</Value>
</Value>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="Adresse">
</Property>
<Property name="AuftragsNr">
</Property>
<Property name="Auftragsdatum">
</Property>
<Property name="BetragInklMwst">
</Property>
<Property name="Lieferdatum">
</Property>
<Property name="LieferscheinNr">
</Property>
<Property name="Mandant">
</Property>
<Property name="RechnungsNr">
</Property>
<Property name="Rechnungsdatum">
</Property>
<Property name="Text">
</Property>
<Property name="Typ">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.RgInfoPos">
<Description>
</Description>
<Super>%Persistent,%XML.Adaptor</Super>
<TimeChanged>62438,40830.905837</TimeChanged>
<TimeCreated>61508,33030.16805</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="PositionsNr">
<Description>
Pos-Nr</Description>
<Type>%Integer</Type>
</Property>

<Property name="ArtikelNr">
<Description>
Artikelnummer</Description>
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Text">
<Description>
Auftragsdetail</Description>
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Menge">
<Description>
Menge</Description>
<Type>%Decimal</Type>
<Parameter name="SCALE" value="5"/>
</Property>

<Property name="Einheit">
<Description>
Einheit</Description>
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Preis">
<Description>
Preis</Description>
<Type>%Decimal</Type>
<Parameter name="SCALE" value="5"/>
</Property>

<Property name="RabattBetrag">
<Description>
Rabatt in Fr.</Description>
<Type>%Decimal</Type>
<Parameter name="SCALE" value="5"/>
</Property>

<Property name="MwstBetrag">
<Description>
Mwst-Betrag</Description>
<Type>%Decimal</Type>
<Parameter name="SCALE" value="5"/>
</Property>

<Property name="BetragInklMwst">
<Description>
Betrag inkl. Mwst</Description>
<Type>%Decimal</Type>
<Parameter name="SCALE" value="5"/>
</Property>

<Property name="Kopf">
<Type>DBAdressen.RgInfoKopf</Type>
<Cardinality>parent</Cardinality>
<Inverse>Positionen</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="Lieferdatum">
<Description>
Lieferdatum</Description>
<Type>%Date</Type>
</Property>

<Method name="GetPosOid">
<ClassMethod>1</ClassMethod>
<FormalSpec>AdressOid:%String,AuftragsNr:%Integer,PositionsNr:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set oid = ""
	
	Set strSQL="SELECT ID FROM DBAdressen.RgInfoPos WHERE Kopf->Adresse="_AdressOid_" AND Kopf->Auftragsnr="_AuftragsNr_" AND PositionsNr="_PositionsNr
	Set rs = ##class(%Library.ResultSet).%New("%DynamicQuery:SQL")
	Do rs.Prepare(strSQL)
	Set sc=rs.Execute()
	if (rs.Next()) {
		set oid = rs.Data("ID")
	}
	
	quit oid
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>{%%PARENT}("Positionen")</DataLocation>
<DefaultData>RgInfoPosDefaultData</DefaultData>
<IdLocation>^DBAdressen.RgInfoKopfC("Positionen")</IdLocation>
<IndexLocation>^DBAdressen.RgInfoPosI</IndexLocation>
<StreamLocation>^DBAdressen.RgInfoPosS</StreamLocation>
<Data name="RgInfoPosDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>PositionsNr</Value>
</Value>
<Value name="3">
<Value>ArtikelNr</Value>
</Value>
<Value name="4">
<Value>Text</Value>
</Value>
<Value name="5">
<Value>Menge</Value>
</Value>
<Value name="6">
<Value>Einheit</Value>
</Value>
<Value name="7">
<Value>Preis</Value>
</Value>
<Value name="8">
<Value>RabattBetrag</Value>
</Value>
<Value name="9">
<Value>MwstBetrag</Value>
</Value>
<Value name="10">
<Value>BetragInklMwst</Value>
</Value>
<Value name="11">
<Value>Lieferdatum</Value>
</Value>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="ArtikelNr">
</Property>
<Property name="BetragInklMwst">
</Property>
<Property name="Einheit">
</Property>
<Property name="Kopf">
</Property>
<Property name="Lieferdatum">
</Property>
<Property name="Menge">
</Property>
<Property name="MwstBetrag">
</Property>
<Property name="PositionsNr">
</Property>
<Property name="Preis">
</Property>
<Property name="RabattBetrag">
</Property>
<Property name="Text">
</Property>
<Property name="childsub">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.SD.AdressReport">
<Super>%Persistent,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40831.092824</TimeChanged>
<TimeCreated>61305,28968.922322</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="AktMandantIdx">
<Properties>AktMandant</Properties>
</Index>

<Property name="Nummer">
<Type>%Integer</Type>
<Required>1</Required>
</Property>

<Index name="NummerIndex">
<Properties>Nummer</Properties>
<Unique>1</Unique>
</Index>

<Property name="Bezeichnung">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Format">
<Type>%Integer</Type>
</Property>

<Property name="ReportFile">
<Type>DBCore.ReportStream</Type>
<Cardinality>many</Cardinality>
<Inverse>AdrReport</Inverse>
<Relationship>1</Relationship>
</Property>

<Method name="GetReportAdrReportOidByCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandOid:%String="",ReportAdrReportNr:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	QUIT:(ReportAdrReportNr<0)
	Set oid = ""
	&sql(SELECT ID INTO :oid
		 FROM DBAdressen_SD.AdressReport
		 WHERE AktMandant = :MandOid AND Nummer = :ReportAdrReportNr)
	Quit oid
]]></Implementation>
</Method>

<Method name="GetNextFreeNumber">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandOid:%String</FormalSpec>
<ReturnType>%Integer</ReturnType>
<Implementation><![CDATA[
	set nr = 0
	&sql(Select max(Nummer) into :nr From DBAdressen_SD.AdressReport WHERE AktMandant = :MandOid)
	Quit +nr+1
]]></Implementation>
</Method>

<Method name="GetBezeichnung">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Bezeichnung, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetBezeichnungClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID'="") {
		Set rs=##Class(DBAdressen.SD.AdressReport).%OpenId(myID)
		set text = rs.GetBezeichnung(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetBezeichnung">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Bezeichnung, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="OutputStream">
<FormalSpec>MandOid:%String,Sprache:%String</FormalSpec>
<ReturnType>%Library.GlobalBinaryStream</ReturnType>
<Implementation><![CDATA[
	Set tmpStream=##class(%Library.GlobalBinaryStream).%New()
	Set Nummer=..Nummer
	Set Ret=""
	If Nummer'="" {
		&sql(SELECT count(*) As Cnt INTO :Cnt
		     FROM DBCore.ReportStream 
		     WHERE AdrReport->Nummer=:Nummer AND Sprache=:Sprache AND AdrReport->AktMandant = :MandOid)
		If (Cnt>0) {
			&sql(SELECT %ID INTO :sID 
				 FROM DBCore.ReportStream 
				 WHERE AdrReport->Nummer=:Nummer AND 
				       Sprache=:Sprache AND AdrReport->AktMandant = :MandOid)
			Set s=##Class(DBCore.ReportStream).%OpenId(sID)
			//Set Ret=s.OutputStream()
			Set Size=s.DataStream.Size
			Set Ret=tmpStream.CopyFromAndSave(s.DataStream)
		} Else {
			Set StdSprache="de"
			&sql(SELECT count(*) As Cnt INTO :Cnt
			     FROM DBCore.ReportStream 
			     WHERE AdrReport->Nummer=:Nummer AND Sprache=:StdSprache AND AdrReport->AktMandant = :MandOid)
			If (Cnt>0) {
				&sql(SELECT %ID INTO :sID 
				     FROM DBCore.ReportStream 
				     WHERE AdrReport->Nummer=:Nummer AND 
				           Sprache=:StdSprache AND AdrReport->AktMandant = :MandOid)
				Set s=##Class(DBCore.ReportStream).%OpenId(sID)
				// Set Ret=s.OutputStream()
				Set Size=s.DataStream.Size
				Set Ret=tmpStream.CopyFromAndSave(s.DataStream)
			}
		}
	}
	Quit tmpStream
]]></Implementation>
</Method>

<Method name="OutputFile">
<FormalSpec>PathFileName:%String,MandOid:%String,Sprache:%String</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	Set DelFile=PathFileName
	Set DelFile=$Replace(DelFile,".lst",".*")
	Set Cmd="DEL /F "_DelFile
	Do $ZF(-1,Cmd)
	Set res=0
	Set Nummer=..Nummer
	If Nummer'="" {
		Set sID = ""
		Set Cnt=0
		&sql(SELECT count(*) As Cnt INTO :Cnt
		     FROM DBCore.ReportStream 
		     WHERE AdrReport->Nummer=:Nummer AND Sprache=:Sprache AND AdrReport->AktMandant = :MandOid)
		If (Cnt>0) {
			&sql(SELECT %ID INTO :sID 
				 FROM DBCore.ReportStream 
				 WHERE AdrReport->Nummer=:Nummer AND 
				       Sprache=:Sprache AND AdrReport->AktMandant = :MandOid)
			Set s=##Class(DBCore.ReportStream).%OpenId(sID)
			Set Ret=s.OutputFile(PathFileName)
			Set res=Ret=1
			
		} Else {
			Set StdSprache="de"
			&sql(SELECT count(*) As Cnt INTO :Cnt
			     FROM DBCore.ReportStream 
			     WHERE AdrReport->Nummer=:Nummer AND Sprache=:StdSprache AND AdrReport->AktMandant = :MandOid)
			If (Cnt>0) {
				&sql(SELECT %ID INTO :sID 
				     FROM DBCore.ReportStream 
				     WHERE AdrReport->Nummer=:Nummer AND 
				           Sprache=:StdSprache AND AdrReport->AktMandant = :MandOid)
				Set s=##Class(DBCore.ReportStream).%OpenId(sID)
				Set Ret=s.OutputFile(PathFileName)
				Set res=Ret=1
			}
		}
	}
	Quit res
]]></Implementation>
</Method>

<Method name="InputStream">
<FormalSpec>Stream:%Library.GlobalBinaryStream,MandOid:%String,Sprache:%String</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	Set res=0
	Set Nummer=..Nummer
	Set sID = ""
	If Nummer'="" {
		Set Cnt=0
		&sql(SELECT count(*) As Cnt INTO :Cnt
		     FROM DBCore.ReportStream 
		     WHERE AdrReport->Nummer=:Nummer AND Sprache=:Sprache AND AdrReport->AktMandant = :MandOid)
		If (Cnt=0) {
			Set myId=..%Id()
			Set n=##Class(DBCore.ReportStream).%New()
			Set n.Sprache = Sprache
			Set n.AdrReport = ##Class(DBAdressen.SD.AdressReport).%OpenId(myId)
			Set Ret=n.%Save()
			Set n=""
			Set res=(Ret=1)
			Quit:'res res
		}
		&sql(SELECT ID InTo :sID 
		     FROM DBCore.ReportStream 
		     WHERE AdrReport->Nummer=:Nummer AND 
		           Sprache=:Sprache AND AdrReport->AktMandant = :MandOid)
		Set s=##Class(DBCore.ReportStream).%OpenId(sID)
		Set Ret=s.DataStream.CopyFromAndSave(Stream)
		Set RetS = s.%Save()
		Set res=((Ret=1) && (RetS=1))
	}
	Quit res
]]></Implementation>
</Method>

<Method name="InputFile">
<FormalSpec>PathFileName:%String,MandOid:%String,Sprache:%String</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	Set Cmd="DEL /F C:\Test.txt"
	Do $ZF(-1,Cmd)
	Set res=0
	Set Nummer=..Nummer
	Set sID = ""
	If Nummer'="" {
		Set Cnt=0
		&sql(SELECT count(*) As Cnt INTO :Cnt
		     FROM DBCore.ReportStream 
		     WHERE AdrReport->Nummer=:Nummer AND Sprache=:Sprache AND AdrReport->AktMandant = :MandOid)
		If (Cnt=0) {
			Set myId=..%Id()
			Set n=##Class(DBCore.ReportStream).%New()
			Set n.Sprache = Sprache
			Set n.AdrReport = ##Class(DBAdressen.SD.AdressReport).%OpenId(myId)
			Set Ret=n.%Save()
			Set n=""
			Set res=(Ret=1)
			Quit:'res res
		}
		&sql(SELECT ID InTo :sID 
		     FROM DBCore.ReportStream 
		     WHERE AdrReport->Nummer=:Nummer AND 
		           Sprache=:Sprache AND AdrReport->AktMandant = :MandOid)
		Set s=##Class(DBCore.ReportStream).%OpenId(sID)
		Set Ret=s.InputFile(PathFileName)
		Set RetS = s.%Save()
		Set res=((Ret=1) && (RetS=1))
	}
	Quit res
]]></Implementation>
</Method>

<Method name="CopyReportAdrReport">
<ClassMethod>1</ClassMethod>
<FormalSpec>oid:%String,dstNr:%Integer,dstBez:%String</FormalSpec>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
	set report = ##class(DBAdressen.SD.AdressReport).%OpenId(oid)
	set newObj = report.%ConstructClone(0)
	Set newObj.Nummer = dstNr
	Set newObj.Bezeichnung = dstBez
	set status = newObj.%Save()
	quit status
]]></Implementation>
</Method>

<Method name="CopyReportAdrReportOnExisting">
<ClassMethod>1</ClassMethod>
<FormalSpec>srcOid:%String,dstOid:%String</FormalSpec>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
	set footer = ##class(DBAdressen.SD.AdressReport).%OpenId(srcOid)
	set newObj = ##class(DBAdressen.SD.AdressReport).%OpenId(dstOid)
	
	set dstNr = newObj.Nummer
	set dstBez = newObj.Bezeichnung
	
	set newObj = footer.%ConstructClone(0)
	
	Set newObj.Nummer = dstNr
	Set newObj.Bezeichnung = dstBez
	set status = newObj.%Save()
	quit status
]]></Implementation>
</Method>

<Method name="%OnDelete">
<Description><![CDATA[
This callback method is invoked by the <METHOD>%Delete</METHOD> method to 
provide notification that the object specified by <VAR>oid</VAR> is being deleted.

<P>If this method returns an error then the object will not be deleted.
[Previously private]]]></Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>oid:%ObjectIdentity</FormalSpec>
<ReturnType>%Status</ReturnType>
<ServerOnly>1</ServerOnly>
<Implementation><![CDATA[
	set reportOid = $lg(oid,1)
	
	&sql(DELETE FROM DBCore.ReportStream WHERE AdrReport = :reportOid)
			
	Quit $$$OK
]]></Implementation>
</Method>

<Trigger name="trgOnDelete">
<Code><![CDATA[	set myId = {ID*O}
	&sql(DELETE FROM DBCore.ReportStream WHERE AdrReport = :myId)]]></Code>
<Event>DELETE</Event>
</Trigger>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SD.AdressReportD</DataLocation>
<DefaultData>AdressReportDefaultData</DefaultData>
<IdLocation>^DBAdressen.SD.AdressReportD</IdLocation>
<IndexLocation>^DBAdressen.SD.AdressReportI</IndexLocation>
<StreamLocation>^DBAdressen.SD.AdressReportS</StreamLocation>
<Data name="AdressReportDefaultData">
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>AktMandant</Value>
</Value>
<Value name="3">
<Value>Nummer</Value>
</Value>
<Value name="4">
<Value>Format</Value>
</Value>
</Data>
<Data name="Bezeichnung">
<Attribute>Bezeichnung</Attribute>
<Structure>subnode</Structure>
<Subscript>"Bezeichnung"</Subscript>
</Data>
<Property name="AktMandant"/>
<Property name="Format"/>
<Property name="Nummer"/>
</Storage>
</Class>


<Class name="DBAdressen.SD.Adresselektion">
<Super>%Persistent,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40831.317124</TimeChanged>
<TimeCreated>61313,53879.122291</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="AktMandantIdx">
<Properties>AktMandant</Properties>
</Index>

<Property name="Nummer">
<Type>%Integer</Type>
</Property>

<Property name="Bezeichnung">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Sortierung">
<Type>%String</Type>
</Property>

<Property name="SortKrit1">
<Type>%String</Type>
</Property>

<Property name="SortKrit2">
<Type>%String</Type>
</Property>

<Property name="SortKrit3">
<Type>%String</Type>
</Property>

<Property name="Selektion1">
<Type>%String</Type>
</Property>

<Property name="Sel1Von">
<Type>%String</Type>
</Property>

<Property name="Sel1Bis">
<Type>%String</Type>
</Property>

<Property name="Selektion2">
<Type>%String</Type>
</Property>

<Property name="Sel2Von">
<Type>%String</Type>
</Property>

<Property name="Sel2Bis">
<Type>%String</Type>
</Property>

<Property name="Selektion3">
<Type>%String</Type>
</Property>

<Property name="Sel3Von">
<Type>%String</Type>
</Property>

<Property name="Sel3Bis">
<Type>%String</Type>
</Property>

<Property name="Selektion4">
<Type>%String</Type>
</Property>

<Property name="Sel4Von">
<Type>%String</Type>
</Property>

<Property name="Sel4Bis">
<Type>%String</Type>
</Property>

<Property name="Branchencode">
<Type>%String</Type>
</Property>

<Property name="IndMuliSel">
<Type>%String</Type>
</Property>

<Method name="GetAdrSelOidByCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandOid:%String="",AdrSelNr:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	QUIT:(AdrSelNr<0)
	Set oid = ""
	&sql(SELECT ID INTO :oid
		 FROM DBAdressen_SD.Adresselektion
		 WHERE AktMandant = :MandOid AND Nummer = :AdrSelNr)
	Quit oid
]]></Implementation>
</Method>

<Method name="GetNextFreeNumber">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandOid:%String=""</FormalSpec>
<ReturnType>%Integer</ReturnType>
<Implementation><![CDATA[
	set nr = 0
	&sql(Select max(Nummer) into :nr From DBAdressen_SD.Adresselektion WHERE AktMandant = :MandOid)
	Quit +nr+1
]]></Implementation>
</Method>

<Method name="GetBezeichnung">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Bezeichnung, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetBezeichnungClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID'="") {
		Set rs=##Class(DBAdressen.SD.Adresselektion).%OpenId(myID)
		set text = rs.GetBezeichnung(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetBezeichnung">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Bezeichnung, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SD.AdresselektionD</DataLocation>
<DefaultData>AdresselektionDefaultData</DefaultData>
<IdLocation>^DBAdressen.SD.AdresselektionD</IdLocation>
<IndexLocation>^DBAdressen.SD.AdresselektionI</IndexLocation>
<StreamLocation>^DBAdressen.SD.AdresselektionS</StreamLocation>
<Data name="AdresselektionDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Bezeichnung</Value>
</Value>
<Value name="3">
<Value>Sortierung</Value>
</Value>
<Value name="4">
<Value>SortKrit1</Value>
</Value>
<Value name="5">
<Value>SortKrit2</Value>
</Value>
<Value name="6">
<Value>SortKrit3</Value>
</Value>
<Value name="7">
<Value>Selektion1</Value>
</Value>
<Value name="8">
<Value>Sel1Von</Value>
</Value>
<Value name="9">
<Value>Sel1Bis</Value>
</Value>
<Value name="10">
<Value>Selektion2</Value>
</Value>
<Value name="11">
<Value>Sel2Von</Value>
</Value>
<Value name="12">
<Value>Sel2Bis</Value>
</Value>
<Value name="13">
<Value>Selektion3</Value>
</Value>
<Value name="14">
<Value>Sel3Von</Value>
</Value>
<Value name="15">
<Value>Sel3Bis</Value>
</Value>
<Value name="16">
<Value>Selektion4</Value>
</Value>
<Value name="17">
<Value>Sel4Von</Value>
</Value>
<Value name="18">
<Value>Sel4Bis</Value>
</Value>
<Value name="19">
<Value>AktMandant</Value>
</Value>
<Value name="20">
<Value>Nummer</Value>
</Value>
<Value name="21">
<Value>Branchencode</Value>
</Value>
<Value name="22">
<Value>IndMuliSel</Value>
</Value>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="AktMandant">
</Property>
<Property name="Bezeichnung">
</Property>
<Property name="Branchencode">
</Property>
<Property name="IndMuliSel">
</Property>
<Property name="Nummer">
</Property>
<Property name="Sel1Bis">
</Property>
<Property name="Sel1Von">
</Property>
<Property name="Sel2Bis">
</Property>
<Property name="Sel2Von">
</Property>
<Property name="Sel3Bis">
</Property>
<Property name="Sel3Von">
</Property>
<Property name="Sel4Bis">
</Property>
<Property name="Sel4Von">
</Property>
<Property name="Selektion1">
</Property>
<Property name="Selektion2">
</Property>
<Property name="Selektion3">
</Property>
<Property name="Selektion4">
</Property>
<Property name="SortKrit1">
</Property>
<Property name="SortKrit2">
</Property>
<Property name="SortKrit3">
</Property>
<Property name="Sortierung">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.SD.Adressgruppe">
<Super>%Persistent,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40831.541769</TimeChanged>
<TimeCreated>61613,31450.35966</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Code">
<Type>%Library.Integer</Type>
<Required>1</Required>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
</Property>

<Property name="Bezeichnung">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="KurzBezeichnung">
<Type>%String</Type>
<Parameter name="MAXLEN" value="20"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="AktMandantIdx">
<Properties>AktMandant</Properties>
</Index>

<Index name="CodeIndex">
<Properties>AktMandant,Code</Properties>
<Unique>1</Unique>
</Index>

<Index name="CodeMoveIndex">
<Data>%%ID,Code,Bezeichnung(ELEMENTS)</Data>
<Properties>AktMandant:Exact,Bezeichnung(KEYS),Code</Properties>
</Index>

<Method name="GetBezeichnung">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Bezeichnung, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetBezeichnungClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID'="") {
		Set rs=##Class(DBAdressen.SD.Adressgruppe).%OpenId(myID)
		set text = rs.GetBezeichnung(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="GetAdrGrpCodeByOidClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String</FormalSpec>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set kg = ""
	&SQL(SELECT Code into :kg FROM DBAdressen_SD.Adressgruppe WHERE ID = :myID)
	Quit kg
]]></Implementation>
</Method>

<Method name="SetBezeichnung">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Bezeichnung, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="CopyAdressgruppenFromMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>srcMandOid:%String,dstMandOid:%String</FormalSpec>
<Implementation><![CDATA[
	set result = ##class(%Library.ResultSet).%New("DBAdressen.AF.SD.AdressgruppeAF:ListeGesamt")
	set grp = result.%Execute(srcMandOid)
	
	while result.Next(.grp) {
		set ptr = ##class(DBAdressen.SD.Adressgruppe).%New()
		set ptr.Code = result.Data("Code")
		set ptr.Bezeichnung = result.Data("Bezeichnung")
		set ptr.KurzBezeichnung = result.Data("KurzBezeichnung")
		set ptr.AktMandant = dstMandOid
		do ptr.%Save()	
	}
]]></Implementation>
</Method>

<Method name="MoveFirstOnAdrGrpNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
	
	set kg = $Order(^DBAdressen.SD.AdressgruppeI("CodeMoveIndex",MandantOid,Lang,""),1)
	if (kg '= ""){
		set id = $Order(^DBAdressen.SD.AdressgruppeI("CodeMoveIndex",MandantOid,Lang,kg,""),1,list)
	} else {
		Quit ""	
	}
	Quit list
]]></Implementation>
</Method>

<Method name="MoveLastOnAdrGrpNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
	
	set kg = $Order(^DBAdressen.SD.AdressgruppeI("CodeMoveIndex",MandantOid,Lang,""),-1)
	if (kg '= ""){
		set id = $Order(^DBAdressen.SD.AdressgruppeI("CodeMoveIndex",MandantOid,Lang,kg,""),-1,list)
	} else {
		Quit ""	
	}
	Quit list
]]></Implementation>
</Method>

<Method name="MoveNextOnAdrGrpNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Lang:%String,aktCode:%Integer</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
	
    set nextAdrGrp = $Order(^DBAdressen.SD.AdressgruppeI("CodeMoveIndex",MandantOid,Lang,aktCode))
	if (nextAdrGrp '= "") {
		set res = $Order(^DBAdressen.SD.AdressgruppeI("CodeMoveIndex",MandantOid,Lang,nextAdrGrp,""),1,list)
	} else {
		set list = ##class(DBAdressen.SD.Adressgruppe).MoveLastOnAdrGrpNr(MandantOid,Lang)
	}
	
	Quit list
]]></Implementation>
</Method>

<Method name="MovePrevOAdrGrpNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Lang:%String,aktCode:%Integer</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
	
    set prevAdrGrp = $Order(^DBAdressen.SD.AdressgruppeI("CodeMoveIndex",MandantOid,Lang,aktCode),-1)
	if (prevAdrGrp '= "") {
		set res = $Order(^DBAdressen.SD.AdressgruppeI("CodeMoveIndex",MandantOid,Lang,prevAdrGrp,""),-1,list)
	} else {
		set list = ##class(DBAdressen.SD.Adressgruppe).MoveFirstOnAdrGrpNr(MandantOid,Lang)
	}
	
	Quit list
]]></Implementation>
</Method>

<Method name="GetAdrGrpOidByCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,code:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set myID = ""
	&SQL(SELECT %ID into :myID FROM DBAdressen_SD.Adressgruppe WHERE AktMandant=:MandantOid AND Code=:code)
	Quit myID
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SD.AdressgruppeD</DataLocation>
<DefaultData>AdressgruppeDefaultData</DefaultData>
<IdLocation>^DBAdressen.SD.AdressgruppeD</IdLocation>
<IndexLocation>^DBAdressen.SD.AdressgruppeI</IndexLocation>
<StreamLocation>^DBAdressen.SD.AdressgruppeS</StreamLocation>
<Data name="AdressgruppeDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Code</Value>
</Value>
<Value name="3">
<Value>AktMandant</Value>
</Value>
</Data>
<Data name="Bezeichnung">
<Attribute>Bezeichnung</Attribute>
<Structure>subnode</Structure>
<Subscript>"Bezeichnung"</Subscript>
</Data>
<Data name="KurzBezeichnung">
<Attribute>KurzBezeichnung</Attribute>
<Structure>subnode</Structure>
<Subscript>"KurzBezeichnung"</Subscript>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="AktMandant">
</Property>
<Property name="Code">
</Property>
<Property name="KurzBezeichnung">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.SD.Anrede">
<Description>
</Description>
<Super>%Persistent,%Populate,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40831.754426</TimeChanged>
<TimeCreated>60969,27708.851155</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Code">
<Type>%Library.Integer</Type>
<Required>1</Required>
<Parameter name="MAXVAL" value="99"/>
<Parameter name="MINVAL" value="1"/>
<Parameter name="POPSPEC" value="Integer(1,99)"/>
</Property>

<Property name="Anredentext">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="AktMandantIdx">
<Properties>AktMandant</Properties>
</Index>

<Index name="CodeIndex">
<Properties>AktMandant,Code</Properties>
<Unique>1</Unique>
</Index>

<Index name="AnredentextIndex">
<Data>%%ID,Code,Anredentext(KEYS),Anredentext(ELEMENTS)</Data>
<Properties>AktMandant:Exact,Anredentext(KEYS),Anredentext(ELEMENTS):Exact</Properties>
</Index>

<Index name="AnredencodeIndex">
<Data>%%ID,Code,Anredentext(KEYS),Anredentext(ELEMENTS)</Data>
<Properties>AktMandant:Exact,Code,Anredentext(KEYS)</Properties>
</Index>

<Method name="GetAnredentext">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Anredentext, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetAnredentextClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID '= "") {
		Set rs=##Class(DBAdressen.SD.Anrede).%OpenId(myID)
		Set text = rs.GetAnredentext(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetAnredentext">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Anredentext, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="CopyAnredenFromMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>srcMandOid:%String,dstMandOid:%String</FormalSpec>
<Implementation><![CDATA[
	set result = ##class(%Library.ResultSet).%New("DBAdressen.AF.SD.AnredeAF:ListeGesamt")
	set anreden= result.%Execute(srcMandOid)
	
	while result.Next(.anreden) {
		set ptr = ##class(DBAdressen.SD.Anrede).%New()
		set ptr.Code = result.Data("Code")
		set ptr.Anredentext = result.Data("Anredentext")
		set ptr.AktMandant = dstMandOid
		do ptr.%Save()	
	}
]]></Implementation>
</Method>

<UDLText name="T">
<Content><![CDATA[
//****************************************************************************

]]></Content>
</UDLText>

<UDLText name="T">
<Content><![CDATA[
//* Move Methoden zu Anredentext

]]></Content>
</UDLText>

<UDLText name="T">
<Content><![CDATA[
//****************************************************************************

]]></Content>
</UDLText>

<Method name="MoveFirstOnAnrede">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()

	set anr = $Order(^DBAdressen.SD.AnredeI("AnredentextIndex",MandantOid,Lang,""),1)
	if (anr '= ""){
		set id = $Order(^DBAdressen.SD.AnredeI("AnredentextIndex",MandantOid,Lang,anr,""),1,list)
	} else {
		Quit ""	
	}
	Quit list
]]></Implementation>
</Method>

<Method name="MoveLastOnAnrede">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()

	set anr = $Order(^DBAdressen.SD.AnredeI("AnredentextIndex",MandantOid,Lang,""),-1)
	if (anr '= ""){
		set id = $Order(^DBAdressen.SD.AnredeI("AnredentextIndex",MandantOid,Lang,anr,""),-1,list)
	} else {
		Quit ""	
	}
	Quit list
]]></Implementation>
</Method>

<Method name="MoveNextOnAnrede">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Lang:%String,aktAnrede:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
    set nextAnr = $Order(^DBAdressen.SD.AnredeI("AnredentextIndex",MandantOid,Lang,aktAnrede))
	if (nextAnr '= "") {
		set res = $Order(^DBAdressen.SD.AnredeI("AnredentextIndex",MandantOid,Lang,nextAnr,""),1,list)
	} else {
		set list = ##class(DBAdressen.SD.Anrede).MoveLastOnAnrede(MandantOid,Lang)
	}
	
	Quit list
]]></Implementation>
</Method>

<Method name="MovePrevOnAnrede">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Lang:%String,aktAnrede:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
    set prevAnr = $Order(^DBAdressen.SD.AnredeI("AnredentextIndex",MandantOid,Lang,aktAnrede),-1)
	if (prevAnr '= "") {
		set res = $Order(^DBAdressen.SD.AnredeI("AnredentextIndex",MandantOid,Lang,prevAnr,""),-1,list)
	} else {
		set list = ##class(DBAdressen.SD.Anrede).MoveFirstOnAnrede(MandantOid,Lang)
	}
	
	Quit list
]]></Implementation>
</Method>

<UDLText name="T">
<Content><![CDATA[
//****************************************************************************

]]></Content>
</UDLText>

<UDLText name="T">
<Content><![CDATA[
//* Move Methoden zu Anredencode

]]></Content>
</UDLText>

<UDLText name="T">
<Content><![CDATA[
//****************************************************************************

]]></Content>
</UDLText>

<Method name="MoveFirstOnCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()

	set anr = $Order(^DBAdressen.SD.AnredeI("AnredencodeIndex",MandantOid,""),1)
	if (anr '= ""){
		set id = $Order(^DBAdressen.SD.AnredeI("AnredencodeIndex",MandantOid,anr,Lang,""),1,list)
	} else {
		Quit ""	
	}
	Quit list
]]></Implementation>
</Method>

<Method name="MoveLastOnCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()

	set anr = $Order(^DBAdressen.SD.AnredeI("AnredencodeIndex",MandantOid,""),-1)
	if (anr '= ""){
		set id = $Order(^DBAdressen.SD.AnredeI("AnredencodeIndex",MandantOid,anr,Lang,""),-1,list)
	} else {
		Quit ""	
	}
	Quit list
]]></Implementation>
</Method>

<Method name="MoveNextOnCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Lang:%String,aktCode:%Integer</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
    set nextCode = $Order(^DBAdressen.SD.AnredeI("AnredencodeIndex",MandantOid,aktCode))
	if (nextCode '= "") {
		set res = $Order(^DBAdressen.SD.AnredeI("AnredencodeIndex",MandantOid,nextCode,Lang,""),1,list)
	} else {
		set list = ##class(DBAdressen.SD.Anrede).MoveLastOnCode(MandantOid,Lang)
	}
	
	Quit list
]]></Implementation>
</Method>

<Method name="MovePrevOnCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Lang:%String,aktCode:%Integer</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
    set prevCode = $Order(^DBAdressen.SD.AnredeI("AnredencodeIndex",MandantOid,aktCode),-1)
	if (prevCode '= "") {
		set res = $Order(^DBAdressen.SD.AnredeI("AnredencodeIndex",MandantOid,prevCode,Lang,""),-1,list)
	} else {
		set list = ##class(DBAdressen.SD.Anrede).MoveFirstOnCode(MandantOid,Lang)
	}
	
	Quit list
]]></Implementation>
</Method>

<Method name="GetOidByCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set myID = ""
	&sql(SELECT ID into :myID FROM DBAdressen_SD.Anrede WHERE AktMandant= :MandantOid AND Code= :Code)
	Quit myID
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SD.AnredeD</DataLocation>
<DefaultData>AnredeDefaultData</DefaultData>
<IdLocation>^DBAdressen.SD.AnredeD</IdLocation>
<IndexLocation>^DBAdressen.SD.AnredeI</IndexLocation>
<StreamLocation>^DBAdressen.SD.AnredeS</StreamLocation>
<Data name="AnredeDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Code</Value>
</Value>
<Value name="3">
<Value>AktMandant</Value>
</Value>
</Data>
<Data name="Anredentext">
<Attribute>Anredentext</Attribute>
<Structure>subnode</Structure>
<Subscript>"Anredentext"</Subscript>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="AktMandant">
</Property>
<Property name="Code">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.SD.Branche">
<Description>
</Description>
<Super>%Persistent,%Populate,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40831.95443</TimeChanged>
<TimeCreated>60954,35541.208751</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Code">
<Type>%Library.Integer</Type>
<Required>1</Required>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
<Parameter name="POPSPEC" value="Integer(1,999)"/>
</Property>

<Property name="Kuerzel">
<Type>%Library.String</Type>
<Parameter name="MAXLEN" value="2"/>
</Property>

<Property name="Branchenbeschreibung">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="AktMandantIdx">
<Properties>AktMandant</Properties>
</Index>

<Index name="CodeIndex">
<Properties>AktMandant,Code</Properties>
<Unique>1</Unique>
</Index>

<Property name="Betrag">
<Type>%Decimal</Type>
<Parameter name="SCALE" value="5"/>
</Property>

<Property name="BrancheAdresse">
<Type>DBAdressen.BrancheAdresse</Type>
<Cardinality>many</Cardinality>
<Inverse>Branche</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="Artikel">
<Type>DBFakturierung.Artikel</Type>
<Cardinality>one</Cardinality>
<Inverse>BrancheArtikel</Inverse>
<Relationship>1</Relationship>
</Property>

<Index name="ArtikelIndex">
<Properties>Artikel</Properties>
</Index>

<Method name="GetBranchenbeschreibung">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Branchenbeschreibung, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetBranchenbeschreibungClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID '= "") {
		Set rs=##Class(DBAdressen.SD.Branche).%OpenId(myID)
		set text = rs.GetBranchenbeschreibung(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetBranchenbeschreibung">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Branchenbeschreibung, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="CopyBranchenFromMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>srcMandOid:%String,dstMandOid:%String</FormalSpec>
<Implementation><![CDATA[
	set result = ##class(%Library.ResultSet).%New("DBAdressen.AF.SD.BrancheAF:ListeGesamt")
	set branchen = result.%Execute(srcMandOid)
	
	while result.Next(.branchen) {
		set ptr = ##class(DBAdressen.SD.Branche).%New()
		set ptr.Code = result.Data("Code")
		set ptr.Kuerzel = result.Data("Kuerzel")
		set ptr.Branchenbeschreibung = result.Data("Branchenbeschreibung")
		set ptr.Betrag = result.Data("Betrag")
		set ptr.AktMandant = dstMandOid
		do ptr.%Save()	
	}
]]></Implementation>
</Method>

<Method name="GetBrancheIdByKuerzel">
<ClassMethod>1</ClassMethod>
<FormalSpec>Kuerzel:%String,MandantOid:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	set id = ""
	&sql(SELECT ID INTO :id FROM DBAdressen_SD.Branche WHERE AktMandant = :MandantOid
			AND Kuerzel = :Kuerzel)
	Quit id
]]></Implementation>
</Method>

<Method name="GetNextCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<ReturnType>%Library.Integer</ReturnType>
<Implementation><![CDATA[
	set retval = 0
	&sql(SELECT Max(Code) INTO :retval FROM DBAdressen_SD.Branche WHERE AktMandant = :MandantOid)
	Set retval = +retval + 1
	Quit retval
]]></Implementation>
</Method>

<Method name="GetOidByCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set myID = ""
	&sql(SELECT ID into :myID FROM DBAdressen_SD.Branche WHERE AktMandant= :MandantOid AND Code= :Code)
	Quit myID
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SD.BrancheD</DataLocation>
<DefaultData>BrancheDefaultData</DefaultData>
<IdLocation>^DBAdressen.SD.BrancheD</IdLocation>
<IndexLocation>^DBAdressen.SD.BrancheI</IndexLocation>
<StreamLocation>^DBAdressen.SD.BrancheS</StreamLocation>
<Data name="BrancheDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Code</Value>
</Value>
<Value name="3">
<Value>Kuerzel</Value>
</Value>
<Value name="4">
<Value>AktMandant</Value>
</Value>
<Value name="5">
<Value>Betrag</Value>
</Value>
<Value name="6">
<Value>Artikel</Value>
</Value>
</Data>
<Data name="Branchenbeschreibung">
<Attribute>Branchenbeschreibung</Attribute>
<Structure>subnode</Structure>
<Subscript>"Branchenbeschreibung"</Subscript>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="AktMandant">
</Property>
<Property name="Artikel">
</Property>
<Property name="Betrag">
</Property>
<Property name="Code">
</Property>
<Property name="Kuerzel">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.SD.Briefanrede">
<Description>
</Description>
<Super>%Persistent,%Populate,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40832.055006</TimeChanged>
<TimeCreated>60969,27708.851155</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Code">
<Type>%Library.Integer</Type>
<Required>1</Required>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
<Parameter name="POPSPEC" value="Integer(1,999)"/>
</Property>

<Property name="Briefanredentext">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="AktMandantIdx">
<Properties>AktMandant</Properties>
</Index>

<Index name="CodeIndex">
<Properties>AktMandant,Code</Properties>
<Unique>1</Unique>
</Index>

<Index name="BriefanredentextIndex">
<Data>%%ID,Code,Briefanredentext(KEYS),Briefanredentext(ELEMENTS)</Data>
<Properties>AktMandant:Exact,Briefanredentext(KEYS),Briefanredentext(ELEMENTS):Exact</Properties>
</Index>

<Method name="GetBriefanredentext">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Briefanredentext, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetBriefanredentextClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID'="") {
		Set rs=##Class(DBAdressen.SD.Briefanrede).%OpenId(myID)
		set text = rs.GetBriefanredentext(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetBriefanredentext">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Briefanredentext, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="CopyBriefanredenFromMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>srcMandOid:%String,dstMandOid:%String</FormalSpec>
<Implementation><![CDATA[
	set result = ##class(%Library.ResultSet).%New("DBAdressen.AF.SD.BriefanredeAF:ListeGesamt")
	set anr = result.%Execute(srcMandOid)
	
	while result.Next(.anr) {
		set ptr = ##class(DBAdressen.SD.Briefanrede).%New()
		set ptr.Code = result.Data("Code")
		set ptr.Briefanredentext = result.Data("Briefanredentext")
		set ptr.AktMandant = dstMandOid
		do ptr.%Save()	
	}
]]></Implementation>
</Method>

<Method name="MoveFirstOnBriefanrede">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()

	set anr = $Order(^DBAdressen.SD.BriefanredeI("BriefanredentextIndex",MandantOid,Lang,""),1)
	if (anr '= ""){
		set id = $Order(^DBAdressen.SD.BriefanredeI("BriefanredentextIndex",MandantOid,Lang,anr,""),1,list)
	} else {
		Quit ""	
	}
	Quit list
]]></Implementation>
</Method>

<Method name="MoveLastOnBriefanrede">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()

	set anr = $Order(^DBAdressen.SD.BriefanredeI("BriefanredentextIndex",MandantOid,Lang,""),-1)
	if (anr '= ""){
		set id = $Order(^DBAdressen.SD.BriefanredeI("BriefanredentextIndex",MandantOid,Lang,anr,""),-1,list)
	} else {
		Quit ""	
	}
	Quit list
]]></Implementation>
</Method>

<Method name="MoveNextOnBriefanrede">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Lang:%String,aktBriefanrede:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
    set nextAnr = $Order(^DBAdressen.SD.BriefanredeI("BriefanredentextIndex",MandantOid,Lang,aktBriefanrede))
	if (nextAnr '= "") {
		set res = $Order(^DBAdressen.SD.BriefanredeI("BriefanredentextIndex",MandantOid,Lang,nextAnr,""),1,list)
	} else {
		set list = ##class(DBAdressen.SD.Briefanrede).MoveLastOnBriefanrede(MandantOid,Lang)
	}
	
	Quit list
]]></Implementation>
</Method>

<Method name="MovePrevOnBriefanrede">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Lang:%String,aktBriefanrede:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
    set prevAnr = $Order(^DBAdressen.SD.BriefanredeI("BriefanredentextIndex",MandantOid,Lang,aktBriefanrede),-1)
	if (prevAnr '= "") {
		set res = $Order(^DBAdressen.SD.BriefanredeI("BriefanredentextIndex",MandantOid,Lang,prevAnr,""),-1,list)
	} else {
		set list = ##class(DBAdressen.SD.Briefanrede).MoveFirstOnBriefanrede(MandantOid,Lang)
	}
	
	Quit list
]]></Implementation>
</Method>

<Method name="GetOidByCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set myID = ""
	&sql(SELECT ID into :myID FROM DBAdressen_SD.Briefanrede WHERE AktMandant= :MandantOid AND Code= :Code)
	Quit myID
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SD.BriefanredeD</DataLocation>
<DefaultData>BriefanredeDefaultData</DefaultData>
<IdLocation>^DBAdressen.SD.BriefanredeD</IdLocation>
<IndexLocation>^DBAdressen.SD.BriefanredeI</IndexLocation>
<StreamLocation>^DBAdressen.SD.BriefanredeS</StreamLocation>
<Data name="BriefanredeDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Code</Value>
</Value>
<Value name="3">
<Value>AktMandant</Value>
</Value>
</Data>
<Data name="Briefanredentext">
<Attribute>Briefanredentext</Attribute>
<Structure>subnode</Structure>
<Subscript>"Briefanredentext"</Subscript>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="AktMandant">
</Property>
<Property name="Code">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.SD.Dokumentengrp">
<Super>%Persistent,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40832.160145</TimeChanged>
<TimeCreated>62340,30470.822883</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Nummer">
<Type>%Library.Integer</Type>
<Parameter name="MAXVAL" value="99999"/>
<Parameter name="MINVAL" value="1"/>
</Property>

<Property name="Bezeichnung">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="AktMandantIdx">
<Properties>AktMandant</Properties>
</Index>

<Index name="NummerIndex">
<Properties>AktMandant,Nummer</Properties>
<Unique>1</Unique>
</Index>

<Property name="Typ">
<Type>DBAdressen.SD.Dokumententyp</Type>
<Cardinality>many</Cardinality>
<Inverse>Gruppe</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="Recht">
<Type>DBAdressen.DokumentRecht</Type>
<Cardinality>many</Cardinality>
<Inverse>Dokumentgrp</Inverse>
<Relationship>1</Relationship>
</Property>

<Method name="GetBezeichnung">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Bezeichnung, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetBezeichnungClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID '= "") {
		Set rs=##Class(DBAdressen.SD.Dokumentengrp).%OpenId(myID)
		Set text = rs.GetBezeichnung(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetBezeichnung">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Bezeichnung, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SD.DokumentengrpD</DataLocation>
<DefaultData>DokumentengrpDefaultData</DefaultData>
<IdLocation>^DBAdressen.SD.DokumentengrpD</IdLocation>
<IndexLocation>^DBAdressen.SD.DokumentengrpI</IndexLocation>
<StreamLocation>^DBAdressen.SD.DokumentengrpS</StreamLocation>
<Data name="Bezeichnung">
<Attribute>Bezeichnung</Attribute>
<Structure>subnode</Structure>
<Subscript>"Bezeichnung"</Subscript>
</Data>
<Data name="DokumentengrpDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Nummer</Value>
</Value>
<Value name="3">
<Value>AktMandant</Value>
</Value>
</Data>
<Property name="AktMandant"/>
<Property name="Nummer"/>
</Storage>
</Class>


<Class name="DBAdressen.SD.Dokumententyp">
<Super>%Persistent,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40832.266122</TimeChanged>
<TimeCreated>62339,60468.161115</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Nummer">
<Type>%Library.Integer</Type>
<Parameter name="MAXVAL" value="99999"/>
<Parameter name="MINVAL" value="1"/>
</Property>

<Property name="Bezeichnung">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="AktMandantIdx">
<Properties>AktMandant</Properties>
</Index>

<Index name="NummerIndex">
<Properties>AktMandant,Gruppe,Nummer</Properties>
<Unique>1</Unique>
</Index>

<Property name="Pfad">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Bemerkung">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Ablageart">
<Type>%Integer</Type>
</Property>

<Property name="Gruppe">
<Type>DBAdressen.SD.Dokumentengrp</Type>
<Cardinality>one</Cardinality>
<Inverse>Typ</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="Dokument">
<Type>DBAdressen.Dokument</Type>
<Cardinality>many</Cardinality>
<Inverse>Dokumententyp</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="Recht">
<Type>DBAdressen.DokumentRecht</Type>
<Cardinality>many</Cardinality>
<Inverse>Dokumenttyp</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="FtpServer">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="FtpBenutzer">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="FtpPasswort">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="FtpPfad">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Method name="GetBezeichnung">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Bezeichnung, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetBezeichnungClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID '= "") {
		Set rs=##Class(DBAdressen.SD.Dokumententyp).%OpenId(myID)
		Set text = rs.GetBezeichnung(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetBezeichnung">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Bezeichnung, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="%OnDelete">
<Description><![CDATA[
This callback method is invoked by the <METHOD>%Delete</METHOD> method to 
provide notification that the object specified by <VAR>oid</VAR> is being deleted.

<P>If this method returns an error then the object will not be deleted.
[Previously private]]]></Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>oid:%ObjectIdentity</FormalSpec>
<ReturnType>%Status</ReturnType>
<ServerOnly>1</ServerOnly>
<Implementation><![CDATA[
		set myOid = $lg(oid,1)
		&sql(DELETE FROM DBAdressen.DokumentRecht WHERE Dokumenttyp = :myOid)
		Quit $$$OK
]]></Implementation>
</Method>

<Trigger name="trgOnDelete">
<Code><![CDATA[	new myId 
	set myId = {ID*O}
	&sql(DELETE FROM DBAdressen.DokumentRecht WHERE Dokumenttyp = :myId)]]></Code>
<Event>DELETE</Event>
</Trigger>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SD.DokumententypD</DataLocation>
<DefaultData>DokumententypDefaultData</DefaultData>
<IdLocation>^DBAdressen.SD.DokumententypD</IdLocation>
<IndexLocation>^DBAdressen.SD.DokumententypI</IndexLocation>
<StreamLocation>^DBAdressen.SD.DokumententypS</StreamLocation>
<Data name="Bezeichnung">
<Attribute>Bezeichnung</Attribute>
<Structure>subnode</Structure>
<Subscript>"Bezeichnung"</Subscript>
</Data>
<Data name="DokumententypDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Nummer</Value>
</Value>
<Value name="3">
<Value>AktMandant</Value>
</Value>
<Value name="4">
<Value>Pfad</Value>
</Value>
<Value name="5">
<Value>Bemerkung</Value>
</Value>
<Value name="6">
<Value>Ablageart</Value>
</Value>
<Value name="7">
<Value>Gruppe</Value>
</Value>
<Value name="8">
<Value>FtpServer</Value>
</Value>
<Value name="9">
<Value>FtpBenutzer</Value>
</Value>
<Value name="10">
<Value>FtpPasswort</Value>
</Value>
<Value name="11">
<Value>FtpPfad</Value>
</Value>
</Data>
<Property name="Ablageart"/>
<Property name="AktMandant"/>
<Property name="Bemerkung"/>
<Property name="FtpBenutzer"/>
<Property name="FtpPasswort"/>
<Property name="FtpPfad"/>
<Property name="FtpServer"/>
<Property name="Gruppe"/>
<Property name="Nummer"/>
<Property name="Pfad"/>
</Storage>
</Class>


<Class name="DBAdressen.SD.Gebiet">
<Description>
</Description>
<Super>%Persistent,%Populate,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40832.365082</TimeChanged>
<TimeCreated>60969,27708.851155</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Code">
<Type>%Library.Integer</Type>
<Required>1</Required>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
<Parameter name="POPSPEC" value="Integer(1,999)"/>
</Property>

<Property name="Gebietstext">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Beschreibung">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="AktMandantIdx">
<Properties>AktMandant</Properties>
</Index>

<Index name="CodeIndex">
<Properties>AktMandant,Code</Properties>
<Unique>1</Unique>
</Index>

<Property name="GebTransKosten">
<Type>DBAgrofresh.SD.GebTransKosten</Type>
<Cardinality>children</Cardinality>
<Inverse>Gebiet</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="AdresseGebietscode">
<Type>DBAdressen.Adresse</Type>
<Cardinality>many</Cardinality>
<Inverse>Gebietscode</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="AgrofreshAuftrag">
<Type>DBAgrofresh.Auftragskopf</Type>
<Cardinality>many</Cardinality>
<Inverse>Gebietscode</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="FakturierungAuftrag">
<Type>DBFakturierung.Auftragskopf</Type>
<Cardinality>many</Cardinality>
<Inverse>Gebietscode</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="AuftrStrgVorschlag">
<Type>DBAgrofresh.AuftrStrg</Type>
<Cardinality>many</Cardinality>
<Inverse>VorschlagGebiet</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="FaktAuftrStrgVorschlag">
<Type>DBFakturierung.AuftrStrg</Type>
<Cardinality>many</Cardinality>
<Inverse>VorschlagGebiet</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="TourDetails">
<Type>DBAdressen.TourDetail</Type>
<Cardinality>children</Cardinality>
<Inverse>Tour</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="DebitorVorschlag">
<Type>DBDebiKredi.Debitor</Type>
<Cardinality>many</Cardinality>
<Inverse>VorschlagGebiet</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="FaktEKBestellung">
<Type>DBFaktEK.Bestellungskopf</Type>
<Cardinality>many</Cardinality>
<Inverse>Gebietscode</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="FaktEKBestStrgVorschlag">
<Type>DBFaktEK.BestStrg</Type>
<Cardinality>many</Cardinality>
<Inverse>VorschlagGebiet</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Method name="GetGebietstext">
<FormalSpec>MandOid:%String="",Lang:%String=""</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Gebietstext, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetGebietstextClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID'="") {
		Set rs=##Class(DBAdressen.SD.Gebiet).%OpenId(myID)
		set text = rs.GetGebietstext(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetGebietstext">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Gebietstext, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetBeschreibung">
<FormalSpec>MandOid:%String="",Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Beschreibung, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetBeschreibungClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID'="") {
		Set rs=##Class(DBAdressen.SD.Gebiet).%OpenId(myID)
		set text = rs.GetBeschreibung(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetBeschreibung">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Beschreibung, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="CopyGebietFromMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>srcMandOid:%String,dstMandOid:%String</FormalSpec>
<Implementation><![CDATA[
	set result = ##class(%Library.ResultSet).%New("DBAdressen.AF.SD.GebietAF:ListeGesamt")
	set gebiet = result.%Execute(srcMandOid)
	
	while result.Next(.gebiet) {
		set ptr = ##class(DBAdressen.SD.Gebiet).%New()
		set ptr.Code = result.Data("Code")
		set ptr.Gebietstext = result.Data("Gebietstext")
		set ptr.Beschreibung = result.Data("Beschreibung")
		set ptr.AktMandant = dstMandOid
		do ptr.%Save()	
	}
]]></Implementation>
</Method>

<Method name="GetOidByCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set myID = ""
	&sql(SELECT ID into :myID FROM DBAdressen_SD.Gebiet WHERE AktMandant= :MandantOid AND Code= :Code)
	Quit myID
]]></Implementation>
</Method>

<Method name="HasGebTransKostenRefs">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,GebietOid:%String</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	set id = ""
	//muss hier auf den mandanten des gebiets prüfen
	&sql(SELECT ID INTO :id FROM DBAgrofresh_SD.GebTransKosten WHERE Gebiet = :GebietOid AND Gebiet->AktMandant = :MandantOid)
	if (id'="") {
		Quit 1	
	} else {
		Quit 0
	}
]]></Implementation>
</Method>

<Method name="HasAuftragskopfRefs">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,GebietOid:%String</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	set id = ""
	&sql(SELECT ID INTO :id FROM DBAgrofresh.Auftragskopf WHERE Mandant = :MandantOid
			AND Gebietscode = :GebietOid)
	if (id'="") {
		Quit 1	
	} else {
		Quit 0
	}
]]></Implementation>
</Method>

<Method name="RemoveRefs">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[

	&sql(UPDATE DBAgrofresh.Auftragskopf SET Gebietscode = null WHERE Mandant = :MandantOid)
	
	//da die Transportkosten nicht Mandantenabhängig sind muss auf Mandant des Gebiets geprüft werden
	&sql(UPDATE DBAgrofresh_SD.GebTransKosten SET Gebiet = null WHERE Gebiet->AktMandant = :MandantOid)
]]></Implementation>
</Method>

<Method name="RemoveGebieteByMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[
	
	&sql(DELETE FROM DBAdressen_SD.Gebiet WHERE AktMandant = :MandantOid)
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SD.GebietD</DataLocation>
<DefaultData>GebietDefaultData</DefaultData>
<IdLocation>^DBAdressen.SD.GebietD</IdLocation>
<IndexLocation>^DBAdressen.SD.GebietI</IndexLocation>
<StreamLocation>^DBAdressen.SD.GebietS</StreamLocation>
<Data name="Beschreibung">
<Attribute>Beschreibung</Attribute>
<Structure>subnode</Structure>
<Subscript>"Beschreibung"</Subscript>
</Data>
<Data name="GebietDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Code</Value>
</Value>
<Value name="3">
<Value>AktMandant</Value>
</Value>
</Data>
<Data name="Gebietstext">
<Attribute>Gebietstext</Attribute>
<Structure>subnode</Structure>
<Subscript>"Gebietstext"</Subscript>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="AktMandant">
</Property>
<Property name="Code">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.SD.IndMultiSel">
<Super>DBAdressen.SD.IndSelektion,%XML.Adaptor</Super>
<TimeChanged>61422,29487</TimeChanged>
<TimeCreated>61297,40355.498896</TimeCreated>
<Inheritance>right</Inheritance>

<Property name="MultiSelAdresse">
<Type>DBAdressen.MultiSelAdresse</Type>
<Cardinality>many</Cardinality>
<Inverse>IndMultiSel</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Method name="PosNrExists">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	
	set id = ""
	&sql(SELECT TOP 1 ID INTO :id FROM DBAdressen_SD.IndMultiSel
	     WHERE Code = :Code AND AktMandant = :MandantOid)
	if (id = "") {
		Quit 0
	} else {
		Quit 1
	}
]]></Implementation>
</Method>

<Method name="GetIdByPosNrOnMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,PosNr:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[

	set id = ""
	&sql(SELECT ID INTO :id FROM DBAdressen_SD.IndMultiSel
		 WHERE AktMandant = :MandantOid AND Code = :PosNr)
	Quit id
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
</Storage>
</Class>


<Class name="DBAdressen.SD.IndSelBoni">
<Super>%Persistent,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40832.47051</TimeChanged>
<TimeCreated>62130,50858.090053</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Code">
<Type>%Library.Integer</Type>
<Required>1</Required>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
</Property>

<Property name="Kuerzel">
<Type>%String</Type>
<Parameter name="MAXLEN" value="2"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Text1">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="AktMandantIdx">
<Properties>AktMandant</Properties>
</Index>

<Index name="CodeIndex">
<Properties>AktMandant,Code</Properties>
</Index>

<Method name="GetText1">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Text1, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetText1Class">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String="",Lang:%String=""</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID'="") {
		Set rs=##Class(DBAdressen.SD.IndSelBoni).%OpenId(myID)
		set text = rs.GetText1(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetText1">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Text1, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SD.IndSelBoniD</DataLocation>
<DefaultData>IndSelBoniDefaultData</DefaultData>
<IdLocation>^DBAdressen.SD.IndSelBoniD</IdLocation>
<IndexLocation>^DBAdressen.SD.IndSelBoniI</IndexLocation>
<StreamLocation>^DBAdressen.SD.IndSelBoniS</StreamLocation>
<Data name="IndSelBoniDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Code</Value>
</Value>
<Value name="3">
<Value>Kuerzel</Value>
</Value>
<Value name="4">
<Value>AktMandant</Value>
</Value>
</Data>
<Data name="Text1">
<Attribute>Text1</Attribute>
<Structure>subnode</Structure>
<Subscript>"Text1"</Subscript>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="AktMandant">
</Property>
<Property name="Code">
</Property>
<Property name="Kuerzel">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.SD.IndSelBoni1">
<Super>DBAdressen.SD.IndSelBoni,%XML.Adaptor</Super>
<TimeChanged>62130,60146.040714</TimeChanged>
<TimeCreated>62130,51194.716893</TimeCreated>
<Inheritance>right</Inheritance>

<Property name="AdresseIndSelBoni1">
<Type>DBAdressen.Adresse</Type>
<Cardinality>many</Cardinality>
<Inverse>IndSelBoni1</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Method name="PosNrExists">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	
	set id = ""
	&sql(SELECT TOP 1 ID INTO :id FROM DBAdressen_SD.IndSelBoni1
	     WHERE Code = :Code AND AktMandant = :MandantOid)
	if (id = "") {
		Quit 0
	} else {
		Quit 1
	}
]]></Implementation>
</Method>

<Method name="GetIdByPosNrOnMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,PosNr:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[

	set id = ""
	&sql(SELECT ID INTO :id FROM DBAdressen_SD.IndSelBoni1
		 WHERE AktMandant = :MandantOid AND Code = :PosNr)
	Quit id
]]></Implementation>
</Method>

<Method name="RemoveSelByMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[
	
	&sql(DELETE FROM DBAdressen_SD.IndSelBoni1 WHERE AktMandant = :MandantOid)
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
</Storage>
</Class>


<Class name="DBAdressen.SD.IndSelBoni2">
<Super>DBAdressen.SD.IndSelBoni,%XML.Adaptor</Super>
<TimeChanged>62130,60143.961319</TimeChanged>
<TimeCreated>62130,51388.113784</TimeCreated>
<Inheritance>right</Inheritance>

<Property name="AdresseIndSelBoni2">
<Type>DBAdressen.Adresse</Type>
<Cardinality>many</Cardinality>
<Inverse>IndSelBoni2</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Method name="PosNrExists">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	
	set id = ""
	&sql(SELECT TOP 1 ID INTO :id FROM DBAdressen_SD.IndSelBoni2
	     WHERE Code = :Code AND AktMandant = :MandantOid)
	if (id = "") {
		Quit 0
	} else {
		Quit 1
	}
]]></Implementation>
</Method>

<Method name="GetIdByPosNrOnMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,PosNr:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[

	set id = ""
	&sql(SELECT ID INTO :id FROM DBAdressen_SD.IndSelBoni2
		 WHERE AktMandant = :MandantOid AND Code = :PosNr)
	Quit id
]]></Implementation>
</Method>

<Method name="RemoveSelByMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[
	
	&sql(DELETE FROM DBAdressen_SD.IndSelBoni2 WHERE AktMandant = :MandantOid)
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
</Storage>
</Class>


<Class name="DBAdressen.SD.IndSelektion">
<Super>%Persistent,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40832.630508</TimeChanged>
<TimeCreated>61297,33063.651931</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Code">
<Type>%Library.Integer</Type>
<Required>1</Required>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
</Property>

<Property name="Kuerzel">
<Type>%String</Type>
<Parameter name="MAXLEN" value="2"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Text1">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Text2">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="AktMandantIdx">
<Properties>AktMandant</Properties>
</Index>

<Index name="CodeIndex">
<Properties>AktMandant,Code</Properties>
</Index>

<Property name="Betrag">
<Type>%Decimal</Type>
<Parameter name="SCALE" value="5"/>
</Property>

<Property name="Artikel">
<Type>DBFakturierung.Artikel</Type>
<Cardinality>one</Cardinality>
<Inverse>IndSelArtikel</Inverse>
<Relationship>1</Relationship>
</Property>

<Index name="ArtikelIndex">
<Properties>Artikel</Properties>
</Index>

<Method name="GetText1">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Text1, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetText1Class">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String="",Lang:%String=""</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID'="") {
		Set rs=##Class(DBAdressen.SD.IndSelektion).%OpenId(myID)
		set text = rs.GetText1(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetText1">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Text1, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetText2">
<FormalSpec>MandOid:%String="",Lang:%String=""</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Text2, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetText2Class">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID'="") {
		Set rs=##Class(DBAdressen.SD.IndSelektion).%OpenId(myID)
		set text = rs.GetText2(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetText2">
<FormalSpec>MandOid:%String="",Lang:%String="",Value:%String=""</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Text2, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SD.IndSelektionD</DataLocation>
<DefaultData>IndSelektionDefaultData</DefaultData>
<IdLocation>^DBAdressen.SD.IndSelektionD</IdLocation>
<IndexLocation>^DBAdressen.SD.IndSelektionI</IndexLocation>
<StreamLocation>^DBAdressen.SD.IndSelektionS</StreamLocation>
<Data name="IndSelektionDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Code</Value>
</Value>
<Value name="3">
<Value>AktMandant</Value>
</Value>
<Value name="4">
<Value>Kuerzel</Value>
</Value>
<Value name="5">
<Value>Betrag</Value>
</Value>
<Value name="6">
<Value>Artikel</Value>
</Value>
</Data>
<Data name="Text1">
<Attribute>Text1</Attribute>
<Structure>subnode</Structure>
<Subscript>"Text1"</Subscript>
</Data>
<Data name="Text2">
<Attribute>Text2</Attribute>
<Structure>subnode</Structure>
<Subscript>"Text2"</Subscript>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="AktMandant">
</Property>
<Property name="Artikel">
</Property>
<Property name="Betrag">
</Property>
<Property name="Code">
</Property>
<Property name="Kuerzel">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.SD.IndSelektion1">
<Super>DBAdressen.SD.IndSelektion,%XML.Adaptor</Super>
<TimeChanged>61592,52524.945205</TimeChanged>
<TimeCreated>61297,33065.705416</TimeCreated>
<Inheritance>right</Inheritance>

<Property name="AdresseIndSel1">
<Type>DBAdressen.Adresse</Type>
<Cardinality>many</Cardinality>
<Inverse>IndSel1</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Method name="PosNrExists">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	
	set id = ""
	&sql(SELECT TOP 1 ID INTO :id FROM DBAdressen_SD.IndSelektion1
	     WHERE Code = :Code AND AktMandant = :MandantOid)
	if (id = "") {
		Quit 0
	} else {
		Quit 1
	}
]]></Implementation>
</Method>

<Method name="GetIdByPosNrOnMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,PosNr:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[

	set id = ""
	&sql(SELECT ID INTO :id FROM DBAdressen_SD.IndSelektion1
		 WHERE AktMandant = :MandantOid AND Code = :PosNr)
	Quit id
]]></Implementation>
</Method>

<Method name="RemoveSelByMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[
	
	&sql(DELETE FROM DBAdressen_SD.IndSelektion1 WHERE AktMandant = :MandantOid)
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<StreamLocation>^DBAdressen.SD.IndSelektion1S</StreamLocation>
</Storage>
</Class>


<Class name="DBAdressen.SD.IndSelektion2">
<Super>DBAdressen.SD.IndSelektion,%XML.Adaptor</Super>
<TimeChanged>61592,52540.497092</TimeChanged>
<TimeCreated>61297,34472.955776</TimeCreated>
<Inheritance>right</Inheritance>

<Property name="AdresseIndSel2">
<Type>DBAdressen.Adresse</Type>
<Cardinality>many</Cardinality>
<Inverse>IndSel2</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Method name="PosNrExists">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	
	set id = ""
	&sql(SELECT TOP 1 ID INTO :id FROM DBAdressen_SD.IndSelektion2
	     WHERE Code = :Code AND AktMandant = :MandantOid)
	if (id = "") {
		Quit 0
	} else {
		Quit 1
	}
]]></Implementation>
</Method>

<Method name="GetIdByPosNrOnMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,PosNr:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[

	set id = ""
	&sql(SELECT ID INTO :id FROM DBAdressen_SD.IndSelektion2
		 WHERE AktMandant = :MandantOid AND Code = :PosNr)
	Quit id
]]></Implementation>
</Method>

<Method name="RemoveSelByMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[
	
	&sql(DELETE FROM DBAdressen_SD.IndSelektion2 WHERE AktMandant = :MandantOid)
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
</Storage>
</Class>


<Class name="DBAdressen.SD.IndSelektion3">
<Super>DBAdressen.SD.IndSelektion,%XML.Adaptor</Super>
<TimeChanged>61592,52549.121756</TimeChanged>
<TimeCreated>61297,34473.095355</TimeCreated>
<Inheritance>right</Inheritance>

<Property name="AdresseIndSel3">
<Type>DBAdressen.Adresse</Type>
<Cardinality>many</Cardinality>
<Inverse>IndSel3</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Method name="PosNrExists">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	
	set id = ""
	&sql(SELECT TOP 1 ID INTO :id FROM DBAdressen_SD.IndSelektion3
	     WHERE Code = :Code AND AktMandant = :MandantOid)
	if (id = "") {
		Quit 0
	} else {
		Quit 1
	}
]]></Implementation>
</Method>

<Method name="GetIdByPosNrOnMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,PosNr:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[

	set id = ""
	&sql(SELECT ID INTO :id FROM DBAdressen_SD.IndSelektion3
		 WHERE AktMandant = :MandantOid AND Code = :PosNr)
	Quit id
]]></Implementation>
</Method>

<Method name="RemoveSelByMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[
	
	&sql(DELETE FROM DBAdressen_SD.IndSelektion3 WHERE AktMandant = :MandantOid)
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
</Storage>
</Class>


<Class name="DBAdressen.SD.IndSelektion4">
<Super>DBAdressen.SD.IndSelektion,%XML.Adaptor</Super>
<TimeChanged>61592,52563.296797</TimeChanged>
<TimeCreated>61297,34473.212526</TimeCreated>
<Inheritance>right</Inheritance>

<Property name="AdresseIndSel4">
<Type>DBAdressen.Adresse</Type>
<Cardinality>many</Cardinality>
<Inverse>IndSel4</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Method name="PosNrExists">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	
	set id = ""
	&sql(SELECT TOP 1 ID INTO :id FROM DBAdressen_SD.IndSelektion4
	     WHERE Code = :Code AND AktMandant = :MandantOid)
	if (id = "") {
		Quit 0
	} else {
		Quit 1
	}
]]></Implementation>
</Method>

<Method name="GetIdByPosNrOnMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,PosNr:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[

	set id = ""
	&sql(SELECT ID INTO :id FROM DBAdressen_SD.IndSelektion4
		 WHERE AktMandant = :MandantOid AND Code = :PosNr)
	Quit id
]]></Implementation>
</Method>

<Method name="RemoveSelByMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[
	
	&sql(DELETE FROM DBAdressen_SD.IndSelektion4 WHERE AktMandant = :MandantOid)
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
</Storage>
</Class>


<Class name="DBAdressen.SD.IndSelektion5">
<Super>DBAdressen.SD.IndSelektion,%XML.Adaptor</Super>
<TimeChanged>61592,52569.920958</TimeChanged>
<TimeCreated>61438,56062.118205</TimeCreated>
<Inheritance>right</Inheritance>

<Property name="AdresseIndSel5">
<Type>DBAdressen.Adresse</Type>
<Cardinality>many</Cardinality>
<Inverse>IndSel5</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Method name="PosNrExists">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	
	set id = ""
	&sql(SELECT TOP 1 ID INTO :id FROM DBAdressen_SD.IndSelektion5
	     WHERE Code = :Code AND AktMandant = :MandantOid)
	if (id = "") {
		Quit 0
	} else {
		Quit 1
	}
]]></Implementation>
</Method>

<Method name="GetIdByPosNrOnMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,PosNr:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[

	set id = ""
	&sql(SELECT ID INTO :id FROM DBAdressen_SD.IndSelektion5
		 WHERE AktMandant = :MandantOid AND Code = :PosNr)
	Quit id
]]></Implementation>
</Method>

<Method name="RemoveSelByMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[
	
	&sql(DELETE FROM DBAdressen_SD.IndSelektion5 WHERE AktMandant = :MandantOid)
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
</Storage>
</Class>


<Class name="DBAdressen.SD.KorrTyp">
<Description>
</Description>
<Super>%Persistent,%Populate,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40832.650181</TimeChanged>
<TimeCreated>61445,49711.065499</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Code">
<Type>%Library.Integer</Type>
<Required>1</Required>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
<Parameter name="POPSPEC" value="Integer(1,999)"/>
</Property>

<Property name="Kuerzel">
<Type>%Library.String</Type>
<Parameter name="MAXLEN" value="2"/>
</Property>

<Property name="Text">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Nachfassen">
<Type>%Library.Boolean</Type>
</Property>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Property name="Vorlage">
<Type>DBAdressen.SD.Vorlage</Type>
<Cardinality>many</Cardinality>
<Inverse>KorrTyp</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="Korrespondenz">
<Type>DBAdressen.Korrespondenz</Type>
<Cardinality>many</Cardinality>
<Inverse>KorrTyp</Inverse>
<Relationship>1</Relationship>
</Property>

<Index name="AktMandantIndex">
<Properties>AktMandant</Properties>
</Index>

<Index name="CodeIndex">
<Properties>AktMandant,Code</Properties>
<Unique>1</Unique>
</Index>

<Property name="Zusatzadresse">
<Type>%Boolean</Type>
</Property>

<Property name="Recht">
<Type>DBAdressen.KorrespondenzRecht</Type>
<Cardinality>many</Cardinality>
<Inverse>Korrespondenztyp</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="Serienbrief">
<Type>DBAdressen.Serienbrief</Type>
<Cardinality>many</Cardinality>
<Inverse>KorrTyp</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="EMail">
<Type>DBAdressen.EMail</Type>
<Cardinality>many</Cardinality>
<Inverse>KorrTyp</Inverse>
<Relationship>1</Relationship>
</Property>

<Method name="GetKorrTypText">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Text, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetKorrTypTextClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID '= "") {
		Set rs=##Class(DBAdressen.SD.KorrTyp).%OpenId(myID)
		set text = rs.GetKorrTypText(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetKorrTypText">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Text, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="CopyKorrTypFromMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>srcMandOid:%String,dstMandOid:%String</FormalSpec>
<Implementation><![CDATA[
	set result = ##class(%Library.ResultSet).%New("DBAdressen.AF.SD.KorrTypAF:ListeGesamt")
	set branchen = result.%Execute(srcMandOid)
	
	while result.Next(.branchen) {
		set ptr = ##class(DBAdressen.SD.KorrTyp).%New()
		set ptr.Code = result.Data("Code")
		set ptr.Kuerzel = result.Data("Kuerzel")
		set ptr.Text = result.Data("Text")
		set ptr.AktMandant = dstMandOid
		do ptr.%Save()	
	}
]]></Implementation>
</Method>

<Method name="GetOidByCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set myID = ""
	&sql(SELECT ID into :myID FROM DBAdressen_SD.KorrTyp WHERE AktMandant= :MandantOid AND Code= :Code)
	Quit myID
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SD.KorrTypD</DataLocation>
<DefaultData>KorrTypDefaultData</DefaultData>
<IdLocation>^DBAdressen.SD.KorrTypD</IdLocation>
<IndexLocation>^DBAdressen.SD.KorrTypI</IndexLocation>
<StreamLocation>^DBAdressen.SD.KorrTypS</StreamLocation>
<Data name="KorrTypDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Code</Value>
</Value>
<Value name="3">
<Value>Kuerzel</Value>
</Value>
<Value name="4">
<Value>AktMandant</Value>
</Value>
<Value name="5">
<Value>Nachfassen</Value>
</Value>
<Value name="6">
<Value>Vorlage</Value>
</Value>
<Value name="7">
<Value>Zusatzadresse</Value>
</Value>
</Data>
<Data name="Text">
<Attribute>Text</Attribute>
<Structure>subnode</Structure>
<Subscript>"Text"</Subscript>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="AktMandant">
</Property>
<Property name="Code">
</Property>
<Property name="Kuerzel">
</Property>
<Property name="Nachfassen">
</Property>
<Property name="Vorlage"/>
<Property name="Zusatzadresse">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.SD.Kundengruppe">
<Description>
</Description>
<Super>%Persistent,%Populate,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40832.84681</TimeChanged>
<TimeCreated>60969,27708.851155</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Code">
<Type>%Library.Integer</Type>
<Required>1</Required>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
<Parameter name="POPSPEC" value="Integer(1,999)"/>
</Property>

<Property name="Kundengruppentext">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Steuerungstyp">
<Type>%Library.Integer</Type>
<Parameter name="MAXVAL" value="9"/>
<Parameter name="MINVAL" value="1"/>
<Parameter name="POPSPEC" value="Integer(1,9)"/>
</Property>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="AktMandantIdx">
<Properties>AktMandant</Properties>
</Index>

<Index name="CodeIndex">
<Properties>AktMandant,Code</Properties>
<Unique>1</Unique>
</Index>

<Index name="CodeMoveIndex">
<Data>%%ID,Code,Kundengruppentext(ELEMENTS)</Data>
<Properties>AktMandant:Exact,Kundengruppentext(KEYS),Code</Properties>
</Index>

<Method name="GetKundengruppentext">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Kundengruppentext, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetKundengruppentextClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID'="") {
		Set rs=##Class(DBAdressen.SD.Kundengruppe).%OpenId(myID)
		set text = rs.GetKundengruppentext(MandOid, Lang)
		kill rs
	}
	Quit text
]]></Implementation>
</Method>

<Method name="GetKgCodeByOidClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String</FormalSpec>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set kg = ""
	&SQL(SELECT Code into :kg FROM DBAdressen_SD.Kundengruppe WHERE ID = :myID)
	Quit kg
]]></Implementation>
</Method>

<Method name="SetKundengruppentext">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Kundengruppentext, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="CopyKundengruppenFromMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>srcMandOid:%String,dstMandOid:%String</FormalSpec>
<Implementation><![CDATA[
	set result = ##class(%Library.ResultSet).%New("DBAdressen.AF.SD.KundengruppeAF:ListeGesamt")
	set grp = result.%Execute(srcMandOid)
	
	while result.Next(.grp) {
		set ptr = ##class(DBAdressen.SD.Kundengruppe).%New()
		set ptr.Code = result.Data("Code")
		set ptr.Kundengruppentext = result.Data("Kundengruppentext")
		set ptr.Steuerungstyp = result.Data("Steuerungstyp")
		set ptr.AktMandant = dstMandOid
		do ptr.%Save()	
	}
]]></Implementation>
</Method>

<Method name="MoveFirstOnKgNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()

	set kg = $Order(^DBAdressen.SD.KundengruppeI("CodeMoveIndex",MandantOid,Lang,""),1)
	if (kg '= ""){
		set id = $Order(^DBAdressen.SD.KundengruppeI("CodeMoveIndex",MandantOid,Lang,kg,""),1,list)
	} else {
		Quit ""	
	}
	Quit list
]]></Implementation>
</Method>

<Method name="MoveLastOnKgNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()

	set kg = $Order(^DBAdressen.SD.KundengruppeI("CodeMoveIndex",MandantOid,Lang,""),-1)
	if (kg '= ""){
		set id = $Order(^DBAdressen.SD.KundengruppeI("CodeMoveIndex",MandantOid,Lang,kg,""),-1,list)
	} else {
		Quit ""	
	}
	Quit list
]]></Implementation>
</Method>

<Method name="MoveNextOnKgNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Lang:%String,aktCode:%Integer</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
    set nextKg = $Order(^DBAdressen.SD.KundengruppeI("CodeMoveIndex",MandantOid,Lang,aktCode))
	if (nextKg '= "") {
		set res = $Order(^DBAdressen.SD.KundengruppeI("CodeMoveIndex",MandantOid,Lang,nextKg,""),1,list)
	} else {
		set list = ##class(DBAdressen.SD.Kundengruppe).MoveLastOnKgNr(MandantOid,Lang)
	}
	
	Quit list
]]></Implementation>
</Method>

<Method name="MovePrevOKgNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Lang:%String,aktCode:%Integer</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
    set prevKg = $Order(^DBAdressen.SD.KundengruppeI("CodeMoveIndex",MandantOid,Lang,aktCode),-1)
	if (prevKg '= "") {
		set res = $Order(^DBAdressen.SD.KundengruppeI("CodeMoveIndex",MandantOid,Lang,prevKg,""),-1,list)
	} else {
		set list = ##class(DBAdressen.SD.Kundengruppe).MoveFirstOnKgNr(MandantOid,Lang)
	}
	
	Quit list
]]></Implementation>
</Method>

<Property name="AdresseKundengruppe">
<Type>DBAdressen.Adresse</Type>
<Cardinality>many</Cardinality>
<Inverse>Kundengruppe</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="GruppenPreis">
<Type>DBAgrofresh.KGPreis</Type>
<Cardinality>many</Cardinality>
<Inverse>Gruppe</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="GruppenGebPreis">
<Type>DBAgrofresh.KGGebPreis</Type>
<Cardinality>many</Cardinality>
<Inverse>Gruppe</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="KGRabattGruppe">
<Type>DBAgrofresh.KGRabatt</Type>
<Cardinality>many</Cardinality>
<Inverse>Gruppe</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="GruppenRueckverg">
<Type>DBAgrofresh.KGRueckverg</Type>
<Cardinality>many</Cardinality>
<Inverse>Gruppe</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="KGPreisGruppe">
<Type>DBAgrofreshEK.KGPreis</Type>
<Cardinality>many</Cardinality>
<Inverse>Gruppe</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="GruppenGebPreisEK">
<Type>DBAgrofreshEK.KGGebPreis</Type>
<Cardinality>many</Cardinality>
<Inverse>Gruppe</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="FaktGruppenPreis">
<Type>DBFakturierung.KGPreis</Type>
<Cardinality>many</Cardinality>
<Inverse>Gruppe</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="FaktKGRabattGruppe">
<Type>DBFakturierung.KGRabatt</Type>
<Cardinality>many</Cardinality>
<Inverse>Gruppe</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="FaktGruppenRueckverg">
<Type>DBFakturierung.KGRueckverg</Type>
<Cardinality>many</Cardinality>
<Inverse>Gruppe</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="ArtGrpKGMarge">
<Type>DBAgrofresh.SD.ArtGrpKGMarge</Type>
<Cardinality>many</Cardinality>
<Inverse>Kundengruppe</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="SpezBerechnungsart">
<Type>DBSpezial.Fakt.SD.PosBerArt</Type>
<Cardinality>many</Cardinality>
<Inverse>Kundengruppe</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Method name="GetKgOidByCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,code:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set myID = ""
	&SQL(SELECT %ID into :myID FROM DBAdressen_SD.Kundengruppe WHERE AktMandant=:MandantOid AND Code=:code)
	Quit myID
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SD.KundengruppeD</DataLocation>
<DefaultData>KundengruppeDefaultData</DefaultData>
<IdLocation>^DBAdressen.SD.KundengruppeD</IdLocation>
<IndexLocation>^DBAdressen.SD.KundengruppeI</IndexLocation>
<StreamLocation>^DBAdressen.SD.KundengruppeS</StreamLocation>
<Data name="KundengruppeDefaultData">
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Code</Value>
</Value>
<Value name="3">
<Value>Steuerungstyp</Value>
</Value>
<Value name="4">
<Value>AktMandant</Value>
</Value>
</Data>
<Data name="Kundengruppentext">
<Attribute>Kundengruppentext</Attribute>
<Structure>subnode</Structure>
<Subscript>"Kundengruppentext"</Subscript>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="AktMandant">
</Property>
<Property name="Code">
</Property>
<Property name="Steuerungstyp">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.SD.Kundenkategorie">
<Description>
</Description>
<Super>%Persistent,%Populate,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40832.906633</TimeChanged>
<TimeCreated>60969,27708.851155</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Code">
<Type>%Library.Integer</Type>
<Required>1</Required>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
<Parameter name="POPSPEC" value="Integer(1,999)"/>
</Property>

<Property name="Kategorie">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="AktMandantIdx">
<Properties>AktMandant</Properties>
</Index>

<Index name="CodeIndex">
<Properties>AktMandant,Code</Properties>
<Unique>1</Unique>
</Index>

<Property name="LieferantenAbrechnungAktiv">
<Type>%Boolean</Type>
</Property>

<Method name="GetKategorie">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Kategorie, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetKategorieClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID'="") {
		Set rs=##Class(DBAdressen.SD.Kundenkategorie).%OpenId(myID)
		set text = rs.GetKategorie(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetKategorie">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Kategorie, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="CopyKundenkategorieFromMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>srcMandOid:%String,dstMandOid:%String</FormalSpec>
<Implementation><![CDATA[
	set result = ##class(%Library.ResultSet).%New("DBAdressen.AF.SD.KundenkategorieAF:ListeGesamt")
	set kat = result.%Execute(srcMandOid)
	
	while result.Next(.kat) {
		set ptr = ##class(DBAdressen.SD.Kundenkategorie).%New()
		set ptr.Code = result.Data("Code")
		set ptr.Kategorie = result.Data("Kategorie")
		set ptr.AktMandant = dstMandOid
		do ptr.%Save()	
	}
]]></Implementation>
</Method>

<Method name="GetOidByCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set myID = ""
	&sql(SELECT ID into :myID FROM DBAdressen_SD.Kundenkategorie WHERE AktMandant= :MandantOid AND Code= :Code)
	Quit myID
]]></Implementation>
</Method>

<Property name="AdresseKundenkategorie">
<Type>DBAdressen.Adresse</Type>
<Cardinality>many</Cardinality>
<Inverse>Kundenkategorie</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="VKFibuKonto">
<Type>DBFibu.Konto</Type>
<Cardinality>one</Cardinality>
<Inverse>KundenkategorieVK</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="VKFibuKonto"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="VKFibuKontoIndex">
<Properties>VKFibuKonto</Properties>
</Index>

<Property name="EKFibuKonto">
<Type>DBFibu.Konto</Type>
<Cardinality>one</Cardinality>
<Inverse>KundenkategorieEK</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="EKFibuKonto"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="EKFibuKontoIndex">
<Properties>EKFibuKonto</Properties>
</Index>

<Property name="GebAdminKosten">
<Type>DBAgrofresh.SD.GebAdminKosten</Type>
<Cardinality>many</Cardinality>
<Inverse>Kundenkategorie</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Method name="RemoveKategorienByMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[
	
	&sql(DELETE FROM DBAdressen_SD.Kundenkategorie WHERE AktMandant = :MandantOid)
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SD.KundenkategorieD</DataLocation>
<DefaultData>KundenkategorieDefaultData</DefaultData>
<IdLocation>^DBAdressen.SD.KundenkategorieD</IdLocation>
<IndexLocation>^DBAdressen.SD.KundenkategorieI</IndexLocation>
<StreamLocation>^DBAdressen.SD.KundenkategorieS</StreamLocation>
<Data name="Kategorie">
<Attribute>Kategorie</Attribute>
<Structure>subnode</Structure>
<Subscript>"Kategorie"</Subscript>
</Data>
<Data name="KundenkategorieDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Code</Value>
</Value>
<Value name="3">
<Value>AktMandant</Value>
</Value>
<Value name="4">
<Value>FibuKonto</Value>
</Value>
<Value name="5">
<Value>VKFibuKonto</Value>
</Value>
<Value name="6">
<Value>EKFibuKonto</Value>
</Value>
<Value name="7">
<Value>LieferantenAbrechnungAktiv</Value>
</Value>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="AktMandant">
</Property>
<Property name="Code">
</Property>
<Property name="EKFibuKonto">
</Property>
<Property name="FibuKonto"/>
<Property name="LieferantenAbrechnungAktiv">
</Property>
<Property name="VKFibuKonto">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.SD.Lieferantengrp">
<Super>%Persistent,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40833.120571</TimeChanged>
<TimeCreated>62235,34567.31176</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Code">
<Type>%Library.Integer</Type>
<Required>1</Required>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
</Property>

<Property name="Bezeichnung">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="AktMandantIdx">
<Properties>AktMandant</Properties>
</Index>

<Index name="CodeIndex">
<Properties>AktMandant,Code</Properties>
<Unique>1</Unique>
</Index>

<Index name="CodeMoveIndex">
<Data>%%ID,Code,Bezeichnung(ELEMENTS)</Data>
<Properties>AktMandant:Exact,Bezeichnung(KEYS),Code</Properties>
</Index>

<Method name="GetBezeichnung">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Bezeichnung, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetBezeichnungClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID'="") {
		Set rs=##Class(DBAdressen.SD.Lieferantengrp).%OpenId(myID)
		set text = rs.GetBezeichnung(MandOid, Lang)
		kill rs
	}
	Quit text
]]></Implementation>
</Method>

<Method name="GetLgCodeByOidClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String</FormalSpec>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set lg = ""
	&SQL(SELECT Code into :lg FROM DBAdressen_SD.Lieferantengrp WHERE ID = :myID)
	if (SQLCODE '= 0) {
		set lg = ""	
	}
	Quit lg
]]></Implementation>
</Method>

<Method name="SetBezeichnung">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Bezeichnung, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="CopyBezeichnungFromMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>srcMandOid:%String,dstMandOid:%String</FormalSpec>
<Implementation><![CDATA[
	set result = ##class(%Library.ResultSet).%New("DBAdressen.AF.SD.LieferantengrpAF:ListeGesamt")
	set grp = result.%Execute(srcMandOid)
	
	while result.Next(.grp) {
		set ptr = ##class(DBAdressen.SD.Lieferantengrp).%New()
		set ptr.Code = result.Data("Code")
		set ptr.Bezeichnung = result.Data("Bezeichnung")
		set ptr.AktMandant = dstMandOid
		do ptr.%Save()	
	}
]]></Implementation>
</Method>

<Method name="MoveFirstOnLgNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()

	set lg = $Order(^DBAdressen.SD.LieferantengrpI("CodeMoveIndex",MandantOid,Lang,""),1)
	if (lg '= ""){
		set id = $Order(^DBAdressen.SD.LieferantengrpI("CodeMoveIndex",MandantOid,Lang,lg,""),1,list)
	} else {
		Quit ""	
	}
	Quit list
]]></Implementation>
</Method>

<Method name="MoveLastOnLgNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Lang:%String</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()

	set lg = $Order(^DBAdressen.SD.LieferantengrpI("CodeMoveIndex",MandantOid,Lang,""),-1)
	if (lg '= ""){
		set id = $Order(^DBAdressen.SD.LieferantengrpI("CodeMoveIndex",MandantOid,Lang,lg,""),-1,list)
	} else {
		Quit ""	
	}
	Quit list
]]></Implementation>
</Method>

<Method name="MoveNextOnLgNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Lang:%String,aktCode:%Integer</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
    set nextLg = $Order(^DBAdressen.SD.LieferantengrpI("CodeMoveIndex",MandantOid,Lang,aktCode))
	if (nextLg '= "") {
		set res = $Order(^DBAdressen.SD.LieferantengrpI("CodeMoveIndex",MandantOid,Lang,nextLg,""),1,list)
	} else {
		set list = ##class(DBAdressen.SD.Lieferantengrp).MoveLastOnLgNr(MandantOid,Lang)
	}
	
	Quit list
]]></Implementation>
</Method>

<Method name="MovePrevOLgNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Lang:%String,aktCode:%Integer</FormalSpec>
<ReturnType>%List</ReturnType>
<Implementation><![CDATA[
	set list = $ListBuild()
    set prevLg = $Order(^DBAdressen.SD.LieferantengrpI("CodeMoveIndex",MandantOid,Lang,aktCode),-1)
	if (prevLg '= "") {
		set res = $Order(^DBAdressen.SD.LieferantengrpI("CodeMoveIndex",MandantOid,Lang,prevLg,""),-1,list)
	} else {
		set list = ##class(DBAdressen.SD.Lieferantengrp).MoveFirstOnLgNr(MandantOid,Lang)
	}
	
	Quit list
]]></Implementation>
</Method>

<Method name="GetLgOidByCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,code:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set myID = ""
	&SQL(SELECT %ID into :myID FROM DBAdressen_SD.Lieferantengrp WHERE AktMandant=:MandantOid AND Code=:code)
	if (SQLCODE '= 0) {
		set myID = ""	
	}
	Quit myID
]]></Implementation>
</Method>

<Method name="CopySetKundengruppen">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	
	set result = ##class(%Library.ResultSet).%New("DBAdressen.AF.SD.KundengruppeAF:ListeGesamt")
	set grp = result.%Execute(MandantOid, "de")
	
	while result.Next(.grp) {
		set ptr = ##class(DBAdressen.SD.Lieferantengrp).%New()
		set oldID = result.Data("ID")
		set old = ##class(DBAdressen.SD.Kundengruppe).%OpenId(oldID)
		set ptr.Code = result.Data("Code")
		set ptr.Bezeichnung = old.Kundengruppentext
		set ptr.AktMandant = old.AktMandant
		do ptr.%Save()	
		set newID = ptr.%Id()
		set ptr = ""
		set old = ""
	}	
	
	set result = ##class(%Library.ResultSet).%New("DBAdressen.AF.AdresseAF:ListeIdsGesamt")
	set grp = result.%Execute(MandantOid)
	while result.Next(.grp) {
		set adr = ##class(DBAdressen.Adresse).%OpenId(result.Data("ID"))
		if (adr.Kundengruppe '= "") {
			set ptr = ##class(DBAdressen.SD.Lieferantengrp).GetLgOidByCode(MandantOid, adr.Kundengruppe.Code)
			set adr.Lieferantengruppe = ##class(DBAdressen.SD.Lieferantengrp).%OpenId(ptr)
			do adr.%Save()
		}
		set adr = ""
	}	
	
	Quit ""
]]></Implementation>
</Method>

<Property name="Adresse">
<Type>DBAdressen.Adresse</Type>
<Cardinality>many</Cardinality>
<Inverse>Lieferantengruppe</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="LGPreisGruppe">
<Type>DBAgrofreshEK.LGPreis</Type>
<Cardinality>many</Cardinality>
<Inverse>Gruppe</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="GruppenGebPreisEK">
<Type>DBAgrofreshEK.LGGebPreis</Type>
<Cardinality>many</Cardinality>
<Inverse>Gruppe</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SD.LieferantengrpD</DataLocation>
<DefaultData>LieferantengrpDefaultData</DefaultData>
<IdLocation>^DBAdressen.SD.LieferantengrpD</IdLocation>
<IndexLocation>^DBAdressen.SD.LieferantengrpI</IndexLocation>
<StreamLocation>^DBAdressen.SD.LieferantengrpS</StreamLocation>
<Data name="Bezeichnung">
<Attribute>Bezeichnung</Attribute>
<Structure>subnode</Structure>
<Subscript>"Bezeichnung"</Subscript>
</Data>
<Data name="LieferantengrpDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Code</Value>
</Value>
<Value name="3">
<Value>AktMandant</Value>
</Value>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="AktMandant">
</Property>
<Property name="Code">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.SD.MAMultiSel">
<Super>%Persistent,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40833.118925</TimeChanged>
<TimeCreated>62164,31021.92468</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Nummer">
<Type>%Library.Integer</Type>
<Required>1</Required>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
</Property>

<Property name="Code">
<Type>%Library.String</Type>
<Parameter name="MAXLEN" value="2"/>
</Property>

<Property name="Bezeichnung">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="AktMandantIdx">
<Properties>AktMandant</Properties>
</Index>

<Index name="CodeIndex">
<Properties>AktMandant,Nummer</Properties>
<Unique>1</Unique>
</Index>

<Property name="MitarbeiterMultiSel">
<Type>DBAdressen.MitarbeiterMultiSel</Type>
<Cardinality>many</Cardinality>
<Inverse>MAMultiSel</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Method name="GetBezeichnung">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Bezeichnung, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetBezeichnungClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID '= "") {
		Set rs=##Class(DBAdressen.SD.MAMultiSel).%OpenId(myID)
		set text = rs.GetBezeichnung(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetBezeichnung">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Bezeichnung, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetMAMultiSelIdByKuerzel">
<ClassMethod>1</ClassMethod>
<FormalSpec>Code:%String,MandantOid:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	set id = ""
	&sql(SELECT ID INTO :id FROM DBAdressen_SD.MAMultiSel WHERE AktMandant = :MandantOid
			AND Code = :Code)
	Quit id
]]></Implementation>
</Method>

<Method name="GetNextCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<ReturnType>%Library.Integer</ReturnType>
<Implementation><![CDATA[
	set retval = 0
	&sql(SELECT Max(Code) INTO :retval FROM DBAdressen_SD.MAMultiSel WHERE AktMandant = :MandantOid)
	Set retval = +retval + 1
	Quit retval
]]></Implementation>
</Method>

<Method name="GetOidByCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Nummer:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set myID = ""
	&sql(SELECT ID into :myID FROM DBAdressen_SD.MAMultiSel 
	WHERE AktMandant= :MandantOid AND Nummer= :Nummer)
	Quit myID
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SD.MAMultiSelD</DataLocation>
<DefaultData>MAMultiSelDefaultData</DefaultData>
<IdLocation>^DBAdressen.SD.MAMultiSelD</IdLocation>
<IndexLocation>^DBAdressen.SD.MAMultiSelI</IndexLocation>
<StreamLocation>^DBAdressen.SD.MAMultiSelS</StreamLocation>
<Data name="Bezeichnung">
<Attribute>Bezeichnung</Attribute>
<Structure>subnode</Structure>
<Subscript>"Bezeichnung"</Subscript>
</Data>
<Data name="MAMultiSelDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Nummer</Value>
</Value>
<Value name="3">
<Value>Code</Value>
</Value>
<Value name="4">
<Value>AktMandant</Value>
</Value>
</Data>
<Property name="AktMandant"/>
<Property name="Code"/>
<Property name="Nummer"/>
</Storage>
</Class>


<Class name="DBAdressen.SD.Preiskategorie">
<Description>
</Description>
<Super>%Persistent,%Populate,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40833.342223</TimeChanged>
<TimeCreated>60969,27708.851155</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Code">
<Type>%Library.Integer</Type>
<Required>1</Required>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
<Parameter name="POPSPEC" value="Integer(1,999)"/>
</Property>

<Property name="Kategorie">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Beschreibung">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="AktMandantIdx">
<Properties>AktMandant</Properties>
</Index>

<Index name="CodeIndex">
<Properties>AktMandant,Code</Properties>
<Unique>1</Unique>
</Index>

<Method name="GetKategorie">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Kategorie, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetKategorieClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID'="") {
		Set rs=##Class(DBAdressen.SD.Preiskategorie).%OpenId(myID)
		set text = rs.GetKategorie(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetKategorie">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Kategorie, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetBeschreibung">
<FormalSpec>MandOid:%String="",Lang:%String=""</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Beschreibung, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetBeschreibungClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID'="") {
		Set rs=##Class(DBAdressen.SD.Preiskategorie).%OpenId(myID)
		set text = rs.GetBeschreibung(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetBeschreibung">
<FormalSpec>MandOid:%String="",Lang:%String="",Value:%String=""</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Beschreibung, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="CopyPreiskategorieFromMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>srcMandOid:%String,dstMandOid:%String</FormalSpec>
<Implementation><![CDATA[
	set result = ##class(%Library.ResultSet).%New("DBAdressen.AF.SD.PreiskategorieAF:ListeGesamt")
	set kat = result.%Execute(srcMandOid)
	
	while result.Next(.kat) {
		set ptr = ##class(DBAdressen.SD.Preiskategorie).%New()
		set ptr.Code = result.Data("Code")
		set ptr.Kategorie = result.Data("Kategorie")
		set ptr.Beschreibung = result.Data("Beschreibung")
		set ptr.AktMandant = dstMandOid
		do ptr.%Save()	
	}
]]></Implementation>
</Method>

<Method name="GetOidByCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set myID = ""
	&sql(SELECT ID into :myID FROM DBAdressen_SD.Preiskategorie WHERE AktMandant= :MandantOid AND Code= :Code)
	Quit myID
]]></Implementation>
</Method>

<Method name="RemovePreiskatByMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[
	
	&sql(DELETE FROM DBAdressen_SD.Preiskategorie WHERE AktMandant = :MandantOid)
]]></Implementation>
</Method>

<Property name="AdressePreiskategorie">
<Type>DBAdressen.Adresse</Type>
<Cardinality>many</Cardinality>
<Inverse>Preiskategorie</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="ArtGrPrKatRabatt">
<Type>DBAgrofresh.SD.ArtGrPreisKatRabatt</Type>
<Cardinality>many</Cardinality>
<Inverse>Preiskategorie</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="FaktArtGrPrKatRabatt">
<Type>DBFakturierung.SD.ArtGrPreisKatRabatt</Type>
<Cardinality>many</Cardinality>
<Inverse>Preiskategorie</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="KategoriePreis">
<Type>DBAgrofresh.PKPreis</Type>
<Cardinality>many</Cardinality>
<Inverse>Kategorie</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Method name="GetFirstCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<ReturnType>%Integer</ReturnType>
<Implementation><![CDATA[
    set code = ""
    &sql(SELECT TOP 1 Code INTO :code FROM DBAdressen_SD.Preiskategorie
         WHERE AktMandant = :MandantOid ORDER BY Code)
    Quit:(SQLCODE'=0) ""
    Quit code
]]></Implementation>
</Method>

<Method name="GetLastCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<ReturnType>%Integer</ReturnType>
<Implementation><![CDATA[
	set code = ""
    &sql(SELECT TOP 1 Code INTO :code FROM DBAdressen_SD.Preiskategorie
         WHERE AktMandant = :MandantOid ORDER BY Code DESC)
    Quit:(SQLCODE'=0) ""
    Quit code
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SD.PreiskategorieD</DataLocation>
<DefaultData>PreiskategorieDefaultData</DefaultData>
<IdLocation>^DBAdressen.SD.PreiskategorieD</IdLocation>
<IndexLocation>^DBAdressen.SD.PreiskategorieI</IndexLocation>
<StreamLocation>^DBAdressen.SD.PreiskategorieS</StreamLocation>
<Data name="Beschreibung">
<Attribute>Beschreibung</Attribute>
<Structure>subnode</Structure>
<Subscript>"Beschreibung"</Subscript>
</Data>
<Data name="Kategorie">
<Attribute>Kategorie</Attribute>
<Structure>subnode</Structure>
<Subscript>"Kategorie"</Subscript>
</Data>
<Data name="PreiskategorieDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Code</Value>
</Value>
<Value name="3">
<Value>AktMandant</Value>
</Value>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="AktMandant">
</Property>
<Property name="Code">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.SD.Prioritaet">
<Super>%Persistent,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40833.378617</TimeChanged>
<TimeCreated>61753,31498.654433</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Code">
<Type>%Library.Integer</Type>
<Parameter name="MAXVAL" value="99"/>
<Parameter name="MINVAL" value="1"/>
</Property>

<Property name="Text">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="AktMandantIdx">
<Properties>AktMandant</Properties>
</Index>

<Index name="CodeIndex">
<Properties>AktMandant,Code</Properties>
<Unique>1</Unique>
</Index>

<Property name="Rapport">
<Type>DBAdressen.Besuchsrapport</Type>
<Cardinality>many</Cardinality>
<Inverse>Prioritaet</Inverse>
<Relationship>1</Relationship>
</Property>

<Method name="GetText">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Text, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetTextClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID '= "") {
		Set rs=##Class(DBAdressen.SD.Prioritaet).%OpenId(myID)
		Set text = rs.GetText(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetText">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Text, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SD.PrioritaetD</DataLocation>
<DefaultData>PrioritaetDefaultData</DefaultData>
<IdLocation>^DBAdressen.SD.PrioritaetD</IdLocation>
<IndexLocation>^DBAdressen.SD.PrioritaetI</IndexLocation>
<StreamLocation>^DBAdressen.SD.PrioritaetS</StreamLocation>
<Data name="PrioritaetDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Code</Value>
</Value>
<Value name="3">
<Value>AktMandant</Value>
</Value>
</Data>
<Data name="Text">
<Attribute>Text</Attribute>
<Structure>subnode</Structure>
<Subscript>"Text"</Subscript>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="AktMandant">
</Property>
<Property name="Code">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.SD.Selektion1">
<Description>
</Description>
<Super>%Persistent,%Populate,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40833.581157</TimeChanged>
<TimeCreated>60969,27708.851155</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Code">
<Type>%Library.Integer</Type>
<Required>1</Required>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
<Parameter name="POPSPEC" value="Integer(1,999)"/>
</Property>

<Property name="Text1">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Text2">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="AktMandantIdx">
<Properties>AktMandant</Properties>
</Index>

<Index name="CodeIndex">
<Properties>AktMandant,Code</Properties>
<Unique>1</Unique>
</Index>

<Method name="GetText1">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Text1, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetText1Class">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID'="") {
		Set rs=##Class(DBAdressen.SD.Selektion1).%OpenId(myID)
		set text = rs.GetText1(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetText1">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Text1, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetText2">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Text2, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetText2Class">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID'="") {
		Set rs=##Class(DBAdressen.SD.Selektion1).%OpenId(myID)
		set text = rs.GetText2(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetText2">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Text2, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="CopySelektion1FromMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>srcMandOid:%String,dstMandOid:%String</FormalSpec>
<Implementation><![CDATA[
	set result = ##class(%Library.ResultSet).%New("DBAdressen.AF.SD.Selektion1AF:ListeGesamt")
	set sel = result.%Execute(srcMandOid)

	while result.Next(.sel) {
		set ptr = ##class(DBAdressen.SD.Selektion1).%New()
		set ptr.Code = result.Data("Code")
		set ptr.Text1 = result.Data("Text1")
		set ptr.Text2 = result.Data("Text2")
		set ptr.AktMandant = dstMandOid
		do ptr.%Save()	
	}
]]></Implementation>
</Method>

<Method name="GetOidByCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set myID = ""
	&sql(SELECT ID into :myID FROM DBAdressen_SD.Selektion1 WHERE AktMandant= :MandantOid AND Code= :Code)
	Quit myID
]]></Implementation>
</Method>

<Method name="RemoveSel1ByMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[
	
	&sql(DELETE FROM DBAdressen_SD.Selektion1 WHERE AktMandant = :MandantOid)
]]></Implementation>
</Method>

<Property name="AdresseSelektion1">
<Type>DBAdressen.Adresse</Type>
<Cardinality>many</Cardinality>
<Inverse>FreieSelektion1</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SD.Selektion1D</DataLocation>
<DefaultData>Selektion1DefaultData</DefaultData>
<IdLocation>^DBAdressen.SD.Selektion1D</IdLocation>
<IndexLocation>^DBAdressen.SD.Selektion1I</IndexLocation>
<StreamLocation>^DBAdressen.SD.Selektion1S</StreamLocation>
<Data name="Selektion1DefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Code</Value>
</Value>
<Value name="3">
<Value>AktMandant</Value>
</Value>
</Data>
<Data name="Text1">
<Attribute>Text1</Attribute>
<Structure>subnode</Structure>
<Subscript>"Text1"</Subscript>
</Data>
<Data name="Text2">
<Attribute>Text2</Attribute>
<Structure>subnode</Structure>
<Subscript>"Text2"</Subscript>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="AktMandant">
</Property>
<Property name="Code">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.SD.Selektion2">
<Description>
</Description>
<Super>%Persistent,%Populate,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40833.590164</TimeChanged>
<TimeCreated>60969,27708.851155</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Code">
<Type>%Library.Integer</Type>
<Required>1</Required>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
<Parameter name="POPSPEC" value="Integer(1,999)"/>
</Property>

<Property name="Text1">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Text2">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="AktMandantIdx">
<Properties>AktMandant</Properties>
</Index>

<Index name="CodeIndex">
<Properties>AktMandant,Code</Properties>
<Unique>1</Unique>
</Index>

<Method name="GetText1">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Text1, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetText1Class">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID'="") {
		Set rs=##Class(DBAdressen.SD.Selektion2).%OpenId(myID)
		set text = rs.GetText1(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetText1">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Text1, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetText2">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Text2, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetText2Class">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID'="") {
		Set rs=##Class(DBAdressen.SD.Selektion2).%OpenId(myID)
		set text = rs.GetText2(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetText2">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Text2, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="CopySelektion2FromMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>srcMandOid:%String,dstMandOid:%String</FormalSpec>
<Implementation><![CDATA[
	set result = ##class(%Library.ResultSet).%New("DBAdressen.AF.SD.Selektion2AF:ListeGesamt")
	set sel = result.%Execute(srcMandOid)
	
	while result.Next(.sel) {
		set ptr = ##class(DBAdressen.SD.Selektion2).%New()
		set ptr.Code = result.Data("Code")
		set ptr.Text1 = result.Data("Text1")
		set ptr.Text2 = result.Data("Text2")
		set ptr.AktMandant = dstMandOid
		do ptr.%Save()	
	}
]]></Implementation>
</Method>

<Method name="GetOidByCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set myID = ""
	&sql(SELECT ID into :myID FROM DBAdressen_SD.Selektion2 WHERE AktMandant= :MandantOid AND Code= :Code)
	Quit myID
]]></Implementation>
</Method>

<Method name="RemoveSel2ByMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[
	
	&sql(DELETE FROM DBAdressen_SD.Selektion2 WHERE AktMandant = :MandantOid)
]]></Implementation>
</Method>

<Property name="AdresseSelektion2">
<Type>DBAdressen.Adresse</Type>
<Cardinality>many</Cardinality>
<Inverse>FreieSelektion2</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="GebindeSelektion2">
<Type>DBAgrofresh.SD.Gebinde</Type>
<Cardinality>many</Cardinality>
<Inverse>Selektion2</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SD.Selektion2D</DataLocation>
<DefaultData>Selektion2DefaultData</DefaultData>
<IdLocation>^DBAdressen.SD.Selektion2D</IdLocation>
<IndexLocation>^DBAdressen.SD.Selektion2I</IndexLocation>
<StreamLocation>^DBAdressen.SD.Selektion2S</StreamLocation>
<Data name="Selektion2DefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Code</Value>
</Value>
<Value name="3">
<Value>AktMandant</Value>
</Value>
</Data>
<Data name="Text1">
<Attribute>Text1</Attribute>
<Structure>subnode</Structure>
<Subscript>"Text1"</Subscript>
</Data>
<Data name="Text2">
<Attribute>Text2</Attribute>
<Structure>subnode</Structure>
<Subscript>"Text2"</Subscript>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="AktMandant">
</Property>
<Property name="Code">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.SD.Status">
<Description>
</Description>
<Super>%Persistent,%Populate,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40833.765107</TimeChanged>
<TimeCreated>60969,27708.851155</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Code">
<Type>%Library.Integer</Type>
<Required>1</Required>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
<Parameter name="POPSPEC" value="Integer(1,999)"/>
</Property>

<Property name="Statustext">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="AktMandantIdx">
<Properties>AktMandant</Properties>
</Index>

<Index name="CodeIndex">
<Properties>AktMandant,Code</Properties>
<Unique>1</Unique>
</Index>

<Method name="GetStatustext">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Statustext, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetStatustextClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID'="") {
		Set rs=##Class(DBAdressen.SD.Status).%OpenId(myID)
		set text = rs.GetStatustext(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetStatustext">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Statustext, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="CopyStatiFromMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>srcMandOid:%String,dstMandOid:%String</FormalSpec>
<Implementation><![CDATA[
	set result = ##class(%Library.ResultSet).%New("DBAdressen.AF.SD.StatusAF:ListeGesamt")
	set stati = result.%Execute(srcMandOid)
	
	while result.Next(.stati) {
		set ptr = ##class(DBAdressen.SD.Status).%New()
		set ptr.Code = result.Data("Code")
		set ptr.Statustext = result.Data("Statustext")
		set ptr.AktMandant = dstMandOid
		do ptr.%Save()	
	}
]]></Implementation>
</Method>

<Property name="Korrespondenz">
<Type>DBAdressen.Korrespondenz</Type>
<Cardinality>many</Cardinality>
<Inverse>Status</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="Dokument">
<Type>DBAdressen.Dokument</Type>
<Cardinality>many</Cardinality>
<Inverse>Status</Inverse>
<Relationship>1</Relationship>
</Property>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SD.StatusD</DataLocation>
<DefaultData>StatusDefaultData</DefaultData>
<IdLocation>^DBAdressen.SD.StatusD</IdLocation>
<IndexLocation>^DBAdressen.SD.StatusI</IndexLocation>
<StreamLocation>^DBAdressen.SD.StatusS</StreamLocation>
<Data name="StatusDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Code</Value>
</Value>
<Value name="3">
<Value>AktMandant</Value>
</Value>
</Data>
<Data name="Statustext">
<Attribute>Statustext</Attribute>
<Structure>subnode</Structure>
<Subscript>"Statustext"</Subscript>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="AktMandant">
</Property>
<Property name="Code">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.SD.StatusBesuch">
<Super>%Persistent,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40833.79175</TimeChanged>
<TimeCreated>61753,49880.058235</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Code">
<Type>%Library.Integer</Type>
<Parameter name="MAXVAL" value="99"/>
<Parameter name="MINVAL" value="1"/>
</Property>

<Property name="Text">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="AktMandantIdx">
<Properties>AktMandant</Properties>
</Index>

<Index name="CodeIndex">
<Properties>AktMandant,Code</Properties>
<Unique>1</Unique>
</Index>

<Property name="Rapport">
<Type>DBAdressen.Besuchsrapport</Type>
<Cardinality>many</Cardinality>
<Inverse>Status</Inverse>
<Relationship>1</Relationship>
</Property>

<Method name="GetText">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Text, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetTextClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID '= "") {
		Set rs=##Class(DBAdressen.SD.StatusBesuch).%OpenId(myID)
		Set text = rs.GetText(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetText">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Text, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetLastStatusByMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandOid</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	set id = ""
	&SQL(Select Top 1 ID into :id FROM DBAdressen_SD.StatusBesuch WHERE AktMandant = :MandOid Order by Code DESC)
	Quit:(SQLCODE'=0) ""
	Quit id
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SD.StatusBesuchD</DataLocation>
<DefaultData>StatusBesuchDefaultData</DefaultData>
<IdLocation>^DBAdressen.SD.StatusBesuchD</IdLocation>
<IndexLocation>^DBAdressen.SD.StatusBesuchI</IndexLocation>
<StreamLocation>^DBAdressen.SD.StatusBesuchS</StreamLocation>
<Data name="StatusBesuchDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Code</Value>
</Value>
<Value name="3">
<Value>AktMandant</Value>
</Value>
</Data>
<Data name="Text">
<Attribute>Text</Attribute>
<Structure>subnode</Structure>
<Subscript>"Text"</Subscript>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="AktMandant">
</Property>
<Property name="Code">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.SD.Vertreter">
<Description>
</Description>
<Owner>cbt</Owner>
<Super>%Persistent,%Populate,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40833.984104</TimeChanged>
<TimeCreated>60969,27708.851155</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Code">
<Type>%Library.Integer</Type>
<Required>1</Required>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
<Parameter name="POPSPEC" value="Integer(1,999)"/>
</Property>

<Property name="Name">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Beschreibung">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="CodeIndex">
<Properties>AktMandant,Code</Properties>
<Unique>1</Unique>
</Index>

<Method name="GetName">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Name, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetNameClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID'="") {
		Set rs=##Class(DBAdressen.SD.Vertreter).%OpenId(myID)
		set text = rs.GetName(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetName">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Name, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetBeschreibung">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Beschreibung, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetBeschreibungClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID'="") {
		Set rs=##Class(DBAdressen.SD.Vertreter).%OpenId(myID)
		set text = rs.GetBeschreibung(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetBeschreibung">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Beschreibung, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="CopyVertreterFromMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>srcMandOid:%String,dstMandOid:%String</FormalSpec>
<Implementation><![CDATA[
	set result = ##class(%Library.ResultSet).%New("DBAdressen.AF.SD.VertreterAF:ListeGesamt")
	set vertreter = result.%Execute(srcMandOid)
	
	while result.Next(.vertreter) {
		set ptr = ##class(DBAdressen.SD.Vertreter).%New()
		set ptr.Code = result.Data("Code")
		set ptr.Name = result.Data("Name")
		set ptr.Beschreibung = result.Data("Beschreibung")
		set ptr.AktMandant = dstMandOid
		do ptr.%Save()	
	}
]]></Implementation>
</Method>

<Method name="GetIdByPosNrOnMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[

	set id = ""
	&sql(SELECT TOP 1 ID INTO :id FROM DBAdressen_SD.Vertreter
		 WHERE AktMandant = :MandantOid AND Code = :Code)
	Quit id
]]></Implementation>
</Method>

<Method name="GetIdByNameOnMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Name:%String,Sprache:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[

	set id = ""
	&sql(SELECT TOP 1 ID INTO :id FROM DBAdressen_SD.Vertreter
		 WHERE AktMandant = :MandantOid AND DBAdressen_SD.Vertreter_GetNameClass(ID,:MandantOid,:Sprache) = :Name)
	Quit id
]]></Implementation>
</Method>

<Method name="GetNextFreeCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<ReturnType>%Integer</ReturnType>
<Implementation><![CDATA[
    set code = 0
    &sql(SELECT TOP 1 Code INTO :code FROM DBAdressen_SD.Vertreter
         WHERE AktMandant = :MandantOid ORDER BY Code DESC)
    set code = code + 1             
    Quit code
]]></Implementation>
</Method>

<Property name="AdresseVertretercode">
<Type>DBAdressen.Adresse</Type>
<Cardinality>many</Cardinality>
<Inverse>Vertretercode</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="AgrofreshAuftrag">
<Type>DBAgrofresh.Auftragskopf</Type>
<Cardinality>many</Cardinality>
<Inverse>Vertreter</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="AgrofreshDetail">
<Type>DBAgrofresh.Auftragspos</Type>
<Cardinality>many</Cardinality>
<Inverse>Vertreter</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="OPVertreter">
<Type>DBDebiKredi.OP</Type>
<Cardinality>many</Cardinality>
<Inverse>Vertreter</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<UDLText name="T">
<Content><![CDATA[
//Relationship BKVertreter As DBAgrofreshEK.BestellungsKopf(XMLPROJECTION = "NONE") [ Cardinality = many, Inverse = Vertreter ];

]]></Content>
</UDLText>

<Property name="BestStrgVorschlag">
<Type>DBAgrofreshEK.BestStrg</Type>
<Cardinality>many</Cardinality>
<Inverse>VorschlagVertreter</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="QsMeldungVk">
<Type>DBAgrofreshEK.QSMeldung</Type>
<Cardinality>many</Cardinality>
<Inverse>VkVertreter</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="FakturierungAuftrag">
<Type>DBFakturierung.Auftragskopf</Type>
<Cardinality>many</Cardinality>
<Inverse>Vertreter</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="FakturierungDetail">
<Type>DBFakturierung.Auftragspos</Type>
<Cardinality>many</Cardinality>
<Inverse>Vertreter</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="FaktEKDetail">
<Type>DBFaktEK.Bestellungspos</Type>
<Cardinality>many</Cardinality>
<Inverse>Vertreter</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Property name="FaktEKBestellung">
<Type>DBFaktEK.Bestellungskopf</Type>
<Cardinality>many</Cardinality>
<Inverse>Vertreter</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SD.VertreterD</DataLocation>
<DefaultData>VertreterDefaultData</DefaultData>
<IdLocation>^DBAdressen.SD.VertreterD</IdLocation>
<IndexLocation>^DBAdressen.SD.VertreterI</IndexLocation>
<StreamLocation>^DBAdressen.SD.VertreterS</StreamLocation>
<Data name="Beschreibung">
<Attribute>Beschreibung</Attribute>
<Structure>subnode</Structure>
<Subscript>"Beschreibung"</Subscript>
</Data>
<Data name="Name">
<Attribute>Name</Attribute>
<Structure>subnode</Structure>
<Subscript>"Name"</Subscript>
</Data>
<Data name="VertreterDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Code</Value>
</Value>
<Value name="3">
<Value>AktMandant</Value>
</Value>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="AktMandant">
</Property>
<Property name="Code">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.SD.Vorlage">
<Super>%Persistent,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40834.021355</TimeChanged>
<TimeCreated>61450,57738.238823</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Nummer">
<Type>%Library.Integer</Type>
<Required>1</Required>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
</Property>

<Index name="NummerIndex">
<Properties>AktMandant,Nummer</Properties>
<Unique>1</Unique>
</Index>

<Property name="Bezeichnung">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="DokumentTyp">
<Type>%Library.Integer</Type>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
</Property>

<Property name="DateiEndung">
<Type>%String</Type>
<Required>1</Required>
<Parameter name="MAXLEN" value="10"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="File">
<Type>DBAdressen.DokumentStream</Type>
<Cardinality>one</Cardinality>
<Inverse>Vorlage</Inverse>
<Relationship>1</Relationship>
</Property>

<Index name="FileIndex">
<Properties>File</Properties>
<Unique>1</Unique>
</Index>

<Property name="KorrTyp">
<Type>DBAdressen.SD.KorrTyp</Type>
<Cardinality>one</Cardinality>
<Inverse>Vorlage</Inverse>
<Relationship>1</Relationship>
</Property>

<Index name="KorrTypIndex">
<Properties>KorrTyp</Properties>
</Index>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="AktMandantIdx">
<Properties>AktMandant</Properties>
</Index>

<Method name="GetBezeichnung">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Bezeichnung, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetBezeichnungClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID '= "") {
		Set rs=##Class(DBAdressen.SD.Vorlage).%OpenId(myID)
		set text = rs.GetBezeichnung(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetBezeichnung">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Bezeichnung, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetNextFreeNumber">
<ClassMethod>1</ClassMethod>
<ReturnType>%Integer</ReturnType>
<Implementation><![CDATA[
	set nr = 0
	&sql(Select max(Nummer) into :nr From DBAdressen_SD.Vorlage)
	Quit +nr +1
]]></Implementation>
</Method>

<Method name="OutputStream">
<ReturnType>%Library.GlobalBinaryStream</ReturnType>
<Implementation><![CDATA[
	Set tmpStream=##class(%Library.GlobalBinaryStream).%New()
	Set f = ..File
	Set Ret=""
	If (f'="") {
		Set Size=f.DataStream.Size
		Set Ret=tmpStream.CopyFromAndSave(f.DataStream)
	}
	Quit tmpStream
]]></Implementation>
</Method>

<Method name="InputStream">
<FormalSpec>Stream:%Library.GlobalBinaryStream</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	Set res=0
	Set f = ..File
	Set sID = ""
	
		Set Cnt=0
		if (f'="") {
			&sql(SELECT count(*) As Cnt INTO :Cnt
		     	FROM DBAdressen.DokumentStream 
		     	WHERE ID = :f)
		}
		If (Cnt=0) {
			Set myId=..%Id()
			Set v=##Class(DBAdressen.SD.Vorlage).%OpenId(myId)
			Set n=##Class(DBAdressen.DokumentStream).%New()
			Set Ret=n.%Save()
			Set v.File=n
			Set Ret=v.%Save()
			if (Ret=1) {
				do n.DataStream.CopyFromAndSave(Stream)
				Set Ret=n.%Save()
			}
			Set n=""
			Set res=(Ret=1)
			Quit res
		}
		&sql(SELECT ID InTo :sID 
		     FROM DBAdressen.DokumentStream
		     WHERE ID = :f)
		     
		Set s=##Class(DBAdressen.DokumentStream).%OpenId(sID)
		Set Ret=s.DataStream.CopyFromAndSave(Stream)
		Set RetS = s.%Save()
		Set res=((Ret=1) && (RetS=1))
	
	Quit res
]]></Implementation>
</Method>

<Method name="GetVorlageOidByCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>VorlageNr:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	QUIT:(VorlageNr<0)
	Set oid = ""
	&sql(SELECT ID INTO :oid
		 FROM DBAdressen_SD.Vorlage
		 WHERE Nummer = :VorlageNr)
	Quit oid
]]></Implementation>
</Method>

<Method name="%OnDelete">
<Description><![CDATA[
This callback method is invoked by the <METHOD>%Delete</METHOD> method to 
provide notification that the object specified by <VAR>oid</VAR> is being deleted.

<P>If this method returns an error then the object will not be deleted.
[Previously private]]]></Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>oid:%ObjectIdentity</FormalSpec>
<ReturnType>%Status</ReturnType>
<ServerOnly>1</ServerOnly>
<Implementation><![CDATA[
	set reportOid = $lg(oid,1)
	set rep = ##class(DBAdressen.SD.Vorlage).%OpenId(reportOid)
	&sql(DELETE FROM DBAdressen.DokumentStream WHERE ID = :rep.File)
	set rep = ""	
	Quit $$$OK
]]></Implementation>
</Method>

<Trigger name="trgOnDelete">
<Code><![CDATA[	set myId = {ID*O}
	set fOld = {File*O}
	&sql(DELETE FROM DBAdressen.DokumentStream WHERE ID = :fOld)
	set rep = ""]]></Code>
<Event>DELETE</Event>
</Trigger>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SD.VorlageD</DataLocation>
<DefaultData>VorlageDefaultData</DefaultData>
<IdLocation>^DBAdressen.SD.VorlageD</IdLocation>
<IndexLocation>^DBAdressen.SD.VorlageI</IndexLocation>
<StreamLocation>^DBAdressen.SD.VorlageS</StreamLocation>
<Data name="Bezeichnung">
<Attribute>Bezeichnung</Attribute>
<Structure>subnode</Structure>
<Subscript>"Bezeichnung"</Subscript>
</Data>
<Data name="VorlageDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Nummer</Value>
</Value>
<Value name="3">
<Value>File</Value>
</Value>
<Value name="4">
<Value>AktMandant</Value>
</Value>
<Value name="5">
<Value>KorrTyp</Value>
</Value>
<Value name="6">
<Value>DokumentTyp</Value>
</Value>
<Value name="7">
<Value>DateiEndung</Value>
</Value>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="AktMandant">
</Property>
<Property name="DateiEndung">
</Property>
<Property name="DokumentTyp">
</Property>
<Property name="File">
</Property>
<Property name="KorrTyp">
</Property>
<Property name="Nummer">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.SD.ZAMultiSel">
<Super>DBAdressen.SD.ZASelektion</Super>
<TimeChanged>61920,49413.662936</TimeChanged>
<TimeCreated>61920,40730.728544</TimeCreated>

<Property name="ZusatzAdresse">
<Type>DBAdressen.MultiSelZA</Type>
<Cardinality>many</Cardinality>
<Inverse>MultiSel</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Method name="PosNrExists">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	
	set id = ""
	&sql(SELECT TOP 1 ID INTO :id FROM DBAdressen_SD.ZAMultiSel
	     WHERE Code = :Code AND AktMandant = :MandantOid)
	if (id = "") {
		Quit 0
	} else {
		Quit 1
	}
]]></Implementation>
</Method>

<Method name="GetIdByPosNrOnMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,PosNr:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[

	set id = ""
	&sql(SELECT ID INTO :id FROM DBAdressen_SD.ZAMultiSel
		 WHERE AktMandant = :MandantOid AND Code = :PosNr)
	Quit id
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
</Storage>
</Class>


<Class name="DBAdressen.SD.ZASelektion">
<Super>%Persistent,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40834.222595</TimeChanged>
<TimeCreated>61920,38783.638291</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Code">
<Type>%Library.Integer</Type>
<Required>1</Required>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
</Property>

<Property name="Kuerzel">
<Type>%String</Type>
<Parameter name="MAXLEN" value="2"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Text1">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Text2">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="AktMandantIdx">
<Properties>AktMandant</Properties>
</Index>

<Index name="CodeIndex">
<Properties>AktMandant,Code</Properties>
</Index>

<Method name="GetText1">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Text1, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetText1Class">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String="",Lang:%String=""</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID'="") {
		Set rs=##Class(DBAdressen.SD.ZASelektion).%OpenId(myID)
		set text = rs.GetText1(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetText1">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Text1, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetText2">
<FormalSpec>MandOid:%String="",Lang:%String=""</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Text2, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetText2Class">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID'="") {
		Set rs=##Class(DBAdressen.SD.ZASelektion).%OpenId(myID)
		set text = rs.GetText2(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetText2">
<FormalSpec>MandOid:%String="",Lang:%String="",Value:%String=""</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Text2, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SD.ZASelektionD</DataLocation>
<DefaultData>ZASelektionDefaultData</DefaultData>
<IdLocation>^DBAdressen.SD.ZASelektionD</IdLocation>
<IndexLocation>^DBAdressen.SD.ZASelektionI</IndexLocation>
<StreamLocation>^DBAdressen.SD.ZASelektionS</StreamLocation>
<Data name="Text1">
<Attribute>Text1</Attribute>
<Structure>subnode</Structure>
<Subscript>"Text1"</Subscript>
</Data>
<Data name="Text2">
<Attribute>Text2</Attribute>
<Structure>subnode</Structure>
<Subscript>"Text2"</Subscript>
</Data>
<Data name="ZASelektionDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Code</Value>
</Value>
<Value name="3">
<Value>AktMandant</Value>
</Value>
<Value name="4">
<Value>Kuerzel</Value>
</Value>
</Data>
<Property name="%%CLASSNAME">
</Property>
<Property name="AktMandant">
</Property>
<Property name="Code">
</Property>
<Property name="Kuerzel">
</Property>
</Storage>
</Class>


<Class name="DBAdressen.SD.ZASelektion1">
<Super>DBAdressen.SD.ZASelektion</Super>
<TimeChanged>61920,40584.55412</TimeChanged>
<TimeCreated>61920,38955.458855</TimeCreated>

<Property name="Zusatzadresse">
<Type>DBAdressen.ZusatzAdresse</Type>
<Cardinality>many</Cardinality>
<Inverse>ZASelektion1</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Method name="PosNrExists">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	
	set id = ""
	&sql(SELECT TOP 1 ID INTO :id FROM DBAdressen_SD.ZASelektion1
	     WHERE Code = :Code AND AktMandant = :MandantOid)
	if (id = "") {
		Quit 0
	} else {
		Quit 1
	}
]]></Implementation>
</Method>

<Method name="GetIdByPosNrOnMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,PosNr:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[

	set id = ""
	&sql(SELECT ID INTO :id FROM DBAdressen_SD.ZASelektion1
		 WHERE AktMandant = :MandantOid AND Code = :PosNr)
	Quit id
]]></Implementation>
</Method>

<Method name="RemoveSelByMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[
	
	&sql(DELETE FROM DBAdressen_SD.ZASelektion1 WHERE AktMandant = :MandantOid)
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
</Storage>
</Class>


<Class name="DBAdressen.SD.ZASelektion2">
<Super>DBAdressen.SD.ZASelektion</Super>
<TimeChanged>61920,40577.573502</TimeChanged>
<TimeCreated>61920,39003.920682</TimeCreated>

<Property name="Zusatzadresse">
<Type>DBAdressen.ZusatzAdresse</Type>
<Cardinality>many</Cardinality>
<Inverse>ZASelektion2</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Method name="PosNrExists">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	
	set id = ""
	&sql(SELECT TOP 1 ID INTO :id FROM DBAdressen_SD.ZASelektion2
	     WHERE Code = :Code AND AktMandant = :MandantOid)
	if (id = "") {
		Quit 0
	} else {
		Quit 1
	}
]]></Implementation>
</Method>

<Method name="GetIdByPosNrOnMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,PosNr:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[

	set id = ""
	&sql(SELECT ID INTO :id FROM DBAdressen_SD.ZASelektion2
		 WHERE AktMandant = :MandantOid AND Code = :PosNr)
	Quit id
]]></Implementation>
</Method>

<Method name="RemoveSelByMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[
	
	&sql(DELETE FROM DBAdressen_SD.ZASelektion2 WHERE AktMandant = :MandantOid)
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
</Storage>
</Class>


<Class name="DBAdressen.SD.ZASelektion3">
<Super>DBAdressen.SD.ZASelektion</Super>
<TimeChanged>61920,40575.970434</TimeChanged>
<TimeCreated>61920,39072.220181</TimeCreated>

<Property name="Zusatzadresse">
<Type>DBAdressen.ZusatzAdresse</Type>
<Cardinality>many</Cardinality>
<Inverse>ZASelektion3</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Method name="PosNrExists">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,Code:%Integer</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	
	set id = ""
	&sql(SELECT TOP 1 ID INTO :id FROM DBAdressen_SD.ZASelektion3
	     WHERE Code = :Code AND AktMandant = :MandantOid)
	if (id = "") {
		Quit 0
	} else {
		Quit 1
	}
]]></Implementation>
</Method>

<Method name="GetIdByPosNrOnMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String,PosNr:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[

	set id = ""
	&sql(SELECT ID INTO :id FROM DBAdressen_SD.ZASelektion3
		 WHERE AktMandant = :MandantOid AND Code = :PosNr)
	Quit id
]]></Implementation>
</Method>

<Method name="RemoveSelByMandant">
<ClassMethod>1</ClassMethod>
<FormalSpec>MandantOid:%String</FormalSpec>
<Implementation><![CDATA[
	
	&sql(DELETE FROM DBAdressen_SD.ZASelektion3 WHERE AktMandant = :MandantOid)
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
</Storage>
</Class>


<Class name="DBAdressen.SearchDouble">
<Super>%Persistent</Super>
<TimeChanged>62438,40801.760423</TimeChanged>
<TimeCreated>61184,24955.166108</TimeCreated>

<UDLText name="T">
<Content><![CDATA[
// Gruppen-Nummer aller identischen gefunden Doubletten

]]></Content>
</UDLText>

<Property name="GroupNo">
<Type>%Integer</Type>
</Property>

<UDLText name="T">
<Content><![CDATA[
// ID der gefundenen doppelten Adresse

]]></Content>
</UDLText>

<Property name="FoundID">
<Type>%Integer</Type>
</Property>

<UDLText name="T">
<Content><![CDATA[
// ID der importierten Adresse

]]></Content>
</UDLText>

<Property name="SearchID">
<Type>%Integer</Type>
</Property>

<UDLText name="T">
<Content><![CDATA[
// Flag zum merken, ob schon vom Programm verarbeitet

]]></Content>
</UDLText>

<Property name="Finished">
<Type>%Boolean</Type>
<InitialExpression>0</InitialExpression>
</Property>

<Index name="idxGroupNo">
<Type>bitmap</Type>
<Properties>GroupNo</Properties>
</Index>

<Index name="idxFoundID">
<Type>bitmap</Type>
<Properties>FoundID</Properties>
</Index>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SearchDoubleD</DataLocation>
<DefaultData>SearchDoubleDefaultData</DefaultData>
<IdLocation>^DBAdressen.SearchDoubleD</IdLocation>
<IndexLocation>^DBAdressen.SearchDoubleI</IndexLocation>
<StreamLocation>^DBAdressen.SearchDoubleS</StreamLocation>
<Data name="SearchDoubleDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>GroupNo</Value>
</Value>
<Value name="3">
<Value>FoundID</Value>
</Value>
<Value name="4">
<Value>SearchID</Value>
</Value>
<Value name="5">
<Value>Finished</Value>
</Value>
</Data>
</Storage>
</Class>


<Class name="DBAdressen.Serienbrief">
<Super>%Persistent,%XML.Adaptor,DBCore.MandantRel</Super>
<TimeChanged>62438,40834.269345</TimeChanged>
<TimeCreated>62348,60001.405575</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Nummer">
<Type>%Library.Integer</Type>
<Required>1</Required>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
</Property>

<Index name="NummerIndex">
<Properties>AktMandant,Nummer</Properties>
<Unique>1</Unique>
</Index>

<Property name="Bezeichnung">
<Type>%String</Type>
<Collection>array</Collection>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="DokumentTyp">
<Type>%Library.Integer</Type>
<Parameter name="MAXVAL" value="999"/>
<Parameter name="MINVAL" value="1"/>
</Property>

<Property name="DateiEndung">
<Type>%String</Type>
<Required>1</Required>
<Parameter name="MAXLEN" value="10"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="File">
<Type>DBAdressen.DokumentStream</Type>
<Cardinality>one</Cardinality>
<Inverse>Serienbrief</Inverse>
<Relationship>1</Relationship>
</Property>

<Index name="FileIndex">
<Properties>File</Properties>
<Unique>1</Unique>
</Index>

<Property name="KorrTyp">
<Type>DBAdressen.SD.KorrTyp</Type>
<Cardinality>one</Cardinality>
<Inverse>Serienbrief</Inverse>
<Relationship>1</Relationship>
</Property>

<Index name="KorrTypIndex">
<Properties>KorrTyp</Properties>
</Index>

<Property name="AktMandant">
<Type>%String</Type>
</Property>

<ForeignKey name="FKAktMandant">
<Properties>AktMandant</Properties>
<ReferencedClass>DBCore.Mandant</ReferencedClass>
<ReferencedKey>MandIdIndex</ReferencedKey>
</ForeignKey>

<Index name="AktMandantIdx">
<Properties>AktMandant</Properties>
</Index>

<Property name="Korrespondenz">
<Type>DBAdressen.Korrespondenz</Type>
<Cardinality>many</Cardinality>
<Inverse>Serienbrief</Inverse>
<Relationship>1</Relationship>
</Property>

<Method name="GetBezeichnung">
<FormalSpec>MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[	Quit ##Class(DBUtils.StringUtils).GetText(..Bezeichnung, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetBezeichnungClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>myID:%String,MandOid:%String,Lang:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set text = ""
	if (myID '= "") {
		Set rs=##Class(DBAdressen.Serienbrief).%OpenId(myID)
		set text = rs.GetBezeichnung(MandOid, Lang)
	}
	Quit text
]]></Implementation>
</Method>

<Method name="SetBezeichnung">
<FormalSpec>MandOid:%String,Lang:%String,Value:%String</FormalSpec>
<Implementation><![CDATA[	Do ##class(DBUtils.StringUtils).SetText(..Bezeichnung, Value, Lang, MandOid)
]]></Implementation>
</Method>

<Method name="GetNextFreeNumber">
<ClassMethod>1</ClassMethod>
<ReturnType>%Integer</ReturnType>
<Implementation><![CDATA[
	set nr = 0
	&sql(Select max(Nummer) into :nr From DBAdressen.Serienbrief)
	Quit +nr +1
]]></Implementation>
</Method>

<Method name="OutputStream">
<ReturnType>%Library.GlobalBinaryStream</ReturnType>
<Implementation><![CDATA[
	Set tmpStream=##class(%Library.GlobalBinaryStream).%New()
	Set f = ..File
	Set Ret=""
	If (f'="") {
		Set Size=f.DataStream.Size
		Set Ret=tmpStream.CopyFromAndSave(f.DataStream)
	}
	Quit tmpStream
]]></Implementation>
</Method>

<Method name="InputStream">
<FormalSpec>Stream:%Library.GlobalBinaryStream</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	Set res=0
	Set f = ..File
	Set sID = ""
	
	Set Cnt=0
	if (f = "") {
		Set myId=..%Id()
		Set brief=##Class(DBAdressen.Serienbrief).%OpenId(myId)
		Set stream=##Class(DBAdressen.DokumentStream).%New()
		Set Ret=stream.%Save()
		Set brief.File=stream
		Set Ret=brief.%Save()
		if (Ret=1) {
			do stream.DataStream.CopyFromAndSave(Stream)
			Set Ret=stream.%Save()
		}
		Set stream=""
		Set res=(Ret=1)
		Quit res
	} else {
		Set Ret= f.DataStream.CopyFromAndSave(Stream)
		Set RetS = f.%Save()
		Set res=((Ret=1) && (RetS=1))
		Quit res
	}
]]></Implementation>
</Method>

<Method name="GetSerienBriefOidByCode">
<ClassMethod>1</ClassMethod>
<FormalSpec>Nummer:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	QUIT:(VorlageNr<0)
	Set oid = ""
	&sql(SELECT ID INTO :oid
		 FROM DBAdressen.Serienbrief
		 WHERE Nummer = :Nummer)
	Quit oid
]]></Implementation>
</Method>

<Method name="%OnDelete">
<Description><![CDATA[
This callback method is invoked by the <METHOD>%Delete</METHOD> method to 
provide notification that the object specified by <VAR>oid</VAR> is being deleted.

<P>If this method returns an error then the object will not be deleted.
[Previously private]]]></Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>oid:%ObjectIdentity</FormalSpec>
<ReturnType>%Status</ReturnType>
<ServerOnly>1</ServerOnly>
<Implementation><![CDATA[
		set reportOid = $lg(oid,1)
		set rep = ##class(DBAdressen.Serienbrief).%OpenId(reportOid)
		if (rep.File '= "") {
			set fileOid = rep.File.%Id()
			Set ^SerienbriefFileOid(reportOid) = fileOid
		}
		kill rep
		Quit $$$OK
]]></Implementation>
</Method>

<Trigger name="trgOnDelete">
<Code>	new myId 
	new fOld
	set myId = {ID*O}
	set fOld = {File*O}
	Set ^SerienbriefFileOid(myId) = fOld</Code>
<Event>DELETE</Event>
</Trigger>

<Method name="%OnAfterDelete">
<Description><![CDATA[
This callback method is invoked by the <METHOD>%Delete</METHOD> method to 
provide notification that the object specified by <VAR>oid</VAR> has been deleted.
The callback occurs immediately after %DeleteData has been called. If %DeleteData returns
an error then %OnAfterDelete is not called.

<P>If %OnAfterDelete returns an error (%Status) then the transaction is rolled back.
[Previously private]]]></Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>oid:%ObjectIdentity</FormalSpec>
<ReturnType>%Status</ReturnType>
<ServerOnly>1</ServerOnly>
<Implementation><![CDATA[
	Set oldFileOid = $GET(^SerienbriefFileOid($lg(oid,1)),"")
	if (oldFileOid'="") {
		KILL ^SerienbriefFileOid($lg(oid,1))
		set status = ##Class(DBAdressen.DokumentStream).%DeleteId(oldFileOid)
	}
	Quit $$$OK
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.SerienbriefD</DataLocation>
<DefaultData>SerienbriefDefaultData</DefaultData>
<IdLocation>^DBAdressen.SerienbriefD</IdLocation>
<IndexLocation>^DBAdressen.SerienbriefI</IndexLocation>
<StreamLocation>^DBAdressen.SerienbriefS</StreamLocation>
<Data name="Bezeichnung">
<Attribute>Bezeichnung</Attribute>
<Structure>subnode</Structure>
<Subscript>"Bezeichnung"</Subscript>
</Data>
<Data name="SerienbriefDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Nummer</Value>
</Value>
<Value name="3">
<Value>DokumentTyp</Value>
</Value>
<Value name="4">
<Value>DateiEndung</Value>
</Value>
<Value name="5">
<Value>File</Value>
</Value>
<Value name="6">
<Value>KorrTyp</Value>
</Value>
<Value name="7">
<Value>AktMandant</Value>
</Value>
</Data>
<Property name="AktMandant"/>
<Property name="DateiEndung"/>
<Property name="DokumentTyp"/>
<Property name="File"/>
<Property name="KorrTyp"/>
<Property name="Nummer"/>
</Storage>
</Class>


<Class name="DBAdressen.Soundex">
<Super>%RegisteredObject</Super>
<TimeChanged>61669,28240</TimeChanged>
<TimeCreated>61163,38809.271243</TimeCreated>

<Method name="GetDoubleMetaphone">
<Description>
------------------------------------------------------------------------------------- 
	Implements the Double Metaphone phonetic matching algorithm published
    by Lawrence Phillips in June 2000 C/C++ Users Journal. 

    Optimized and ported to CachÃ© by Tilo Schinke (tilo.schinke@intersystems.com)
------------------------------------------------------------------------------------- </Description>
<ClassMethod>1</ClassMethod>
<FormalSpec><![CDATA[myWord:%String="",&Secondary:%String,&HasAlternate:%Boolean]]></FormalSpec>
<ReturnType>%String</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
		// The length of the metaphone keys produced.  
		// (4 is sweet spot)
		S mLen = 4
		// The Prefix "^||" means the Variable is a "process-private Global"
		S ^||pKeyStr="",^||aKeyStr=""
		S ^||pKeyLen=0, ^||aKeyLen=0
		S ^||hasAlternate=0
		// Convert to upper case, since metaphone is not case sensitive
		// ... Padd with four spaces, so word can be over-indexed without fear of exception
		S Word=$ZCVT(myWord,"U")_"    "
		// translate diacritic letters
    S Word=$Replace(Word,"Ã„","AE"),Word=$Replace(Word,"Ã–","OE")
		S Word=$Replace(Word,"Ãœ","UE"),Word=$Replace(Word,"Ãˆ", "E")
		S Word=$Replace(Word,"Ã‰", "E"),Word=$Replace(Word,"ÃŠ", "E")
		S Word=$Replace(Word,"Ã‹", "E"),Word=$Replace(Word,"Ã†", "E")
		S Word=$Replace(Word,"Ã€", "A"),Word=$Replace(Word,"Ã?", "A")
		S Word=$Replace(Word,"Ã‚", "A"),Word=$Replace(Word,"Ãƒ", "A")
		S Word=$Replace(Word,"Ã…", "A"),Word=$Replace(Word,"ÃŒ", "I")
		S Word=$Replace(Word,"Ã?", "I"),Word=$Replace(Word,"ÃŽ", "I")
		S Word=$Replace(Word,"Ã?", "I"),Word=$Replace(Word,"Ã�?", "O")
		S Word=$Replace(Word,"Ã’", "O"),Word=$Replace(Word,"Ã“", "O")
		S Word=$Replace(Word,"Ã•", "O"),Word=$Replace(Word,"Ã™", "U")
		S Word=$Replace(Word,"Ãš", "U"),Word=$Replace(Word,"Ã›", "U")
		S Word=$Replace(Word,"Ã?", "Y"),Word=$Replace(Word,"Ã‘", "N")
		S Word=$Replace(Word,"Ã?","DJ")
		S wLen=$L(Word)
		If wLen'<1 {
			// Define posible vowels
			S Vowel="AEIOUY"
			// skip these when at start of word
			S Cnt=$Case($E(Word,1,2),"GN":2,"KN":2,"PN":2,"WR":2,"PS":2,:1)
			// Initial "X" is pronounced "Z" e.g. "XAVIER" (Z maps to S)
			If $E(Word)="X" {
				D ..AddStr("S")
				S Cnt=Cnt+1
			}
			// ========== main loop ============================
			While ((^||pKeyLen<mLen)||(^||aKeyLen<mLen))&&(Cnt<=wLen) {
				S Chr=$E(Word,Cnt)
				S Chr2=" "
				S:Cnt<=wLen Chr2=$E(Word,Cnt+1)
				If (Chr=" ") {
					S Cnt=Cnt+1
					Continue
				}
				If (Vowel[Chr) {
					If (Cnt=1) {
						D ..AddStr("A") // all init vowels now map to "A"
						S Cnt=Cnt+1
						Continue
					} Else {
						S Cnt=Cnt+1
						Continue
					}
				} 
				If Chr="B" {
					// "...MB", e.g "DUMB", already skipped over...
					D ..AddCnt(Chr,Chr2,"P",.Cnt)
					Continue
				}
				If Chr="Ã‡" {
					D ..AddStr("S")
					S Cnt=Cnt+1
					Continue
				}
				If Chr="C" {
					If (Cnt>2)&&
					   ('(Vowel[$E(Word,Cnt-2)))&&
					   (..Mid(Word,Cnt-1,3)="ACH")&&
					   (($E(Word,Cnt+2)'="I")&&
					    (($E(Word,Cnt+2)'="E")||
					     (..MidList(Word,Cnt-2,6,"BACHER,MACHER")))) 
					{
						// various germanic
						D ..AddStr("K")
						S Cnt=Cnt+2
						Continue
					}
					// special case "CEASAR"
					If (Cnt=1)&&(..Mid(Word,Cnt,6)="CAESAR") {
						D ..AddStr("S")
						S Cnt=Cnt+2
						Continue
					}
					// italian "CHIANTI"
					If (..Mid(Word,Cnt,4)="CHIA") {
						D ..AddStr("K")
						S Cnt=Cnt+2
						Continue
					} 
					If (Chr2="H") {
						// find "MICHAEL"
						If (Cnt>1)&&(..Mid(Word,Cnt,4)="CHAE") {
							D ..AddStr("K","X")
							S Cnt=Cnt+2
							Continue
						}
						// greek roots e.g. "CHEMISTRY", "CHORUS"
						If ( (Cnt=1)&&
						     ( (..MidList(Word,Cnt+1,5,"HARAC,HARIS"))||
						       (..MidList(Word,Cnt+1,3,"HOR,HYM,HIA,HEM")) )&&
						     ('(..Mid(Word,1,5)="CHORE")) )
						{
							D ..AddStr("K")
							S Cnt=Cnt+2
							Continue
						}
						// germanic, greek, or otherwise "CH" for "KH" sound
						If ((..MidList(Word,1,4,"VAN ,VON "))||(..Mid(Word,1,3)="SCH"))||
	 					   (..MidList(Word,Cnt-2,6,"ORCHES,ARCHIT,ORCHID"))||
						   ("TS"[$E(Word,Cnt+2))||
						   ( (("AOUE"[$E(Word,Cnt-1))||(Cnt=1))&&
						     // e.g. "WACHTLER", "WECHSLER", but not "TICHNER"
						     ("LRNMBHFVW "[$E(Word,Cnt+2)) )
						{
							D ..AddStr("K")
						} Else {
							If (Cnt>1) {
								If ($E("Word",1,2)="MC") {
									//e.g. "McHUGH"
									D ..AddStr("K")
								} Else {
									D ..AddStr("K","X")
								}
							} Else {
								D ..AddStr("X")
							}
						}
						S Cnt=Cnt+2
						Continue
					} 
				    // e.g, "CZERNY"
					If (Chr2="Z")&&(..Mid(Word,Cnt-2,4)'="WICZ") {
						D ..AddStr("S","X")
						S Cnt=Cnt+2
						Continue
					} 
					//e.g., "FOCACCIA"
					If (..Mid(Word,Cnt,3)="CIA") {
						D ..AddStr("X")
						S Cnt=Cnt+2
						Continue
					}
					// double "C", but not If e.g. "McCLELLAN"
					If (Chr2="C")&&('((Cnt=2)&&($E(Word)="M"))) {
						//"BELLOCCHIO" but not "BACCHUS"
						If (("IEH "[$E(Word,Cnt+2))&&('(..Mid(Word,Cnt+2,2)="HU"))) {
							// "ACCIDENT", "ACCEDE" "SUCCEED"
							If ((Cnt=2)&&($E(Word,Cnt-1)="A"))||
							   (..MidList(Word,Cnt-1,5,"UCCEE,UCCES")) {
								D ..AddStr("KS")
							// "BACCI", "BERTUCCI", other italian
							} Else { 
								D ..AddStr("X")
							}
							S Cnt=Cnt+3
						} Else { // Pierce's rule
							D ..AddStr("K")
							S Cnt=Cnt+2
						}
						Continue
					} 
					If ("KGQ"[Chr2) {
						D ..AddStr("K")
						S Cnt=Cnt+2
						Continue
					} 
					If ("IEY"[Chr2) {
						// italian vs. english
						If (..MidList(Word,Cnt,3,"CI0,CIE,CIA")) {
							D ..AddStr("S","X")
						} Else {
							D ..AddStr("S")
						}
						S Cnt=Cnt+2
						Continue
					} 
					D ..AddStr("K")
					// name sent in "MAC CAFFREY", "MAC GREGOR"
					If (..MidList(Word,Cnt+1,2," C, G, Q")) {
						S Cnt=Cnt+3
					} Else {
						S Cnt=Cnt+1
						S:("CKQ"[Chr2)&&('(..MidList(Word,Cnt+1,2,"CE,CI"))) Cnt=Cnt+1
					}
					Continue
				// End:ElseIf Chr="C"
				} 
				If Chr="D" {
					If (Chr2="G") {
						If ("IEY"[$E(Word,Cnt+2)) {
							D ..AddStr("S")
							S Cnt=Cnt+3
						} Else {
							D ..AddStr("TK")
							S Cnt=Cnt+2
						}
						Continue
					} 
					D ..AddStr("T")
					S Cnt=Cnt+1
					S:("DT"[Chr2) Cnt=Cnt+1
					Continue
				} 
				If Chr="F" {
					D ..AddCnt(Chr,Chr2,"F",.Cnt)
					Continue
				} 
				If Chr="G" {
					If ((Chr2="H")) {
						If (Cnt>1)&&('(Vowel[$E(Word,Cnt-1))) {
							D ..AddStr("F")
							S Cnt=Cnt+2
							Continue
						} 
						If (Cnt<4) {
							//"GHISLANE", "GHIRADELLI"
							If (Cnt=1) {
								If ($E(Word,Cnt+2)="I") {
									D ..AddStr("J")
								} Else {
									D ..AddStr("K")
								}
								S Cnt=Cnt+2
								Continue
							}
						}
						// Parker's rule (with some further refinements) - e.g. "HUGH"
						If ((Cnt>2)&&("BHD"[$E(Word,Cnt-2)))||
						   ((Cnt>3)&&("BHD"[$E(Word,Cnt-3)))||
						   ((Cnt>4)&&("BH"[$E(Word,Cnt-4))) { 
							S Cnt=Cnt+2
						} Else {
							// e.g. "LAUGH", "McLAUGHLIN", "COUGH", "GOUGH", "ROUGH", "TOUGH"
							If (Cnt>3)&&($E(Word,Cnt-1)="U")&&("CGLRT"[$E(Word,Cnt-3)) {
								D ..AddStr("F")
							} Else {
								D:(Cnt>1)&&($E(Word,Cnt+2)'="I") ..AddStr("K")
							}
							S Cnt=Cnt+2
						}
						Continue
					} 
					If ((Chr2="N")) {
						If (Cnt=2)&&(Vowel[$E(Word))&&('(..isSlGe(Word))) {
							D ..AddStr("KN","N")
						} Else {
							//not e.g. "CAGNEY"
							If (..Mid(Word,Cnt+2,2)="EY")&&
							   ('(Chr2="Y"))&&('(..isSlGe(Word))) 
							{ 
								D ..AddStr("N","KN")
							} Else {
								D ..AddStr("KN")
							}
						}
						S Cnt=Cnt+2
						Continue
					}
					// "TAGLIARO" 
					If (..Mid(Word,Cnt+1,2)="LI")&&('(..isSlGe(Word))) {
						D ..AddStr("KL","L")
						S Cnt=Cnt+2
						Continue
					}
					// "GES", "GEP", "GEL", "GIE" at beginning
					If ((Cnt=1)&&
			            ((Chr2="Y"))||
			             (..MidList(Word,Cnt+1,2,"ES,EP,EB,EL,EY,IB,IL,IN,IE,EI,ER"))) { 
						D ..AddStr("K","J")
						S Cnt=Cnt+2
						Continue
					}
					// "GER", "GY"
					If ( ((..Mid(Word,Cnt+1,2)="ER")||(Chr2="Y"))&&
					     ('(..MidList(Word,1,6,"DANGER,RANGER,MANGER")))&&
					     ('(..MidList(Word,Cnt-1,1,"E,I")))&&
					     ('(..MidList(Word,Cnt-1,3,"RGY,OGY")))) { 
							D ..AddStr("K","J")
							S Cnt=Cnt+2
							Continue
					}
					// italian e.g, "BIAGGI"
					If (("EIY"[Chr2)||(..MidList(Word,Cnt-1,4,"AGGI,OGGI"))) { 
						// obvious germanic
						If ((..MidList(Word,1,4,"VAN ,VON "))||
						    (..Mid(Word,1,3)="SCH")||
							(..Mid(Word,Cnt+1,2)="ET"))
						{
							D ..AddStr("K")
						} Else {
							// always soft if french ending
							If (..Mid(Word,Cnt+1,4)="IER ") {
								D ..AddStr("J")
							} Else {
								D ..AddStr("J","K")
							}
						}
						S Cnt=Cnt+2
						Continue
					}
					D ..AddStr("K")
					S Cnt=Cnt+1
					S:(Chr2="G") Cnt=Cnt+1
					Continue
				// End:ElseIf Chr="G"
				} 
				If Chr="H" {
					// only keep if first & before vowel or btw. 2 vowels
					If ((Cnt=1)||(Vowel[$E(Word,Cnt-1)))&&(Vowel[Chr2) {
						D ..AddStr("H")
						S Cnt=Cnt+1
					}
					S Cnt=Cnt+1
					Continue
				} 
				If Chr="J" {
					// obvious spanish, "JOSE", "SAN JACINTO"
					If ((..Mid(Word,Cnt,4)="JOSE")||(..Mid(Word,1,4)="SAN ")) {
						If (((Cnt=1)&&(Chr2=" ")))||(..Mid(Word,1,4)="SAN ") {
							D ..AddStr("H")
						} Else {
							D ..AddStr("J","H")
						}
						S Cnt=Cnt+1
						Continue
					} 
					If ((Cnt=1)&&('(..Mid(Word,Cnt,4)="JOSE"))) {
						// "YAKELOVICH", "JANKELOWICZ"
	                    D ..AddStr("J","A")
	                } Else {
	                    // spanish pron. of e.g. "BAJADOR"
	                    If Vowel[$E(Word,Cnt-1)&&('(..isSlGe(Word)))&&
	                       ("AO"[Chr2)
	                    {
	                        D ..AddStr("J","H")
	                    } Else {
	                        If (Cnt=wLen) {
	                            D ..AddStr("J"," ")
	                        } Else {
	                            If ('("LTKSNMBZ"[Chr2))&&('("SKL"[$E(Word,Cnt-1))) {
	                                D ..AddStr("J")
	                            }
	                        }
	                    }
		                S Cnt=Cnt+1
		                S:Chr2="J" Cnt=Cnt+1
	                }
	                Continue
				// End:ElseIf Chr="J"
				} 
				If Chr="K" {
					D ..AddCnt(Chr,Chr2,"K",.Cnt)
					Continue
				} 
				If Chr="L" {
					If (Chr2="L") {
						//spanish e.g. "CABRILLO","GALLEGOS"
						If ((Cnt=(wLen-3))&&(..MidList(Word,Cnt-1,4,"ILLO,ILLA,ALLE")))||
							(((..MidList(Word,wLen-1,2, "AS,OS"))||("AO"[Chr2))&&
							 (..Mid(Word,(Cnt-1),4)="ALLE"))
						{
							D ..AddStr("L"," ")
							S Cnt=Cnt+2
							Continue
						}
						S Cnt=Cnt+2
					} Else {
						S Cnt=Cnt+1
					}
					D ..AddStr("L")
					Continue
				}
				If Chr="M" {
					S Cnt=Cnt+1
					If ((..Mid(Word,Cnt-2,3)="UMB")&& 
						((Cnt=wLen)||(..Mid(Word,Cnt+1,2)="ER"))||
						//"DUMB","THUMB"
						(Chr2="M"))
					{
						S Cnt=Cnt+1
					}
					D ..AddStr("M")
					Continue
				}
				If "Ã‘N"[Chr {
					D ..AddCnt(Chr,Chr2,"N",.Cnt)
					Continue
				}
				If Chr="P" {
					S Cnt=Cnt+1
					If (Chr2="H") {
						D ..AddStr("F")
						S Cnt=Cnt+1
						Continue
					}
					S:("PB"[Chr2) Cnt=Cnt+1
					D ..AddStr("P")
					Continue
				} 
				If Chr="Q" {
					D ..AddCnt(Chr,Chr2,"K",.Cnt)
					Continue
				} 
				If Chr="R" {
					If ((Cnt=wLen)&& 
					    ('(..isSlGe(Word)))&&
						(..Mid(Word,Cnt-2,2)="IE")&&
						('(..MidList(Word,Cnt-4,2,"ME,MA")))) 
					{
						D ..AddStr("","R")
					} Else {
						D ..AddStr("R")
					}
					S Cnt=Cnt+1
					S:(Chr2="R") Cnt=Cnt+1
					Continue
				} 
				If Chr="S" {
					// special cases "ISLAND", "ISLE", "CARLISLE", "CARLYSLE"
					If (..MidList(Word,Cnt-1,3,"ISL,YSL")) {
						S Cnt=Cnt+1
						Continue
					} 
					// special case "SUGAR"
					If (Cnt=1)&&(..Mid(Word,Cnt,5)="SUGAR") {
						D ..AddStr("X","S")
						S Cnt=Cnt+1
						Continue
					} 
					If (Chr2="H") {
						// germanic
						If (..MidList(Word,Cnt+1,4,"HEIM,HOEK,HOLM,HOLZ")) {
							D ..AddStr("S")
						} Else {
							D ..AddStr("X")
						}
						S Cnt=Cnt+2
						Continue
					} 
					// italian & armenian
					If (..MidList(Word,Cnt,3,"SIO,SIA"))||(..Mid(Word,Cnt,4)="SIAN") {
						If ..isSlGe(Word) {
							D ..AddStr("S")
						} Else {
							D ..AddStr("S","X")
						}
						S Cnt=Cnt+3
						Continue
					} 
					// german & anglicisations
					// e.g. "SMITH" match "SCHMIDT", "SNIDER" match "SCHNEIDER"
					// also, "SZ" in slavic language altho in hungarian 
					// it is pronounced "S"
					If (((Cnt=1)&&("MNLW"[Chr2))||
					    (Chr2="Z")) {
						D ..AddStr("S","X")
						S Cnt=Cnt+1
						S:(Chr2="Z") Cnt=Cnt+1
						Continue
					}
					If ((..Mid(Word,Cnt,2)="SC")) {
						// Schlesinger's rule
						If ($E(Word,Cnt+2)="H") {
							// dutch origin, e.g. "SCHOOL", "SCHOONER"
							If (..MidList(Word,Cnt+3,2,"OO,ER,EN,UY,ED,EM")) {
								// "SCHERMERHORN", "SCHENKER"
								If (..MidList(Word,Cnt+3,2,"ER,EN")) {
									D ..AddStr("X","SK")
								} Else {
									D ..AddStr("SK")
								}
							} Else {
								If ((Cnt=1)&&('(Vowel[$E(Word,4)))&&($E(Word,4)'="W")) {
									D ..AddStr("X","S")
								} Else {
									D ..AddStr("X")
								}
							}
							S Cnt=Cnt+3
							Continue
						} 
						If ("IEY"[$E(Word,Cnt+2)) {
							D ..AddStr("S")
						} Else {
							//Else
							D ..AddStr("SK")
						}					
						S Cnt=Cnt+3
						Continue
					} 
					If (Cnt=wLen)&&(..MidList(Word,Cnt-2,2,"AI,OI")) 
					{ // french e.g. "resnais", "artois"
						D ..AddStr("","S")
					} Else {
						D ..AddStr("S")
					}
					S Cnt=Cnt+1
					S:"SZ"[Chr2 Cnt=Cnt+1
					Continue
				// End:ElseIf Chr="S"
				} 
				If Chr="T" {
					If (..Mid(Word,Cnt,4)="TION")||
					   (..MidList(Word,Cnt,3,"TIA,TCH"))
					{
						D ..AddStr("X")
						S Cnt=Cnt+3
						Continue
					}
					If (Chr2="H")||(..Mid(Word,Cnt,3)="TTH") { 
						// special case "THOMAS", "THAMES" or germanic
						If (..MidList(Word,Cnt+2,2,"OM,AM"))||
						   (..MidList(Word,1,4,"VAN ,VON "))||
						   (..Mid(Word,1,3)="SCH") {
							D ..AddStr("T")
						} Else {
							D ..AddStr("O","T")
						}
						S Cnt=Cnt+2
						Continue
					} 
					D ..AddStr("T")
					S Cnt=Cnt+1
					S:"TD"[Chr2 Cnt=Cnt+1
					Continue
				// End:ElseIf Chr="T"
				} 
				If Chr="V" {
					D ..AddCnt(Chr,Chr2,"F",.Cnt)
					Continue
				} 
				If Chr="W" {
					// can also be in middle of word
					If (Chr2="R") {
						D ..AddStr("R")
						S Cnt=Cnt+2
						Continue
					} 
					If (Cnt=1)&&
					   ((Vowel[Chr2)||
				        (Chr2="H"))
					{ // "WASSERMANN" should match "VASSERMAN"
						If (Vowel[Chr2) {
							D ..AddStr("A","F")
						} Else {
							D ..AddStr("A")
						}
					} 
					If ((Cnt=wLen)&&(Vowel[$E(Word,Cnt-1)))||
					    (..MidList(Word,Cnt-1,5,"EWSKI,EWSKY,OWSKI,OWSKY"))||
					    (..Mid(Word,1,3)="SCH")
					{
						D ..AddStr("","F")
						S Cnt=Cnt+1
						Continue
					} 
					If (..MidList(Word,Cnt,4,"WICZ,WITZ")) {
						D ..AddStr("TS","FX")
						S Cnt=Cnt+4
						Continue
					} 
					// Else skip it
					S Cnt=Cnt+1
					Continue
				} 
				If Chr="X" {
					// french e.g. "BREAUX"
					If ('((Cnt=wLen)&&
					      ((..MidList(Word,Cnt-3,3,"IAU,EAU"))||
					       (..MidList(Word,Cnt-2,2,"AU,OU"))) )) 
					{
						D ..AddStr("KS")
					}
					S Cnt=Cnt+1
					S:"CX"[Chr2 Cnt=Cnt+1
					Continue
				} 
				If Chr="Z" {
					If (Chr2="H") {
						D ..AddStr("J")
						S Cnt=Cnt+2
						Continue
					} Else {
						If (..MidList(Word,Cnt+1,2,"ZO,ZI,ZA"))||
						   ((..isSlGe(Word))&&(Cnt>1)&&($E(Word,Cnt-1)'="T")) {
							D ..AddStr("S","TS")
						} Else {
							D ..AddStr("S")
						}
					}
					S Cnt=Cnt+1
					S:Chr2="Z" Cnt=Cnt+1
					Continue
				}
				S Cnt=Cnt+1
			}
		}
		S ^||pKeyStr=$E(^||pKeyStr_"0000",1,mLen)
		S ^||aKeyStr=$E(^||aKeyStr_"0000",1,mLen)
		S Secondary=^||aKeyStr
		S HasAlternate=^||hasAlternate
		Q ^||pKeyStr
]]></Implementation>
</Method>

<Method name="AddStr">
<Description>
Help routine for ClassMethod GetDoubleMetaphone
Appends a metaphone character to the primary, and a possibly different alternate,
metaphone keys for the word.

primaryCharacter
    Primary character to append to primary key, and, If no alternate char is present,
    the alternate key as well
alternateCharacter
    Alternate character to append to alternate key.  May be null or a zero-length string,
    in which case the primary character will be appended to the alternate key instead
[Previously private]</Description>
<Final>1</Final>
<ClassMethod>1</ClassMethod>
<FormalSpec>pChr:%String="",aChr:%String=""</FormalSpec>
<Implementation><![CDATA[
		S pLen=$L(pChr)
		S aLen=$L(aChr)
		If (pLen>0) {
			S ^||pKeyStr=^||pKeyStr_pChr
			S ^||pKeyLen=^||pKeyLen+pLen
		}
		If (aLen>0) {
			S ^||hasAlternate=1
			If $E(aChr)=" " {
				S ^||aKeyStr=^||aKeyStr_pChr
				S ^||aKeyLen=^||aKeyLen+pLen
			} Else {
				S ^||aKeyStr=^||aKeyStr_aChr
				S ^||aKeyLen=^||aKeyLen+aLen
			}
		} ElseIf (pLen>0) {
			S ^||aKeyStr=^||aKeyStr_pChr
			S ^||aKeyLen=^||aKeyLen+pLen
		}
]]></Implementation>
</Method>

<Method name="isSlGe">
<Description>
Help routine for ClassMethod GetDoubleMetaphone
Returns true If m_word is classified as "slavo-germanic" by Phillips' algorithm

@return true If word contains strings that Lawrence's algorithm considers indicative of
        slavo-germanic origin; Else false
[Previously private]</Description>
<Final>1</Final>
<ClassMethod>1</ClassMethod>
<FormalSpec>myWord:%String</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[		Q (myWord["W")||(myWord["K")||(myWord["CZ")||(myWord["WITZ")
]]></Implementation>
</Method>

<Method name="MidList">
<Description>
Help routine for ClassMethod GetDoubleMetaphone
[Previously private]</Description>
<Final>1</Final>
<ClassMethod>1</ClassMethod>
<FormalSpec>myWord:%String,pos:%Integer,len:%Integer,strList:%String</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[		Q $LF($LFS(strList,","),$E(myWord,pos,pos+len-1))
]]></Implementation>
</Method>

<Method name="Mid">
<Description>
Help routine for ClassMethod GetDoubleMetaphone
[Previously private]</Description>
<Final>1</Final>
<ClassMethod>1</ClassMethod>
<FormalSpec>myWord:%String,pos:%Integer,len:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[		Q $E(myWord,pos,pos+len-1)
]]></Implementation>
</Method>

<Method name="AddCnt">
<Description>
Help routine for ClassMethod GetDoubleMetaphone
[Previously private]</Description>
<Final>1</Final>
<ClassMethod>1</ClassMethod>
<FormalSpec><![CDATA[lChr:%String,lChr2:%String,aChr:%String,&Cnt:%Integer]]></FormalSpec>
<Implementation><![CDATA[
		D ..AddStr(aChr)
		S Cnt=Cnt+1
		Q:lChr2=""
		S:lChr2=lChr Cnt=Cnt+1
]]></Implementation>
</Method>

<Method name="sdxStreet">
<Description>
split the native street labels and return max. 3 Soundex-Codes for each word</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec><![CDATA[strStreet:%String="",&sdxStreet1:%String,&sdxStreet2:%String,&sdxStreet3:%String]]></FormalSpec>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
		Set strIn=$ZStrip($TR($ZStrip(strStreet,"*P",," _-.,"),"_-.,","    "),"*N")
		Set strIn=..CleanStreet(strIn)
	    Set max=$Length(strIn, " ")
		Set s1="",s2="",s3="",sn=0
	    For i=1:1:max {
		    Set wrd = $Piece(strIn," ",i)
		    If $Length(wrd)>2 {
			    Set sn=sn+1
		    	Set sdx=..GetDoubleMetaphone(wrd)
		    	Set:sn=1 s1=sdx
		    	Set:sn=2 s2=sdx
		    	Set:sn=3 s3=sdx
		    }
	    }
	    Set sdxStreet1=$ZStrip(s1,"<>W")
	    Set sdxStreet2=$ZStrip(s2,"<>W")
	    Set sdxStreet3=$ZStrip(s3,"<>W")
		Quit $$$OK
]]></Implementation>
</Method>

<Method name="CleanStreet">
<Description>
Clean the Name of Street to it's decisive label 
and remove standard phrase, their could be confused.
Return native street label
[Previously private]</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>strIn:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	   Set max=$L(strIn, " ")
	   Set ret = ""
	   For i=1:1:max {
	      Set wrd=$ZStrip($ZConvert($P(strIn, " ", i),"U"),"<>W")
	      If ($L(wrd)>0) {
	      	Set wrd = $Case(wrd,
	      	                "VON":"", "VAN":"", "BEI":"", "DER":"", "SANKT":"", "DES":"", "DE":"", "VIA":"",
	      	                "PLACE":"", "AL":"", "QUAI":"", "ST":"", "RUE":"", "STREET":"", "AVE":"", "AVENUE":"",
	      	                "ROUTE":"", "HOUSE":"", "PIAZZA":"", "BOULEVARD":"", "BLVD":"", "RUA":"", "GROVE":"", 
	      	                "APT":"", "BULEVAR":"", "ROAD":"", "CALLE":"", "DRIVE":"", "VIALE":"", "LANE":"", 
	      	                "BUREAU":"", "RD":"", "AV":"", "PL":"", "LAS":"", "AUF":"", "DEM":"", "DEL":"", 
	      	                "DEN":"", "RTE":"", "ZUM":"", "AN":"", "AM":"", "HWY":"", "STN":"", "BIS":"", "VAG":"", 
	      	                "KARVEJ":"", "PASSAGE":"", "WEG":"", "STRASSE":"", "PLATZ":"", "ALLEE":"", "PO":"", 
	      	                "BOX":"", "PATH":"", "LES":"", "POSTFACH":"","P":"","PF":"","O":"",:wrd)
	       	Set Len=$L(wrd)
	       	Continue:(Len=0)
	       	If (Len>8) {
	       		Set:$E(wrd,Len-8,Len)="BOULEVARD" wrd = $E(wrd,1,Len-9)
	       		Set Len=$L(wrd)
	       	}
	       	If (Len>7) {
	       		Set:$E(wrd,Len-7,Len)="POSTFACH" wrd = $E(wrd,1,Len-8)
	       		Set Len=$L(wrd)
	       	}
	       	If (Len>6) {
		       	Set sub = $E(wrd,1,Len-7)
	       		Set wrd = $Case($E(wrd,Len-6,Len),"STRASSE":sub,"BULEVAR":sub,"PASSAGE":sub,:wrd)
	       		Set Len=$L(wrd)
	       	}
	       	If (Len>5) {
		       	Set sub = $E(wrd,1,Len-6)
	       		Set wrd = $Case($E(wrd,Len-5,Len),"AVENUE":sub,"PIAZZA":sub,"STREET":sub,"STRAAT":sub,:wrd)
	       		Set Len=$L(wrd)
	       	}
	       	If (Len>4) {
		       	Set sub = $E(wrd,1,Len-5)
	       		Set wrd = $Case($E(wrd,Len-4,Len),"VAGEN":sub,"PLACE":sub,"PLATZ":sub,"ALLEE":sub,"ROUTE":sub,"GASSE":sub,"HOUSE":sub,:wrd)
	       		Set Len=$L(wrd)
	       	}
	       	If (Len>3) {
		       	Set sub = $E(wrd,1,Len-4)
	       		Set wrd = $Case($E(wrd,Len-3,Len),"QUAI":sub,"KATU":sub,:wrd)
	       		Set Len=$L(wrd)
	       	}
	       	If (Len>2) {
		       	Set sub = $E(wrd,1,Len-3)
	       		Set wrd = $Case($E(wrd,Len-2,Len),"RUE":sub,"WEG":sub,"AVE":sub,"HWY":sub,"BOX":sub,"STR":sub,:wrd)
	       	}
	   		Set ret=ret_" "_wrd
	      }
	   }
	   Quit $ZStrip(ret,"<>W")
]]></Implementation>
</Method>

<Method name="GetSdxList">
<Description>
Splitet die Namen auf und erzeugt fÃ¼r jedes Wort einen Soundex
[Previously private]</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>myString:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	   Set max=$L(myString, " ")
	   Set ret = ""
	   For i=1:1:max {
	      Set wrd=$P(myString, " ", i)
	      Set:($L(wrd)>2) ret=ret_" "_..GetDoubleMetaphone(wrd)
	   }
	   Quit $ZStrip(ret,"<>W")
]]></Implementation>
</Method>

<Method name="sdxName">
<Description>
Clean the Name to it's decisive property 
and remove titles and phrases, their could be confused.
Return a list of Soundex-Codes</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>strName:%String=""</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
		Quit:(strName="") ""
		Set strName= $ZStrip(strName,"*N")
		Set myName = $TR($ZStrip(strName,"*P",," _-.,"),"_-.,","    ")
		Set myName = $TR(myName,"Â§Â°Â¦+@#*Ã§%Â¬&|/Â¢()Â´'?~^`!.:,;\<>?$Â£""-_"," ")
	    Set max=$L(myName, " ")
	    Set ret = ""
	    For i=1:1:max {
	        Set wrd=$ZStrip($P(myName, " ", i),"<>W")
	        If ($L(wrd)>2) {
		      	Set wrd = $Case(wrd,
		      	                "GMBH":"", "INC":"", "CIE":"", "GES":"", "ZHD":"", "GESMBH":"", "GDBR":"",
		      	                "VON":"", "HERR":"", "HERRN":"", "FRAU":"", "MRS":"", "FIRMA":"", "HOTEL":"", 
		      	                "ZHV":"", "PROF":"", "INH":"", "DIPL":"", "ING":"", "UND":"", "PSYCH":"", 
		      	                "APT":"", "MED":"", "PHYS":"", "PHIL":"", "CORP":"", "LES":"", "VOM":"", 
		      	                "ZUM":"", "MAG":"", "DIR":"", "ATT":"", "ATTN":"", "DEM":"", "DEL":"", 
		      	                "DEN":"", "BIS":"", "ZUM":"","JUN":"","MBH":"","REF":"","NAT":"","ABTL":"",
		      	                :wrd)
		      	Set sdx2=""
		      	Set asdx=0
	       		If ($L(wrd)>2) {
		       		Set sdx=..GetDoubleMetaphone(wrd,.sdx2,.asdx)
		       		Set:(sdx="0000")&&(asdx) sdx=sdx2
		       		Set ret=ret_" "_sdx
		       	}
	       }
	    }
		Quit $ZStrip(ret,"<>W")
]]></Implementation>
</Method>

<Method name="sdxCity">
<Description>
return a list of DMsoundexes</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>City:%String=""</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
		If (City = "") { Quit "" } Else {
			Set City = $TR($ZStrip(City,"*P",," _-."),"_-.","   ")
			Quit $ZStrip(..GetSdxList(City),"<>W")
		}
]]></Implementation>
</Method>

<Method name="sdxZip">
<Description><![CDATA[
return only numbers of a ZIP -> British: 3B2 = 32]]></Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>Zip:%String=""</FormalSpec>
<ReturnType>%Integer</ReturnType>
<Implementation><![CDATA[
		If (Zip = "") { Quit "" } Else {
			Quit $ZStrip(Zip,"*E'W",,"0123456789")
			Quit $ZStrip(Zip,"*PAC")
		}
]]></Implementation>
</Method>

<Method name="sdxStreetNo">
<Description>
separate the Numbers from StreetNo</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>strStreet:%String=""</FormalSpec>
<ReturnType>%Integer</ReturnType>
<Implementation><![CDATA[
		If (strStreet = "") { Quit "" } Else {
			Quit $ZStrip(strStreet,"*E'W",,"0123456789")
		}
]]></Implementation>
</Method>

<Method name="Cyrill2Latin">
<Description>
Translate UNICODE Cyrilic Letters to it's corresponding Latin Letters</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>Text:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
		Set Text=$Replace(Text,$C(1034)_$C(1072),"Nja")
		Set Text=$Replace(Text,$C(1034)_$C(1077),"Nje")
		Set Text=$Replace(Text,$C(1034)_$C(1080),"Nji")
		Set Text=$Replace(Text,$C(1034)_$C(1086),"Njo")
		Set Text=$Replace(Text,$C(1034)_$C(1091),"Nju")
		Set Text=$Replace(Text,$C(1033)_$C(1072),"Lja")
		Set Text=$Replace(Text,$C(1033)_$C(1077),"Lje")
		Set Text=$Replace(Text,$C(1033)_$C(1080),"Lji")
		Set Text=$Replace(Text,$C(1033)_$C(1086),"Ljo")
		Set Text=$Replace(Text,$C(1033)_$C(1091),"Lju")
		Set Text=$Replace(Text,$C(1039)_$C(1072),"Dza")
		Set Text=$Replace(Text,$C(1033)_$C(1077),"Dze")
		Set Text=$Replace(Text,$C(1033)_$C(1080),"Dzi")
		Set Text=$Replace(Text,$C(1033)_$C(1086),"Dzo")
		Set Text=$Replace(Text,$C(1033)_$C(1091),"Dzu")
		Set Text=$Replace(Text,$C(1040),"A")
		Set Text=$Replace(Text,$C(1041),"B")
		Set Text=$Replace(Text,$C(1042),"V")
		Set Text=$Replace(Text,$C(1043),"G")
		Set Text=$Replace(Text,$C(1044),"D")
		Set Text=$Replace(Text,$C(1045),"E")
		Set Text=$Replace(Text,$C(1046),"ZH")
		Set Text=$Replace(Text,$C(1047),"Z")
		Set Text=$Replace(Text,$C(1048),"I")
		Set Text=$Replace(Text,$C(1050),"K")
		Set Text=$Replace(Text,$C(1051),"L")
		Set Text=$Replace(Text,$C(1052),"M")
		Set Text=$Replace(Text,$C(1053),"N")
		Set Text=$Replace(Text,$C(1054),"O")
		Set Text=$Replace(Text,$C(1055),"P")
		Set Text=$Replace(Text,$C(1056),"R")
		Set Text=$Replace(Text,$C(1057),"S")
		Set Text=$Replace(Text,$C(1058),"T")
		Set Text=$Replace(Text,$C(1059),"U")
		Set Text=$Replace(Text,$C(1060),"F")
		Set Text=$Replace(Text,$C(1061),"H")
		Set Text=$Replace(Text,$C(1062),"C")
		Set Text=$Replace(Text,$C(1063),"C")
		Set Text=$Replace(Text,$C(1064),"SH")
		Set Text=$Replace(Text,$C(1065),"SH")
		Set Text=$Replace(Text,$C(1069),"E")
		Set Text=$Replace(Text,$C(1070),"YU")
		Set Text=$Replace(Text,$C(1071),"YA")
		Set Text=$Replace(Text,$C(1072),"a")
		Set Text=$Replace(Text,$C(1073),"b")
		Set Text=$Replace(Text,$C(1074),"v")
		Set Text=$Replace(Text,$C(1075),"g")
		Set Text=$Replace(Text,$C(1076),"d")
		Set Text=$Replace(Text,$C(1077),"e")
		Set Text=$Replace(Text,$C(1078),"sh")
		Set Text=$Replace(Text,$C(1079),"z")
		Set Text=$Replace(Text,$C(1080),"i")
		Set Text=$Replace(Text,$C(1081),"i")
		Set Text=$Replace(Text,$C(1082),"k")
		Set Text=$Replace(Text,$C(1083),"l")
		Set Text=$Replace(Text,$C(1084),"m")
		Set Text=$Replace(Text,$C(1085),"n")
		Set Text=$Replace(Text,$C(1086),"o")
		Set Text=$Replace(Text,$C(1087),"p")
		Set Text=$Replace(Text,$C(1088),"r")
		Set Text=$Replace(Text,$C(1089),"s")
		Set Text=$Replace(Text,$C(1090),"t")
		Set Text=$Replace(Text,$C(1091),"u")
		Set Text=$Replace(Text,$C(1092),"f")
		Set Text=$Replace(Text,$C(1093),"h")
		Set Text=$Replace(Text,$C(1094),"c")
		Set Text=$Replace(Text,$C(1095),"c")
		Set Text=$Replace(Text,$C(1096),"sh")
		Set Text=$Replace(Text,$C(1026),"DJ")
		Set Text=$Replace(Text,$C(1045),"E")
		Set Text=$Replace(Text,$C(1032),"J")
		Set Text=$Replace(Text,$C(1033),"LJ")
		Set Text=$Replace(Text,$C(1034),"NJ")
		Set Text=$Replace(Text,$C(1035),"C")
		Set Text=$Replace(Text,$C(1064),"SH")
		Set Text=$Replace(Text,$C(1038),"DZ")
		Set Text=$Replace(Text,$C(1106),"dj")
		Set Text=$Replace(Text,$C(1112),"j")
		Set Text=$Replace(Text,$C(1113),"lj")
		Set Text=$Replace(Text,$C(1114),"nj")
		Set Text=$Replace(Text,$C(1096),"sh")
		Set Text=$Replace(Text,$C(1115),"c")
		Set Text=$Replace(Text,$C(1119),"x")
		Quit Text
]]></Implementation>
</Method>

<Method name="CompareImportAdr">
<Description>
Sucht nach Doubletten in den importierten Adressen</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>Mandantnr:%Integer</FormalSpec>
<Implementation><![CDATA[
		Set grp=0
		Set newAdr=0
		Set WriteSQL=0
		// Reset the Import-Search Globals
		Kill ^DBAdressen.ImportDoubleI
		Kill ^DBAdressen.ImportDoubleD
		Kill ^DBAdressen.ImportNewI // ???
		Kill ^DBAdressen.ImportNewD // ???
		Set strSQL="SELECT * FROM SDX.ImportFile"
		Set rsImp=##class(%Library.ResultSet).%New() //"%DynamicQuery:SQL"
		Set sc=rsImp.Prepare(strSQL)
		Set:$$$ISOK(sc) sc=rsImp.Execute()
		// Exit if Error
		If $$$ISERR(sc) {
			Do $System.Status.DisplayError(sc)
			Quit
		}
		// for each address
		While rsImp.Next(.sc) {
			Set strWhere=""
			If $L(strStr3)'=0 {
				Set strWhere = "((sdxStreet1='"_strStr1_"') OR (sdxStreet1='"_strStr2_"') OR (sdxStreet1='"_strStr3_"') OR "_
				                "(sdxStreet2='"_strStr1_"') OR (sdxStreet2='"_strStr2_"') OR (sdxStreet2='"_strStr3_"') OR "_
				                "(sdxStreet3='"_strStr1_"') OR (sdxStreet3='"_strStr2_"') OR (sdxStreet3='"_strStr3_"'))"
			} ElseIf $L(strStr2)'=0 {
				Set strWhere = "((sdxStreet1='"_strStr1_"') OR (sdxStreet1='"_strStr2_"') OR "_
				                "(sdxStreet2='"_strStr1_"') OR (sdxStreet2='"_strStr2_"') OR "_
				                "(sdxStreet3='"_strStr1_"') OR (sdxStreet3='"_strStr2_"'))"
			} ElseIf $L(strStr1)'=0 {
				Set strWhere = "((sdxStreet1='"_strStr1_"') OR "_
				                "(sdxStreet2='"_strStr1_"') OR "_
				                "(sdxStreet3='"_strStr1_"'))"
			}
			Set strStrNo=rsImp.Data("sdxStreetNo")
			// Compare City-Name(s)
			Set strCity=rsImp.Data("sdxCity")
			Set wrd=$ZStrip(strCity,"<>W")
			Set cnt=$L(wrd, " "), Whr=""
			For I=1:1:cnt {
				Set:Whr'="" Whr=Whr_" OR "
				Set Whr=Whr_"(sdxCity %CONTAINSTERM('"_$P(wrd," ",I)_"'))"
			}
			Set strZip=$ZStrip($Get(rsImp.Data("sdxZip"),""),"<>W")
			If $L(Whr)'=0 {
				Set:strWhere'="" strWhere=strWhere_" AND "
				// Either the City-Name or the Zip-Code should be identical
				Set:$L(strZip)'=0 Whr=Whr_" OR (sdxZip='"_strZip_"')"
				Set strWhere=strWhere_"("_Whr_")"
			}
			// Look up for Company->Address
			If (strWhere'="") {
				Set:newAdr=0 grp=grp+1
				Set newAdr=1
				Set strWhere=strWhere_" AND (Mandant="_Mandantnr_")"
				Set strSQL = "SELECT * FROM DBAdressen.Adresse WHERE "_strWhere
				Set rsAdr=##class(%Library.ResultSet).%New() //"%DynamicQuery:SQL"
				Set sc=rsAdr.Prepare(strSQL)
				Set:$$$ISOK(sc) sc=rsAdr.Execute()
				// Exit if Error
				If $$$ISERR(sc) {
					Do $System.Status.DisplayError(sc)
					Quit
				}
				// for each address
				While rsAdr.Next(.sc) {
					// Compare Company- and/or Contact-Name(s)
					Set adrName=rsAdr.sdxName
					Set impName=rsImp.sdxName
					// Count the elements
					Set adrCnt=$L(adrName," "), impCnt=$L(impName," "), iCnt=0, pMax=0
					// Compare the Name of Company
					For I=1:1:adrCnt {
						For J=1:1:impCnt {
							Set:$P(adrName," ",I)=$P(impName," ",J) iCnt=iCnt+1
						}
					}
					// if at least one identically name was found
					If (iCnt'=0) {
						If adrCnt'=0 {
							Set pAdr=((iCnt/adrCnt)*100)
							Set pImp=((iCnt/impCnt)*100)
							Set pMax=$S(pImp<pAdr:pAdr,1:pImp)
						} Else { Set pMax=0 }
						Set adrStrNo=rsAdr.sdxStreetNo
						Set impStrNo=rsImp.sdxStreetNo
						// if at minimum the number of identical Elements
						// is the Half of one of the both NameFields
						If (pMax>=70)||
						   ((adrStrNo=strStrNo)&&('(adrStrNo=""))) 
						{
							Set newAdr=0
							TStart
							Set d=##Class(DBAdressen.ImportDouble).%New()
							Set d.GroupNo=grp
							Set d.Finished=0
							Set d.ImportID=rsImp.Data("ID")
							Set d.AddressID=rsAdr.Data("ID")
							Set sc=d.%Save()
							If $$$ISOK(sc) { 
								TCommit
							} Else { 
								TRollBack 
							    Do $System.Status.DisplayError(sc)
							}
						}
					}
				    Quit:$$$ISERR(sc)
			    }
			    If $$$ISERR(sc) {
				    Do $System.Status.DisplayError(sc)
				    Continue
			    }
			    Set sc=rsAdr.Close()
			    If $$$ISERR(sc) {
				    Do $System.Status.DisplayError(sc)
				    Continue
			    }
			} Else {
				Set newAdr=0
			}
		    If (newAdr=1) {
				// No Address of the one ist identical in the other
				// ..add it new
				Set n=##Class(DBAdressen.ImportNew).%New()
				Set n.ImportID=rsImp.Data("ID")
				Set sc=n.%Save()
		    }
		    Continue:$$$ISERR(sc)
	    }
	    If $$$ISERR(sc) {
		    Do $System.Status.DisplayError(sc)
	    }
]]></Implementation>
</Method>

<Method name="SearchDoubleCompanies">
<Description>
Doublet-Search of Companies</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>Mandantnr:%Integer</FormalSpec>
<Implementation><![CDATA[
		Set grp=0, grp2=0, wcnt=0
		Set newAdr=0
		Set WriteSQL=0
		Kill ^DBAdressen.SearchDoubleI
		Kill ^DBAdressen.SearchDoubleD
		Set strSQL="SELECT * FROM DBAdressen.Adresse WHERE (Mandant="_Mandantnr_")"
		Set rsSearch=##class(%Library.ResultSet).%New() //"%DynamicQuery:SQL"
		Set sc=rsSearch.Prepare(strSQL)
		Set:$$$ISOK(sc) sc=rsSearch.Execute()
		// Exit if Error
		If $$$ISERR(sc) {
			Do $System.Status.DisplayError(sc)
			Quit
		}
		// for each address
		While rsSearch.Next(.sc) {
			Set strWhere=""
			// =========== Look Up 4 Street =========================
			Set strStr1=$Get(rsSearch.Data("sdxStreet1"),"")
			Set strStr2=$Get(rsSearch.Data("sdxStreet2"),"")
			Set strStr3=$Get(rsSearch.Data("sdxStreet3"),"")
			If $L(strStr3)'=0 {
				Set strWhere = "((sdxStreet1='"_strStr1_"') OR (sdxStreet1='"_strStr2_"') OR (sdxStreet1='"_strStr3_"') OR "_
				                "(sdxStreet2='"_strStr1_"') OR (sdxStreet2='"_strStr2_"') OR (sdxStreet2='"_strStr3_"') OR "_
				                "(sdxStreet3='"_strStr1_"') OR (sdxStreet3='"_strStr2_"') OR (sdxStreet3='"_strStr3_"'))"
			} ElseIf $L(strStr2)'=0 {
				Set strWhere = "((sdxStreet1='"_strStr1_"') OR (sdxStreet1='"_strStr2_"') OR "_
				                "(sdxStreet2='"_strStr1_"') OR (sdxStreet2='"_strStr2_"') OR "_
				                "(sdxStreet3='"_strStr1_"') OR (sdxStreet3='"_strStr2_"'))"
			} ElseIf $L(strStr1)'=0 {
				Set strWhere = "((sdxStreet1='"_strStr1_"') OR "_
				                "(sdxStreet2='"_strStr1_"') OR "_
				                "(sdxStreet3='"_strStr1_"'))"
			}
			Set strStrNo=rsSearch.Data("sdxStreetNo")
			// =========== Look Up 4 City ===========================
			// Compare City-Name(s)
			Set strCity=rsSearch.Data("sdxCity")
			Set wrd=$ZStrip(strCity,"<>W")
			Set cnt=$L(wrd, " "), Whr=""
			For I=1:1:cnt {
				Set:Whr'="" Whr=Whr_" OR "
				Set Whr=Whr_"(sdxCity %CONTAINSTERM('"_$P(wrd," ",I)_"'))"
			}
			// =========== Look Up 4 ZIP ============================
			Set strZip=$ZStrip($Get(rsSearch.Data("sdxZip"),""),"<>W")
			If $L(Whr)'=0 {
				Set:strWhere'="" strWhere=strWhere_" AND "
				// Either the City-Name or the Zip-Code should be identical
				Set:$L(strZip)'=0 Whr=Whr_" OR (sdxZip='"_strZip_"')"
				Set strWhere=strWhere_"("_Whr_")"
			}
			// If it is a valid Where-Condition...
			If (strWhere'="") {
				// ========= look up 4 possible double Companies ===============
				Set myID=rsSearch.Data("ID")
				Set strWhere="("_strWhere_") AND (NOT (ID="_myID_"))"_" AND (Mandant="_Mandantnr_")"
				Set strSQL = "SELECT * FROM DBAdressen.Adresse WHERE "_strWhere
				Set rsFound=##class(%Library.ResultSet).%New() //"%DynamicQuery:SQL"
				Set sc=rsFound.Prepare(strSQL)
				Set:$$$ISOK(sc) sc=rsFound.Execute()
				// Exit if Error
				If $$$ISERR(sc) {
					Do $System.Status.DisplayError(sc)
					Quit
				}
				Set addMe=1
				// ========= for each Company found ============================
				Set x=0
				While rsFound.Next(.sc) {
					Set newID=rsFound.Data("ID"), Skip=0
					// Seek 4 still exist element if their is not new group number
					If (grp'=grp2) {
						Set cnt=0
						&sql(SELECT Count(*) INTO :cnt 
						     FROM DBAdressen.SearchDouble 
						     WHERE (GroupNo=:grp) AND (SearchID=:newID))
						Set Skip=(cnt'=0)
						     
					}
					If 'Skip { 
						// get the street number of found
						Set luStrNo=rsFound.Data("sdxStreetNo")
						// Compare Company-Name(s)
						Set fAdr=rsFound.Data("sdxName")
						Set sAdr=rsSearch.Data("sdxName")
						// Count the elements of the lists
						Set fCnt=$L(fAdr," "), sCnt=$L(sAdr," ")
						Set iCnt=0, pMax=0
						// Count for identically elements in both lists
						For I=1:1:fCnt {
							For J=1:1:sCnt {
								Set:$P(fAdr," ",I)=$P(sAdr," ",J) iCnt=iCnt+1
							}
						}
						// if at least one identically element in the lists of names be found...
						If (iCnt'=0) {
							// what is the higher percentage of identically elements of lists?
							If fCnt'=0 {
								Set pFound=((iCnt/fCnt)*100)
								Set pSearch=((iCnt/sCnt)*100)
								// get the higher one
								Set pMax=$S(pSearch<pFound:pFound,1:pSearch)
							} Else { Set pMax=0 }
							// if at minimum the number of identical elements was 70% ...
							If (pMax>=70)||((luStrNo=strStrNo)&&('(luStrNo=""))) {
								if addMe {
									Set addMe=0
									// Look up 4 still found Company
									Set GroupID=0
									&sql(SELECT GroupNo INTO :GroupID 
									     FROM DBAdressen.SearchDouble 
									     WHERE SearchID=:myID)
									If (GroupID=0)||(GroupID="") {
										// ============= add new if not found =============
										Set grp2=grp2+1
										Set grp=grp2
										Set d=##Class(DBAdressen.SearchDouble).%New()
										Set d.GroupNo=grp
										Set d.Finished=0
										Set d.SearchID=myID
										Set d.FoundID=rsSearch.Data("ID")
										Set sc=d.%Save()
									} Else {
										// ==========  else use it's GroupID ==============
										Set grp=GroupID
									}
								}
								// ... add new
								Set d=##Class(DBAdressen.SearchDouble).%New()
								Set d.GroupNo=grp
								Set d.Finished=0
								Set d.SearchID=newID
								Set d.FoundID=rsFound.Data("ID")
								Set sc=d.%Save()
							}
						}
					    Quit:$$$ISERR(sc)
					}
			    }
			    If $$$ISERR(sc) {
				    Do $System.Status.DisplayError(sc)
				    Continue
			    }
			    Do rsFound.Close()
			}
		    Continue:$$$ISERR(sc)
	    }
	    If $$$ISERR(sc) {
		    Do $System.Status.DisplayError(sc)
	    }
	    // d ##Class(SDX.Tools).SearchDoubleCompanies()
]]></Implementation>
</Method>
</Class>


<Class name="DBAdressen.TelefonatDetail">
<Super>%Persistent,%XML.Adaptor</Super>
<TimeChanged>62438,40802.003335</TimeChanged>
<TimeCreated>61605,54805.462027</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Kopf">
<Type>DBAdressen.TelefonatKopf</Type>
<Cardinality>one</Cardinality>
<Inverse>Detail</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Kopf"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="KopfIndex">
<Properties>Kopf</Properties>
</Index>

<Property name="Bearbeiter">
<Type>DBCore.Mitarbeiter</Type>
<Cardinality>one</Cardinality>
<Inverse>TelefonatBearbeiter</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Bearbeiter"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="BearbeiterIndex">
<Properties>Bearbeiter</Properties>
</Index>

<Property name="Erledigung">
<Type>%Date</Type>
</Property>

<Property name="MeldungIntern">
<Type>%String</Type>
<Parameter name="MAXLEN" value="32767"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Verrechnen">
<Type>%Boolean</Type>
</Property>

<Property name="Erledigt">
<Type>%Boolean</Type>
</Property>

<Property name="Beginn">
<Type>%Time</Type>
</Property>

<Property name="Ende">
<Type>%Time</Type>
</Property>

<Property name="Menge">
<Type>%Decimal</Type>
<Calculated>1</Calculated>
<SqlComputeCode> Set {Menge}=##class(DBAdressen.TelefonatDetail).CalcMengeClass({ID}) </SqlComputeCode>
<SqlComputed>1</SqlComputed>
<Parameter name="SCALE" value="5"/>
</Property>

<Property name="TarifIntern">
<Type>%Decimal</Type>
</Property>

<Property name="TarifExtern">
<Type>%Decimal</Type>
</Property>

<Property name="Projekt">
<Type>DBIntrap.SD.Projekt</Type>
<Cardinality>one</Cardinality>
<Inverse>TelefonatProjekt</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Projekt"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="ProjektIndex">
<Properties>Projekt</Properties>
</Index>

<Property name="Arbeitsposition">
<Type>DBIntrap.SD.Arbeitsposition</Type>
<Cardinality>one</Cardinality>
<Inverse>TelefonatArbeitsposition</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Arbeitsposition"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="ArbeitspositionIndex">
<Properties>Arbeitsposition</Properties>
</Index>

<Property name="QMeldung">
<Type>DBIntrap.SD.QMeldung</Type>
<Cardinality>one</Cardinality>
<Inverse>TelefonatQMeldung</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Auswirkung"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="QMeldungIndex">
<Properties>QMeldung</Properties>
</Index>

<Property name="Kategorie">
<Type>%Integer</Type>
</Property>

<Property name="Berechnungsart">
<Type>%Integer</Type>
</Property>

<Property name="BetragIntern">
<Type>%Decimal</Type>
<Calculated>1</Calculated>
<SqlComputeCode> Set {BetragIntern}=##class(DBAdressen.TelefonatDetail).CalcBetragInternClass({Kategorie},{Berechnungsart},{Menge},{TarifIntern}) </SqlComputeCode>
<SqlComputed>1</SqlComputed>
<Parameter name="SCALE" value="5"/>
</Property>

<Property name="BetragExtern">
<Type>%Decimal</Type>
<Calculated>1</Calculated>
<SqlComputeCode> Set {BetragExtern}=##class(DBAdressen.TelefonatDetail).CalcBetragExternClass({ID}) </SqlComputeCode>
<SqlComputed>1</SqlComputed>
<Parameter name="SCALE" value="5"/>
</Property>

<Property name="VerbuchtIntrap">
<Type>%Boolean</Type>
</Property>

<Property name="Eingang">
<Type>%Boolean</Type>
</Property>

<Property name="IsFirstDetail">
<Type>%Boolean</Type>
<Calculated>1</Calculated>
<SqlComputeCode> Set {IsFirstDetail}=##class(DBAdressen.TelefonatDetail).IsFirstDetailEntry({ID}) </SqlComputeCode>
<SqlComputed>1</SqlComputed>
</Property>

<Property name="Problemtyp">
<Type>DBIntrap.SD.Problemtyp</Type>
<Cardinality>one</Cardinality>
<Inverse>TelefonatDetProblemtyp</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Problemtyp"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Property name="Meldung">
<Type>%String</Type>
<Parameter name="MAXLEN" value="32767"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Method name="CalcMengeClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>Oid:%String</FormalSpec>
<ReturnType>%Decimal</ReturnType>
<ReturnTypeParams>SCALE=5</ReturnTypeParams>
<Implementation><![CDATA[
	set menge = 0
	
	set obj = ##class(DBAdressen.TelefonatDetail).%OpenId(Oid)
	
	set dauer = obj.Ende - obj.Beginn
	
	set menge = (dauer / 3600)
	
	set menge = ##class(DBUtils.NumberUtils).Round(menge, 2)
	
	Quit menge
]]></Implementation>
</Method>

<Method name="CalcBetragExternClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>Oid:%String</FormalSpec>
<ReturnType>%Decimal</ReturnType>
<ReturnTypeParams>SCALE=5</ReturnTypeParams>
<Implementation><![CDATA[
	set b = 0
	
	set obj = ##class(DBAdressen.TelefonatDetail).%OpenId(Oid)
	
	if (obj.Berechnungsart = ##class(DBIntrap.Konst).BerechnungMengeTarif()) {
		if (obj.Kategorie '= ##class(DBIntrap.Konst).KategorieIntern()) {
			Set b = (obj.Menge * obj.TarifExtern)
		}
		
	} elseif (obj.Berechnungsart = ##class(DBIntrap.Konst).BerechnungPauschal()) {
		if (obj.Kategorie '= ##class(DBIntrap.Konst).KategorieIntern()) {
			Set b = obj.TarifExtern
		}
		
	} elseif (obj.Berechnungsart = ##class(DBIntrap.Konst).BerechnungInternMTExternP()) {
		if (obj.Kategorie '= ##class(DBIntrap.Konst).KategorieIntern()) {
			Set b = obj.TarifExtern
		}
		
	}
	
	Quit b
]]></Implementation>
</Method>

<Method name="GetPrevTelefonatDetailId">
<ClassMethod>1</ClassMethod>
<FormalSpec>KopfOid:%String,ZeitVon:%Time</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	set Oid = ""
	&sql(SELECT TOP 1 ID INTO :Oid
		     	FROM DBAdressen.TelefonatDetail 
		     	WHERE Kopf->ID = :KopfOid and Beginn < :ZeitVon Order by Beginn desc)
	quit Oid
]]></Implementation>
</Method>

<Method name="CalcBetragInternClass">
<ClassMethod>1</ClassMethod>
<FormalSpec>kategorie:%Integer,berechnung:%Integer,menge:%Decimal,tarif:%Decimal</FormalSpec>
<ReturnType>%Decimal</ReturnType>
<ReturnTypeParams>SCALE=5</ReturnTypeParams>
<Implementation><![CDATA[
	set b = 0
	
	if (berechnung = ##class(DBIntrap.Konst).BerechnungMengeTarif()) {
		Set b = (menge * tarif)
		
	} elseif (berechnung = ##class(DBIntrap.Konst).BerechnungPauschal()) {
		Set b = tarif
		
	} elseif (berechnung = ##class(DBIntrap.Konst).BerechnungInternMTExternP()) {
		Set b = (menge * tarif)
		
	}
	
	Quit b
]]></Implementation>
</Method>

<Method name="IsFirstDetailEntry">
<ClassMethod>1</ClassMethod>
<FormalSpec>entryId:%String</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<Implementation><![CDATA[
	set obj = ##class(DBAdressen.TelefonatDetail).%OpenId(entryId)
	//set zeitvon = obj.Beginn
	set kopfId = obj.Kopf.%Id()
	kill obj 
	set count = 0
	//&sql(SELECT COUNT(ID) INTO :count
	//	     	FROM DBAdressen.TelefonatDetail 
	//	     	WHERE Kopf->ID = :kopfId and Beginn < :zeitvon Order by Beginn desc)
	&sql(SELECT COUNT(ID) INTO :count
		     	FROM DBAdressen.TelefonatDetail 
		     	WHERE Kopf->ID = :kopfId and ID < :entryId)
	if (count > 0) {
		quit 0	
	} else {
		quit 1	
	}
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.TelefonatDetailD</DataLocation>
<DefaultData>TelefonatDetailDefaultData</DefaultData>
<IdLocation>^DBAdressen.TelefonatDetailD</IdLocation>
<IndexLocation>^DBAdressen.TelefonatDetailI</IndexLocation>
<StreamLocation>^DBAdressen.TelefonatDetailS</StreamLocation>
<Data name="TelefonatDetailDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Kopf</Value>
</Value>
<Value name="3">
<Value>Bearbeiter</Value>
</Value>
<Value name="4">
<Value>Erledigung</Value>
</Value>
<Value name="5">
<Value>MeldungIntern</Value>
</Value>
<Value name="6">
<Value>Verrechnen</Value>
</Value>
<Value name="7">
<Value>Erledigt</Value>
</Value>
<Value name="8">
<Value>Beginn</Value>
</Value>
<Value name="9">
<Value>Ende</Value>
</Value>
<Value name="10">
<Value>TarifIntern</Value>
</Value>
<Value name="11">
<Value>TarifExtern</Value>
</Value>
<Value name="12">
<Value>Projekt</Value>
</Value>
<Value name="13">
<Value>Arbeitsposition</Value>
</Value>
<Value name="14">
<Value>Auswirkung</Value>
</Value>
<Value name="15">
<Value>Kategorie</Value>
</Value>
<Value name="16">
<Value>Berechnungsart</Value>
</Value>
<Value name="17">
<Value>QMeldung</Value>
</Value>
<Value name="18">
<Value>VerbuchtIntrap</Value>
</Value>
<Value name="19">
<Value>Eingang</Value>
</Value>
<Value name="20">
<Value>Problemtyp</Value>
</Value>
<Value name="21">
<Value>MeldungOld</Value>
</Value>
<Value name="22">
<Value>Meldung</Value>
</Value>
</Data>
<Property name="Arbeitsposition"/>
<Property name="Auswirkung"/>
<Property name="Bearbeiter"/>
<Property name="Beginn"/>
<Property name="Berechnungsart"/>
<Property name="BetragExtern"/>
<Property name="BetragIntern"/>
<Property name="Dauer"/>
<Property name="Eingang"/>
<Property name="Ende"/>
<Property name="Erledigt"/>
<Property name="Erledigung"/>
<Property name="IsFirstDetail"/>
<Property name="Kategorie"/>
<Property name="Kopf"/>
<Property name="Meldung"/>
<Property name="MeldungIntern"/>
<Property name="Menge"/>
<Property name="Problemtyp"/>
<Property name="Projekt"/>
<Property name="QMeldung"/>
<Property name="TarifExtern"/>
<Property name="TarifIntern"/>
<Property name="VerbuchtIntrap"/>
<Property name="Verrechnen"/>
</Storage>
</Class>


<Class name="DBAdressen.TelefonatKopf">
<Super>%Persistent,%XML.Adaptor</Super>
<TimeChanged>62438,40801.935397</TimeChanged>
<TimeCreated>61605,54873.819194</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Adresse">
<Type>DBAdressen.Adresse</Type>
<Cardinality>one</Cardinality>
<Inverse>TelefonatAdresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Adresse"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="AdresseIndex">
<Properties>Adresse</Properties>
</Index>

<Property name="Erfasser">
<Type>DBCore.Mitarbeiter</Type>
<Cardinality>one</Cardinality>
<Inverse>TelefonatErfasser</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Erfasser"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="ErfasserIndex">
<Properties>Erfasser</Properties>
</Index>

<Property name="Erfassung">
<Type>%Date</Type>
</Property>

<Property name="MeldungOld">
<Type>%String</Type>
<Parameter name="MAXLEN" value="32767"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="Ansprechsperson">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="RueckrufTelefonnr">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="ProblemtypOld">
<Type>DBIntrap.SD.Problemtyp</Type>
<Cardinality>one</Cardinality>
<Inverse>TelefonatProblemtyp</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Problemtyp"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Property name="AnsprechspersMitarbeiter">
<Type>DBAdressen.Mitarbeiter</Type>
<Cardinality>one</Cardinality>
<Inverse>TelefonatMitarbeiter</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="AnsprechspersMitarbeiter"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="AnspMitarbeiterIndex">
<Properties>AnsprechspersMitarbeiter</Properties>
</Index>

<Property name="Detail">
<Type>DBAdressen.TelefonatDetail</Type>
<Cardinality>many</Cardinality>
<Inverse>Kopf</Inverse>
<Relationship>1</Relationship>
</Property>

<Property name="NatelRueckruf">
<Type>%String</Type>
<Parameter name="MAXLEN" value="255"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Method name="%OnDelete">
<Description><![CDATA[
This callback method is invoked by the <METHOD>%Delete</METHOD> method to 
provide notification that the object specified by <VAR>oid</VAR> is being deleted.

<P>If this method returns an error then the object will not be deleted.
[Previously private]]]></Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>oid:%ObjectIdentity</FormalSpec>
<ReturnType>%Status</ReturnType>
<ServerOnly>1</ServerOnly>
<Implementation><![CDATA[
	set myId = $lg(oid,1)
	d ##class(DBUtils.ClassHelper).DeleteManyRelations("DBAdressen.TelefonatKopf", myId)
	Quit $$$OK
]]></Implementation>
</Method>

<Trigger name="trgOnDelete">
<Code>	set myId = {ID*O}
	Quit ##class(DBUtils.ClassHelper).DeleteManyRelations("DBAdressen.TelefonatKopf", myId)</Code>
<Event>DELETE</Event>
</Trigger>

<Method name="HasOpenDetails">
<ClassMethod>1</ClassMethod>
<FormalSpec>oidKopf:%String,BenutzerOid:%String,ErfasserOid:%String</FormalSpec>
<ReturnType>%Boolean</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	
	set Count = 0
	&sql(SELECT count(*) As Cnt INTO :Count
	     	FROM DBAdressen.TelefonatDetail
	     	WHERE Kopf->ID = :oidKopf and Erledigt = 0 And
	     	(Bearbeiter = :BenutzerOid or :BenutzerOid = '') and
			(Kopf->Erfasser = :ErfasserOid or :ErfasserOid = '')
		)
	quit Count '= 0
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.TelefonatKopfD</DataLocation>
<DefaultData>TelefonatKopfDefaultData</DefaultData>
<IdLocation>^DBAdressen.TelefonatKopfD</IdLocation>
<IndexLocation>^DBAdressen.TelefonatKopfI</IndexLocation>
<StreamLocation>^DBAdressen.TelefonatKopfS</StreamLocation>
<Data name="TelefonatKopfDefaultData">
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Adresse</Value>
</Value>
<Value name="3">
<Value>Erfasser</Value>
</Value>
<Value name="4">
<Value>Erfassung</Value>
</Value>
<Value name="5">
<Value>MeldungOld</Value>
</Value>
<Value name="6">
<Value>Ansprechsperson</Value>
</Value>
<Value name="7">
<Value>RueckrufTelefonnr</Value>
</Value>
<Value name="8">
<Value>Eingang</Value>
</Value>
<Value name="9">
<Value>ProblemtypOld</Value>
</Value>
<Value name="10">
<Value>AnsprechspersMitarbeiter</Value>
</Value>
<Value name="11">
<Value>NatelRueckruf</Value>
</Value>
</Data>
<Property name="Adresse"/>
<Property name="AnsprechspersMitarbeiter"/>
<Property name="Ansprechsperson"/>
<Property name="Eingang"/>
<Property name="Erfasser"/>
<Property name="Erfassung"/>
<Property name="Meldung"/>
<Property name="MeldungOld"/>
<Property name="NatelRueckruf"/>
<Property name="Problemtyp"/>
<Property name="ProblemtypOld"/>
<Property name="RueckrufTelefonnr"/>
</Storage>
</Class>


<Class name="DBAdressen.TourDetail">
<Super>%Persistent,%XML.Adaptor</Super>
<TimeChanged>62438,40876.857522</TimeChanged>
<TimeCreated>61942,55395.133666</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Tour">
<Type>DBAdressen.SD.Gebiet</Type>
<Cardinality>parent</Cardinality>
<Inverse>TourDetails</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Tour"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="TourIndex">
<Properties>Tour</Properties>
</Index>

<Property name="PosNr">
<Type>%Integer</Type>
</Property>

<Property name="Aktiv">
<Type>%Boolean</Type>
</Property>

<Property name="Adresse">
<Type>DBAdressen.Adresse</Type>
<Cardinality>one</Cardinality>
<Inverse>TourDetail</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Adresse"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="AdresseIndex">
<Properties>Adresse</Properties>
</Index>

<Method name="GetIdByGebPosNr">
<ClassMethod>1</ClassMethod>
<FormalSpec>GebietOid:%String,PosNr:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	set Oid = ""
	&sql(SELECT ID INTO :Oid
		     	FROM DBAdressen.TourDetail
		     	WHERE Tour->ID = :GebietOid and PosNr = :PosNr)
	quit Oid
]]></Implementation>
</Method>

<Method name="GetIdByGebIdAdrId">
<ClassMethod>1</ClassMethod>
<FormalSpec>GebietOid:%String,AdressOid:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	set Oid = ""
	&sql(SELECT ID INTO :Oid
		     	FROM DBAdressen.TourDetail
		     	WHERE Tour->ID = :GebietOid and Adresse = :AdressOid)
	quit Oid
]]></Implementation>
</Method>

<Method name="GetPosNrById">
<ClassMethod>1</ClassMethod>
<FormalSpec>TourDetId:%String</FormalSpec>
<ReturnType>%Integer</ReturnType>
<Implementation><![CDATA[
	set PosNr = 0
	set tourDet = ##class(DBAdressen.TourDetail).%OpenId(TourDetId)
	if (tourDet '= "") {
		set PosNr = tourDet.PosNr
	}
	quit PosNr
]]></Implementation>
</Method>

<Method name="GetNextPosNrByTour">
<ClassMethod>1</ClassMethod>
<FormalSpec>GebietOid:%String</FormalSpec>
<ReturnType>%Integer</ReturnType>
<Implementation><![CDATA[
	set aktPosNr = ""
	&sql(SELECT MAX(PosNr) INTO :aktPosNr
		     	FROM DBAdressen.TourDetail
		     	WHERE Tour = :GebietOid)
	quit aktPosNr +1
]]></Implementation>
</Method>

<Method name="GetPosNrByGebIdAdrId">
<ClassMethod>1</ClassMethod>
<FormalSpec>GebietOid:%String,AdressOid:%String</FormalSpec>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
	set PosNr = 9999
	&sql(SELECT TOP 1 PosNr INTO :PosNr
		     	FROM DBAdressen.TourDetail
		     	WHERE Tour = :GebietOid and Adresse = :AdressOid)
	quit PosNr
]]></Implementation>
</Method>

<Method name="RenumberTour">
<ClassMethod>1</ClassMethod>
<FormalSpec>GebietOid:%String</FormalSpec>
<Implementation><![CDATA[
	Set strSQL = "SELECT ID FROM DBAdressen.TourDetail WHERE Tour->ID = '"_GebietOid_"' Order By PosNr"
	Set rs = ##class(%Library.ResultSet).%New("%DynamicQuery:SQL")
	Do rs.Prepare(strSQL)
	Set sc=rs.Execute()
	Set posNr = 1
	
	IF $$$ISOK(sc) {
		While rs.Next(.sc) {
			Set currId =rs.Data("ID")
			set tourDet = ##class(DBAdressen.TourDetail).%OpenId(currId)
			if (tourDet '= "") {
				if (tourDet.PosNr '= posNr) {
					set tourDet.PosNr = posNr
					set state = tourDet.%Save()
				}
				k tourDet
				set posNr = posNr +1
			}
		}
	}
]]></Implementation>
</Method>

<Method name="InsertInTourByIndex">
<ClassMethod>1</ClassMethod>
<FormalSpec>GebietOid:%String,PosNr:%Integer,TourDetId:%String</FormalSpec>
<Implementation><![CDATA[
	set BisPosNr = 0
	// Dem Tourdetail welches zu verschieben ist wird temporär die 0 zugewiesen, damit es keine Konflikte gibt
	set tourDet = ##class(DBAdressen.TourDetail).%OpenId(TourDetId)
	set DetPosNr = tourDet.PosNr
	set tourDet.PosNr = 0
	d tourDet.%Save()
	
	set AktMaxPosNr = (##class(DBAdressen.TourDetail).GetNextPosNrByTour(GebietOid) - 1)
	
	Set strSQL = "SELECT ID FROM DBAdressen.TourDetail WHERE Tour->ID = '"_GebietOid_"' "
	if (DetPosNr < PosNr) {
		set strSQL = strSQL_" AND PosNr between "_DetPosNr_" AND "_PosNr_" Order By PosNr"
	} else {
		set strSQL = strSQL_" AND PosNr between "_PosNr_" AND "_DetPosNr_" Order By PosNr"
	}
	write strSQL, !
	Set rs = ##class(%Library.ResultSet).%New("%DynamicQuery:SQL")
	Do rs.Prepare(strSQL)
	Set sc=rs.Execute()
    IF $$$ISOK(sc) {
		While rs.Next(.sc) {
			set id = rs.Data("ID")
			w id, !
			set tmpTourDet = ##class(DBAdressen.TourDetail).%OpenId(id)
			w "Alte PosNr: ", tmpTourDet,!
			if (tmpTourDet '= "") {
				// Wenn jetzige Nummer tiefer als neue müssen alle zwichen der jetzigen und der neuen
				// um eins vermindert werden bevor die neue eingefügt werden kann
				if (DetPosNr < PosNr) {
					set tmpTourDet = ##class(DBAdressen.TourDetail).%OpenId(id)
					if (tmpTourDet '= "") {
						set tmpTourDet.PosNr = tmpTourDet.PosNr - 1
					}
				} else {
					// Wenn jetzige Nummer höher als neue müssen alle zwichen der jetzigen und der neuen
					// um eins erhöht werden bevor die neue eingefügt werden kann
					set tmpTourDet.PosNr = tmpTourDet.PosNr + 1
				}
				set state = tmpTourDet.%Save()
				If $$$ISERR(state) {
					w "Fehler beim speichern ", state, !
				}
			}
		}
	}
	
	// Nach dem alle Verschoben worden sind kann num die gewünschte Positionsnummer zugeteilt werden
	set tourDet = ##class(DBAdressen.TourDetail).%OpenId(TourDetId)
	set tourDet.PosNr = PosNr
	d tourDet.%Save()
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>{%%PARENT}("Details")</DataLocation>
<DefaultData>TourDetailDefaultData</DefaultData>
<IdLocation>^DBAdressen.TourC("Details")</IdLocation>
<IndexLocation>^DBAdressen.TourDetailI</IndexLocation>
<StreamLocation>^DBAdressen.TourDetailS</StreamLocation>
<Data name="TourDetailDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>PosNr</Value>
</Value>
<Value name="3">
<Value>Aktiv</Value>
</Value>
<Value name="4">
<Value>Adresse</Value>
</Value>
</Data>
<Property name="Adresse"/>
<Property name="Aktiv"/>
<Property name="PosNr"/>
<Property name="Tour"/>
<Property name="childsub"/>
</Storage>
</Class>


<Class name="DBAdressen.ZusatzAdresse">
<Super>%Persistent,%XML.Adaptor</Super>
<TimeChanged>62438,40802.117959</TimeChanged>
<TimeCreated>61920,40456.768979</TimeCreated>
<Inheritance>right</Inheritance>

<Parameter name="XMLIGNOREINVALIDATTRIBUTE">
<Description><![CDATA[
Controls how to handle attributes that are unexpected.
-> If this parameter is 1 (the default), such attributes are ignored.
-> If it is 0, they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNOREINVALIDTAG">
<Description><![CDATA[
Controls how to handle tags that are unexpected. 
-> If this parameter is 1, such tags are ignored. 
-> If it is 0 (the default), they are treated as errors, and import fails.]]></Description>
<Default>1</Default>
</Parameter>

<Parameter name="XMLIGNORENULL">
<Default>1</Default>
</Parameter>

<Property name="IdForExport">
<Type>%XML.Id</Type>
<Private>1</Private>
<Transient>1</Transient>
<Parameter name="XMLNAME" value="ID"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
</Property>

<Property name="Hauptadresse">
<Type>DBAdressen.Adresse</Type>
<Cardinality>one</Cardinality>
<Inverse>ZAHaupt</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Hauptadresse"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Index name="HauptadresseIndex">
<Properties>Hauptadresse</Properties>
</Index>

<Property name="Adresse">
<Type>DBAdressen.Adresse</Type>
<Cardinality>one</Cardinality>
<Inverse>Zusatzadresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="Adresse"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Property name="Bemerkung1">
<Type>%String</Type>
<Parameter name="MAXLEN" value="250"/>
<Parameter name="TRUNCATE" value="1"/>
</Property>

<Property name="ZASelektion1">
<Type>DBAdressen.SD.ZASelektion1</Type>
<Cardinality>one</Cardinality>
<Inverse>Zusatzadresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="ZASelektion1"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Property name="ZASelektion2">
<Type>DBAdressen.SD.ZASelektion2</Type>
<Cardinality>one</Cardinality>
<Inverse>Zusatzadresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="ZASelektion2"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Property name="ZASelektion3">
<Type>DBAdressen.SD.ZASelektion3</Type>
<Cardinality>one</Cardinality>
<Inverse>Zusatzadresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLELEMENTREF" value="1"/>
<Parameter name="XMLNAME" value="ZASelektion3"/>
<Parameter name="XMLPROJECTION" value="ATTRIBUTE"/>
<Parameter name="XMLREFERENCE" value="ID"/>
</Property>

<Property name="MutliSel">
<Type>DBAdressen.MultiSelZA</Type>
<Cardinality>many</Cardinality>
<Inverse>Zusatzadresse</Inverse>
<Relationship>1</Relationship>
<Parameter name="XMLPROJECTION" value="NONE"/>
</Property>

<Method name="%OnDelete">
<Description><![CDATA[
This callback method is invoked by the <METHOD>%Delete</METHOD> method to 
provide notification that the object specified by <VAR>oid</VAR> is being deleted.

<P>If this method returns an error then the object will not be deleted.
[Previously private]]]></Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>oid:%ObjectIdentity</FormalSpec>
<ReturnType>%Status</ReturnType>
<ServerOnly>1</ServerOnly>
<Implementation><![CDATA[
    set adrOid = $lg(oid,1)
    set adr = ##class(DBAdressen.ZusatzAdresse).%OpenId(adrOid)
    set mandOid = adr.Hauptadresse.Mandant
    
    // Multisel der ZAdresse loeschen
	set result = ##class(%Library.ResultSet).%New("DBAdressen.AF.MultiSelZAAF:GetSelektionByZusatzAdresse")
	set multisel = result.%Execute(mandOid, adrOid)
	
	while result.Next(.multisel) {
		set id = result.Data("ID")
		do ##class(DBAdressen.MultiSelZA).%DeleteId(id)
	}
	
	Quit $$$OK
]]></Implementation>
</Method>

<Method name="GetFirstZusatzadresseOid">
<ClassMethod>1</ClassMethod>
<FormalSpec>HauptadresseOid:%String</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	set id = ""
	
	&sql(SELECT TOP 1 Adresse INTO :id 
			FROM DBAdressen.ZusatzAdresse 
			WHERE Hauptadresse=:HauptadresseOid
			ORDER BY Adresse->Adressnummer)
	if (SQLCODE = 0) {
		Quit id
	} else {
		Quit ""
	}
]]></Implementation>
</Method>

<Method name="GetZusatzAdrOidByZASel1">
<ClassMethod>1</ClassMethod>
<FormalSpec>HauptadresseOid:%String,ZASel1Code:%Integer</FormalSpec>
<ReturnType>%String</ReturnType>
<Implementation><![CDATA[
	set id = ""
	
	&sql(SELECT TOP 1 Adresse INTO :id 
			FROM DBAdressen.ZusatzAdresse 
			WHERE Hauptadresse=:HauptadresseOid
			AND ZASelektion1->Code = :ZASel1Code
			ORDER BY Adresse->Adressnummer)
			
	if (SQLCODE = 0) {
		Quit id
	} else {
		Quit ""
	}
]]></Implementation>
</Method>

<Storage name="Default">
<Type>%Library.CacheStorage</Type>
<DataLocation>^DBAdressen.ZusatzAdresseD</DataLocation>
<DefaultData>ZusatzAdresseDefaultData</DefaultData>
<IdLocation>^DBAdressen.ZusatzAdresseD</IdLocation>
<IndexLocation>^DBAdressen.ZusatzAdresseI</IndexLocation>
<StreamLocation>^DBAdressen.ZusatzAdresseS</StreamLocation>
<Data name="ZusatzAdresseDefaultData">
<Structure>listnode</Structure>
<Subscript/>
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Hauptadresse</Value>
</Value>
<Value name="3">
<Value>Adresse</Value>
</Value>
<Value name="4">
<Value>Bemerkung1</Value>
</Value>
<Value name="5">
<Value>Bemerkung2</Value>
</Value>
<Value name="6">
<Value>Bemerkung3</Value>
</Value>
<Value name="7">
<Value>ZASelektion1</Value>
</Value>
<Value name="8">
<Value>ZASelektion2</Value>
</Value>
<Value name="9">
<Value>ZASelektion3</Value>
</Value>
</Data>
<Property name="Adresse"/>
<Property name="Bemerkung1"/>
<Property name="Hauptadresse"/>
<Property name="ZASelektion1"/>
<Property name="ZASelektion2"/>
<Property name="ZASelektion3"/>
</Storage>
</Class>
</Export>
