Index: /changelog
===================================================================
--- /changelog	(revision 8428)
+++ /changelog	(revision 8429)
@@ -630,3 +630,4 @@
 - Feature: InvoiveNr die zu PayPal ÃŒbermittelt wird kann angepasst werden (Es gab einen Kunden bei dem waren die IDs bei PayPal schon vergeben)
 - Feature: Sortierung der ZubehÃ¶rprodukte im Produktbacken
+- Bugfix: EAN/GTIN etc. (Productcodes) fÃŒr Export-/Import im Produktexport (ohne Varianten)
 - Bugfix: Korrektur Gutschein mit % Wert auf Rechnung
Index: /controller/wpsg_ProduktController.class.php
===================================================================
--- /controller/wpsg_ProduktController.class.php	(revision 8428)
+++ /controller/wpsg_ProduktController.class.php	(revision 8429)
@@ -249,8 +249,8 @@
 			foreach ($arData as $k => $v) {
 
-			    $product_id = intval($v['id']);
+			    $product_id = intval($v['id']); $oProduct = wpsg_product::getInstance($product_id);
 
                 $addColum = function($col_key) use (&$arData) {
-
+ 
                     foreach ($arData as $k => $v) {
 
@@ -297,8 +297,8 @@
 
                                     foreach ($v2 as $k3 => $v3) {
-
+ 
                                         foreach ($v3 as $k4 => $v4) {
 
-                                        	if ($k4 === 'images_global') continue;
+											if (in_array($k4, ['ean', 'images_global'])) continue;
 
                                             $addColum('PV_VARI_'.$k4);
@@ -359,4 +359,18 @@
 				}
 
+				// Productcodes
+				foreach (wpsg_product::getProductCodeConfig() as $code_key => $code_config) {
+				
+					$code = $oProduct->getProductCode($code_key)['code']??'';
+					
+					if ($code !== '') {
+					
+						$addColum($code_key);
+						$arData[$k][$code_key] = $code;
+						
+					}
+					
+				}
+				
 			}
 
@@ -364,11 +378,13 @@
 			$path = $mb->getTmpFilePath();
 
+			$arHeadCols = array_keys($arData[0]);
+			
 			$fp = fopen($path.'/wpsg_productexport.csv', 'w');
-			fputcsv($fp, array_keys($arData[0]), ';', '"');;
-
+			fputcsv($fp, $arHeadCols, ';', '"');;
+ 
 			$arDataExport = array();
-
+ 
 			foreach ($arData as $e) {
-
+				
 				// ZeilenumbrÃŒche entfernen
 				if (get_option('wpsg_impexp_clearlinebreak') === '1') {
@@ -378,7 +394,11 @@
 				}
 
-				$arDataExport[] = $e;
-
-				fputcsv($fp, $e, ';', '"');
+				$csv_row = [];
+				
+				foreach ($arHeadCols as $v) $csv_row[$v] = strval($e[$v]??'');
+				
+				$arDataExport[] = $csv_row;
+
+				fputcsv($fp, $csv_row, ';', '"');
 
 			}
@@ -835,12 +855,26 @@
                             if (
                                 preg_match("/^ATT_(.*)/", $k) ||
-                                preg_match("/^PV_(.*)/", $k)
+                                preg_match("/^PV_(.*)/", $k) ||
+								in_array($k, array_keys(wpsg_product::getProductCodeConfig()))
                             ) { unset($data_import[$k]); }
 
                         }
 
-                        $pNeu_id = $this->db->ImportQuery(WPSG_TBL_PRODUCTS, $data_import, true);
+                        $pNeu_id = intval($this->db->ImportQuery(WPSG_TBL_PRODUCTS, $data_import, true));
                         $this->shop->cache->clearProductCache($pNeu_id);
 
+						$oProduct = wpsg_product::getInstance($pNeu_id);
+						
+						// Productcodes speichern
+						foreach ($data as $k => $v) {
+							
+							if (in_array($k, array_keys(wpsg_product::getProductCodeConfig()))) {
+								
+								$oProduct->setMeta($k, $v);
+								
+							}
+							
+						}
+						
                         // Attribute speichern
                         foreach ($data as $k => $v) {
Index: /model/wpsg_order.class.php
===================================================================
--- /model/wpsg_order.class.php	(revision 8428)
+++ /model/wpsg_order.class.php	(revision 8429)
@@ -531,4 +531,15 @@
 
 		/* Rechnungsadresse */
+		
+		/**
+		 * Firma oder Herr Max Mustermann
+		 * @return string
+		 */
+		public function getInvoiceSalutationTitle(): string {
+			
+			if (trim($this->getInvoiceCompany()) !== '') return $this->getInvoiceCompany();
+			else return trim($this->getInvoiceTitle().' '.$this->getInvoiceFirstName().' '.$this->getInvoiceName());
+			
+		}
 		
 		/**
Index: /mods/mod_rechnungen/eInvoice.php
===================================================================
--- /mods/mod_rechnungen/eInvoice.php	(revision 8429)
+++ /mods/mod_rechnungen/eInvoice.php	(revision 8429)
@@ -0,0 +1,128 @@
+<?php
+	
+	declare(strict_types=1);
+	
+	/**
+	 * @author: daniel
+	 * @date: 28.08.24
+	 * @time: 07:06
+	 */
+	
+	namespace wpsg\mod_invoice;
+	
+	use wpsg\wpsg_invoice;
+	use \wpsg_order;
+	
+	use horstoeko\zugferd\{
+		ZugferdDocumentBuilder, ZugferdProfiles, codelists\ZugferdInvoiceType, ZugferdDocumentPdfBuilder
+	};
+	
+	abstract class eInvoice {
+	
+		public static function writeEInvoice(int $order_id, int $invoice_id): void {
+			
+			$shop = \wpsg_ShopController::getShop();
+			$profil_id = intval($shop->get_option('wpsg_mod_rechnungen_einvoice')) - 100;
+			
+			if ($profil_id >= 0) {
+			
+				$oInvoice = wpsg_invoice::getInstance($invoice_id);
+				$oOrder = wpsg_order::getInstance($order_id);
+				
+				$pdf_file = $oInvoice->getFilePath();
+				$pdf_path = dirname($pdf_file).DIRECTORY_SEPARATOR;
+				
+				$document = ZugferdDocumentBuilder::CreateNew($profil_id);
+				
+				$document
+					->setDocumentInformation($oInvoice->getNr(), ZugferdInvoiceType::INVOICE, \DateTime::createFromFormat("Ymd", $oInvoice->getDate('Ymd')), "EUR")
+					->addDocumentNote(wpsg_translate(__('Rechnung #1# zu Bestellung #2#', 'wpsg'), $oInvoice->getNr(), $oOrder->getNr()))
+					// ->setDocumentSupplyChainEvent(\DateTime::createFromFormat('Ymd', '20180305')) Lieferinformation
+					->setDocumentSeller($shop->get_option('wpsg_shopdata_name'))
+					->addDocumentSellerContact(
+						$shop->get_option('wpsg_shopdata_owner'),
+						null,
+						null,
+						null,
+						$shop->get_option('wpsg_shopdata_email')
+					)
+					->setDocumentSellerContact(
+						$shop->get_option('wpsg_shopdata_owner'),
+						null,
+						null,
+						null,
+						$shop->get_option('wpsg_shopdata_email')
+					)
+					//->addDocumentSellerGlobalId("4000001123452", "0088")
+					->addDocumentSellerTaxRegistration("FC", $shop->get_option('wpsg_shopdata_taxnr'))
+					->addDocumentSellerTaxRegistration("VA", $shop->get_option('wpsg_shopdata_ustidnr'))
+					->setDocumentSellerAddress(
+						$shop->get_option('wpsg_shopdata_street'),
+						"",
+						"",
+						$shop->get_option('wpsg_shopdata_zip'),
+						$shop->get_option('wpsg_shopdata_city'),
+						\wpsg_country::getInstance(intval($shop->get_option('wpsg_shopdata_country')))->getShorttext()
+					)
+					->setDocumentBuyer($oOrder->getInvoiceSalutationTitle(), strval($oOrder->getId()))
+					->setDocumentBuyerAddress(
+						$oOrder->getInvoiceStreet(),
+						"",
+						"",
+						$oOrder->getInvoiceZip(),
+						$oOrder->getInvoiceCity(),
+						$oOrder->getInvoiceCountryKuerzel()
+					);
+				
+				// Steuer Anteile
+				foreach ($oInvoice->getTaxInfo() as $tax_info) {
+				
+					$document->addDocumentTax('S', 'VAT', $tax_info['netto'], $tax_info['tax_value'], $tax_info['tax_rate']);
+					
+				}
+				
+				$document->setDocumentSummation(
+					$oInvoice->getSumBrutto(),
+					$oInvoice->getSumBrutto(),
+					$oInvoice->getSumNetto(),
+					0.0,
+					0.0,
+					$oInvoice->getSumNetto(),
+					$oInvoice->getSumBrutto() - $oInvoice->getSumNetto()
+				);
+				
+				// $document->addDocumentPaymentTerm("Zahlbar innerhalb 30 Tagen netto bis 04.04.2018, 3% Skonto innerhalb 10 Tagen bis 15.03.2018")
+				
+				foreach ($oInvoice->getItems() as $oInvoiceItem) {
+				
+					$lineID = ($lineID??0) + 1;
+					
+					$document->addNewPosition(strval($lineID));
+					$document->setDocumentPositionProductDetails(
+						$oInvoiceItem->getLabel(),
+						"",
+						strval($oInvoiceItem->getId()),
+						null,
+						"0160", // GS1 Global Trade Item Number (GTIN, EAN)
+						$oInvoiceItem->getGTIN()
+					);
+					$document->setDocumentPositionGrossPrice($oInvoiceItem->getBrutto());
+					$document->setDocumentPositionNetPrice($oInvoiceItem->getNetto());
+					$document->setDocumentPositionQuantity($oInvoiceItem->getAmount(), "H87");
+					$document->addDocumentPositionTax('S', 'VAT', $oInvoiceItem->getTaxRate());
+					$document->setDocumentPositionLineSummation($oInvoiceItem->getBruttoSum());
+					
+				}
+				
+				$document->writeFile($pdf_path."/e".$oInvoice->getId()."_".$profil_id.".xml");
+				
+				$pdfBuilder = new ZugferdDocumentPdfBuilder($document, $pdf_file);
+  				$pdfBuilder->generateDocument()->saveDocument($pdf_path.'e'.$oInvoice->getId().'_'.$profil_id.'.pdf');
+				
+				die("OK".$pdf_path);
+				
+			}
+			
+		}
+	
+	}
Index: /mods/mod_rechnungen/wpsg_invoice.php
===================================================================
--- /mods/mod_rechnungen/wpsg_invoice.php	(revision 8428)
+++ /mods/mod_rechnungen/wpsg_invoice.php	(revision 8429)
@@ -13,5 +13,7 @@
     class wpsg_invoice extends \wpsg_model {
 		
-		 static $_tableName = 'WPSG_TBL_RECHNUNGEN';
+		static $_tableName = 'WPSG_TBL_RECHNUNGEN';
+		
+		private ?array $arItems = null;
 		
 		 /**
@@ -53,5 +55,117 @@
 
         }
-
+		
+		/**
+		 * Gibt einen Array mit Informationen zu den SteuersÃ€tzen zurÃŒck
+		 * Beispiel 1190 Brutto, 19% = 190 Steueranteil
+		 * 	[
+		 * 		[
+		 * 			'tax_rate' => 19
+		 * 			'brutto' => 1190
+		 * 			'netto' => 1000
+		 * 			'tax_value' => 190
+		 * 		]
+		 * 	]
+		 * @return array
+		 */
+		public function getTaxInfo(): array {
+		
+			$arTaxInfo = [];
+			
+			$add = function(float $tax_rate, float $brutto_sum, float $netto_sum) use (&$arTaxInfo) {
+				
+				if (!isset($arTaxInfo[$tax_rate])) $arTaxInfo[$tax_rate] = [
+					'tax_rate' => $tax_rate,
+					'brutto' => 0,
+					'netto' => 0,
+					'tax_value' => 0
+				];
+				
+				$arTaxInfo[$tax_rate]['brutto'] += $brutto_sum;
+				$arTaxInfo[$tax_rate]['netto'] += $netto_sum;
+				$arTaxInfo[$tax_rate]['tax_value'] += $brutto_sum - $netto_sum;
+				
+			};
+			
+			// Produkte
+			foreach ($this->getInvoiceProducts() as $oInvoiceItem) {
+			
+				$add(
+					$oInvoiceItem->getTaxRate(),
+					$oInvoiceItem->getBruttoSum(),
+					$oInvoiceItem->getNettoSum()
+				);
+			
+			}
+			
+			return $arTaxInfo;
+			
+		}
+		
+		/**
+		 * FÃŒgt ein Produkt an die Rechnung
+		 * @param int $order_product_id
+		 * @param int $amount
+		 * @param float $single_price_netto
+		 * @param float $single_price_brutto
+		 * @param float $tax_rate
+		 * @param float $tax_value
+		 * @return void
+		 * @throws Exception
+		 */
+		public function addProduct(int $order_product_id, int $amount, float $single_price_netto, float $single_price_brutto, float $tax_rate): void {
+		 
+			$this->db->ImportQuery(WPSG_TBL_INVOICE_ITEM, [
+				'invoice_id' => intval($this->getId()),
+				'order_product_id' => intval($order_product_id),
+				'item_key' => 'product',
+				'amount' => intval($amount),
+				'single_price_netto' => wpsg_q($single_price_netto),
+				'single_price_brutto' => wpsg_q($single_price_brutto),
+				'tax_rate' => wpsg_q($tax_rate)
+			]);
+		
+		}
+		
+		/**
+		 * Gibt die Produkte der Rechnung zurÃŒck
+		 * @return wpsg_invoice_item[]
+		 */
+		public function getInvoiceProducts(): array { return $this->getItems('product'); }
+		
+		/**
+		 * @param string|null $strType
+		 * @return wpsg_invoice_item[]
+		 */
+		public function getItems(?string $strType = null): array {
+			
+			if ($this->arItems === null) {
+			
+				$this->arItems = [];
+				
+				foreach (array_map('intval', $this->db->fetchAssocField("SELECT `id` FROM `".WPSG_TBL_INVOICE_ITEM."` WHERE `invoice_id` = '".intval($this->getId())."' ")) as $item_id) {
+					
+					$this->arItems[] = wpsg_invoice_item::getInstance($item_id);
+					
+				}
+				
+			}
+			
+			$arReturn = [];
+			
+			foreach ($this->arItems as $oInvoiceItem) {
+				
+				if ($strType === null || $oInvoiceItem->getType() === $strType) {
+					
+					$arReturn[] = $oInvoiceItem;
+				
+				}
+				
+			}
+		 
+			return $arReturn;
+			
+		}
+		
 		public function isInvoice() {
 			
@@ -225,4 +339,38 @@
         }
 
+		public function getSumNetto(): float {
+		
+			$netto = 0;
+			
+			foreach ($this->getItems() as $oInvoiceItem) {
+				
+				$netto += $oInvoiceItem->getNettoSum();
+				
+			}
+			
+			return $netto;
+			
+		}
+		
+		public function getSumBrutto(): float {
+		
+			$brutto = 0;
+			
+			foreach ($this->getItems() as $oInvoiceItem) {
+				
+				$brutto += $oInvoiceItem->getBruttoSum();
+				
+			}
+			
+			return $brutto;
+			
+		}
+		
+		public function getToPay(): float {
+		
+			return $this->getSumBrutto();
+			
+		}
+		
         /**
          * @param int $order_id
Index: /mods/mod_rechnungen/wpsg_invoice_item.class.php
===================================================================
--- /mods/mod_rechnungen/wpsg_invoice_item.class.php	(revision 8429)
+++ /mods/mod_rechnungen/wpsg_invoice_item.class.php	(revision 8429)
@@ -0,0 +1,119 @@
+<?php
+	
+	declare(strict_types=1);
+	
+	/**
+	 * @author: daniel
+	 * @date: 28.08.24
+	 * @time: 07:46
+	 */
+	
+	namespace wpsg;
+	
+	class wpsg_invoice_item extends \wpsg_model {
+	
+		static $_tableName = 'WPSG_TBL_INVOICE_ITEM';
+		
+		/**
+		 * LÃ€dt die Daten aus der Datenbank
+		 */
+		public function load($invoice_item_id) {
+		
+			parent::load($invoice_item_id);
+			
+			$this->data = $this->db->fetchRow("SELECT O.* FROM `".WPSG_TBL_INVOICE_ITEM."` AS O WHERE O.`id` = '".wpsg_q($invoice_item_id)."' ");
+			
+			if ($this->data === null || $this->data['id'] != $invoice_item_id) throw new \wpsg\Exception(
+				wpsg_translate(__('Die Daten eines Rechnungspostens konnten nicht geladen werden', 'wpsg'), $invoice_item_id)
+			);
+			
+		}
+		
+		/**
+		 * Gibt den Typ zurÃŒck
+		 * @return string product|voucher|credit|shipping|payment|discount
+		 */
+		public function getType(): string { return $this->__get('item_key'); }
+		
+		/**
+		 * @throws \Exception
+		 */
+		public function getLabel(): string {
+			
+			if ($this->getType() === 'product') {
+			
+				return $this->getProduct()->getProductName();
+			
+			} else throw new \Exception();
+			
+		}
+		
+		/**
+		 * @throws \Exception
+		 */
+		public function getGTIN(): string {
+	
+			if ($this->getType() !== 'product') throw new \Exception();
+			
+			return $this->getProduct()->getGTIN();
+			
+		}
+		
+		public function getOrderProduct(): \wpsg_order_product {
+			
+			if ($this->getType() !== 'product') throw new \Exception();
+			
+			return \wpsg_order_product::getInstance(intval($this->__get('order_product_id')));
+			
+		}
+		
+		/**
+		 * @throws \Exception
+		 */
+		public function getProduct(): \wpsg_product {
+			
+			return $this->getOrderProduct()->getProduct();
+			
+		}
+		
+		/**
+		 * Steuersatz z.B. 19 fÃŒr 19% Steueranteil
+		 * @return float
+		 */
+		public function getTaxRate(): float {
+		
+			return wpsg_tf($this->__get('tax_rate'));
+		
+		}
+		
+		public function getBrutto(): float {
+			
+			return wpsg_tf($this->__get('single_price_brutto'));
+			
+		}
+		
+		public function getBruttoSum(): float {
+			
+			return intval($this->__get('amount')) * wpsg_tf($this->__get('single_price_brutto'));
+			
+		}
+		
+		public function getNetto(): float {
+			
+			return wpsg_tf($this->__get('single_price_netto'));
+			
+		}
+		
+		public function getNettoSum(): float {
+			
+			return intval($this->__get('amount')) * wpsg_tf($this->__get('single_price_netto'));
+			
+		}
+		
+		public function getAmount(): int {
+			
+			return intval($this->__get('amount'));
+			
+		}
+		
+	}
Index: /mods/wpsg_mod_rechnungen.class.php
===================================================================
--- /mods/wpsg_mod_rechnungen.class.php	(revision 8428)
+++ /mods/wpsg_mod_rechnungen.class.php	(revision 8429)
@@ -50,8 +50,18 @@
 			
 			require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'mod_rechnungen'.DIRECTORY_SEPARATOR.'wpsg_invoice.php';
+			require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'mod_rechnungen'.DIRECTORY_SEPARATOR.'wpsg_invoice_item.class.php';
 
 			$this->shop->arStatus['120'] = __('Sammelrechnung geschrieben', 'wpsg');
 			
 		} // public function __construct()
+		
+		public function init(): void {
+			
+			require_once implode(DIRECTORY_SEPARATOR, [dirname(__FILE__), 'mod_rechnungen', 'lib', 'vendor', 'autoload.php']);
+			require_once implode(DIRECTORY_SEPARATOR, [dirname(__FILE__), 'mod_rechnungen', 'eInvoice.php']);
+			
+			if (isset($_REQUEST['invoicetest'])) \wpsg\mod_invoice\eInvoice::writeEInvoice(106, 8);
+			
+		}
 		
 		public function install() {
@@ -87,4 +97,21 @@
 
             dbDelta($sql);
+			
+			$sql = "CREATE TABLE ".WPSG_TBL_INVOICE_ITEM." (
+                id int(25) NOT NULL AUTO_INCREMENT,
+                invoice_id INT(11) NOT NULL,
+                order_product_id INT(11) NOT NULL COMMENT 'Kann auch 0 sein fÃŒr z.B. Versand/Gutschein/Rabatt',
+                item_key VARCHAR(255) NOT NULL COMMENT 'product|voucher|shipping|payment|credit',
+                amount INT(11) NOT NULL,
+                single_price_netto DOUBLE(10,4) NOT NULL,
+                single_price_brutto DOUBLE(10,4) NOT NULL,
+                tax_rate DOUBLE(10,4) NOT NULL COMMENT 'z.B. 19 fÃŒr 19%'
+                PRIMARY KEY  (id),
+				KEY invoice_id (invoice_id),
+				KEY order_product_id (order_product_id),
+				KEY item_key (item_key)
+            ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;";
+
+            dbDelta($sql);
 
 		   	$this->shop->checkDefault('wpsg_rechnungen_pdfperpage', '10');
@@ -363,4 +390,5 @@
 			}
 
+			$this->shop->update_option('wpsg_mod_rechnungen_einvoice', $_REQUEST['wpsg_mod_rechnungen_einvoice'], false, false, WPSG_SANITIZE_INT);
 			$this->shop->update_option("wpsg_rechnungen_url", $_REQUEST['wpsg_rechnungen_url'], false, false, WPSG_SANITIZE_TEXTFIELD);
 			$this->shop->update_option("wpsg_mod_rechnungen_auto", $_REQUEST['wpsg_mod_rechnungen_auto'], false, false, WPSG_SANITIZE_VALUES, ['0', '1', '2']);
@@ -1326,5 +1354,5 @@
 					$invoice_data = json_decode($oOrderProduct->getMeta('wpsg_mod_rechnungen_data', false, 'null'), true);
 					if (!is_array($invoice_data)) $invoice_data = [];
-					print_r($invoice_data);
+			
 					foreach ($invoice_data as $oi) {
 						
@@ -1508,5 +1536,5 @@
 					
 				}
- 
+
 				$r_id = $this->db->importQuery(
 					WPSG_TBL_RECHNUNGEN,
@@ -1519,4 +1547,16 @@
 				$oInvoice = \wpsg\wpsg_invoice::getInstance($r_id);
                 $oInvoice->setOrder($order_id);
+				
+				foreach ($arProduct as $product_data) {
+					
+					$oInvoice->addProduct(
+						$product_data['oOrderProduct']->getId(),
+						$product_data['menge'],
+						$product_data['preis_netto'],
+						$product_data['preis_brutto'],
+						$product_data['mwst_value']
+					);
+					
+				}
 				
 				$oInvoice->setMeta('basket_data', json_encode($this->shop->view['basket']));
Index: /views/mods/mod_rechnungen/settings_edit.phtml
===================================================================
--- /views/mods/mod_rechnungen/settings_edit.phtml	(revision 8428)
+++ /views/mods/mod_rechnungen/settings_edit.phtml	(revision 8429)
@@ -5,4 +5,6 @@
 	 */
 
+	use horstoeko\zugferd\ZugferdProfiles;
+	
 ?>
 
@@ -183,4 +185,45 @@
 		<div id="tab3" role="tabpanel" class="tab-pane" >
 
+			<?php echo wpsg_drawForm_Select('wpsg_mod_rechnungen_einvoice', __('E-Rechnung', 'wpsg'), [
+				0 => __('Keine E-Rechnungsdaten erzeugen', 'wpsg'),
+				100 + ZugferdProfiles::PROFILE_MINIMUM => __('EN16931 Minimum', 'wpsg'),
+				100 + ZugferdProfiles::PROFILE_BASIC => __('EN16931 Basic', 'wpsg'),
+				100 + ZugferdProfiles::PROFILE_BASICWL => __('EN16931 Basic WL', 'wpsg'),
+				100 + ZugferdProfiles::PROFILE_EN16931 => __('EN16931 Comfort', 'wpsg'),
+				100 + ZugferdProfiles::PROFILE_EXTENDED => __('EN16931 Extended', 'wpsg'),
+				100 + ZugferdProfiles::PROFILE_XRECHNUNG => __('EN16931 XRechnung 1', 'wpsg'),
+				100 + ZugferdProfiles::PROFILE_XRECHNUNG_2 => __('EN16931 XRechnung 2', 'wpsg'),
+				100 + ZugferdProfiles::PROFILE_XRECHNUNG_2_1 => __('EN16931 XRechnung 2.1', 'wpsg'),
+				100 + ZugferdProfiles::PROFILE_XRECHNUNG_2_2 => __('EN16931 XRechnung 2.2', 'wpsg'),
+				100 + ZugferdProfiles::PROFILE_XRECHNUNG_2_3 => __('EN16931 XRechnung 2.3', 'wpsg'),
+				100 + ZugferdProfiles::PROFILE_XRECHNUNG_3 => __('EN16931 XRechnung 3', 'wpsg'),
+			], $this->get_option('wpsg_mod_rechnungen_einvoice'), ['help' => 'wpsg_mod_rechnungen_einvoice']); ?>
+			
+			<p style="line-height:normal; margin-bottom:1rem; margin-top:1rem; display:none; font-style:italic;" id="wpsg_mod_rechnungen_einvoice_description"><?php echo __('Die Platzhalter kÃ¶nnen bei den Formatfeldern und dem Dateinamen verwendet werden. Der Platzhalter %nr% sollte dabei immer Verwendung finden.', 'wpsg'); ?></p>
+ 
+			<script>
+				
+				const eInvoiceProfileDev = <?php echo json_encode(ZugferdProfiles::PROFILEDEF); ?>;
+				const el_wpsg_mod_rechnungen_einvoice_description = document.getElementById('wpsg_mod_rechnungen_einvoice_description');
+				
+				document.getElementById('wpsg_mod_rechnungen_einvoice').addEventListener('change', ev => {
+				
+					if (eInvoiceProfileDev[ev.target.value] !== undefined) {
+						
+						el_wpsg_mod_rechnungen_einvoice_description.innerText = eInvoiceProfileDev[ev.target.value].description;
+						el_wpsg_mod_rechnungen_einvoice_description.style.display = 'block';
+						
+					} else {
+						
+						el_wpsg_mod_rechnungen_einvoice_description.style.display = 'hidden';
+						
+					}
+				
+				});
+				
+				document.getElementById('wpsg_mod_rechnungen_einvoice').dispatchEvent(new Event('change'));
+				
+			</script>
+			
 			<?php echo wpsg_drawForm_Input('wpsg_rechnungen_url', __('URL Benachrichtigung', 'wpsg'), $this->get_option('wpsg_rechnungen_url'), array('help' => 'wpsg_rechnung_url')); ?>
 			<?php echo wpsg_drawForm_Select('wpsg_mod_rechnungen_auto', __('Rechnungserstellung', 'wpsg'), array(
Index: /wpshopgermany.php
===================================================================
--- /wpshopgermany.php	(revision 8428)
+++ /wpshopgermany.php	(revision 8429)
@@ -45,4 +45,5 @@
 	define('WPSG_TBL_RECHNUNGEN', $prefix.'wpsg_rechnungen');
 	define('WPSG_TBL_ORDER_INVOICE', $prefix.'wpsg_order_invoice');
+	define('WPSG_TBL_INVOICE_ITEM', $prefix.'wpsg_invoice_item');
 	define('WPSG_TBL_GUTSCHEIN', $prefix.'wpsg_gutscheine');
  	define('WPSG_TBL_PRODUCTS_REL', $prefix.'wpsg_products_related');
