Index: /lib/filter_functions.inc.php
===================================================================
--- /lib/filter_functions.inc.php	(revision 8464)
+++ /lib/filter_functions.inc.php	(revision 8465)
@@ -416,5 +416,5 @@
                            
         } catch (\Exception $e) {
-
+   
             wpsg_ShopController::getShop()->api_broken = true;
 			wpsg_ShopController::getShop()->addBackendError(__('Lizenz API reagiert nicht.', 'wpsg'));
Index: /mods/mod_rechnungen/eInvoice.php
===================================================================
--- /mods/mod_rechnungen/eInvoice.php	(revision 8464)
+++ /mods/mod_rechnungen/eInvoice.php	(revision 8465)
@@ -44,8 +44,10 @@
 				$oOrder = wpsg_order::getInstance($order_id);
 				
-				$pdf_file = $oInvoice->getFilePath();
+				$pdf_file = $oInvoice->getFilePath(true);
 				$pdf_path = dirname($pdf_file).DIRECTORY_SEPARATOR;
 
 				$document = ZugferdDocumentBuilder::CreateNew($profil_id);
+				
+				$arCalculation = wpsg_calculation::getOrderCalculation($order_id)->getCalculationArray();
 				
 				$document
@@ -55,9 +57,9 @@
 					->setDocumentSeller($shop->get_option('wpsg_shopdata_name', default: ''))
 					->addDocumentSellerContact(
-						$shop->get_option('wpsg_shopdata_owner'),
+						$shop->get_option('wpsg_shopdata_owner')?:null,
 						null,
 						null,
 						null,
-						$shop->get_option('wpsg_shopdata_email')
+						$shop->get_option('wpsg_shopdata_email')?:null
 					)
 
@@ -106,5 +108,5 @@
 
 				$PaymentNettoPos = 0; $PaymentNettoNeg = 0;
-				$PaymentNetto = wpsg_calculation::getOrderCalculation($order_id)->getCalculationArray()['sum']['payment_brutto_calculated'];
+				$PaymentNetto = $arCalculation['sum']['payment_brutto_calculated'];
 				if ($PaymentNetto > 0) {$PaymentNettoPos = $PaymentNetto;}
 				elseif ($PaymentNetto < 0) {$PaymentNettoNeg = $PaymentNetto;}
@@ -112,8 +114,8 @@
 				$document->setDocumentSummation(
 					$oInvoice->getSumBrutto(),
-					wpsg_calculation::getOrderCalculation($order_id)->getCalculationArray()['sum']['topay_brutto'] /* - totalPrepaidAmount (BT-113) */,
+					$arCalculation['sum']['topay_brutto'] /* - totalPrepaidAmount (BT-113) */,
 					$oInvoice->getSumNetto(),
-					wpsg_calculation::getOrderCalculation($order_id)->getCalculationArray()['sum']['shipping_brutto_calculated'] + $PaymentNettoPos,
-					wpsg_calculation::getOrderCalculation($order_id)->getCalculationArray()['sum']['voucher_brutto'] + $PaymentNettoNeg,
+					$arCalculation['sum']['shipping_brutto_calculated'] + $PaymentNettoPos,
+					($arCalculation['sum']['voucher_brutto']??0) + $PaymentNettoNeg,
 					$oInvoice->getSumNetto(),
 					$oInvoice->getSumBrutto() - $oInvoice->getSumNetto(),
@@ -155,10 +157,7 @@
 				return $pdf_path;
 				
-				//\wpsg_header::PDFPlugin($pdf_path);
-				//die("OK".$pdf_path);
-				
 			}
 			
-			return $oInvoice->getFilePath();
+			return $oInvoice->getFilePath(true);
 			
 		}
Index: /mods/mod_rechnungen/wpsg_invoice.php
===================================================================
--- /mods/mod_rechnungen/wpsg_invoice.php	(revision 8464)
+++ /mods/mod_rechnungen/wpsg_invoice.php	(revision 8465)
@@ -185,9 +185,10 @@
 			
 		}
-
-		/**
-		 * @throws \Exception
-		 */
-		public function getFilePath() {
+		
+		/**
+		 * @param bool $raw Wenn true, dann das reine PDF ohne eRechnungsdaten
+		 * @return string
+		 */
+		public function getFilePath(bool $raw = false): string {
 
             $ym = date('Y/m', strtotime($this->__get('datum')));
@@ -250,7 +251,15 @@
 
             }
-
+			
 			\wpsg_ShopController::getShop()->protectDirectory(dirname($path));
 
+			if ($raw === true) return $path;
+			
+			$path = \wpsg\mod_invoice\eInvoice::writeEInvoice(
+				$this->getOrder()->getId(),
+				$this->getId(),
+				0
+			);
+			
 			return $path;
 			
Index: /mods/wpsg_mod_rechnungen.class.php
===================================================================
--- /mods/wpsg_mod_rechnungen.class.php	(revision 8464)
+++ /mods/wpsg_mod_rechnungen.class.php	(revision 8465)
@@ -2251,5 +2251,6 @@
  
 			$oInvoice = \wpsg\wpsg_invoice::getInstance($r_id);
-			$file_path = $oInvoice->getFilePath();
+			$file_path = $oInvoice->getFilePath(true);
+			$file_name_raw = basename($file_path);
 			
 			if (!file_exists($file_path)) throw new \Exception(
@@ -2261,5 +2262,5 @@
 			$file_path = \wpsg\mod_invoice\eInvoice::writeEInvoice($oInvoice->getOrder()->getId(), $oInvoice->getId(), $profil_id);
 			
-			header('Content-Disposition: inline; filename="'.basename($file_path).'"');
+			header('Content-Disposition: inline; filename="'.$file_name_raw.'"');
 			header("Cache-Control: no-cache, must-revalidate");
 			header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
Index: /views/mods/mod_rechnungen/invoice_pdf.phtml
===================================================================
--- /views/mods/mod_rechnungen/invoice_pdf.phtml	(revision 8464)
+++ /views/mods/mod_rechnungen/invoice_pdf.phtml	(revision 8465)
@@ -941,9 +941,20 @@
 	} else {
 		
-		if (($this->view['rebuild']??false) === false) $pdf->Output($oInvoice->getFilePath(), 'F');
+		if (($this->view['rebuild']??false) === false) $pdf->Output($oInvoice->getFilePath(true), 'F');
 		
 		// Hier wird der Dateiname an FPD ÃŒbergeben. Er soll sich aus der Rechnungsnummer ergeben, auch wenn das Dokument ÃŒber die ID gespeichert ist.
-		if ($this->view['output'] === true) $pdf->Output($this->view['filename_out'], 'I');
-		
-	}
-
+		// if ($this->view['output'] === true) $pdf->Output($this->view['filename_out'], 'I');
+		
+		if ($this->view['output'] === true) {
+			
+			header('Content-Disposition: inline; filename="'.basename($this->view['filename_out']).'"');
+			header("Cache-Control: no-cache, must-revalidate");
+			header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
+			header('Content-type: application/pdf');
+			
+			readfile($oInvoice->getFilePath());
+			
+		}
+		
+	}
+
