Index: /mods/wpsg_mod_rechnungen.class.php
===================================================================
--- /mods/wpsg_mod_rechnungen.class.php	(revision 5959)
+++ /mods/wpsg_mod_rechnungen.class.php	(revision 5972)
@@ -577,6 +577,6 @@
 		{
 			
-			wpsg_saveEMailConfig("rechnungsmail");
-			wpsg_saveEMailConfig("gutschriftmail");
+			wpsg_saveEMailConfig("invoicemail");
+			wpsg_saveEMailConfig("accountingmail");
 			wpsg_saveEMailConfig("rechnungscopy");
 			 
@@ -587,10 +587,10 @@
 			
 			echo wpsg_drawEMailConfig(
-				'rechnungsmail',
+				'invoicemail',
 				__('E-Mail bei neuer Rechnung an den Kunden', 'wpsg'),
 				__('Diese Mail bekommt der Kunde wenn die Rechnung geschrieben wird.', 'wpsg')); 
 		
 			echo wpsg_drawEMailConfig(
-				'gutschriftmail',
+				'accountingmail',
 				__('E-Mail bei neuer Rechnungskorrektur', 'wpsg'),
 				__('Diese Mail bekommt der Kunde wenn eine neue Rechnungskorrektur geschrieben wird.', 'wpsg'));
@@ -807,5 +807,5 @@
 			$this->shop->view['invoice'] = false;
 			
-			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_rechnungen/rechnung_pdf.phtml');
+			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_rechnungen/accounting_pdf.phtml');
 			
 			$this->shop->restoreTempLocale();
@@ -971,5 +971,5 @@
 			$this->shop->view['invoice'] = true;
 			
-			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_rechnungen/rechnung_pdf.phtml');	
+			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_rechnungen/invoice_pdf.phtml');	
  
 			if (!$preview)
@@ -1011,10 +1011,10 @@
 					$file = $this->copyTemp($file, $rnr);
 					
-					$mail_text = $this->shop->render(WPSG_PATH_VIEW."/mods/mod_rechnungen/rechnungsmail.phtml", false);
+					$mail_text = $this->shop->render(WPSG_PATH_VIEW."/mods/mod_rechnungen/invoicemail.phtml", false);
 
 					if ($this->shop->get_option('wpsg_htmlmail') === '1')
 					{
 						
-						$mail_html = $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_rechnungen/rechnungsmail_html.phtml', false);
+						$mail_html = $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_rechnungen/invoicemail_html.phtml', false);
 						
 					}
@@ -1045,5 +1045,5 @@
 					}
 					
-					$this->shop->sendMail($mail_text, $to, 'rechnungsmail', $arFiles, $order_id, false, $mail_html);
+					$this->shop->sendMail($mail_text, $to, 'invoicemail', $arFiles, $order_id, false, $mail_html);
 
 					// TemporÃ€re Rechnung lÃ¶schen
@@ -1191,10 +1191,10 @@
 					$this->shop->view['storno_fee'] = $storno_fee;
 					
-					$mail_text = $this->shop->render(WPSG_PATH_VIEW."/mods/mod_rechnungen/gutschriftmail.phtml", false);
+					$mail_text = $this->shop->render(WPSG_PATH_VIEW."/mods/mod_rechnungen/accountingmail.phtml", false);
 
 					if ($this->shop->get_option('wpsg_htmlmail') == '1')
 					{
 						
-						$mail_html = $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_rechnungen/gutschriftmail_html.phtml', false);
+						$mail_html = $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_rechnungen/accountingmail_html.phtml', false);
 						
 					}
@@ -1213,5 +1213,5 @@
 					
 						$arFiles = array($file);						
-						$this->shop->sendMail($mail_text, $this->shop->view['kunde']['email'], 'gutschriftmail', $arFiles, false, false, $mail_html);
+						$this->shop->sendMail($mail_text, $this->shop->view['kunde']['email'], 'accountingmail', $arFiles, false, false, $mail_html);
 					
 						// TemporÃ€re Rechnung lÃ¶schen
Index: /views/mods/mod_rechnungen/accounting_pdf.phtml
===================================================================
--- /views/mods/mod_rechnungen/accounting_pdf.phtml	(revision 5972)
+++ /views/mods/mod_rechnungen/accounting_pdf.phtml	(revision 5972)
@@ -0,0 +1,929 @@
+<?php
+ 
+	/**
+	 * Template fÃŒr die PDF Rechnungskorrektur
+	 */
+
+	require_once WPSG_PATH_LIB.'fpdf/fpdf.php';
+	require_once WPSG_PATH_LIB.'fpdf/fpdi.php';
+	require_once WPSG_PATH_LIB.'wpsg_fpdf.class.php';
+  
+	global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top;
+	 
+	// Positionierung der Absenderadresszeile
+	$absender_left				= 25;
+	$absender_top				= 50;
+	
+	// Positionierung der Zieladress
+	$adress_left 				= 25;	
+	$adress_top					= 55;
+	
+	// Positionierung des Rechnungskopfes
+	$rdata_left					= 25;
+	$rdata_top					= 90;
+	
+	// Positionierung der Produktdaten
+	$prod_left					= 25;
+	$prod_top					= 105;
+
+	// Anzahl an Produkten pro Seite
+	$prod_break					= $this->get_option('wpsg_rechnungen_pdfperpage');
+	
+	// Damit die Steuer bei der Kleinunternehmerregelung nicht angezeigt wird leer ich den Array sicherheitshalber
+	if ($this->get_option('wpsg_kleinunternehmer') == '1')
+	{
+		
+		unset($this->view['basket']['mwst']);
+		
+	}
+	
+	if (!function_exists('AddRechnungPage'))
+	{
+		
+		function AddRechnungPage($shop, $pdf)
+		{
+			
+			global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top;
+			
+			$pdf->AddPage();
+			
+			if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.pdf"))
+			{
+				
+				$pagecount = $pdf->setSourceFile($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.pdf"); 
+				$tplidx = $pdf->importPage(1, '/MediaBox'); 
+				$pdf->useTemplate($tplidx, 0, 0, 210); 
+				
+			}
+			if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.jpg"))
+			{
+				$pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.jpg", 0, 0, 210, 297, 'jpg');
+			}
+			
+			
+			if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg"))
+			{
+	
+				list($width, $height, $type, $attr) = getimagesize($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg");
+				
+				//wpsg_debug($width.":".$height);
+				
+				$wPix = (25.4 * $width) / 96;
+				$hPix = (25.4 * $height) / 96;  
+				
+				$pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg", 210 - $wPix, 0, $wPix, $hPix);
+				
+			}
+			
+			// Absenderadresszeile (Wird in der Konfiguration hinterlegt)
+			$pdf->SetFont('Arial', '', 6);
+			$pdf->Text($absender_left, $absender_top, $shop->replaceUniversalPlatzhalter(__($shop->get_option("wpsg_rechnungen_adresszeile"), 'wpsg'), $shop->view['data']['id']));	
+			
+			if (wpsg_getStr($shop->view['kunde']['kuerzel']) != "") $shop->view['kunde']['kuerzel'] = $shop->view['kunde']['kuerzel'].'-';
+			
+			// Adresse des Kunden
+			$pdf->SetFont('Arial', '', 12);			
+			$pdf->Text($adress_left, $adress_top, $shop->view['kunde']['firma']);
+			$pdf->Text($adress_left, $adress_top + 5, $shop->view['kunde']['vname'].' '.$shop->view['kunde']['name']);
+			$pdf->Text($adress_left, $adress_top + 10, $shop->view['kunde']['strasse'].' '.wpsg_getStr($shop->view['kunde']['hausnr']));
+			$pdf->Text($adress_left, $adress_top + 15, $shop->view['kunde']['plz'].' '.$shop->view['kunde']['ort']);
+			$pdf->Text($adress_left, $adress_top + 20, strtoupper($shop->view['oOrder']->getInvoiceCountryName()));			
+			
+			// Rechnungsdaten 
+			$pdf->SetFont('Arial', 'B', 16);
+			$pdf->Text($rdata_left, $rdata_top, $shop->view['title']);
+			$pdf->SetFont('Arial', 'B', 9);
+			$pdf->Text($rdata_left, $rdata_top + 6, $shop->view['rnr']);
+			$pdf->SetFont('Arial', '', 9);
+			
+			if (isset($shop->view['faelligkeitdatum']))
+			{
+	
+				$pdf->Text($rdata_left + 35, $rdata_top, __("FÃ€llig am", "wpsg"));
+				$pdf->Text($rdata_left + 35, $rdata_top + 6, $shop->view['faelligkeitdatum']);
+				
+			}
+					
+			if (isset($shop->view['payment']))
+			{
+							
+				$pdf->Text($rdata_left + 58, $rdata_top, __("Zahlungsbedingungen", "wpsg"));
+				$pdf->Text($rdata_left + 58, $rdata_top + 6, $shop->view['payment']);
+				
+			}
+			
+			$pdf->Text($rdata_left + 105, $rdata_top, __("Kunden-Nr", "wpsg"));
+			$pdf->Text($rdata_left + 105, $rdata_top + 6, (($shop->view['kunde']['knr'] != '')?$shop->view['kunde']['knr']:$shop->view['kunde']['id']));
+			
+			$pdf->Text($rdata_left + 135, $rdata_top, __("Best. Nr.", "wpsg"));
+			$pdf->Text($rdata_left + 135, $rdata_top + 6, ((trim($shop->view['data']['onr']) != '')?$shop->view['data']['onr']:$shop->view['data']['id']));
+			
+			$pdf->Text($rdata_left + 155, $rdata_top, __("Datum", "wpsg")); 
+			$pdf->Text($rdata_left + 155, $rdata_top + 6, $shop->view['rDatum']);
+					
+			if ($shop->view['oOrder']->isInnerEu())
+			{
+				 
+				$pdf->SetFont('Arial', '', 9);		
+				$pdf->Text($adress_left, $rdata_top + 11.5, __("Innergemeinschaftliche Lieferung.", "wpsg"));
+				
+			}
+			
+			// Benutzerdefinierte Felder
+			$arTexte = $shop->callMod('wpsg_mod_rechnungen', 'getRechnungstexte', array($shop->view['data']['id']));
+			
+			foreach ((array)$arTexte as $text)
+			{
+				
+				if (isset($text['aktiv']) && $text['aktiv'] == 1)
+				{
+					
+					$pdf->SetFont('Arial', 'B', ((intval($text['fontsize']) > 0)?intval($text['fontsize']):10));
+					$pdf->wpsg_SetTextColor($text['color']);
+					$pdf->wpsg_MultiCell($text['x'], $text['y'], 5, $text['text']); 
+					$pdf->wpsg_SetTextColor("#000000");
+					
+				}
+				
+			}
+			
+		}
+		
+	}
+	//wpsg_debug($this->view); die();
+	$pdf = new wpsg_fpdf();	
+	$pdf->SetAutoPageBreak(true, 5);
+	AddRechnungPage($this, $pdf);
+				
+	$summe = 0;
+	
+	$bKopf = false; $pnr = 1; $offset = 0; $count = 0;
+	foreach ($this->view['basket']['produkte'] as $p)
+	{
+			 
+		if (!$bKopf)
+		{
+
+			$pdf->SetFont('Arial', 'B', 9);
+			$pdf->setXY($prod_left, $prod_top);
+			$pdf->Cell(10, 8, __("Nr.", "wpsg"), 1, 0, 'C');
+
+			$pdf->setXY($prod_left + 10, $prod_top);
+			$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, "Name", 1, 0, 'L');
+			
+			if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
+			{
+			
+				$pdf->setXY($prod_left + 97, $prod_top);
+				$pdf->Cell(15, 8, __("MwSt.", "wpsg"), 1, 0, 'C');
+				
+			}
+			
+			$pdf->setXY($prod_left + 112, $prod_top);
+			$pdf->Cell(15, 8, __("Menge", "wpsg"), 1, 0, 'C');
+						
+			$pdf->setXY($prod_left + 127, $prod_top);
+			$pdf->Cell(25, 8, __("Einzelpreis", "wpsg"), 1, 0, 'R');
+			
+			$pdf->setXY($prod_left + 152, $prod_top);
+			$pdf->Cell(25, 8, __("Gesamtpreis", "wpsg"), 1, 0, 'R');
+			 												
+			$offset = 8;	
+			$bKopf = true;
+			
+		}
+		
+		$pdf->SetFont('Arial', '', 9);
+		$pdf->setXY($prod_left, $prod_top + $offset);
+		
+		if ($this->get_option('wpsg_mod_rechnungen_showanr') == '1')
+		{
+			
+			$pdf->Cell(10, 8, $p['anr'], 0, 0, 'C');
+			
+		}
+		else
+		{
+		
+			$pdf->Cell(10, 8, $pnr.".", 0, 0, 'C');
+			
+		}
+
+		/* Wenn Detailname vorhanden, wird der Detailname auf Rechnung verwendet */
+		$produkt_text = $this->getProductName($this->getProduktID($p['id']), true);
+		
+		/* Falls Detailname vorhanden, wird jetzt der Produktname verwendet */
+		/* $produkt_text = $this->getProductName($this->getProduktID($p['id']), false); */
+		
+		$produktBeschreibung = trim(strip_tags($p['beschreibung']));
+		
+		if ($this->isOtherLang())
+		{ 
+			
+			$trans_db = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_PRODUCTS."` WHERE `lang_parent` = '".wpsg_q($this->getProduktID($p['id']))."' AND `lang_code` = '".wpsg_q($this->getCurrentLanguageCode())."'");
+			
+			if (is_array($trans_db) && sizeof($trans_db) > 0)
+			{
+				
+				$produkt_text = $trans_db['name'];
+				$produktBeschreibung = trim(strip_tags($trans_db['beschreibung']));
+				 
+			}
+			
+		}
+		 
+		$height = 0; // HÃ¶he der Zeile fÃŒr den Rahmen
+		
+		$pdf->setXY($prod_left + 10, $prod_top + $offset);
+		
+		// Produktvariablen 
+		if ($this->hasMod('wpsg_mod_productvars') && $this->get_option("wpsg_mod_rechnungen_showpv") == "1")
+		{
+		 
+			$arPV = $this->callMod('wpsg_mod_productvars', 'getAllProductVarValues', array($this->view['data']['id'], $p['product_index']));
+					
+			if (wpsg_isSizedArray($arPV))
+			{
+				
+				foreach ($arPV as $pv) 
+				{
+				
+					$produkt_text .= "\r\n".$pv['name'].': '.$pv['value'];
+					$height += 5;
+					
+				}
+				
+			}
+			
+		}
+
+		$produkt_text_cell_width = 102;
+		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
+		{
+			$produkt_text_cell_width = 87;	
+		}
+		
+		$produkt_text_width = $pdf->GetStringWidth($produkt_text);
+		//$produkt_text_cell_width = (($this->arMwSt == "-1")?87:102);
+		
+		$height += 5 * ceil($produkt_text_width / $produkt_text_cell_width) + 3;
+		
+		$height_y = $pdf->getY();
+		$height = 2 + $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $offset + 1.5, 5, $produkt_text, 0, 'L', 0, $produkt_text_cell_width);
+		
+		//$height += 3 + 5 + $pdf->getY() - $height_y;
+		//$pdf->Cell((($this->arMwSt == "-1")?102:87), 8, $produkt_text, 0, 0, 'L');
+
+		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
+		{
+		
+			$pdf->setXY($prod_left + 97, $prod_top + $offset);		
+			$pdf->Cell(15, 8, (($this->view['basket']['noMwSt'] == '1')?'0.00 %':wpsg_ff($p['mwst_value'], '%')), 0, 0, 'C');
+			
+		}
+		
+		$pdf->setXY($prod_left + 112, $prod_top + $offset);
+		$pdf->Cell(15, 8, $p['menge'], 0, 0, 'C');
+						
+		if (wpsg_ShopController::get_option('wpsg_preisangaben') == WPSG_NETTO)
+		{
+			$preis = $p['preis_netto'];
+			
+			//TODO
+		}
+		else
+		{
+			$preis = $p['preis_brutto'];
+		}
+		
+		$pdf->setXY($prod_left + 127, $prod_top + $offset);
+		$pdf->Cell(25, 8, wpsg_ff($preis, $this->get_option('wpsg_currency')), 0, 0, 'R');
+		
+		$pdf->setXY($prod_left + 152, $prod_top + $offset);
+		$pdf->Cell(25, 8, wpsg_ff($preis * $p['menge'], $this->get_option('wpsg_currency')), 0, 0, 'R');		
+
+		/**
+		 * Produktbeschreibung anzeigen Ja/Nein
+		 */
+		$pBeschreibungHeight = 0;
+		if ($this->get_option("wpsg_rechnungen_pbeschreibung") == "1" && trim(strip_tags($p['beschreibung'])) != '')
+		{
+			
+			$produktBeschreibung = nl2br($produktBeschreibung);			
+			preg_match_all('/\<br \/\>/', $produktBeschreibung, $treffer);
+			$produktBeschreibung = strip_tags($produktBeschreibung);
+			
+			$pBeschreibungWidth = $pdf->getStringWidth($produktBeschreibung); 
+			$pBeschreibungHeight = 5 * (ceil($pBeschreibungWidth / $produkt_text_cell_width) + @sizeof($treffer[0]));
+			
+			$pdf->SetFont('Arial', 'I', 9);
+			
+			$cellY = $pdf->getY();
+			$pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 1, 5, $produktBeschreibung, 0, 'L', 0, $produkt_text_cell_width);			
+			$pBeschreibungHeight = $pdf->getY() - $cellY - $height + 1;
+			$pdf->SetFont('Arial', '', 9);
+			
+		} 
+					
+		$height += $pBeschreibungHeight;
+
+		/**
+		 * Produktattribute ?
+		 */
+		if ($this->get_option('wpsg_rechnungen_produktattribute') == '1')
+		{
+				
+			$attributeInfo = $this->callMod('wpsg_mod_produktattribute', 'getProductAttributeByProductId', array($this->getProduktId($p['id'])));
+		
+			foreach ($attributeInfo as $pa)
+			{
+					
+				$pa_text = $pa['name'].': '.$pa['value'];
+				$height += $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 0.5, 5, $pa_text, 0, 'L', 0, $produkt_text_cell_width);
+					
+			}
+		}		
+		
+		/**
+		 * Variante ? 
+		 */
+		if (preg_match('/vp_(.*)/', $p['productkey']))
+		{
+			
+			$variInfo = $this->callMod('wpsg_mod_varianten', 'getVariantenInfoArray', array($p['productkey']));
+
+			$height += $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 0.5, 5, wpsg_translate(__('Variante: #1#', 'wpsg'), $variInfo['key']), 0, 'L', 0, $produkt_text_cell_width);			
+			
+			//$height += 5;
+			
+		}
+		
+		if ($this->hasMod('wpsg_mod_deliverynote'))
+		{
+			
+			$arDN_order = $this->callMod('wpsg_mod_deliverynote', 'loadDeliveryNotesFromOrder', array($this->view['data']['id']));
+			
+			if (sizeof($arDN_order) > 1)
+			{
+				
+				$deliveryTimeProduct = $this->callMod('wpsg_mod_deliverynote', 'getProductDeliveryTime', array($this->view['data']['id'], $p['product_index'])); 
+				
+				if ($deliveryTimeProduct !== false)
+				{
+				
+					$height += $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 0.5, 5, wpsg_translate(__('Lieferdatum: #1#', 'wpsg'), date('d.m.Y', $deliveryTimeProduct)), 0, 'L', 0, $produkt_text_cell_width);
+					
+				}
+									
+			}
+			
+		}
+		
+		// Jetzt die Rahmen zeichnen
+		$pdf->Rect($prod_left, $prod_top + $offset, 10, $height);
+		
+		$pdf->Rect($prod_left + 10, $prod_top + $offset, ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), $height);
+		
+		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
+		{
+		
+			$pdf->Rect($prod_left + 97, $prod_top + $offset, 15, $height);
+			
+		}
+		
+		$pdf->Rect($prod_left + 112, $prod_top + $offset, 15, $height);
+		$pdf->Rect($prod_left + 127, $prod_top + $offset, 25, $height);
+		$pdf->Rect($prod_left + 152, $prod_top + $offset, 25, $height);
+		
+		$offset += $height;
+		 		
+		$pnr ++;
+		$count ++;
+				
+		$summe += $p['price'] * $p['menge'];
+		
+		if ($pdf->getY() > 220 || ($count >= $prod_break && sizeof($this->view['basket']['produkte']) > ($pnr - 1)))		
+		{
+			
+			AddRechnungPage($this, $pdf);
+			$bKopf = false; $offset = 0; $count = 0;
+			
+		}
+		
+	} // produkte
+ 
+	// Gutschein
+	if ((isset($this->view['basket']['gs'])) && ($this->view['basket']['gs_value'] > 0))
+	{
+		
+		$pdf->SetFont('Arial', '', 9);
+		$pdf->setXY($prod_left, $prod_top + $offset);
+		$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
+
+		$pdf->setXY($prod_left + 10, $prod_top + $offset);
+		$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, wpsg_translate(__('Gutschein (#1#)', 'wpsg'), $this->view['basket']['gs']['code']), 1, 0, 'L');
+		
+		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
+		{
+		
+			$mwst = __('anteilig', 'wpsg');
+				
+			$pdf->setXY($prod_left + 97, $prod_top + $offset);
+			$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
+			
+		}
+		
+		$pdf->setXY($prod_left + 112, $prod_top + $offset);
+		$pdf->Cell(15, 8, '1', 1, 0, 'C');		
+					
+		/*
+		if ($this->view['basket']['gs']['calc'] == 'w')
+		{
+			
+			$gs_value_einzel = '-'.wpsg_ff($this->view['basket']['gs']['value'], $this->get_option('wpsg_currency'));
+			$gs_value_gesamt = '-'.wpsg_ff($this->view['basket']['gs']['value'], $this->get_option('wpsg_currency'));
+			
+		}
+		else if ($this->view['basket']['gs']['calc'] == 'p')
+		{
+			
+			$gs_value_einzel = '-'.wpsg_ff($this->view['basket']['gs']['value'], '%');
+			$gs_value_gesamt = '-'.wpsg_ff($this->view['basket']['sum']['gs'], $this->get_option('wpsg_currency'));
+			
+		}
+		*/
+		
+		$gs_value_einzel = '-'.wpsg_ff($this->view['basket']['sum']['gs'], $this->get_option('wpsg_currency'));
+		$gs_value_gesamt = '-'.wpsg_ff($this->view['basket']['sum']['gs'], $this->get_option('wpsg_currency'));
+		
+		$pdf->setXY($prod_left + 127, $prod_top + $offset);
+		$pdf->Cell(25, 8, $gs_value_einzel, 1, 0, 'R');
+		
+		$pdf->setXY($prod_left + 152, $prod_top + $offset);
+		$pdf->Cell(25, 8, $gs_value_gesamt, 1, 0, 'R');
+		 												
+		$offset += 8; 
+		
+	} 
+	
+	// Versandkosten
+	if ($this->view['basket']['sum']['preis_shipping'] != '' && $this->view['basket']['sum']['preis_shipping'] != 0)
+	{
+			 
+		$pdf->SetFont('Arial', '', 9);
+		$pdf->setXY($prod_left, $prod_top + $offset);
+		$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
+
+		$pdf->setXY($prod_left + 10, $prod_top + $offset);
+		$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, wpsg_translate(__('Versandkosten "#1#"', 'wpsg'), $this->view['oOrder']->getShippingLabel()), 1, 0, 'L');
+		
+		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
+		{
+		
+			if ($this->arShipping[$this->view['data']['type_shipping']]['mwst_null'] == '1' && $this->view['basket']['noMwSt'] == '1')
+			{
+				
+				$mwst = 0;
+				
+			}
+			else
+			{
+	 
+				if (isset($this->view['basket']['shipping']['tax_rata']) && $this->view['basket']['shipping']['tax_rata'] === true)
+				{
+					
+					$mwst = __('anteilig', 'wpsg');
+											
+				}
+				else
+				{
+					
+					$mwst = wpsg_ff($this->arShipping[$this->view['basket']['checkout']['shipping']]['mwst_value'], '%');
+					
+				}
+				
+				/*
+				if ($this->arShipping[$this->view['data']['type_shipping']]['mwst'] == '0')
+				{
+
+					$mwst = __('anteilig', 'wpsg');
+					
+				}
+				else
+				{
+				
+					$mwst = wpsg_ff($this->arShipping[$this->view['data']['type_shipping']]['mwst_value'], '%');
+					
+				}
+				*/
+				
+			}
+			
+			$pdf->setXY($prod_left + 97, $prod_top + $offset);
+			$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
+ 	
+		}
+		
+		$pdf->setXY($prod_left + 112, $prod_top + $offset);
+		$pdf->Cell(15, 8, '1', 1, 0, 'C');		
+					
+		$pdf->setXY($prod_left + 127, $prod_top + $offset);
+		$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_shipping'], $this->get_option('wpsg_currency')), 1, 0, 'R');
+		
+		$pdf->setXY($prod_left + 152, $prod_top + $offset);
+		$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_shipping'], $this->get_option('wpsg_currency')), 1, 0, 'R');
+		 												
+		$offset += 8;
+
+		// Zusammengesetzte Versandarten darstellen
+		/*
+		if (wpsg_isSizedArray($this->view['basket']['shipping']['methods'])) {
+		
+			foreach ($this->view['basket']['shipping']['methods'] as $shipping) {
+					
+				$pdf->SetFont('Arial', '', 9);
+				$pdf->setXY($prod_left, $prod_top + $offset);
+				$pdf->Cell(10, 8, '', 1, 0, 'C'); $pnr ++;
+					
+				$pdf->setXY($prod_left + 10, $prod_top + $offset);
+				$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, $this->getShippingName($shipping), 1, 0, 'L');
+					
+				if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
+				{
+				
+					if ($this->view['basket']['shipping'][$shipping]['tax_rata'] == 1) { $mwst = __('Anteilig', 'wpsg'); }
+					else { $mwst = wpsg_ff($this->view['basket']['shipping'][$shipping]['mwst'], '%'); }
+					
+					$pdf->setXY($prod_left + 97, $prod_top + $offset);
+					$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
+					
+				}
+				
+				$pdf->setXY($prod_left + 112, $prod_top + $offset);
+				$pdf->Cell(15, 8, '1', 1, 0, 'C');
+					
+				$pdf->setXY($prod_left + 127, $prod_top + $offset);
+				$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['shipping'][$shipping]['preis_shipping_brutto'], $this->get_option('wpsg_currency')), 1, 0, 'R');
+				
+				$pdf->setXY($prod_left + 152, $prod_top + $offset);
+				$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['shipping'][$shipping]['preis_shipping_brutto'], $this->get_option('wpsg_currency')), 1, 0, 'R');
+					
+				$offset += 8;
+				
+			}
+		
+		}
+		*/
+			
+		
+	}
+	
+	// Zahlungskosten
+	if ($this->view['basket']['sum']['preis_payment'] != '' && $this->view['basket']['sum']['preis_payment'] != 0)
+	{
+		
+		$pdf->SetFont('Arial', '', 9);
+		$pdf->setXY($prod_left, $prod_top + $offset);
+		$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
+
+		$pdf->setXY($prod_left + 10, $prod_top + $offset);
+		$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, $this->arPayment[$this->view['data']['type_payment']]['name'], 1, 0, 'L');
+		
+		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
+		{
+		
+			if ($this->arPayment[$this->view['data']['type_payment']]['mwst_null'] == '1' && $this->view['basket']['noMwSt'] == '1')
+			{
+				$mwst = 0;
+			}
+			else
+			{ 
+				
+				if (isset($this->view['basket']['payment']['tax_rata']) && $this->view['basket']['payment']['tax_rata'] === true)
+				{
+						
+					$mwst = __('anteilig', 'wpsg');
+						
+				}
+				else
+				{
+						
+					$mwst = wpsg_ff($this->arPayment[$this->view['basket']['checkout']['payment']]['mwst_value'], '%');
+						
+				}
+				
+				/*
+				if ($this->arPayment[$this->view['data']['type_payment']]['mwst'] == '0')
+				{
+
+					$mwst = __('anteilig', 'wpsg');
+					
+				}
+				else
+				{
+				
+					$mwst = wpsg_ff($this->arPayment[$this->view['data']['type_payment']]['mwst_value'], '%');
+					
+				}
+				*/
+				
+			}
+			
+			$pdf->setXY($prod_left + 97, $prod_top + $offset);
+			$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
+			
+		}
+		
+		$pdf->setXY($prod_left + 112, $prod_top + $offset);
+		$pdf->Cell(15, 8, '1', 1, 0, 'C');		
+					
+		$pdf->setXY($prod_left + 127, $prod_top + $offset);
+		$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_payment'], $this->get_option('wpsg_currency')), 1, 0, 'R');
+		
+		$pdf->setXY($prod_left + 152, $prod_top + $offset);
+		$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_payment'], $this->get_option('wpsg_currency')), 1, 0, 'R');
+		 												
+		$offset += 8;
+		
+	}
+		 	 
+	// GebÃŒhr
+	if (wpsg_tf(wpsg_getStr($this->view['storno_fee'])) > 0)
+	{
+		
+		$pdf->SetFont('Arial', '', 9);
+		$pdf->setXY($prod_left, $prod_top + $offset);
+		$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
+
+		$label = __('BearbeitungsgebÃŒhr', 'wpsg');
+
+		if (strpos($this->view['storno_fee'], '%') !== false) $label .= ' ('.wpsg_ff($this->view['storno_fee'], '%').')';
+		
+		$pdf->setXY($prod_left + 10, $prod_top + $offset);
+		$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, $label, 1, 0, 'L');
+		
+		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
+		{
+		
+			if ($this->view['basket']['noMwSt'] == '1')
+			{
+				$mwst = 0;
+			}
+			else
+			{ 
+				
+				
+				$mwst = wpsg_ff($this->view['storno_fee_tax_value'], '%');
+				
+			}
+			
+			$pdf->setXY($prod_left + 97, $prod_top + $offset);
+			$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
+			
+		}
+		
+		$pdf->setXY($prod_left + 112, $prod_top + $offset);
+		$pdf->Cell(15, 8, '1', 1, 0, 'C');		
+					
+		$pdf->setXY($prod_left + 127, $prod_top + $offset);
+		$pdf->Cell(25, 8, '-'.wpsg_ff($this->view['storno_fee_value'], $this->get_option('wpsg_currency')), 1, 0, 'R');
+		
+		$pdf->setXY($prod_left + 152, $prod_top + $offset);
+		$pdf->Cell(25, 8, '-'.wpsg_ff($this->view['storno_fee_value'], $this->get_option('wpsg_currency')), 1, 0, 'R');
+		 												
+		$offset += 8;
+		
+	}
+	
+	$pdf->SetFont('Arial', '', 9);
+	
+	if ($this->view['kunde']['ustidnr'] != "")
+	{
+		$offset += 10;
+		$pdf->Text($prod_left, $prod_top + $offset, __("Ihre Umsatzsteuer-Identifikationsnummer:", "wpsg"));
+		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
+		$pdf->Cell(37, 8, $this->view['kunde']['ustidnr'], 0, 0, 'R');
+	}
+	
+	$offset += 10;
+	if ($this->get_option('wpsg_kleinunternehmer'))
+	{
+
+		$pdf->Text($prod_left, $prod_top + $offset, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':');
+		$pdf->Text($prod_left + 100, $prod_top + $offset, __("Summe", "wpsg"));
+		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
+		$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'] + $this->view['basket']['sum']['preis_rabatt'], $this->get_option('wpsg_currency')), 0, 0, 'R');
+		$offset += 5;
+		
+	}
+	else
+	{
+		
+		if ($this->view['basket']['noMwSt'] == '1')
+		{
+			
+			$pdf->Text($prod_left, $prod_top + $offset, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':');
+			$pdf->Text($prod_left + 100, $prod_top + $offset, __("BRUTTOBETRAG", "wpsg"));
+			$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
+			$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_netto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
+			$offset += 5;
+			
+			$pdf->Text($prod_left + 100, $prod_top + $offset, __("MwSt. GESAMT", "wpsg"));
+			$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
+			$pdf->Cell(37, 8, wpsg_ff(0, $this->get_option('wpsg_currency')), 0, 0, 'R');
+					
+		}
+		else  
+		{
+			
+			$pdf->Text($prod_left, $prod_top + $offset, __("Der Gesamtbetrag setzt sich wie folgt zusammen", "wpsg"));
+				 
+			$pdf->Text($prod_left + 100, $prod_top + $offset, __("NETTOBETRAG", "wpsg"));
+			$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
+			$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_netto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
+							
+			if (sizeof($this->view['basket']['mwst']) >= 1)
+			{
+				
+				foreach ($this->view['basket']['mwst'] as $mw)
+				{
+					
+					$offset += 5;
+					$pdf->Text($prod_left + 100, $prod_top + $offset, __("MwSt. ", "wpsg").wpsg_ff($mw['value'], '%'));
+					$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
+					$pdf->Cell(37, 8, wpsg_ff($mw['sum'], $this->get_option('wpsg_currency')), 0, 0, 'R');
+					
+				}
+				
+			}
+		 	
+			if (sizeof($this->view['basket']['mwst']) > 1)
+			{
+				
+				$offset += 5;
+				$pdf->Text($prod_left + 100, $prod_top + $offset, __("MwSt. GESAMT", "wpsg"));
+				$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
+				$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'] - $this->view['basket']['sum']['preis_gesamt_netto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
+			
+			}
+	
+		} 
+		
+	}
+	
+	// Rabatt
+	if ($this->view['basket']['sum']['preis_rabatt'] > 0)
+	{
+		
+		$offset += 5;
+		
+		$pdf->Text($prod_left + 100, $prod_top + $offset, __("Rabatt", "wpsg"));
+		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
+		$pdf->Cell(37, 8, '-'.wpsg_ff($this->view['basket']['sum']['preis_rabatt'], $this->get_option('wpsg_currency')), 0, 0, 'R');
+		
+	}
+	 
+	$offset += 5;
+	$pdf->Text($prod_left + 100, $prod_top + $offset, __("SUMME", "wpsg"));
+	$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
+	$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
+
+	if ($this->get_option('wpsg_kleinunternehmer') == '1')
+	{
+ 
+		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset + 5, 5, $this->get_option('wpsg_kleinunternehmer_text')); 
+		$offset += 15;
+		
+	}
+	
+	if ($this->hasMod('wpsg_mod_deliverynote'))
+	{
+		
+		$arDN_order = $this->callMod('wpsg_mod_deliverynote', 'loadDeliveryNotesFromOrder', array($this->view['data']['id']));
+		$delivery_date = $this->callMod('wpsg_mod_deliverynote', 'getDeliveryTime', array($this->view['data']['id']));
+		
+		// Wenn es ein Gesamtlieferdatum gibt und nur einen Lieferschein, dann unter der Bestellung anzeigen
+		if ($delivery_date !== false && sizeof($arDN_order) == 1)
+		{
+			
+			$offset += 10; 
+			
+			$pdf->wpsg_MultiCell($prod_left, $prod_top + $offset, 5, wpsg_translate(__('Lieferung: #1#', 'wpsg'), date('d.m.Y', $delivery_date)));
+
+			$offset += 5;
+			
+		}
+		
+	}
+	
+	$offset += 5;
+	
+	if ($this->view['fussText'] != "")
+	{
+	
+		//$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, utf8_encode($this->view['fussText']));		
+		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, $this->view['fussText']);
+		$pdf->SetFont('Arial', 'B', 9);
+		$offset += 10;	
+		
+	}
+	
+	$shipping_adress = false;
+
+	if ($this->hasMod('wpsg_mod_shippingadress') && $this->callMod('wpsg_mod_shippingadress', 'check_different_shippingadress', array('k_id' => $this->view['data']['k_id'], 'o_id' => $this->view['data']['id'])))
+	{
+ 
+		$pdf->setFont('Arial', 'B', 9);
+		$pdf->Text($prod_left, $prod_top + $offset, __("Lieferanschrift", "wpsg").":");
+		$offset += 5;
+		
+		$pdf->setFont('Arial', '', 9);		
+		
+		$shipping_adress = "";
+		if ($this->view['data']['shipping_firma'] != "")
+		{
+			$shipping_adress .= $this->view['data']['shipping_firma']."\r\n";
+		}
+		$shipping_adress .= $this->view['data']['shipping_vname'].' '.$this->view['data']['shipping_name']."\r\n";
+		$shipping_adress .= $this->view['data']['shipping_strasse']."\r\n";
+		//$shipping_adress .= $this->view['data']['shipping_land']['kuerzel'].'-';
+		
+		$shipping_adress .= $this->view['data']['shipping_plz'].' '.$this->view['data']['shipping_ort']."\r\n";
+		$shipping_adress .= $this->view['data']['shipping_land']['name'];
+		
+		
+		$start = $pdf->getY();
+		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, $shipping_adress, 0, 'L', 0, 100);
+		$offset += $pdf->getY() - $start;
+		
+		$shipping_adress = true;
+		
+	}
+		
+	
+	$offset += 5;
+	 
+	// Bestellvariablen
+	if ($this->hasMod('wpsg_mod_ordervars') && $this->get_option('wpsg_mod_rechnungen_showov') == '1')
+	{
+		
+		$bvars = @unserialize($this->view['data']['bvars']);		
+		if (!is_array($bvars)) $bvars = array();
+		
+		$strBVars = "";
+		foreach ($bvars as $bvars_id => $bvars_value)
+		{
+				
+			$bvars = $this->db->fetchRow("SELECT * FROM `".wpsg_q(WPSG_TBL_ORDERVARS)."` WHERE `id` = '".wpsg_q($bvars_id)."' ORDER BY `pos` ASC, `id` ASC ");
+			
+			if ($bvars['typ'] == "1") // Auswahl
+			{
+				if ($bvars_value <= 0) $bvars_value = __("Keine Angabe", "wpsg");
+			}
+			else if ($bvars['typ'] == "2") // Texteingabe
+			{
+				if (trim($bvars_value) == "") $bvars_value = __("Keine Angabe", "wpsg");
+			}
+			else if ($bvars['typ'] == "3") // Checkbox
+			{
+				if ($bvars_value <= 0) $bvars_value = __("Keine Angabe", "wpsg");					
+			}
+			
+			$bvars_name = $this->callMod('wpsg_mod_ordervars', 'getNameById', array($bvars_id));			
+			$strBVars .= "\r\n".$bvars_name.": ".$bvars_value;	
+			
+		}
+		
+		$pdf->SetFont('Arial', 'B', 9);	
+		$pdf->Text($prod_left, $prod_top + $offset, __("Angaben wÃ€hrend der Bestellung", "wpsg").":");
+		$pdf->SetFont('Arial', '', 9);
+		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, $strBVars);
+		
+	}  
+	
+	if (!file_exists($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id']))))
+	{
+		
+		mkdir($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id'])), 0777, true);
+		
+	}
+	
+	$this->callMods('wpsg_mod_rechnungen_pdf', array(&$pdf, &$this->view['data']['id'], &$this->view['preview'], &$this->view['invoice']));
+	
+	$filename = $this->view['filename'].".pdf";
+	 
+	if ($this->view['preview'])
+	{
+		$pdf->Output($filename, 'I');
+	}
+	else
+	{
+		
+		$pdf->Output($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id'])).$filename, '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');
+			
+	} 
+	 
+?>
Index: /views/mods/mod_rechnungen/accountingmail.phtml
===================================================================
--- /views/mods/mod_rechnungen/accountingmail.phtml	(revision 5972)
+++ /views/mods/mod_rechnungen/accountingmail.phtml	(revision 5972)
@@ -0,0 +1,19 @@
+<?php 
+
+	/**
+	 * Template fÃŒr die Mail, die beim Schreiben einer Rechnungskorrektur optional an den Kunden versendet werden kann
+	 */
+
+	//wpsg_debug($this->view);
+
+?><?php echo __("Hallo", "wpsg"); ?> <?php echo $this->view['kunde']['vname']; ?> <?php echo $this->view['kunde']['name']; ?>,
+		
+<?php echo __("Sie erhalten hiermit die Rechnungskorrektur in HÃ¶he von", "wpsg"); ?> <?php echo wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')); ?> <?php echo __("fÃŒr Ihre Bestellung mit der Bestellnummer", "wpsg"); ?> <?php echo ((trim($this->view['data']['onr']) != '')?$this->view['data']['onr']:$this->view['data']['o_id']); ?>.
+		
+<?php if (wpsg_tf($this->view['storno_fee']) > 0) { ?>
+<?php echo wpsg_translate(__('Darin ist eine GebÃŒhr von #1# #2# enthalten.', 'wpsg'), $this->view['storno_fee'], $this->get_option('wpsg_currency')); ?> 
+  
+<?php } ?>
+<?php echo __("Mit freundlichen GrÃŒÃen", "wpsg"); ?>
+ 
+<?php echo __($this->get_option('wpsg_shopdata_name'), 'wpsg'); ?> - <?php echo __('Team', 'wpsg'); ?>
Index: /views/mods/mod_rechnungen/accountingmail_html.phtml
===================================================================
--- /views/mods/mod_rechnungen/accountingmail_html.phtml	(revision 5972)
+++ /views/mods/mod_rechnungen/accountingmail_html.phtml	(revision 5972)
@@ -0,0 +1,19 @@
+<?php 
+
+	/**
+	 * Template fÃŒr die Mail, die beim Schreiben einer Rechnungskorrektur optional an den Kunden versendet werden kann (HTML)
+	 */
+
+	//wpsg_debug($this->view);
+
+?><p><?php echo __("Hallo", "wpsg"); ?> <?php echo $this->view['kunde']['vname']; ?> <?php echo $this->view['kunde']['name']; ?>,</p>
+		
+<p><?php echo __("Sie erhalten hiermit die Rechnungskorrektur in HÃ¶he von", "wpsg"); ?> <?php echo wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')); ?> <?php echo __("fÃŒr Ihre Bestellung mit der Bestellnummer", "wpsg"); ?> <?php echo ((trim($this->view['data']['onr']) != '')?$this->view['data']['onr']:$this->view['data']['o_id']); ?>.</p>
+		
+<?php if (wpsg_tf($this->view['storno_fee']) > 0) { ?>
+<p><?php echo wpsg_translate(__('Darin ist eine GebÃŒhr von #1# #2# enthalten.', 'wpsg'), $this->view['storno_fee'], $this->get_option('wpsg_currency')); ?></p> 
+<?php } ?>
+
+<p><?php echo __("Mit freundlichen GrÃŒÃen", "wpsg"); ?></p>
+
+<p><?php echo __($this->get_option('wpsg_shopdata_name'), 'wpsg'); ?> - <?php echo __('Team', 'wpsg'); ?></p>
Index: ews/mods/mod_rechnungen/gutschriftmail.phtml
===================================================================
--- /views/mods/mod_rechnungen/gutschriftmail.phtml	(revision 5959)
+++ 	(revision )
@@ -1,19 +1,0 @@
-<?php 
-
-	/**
-	 * Template fÃŒr die Mail, die beim Schreiben einer Rechnungskorrektur optional an den Kunden versendet werden kann
-	 */
-
-	//wpsg_debug($this->view);
-
-?><?php echo __("Hallo", "wpsg"); ?> <?php echo $this->view['kunde']['vname']; ?> <?php echo $this->view['kunde']['name']; ?>,
-		
-<?php echo __("Sie erhalten hiermit die Rechnungskorrektur in HÃ¶he von", "wpsg"); ?> <?php echo wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')); ?> <?php echo __("fÃŒr Ihre Bestellung mit der Bestellnummer", "wpsg"); ?> <?php echo ((trim($this->view['data']['onr']) != '')?$this->view['data']['onr']:$this->view['data']['o_id']); ?>.
-		
-<?php if (wpsg_tf($this->view['storno_fee']) > 0) { ?>
-<?php echo wpsg_translate(__('Darin ist eine GebÃŒhr von #1# #2# enthalten.', 'wpsg'), $this->view['storno_fee'], $this->get_option('wpsg_currency')); ?> 
-  
-<?php } ?>
-<?php echo __("Mit freundlichen GrÃŒÃen", "wpsg"); ?>
- 
-<?php echo __($this->get_option('wpsg_shopdata_name'), 'wpsg'); ?> - <?php echo __('Team', 'wpsg'); ?>
Index: ews/mods/mod_rechnungen/gutschriftmail_html.phtml
===================================================================
--- /views/mods/mod_rechnungen/gutschriftmail_html.phtml	(revision 5959)
+++ 	(revision )
@@ -1,19 +1,0 @@
-<?php 
-
-	/**
-	 * Template fÃŒr die Mail, die beim Schreiben einer Rechnungskorrektur optional an den Kunden versendet werden kann (HTML)
-	 */
-
-	//wpsg_debug($this->view);
-
-?><p><?php echo __("Hallo", "wpsg"); ?> <?php echo $this->view['kunde']['vname']; ?> <?php echo $this->view['kunde']['name']; ?>,</p>
-		
-<p><?php echo __("Sie erhalten hiermit die Rechnungskorrektur in HÃ¶he von", "wpsg"); ?> <?php echo wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')); ?> <?php echo __("fÃŒr Ihre Bestellung mit der Bestellnummer", "wpsg"); ?> <?php echo ((trim($this->view['data']['onr']) != '')?$this->view['data']['onr']:$this->view['data']['o_id']); ?>.</p>
-		
-<?php if (wpsg_tf($this->view['storno_fee']) > 0) { ?>
-<p><?php echo wpsg_translate(__('Darin ist eine GebÃŒhr von #1# #2# enthalten.', 'wpsg'), $this->view['storno_fee'], $this->get_option('wpsg_currency')); ?></p> 
-<?php } ?>
-
-<p><?php echo __("Mit freundlichen GrÃŒÃen", "wpsg"); ?></p>
-
-<p><?php echo __($this->get_option('wpsg_shopdata_name'), 'wpsg'); ?> - <?php echo __('Team', 'wpsg'); ?></p>
Index: /views/mods/mod_rechnungen/invoice_pdf.phtml
===================================================================
--- /views/mods/mod_rechnungen/invoice_pdf.phtml	(revision 5972)
+++ /views/mods/mod_rechnungen/invoice_pdf.phtml	(revision 5972)
@@ -0,0 +1,929 @@
+<?php
+ 
+	/**
+	 * Template fÃŒr die PDF Rechnung
+	 */
+
+	require_once WPSG_PATH_LIB.'fpdf/fpdf.php';
+	require_once WPSG_PATH_LIB.'fpdf/fpdi.php';
+	require_once WPSG_PATH_LIB.'wpsg_fpdf.class.php';
+  
+	global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top;
+	 
+	// Positionierung der Absenderadresszeile
+	$absender_left				= 25;
+	$absender_top				= 50;
+	
+	// Positionierung der Zieladress
+	$adress_left 				= 25;	
+	$adress_top					= 55;
+	
+	// Positionierung des Rechnungskopfes
+	$rdata_left					= 25;
+	$rdata_top					= 90;
+	
+	// Positionierung der Produktdaten
+	$prod_left					= 25;
+	$prod_top					= 105;
+
+	// Anzahl an Produkten pro Seite
+	$prod_break					= $this->get_option('wpsg_rechnungen_pdfperpage');
+	
+	// Damit die Steuer bei der Kleinunternehmerregelung nicht angezeigt wird leer ich den Array sicherheitshalber
+	if ($this->get_option('wpsg_kleinunternehmer') == '1')
+	{
+		
+		unset($this->view['basket']['mwst']);
+		
+	}
+	
+	if (!function_exists('AddRechnungPage'))
+	{
+		
+		function AddRechnungPage($shop, $pdf)
+		{
+			
+			global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top;
+			
+			$pdf->AddPage();
+			
+			if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.pdf"))
+			{
+				
+				$pagecount = $pdf->setSourceFile($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.pdf"); 
+				$tplidx = $pdf->importPage(1, '/MediaBox'); 
+				$pdf->useTemplate($tplidx, 0, 0, 210); 
+				
+			}
+			if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.jpg"))
+			{
+				$pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.jpg", 0, 0, 210, 297, 'jpg');
+			}
+			
+			
+			if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg"))
+			{
+	
+				list($width, $height, $type, $attr) = getimagesize($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg");
+				
+				//wpsg_debug($width.":".$height);
+				
+				$wPix = (25.4 * $width) / 96;
+				$hPix = (25.4 * $height) / 96;  
+				
+				$pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg", 210 - $wPix, 0, $wPix, $hPix);
+				
+			}
+			
+			// Absenderadresszeile (Wird in der Konfiguration hinterlegt)
+			$pdf->SetFont('Arial', '', 6);
+			$pdf->Text($absender_left, $absender_top, $shop->replaceUniversalPlatzhalter(__($shop->get_option("wpsg_rechnungen_adresszeile"), 'wpsg'), $shop->view['data']['id']));	
+			
+			if (wpsg_getStr($shop->view['kunde']['kuerzel']) != "") $shop->view['kunde']['kuerzel'] = $shop->view['kunde']['kuerzel'].'-';
+			
+			// Adresse des Kunden
+			$pdf->SetFont('Arial', '', 12);			
+			$pdf->Text($adress_left, $adress_top, $shop->view['kunde']['firma']);
+			$pdf->Text($adress_left, $adress_top + 5, $shop->view['kunde']['vname'].' '.$shop->view['kunde']['name']);
+			$pdf->Text($adress_left, $adress_top + 10, $shop->view['kunde']['strasse'].' '.wpsg_getStr($shop->view['kunde']['hausnr']));
+			$pdf->Text($adress_left, $adress_top + 15, $shop->view['kunde']['plz'].' '.$shop->view['kunde']['ort']);
+			$pdf->Text($adress_left, $adress_top + 20, strtoupper($shop->view['oOrder']->getInvoiceCountryName()));			
+			
+			// Rechnungsdaten 
+			$pdf->SetFont('Arial', 'B', 16);
+			$pdf->Text($rdata_left, $rdata_top, $shop->view['title']);
+			$pdf->SetFont('Arial', 'B', 9);
+			$pdf->Text($rdata_left, $rdata_top + 6, $shop->view['rnr']);
+			$pdf->SetFont('Arial', '', 9);
+			
+			if (isset($shop->view['faelligkeitdatum']))
+			{
+	
+				$pdf->Text($rdata_left + 35, $rdata_top, __("FÃ€llig am", "wpsg"));
+				$pdf->Text($rdata_left + 35, $rdata_top + 6, $shop->view['faelligkeitdatum']);
+				
+			}
+					
+			if (isset($shop->view['payment']))
+			{
+							
+				$pdf->Text($rdata_left + 58, $rdata_top, __("Zahlungsbedingungen", "wpsg"));
+				$pdf->Text($rdata_left + 58, $rdata_top + 6, $shop->view['payment']);
+				
+			}
+			
+			$pdf->Text($rdata_left + 105, $rdata_top, __("Kunden-Nr", "wpsg"));
+			$pdf->Text($rdata_left + 105, $rdata_top + 6, (($shop->view['kunde']['knr'] != '')?$shop->view['kunde']['knr']:$shop->view['kunde']['id']));
+			
+			$pdf->Text($rdata_left + 135, $rdata_top, __("Best. Nr.", "wpsg"));
+			$pdf->Text($rdata_left + 135, $rdata_top + 6, ((trim($shop->view['data']['onr']) != '')?$shop->view['data']['onr']:$shop->view['data']['id']));
+			
+			$pdf->Text($rdata_left + 155, $rdata_top, __("Datum", "wpsg")); 
+			$pdf->Text($rdata_left + 155, $rdata_top + 6, $shop->view['rDatum']);
+					
+			if ($shop->view['oOrder']->isInnerEu())
+			{
+				 
+				$pdf->SetFont('Arial', '', 9);		
+				$pdf->Text($adress_left, $rdata_top + 11.5, __("Innergemeinschaftliche Lieferung.", "wpsg"));
+				
+			}
+			
+			// Benutzerdefinierte Felder
+			$arTexte = $shop->callMod('wpsg_mod_rechnungen', 'getRechnungstexte', array($shop->view['data']['id']));
+			
+			foreach ((array)$arTexte as $text)
+			{
+				
+				if (isset($text['aktiv']) && $text['aktiv'] == 1)
+				{
+					
+					$pdf->SetFont('Arial', 'B', ((intval($text['fontsize']) > 0)?intval($text['fontsize']):10));
+					$pdf->wpsg_SetTextColor($text['color']);
+					$pdf->wpsg_MultiCell($text['x'], $text['y'], 5, $text['text']); 
+					$pdf->wpsg_SetTextColor("#000000");
+					
+				}
+				
+			}
+			
+		}
+		
+	}
+	//wpsg_debug($this->view); die();
+	$pdf = new wpsg_fpdf();	
+	$pdf->SetAutoPageBreak(true, 5);
+	AddRechnungPage($this, $pdf);
+				
+	$summe = 0;
+	
+	$bKopf = false; $pnr = 1; $offset = 0; $count = 0;
+	foreach ($this->view['basket']['produkte'] as $p)
+	{
+			 
+		if (!$bKopf)
+		{
+
+			$pdf->SetFont('Arial', 'B', 9);
+			$pdf->setXY($prod_left, $prod_top);
+			$pdf->Cell(10, 8, __("Nr.", "wpsg"), 1, 0, 'C');
+
+			$pdf->setXY($prod_left + 10, $prod_top);
+			$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, "Name", 1, 0, 'L');
+			
+			if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
+			{
+			
+				$pdf->setXY($prod_left + 97, $prod_top);
+				$pdf->Cell(15, 8, __("MwSt.", "wpsg"), 1, 0, 'C');
+				
+			}
+			
+			$pdf->setXY($prod_left + 112, $prod_top);
+			$pdf->Cell(15, 8, __("Menge", "wpsg"), 1, 0, 'C');
+						
+			$pdf->setXY($prod_left + 127, $prod_top);
+			$pdf->Cell(25, 8, __("Einzelpreis", "wpsg"), 1, 0, 'R');
+			
+			$pdf->setXY($prod_left + 152, $prod_top);
+			$pdf->Cell(25, 8, __("Gesamtpreis", "wpsg"), 1, 0, 'R');
+			 												
+			$offset = 8;	
+			$bKopf = true;
+			
+		}
+		
+		$pdf->SetFont('Arial', '', 9);
+		$pdf->setXY($prod_left, $prod_top + $offset);
+		
+		if ($this->get_option('wpsg_mod_rechnungen_showanr') == '1')
+		{
+			
+			$pdf->Cell(10, 8, $p['anr'], 0, 0, 'C');
+			
+		}
+		else
+		{
+		
+			$pdf->Cell(10, 8, $pnr.".", 0, 0, 'C');
+			
+		}
+
+		/* Wenn Detailname vorhanden, wird der Detailname auf Rechnung verwendet */
+		$produkt_text = $this->getProductName($this->getProduktID($p['id']), true);
+		
+		/* Falls Detailname vorhanden, wird jetzt der Produktname verwendet */
+		/* $produkt_text = $this->getProductName($this->getProduktID($p['id']), false); */
+		
+		$produktBeschreibung = trim(strip_tags($p['beschreibung']));
+		
+		if ($this->isOtherLang())
+		{ 
+			
+			$trans_db = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_PRODUCTS."` WHERE `lang_parent` = '".wpsg_q($this->getProduktID($p['id']))."' AND `lang_code` = '".wpsg_q($this->getCurrentLanguageCode())."'");
+			
+			if (is_array($trans_db) && sizeof($trans_db) > 0)
+			{
+				
+				$produkt_text = $trans_db['name'];
+				$produktBeschreibung = trim(strip_tags($trans_db['beschreibung']));
+				 
+			}
+			
+		}
+		 
+		$height = 0; // HÃ¶he der Zeile fÃŒr den Rahmen
+		
+		$pdf->setXY($prod_left + 10, $prod_top + $offset);
+		
+		// Produktvariablen 
+		if ($this->hasMod('wpsg_mod_productvars') && $this->get_option("wpsg_mod_rechnungen_showpv") == "1")
+		{
+		 
+			$arPV = $this->callMod('wpsg_mod_productvars', 'getAllProductVarValues', array($this->view['data']['id'], $p['product_index']));
+					
+			if (wpsg_isSizedArray($arPV))
+			{
+				
+				foreach ($arPV as $pv) 
+				{
+				
+					$produkt_text .= "\r\n".$pv['name'].': '.$pv['value'];
+					$height += 5;
+					
+				}
+				
+			}
+			
+		}
+
+		$produkt_text_cell_width = 102;
+		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
+		{
+			$produkt_text_cell_width = 87;	
+		}
+		
+		$produkt_text_width = $pdf->GetStringWidth($produkt_text);
+		//$produkt_text_cell_width = (($this->arMwSt == "-1")?87:102);
+		
+		$height += 5 * ceil($produkt_text_width / $produkt_text_cell_width) + 3;
+		
+		$height_y = $pdf->getY();
+		$height = 2 + $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $offset + 1.5, 5, $produkt_text, 0, 'L', 0, $produkt_text_cell_width);
+		
+		//$height += 3 + 5 + $pdf->getY() - $height_y;
+		//$pdf->Cell((($this->arMwSt == "-1")?102:87), 8, $produkt_text, 0, 0, 'L');
+
+		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
+		{
+		
+			$pdf->setXY($prod_left + 97, $prod_top + $offset);		
+			$pdf->Cell(15, 8, (($this->view['basket']['noMwSt'] == '1')?'0.00 %':wpsg_ff($p['mwst_value'], '%')), 0, 0, 'C');
+			
+		}
+		
+		$pdf->setXY($prod_left + 112, $prod_top + $offset);
+		$pdf->Cell(15, 8, $p['menge'], 0, 0, 'C');
+						
+		if (wpsg_ShopController::get_option('wpsg_preisangaben') == WPSG_NETTO)
+		{
+			$preis = $p['preis_netto'];
+			
+			//TODO
+		}
+		else
+		{
+			$preis = $p['preis_brutto'];
+		}
+		
+		$pdf->setXY($prod_left + 127, $prod_top + $offset);
+		$pdf->Cell(25, 8, wpsg_ff($preis, $this->get_option('wpsg_currency')), 0, 0, 'R');
+		
+		$pdf->setXY($prod_left + 152, $prod_top + $offset);
+		$pdf->Cell(25, 8, wpsg_ff($preis * $p['menge'], $this->get_option('wpsg_currency')), 0, 0, 'R');		
+
+		/**
+		 * Produktbeschreibung anzeigen Ja/Nein
+		 */
+		$pBeschreibungHeight = 0;
+		if ($this->get_option("wpsg_rechnungen_pbeschreibung") == "1" && trim(strip_tags($p['beschreibung'])) != '')
+		{
+			
+			$produktBeschreibung = nl2br($produktBeschreibung);			
+			preg_match_all('/\<br \/\>/', $produktBeschreibung, $treffer);
+			$produktBeschreibung = strip_tags($produktBeschreibung);
+			
+			$pBeschreibungWidth = $pdf->getStringWidth($produktBeschreibung); 
+			$pBeschreibungHeight = 5 * (ceil($pBeschreibungWidth / $produkt_text_cell_width) + @sizeof($treffer[0]));
+			
+			$pdf->SetFont('Arial', 'I', 9);
+			
+			$cellY = $pdf->getY();
+			$pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 1, 5, $produktBeschreibung, 0, 'L', 0, $produkt_text_cell_width);			
+			$pBeschreibungHeight = $pdf->getY() - $cellY - $height + 1;
+			$pdf->SetFont('Arial', '', 9);
+			
+		} 
+					
+		$height += $pBeschreibungHeight;
+
+		/**
+		 * Produktattribute ?
+		 */
+		if ($this->get_option('wpsg_rechnungen_produktattribute') == '1')
+		{
+				
+			$attributeInfo = $this->callMod('wpsg_mod_produktattribute', 'getProductAttributeByProductId', array($this->getProduktId($p['id'])));
+		
+			foreach ($attributeInfo as $pa)
+			{
+					
+				$pa_text = $pa['name'].': '.$pa['value'];
+				$height += $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 0.5, 5, $pa_text, 0, 'L', 0, $produkt_text_cell_width);
+					
+			}
+		}		
+		
+		/**
+		 * Variante ? 
+		 */
+		if (preg_match('/vp_(.*)/', $p['productkey']))
+		{
+			
+			$variInfo = $this->callMod('wpsg_mod_varianten', 'getVariantenInfoArray', array($p['productkey']));
+
+			$height += $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 0.5, 5, wpsg_translate(__('Variante: #1#', 'wpsg'), $variInfo['key']), 0, 'L', 0, $produkt_text_cell_width);			
+			
+			//$height += 5;
+			
+		}
+		
+		if ($this->hasMod('wpsg_mod_deliverynote'))
+		{
+			
+			$arDN_order = $this->callMod('wpsg_mod_deliverynote', 'loadDeliveryNotesFromOrder', array($this->view['data']['id']));
+			
+			if (sizeof($arDN_order) > 1)
+			{
+				
+				$deliveryTimeProduct = $this->callMod('wpsg_mod_deliverynote', 'getProductDeliveryTime', array($this->view['data']['id'], $p['product_index'])); 
+				
+				if ($deliveryTimeProduct !== false)
+				{
+				
+					$height += $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 0.5, 5, wpsg_translate(__('Lieferdatum: #1#', 'wpsg'), date('d.m.Y', $deliveryTimeProduct)), 0, 'L', 0, $produkt_text_cell_width);
+					
+				}
+									
+			}
+			
+		}
+		
+		// Jetzt die Rahmen zeichnen
+		$pdf->Rect($prod_left, $prod_top + $offset, 10, $height);
+		
+		$pdf->Rect($prod_left + 10, $prod_top + $offset, ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), $height);
+		
+		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
+		{
+		
+			$pdf->Rect($prod_left + 97, $prod_top + $offset, 15, $height);
+			
+		}
+		
+		$pdf->Rect($prod_left + 112, $prod_top + $offset, 15, $height);
+		$pdf->Rect($prod_left + 127, $prod_top + $offset, 25, $height);
+		$pdf->Rect($prod_left + 152, $prod_top + $offset, 25, $height);
+		
+		$offset += $height;
+		 		
+		$pnr ++;
+		$count ++;
+				
+		$summe += $p['price'] * $p['menge'];
+		
+		if ($pdf->getY() > 220 || ($count >= $prod_break && sizeof($this->view['basket']['produkte']) > ($pnr - 1)))		
+		{
+			
+			AddRechnungPage($this, $pdf);
+			$bKopf = false; $offset = 0; $count = 0;
+			
+		}
+		
+	} // produkte
+ 
+	// Gutschein
+	if ((isset($this->view['basket']['gs'])) && ($this->view['basket']['gs_value'] > 0))
+	{
+		
+		$pdf->SetFont('Arial', '', 9);
+		$pdf->setXY($prod_left, $prod_top + $offset);
+		$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
+
+		$pdf->setXY($prod_left + 10, $prod_top + $offset);
+		$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, wpsg_translate(__('Gutschein (#1#)', 'wpsg'), $this->view['basket']['gs']['code']), 1, 0, 'L');
+		
+		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
+		{
+		
+			$mwst = __('anteilig', 'wpsg');
+				
+			$pdf->setXY($prod_left + 97, $prod_top + $offset);
+			$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
+			
+		}
+		
+		$pdf->setXY($prod_left + 112, $prod_top + $offset);
+		$pdf->Cell(15, 8, '1', 1, 0, 'C');		
+					
+		/*
+		if ($this->view['basket']['gs']['calc'] == 'w')
+		{
+			
+			$gs_value_einzel = '-'.wpsg_ff($this->view['basket']['gs']['value'], $this->get_option('wpsg_currency'));
+			$gs_value_gesamt = '-'.wpsg_ff($this->view['basket']['gs']['value'], $this->get_option('wpsg_currency'));
+			
+		}
+		else if ($this->view['basket']['gs']['calc'] == 'p')
+		{
+			
+			$gs_value_einzel = '-'.wpsg_ff($this->view['basket']['gs']['value'], '%');
+			$gs_value_gesamt = '-'.wpsg_ff($this->view['basket']['sum']['gs'], $this->get_option('wpsg_currency'));
+			
+		}
+		*/
+		
+		$gs_value_einzel = '-'.wpsg_ff($this->view['basket']['sum']['gs'], $this->get_option('wpsg_currency'));
+		$gs_value_gesamt = '-'.wpsg_ff($this->view['basket']['sum']['gs'], $this->get_option('wpsg_currency'));
+		
+		$pdf->setXY($prod_left + 127, $prod_top + $offset);
+		$pdf->Cell(25, 8, $gs_value_einzel, 1, 0, 'R');
+		
+		$pdf->setXY($prod_left + 152, $prod_top + $offset);
+		$pdf->Cell(25, 8, $gs_value_gesamt, 1, 0, 'R');
+		 												
+		$offset += 8; 
+		
+	} 
+	
+	// Versandkosten
+	if ($this->view['basket']['sum']['preis_shipping'] != '' && $this->view['basket']['sum']['preis_shipping'] != 0)
+	{
+			 
+		$pdf->SetFont('Arial', '', 9);
+		$pdf->setXY($prod_left, $prod_top + $offset);
+		$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
+
+		$pdf->setXY($prod_left + 10, $prod_top + $offset);
+		$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, wpsg_translate(__('Versandkosten "#1#"', 'wpsg'), $this->view['oOrder']->getShippingLabel()), 1, 0, 'L');
+		
+		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
+		{
+		
+			if ($this->arShipping[$this->view['data']['type_shipping']]['mwst_null'] == '1' && $this->view['basket']['noMwSt'] == '1')
+			{
+				
+				$mwst = 0;
+				
+			}
+			else
+			{
+	 
+				if (isset($this->view['basket']['shipping']['tax_rata']) && $this->view['basket']['shipping']['tax_rata'] === true)
+				{
+					
+					$mwst = __('anteilig', 'wpsg');
+											
+				}
+				else
+				{
+					
+					$mwst = wpsg_ff($this->arShipping[$this->view['basket']['checkout']['shipping']]['mwst_value'], '%');
+					
+				}
+				
+				/*
+				if ($this->arShipping[$this->view['data']['type_shipping']]['mwst'] == '0')
+				{
+
+					$mwst = __('anteilig', 'wpsg');
+					
+				}
+				else
+				{
+				
+					$mwst = wpsg_ff($this->arShipping[$this->view['data']['type_shipping']]['mwst_value'], '%');
+					
+				}
+				*/
+				
+			}
+			
+			$pdf->setXY($prod_left + 97, $prod_top + $offset);
+			$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
+ 	
+		}
+		
+		$pdf->setXY($prod_left + 112, $prod_top + $offset);
+		$pdf->Cell(15, 8, '1', 1, 0, 'C');		
+					
+		$pdf->setXY($prod_left + 127, $prod_top + $offset);
+		$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_shipping'], $this->get_option('wpsg_currency')), 1, 0, 'R');
+		
+		$pdf->setXY($prod_left + 152, $prod_top + $offset);
+		$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_shipping'], $this->get_option('wpsg_currency')), 1, 0, 'R');
+		 												
+		$offset += 8;
+
+		// Zusammengesetzte Versandarten darstellen
+		/*
+		if (wpsg_isSizedArray($this->view['basket']['shipping']['methods'])) {
+		
+			foreach ($this->view['basket']['shipping']['methods'] as $shipping) {
+					
+				$pdf->SetFont('Arial', '', 9);
+				$pdf->setXY($prod_left, $prod_top + $offset);
+				$pdf->Cell(10, 8, '', 1, 0, 'C'); $pnr ++;
+					
+				$pdf->setXY($prod_left + 10, $prod_top + $offset);
+				$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, $this->getShippingName($shipping), 1, 0, 'L');
+					
+				if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
+				{
+				
+					if ($this->view['basket']['shipping'][$shipping]['tax_rata'] == 1) { $mwst = __('Anteilig', 'wpsg'); }
+					else { $mwst = wpsg_ff($this->view['basket']['shipping'][$shipping]['mwst'], '%'); }
+					
+					$pdf->setXY($prod_left + 97, $prod_top + $offset);
+					$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
+					
+				}
+				
+				$pdf->setXY($prod_left + 112, $prod_top + $offset);
+				$pdf->Cell(15, 8, '1', 1, 0, 'C');
+					
+				$pdf->setXY($prod_left + 127, $prod_top + $offset);
+				$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['shipping'][$shipping]['preis_shipping_brutto'], $this->get_option('wpsg_currency')), 1, 0, 'R');
+				
+				$pdf->setXY($prod_left + 152, $prod_top + $offset);
+				$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['shipping'][$shipping]['preis_shipping_brutto'], $this->get_option('wpsg_currency')), 1, 0, 'R');
+					
+				$offset += 8;
+				
+			}
+		
+		}
+		*/
+			
+		
+	}
+	
+	// Zahlungskosten
+	if ($this->view['basket']['sum']['preis_payment'] != '' && $this->view['basket']['sum']['preis_payment'] != 0)
+	{
+		
+		$pdf->SetFont('Arial', '', 9);
+		$pdf->setXY($prod_left, $prod_top + $offset);
+		$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
+
+		$pdf->setXY($prod_left + 10, $prod_top + $offset);
+		$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, $this->arPayment[$this->view['data']['type_payment']]['name'], 1, 0, 'L');
+		
+		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
+		{
+		
+			if ($this->arPayment[$this->view['data']['type_payment']]['mwst_null'] == '1' && $this->view['basket']['noMwSt'] == '1')
+			{
+				$mwst = 0;
+			}
+			else
+			{ 
+				
+				if (isset($this->view['basket']['payment']['tax_rata']) && $this->view['basket']['payment']['tax_rata'] === true)
+				{
+						
+					$mwst = __('anteilig', 'wpsg');
+						
+				}
+				else
+				{
+						
+					$mwst = wpsg_ff($this->arPayment[$this->view['basket']['checkout']['payment']]['mwst_value'], '%');
+						
+				}
+				
+				/*
+				if ($this->arPayment[$this->view['data']['type_payment']]['mwst'] == '0')
+				{
+
+					$mwst = __('anteilig', 'wpsg');
+					
+				}
+				else
+				{
+				
+					$mwst = wpsg_ff($this->arPayment[$this->view['data']['type_payment']]['mwst_value'], '%');
+					
+				}
+				*/
+				
+			}
+			
+			$pdf->setXY($prod_left + 97, $prod_top + $offset);
+			$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
+			
+		}
+		
+		$pdf->setXY($prod_left + 112, $prod_top + $offset);
+		$pdf->Cell(15, 8, '1', 1, 0, 'C');		
+					
+		$pdf->setXY($prod_left + 127, $prod_top + $offset);
+		$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_payment'], $this->get_option('wpsg_currency')), 1, 0, 'R');
+		
+		$pdf->setXY($prod_left + 152, $prod_top + $offset);
+		$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_payment'], $this->get_option('wpsg_currency')), 1, 0, 'R');
+		 												
+		$offset += 8;
+		
+	}
+		 	 
+	// GebÃŒhr
+	if (wpsg_tf(wpsg_getStr($this->view['storno_fee'])) > 0)
+	{
+		
+		$pdf->SetFont('Arial', '', 9);
+		$pdf->setXY($prod_left, $prod_top + $offset);
+		$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
+
+		$label = __('BearbeitungsgebÃŒhr', 'wpsg');
+
+		if (strpos($this->view['storno_fee'], '%') !== false) $label .= ' ('.wpsg_ff($this->view['storno_fee'], '%').')';
+		
+		$pdf->setXY($prod_left + 10, $prod_top + $offset);
+		$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, $label, 1, 0, 'L');
+		
+		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
+		{
+		
+			if ($this->view['basket']['noMwSt'] == '1')
+			{
+				$mwst = 0;
+			}
+			else
+			{ 
+				
+				
+				$mwst = wpsg_ff($this->view['storno_fee_tax_value'], '%');
+				
+			}
+			
+			$pdf->setXY($prod_left + 97, $prod_top + $offset);
+			$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
+			
+		}
+		
+		$pdf->setXY($prod_left + 112, $prod_top + $offset);
+		$pdf->Cell(15, 8, '1', 1, 0, 'C');		
+					
+		$pdf->setXY($prod_left + 127, $prod_top + $offset);
+		$pdf->Cell(25, 8, '-'.wpsg_ff($this->view['storno_fee_value'], $this->get_option('wpsg_currency')), 1, 0, 'R');
+		
+		$pdf->setXY($prod_left + 152, $prod_top + $offset);
+		$pdf->Cell(25, 8, '-'.wpsg_ff($this->view['storno_fee_value'], $this->get_option('wpsg_currency')), 1, 0, 'R');
+		 												
+		$offset += 8;
+		
+	}
+	
+	$pdf->SetFont('Arial', '', 9);
+	
+	if ($this->view['kunde']['ustidnr'] != "")
+	{
+		$offset += 10;
+		$pdf->Text($prod_left, $prod_top + $offset, __("Ihre Umsatzsteuer-Identifikationsnummer:", "wpsg"));
+		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
+		$pdf->Cell(37, 8, $this->view['kunde']['ustidnr'], 0, 0, 'R');
+	}
+	
+	$offset += 10;
+	if ($this->get_option('wpsg_kleinunternehmer'))
+	{
+
+		$pdf->Text($prod_left, $prod_top + $offset, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':');
+		$pdf->Text($prod_left + 100, $prod_top + $offset, __("Summe", "wpsg"));
+		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
+		$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'] + $this->view['basket']['sum']['preis_rabatt'], $this->get_option('wpsg_currency')), 0, 0, 'R');
+		$offset += 5;
+		
+	}
+	else
+	{
+		
+		if ($this->view['basket']['noMwSt'] == '1')
+		{
+			
+			$pdf->Text($prod_left, $prod_top + $offset, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':');
+			$pdf->Text($prod_left + 100, $prod_top + $offset, __("BRUTTOBETRAG", "wpsg"));
+			$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
+			$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_netto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
+			$offset += 5;
+			
+			$pdf->Text($prod_left + 100, $prod_top + $offset, __("MwSt. GESAMT", "wpsg"));
+			$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
+			$pdf->Cell(37, 8, wpsg_ff(0, $this->get_option('wpsg_currency')), 0, 0, 'R');
+					
+		}
+		else  
+		{
+			
+			$pdf->Text($prod_left, $prod_top + $offset, __("Der Gesamtbetrag setzt sich wie folgt zusammen", "wpsg"));
+				 
+			$pdf->Text($prod_left + 100, $prod_top + $offset, __("NETTOBETRAG", "wpsg"));
+			$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
+			$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_netto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
+							
+			if (sizeof($this->view['basket']['mwst']) >= 1)
+			{
+				
+				foreach ($this->view['basket']['mwst'] as $mw)
+				{
+					
+					$offset += 5;
+					$pdf->Text($prod_left + 100, $prod_top + $offset, __("MwSt. ", "wpsg").wpsg_ff($mw['value'], '%'));
+					$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
+					$pdf->Cell(37, 8, wpsg_ff($mw['sum'], $this->get_option('wpsg_currency')), 0, 0, 'R');
+					
+				}
+				
+			}
+		 	
+			if (sizeof($this->view['basket']['mwst']) > 1)
+			{
+				
+				$offset += 5;
+				$pdf->Text($prod_left + 100, $prod_top + $offset, __("MwSt. GESAMT", "wpsg"));
+				$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
+				$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'] - $this->view['basket']['sum']['preis_gesamt_netto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
+			
+			}
+	
+		} 
+		
+	}
+	
+	// Rabatt
+	if ($this->view['basket']['sum']['preis_rabatt'] > 0)
+	{
+		
+		$offset += 5;
+		
+		$pdf->Text($prod_left + 100, $prod_top + $offset, __("Rabatt", "wpsg"));
+		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
+		$pdf->Cell(37, 8, '-'.wpsg_ff($this->view['basket']['sum']['preis_rabatt'], $this->get_option('wpsg_currency')), 0, 0, 'R');
+		
+	}
+	 
+	$offset += 5;
+	$pdf->Text($prod_left + 100, $prod_top + $offset, __("SUMME", "wpsg"));
+	$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
+	$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
+
+	if ($this->get_option('wpsg_kleinunternehmer') == '1')
+	{
+ 
+		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset + 5, 5, $this->get_option('wpsg_kleinunternehmer_text')); 
+		$offset += 15;
+		
+	}
+	
+	if ($this->hasMod('wpsg_mod_deliverynote'))
+	{
+		
+		$arDN_order = $this->callMod('wpsg_mod_deliverynote', 'loadDeliveryNotesFromOrder', array($this->view['data']['id']));
+		$delivery_date = $this->callMod('wpsg_mod_deliverynote', 'getDeliveryTime', array($this->view['data']['id']));
+		
+		// Wenn es ein Gesamtlieferdatum gibt und nur einen Lieferschein, dann unter der Bestellung anzeigen
+		if ($delivery_date !== false && sizeof($arDN_order) == 1)
+		{
+			
+			$offset += 10; 
+			
+			$pdf->wpsg_MultiCell($prod_left, $prod_top + $offset, 5, wpsg_translate(__('Lieferung: #1#', 'wpsg'), date('d.m.Y', $delivery_date)));
+
+			$offset += 5;
+			
+		}
+		
+	}
+	
+	$offset += 5;
+	
+	if ($this->view['fussText'] != "")
+	{
+	
+		//$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, utf8_encode($this->view['fussText']));		
+		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, $this->view['fussText']);
+		$pdf->SetFont('Arial', 'B', 9);
+		$offset += 10;	
+		
+	}
+	
+	$shipping_adress = false;
+
+	if ($this->hasMod('wpsg_mod_shippingadress') && $this->callMod('wpsg_mod_shippingadress', 'check_different_shippingadress', array('k_id' => $this->view['data']['k_id'], 'o_id' => $this->view['data']['id'])))
+	{
+ 
+		$pdf->setFont('Arial', 'B', 9);
+		$pdf->Text($prod_left, $prod_top + $offset, __("Lieferanschrift", "wpsg").":");
+		$offset += 5;
+		
+		$pdf->setFont('Arial', '', 9);		
+		
+		$shipping_adress = "";
+		if ($this->view['data']['shipping_firma'] != "")
+		{
+			$shipping_adress .= $this->view['data']['shipping_firma']."\r\n";
+		}
+		$shipping_adress .= $this->view['data']['shipping_vname'].' '.$this->view['data']['shipping_name']."\r\n";
+		$shipping_adress .= $this->view['data']['shipping_strasse']."\r\n";
+		//$shipping_adress .= $this->view['data']['shipping_land']['kuerzel'].'-';
+		
+		$shipping_adress .= $this->view['data']['shipping_plz'].' '.$this->view['data']['shipping_ort']."\r\n";
+		$shipping_adress .= $this->view['data']['shipping_land']['name'];
+		
+		
+		$start = $pdf->getY();
+		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, $shipping_adress, 0, 'L', 0, 100);
+		$offset += $pdf->getY() - $start;
+		
+		$shipping_adress = true;
+		
+	}
+		
+	
+	$offset += 5;
+	 
+	// Bestellvariablen
+	if ($this->hasMod('wpsg_mod_ordervars') && $this->get_option('wpsg_mod_rechnungen_showov') == '1')
+	{
+		
+		$bvars = @unserialize($this->view['data']['bvars']);		
+		if (!is_array($bvars)) $bvars = array();
+		
+		$strBVars = "";
+		foreach ($bvars as $bvars_id => $bvars_value)
+		{
+				
+			$bvars = $this->db->fetchRow("SELECT * FROM `".wpsg_q(WPSG_TBL_ORDERVARS)."` WHERE `id` = '".wpsg_q($bvars_id)."' ORDER BY `pos` ASC, `id` ASC ");
+			
+			if ($bvars['typ'] == "1") // Auswahl
+			{
+				if ($bvars_value <= 0) $bvars_value = __("Keine Angabe", "wpsg");
+			}
+			else if ($bvars['typ'] == "2") // Texteingabe
+			{
+				if (trim($bvars_value) == "") $bvars_value = __("Keine Angabe", "wpsg");
+			}
+			else if ($bvars['typ'] == "3") // Checkbox
+			{
+				if ($bvars_value <= 0) $bvars_value = __("Keine Angabe", "wpsg");					
+			}
+			
+			$bvars_name = $this->callMod('wpsg_mod_ordervars', 'getNameById', array($bvars_id));			
+			$strBVars .= "\r\n".$bvars_name.": ".$bvars_value;	
+			
+		}
+		
+		$pdf->SetFont('Arial', 'B', 9);	
+		$pdf->Text($prod_left, $prod_top + $offset, __("Angaben wÃ€hrend der Bestellung", "wpsg").":");
+		$pdf->SetFont('Arial', '', 9);
+		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, $strBVars);
+		
+	}  
+	
+	if (!file_exists($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id']))))
+	{
+		
+		mkdir($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id'])), 0777, true);
+		
+	}
+	
+	$this->callMods('wpsg_mod_rechnungen_pdf', array(&$pdf, &$this->view['data']['id'], &$this->view['preview'], &$this->view['invoice']));
+	
+	$filename = $this->view['filename'].".pdf";
+	 
+	if ($this->view['preview'])
+	{
+		$pdf->Output($filename, 'I');
+	}
+	else
+	{
+		
+		$pdf->Output($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id'])).$filename, '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');
+			
+	} 
+	 
+?>
Index: /views/mods/mod_rechnungen/invoicemail.phtml
===================================================================
--- /views/mods/mod_rechnungen/invoicemail.phtml	(revision 5972)
+++ /views/mods/mod_rechnungen/invoicemail.phtml	(revision 5972)
@@ -0,0 +1,16 @@
+<?php 
+
+	/**
+	 * Template fÃŒr die Mail, die beim Schreiben einer Rechnung optional an den Kunden versendet werden kann
+	 */
+
+	//wpsg_debug($this->view);
+
+?><?php echo __("Hallo", "wpsg"); ?> <?php echo $this->view['kunde']['vname']; ?> <?php echo $this->view['kunde']['name']; ?>,
+		
+<?php echo __("Sie erhalten hiermit die Rechnung in HÃ¶he von", "wpsg"); ?> <?php echo wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')); ?> <?php echo __("fÃŒr Ihre Bestellung mit der Bestellnummer", "wpsg"); ?> <?php echo ((trim($this->view['data']['onr']) != '')?$this->view['data']['onr']:$this->view['data']['o_id']); ?>.
+<?php $this->callMods('wpsg_mod_rechnungen_mail'); ?>
+ 
+<?php echo __("Mit freundlichen GrÃŒÃen", "wpsg"); ?>
+ 
+<?php echo __($this->get_option('wpsg_shopdata_name'), 'wpsg'); ?> - <?php echo __('Team', 'wpsg'); ?>
Index: /views/mods/mod_rechnungen/invoicemail_html.phtml
===================================================================
--- /views/mods/mod_rechnungen/invoicemail_html.phtml	(revision 5972)
+++ /views/mods/mod_rechnungen/invoicemail_html.phtml	(revision 5972)
@@ -0,0 +1,20 @@
+<?php 
+
+	/**
+	 * Template fÃŒr die Mail, die beim Schreiben einer Rechnung optional an den Kunden versendet werden kann (HTML)
+	 */
+
+	/* Wichtig, da die Module sonst kein HTML zurÃŒckgeben */
+	$this->htmlMail = true;
+
+	//wpsg_debug($this->view);
+
+?><p><?php echo __("Hallo", "wpsg"); ?> <?php echo $this->view['kunde']['vname']; ?> <?php echo $this->view['kunde']['name']; ?>,</p>
+		
+<p><?php echo __("Sie erhalten hiermit die Rechnung in HÃ¶he von", "wpsg"); ?> <?php echo wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')); ?> <?php echo __("fÃŒr Ihre Bestellung mit der Bestellnummer", "wpsg"); ?> <?php echo ((trim($this->view['data']['onr']) != '')?$this->view['data']['onr']:$this->view['data']['o_id']); ?>.</p>
+
+<?php $this->callMods('wpsg_mod_rechnungen_mail'); ?>
+ 
+<p><?php echo __("Mit freundlichen GrÃŒÃen", "wpsg"); ?></p>
+ 
+<p><?php echo __($this->get_option('wpsg_shopdata_name'), 'wpsg'); ?> - <?php echo __('Team', 'wpsg'); ?></p>
Index: ews/mods/mod_rechnungen/rechnung_pdf.phtml
===================================================================
--- /views/mods/mod_rechnungen/rechnung_pdf.phtml	(revision 5959)
+++ 	(revision )
@@ -1,929 +1,0 @@
-<?php
- 
-	/**
-	 * Template fÃŒr die PDF Rechnung
-	 */
-
-	require_once WPSG_PATH_LIB.'fpdf/fpdf.php';
-	require_once WPSG_PATH_LIB.'fpdf/fpdi.php';
-	require_once WPSG_PATH_LIB.'wpsg_fpdf.class.php';
-  
-	global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top;
-	 
-	// Positionierung der Absenderadresszeile
-	$absender_left				= 25;
-	$absender_top				= 50;
-	
-	// Positionierung der Zieladress
-	$adress_left 				= 25;	
-	$adress_top					= 55;
-	
-	// Positionierung des Rechnungskopfes
-	$rdata_left					= 25;
-	$rdata_top					= 90;
-	
-	// Positionierung der Produktdaten
-	$prod_left					= 25;
-	$prod_top					= 105;
-
-	// Anzahl an Produkten pro Seite
-	$prod_break					= $this->get_option('wpsg_rechnungen_pdfperpage');
-	
-	// Damit die Steuer bei der Kleinunternehmerregelung nicht angezeigt wird leer ich den Array sicherheitshalber
-	if ($this->get_option('wpsg_kleinunternehmer') == '1')
-	{
-		
-		unset($this->view['basket']['mwst']);
-		
-	}
-	
-	if (!function_exists('AddRechnungPage'))
-	{
-		
-		function AddRechnungPage($shop, $pdf)
-		{
-			
-			global $absender_left, $absender_top, $adress_left, $adress_top, $rdata_left, $rdata_top;
-			
-			$pdf->AddPage();
-			
-			if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.pdf"))
-			{
-				
-				$pagecount = $pdf->setSourceFile($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.pdf"); 
-				$tplidx = $pdf->importPage(1, '/MediaBox'); 
-				$pdf->useTemplate($tplidx, 0, 0, 210); 
-				
-			}
-			if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.jpg"))
-			{
-				$pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_bp.jpg", 0, 0, 210, 297, 'jpg');
-			}
-			
-			
-			if (file_exists($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg"))
-			{
-	
-				list($width, $height, $type, $attr) = getimagesize($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg");
-				
-				//wpsg_debug($width.":".$height);
-				
-				$wPix = (25.4 * $width) / 96;
-				$hPix = (25.4 * $height) / 96;  
-				
-				$pdf->image($shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array(''))."wpsg_rechnungen_logo.jpg", 210 - $wPix, 0, $wPix, $hPix);
-				
-			}
-			
-			// Absenderadresszeile (Wird in der Konfiguration hinterlegt)
-			$pdf->SetFont('Arial', '', 6);
-			$pdf->Text($absender_left, $absender_top, $shop->replaceUniversalPlatzhalter(__($shop->get_option("wpsg_rechnungen_adresszeile"), 'wpsg'), $shop->view['data']['id']));	
-			
-			if (wpsg_getStr($shop->view['kunde']['kuerzel']) != "") $shop->view['kunde']['kuerzel'] = $shop->view['kunde']['kuerzel'].'-';
-			
-			// Adresse des Kunden
-			$pdf->SetFont('Arial', '', 12);			
-			$pdf->Text($adress_left, $adress_top, $shop->view['kunde']['firma']);
-			$pdf->Text($adress_left, $adress_top + 5, $shop->view['kunde']['vname'].' '.$shop->view['kunde']['name']);
-			$pdf->Text($adress_left, $adress_top + 10, $shop->view['kunde']['strasse'].' '.wpsg_getStr($shop->view['kunde']['hausnr']));
-			$pdf->Text($adress_left, $adress_top + 15, $shop->view['kunde']['plz'].' '.$shop->view['kunde']['ort']);
-			$pdf->Text($adress_left, $adress_top + 20, strtoupper($shop->view['oOrder']->getInvoiceCountryName()));			
-			
-			// Rechnungsdaten 
-			$pdf->SetFont('Arial', 'B', 16);
-			$pdf->Text($rdata_left, $rdata_top, $shop->view['title']);
-			$pdf->SetFont('Arial', 'B', 9);
-			$pdf->Text($rdata_left, $rdata_top + 6, $shop->view['rnr']);
-			$pdf->SetFont('Arial', '', 9);
-			
-			if (isset($shop->view['faelligkeitdatum']))
-			{
-	
-				$pdf->Text($rdata_left + 35, $rdata_top, __("FÃ€llig am", "wpsg"));
-				$pdf->Text($rdata_left + 35, $rdata_top + 6, $shop->view['faelligkeitdatum']);
-				
-			}
-					
-			if (isset($shop->view['payment']))
-			{
-							
-				$pdf->Text($rdata_left + 58, $rdata_top, __("Zahlungsbedingungen", "wpsg"));
-				$pdf->Text($rdata_left + 58, $rdata_top + 6, $shop->view['payment']);
-				
-			}
-			
-			$pdf->Text($rdata_left + 105, $rdata_top, __("Kunden-Nr", "wpsg"));
-			$pdf->Text($rdata_left + 105, $rdata_top + 6, (($shop->view['kunde']['knr'] != '')?$shop->view['kunde']['knr']:$shop->view['kunde']['id']));
-			
-			$pdf->Text($rdata_left + 135, $rdata_top, __("Best. Nr.", "wpsg"));
-			$pdf->Text($rdata_left + 135, $rdata_top + 6, ((trim($shop->view['data']['onr']) != '')?$shop->view['data']['onr']:$shop->view['data']['id']));
-			
-			$pdf->Text($rdata_left + 155, $rdata_top, __("Datum", "wpsg")); 
-			$pdf->Text($rdata_left + 155, $rdata_top + 6, $shop->view['rDatum']);
-					
-			if ($shop->view['oOrder']->isInnerEu())
-			{
-				 
-				$pdf->SetFont('Arial', '', 9);		
-				$pdf->Text($adress_left, $rdata_top + 11.5, __("Innergemeinschaftliche Lieferung.", "wpsg"));
-				
-			}
-			
-			// Benutzerdefinierte Felder
-			$arTexte = $shop->callMod('wpsg_mod_rechnungen', 'getRechnungstexte', array($shop->view['data']['id']));
-			
-			foreach ((array)$arTexte as $text)
-			{
-				
-				if (isset($text['aktiv']) && $text['aktiv'] == 1)
-				{
-					
-					$pdf->SetFont('Arial', 'B', ((intval($text['fontsize']) > 0)?intval($text['fontsize']):10));
-					$pdf->wpsg_SetTextColor($text['color']);
-					$pdf->wpsg_MultiCell($text['x'], $text['y'], 5, $text['text']); 
-					$pdf->wpsg_SetTextColor("#000000");
-					
-				}
-				
-			}
-			
-		}
-		
-	}
-	//wpsg_debug($this->view); die();
-	$pdf = new wpsg_fpdf();	
-	$pdf->SetAutoPageBreak(true, 5);
-	AddRechnungPage($this, $pdf);
-				
-	$summe = 0;
-	
-	$bKopf = false; $pnr = 1; $offset = 0; $count = 0;
-	foreach ($this->view['basket']['produkte'] as $p)
-	{
-			 
-		if (!$bKopf)
-		{
-
-			$pdf->SetFont('Arial', 'B', 9);
-			$pdf->setXY($prod_left, $prod_top);
-			$pdf->Cell(10, 8, __("Nr.", "wpsg"), 1, 0, 'C');
-
-			$pdf->setXY($prod_left + 10, $prod_top);
-			$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, "Name", 1, 0, 'L');
-			
-			if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
-			{
-			
-				$pdf->setXY($prod_left + 97, $prod_top);
-				$pdf->Cell(15, 8, __("MwSt.", "wpsg"), 1, 0, 'C');
-				
-			}
-			
-			$pdf->setXY($prod_left + 112, $prod_top);
-			$pdf->Cell(15, 8, __("Menge", "wpsg"), 1, 0, 'C');
-						
-			$pdf->setXY($prod_left + 127, $prod_top);
-			$pdf->Cell(25, 8, __("Einzelpreis", "wpsg"), 1, 0, 'R');
-			
-			$pdf->setXY($prod_left + 152, $prod_top);
-			$pdf->Cell(25, 8, __("Gesamtpreis", "wpsg"), 1, 0, 'R');
-			 												
-			$offset = 8;	
-			$bKopf = true;
-			
-		}
-		
-		$pdf->SetFont('Arial', '', 9);
-		$pdf->setXY($prod_left, $prod_top + $offset);
-		
-		if ($this->get_option('wpsg_mod_rechnungen_showanr') == '1')
-		{
-			
-			$pdf->Cell(10, 8, $p['anr'], 0, 0, 'C');
-			
-		}
-		else
-		{
-		
-			$pdf->Cell(10, 8, $pnr.".", 0, 0, 'C');
-			
-		}
-
-		/* Wenn Detailname vorhanden, wird der Detailname auf Rechnung verwendet */
-		$produkt_text = $this->getProductName($this->getProduktID($p['id']), true);
-		
-		/* Falls Detailname vorhanden, wird jetzt der Produktname verwendet */
-		/* $produkt_text = $this->getProductName($this->getProduktID($p['id']), false); */
-		
-		$produktBeschreibung = trim(strip_tags($p['beschreibung']));
-		
-		if ($this->isOtherLang())
-		{ 
-			
-			$trans_db = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_PRODUCTS."` WHERE `lang_parent` = '".wpsg_q($this->getProduktID($p['id']))."' AND `lang_code` = '".wpsg_q($this->getCurrentLanguageCode())."'");
-			
-			if (is_array($trans_db) && sizeof($trans_db) > 0)
-			{
-				
-				$produkt_text = $trans_db['name'];
-				$produktBeschreibung = trim(strip_tags($trans_db['beschreibung']));
-				 
-			}
-			
-		}
-		 
-		$height = 0; // HÃ¶he der Zeile fÃŒr den Rahmen
-		
-		$pdf->setXY($prod_left + 10, $prod_top + $offset);
-		
-		// Produktvariablen 
-		if ($this->hasMod('wpsg_mod_productvars') && $this->get_option("wpsg_mod_rechnungen_showpv") == "1")
-		{
-		 
-			$arPV = $this->callMod('wpsg_mod_productvars', 'getAllProductVarValues', array($this->view['data']['id'], $p['product_index']));
-					
-			if (wpsg_isSizedArray($arPV))
-			{
-				
-				foreach ($arPV as $pv) 
-				{
-				
-					$produkt_text .= "\r\n".$pv['name'].': '.$pv['value'];
-					$height += 5;
-					
-				}
-				
-			}
-			
-		}
-
-		$produkt_text_cell_width = 102;
-		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
-		{
-			$produkt_text_cell_width = 87;	
-		}
-		
-		$produkt_text_width = $pdf->GetStringWidth($produkt_text);
-		//$produkt_text_cell_width = (($this->arMwSt == "-1")?87:102);
-		
-		$height += 5 * ceil($produkt_text_width / $produkt_text_cell_width) + 3;
-		
-		$height_y = $pdf->getY();
-		$height = 2 + $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $offset + 1.5, 5, $produkt_text, 0, 'L', 0, $produkt_text_cell_width);
-		
-		//$height += 3 + 5 + $pdf->getY() - $height_y;
-		//$pdf->Cell((($this->arMwSt == "-1")?102:87), 8, $produkt_text, 0, 0, 'L');
-
-		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
-		{
-		
-			$pdf->setXY($prod_left + 97, $prod_top + $offset);		
-			$pdf->Cell(15, 8, (($this->view['basket']['noMwSt'] == '1')?'0.00 %':wpsg_ff($p['mwst_value'], '%')), 0, 0, 'C');
-			
-		}
-		
-		$pdf->setXY($prod_left + 112, $prod_top + $offset);
-		$pdf->Cell(15, 8, $p['menge'], 0, 0, 'C');
-						
-		if (wpsg_ShopController::get_option('wpsg_preisangaben') == WPSG_NETTO)
-		{
-			$preis = $p['preis_netto'];
-			
-			//TODO
-		}
-		else
-		{
-			$preis = $p['preis_brutto'];
-		}
-		
-		$pdf->setXY($prod_left + 127, $prod_top + $offset);
-		$pdf->Cell(25, 8, wpsg_ff($preis, $this->get_option('wpsg_currency')), 0, 0, 'R');
-		
-		$pdf->setXY($prod_left + 152, $prod_top + $offset);
-		$pdf->Cell(25, 8, wpsg_ff($preis * $p['menge'], $this->get_option('wpsg_currency')), 0, 0, 'R');		
-
-		/**
-		 * Produktbeschreibung anzeigen Ja/Nein
-		 */
-		$pBeschreibungHeight = 0;
-		if ($this->get_option("wpsg_rechnungen_pbeschreibung") == "1" && trim(strip_tags($p['beschreibung'])) != '')
-		{
-			
-			$produktBeschreibung = nl2br($produktBeschreibung);			
-			preg_match_all('/\<br \/\>/', $produktBeschreibung, $treffer);
-			$produktBeschreibung = strip_tags($produktBeschreibung);
-			
-			$pBeschreibungWidth = $pdf->getStringWidth($produktBeschreibung); 
-			$pBeschreibungHeight = 5 * (ceil($pBeschreibungWidth / $produkt_text_cell_width) + @sizeof($treffer[0]));
-			
-			$pdf->SetFont('Arial', 'I', 9);
-			
-			$cellY = $pdf->getY();
-			$pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 1, 5, $produktBeschreibung, 0, 'L', 0, $produkt_text_cell_width);			
-			$pBeschreibungHeight = $pdf->getY() - $cellY - $height + 1;
-			$pdf->SetFont('Arial', '', 9);
-			
-		} 
-					
-		$height += $pBeschreibungHeight;
-
-		/**
-		 * Produktattribute ?
-		 */
-		if ($this->get_option('wpsg_rechnungen_produktattribute') == '1')
-		{
-				
-			$attributeInfo = $this->callMod('wpsg_mod_produktattribute', 'getProductAttributeByProductId', array($this->getProduktId($p['id'])));
-		
-			foreach ($attributeInfo as $pa)
-			{
-					
-				$pa_text = $pa['name'].': '.$pa['value'];
-				$height += $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 0.5, 5, $pa_text, 0, 'L', 0, $produkt_text_cell_width);
-					
-			}
-		}		
-		
-		/**
-		 * Variante ? 
-		 */
-		if (preg_match('/vp_(.*)/', $p['productkey']))
-		{
-			
-			$variInfo = $this->callMod('wpsg_mod_varianten', 'getVariantenInfoArray', array($p['productkey']));
-
-			$height += $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 0.5, 5, wpsg_translate(__('Variante: #1#', 'wpsg'), $variInfo['key']), 0, 'L', 0, $produkt_text_cell_width);			
-			
-			//$height += 5;
-			
-		}
-		
-		if ($this->hasMod('wpsg_mod_deliverynote'))
-		{
-			
-			$arDN_order = $this->callMod('wpsg_mod_deliverynote', 'loadDeliveryNotesFromOrder', array($this->view['data']['id']));
-			
-			if (sizeof($arDN_order) > 1)
-			{
-				
-				$deliveryTimeProduct = $this->callMod('wpsg_mod_deliverynote', 'getProductDeliveryTime', array($this->view['data']['id'], $p['product_index'])); 
-				
-				if ($deliveryTimeProduct !== false)
-				{
-				
-					$height += $pdf->wpsg_MultiCell($prod_left + 10, $prod_top + $height + $offset - 0.5, 5, wpsg_translate(__('Lieferdatum: #1#', 'wpsg'), date('d.m.Y', $deliveryTimeProduct)), 0, 'L', 0, $produkt_text_cell_width);
-					
-				}
-									
-			}
-			
-		}
-		
-		// Jetzt die Rahmen zeichnen
-		$pdf->Rect($prod_left, $prod_top + $offset, 10, $height);
-		
-		$pdf->Rect($prod_left + 10, $prod_top + $offset, ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), $height);
-		
-		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
-		{
-		
-			$pdf->Rect($prod_left + 97, $prod_top + $offset, 15, $height);
-			
-		}
-		
-		$pdf->Rect($prod_left + 112, $prod_top + $offset, 15, $height);
-		$pdf->Rect($prod_left + 127, $prod_top + $offset, 25, $height);
-		$pdf->Rect($prod_left + 152, $prod_top + $offset, 25, $height);
-		
-		$offset += $height;
-		 		
-		$pnr ++;
-		$count ++;
-				
-		$summe += $p['price'] * $p['menge'];
-		
-		if ($pdf->getY() > 220 || ($count >= $prod_break && sizeof($this->view['basket']['produkte']) > ($pnr - 1)))		
-		{
-			
-			AddRechnungPage($this, $pdf);
-			$bKopf = false; $offset = 0; $count = 0;
-			
-		}
-		
-	} // produkte
- 
-	// Gutschein
-	if ((isset($this->view['basket']['gs'])) && ($this->view['basket']['gs_value'] > 0))
-	{
-		
-		$pdf->SetFont('Arial', '', 9);
-		$pdf->setXY($prod_left, $prod_top + $offset);
-		$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
-
-		$pdf->setXY($prod_left + 10, $prod_top + $offset);
-		$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, wpsg_translate(__('Gutschein (#1#)', 'wpsg'), $this->view['basket']['gs']['code']), 1, 0, 'L');
-		
-		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
-		{
-		
-			$mwst = __('anteilig', 'wpsg');
-				
-			$pdf->setXY($prod_left + 97, $prod_top + $offset);
-			$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
-			
-		}
-		
-		$pdf->setXY($prod_left + 112, $prod_top + $offset);
-		$pdf->Cell(15, 8, '1', 1, 0, 'C');		
-					
-		/*
-		if ($this->view['basket']['gs']['calc'] == 'w')
-		{
-			
-			$gs_value_einzel = '-'.wpsg_ff($this->view['basket']['gs']['value'], $this->get_option('wpsg_currency'));
-			$gs_value_gesamt = '-'.wpsg_ff($this->view['basket']['gs']['value'], $this->get_option('wpsg_currency'));
-			
-		}
-		else if ($this->view['basket']['gs']['calc'] == 'p')
-		{
-			
-			$gs_value_einzel = '-'.wpsg_ff($this->view['basket']['gs']['value'], '%');
-			$gs_value_gesamt = '-'.wpsg_ff($this->view['basket']['sum']['gs'], $this->get_option('wpsg_currency'));
-			
-		}
-		*/
-		
-		$gs_value_einzel = '-'.wpsg_ff($this->view['basket']['sum']['gs'], $this->get_option('wpsg_currency'));
-		$gs_value_gesamt = '-'.wpsg_ff($this->view['basket']['sum']['gs'], $this->get_option('wpsg_currency'));
-		
-		$pdf->setXY($prod_left + 127, $prod_top + $offset);
-		$pdf->Cell(25, 8, $gs_value_einzel, 1, 0, 'R');
-		
-		$pdf->setXY($prod_left + 152, $prod_top + $offset);
-		$pdf->Cell(25, 8, $gs_value_gesamt, 1, 0, 'R');
-		 												
-		$offset += 8; 
-		
-	} 
-	
-	// Versandkosten
-	if ($this->view['basket']['sum']['preis_shipping'] != '' && $this->view['basket']['sum']['preis_shipping'] != 0)
-	{
-			 
-		$pdf->SetFont('Arial', '', 9);
-		$pdf->setXY($prod_left, $prod_top + $offset);
-		$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
-
-		$pdf->setXY($prod_left + 10, $prod_top + $offset);
-		$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, wpsg_translate(__('Versandkosten "#1#"', 'wpsg'), $this->view['oOrder']->getShippingLabel()), 1, 0, 'L');
-		
-		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
-		{
-		
-			if ($this->arShipping[$this->view['data']['type_shipping']]['mwst_null'] == '1' && $this->view['basket']['noMwSt'] == '1')
-			{
-				
-				$mwst = 0;
-				
-			}
-			else
-			{
-	 
-				if (isset($this->view['basket']['shipping']['tax_rata']) && $this->view['basket']['shipping']['tax_rata'] === true)
-				{
-					
-					$mwst = __('anteilig', 'wpsg');
-											
-				}
-				else
-				{
-					
-					$mwst = wpsg_ff($this->arShipping[$this->view['basket']['checkout']['shipping']]['mwst_value'], '%');
-					
-				}
-				
-				/*
-				if ($this->arShipping[$this->view['data']['type_shipping']]['mwst'] == '0')
-				{
-
-					$mwst = __('anteilig', 'wpsg');
-					
-				}
-				else
-				{
-				
-					$mwst = wpsg_ff($this->arShipping[$this->view['data']['type_shipping']]['mwst_value'], '%');
-					
-				}
-				*/
-				
-			}
-			
-			$pdf->setXY($prod_left + 97, $prod_top + $offset);
-			$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
- 	
-		}
-		
-		$pdf->setXY($prod_left + 112, $prod_top + $offset);
-		$pdf->Cell(15, 8, '1', 1, 0, 'C');		
-					
-		$pdf->setXY($prod_left + 127, $prod_top + $offset);
-		$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_shipping'], $this->get_option('wpsg_currency')), 1, 0, 'R');
-		
-		$pdf->setXY($prod_left + 152, $prod_top + $offset);
-		$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_shipping'], $this->get_option('wpsg_currency')), 1, 0, 'R');
-		 												
-		$offset += 8;
-
-		// Zusammengesetzte Versandarten darstellen
-		/*
-		if (wpsg_isSizedArray($this->view['basket']['shipping']['methods'])) {
-		
-			foreach ($this->view['basket']['shipping']['methods'] as $shipping) {
-					
-				$pdf->SetFont('Arial', '', 9);
-				$pdf->setXY($prod_left, $prod_top + $offset);
-				$pdf->Cell(10, 8, '', 1, 0, 'C'); $pnr ++;
-					
-				$pdf->setXY($prod_left + 10, $prod_top + $offset);
-				$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, $this->getShippingName($shipping), 1, 0, 'L');
-					
-				if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
-				{
-				
-					if ($this->view['basket']['shipping'][$shipping]['tax_rata'] == 1) { $mwst = __('Anteilig', 'wpsg'); }
-					else { $mwst = wpsg_ff($this->view['basket']['shipping'][$shipping]['mwst'], '%'); }
-					
-					$pdf->setXY($prod_left + 97, $prod_top + $offset);
-					$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
-					
-				}
-				
-				$pdf->setXY($prod_left + 112, $prod_top + $offset);
-				$pdf->Cell(15, 8, '1', 1, 0, 'C');
-					
-				$pdf->setXY($prod_left + 127, $prod_top + $offset);
-				$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['shipping'][$shipping]['preis_shipping_brutto'], $this->get_option('wpsg_currency')), 1, 0, 'R');
-				
-				$pdf->setXY($prod_left + 152, $prod_top + $offset);
-				$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['shipping'][$shipping]['preis_shipping_brutto'], $this->get_option('wpsg_currency')), 1, 0, 'R');
-					
-				$offset += 8;
-				
-			}
-		
-		}
-		*/
-			
-		
-	}
-	
-	// Zahlungskosten
-	if ($this->view['basket']['sum']['preis_payment'] != '' && $this->view['basket']['sum']['preis_payment'] != 0)
-	{
-		
-		$pdf->SetFont('Arial', '', 9);
-		$pdf->setXY($prod_left, $prod_top + $offset);
-		$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
-
-		$pdf->setXY($prod_left + 10, $prod_top + $offset);
-		$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, $this->arPayment[$this->view['data']['type_payment']]['name'], 1, 0, 'L');
-		
-		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
-		{
-		
-			if ($this->arPayment[$this->view['data']['type_payment']]['mwst_null'] == '1' && $this->view['basket']['noMwSt'] == '1')
-			{
-				$mwst = 0;
-			}
-			else
-			{ 
-				
-				if (isset($this->view['basket']['payment']['tax_rata']) && $this->view['basket']['payment']['tax_rata'] === true)
-				{
-						
-					$mwst = __('anteilig', 'wpsg');
-						
-				}
-				else
-				{
-						
-					$mwst = wpsg_ff($this->arPayment[$this->view['basket']['checkout']['payment']]['mwst_value'], '%');
-						
-				}
-				
-				/*
-				if ($this->arPayment[$this->view['data']['type_payment']]['mwst'] == '0')
-				{
-
-					$mwst = __('anteilig', 'wpsg');
-					
-				}
-				else
-				{
-				
-					$mwst = wpsg_ff($this->arPayment[$this->view['data']['type_payment']]['mwst_value'], '%');
-					
-				}
-				*/
-				
-			}
-			
-			$pdf->setXY($prod_left + 97, $prod_top + $offset);
-			$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
-			
-		}
-		
-		$pdf->setXY($prod_left + 112, $prod_top + $offset);
-		$pdf->Cell(15, 8, '1', 1, 0, 'C');		
-					
-		$pdf->setXY($prod_left + 127, $prod_top + $offset);
-		$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_payment'], $this->get_option('wpsg_currency')), 1, 0, 'R');
-		
-		$pdf->setXY($prod_left + 152, $prod_top + $offset);
-		$pdf->Cell(25, 8, wpsg_ff($this->view['basket']['sum']['preis_payment'], $this->get_option('wpsg_currency')), 1, 0, 'R');
-		 												
-		$offset += 8;
-		
-	}
-		 	 
-	// GebÃŒhr
-	if (wpsg_tf(wpsg_getStr($this->view['storno_fee'])) > 0)
-	{
-		
-		$pdf->SetFont('Arial', '', 9);
-		$pdf->setXY($prod_left, $prod_top + $offset);
-		$pdf->Cell(10, 8, $pnr.'.', 1, 0, 'C'); $pnr ++;
-
-		$label = __('BearbeitungsgebÃŒhr', 'wpsg');
-
-		if (strpos($this->view['storno_fee'], '%') !== false) $label .= ' ('.wpsg_ff($this->view['storno_fee'], '%').')';
-		
-		$pdf->setXY($prod_left + 10, $prod_top + $offset);
-		$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, $label, 1, 0, 'L');
-		
-		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
-		{
-		
-			if ($this->view['basket']['noMwSt'] == '1')
-			{
-				$mwst = 0;
-			}
-			else
-			{ 
-				
-				
-				$mwst = wpsg_ff($this->view['storno_fee_tax_value'], '%');
-				
-			}
-			
-			$pdf->setXY($prod_left + 97, $prod_top + $offset);
-			$pdf->Cell(15, 8, $mwst, 1, 0, 'C');
-			
-		}
-		
-		$pdf->setXY($prod_left + 112, $prod_top + $offset);
-		$pdf->Cell(15, 8, '1', 1, 0, 'C');		
-					
-		$pdf->setXY($prod_left + 127, $prod_top + $offset);
-		$pdf->Cell(25, 8, '-'.wpsg_ff($this->view['storno_fee_value'], $this->get_option('wpsg_currency')), 1, 0, 'R');
-		
-		$pdf->setXY($prod_left + 152, $prod_top + $offset);
-		$pdf->Cell(25, 8, '-'.wpsg_ff($this->view['storno_fee_value'], $this->get_option('wpsg_currency')), 1, 0, 'R');
-		 												
-		$offset += 8;
-		
-	}
-	
-	$pdf->SetFont('Arial', '', 9);
-	
-	if ($this->view['kunde']['ustidnr'] != "")
-	{
-		$offset += 10;
-		$pdf->Text($prod_left, $prod_top + $offset, __("Ihre Umsatzsteuer-Identifikationsnummer:", "wpsg"));
-		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
-		$pdf->Cell(37, 8, $this->view['kunde']['ustidnr'], 0, 0, 'R');
-	}
-	
-	$offset += 10;
-	if ($this->get_option('wpsg_kleinunternehmer'))
-	{
-
-		$pdf->Text($prod_left, $prod_top + $offset, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':');
-		$pdf->Text($prod_left + 100, $prod_top + $offset, __("Summe", "wpsg"));
-		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
-		$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'] + $this->view['basket']['sum']['preis_rabatt'], $this->get_option('wpsg_currency')), 0, 0, 'R');
-		$offset += 5;
-		
-	}
-	else
-	{
-		
-		if ($this->view['basket']['noMwSt'] == '1')
-		{
-			
-			$pdf->Text($prod_left, $prod_top + $offset, __("Es ergibt sich folgender Gesamtbetrag", "wpsg").':');
-			$pdf->Text($prod_left + 100, $prod_top + $offset, __("BRUTTOBETRAG", "wpsg"));
-			$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
-			$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_netto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
-			$offset += 5;
-			
-			$pdf->Text($prod_left + 100, $prod_top + $offset, __("MwSt. GESAMT", "wpsg"));
-			$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
-			$pdf->Cell(37, 8, wpsg_ff(0, $this->get_option('wpsg_currency')), 0, 0, 'R');
-					
-		}
-		else  
-		{
-			
-			$pdf->Text($prod_left, $prod_top + $offset, __("Der Gesamtbetrag setzt sich wie folgt zusammen", "wpsg"));
-				 
-			$pdf->Text($prod_left + 100, $prod_top + $offset, __("NETTOBETRAG", "wpsg"));
-			$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
-			$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_netto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
-							
-			if (sizeof($this->view['basket']['mwst']) >= 1)
-			{
-				
-				foreach ($this->view['basket']['mwst'] as $mw)
-				{
-					
-					$offset += 5;
-					$pdf->Text($prod_left + 100, $prod_top + $offset, __("MwSt. ", "wpsg").wpsg_ff($mw['value'], '%'));
-					$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
-					$pdf->Cell(37, 8, wpsg_ff($mw['sum'], $this->get_option('wpsg_currency')), 0, 0, 'R');
-					
-				}
-				
-			}
-		 	
-			if (sizeof($this->view['basket']['mwst']) > 1)
-			{
-				
-				$offset += 5;
-				$pdf->Text($prod_left + 100, $prod_top + $offset, __("MwSt. GESAMT", "wpsg"));
-				$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
-				$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'] - $this->view['basket']['sum']['preis_gesamt_netto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
-			
-			}
-	
-		} 
-		
-	}
-	
-	// Rabatt
-	if ($this->view['basket']['sum']['preis_rabatt'] > 0)
-	{
-		
-		$offset += 5;
-		
-		$pdf->Text($prod_left + 100, $prod_top + $offset, __("Rabatt", "wpsg"));
-		$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
-		$pdf->Cell(37, 8, '-'.wpsg_ff($this->view['basket']['sum']['preis_rabatt'], $this->get_option('wpsg_currency')), 0, 0, 'R');
-		
-	}
-	 
-	$offset += 5;
-	$pdf->Text($prod_left + 100, $prod_top + $offset, __("SUMME", "wpsg"));
-	$pdf->setXY($prod_left + 140, $prod_top + $offset - 5);
-	$pdf->Cell(37, 8, wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')), 0, 0, 'R');
-
-	if ($this->get_option('wpsg_kleinunternehmer') == '1')
-	{
- 
-		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset + 5, 5, $this->get_option('wpsg_kleinunternehmer_text')); 
-		$offset += 15;
-		
-	}
-	
-	if ($this->hasMod('wpsg_mod_deliverynote'))
-	{
-		
-		$arDN_order = $this->callMod('wpsg_mod_deliverynote', 'loadDeliveryNotesFromOrder', array($this->view['data']['id']));
-		$delivery_date = $this->callMod('wpsg_mod_deliverynote', 'getDeliveryTime', array($this->view['data']['id']));
-		
-		// Wenn es ein Gesamtlieferdatum gibt und nur einen Lieferschein, dann unter der Bestellung anzeigen
-		if ($delivery_date !== false && sizeof($arDN_order) == 1)
-		{
-			
-			$offset += 10; 
-			
-			$pdf->wpsg_MultiCell($prod_left, $prod_top + $offset, 5, wpsg_translate(__('Lieferung: #1#', 'wpsg'), date('d.m.Y', $delivery_date)));
-
-			$offset += 5;
-			
-		}
-		
-	}
-	
-	$offset += 5;
-	
-	if ($this->view['fussText'] != "")
-	{
-	
-		//$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, utf8_encode($this->view['fussText']));		
-		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, $this->view['fussText']);
-		$pdf->SetFont('Arial', 'B', 9);
-		$offset += 10;	
-		
-	}
-	
-	$shipping_adress = false;
-
-	if ($this->hasMod('wpsg_mod_shippingadress') && $this->callMod('wpsg_mod_shippingadress', 'check_different_shippingadress', array('k_id' => $this->view['data']['k_id'], 'o_id' => $this->view['data']['id'])))
-	{
- 
-		$pdf->setFont('Arial', 'B', 9);
-		$pdf->Text($prod_left, $prod_top + $offset, __("Lieferanschrift", "wpsg").":");
-		$offset += 5;
-		
-		$pdf->setFont('Arial', '', 9);		
-		
-		$shipping_adress = "";
-		if ($this->view['data']['shipping_firma'] != "")
-		{
-			$shipping_adress .= $this->view['data']['shipping_firma']."\r\n";
-		}
-		$shipping_adress .= $this->view['data']['shipping_vname'].' '.$this->view['data']['shipping_name']."\r\n";
-		$shipping_adress .= $this->view['data']['shipping_strasse']."\r\n";
-		//$shipping_adress .= $this->view['data']['shipping_land']['kuerzel'].'-';
-		
-		$shipping_adress .= $this->view['data']['shipping_plz'].' '.$this->view['data']['shipping_ort']."\r\n";
-		$shipping_adress .= $this->view['data']['shipping_land']['name'];
-		
-		
-		$start = $pdf->getY();
-		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, $shipping_adress, 0, 'L', 0, 100);
-		$offset += $pdf->getY() - $start;
-		
-		$shipping_adress = true;
-		
-	}
-		
-	
-	$offset += 5;
-	 
-	// Bestellvariablen
-	if ($this->hasMod('wpsg_mod_ordervars') && $this->get_option('wpsg_mod_rechnungen_showov') == '1')
-	{
-		
-		$bvars = @unserialize($this->view['data']['bvars']);		
-		if (!is_array($bvars)) $bvars = array();
-		
-		$strBVars = "";
-		foreach ($bvars as $bvars_id => $bvars_value)
-		{
-				
-			$bvars = $this->db->fetchRow("SELECT * FROM `".wpsg_q(WPSG_TBL_ORDERVARS)."` WHERE `id` = '".wpsg_q($bvars_id)."' ORDER BY `pos` ASC, `id` ASC ");
-			
-			if ($bvars['typ'] == "1") // Auswahl
-			{
-				if ($bvars_value <= 0) $bvars_value = __("Keine Angabe", "wpsg");
-			}
-			else if ($bvars['typ'] == "2") // Texteingabe
-			{
-				if (trim($bvars_value) == "") $bvars_value = __("Keine Angabe", "wpsg");
-			}
-			else if ($bvars['typ'] == "3") // Checkbox
-			{
-				if ($bvars_value <= 0) $bvars_value = __("Keine Angabe", "wpsg");					
-			}
-			
-			$bvars_name = $this->callMod('wpsg_mod_ordervars', 'getNameById', array($bvars_id));			
-			$strBVars .= "\r\n".$bvars_name.": ".$bvars_value;	
-			
-		}
-		
-		$pdf->SetFont('Arial', 'B', 9);	
-		$pdf->Text($prod_left, $prod_top + $offset, __("Angaben wÃ€hrend der Bestellung", "wpsg").":");
-		$pdf->SetFont('Arial', '', 9);
-		$pdf->wpsg_MultiCell($prod_left - 1, $prod_top + $offset, 5, $strBVars);
-		
-	}  
-	
-	if (!file_exists($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id']))))
-	{
-		
-		mkdir($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id'])), 0777, true);
-		
-	}
-	
-	$this->callMods('wpsg_mod_rechnungen_pdf', array(&$pdf, &$this->view['data']['id'], &$this->view['preview'], &$this->view['invoice']));
-	
-	$filename = $this->view['filename'].".pdf";
-	 
-	if ($this->view['preview'])
-	{
-		$pdf->Output($filename, 'I');
-	}
-	else
-	{
-		
-		$pdf->Output($this->callMod('wpsg_mod_rechnungen', 'getFilePath', array($this->view['data']['id'])).$filename, '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');
-			
-	} 
-	 
-?>
Index: ews/mods/mod_rechnungen/rechnungsmail.phtml
===================================================================
--- /views/mods/mod_rechnungen/rechnungsmail.phtml	(revision 5959)
+++ 	(revision )
@@ -1,16 +1,0 @@
-<?php 
-
-	/**
-	 * Template fÃŒr die Mail, die beim Schreiben einer Rechnung optional an den Kunden versendet werden kann
-	 */
-
-	//wpsg_debug($this->view);
-
-?><?php echo __("Hallo", "wpsg"); ?> <?php echo $this->view['kunde']['vname']; ?> <?php echo $this->view['kunde']['name']; ?>,
-		
-<?php echo __("Sie erhalten hiermit die Rechnung in HÃ¶he von", "wpsg"); ?> <?php echo wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')); ?> <?php echo __("fÃŒr Ihre Bestellung mit der Bestellnummer", "wpsg"); ?> <?php echo ((trim($this->view['data']['onr']) != '')?$this->view['data']['onr']:$this->view['data']['o_id']); ?>.
-<?php $this->callMods('wpsg_mod_rechnungen_mail'); ?>
- 
-<?php echo __("Mit freundlichen GrÃŒÃen", "wpsg"); ?>
- 
-<?php echo __($this->get_option('wpsg_shopdata_name'), 'wpsg'); ?> - <?php echo __('Team', 'wpsg'); ?>
Index: ews/mods/mod_rechnungen/rechnungsmail_html.phtml
===================================================================
--- /views/mods/mod_rechnungen/rechnungsmail_html.phtml	(revision 5959)
+++ 	(revision )
@@ -1,20 +1,0 @@
-<?php 
-
-	/**
-	 * Template fÃŒr die Mail, die beim Schreiben einer Rechnung optional an den Kunden versendet werden kann (HTML)
-	 */
-
-	/* Wichtig, da die Module sonst kein HTML zurÃŒckgeben */
-	$this->htmlMail = true;
-
-	//wpsg_debug($this->view);
-
-?><p><?php echo __("Hallo", "wpsg"); ?> <?php echo $this->view['kunde']['vname']; ?> <?php echo $this->view['kunde']['name']; ?>,</p>
-		
-<p><?php echo __("Sie erhalten hiermit die Rechnung in HÃ¶he von", "wpsg"); ?> <?php echo wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto'], $this->get_option('wpsg_currency')); ?> <?php echo __("fÃŒr Ihre Bestellung mit der Bestellnummer", "wpsg"); ?> <?php echo ((trim($this->view['data']['onr']) != '')?$this->view['data']['onr']:$this->view['data']['o_id']); ?>.</p>
-
-<?php $this->callMods('wpsg_mod_rechnungen_mail'); ?>
- 
-<p><?php echo __("Mit freundlichen GrÃŒÃen", "wpsg"); ?></p>
- 
-<p><?php echo __($this->get_option('wpsg_shopdata_name'), 'wpsg'); ?> - <?php echo __('Team', 'wpsg'); ?></p>
