Index: /controller/wpsg_BasketController.class.php
===================================================================
--- /controller/wpsg_BasketController.class.php	(revision 7485)
+++ /controller/wpsg_BasketController.class.php	(revision 7486)
@@ -813,11 +813,14 @@
 				parent::dispatch();
 				
-				if ($_REQUEST['wpsg_produkt'] == 'gs')
-				{
-				
+				if (preg_match('/^voucher_(\d+)?/', $_REQUEST['wpsg_produkt'], $m)) {
+				
+					foreach ($_SESSION['wpsg']['gs'] as $gs_k => $gs) {
+						
+						if (intval($gs['id']) === intval($m[1])) unset($_SESSION['wpsg']['gs'][$gs_k]);
+						
+					}
+										
 					$this->shop->addFrontendMessage(__('Gutschein erfolgreich entfernt.', 'wpsg'));
-					
-					unset($_SESSION['wpsg']['gs']);
-				
+									
 				}
 				else
Index: /controller/wpsg_OrderController.class.php
===================================================================
--- /controller/wpsg_OrderController.class.php	(revision 7485)
+++ /controller/wpsg_OrderController.class.php	(revision 7486)
@@ -1185,9 +1185,9 @@
 					if ($_REQUEST['do'] === 'remove') {
 						
-						$this->shop->view['oCalculation']->removeVoucher();
+						$this->shop->view['oCalculation']->removeVoucher($_REQUEST['order_voucher_id']);
 						
 					} else if ($_REQUEST['do'] === 'submit') {
 						
-						if (wpsg_tf($_REQUEST['be_voucher_amount']) < 0) $this->shop->view['oCalculation']->removeVoucher();
+						if (wpsg_tf($_REQUEST['be_voucher_amount']) < 0) $this->shop->view['oCalculation']->removeVoucher($_REQUEST['order_voucher_id']);
 						else $this->shop->view['oCalculation']->addVoucher($_REQUEST['be_voucher_amount'], $this->shop->getBackendTaxview(), '0', 1, $_REQUEST['be_voucher_code'], $_REQUEST['be_voucher_id']);
 						 						
Index: /lib/functions.inc.php
===================================================================
--- /lib/functions.inc.php	(revision 7485)
+++ /lib/functions.inc.php	(revision 7486)
@@ -516,4 +516,11 @@
 		switch ($type) {
 			
+			case WPSG_SANITIZE_DATETIME:
+				
+				if (preg_match('/\d{2}\.\d{2}\.\d{4}(\040\d{2}\:\d{2}(\:\d{2})?)?/', $val)) $bReturn = true;
+				else $bReturn = false;
+				
+				break;
+			
 			case WPSG_SANITIZE_CHECKBOX:
 				
@@ -581,4 +588,19 @@
 				
 				break; 
+				
+			case WPSG_SANITIZE_ARRAY_INT:
+				
+				if (!is_array($val)) $bReturn = false;
+				else {
+					
+					$bReturn = true;
+					
+					foreach ($val as $k => $v) {
+						
+						if (!wpsg_checkInput($v, WPSG_SANITIZE_INT)) $bReturn = false;
+						
+					}
+					
+				}
 				
 			default:
Index: /lib/install.php
===================================================================
--- /lib/install.php	(revision 7485)
+++ /lib/install.php	(revision 7486)
@@ -120,5 +120,8 @@
 		price_gesamt_netto DOUBLE(10,4) NOT NULL,
 		price_gesamt_brutto DOUBLE(10,4) NOT NULL,   	 
-		price_frontend INT(1) NOT NULL,   		   		
+		price_frontend INT(1) NOT NULL,   		
+		topay DOUBLE(10,4) NOT NULL COMMENT '',   		
+		topay_netto DOUBLE(10,4) NOT NULL COMMENT 'Zahlbetrag Netto',
+		topay_brutto DOUBLE(10,4) NOT NULL COMMENT 'Zahlbetrag Brutto', 
 	  	bname VARCHAR(500) NOT NULL,
 		bblz VARCHAR(500) NOT NULL,
@@ -195,5 +198,5 @@
 	 	 
 	dbDelta($sql);
-	
+		
 	/**
 	 * Tabelle fÃŒr die bestellten Produkte
Index: /lib/wpsg_basket.class.php
===================================================================
--- /lib/wpsg_basket.class.php	(revision 7485)
+++ /lib/wpsg_basket.class.php	(revision 7486)
@@ -197,17 +197,13 @@
 		 * @param string $mode w = Wertgutschein, p = Prozentual
 		 */
-		public function addGutscheinToSession($value, $calc, $code, $gs_id)
-		{
-			
-			$this->gs_value = $value;
-			$this->gs_calc = $calc;
-			$this->gs_code = $code;
-			$this->gs_id = $gs_id;
-			
-			$_SESSION['wpsg']['gs'] = wpsg_xss(array(
-				'value' => $this->gs_value,
-				'calc' => $this->gs_calc,
-				'code' => $this->gs_code,
-				'id' => $this->gs_id
+		public function addGutscheinToSession($value, $calc, $code, $gs_id) {
+			  
+			if (!isset($_SESSION['wpsg']['gs'])) $_SESSION['wpsg']['gs'] = [];
+			
+			$_SESSION['wpsg']['gs'][] = wpsg_xss(array(
+				'value' => $value,
+				'calc' => $calc,
+				'code' => $code,
+				'id' => $gs_id
 			));
 			
@@ -1482,5 +1478,5 @@
 			
 			// Gutschein einberechnen
-			$this->shop->callMod('wpsg_mod_gutschein', 'basket_toArray_gs', array(&$this, &$arReturn));
+			//$this->shop->callMod('wpsg_mod_gutschein', 'basket_toArray_gs', array(&$this, &$arReturn));
 			
 			// Staffelrabatt
@@ -1711,5 +1707,5 @@
 			}
 			
-			
+			$arReturn['gs'] = null;
 			$arReturn['sum'] = [
 				'preis' => (($this->shop->getFrontendTaxview() === WPSG_NETTO)?$arCalculation['sum']['productsum_netto']:$arCalculation['sum']['productsum_brutto']),
@@ -1769,5 +1765,5 @@
 			}
 			
-			if (wpsg_isSizedArray($arCalculation['voucher'][0])) {
+			/*if (wpsg_isSizedArray($arCalculation['voucher'][0])) {
 				
 				$arReturn['gs_value'] = abs(($this->shop->getFrontendTaxview() === WPSG_NETTO)?$arCalculation['voucher'][0]['netto']:$arCalculation['voucher'][0]['brutto']);
@@ -1775,5 +1771,5 @@
 				$arReturn['gs']['gs_value'] = $arReturn['gs_value'];
 								
-			}
+			}*/
 			
 			// Alte Templates greifen auf den Shipping Array zu, deshalb dort auch korrigieren
Index: /lib/wpsg_calculation.class.php
===================================================================
--- /lib/wpsg_calculation.class.php	(revision 7485)
+++ /lib/wpsg_calculation.class.php	(revision 7486)
@@ -142,9 +142,9 @@
 		}
         
-        public function removeVoucher() {
+        public function removeVoucher($order_voucher_id) {
         	
         	foreach ($this->arCalculationRow as $k => $cr) {
         		
-        		if ($cr['type'] === 'voucher') {
+        		if (isset($cr['order_voucher_id']) && $cr['order_voucher_id'] == $order_voucher_id) {
         			
         			unset($this->arCalculationRow[$k]);
@@ -163,5 +163,5 @@
 		 * 
 		 */
-		public function addVoucher($set, $bruttonetto, $tax_key, $amount = 1, $code = false, $id = false) {
+		public function addVoucher($set, $bruttonetto, $tax_key, $amount = 1, $code = false, $id = false, $order_voucher_id) {
 		 
 			$tax_key = $this->normalizeTaxKey($tax_key);
@@ -169,5 +169,5 @@
 			if (strpos($set, '-') === false) $set = '-'.$set; 
 			
-			$this->arCalculationRow['voucher'] = [
+			$this->arCalculationRow['voucher_'.$id] = [
 				'type' => 'voucher',
 				'amount' => $amount,
@@ -177,5 +177,29 @@
 				'data' => [
 					'code' => $code,
-					'id' => $id
+					'id' => $id,
+					'order_voucher_id' => $order_voucher_id
+				]
+			];
+			
+			$this->arCalculation = null;
+			
+		}
+		
+		public function addCoupon($set, $bruttonetto, $tax_key, $amount = 1, $code = false, $id = false, $order_voucher_id = 0) {
+			
+			$tax_key = $this->normalizeTaxKey($tax_key);
+			
+			if (strpos($set, '-') === false) $set = '-'.$set;
+			
+			$this->arCalculationRow['coupon_'.$id] = [
+				'type' => 'coupon',
+				'amount' => $amount,
+				'set' => $set,
+				'tax_key' => $tax_key,
+				'bruttonetto' => $bruttonetto,				
+				'data' => [
+					'code' => $code,
+					'id' => $id,
+					'order_voucher_id' => $order_voucher_id
 				]
 			];
@@ -357,4 +381,6 @@
         public function getCalculationArray($force_rebuild = false) {
 
+        	//die(wpsg_debug($_SESSION));
+        	
             if ($this->arCountry === null) throw new \Exception(__('Warenkorb kann nicht ohne ein gesetztes Land berechnet werden.', 'wpsg'));
             
@@ -380,5 +406,7 @@
 					],
 					'tax' => [],
-					'product' => []
+					'product' => [],
+					'voucher' => [],
+					'coupon' => []
             	];
             	
@@ -391,8 +419,10 @@
 				});
             	
-            	//die(wpsg_debug($this->arCalculationRow));
+            	//wpsg_debug($this->arCalculationRow);
 				
                 foreach ($this->arCalculationRow as $cr) {
                 	             
+                	if ($cr['type'] === 'coupon') continue;
+                	
                 	$this->addTax($cr['tax_key']);
                 	$this->calculateTaxProportionally($cr['bruttonetto']);
@@ -407,5 +437,5 @@
 						$set_brutto = 0;
 						$set_brutto = 0;
-                		
+                								
 						if (strpos($set, '|') !== false) {
 									
@@ -536,4 +566,5 @@
 					       					
 					$this->arCalculation[$cr['type']][] = $cr['data'] + [
+						'type' => $cr['type'],
 						'netto' => $netto,
 						'brutto' => $brutto,
@@ -578,4 +609,78 @@
 				}
 				
+				$this->arCalculation['sum']['topay_netto'] = $this->arCalculation['sum']['netto'];
+				$this->arCalculation['sum']['topay_brutto'] = $this->arCalculation['sum']['brutto'];
+					
+				foreach ($this->arCalculationRow as $cr) {
+                	
+					$set = $cr['set'];
+					
+                	if ($cr['type'] === 'coupon') {
+		
+						// Netto / Brutto berechnen
+						if ($cr['bruttonetto'] === WPSG_NETTO) {
+			
+							$set_netto = wpsg_tf($set);
+			
+							list($set_netto, $set_brutto) = $this->calculateTaxPart(WPSG_NETTO, $set_netto, $cr['tax_key']);
+			
+						} else {
+			
+							if (wpsg_isTrue($cr['data']['targetCountry'])) {
+				
+								$tax_key_part = preg_replace('/\_(.*)/', '', $cr['tax_key']);
+				
+								$tax_default = $this->arCountry[$this->getDefaultCountryID()][$tax_key_part.'_'.$this->getDefaultCountryID()];
+								$tax_target = $this->arCountry[$this->getTargetCountryID()][$tax_key_part.'_'.$this->getTargetCountryID()];
+				
+								$set_brutto = wpsg_calculatePreis(
+									wpsg_calculatePreis(wpsg_tf($set), WPSG_NETTO, $tax_default),
+									WPSG_BRUTTO,
+									$tax_target
+								);
+				
+							} else {
+				
+								$set_brutto = wpsg_tf($set);
+				
+							}
+			
+							list($set_netto, $set_brutto) = $this->calculateTaxPart(WPSG_BRUTTO, $set_brutto, $cr['tax_key']);
+							
+							if ($this->arCalculation['sum']['topay_netto'] + $set_netto < 0) {
+								
+								$set_netto = $this->arCalculation['sum']['topay_netto'];
+								$this->arCalculation['sum']['topay_netto'] = 0;
+								
+							} else $this->arCalculation['sum']['topay_netto'] += $set_netto;
+							
+							if ($this->arCalculation['sum']['topay_brutto'] + $set_brutto < 0) {
+								
+								$set_brutto = $this->arCalculation['sum']['topay_brutto'];
+								$this->arCalculation['sum']['topay_brutto'] = 0;
+								
+							} else $this->arCalculation['sum']['topay_brutto'] += $set_brutto;
+							 							
+						}
+		
+						$tax = $set_brutto - $set_netto;
+		
+						$this->arCalculation[$cr['type']][] = $cr['data'] + [
+							'type' => $cr['type'],
+							'netto' => $set_netto,
+							'brutto' => $set_brutto,
+							'netto_single' => $set_netto,
+							'brutto_single' => $set_brutto,
+							'tax' => $tax,
+							'amount' => 1,
+							'tax_key' => $cr['tax_key'],
+							'bruttonetto' => $cr['bruttonetto'],
+							'set' => $cr['set']
+						];
+						
+					}
+                	
+				}
+	 
 				foreach ($this->arCalculation['tax'] as $tax_key => $tax) {
 		
@@ -587,5 +692,5 @@
                 
             }
-
+            
             return $this->arCalculation;
 
@@ -603,7 +708,10 @@
         	
             $arCalculation = $this->getCalculationArray();
-            
+             
             $db_data['price_gesamt_netto'] = wpsg_q($arCalculation['sum']['netto']);
             $db_data['price_gesamt_brutto'] = wpsg_q($arCalculation['sum']['brutto']);
+	
+			$db_data['topay_netto'] = wpsg_q($arCalculation['sum']['topay_netto']);
+			$db_data['topay_brutto'] = wpsg_q($arCalculation['sum']['topay_brutto']);
                         
             if ($this->shop->getFrontendTaxview() === WPSG_NETTO) $display = 'netto';
@@ -611,4 +719,5 @@
 	
 			$db_data['price_gesamt'] = wpsg_q($arCalculation['sum'][$display]);
+			$db_data['topay'] = wpsg_q($arCalculation['sum']['topay_'.$display]);
 	
 			// Shipping leeren
@@ -667,16 +776,4 @@
 					$db_data['price_rabatt_brutto'] = wpsg_q($arCalculation['sum']['discount_brutto']);
 					            		
-				} else if ($cr['type'] === 'voucher') {
-            	 
-            		$db_data['voucher_tax_key'] = wpsg_q($cr['tax_key']);
-					$db_data['price_gs'] = wpsg_q($arCalculation['sum']['voucher_'.$display]);
-					$db_data['price_gs_netto'] = wpsg_q($arCalculation['sum']['voucher_netto']);
-					$db_data['price_gs_brutto'] = wpsg_q($arCalculation['sum']['voucher_brutto']);
-					$db_data['gs_set'] = wpsg_q($cr['set']);
-					$db_data['gs_tax_key'] = wpsg_q($this->clearTaxKey($cr['tax_key']));
-					$db_data['voucher_bruttonetto'] = wpsg_q($cr['bruttonetto']);
-					$db_data['gs_id'] = wpsg_q($cr['data']['id']);
-					$db_data['gs_code'] = wpsg_q($cr['data']['code']);
-		 					
 				} else if ($cr['type'] === 'shipping') {
             		
@@ -752,23 +849,46 @@
                 
             }
-	
-			foreach ($this->arCalculationRow as $cr) {
-				
-				if ($cr['type'] === 'voucher') {
-					
-					if (wpsg_isSizedInt($cr['data']['id']) && $finish_order) {
-						
-						$this->db->UpdateQuery(WPSG_TBL_GUTSCHEIN, [
-							'o_id' => wpsg_q($cr['data']['id'])
-						], " `id` = '".wpsg_q($cr['data']['id'])."' ");
-						
-					}
-										
-				}
-				
-			}
-                        
+	                         
             $arOrderProductID = [-1];
             
+			// Gutscheine speichern		
+			if ($finish_order) {
+				
+				foreach ($arCalculation['voucher'] as $v) {
+				
+					$this->db->ImportQuery(WPSG_TBL_ORDER_VOUCHER, [
+						'create_time' => "NOW()",
+						'order_id' => wpsg_q($id),
+						'voucher_id' => wpsg_q($v['id']),
+						'set_value' => wpsg_q($v['set']), 
+						'sum_netto' => wpsg_q($v['netto']),
+						'sum_brutto' => wpsg_q($v['brutto']),
+						'tax_key' => wpsg_q($v['tax_key']),
+						'bruttonetto' => wpsg_q($v['bruttonetto']),
+						'code' => wpsg_q($v['code']),
+						'coupon' => '0'
+					]);
+	
+				}
+				
+				foreach ($arCalculation['coupon'] as $c) {
+					
+					$this->db->ImportQuery(WPSG_TBL_ORDER_VOUCHER, [
+						'create_time' => "NOW()",
+						'order_id' => wpsg_q($id),
+						'voucher_id' => wpsg_q($v['id']),
+						'set_value' => wpsg_q($v['set']),
+						'sum_netto' => wpsg_q($v['netto']),
+						'sum_brutto' => wpsg_q($v['brutto']),
+						'tax_key' => wpsg_q($v['tax_key']),
+						'bruttonetto' => wpsg_q($v['bruttonetto']),
+						'code' => wpsg_q($v['code']),
+						'coupon' => '1'
+					]);
+					
+				}
+						
+			}
+			
             // Produkte speichern
 			foreach ($arCalculation['product'] as $p) {
@@ -969,5 +1089,23 @@
 			}            
             			
-			
+			if ($this->shop->hasMod('wpsg_mod_gutschein')) {
+            	
+            	$arVoucher = $this->db->fetchAssoc("SELECT * FROM `".WPSG_TBL_ORDER_VOUCHER."` WHERE `order_id` = '".wpsg_q($id)."' ORDER BY `id` ASC ");
+            	 
+            	foreach ($arVoucher as $v) {
+						
+            		if ($v['coupon'] === '1') {
+            			
+            			$this->addCoupon($v['set_value'], $v['bruttonetto'], $v['tax_key'], 1, $v['code'], $v['voucher_id'], $v['id']);
+            			
+					} else {
+            			
+            			$this->addVoucher($v['set_value'], $v['bruttonetto'], $v['tax_key'], 1, $v['code'], $v['voucher_id'], $v['id']);
+            			
+					}
+            		
+				}
+            	
+			}
 			
         } // public function fromDB($id)
Index: /model/wpsg_model.class.php
===================================================================
--- /model/wpsg_model.class.php	(revision 7485)
+++ /model/wpsg_model.class.php	(revision 7486)
@@ -32,4 +32,10 @@
 			
 		} // public function __construct()
+		
+		public function getId() {
+			
+			return intval($this->data['id']);
+			
+		}
 		
 		/**
Index: /mods/mod_gutschein/wpsg_voucher.php
===================================================================
--- /mods/mod_gutschein/wpsg_voucher.php	(revision 7485)
+++ /mods/mod_gutschein/wpsg_voucher.php	(revision 7486)
@@ -37,4 +37,10 @@
 			
         }
+        
+        public function isCoupon() {
+			
+			return wpsg_isSizedInt($this->__get('coupon'));
+			
+		}
 
         public function isAutoCreated() {
Index: /mods/wpsg_mod_gutschein.class.php
===================================================================
--- /mods/wpsg_mod_gutschein.class.php	(revision 7485)
+++ /mods/wpsg_mod_gutschein.class.php	(revision 7486)
@@ -36,4 +36,5 @@
 		   		id mediumint(9) NOT NULL AUTO_INCREMENT,
 		   		code VARCHAR(255) NOT NULL,
+		   		coupon INT(1) NOT NULL COMMENT '1 bei Wertgutscheinen',
 		   		value DOUBLE(10,2) NOT NULL,
 		   		o_id INT(11) NOT NULL,
@@ -57,5 +58,26 @@
 
 			dbDelta($sql);
-
+			
+			/** Tabelle fÃŒr die Zuordnung Bestellung <=> Gutschein */
+			$sql = "CREATE TABLE ".WPSG_TBL_ORDER_VOUCHER." (
+				id int(11) NOT NULL AUTO_INCREMENT,
+				create_time DATETIME NOT NULL,
+				edit_time DATETIME NOT NULL,
+				order_id INT(11) NOT NULL,
+				voucher_id INT(11) NOT NULL,
+				set_value VARCHAR(100) NOT NULL, 
+				sum_netto DOUBLE(10,2) NOT NULL,
+				sum_brutto DOUBLE(10,2) NOT NULL,
+				tax_key VARCHAR(10) NOT NULL,
+				bruttonetto INT(1) NOT NULL,
+				code VARCHAR(1000) NOT NULL,
+				coupon INT(1) NOT NULL,
+				PRIMARY KEY  (`id`),
+				KEY order_id (order_id),
+				KEY voucher_id (voucher_id)
+			) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;";
+
+			dbDelta($sql);
+			
 			$this->shop->checkDefault('wpsg_mod_gutschein_size', '10');
 			$this->shop->checkDefault('wpsg_mod_gutschein_perPage', '25');
@@ -123,15 +145,27 @@
 		
 		public function calculation_fromSession(&$oCalculation, $product_done, $payship_done) { 
-			
+		 
 			if ($product_done && $payship_done) {
 				
 				if (wpsg_isSizedArray($_SESSION['wpsg']['gs'])) {
 					
-					$gs = $_SESSION['wpsg']['gs'];
-					
-					if ($gs['calc'] === 'p') $gs['value'] = $gs['value'].'%';
-					
-					$oCalculation->addVoucher($gs['value'], $this->shop->getBackendTaxview(), '0', 1, $gs['code'], $gs['id']);
-					
+					foreach ($_SESSION['wpsg']['gs'] as $gs) {
+						
+						$oVoucher = wpsg_voucher::getInstance($gs['id']);
+						
+						if ($oVoucher->isCoupon()) {
+							
+							$oCalculation->addCoupon($gs['value'], $this->shop->getBackendTaxview(), '0', 1, $gs['code'], $gs['id']);
+							
+						} else {
+						
+							if ($gs['calc'] === 'p') $gs['value'] = $gs['value'].'%';
+						
+							$oCalculation->addVoucher($gs['value'], $this->shop->getBackendTaxview(), '0', 1, $gs['code'], $gs['id']);
+							
+						}
+						
+					}
+					 
 				}
 				
@@ -139,5 +173,6 @@
 			
 		}
-		
+				
+		/*
         public function editAction() {
 
@@ -170,16 +205,14 @@
             $this->render(WPSG_PATH_VIEW.'/mods/mod_gutschein/add.phtml');
             
-        }
+        } */
         
 		/**
 		 * Maske fÃŒr einen neuen Gutschein
-		 */
-		public function addAction()
-		{
+		 *
+		public function addAction() {
 
 			$this->shop->view['mod_gutschein'] = array();
 
-			if (isset($_SESSION['wpsg']['mod_gutschein_error']))
-			{
+			if (isset($_SESSION['wpsg']['mod_gutschein_error'])) {
 
 				$this->shop->view['mod_gutschein']['value'] = $_SESSION['wpsg']['mod_gutschein_error']['wpsg_mod_gutschein_value'];
@@ -198,7 +231,5 @@
 				unset($_SESSION['wpsg']['mod_gutschein_error']);
 
-			}
-			else
-			{
+			} else {
 
 				$this->shop->view['mod_gutschein']['value'] = 10;
@@ -227,6 +258,182 @@
 			$this->render(WPSG_PATH_VIEW.'/mods/mod_gutschein/add.phtml');
 
-		} // public function addAction()
-
+		} // public function addAction() */
+		
+		public function be_ajax() {
+			
+			if (wpsg_isSizedString($_REQUEST['subaction'], 'addedit')) $this->be_ajax_addedit();
+			else if (wpsg_isSizedString($_REQUEST['subaction'], 'save')) $this->be_ajax_save();
+			else if (wpsg_isSizedString($_REQUEST['subaction'], 'delete')) $this->be_ajax_delete();
+			
+			exit;
+			
+		}
+		
+		public function be_ajax_save() {
+			
+			$bError = false;
+			
+			parse_str($_REQUEST['form_data'], $form_data);
+			
+			try {
+				
+				if (!wpsg_checkInput($form_data['wpsg_mod_gutschein_start'], WPSG_SANITIZE_DATETIME)) throw new \Exception(__('Eingabefehler in Feld "GÃŒltig ab"', 'wpsg'));
+				if (!wpsg_checkInput($form_data['wpsg_mod_gutschein_end'], WPSG_SANITIZE_DATETIME)) throw new \Exception(__('Eingabefehler in Feld "GÃŒltig bis"', 'wpsg'));
+				if (!wpsg_isSizedInt($form_data['voucher_id']) && (!wpsg_checkInput($form_data['wpsg_mod_gutschein_count'], WPSG_SANITIZE_INT) || !wpsg_isSizedInt($form_data['wpsg_mod_gutschein_count']))) throw new \Exception(__('Eingabefehler in Feld "Menge"', 'wpsg'));
+				
+				$t_start = strtotime($form_data['wpsg_mod_gutschein_start']);
+				$t_end = strtotime($form_data['wpsg_mod_gutschein_end']);
+				
+				if ($t_start <= 0 || $t_end <= 0 || $t_end <= $t_start) throw new \Exception(__('Eingaben in "GÃŒltig ab" und "GÃŒltig bis" ÃŒberprÃŒfen.', 'wpsg'));
+				
+				if (!wpsg_checkInput($form_data['wpsg_mod_gutschein_value'], WPSG_SANITIZE_FLOAT) || wpsg_tf($form_data['wpsg_mod_gutschein_value']) <= 0) throw new \Exception(__('Eingaben im Feld "Wert" ÃŒberprÃŒfen.', 'wpsg'));
+				
+				if (!wpsg_checkInput($form_data['wpsg_mod_gutschein_comment'], WPSG_SANITIZE_TEXTAREA)) throw new \Exception(__('UngÃŒltige Eingaben im Feld "Kommentar"', 'wpsg'));
+				if (!wpsg_checkInput($form_data['wpsg_mod_gutschein_minvalue'], WPSG_SANITIZE_FLOAT)) throw new \Exception(__('UngÃŒltige Eingaben im Feld "Minimaler Warenwert"', 'wpsg'));
+				
+				if (
+					!wpsg_checkInput($form_data['wpsg_mod_gutschein_calc'], WPSG_SANITIZE_VALUES, ['p', 'w']) ||
+					!wpsg_checkInput($form_data['wpsg_mod_gutschein_multi'], WPSG_SANITIZE_CHECKBOX) ||
+					!wpsg_checkInput($form_data['wpsg_mod_gutschein_coupon'], WPSG_SANITIZE_CHECKBOX) ||
+					(isset($form_data['wpsg_mod_gutschein_productgroups']) && !wpsg_checkInput($form_data['wpsg_mod_gutschein_productgroups'], WPSG_SANITIZE_ARRAY_INT)) ||
+					(isset($form_data['wpsg_mod_gutschein_products']) && !wpsg_checkInput($form_data['wpsg_mod_gutschein_products'], WPSG_SANITIZE_ARRAY_INT)) || 
+					(isset($form_data['voucher_id']) && !wpsg_checkInput($form_data['voucher_id'], WPSG_SANITIZE_INT)) || 
+					(!isset($form_data['voucher_id']) && !wpsg_checkInput($form_data['wpsg_mod_gutschein_gen'], WPSG_SANITIZE_VALUES, ['0', '1']))
+				) throw new \Exception(__('Eingabevalidierungsfehler!', 'wpsg'));
+									
+				if (isset($form_data['voucher_id'])) {
+										
+					$this->db->UpdateQuery(WPSG_TBL_GUTSCHEIN, [
+						'code' => wpsg_q($form_data['wpsg_mod_gutschein_code']),
+						'coupon' => wpsg_q($form_data['wpsg_mod_gutschein_coupon']),
+						'value' => wpsg_q(wpsg_tf($form_data['wpsg_mod_gutschein_value'])),						
+						'calc_typ' => wpsg_q($form_data['wpsg_mod_gutschein_calc']),
+						'start_date' => wpsg_q(date('Y-m-d H:i:s', $t_start)),
+						'end_date' => wpsg_q(date('Y-m-d H:i:s', $t_end)),
+						'multi' => wpsg_q($form_data['wpsg_mod_gutschein_multi']),
+						'comment' => wpsg_q($form_data['wpsg_mod_gutschein_comment']),
+						'minvalue' => wpsg_q(wpsg_tf($form_data['wpsg_mod_gutschein_minvalue'])),
+						'productgroups' => wpsg_q(implode(',', wpsg_getArray($form_data['wpsg_mod_gutschein_productgroups']))),
+						'products' => wpsg_q(implode(',', wpsg_getArray($form_data['wpsg_mod_gutschein_products']))),
+					], " `id` = '".wpsg_q($form_data['voucher_id'])."' ");
+					
+					$this->shop->addBackendMessage(__('Gutschein erfolgreich gespeichert.', 'wpsg'));
+										
+				} else {
+					
+					$arProductGroups = array(); if (wpsg_isSizedArray($form_data['wpsg_mod_gutschein_productgroups'])) $arProductGroups = $form_data['wpsg_mod_gutschein_productgroups'];
+					$arProducts = array(); if (wpsg_isSizedArray($form_data['wpsg_mod_gutschein_products'])) $arProducts = $form_data['wpsg_mod_gutschein_products'];
+					
+					for ($i = 0; $i < $form_data['wpsg_mod_gutschein_count']; $i ++) {
+						
+						if ($form_data['wpsg_mod_gutschein_gen'] == '1') {
+														
+							if (!wpsg_checkInput($form_data['wpsg_mod_gutschein_code'], WPSG_SANITIZE_APIKEY)) throw new \Exception(__('UngÃŒltige Eingaben im Feld "Code"', 'wpsg'));
+							
+							$setCode = $form_data['wpsg_mod_gutschein_code'];
+							
+						} else {
+							
+							$setCode = false;
+							
+						}
+						
+						if ($form_data['wpsg_mod_gutschein_coupon'] === '1') $isCoupon = true;
+						else $isCoupon = false;
+						
+						$this->genGS(
+							wpsg_tf($form_data['wpsg_mod_gutschein_value']),
+							$form_data['wpsg_mod_gutschein_calc'],
+							$t_start,
+							$t_end,
+							$form_data['wpsg_mod_gutschein_multi'],
+							$this->shop->get_option('wpsg_mod_gutschein_size'),
+							$form_data['wpsg_mod_gutschein_comment'],
+							0,
+							0,
+							0,
+							$arProductGroups,
+							$arProducts,
+							wpsg_tf($form_data['wpsg_mod_gutschein_minvalue']),
+							$setCode,
+							$isCoupon
+						);
+						
+					}
+					
+					if ($form_data['wpsg_mod_gutschein_count'] > 1) {
+						
+						$this->shop->addBackendMessage(__('Gutscheine wurden erfolgreich angelegt.', 'wpsg'));
+						
+					} else {
+						
+						$this->shop->addBackendMessage(__('Gutschein wurde erfolgreich angelegt.', 'wpsg'));
+						
+					}
+					
+				}
+				
+			} catch (\Exception $e) {
+				
+				echo $e->getMessage(); exit;
+				
+			}
+						
+			echo "1"; exit;
+			
+		}
+		
+		/**
+		 * @throws Exception
+		 */
+		public function be_ajax_addedit() {
+			
+			if ($this->shop->hasMod('wpsg_mod_productgroups')) {
+				
+				$this->shop->view['wpsg_mod_gutschein']['arProductGroups'] = $this->shop->callMod('wpsg_mod_productgroups', 'getAllProductGroups');
+				
+			}
+			
+			$this->shop->view['wpsg_mod_gutschein']['arProducts'] = $this->shop->getAllProductsForSelect();
+			
+			if (isset($_REQUEST['voucher_id'])) {
+				
+				if (!wpsg_checkInput($_REQUEST['voucher_id'], WPSG_SANITIZE_INT)) throw new \Exception(__('Fehler in ÃŒbergebenenem Parameter!', 'wpsg'));
+				
+				$oVoucher = wpsg_voucher::getInstance($_REQUEST['voucher_id']);
+				
+				$this->shop->view['edit_id'] = $oVoucher->getId();
+				$this->shop->view['mod_gutschein'] = [					
+					'value' => $oVoucher->__get('value'),
+					'coupon' => $oVoucher->__get('coupon'),
+					'calc' => $oVoucher->__get('calc'),
+					'start' => date('d.m.Y', strtotime($oVoucher->start_date)),
+					'end' => date('d.m.Y', strtotime($oVoucher->end_date)),
+					'code' => $oVoucher->__get('code'),
+					'minvalue' => $oVoucher->__get('minvalue'),
+					'multi' => $oVoucher->__get('multi'),
+					'comment' => $oVoucher->__get('comment'),
+					'productgroups' => explode(',', $oVoucher->__get('productgroups')),
+					'products' => explode(',', $oVoucher->__get('products')),
+				];
+				
+			}
+			
+			$this->render(WPSG_PATH_VIEW.'/mods/mod_gutschein/add.phtml');
+			
+		}
+		
+		public function be_ajax_delete() {
+			
+			if (!wpsg_checkInput($_REQUEST['voucher_id'], WPSG_SANITIZE_INT)) throw new \Exception(__('Parameterfehler'));
+			
+			$oVoucher = wpsg_voucher::getInstance(intval($_REQUEST['voucher_id']));
+			$oVoucher->delete();
+			
+			$this->shop->addBackendMessage(__('Gutschein wurde erfolgreich gelÃ¶scht.', 'wpsg'));
+			$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Voucher');
+			
+		}
+		
 		/**
 		 * CSV Import von Gutscheinen
@@ -436,135 +643,28 @@
 		} // public function importAction()
 
-		/**
-		 * Speichert einen Gutschein
-		 */
-		public function saveAction()
-		{
-
-			$bError = false;
-			//$tStart = wpsg_fieldarray_todate($_REQUEST['wpsg_mod_gutschein_start']);
-			//$tEnd = wpsg_fieldarray_todate($_REQUEST['wpsg_mod_gutschein_end']);
-			$tStart = strtotime(wpsg_sinput("key", $_REQUEST['wpsg_mod_gutschein_start']));
-			$tEnd = strtotime(wpsg_sinput("key", $_REQUEST['wpsg_mod_gutschein_end']));
-
-			// Validierung
-			if ($_REQUEST['wpsg_mod_gutschein_count'] <= 0 && !isset($_REQUEST['edit_id']))
-			{
-
-				$this->shop->addBackendError(__('Eingabe im Feld "Menge" ist ungÃŒltig.', 'wpsg'));
-				$bError = true;
-
-			} 
-
-			if ($tStart <= 0)
-			{
-
-				$this->shop->addBackendError(__('Eingabe im Feld "GÃŒltig ab" ÃŒberprÃŒfen.', 'wpsg'));
-				$bError = true;
-
-			}
-
-			if ($tEnd <= 0)
-			{
-
-				$this->shop->addBackendError(__('Eingabe im Feld "GÃŒltig bis" ÃŒberprÃŒfen.', 'wpsg'));
-				$bError = true;
-
-			}
-
-			if ($_REQUEST['wpsg_mod_gutschein_value'] <= 0)
-			{
-
-				$this->shop->addBackendError(__('Eingabe im Feld "Wert" ÃŒberprÃŒfen.', 'wpsg'));
-				$bError = true;
-
-			}
-
-			if ($bError)
-			{
-
-				$_SESSION['wpsg']['mod_gutschein_error'] = wpsg_xss($_REQUEST);
-
-				$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Voucher&action=add');
-                			
-			}
-			else
-			{
-
-			    if (isset($_REQUEST['edit_id'])) {
-
-			        $this->db->UpdateQuery(WPSG_TBL_GUTSCHEIN, [ 
-                        'code' => wpsg_q(wpsg_sinput("text_field", $_REQUEST['wpsg_mod_gutschein_code'])),
-			            'value' => wpsg_q(wpsg_tf(wpsg_sinput("key", $_REQUEST['wpsg_mod_gutschein_value'], WPSG_SANITIZE_FLOAT))),
-                        'calc_typ' => wpsg_q(wpsg_sinput("wpsg_in_array", $_REQUEST['wpsg_mod_gutschein_calc'], ['p', 'w'])),
-                        'start_date' => wpsg_q(date('Y-m-d H:i:s', strtotime(wpsg_sinput("text_field", $_REQUEST['wpsg_mod_gutschein_start'])))),
-                        'end_date' => wpsg_q(date('Y-m-d H:i:s', strtotime(wpsg_sinput("text_field", $_REQUEST['wpsg_mod_gutschein_end'])))),
-                        'multi' => wpsg_q(wpsg_sinput("key", $_REQUEST['wpsg_mod_gutschein_multi'])),
-                        'comment' => wpsg_q(wpsg_sinput("text_field", $_REQUEST['wpsg_mod_gutschein_comment'])),
-			            'minvalue' => wpsg_q(wpsg_tf(wpsg_sinput("key", $_REQUEST['wpsg_mod_gutschein_minvalue'], WPSG_SANITIZE_FLOAT))),
-                        'productgroups' => wpsg_q(implode(',', wpsg_getArray(wpsg_xss($_REQUEST['wpsg_mod_gutschein_productgroups'])))),
-                        'products' => wpsg_q(implode(',', wpsg_getArray(wpsg_xss($_REQUEST['wpsg_mod_gutschein_products'])))),
-                    ], " `id` = '".wpsg_q(wpsg_sinput("key", $_REQUEST['edit_id']))."' ");
-			        
-			        $this->shop->addBackendMessage(__('Gutschein erfolgreich gespeichert.', 'wpsg'));
-                    $this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Voucher&action=edit&edit_id='.$_REQUEST['edit_id']);
-			        
-                } else {
-
-                    $arProductGroups = array(); if (wpsg_isSizedArray($_REQUEST['wpsg_mod_gutschein_productgroups'])) $arProductGroups = $_REQUEST['wpsg_mod_gutschein_productgroups'];
-                    $arProducts = array(); if (wpsg_isSizedArray($_REQUEST['wpsg_mod_gutschein_products'])) $arProducts = $_REQUEST['wpsg_mod_gutschein_products'];
-			        
-                    for ($i = 0; $i < $_REQUEST['wpsg_mod_gutschein_count']; $i ++)
-                    {
-        
-                        if ($_REQUEST['wpsg_mod_gutschein_gen'] == '1')
-                        {
-    
-                            $setCode = wpsg_sinput("text_field", $_REQUEST['wpsg_mod_gutschein_code']);
-    
-                        }
-                        else
-                        {
-    
-                            $setCode = false;
-    
-                        }
-    
-                        $this->genGS(
-                            wpsg_tf(wpsg_sinput("key", $_REQUEST['wpsg_mod_gutschein_value'], WPSG_SANITIZE_FLOAT)),
-                            wpsg_sinput("text_field", $_REQUEST['wpsg_mod_gutschein_calc']),
-                            $tStart,
-                            $tEnd,
-                            $_REQUEST['wpsg_mod_gutschein_multi'],
-                            $this->shop->get_option('wpsg_mod_gutschein_size'),
-                            wpsg_sinput("text_field", $_REQUEST['wpsg_mod_gutschein_comment']),
-                            0,
-                            0,
-                            0,
-                            $arProductGroups,
-                            $arProducts,
-                            wpsg_tf(wpsg_sinput("key", $_REQUEST['wpsg_mod_gutschein_minvalue'], WPSG_SANITIZE_FLOAT)),
-                            $setCode
-                        );
-    
-                    }
-    
-                    if ($_REQUEST['wpsg_mod_gutschein_count'] > 1)
-                    {
-                        $this->shop->addBackendMessage(__('Gutscheine wurden erfolgreich angelegt.', 'wpsg'));
-                    }
-                    else
-                    {
-                        $this->shop->addBackendMessage(__('Gutschein wurde erfolgreich angelegt.', 'wpsg'));
-                    }
-                    
-                }
-
-				$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Voucher&action=index');
-
-			}
-
-		} // public function saveAction()
-
+		public function basket_row_end_coupon() {
+			
+			$arCalculation = &$this->shop->view['basket']['arCalculation'];
+			
+			if ($arCalculation['sum']['topay_brutto'] !== $arCalculation['sum']['brutto'] && wpsg_isSizedArray($arCalculation['coupon'])) {
+				
+				$this->render(WPSG_PATH_VIEW.'/mods/mod_gutschein/basket_row_end_coupon.phtml');
+				
+			}
+			
+		}
+		
+		public function overview_row_end_coupon() {
+			
+			$arCalculation = &$this->shop->view['basket']['arCalculation'];
+			
+			if ($arCalculation['sum']['topay_brutto'] !== $arCalculation['sum']['brutto'] && wpsg_isSizedArray($arCalculation['coupon'])) {
+				
+				$this->render(WPSG_PATH_VIEW.'/mods/mod_gutschein/overview_row_end_coupon.phtml');
+				
+			}
+			
+		}
+		
 		public function basket_row_end(&$basket_view)
 		{
@@ -639,205 +739,5 @@
 
 		/* Modulfunktionen */
-
-		/**
-		 * Gutscheinberechnung im Warenkorb
-		 */
-		public function basket_toArray_gs(&$basket, &$arReturn)
-		{
-
-			// Analog Rabatt
-
-			if ($basket->gs_value !== false)
-			{
-				if ((isset($arReturn['backend'])) && $arReturn['backend'])
-				{
-					// Berechnung Gutschein im Backend je nach netto/brutto im Frontend
-
-					$arReturn['gs'] = array(
-							'value' => $arReturn['gs_value'],
-							'calc' => $basket->gs_calc,
-							'code' => $basket->gs_code
-					);
-
-					$gs_value = $arReturn['gs_value'];
-					$gs_tax = 0;
-
-					//$gs_brutto = $basket->arOrder['price_gs_brutto'];
-					//$gs_netto = $basket->arOrder['price_gs_netto'];
-					//$gs_tax = $gs_brutto - $gs_netto;
-					//$gs_value = $gs_brutto;
-
-					//if ((isset($arReturn['price_frontend'])) && ($arReturn['price_frontend'] == WPSG_BRUTTO))
-					$price_option = $this->shop->get_option('wpsg_preisangaben');
-					$gs_value = $basket->gs_value;
-
-					if ($price_option == WPSG_NETTO)
-					{
-
-						if ($gs_value > $arReturn['sum']['preis_gesamt_netto']) $gs_value = $arReturn['sum']['preis_gesamt_netto'];
-						
-						if ($this->shop->get_option('wpsg_kleinunternehmer') != '1')
-						{
-
-							$gs_tax = $this->shop->addMwSt($arReturn, $gs_netto);
-
-						}
-
-						if ($this->shop->addRoundedValues === true)
-						{
-
-							$gs_brutto = round($gs_value + $gs_tax, 2);
-							$gs_netto = round($gs_value, 2);
-
-						}
-						else
-						{
-
-							$gs_brutto = $gs_value + $gs_tax;
-							$gs_netto = $gs_value;
-
-						}
-
-						$arReturn['sum']['gs'] = $gs_netto;
-						$arReturn['sum']['gs_netto'] = $gs_netto;
-						$arReturn['sum']['gs_brutto'] = $gs_brutto;
-						$arReturn['sum']['preis'] = $arReturn['sum']['preis_netto'];
-						$arReturn['sum']['preis_gesamt'] = $arReturn['sum']['preis_gesamt_netto'];
-
-					}
-
-					//if ((isset($arReturn['price_frontend'])) && ($arReturn['price_frontend'] == WPSG_NETTO))
-					if ($price_option == WPSG_BRUTTO)
-					{
-						if ($gs_value > $arReturn['sum']['preis_gesamt_brutto']) $gs_value = $arReturn['sum']['preis_gesamt_brutto'];
-						
-						if ($this->shop->get_option('wpsg_kleinunternehmer') != '1')
-						{
-
-							$gs_tax = $this->shop->subMwSt($arReturn, $gs_value);
-
-						}
-
-						if ($this->shop->addRoundedValues === true)
-						{
-
-							$gs_brutto = round($gs_value, 2);
-							$gs_netto = round($gs_value - $gs_tax, 2);
-
-						}
-						else
-						{
-
-							$gs_brutto = $gs_value;
-							$gs_netto = $gs_value - $gs_tax;
-
-						}
-
-						$arReturn['sum']['gs'] = $gs_brutto;
-						$arReturn['sum']['gs_netto'] = $gs_netto;
-						$arReturn['sum']['gs_brutto'] = $gs_brutto;
-						$arReturn['sum']['preis'] = $arReturn['sum']['preis_brutto'];
-						$arReturn['sum']['preis_gesamt'] = $arReturn['sum']['preis_gesamt_brutto'];
-
-					}
-
-					$arReturn['sum']['preis_brutto'] -= $gs_brutto;
-					$arReturn['sum']['preis_netto'] -= $gs_netto;
-					$arReturn['sum']['preis_gesamt_brutto'] -= $gs_brutto;
-					$arReturn['sum']['preis_gesamt_netto'] -= $gs_netto;
-
-				}
-				else	// if ((isset($arReturn['backend'])) && $arReturn['backend'])
-				{
-					$arReturn['gs'] = array(
-							'value' => $basket->gs_value,
-							'calc' => $basket->gs_calc,
-							'code' => $basket->gs_code
-					);
-
-					$gs_value = $basket->gs_value;
-					$gs_tax = 0;
-
-					// Bruttopreis des Gutscheins bestimmen
-					if ($basket->gs_calc == 'p')
-					{
-
-						$gs_value = $arReturn['sum']['preis_gesamt_brutto'] / 100 * $basket->gs_value;
-
-						if ($this->shop->get_option('wpsg_kleinunternehmer') != '1')
-						{
-
-							$gs_tax = $this->shop->subMwSt($arReturn, $gs_value);
-
-						}
-
-					}
-					else
-					{
-
-						if ($this->shop->get_option('wpsg_preisangaben') == WPSG_NETTO)
-						{
-
-							if ($this->shop->get_option('wpsg_kleinunternehmer') != '1')
-							{
-
-								$gs_tax = $this->shop->addMwSt($arReturn, $basket->gs_value);
-
-							}
-
-							$gs_value = $basket->gs_value + $gs_tax;
-
-						}
-						else
-						{
-
-							$gs_value = $basket->gs_value;
-
-							if ($this->shop->get_option('wpsg_kleinunternehmer') != '1')
-							{
-
-								$gs_tax = $this->shop->subMwSt($arReturn, $basket->gs_value);
-
-							}
-							//die($gs_tax."=".$gs_value);
-						}
-
-					}
-
-					$gs_brutto = $gs_value;
-					$gs_netto = $gs_value - $gs_tax;
-
-					$arReturn['sum']['preis_brutto'] -= $gs_brutto;
-					$arReturn['sum']['preis_netto'] -= $gs_netto;
-					$arReturn['sum']['preis_gesamt_brutto'] -= $gs_brutto;
-					$arReturn['sum']['preis_gesamt_netto'] -= $gs_netto;
-
-					if ($this->shop->getFrontendTaxview() == WPSG_NETTO)
-					{
-
-						$arReturn['sum']['gs'] = $gs_netto;
-						$arReturn['sum']['gs_netto'] = $gs_netto;
-						$arReturn['sum']['gs_brutto'] = $gs_brutto;
-						$arReturn['sum']['preis'] = $arReturn['sum']['preis_netto'];
-						$arReturn['sum']['preis_gesamt'] = $arReturn['sum']['preis_gesamt_netto'];
-
-					}
-					else if ($this->shop->getFrontendTaxview() == WPSG_BRUTTO)
-					{
-
-						$arReturn['sum']['gs'] = $gs_brutto;
-						$arReturn['sum']['gs_netto'] = $gs_netto;
-						$arReturn['sum']['gs_brutto'] = $gs_brutto;
-						$arReturn['sum']['preis'] = $arReturn['sum']['preis_brutto'];
-						$arReturn['sum']['preis_gesamt'] = $arReturn['sum']['preis_gesamt_brutto'];
-
-					}
-
-				}	// else if ((isset($arReturn['backend'])) && $arReturn['backend'])
-
-			} // gs_value
-
-		} // public function basket_toArray_gs(&$basket, &$arReturn)
-
+ 
 		/**
 		 * PrÃŒft den Basket und entfernt den Gutschein, sollte irgendetwas nicht passen
@@ -894,5 +794,5 @@
 		 * @throws \wpsg\Exception
 		 */
-		public function genGS($value, $calc_typ, $tStart, $tEnd, $multi, $laenge, $comment, $autocreate_order = 0, $autocreate_product = 0, $autocreate_order_product, $productgroups = array(), $products = array(), $minValue = false, $code = false)
+		public function genGS($value, $calc_typ, $tStart, $tEnd, $multi, $laenge, $comment, $autocreate_order = 0, $autocreate_product = 0, $autocreate_order_product, $productgroups = array(), $products = array(), $minValue = false, $code = false, $isCoupon = false)
 		{
 
Index: /mods/wpsg_mod_voucherproduct.class.php
===================================================================
--- /mods/wpsg_mod_voucherproduct.class.php	(revision 7485)
+++ /mods/wpsg_mod_voucherproduct.class.php	(revision 7486)
@@ -178,5 +178,5 @@
 						OP.`product_index`,
 						OP.`menge`,
-						OP.`price_netto`, `price_brutto`
+						OP.`price_netto`, OP.`price_brutto`
 					FROM
 						`".WPSG_TBL_ORDERPRODUCT."` AS OP
Index: /views/admin/form/input.phtml
===================================================================
--- /views/admin/form/input.phtml	(revision 7485)
+++ /views/admin/form/input.phtml	(revision 7486)
@@ -9,5 +9,5 @@
 				type="<?php echo wpsg_getStr($this->view['field_config']['type'], 'text'); ?>"
 				class="form-control input-sm" 
-				name="<?php echo $this->view['field_name']; ?>" 
+				name="<?php echo $this->view['field_name']; ?>"  
 				tabindex="<?php
 
@@ -52,5 +52,5 @@
 
     <?php if (wpsg_isTrue($this->view['field_config']['datepicker'])) { ?>
-    <script type="text/javascript">/* <![CDATA[ */
+    <script>
 
         jQuery(document).ready(function() {
@@ -60,5 +60,5 @@
         } );
 
-    /* ]]> */</script>
+    </script>
     <?php } ?>
 
Index: /views/css/admin.css
===================================================================
--- /views/css/admin.css	(revision 7485)
+++ /views/css/admin.css	(revision 7486)
@@ -7,4 +7,6 @@
 .wpsg_flex_justify_content_space_between { justify-content:space-between; }
 .wpsg_flex_align_items_center { align-items:center; }
+
+.ajax_loading { position:absolute; display:flex; align-items:center; justify-content:center; left:0px; top:0px; width:100%; height:100%; background-color:rgba(255, 255, 255, 0.5); z-index:1000000; }
 
 /* Bootstrap Teil */
@@ -124,5 +126,5 @@
 
 /* Datepicker */
-#ui-datepicker-div { z-index:3 !important; }
+#ui-datepicker-div { z-index:1151221 !important; }
 
 /* Kundenkontakt */
@@ -377,5 +379,11 @@
 .wpsg_mod_voucher_fieldtable .col_groesse { width:60px; }
 .wpsg_voucher .wpsg_status_link_wrap { min-height:50px; float:left; display:inline-block; }
-
+.wpsg_voucher td .actions { opacity:1; font-size: 0.9em; }
+.wpsg_voucher td:hover .actions { opacity:1; }
+
+
+@media (min-width: 768px) {
+    #wpsg_voucher_dialog > .modal-dialog { width:1000px; }
+}
 
 /* Modul Lieferschein/Rechnung */
Index: /views/js/admin.js
===================================================================
--- /views/js/admin.js	(revision 7485)
+++ /views/js/admin.js	(revision 7486)
@@ -1,2 +1,26 @@
+function wpsg_loading(selector) {
+
+	var jqSel = jQuery(selector);
+	
+	jqSel.css( {
+		'position': 'relative',
+		'display': 'block',
+		'width': jqSel.width(),
+		'height': jqSel.height(true)
+	} );
+
+	jqSel.append('<div class="ajax_loading"><img class="loading" src="' + wpsg_ajax.img_ajaxloading + '" alt="Bitte warten" /></div>');
+	
+}
+
+function wpsg_loading_done(selector) {
+
+	var jqSel = jQuery(selector);
+	
+	jqSel.find('.ajax_loading').remove();
+	
+}
+
+
 wpsg_number_format = function (number, decimals, dec_point, thousands_sep) {
 
@@ -209,5 +233,5 @@
 			return false;
 			
-		} );
+		} ).css('pointer-events', 'auto');
 				
 	}
Index: /views/mods/mod_gutschein/add.phtml
===================================================================
--- /views/mods/mod_gutschein/add.phtml	(revision 7485)
+++ /views/mods/mod_gutschein/add.phtml	(revision 7486)
@@ -4,95 +4,91 @@
 	 * Template fÃŒr die Maske eines neuen Gutscheins
 	 */
-
+ 
 ?>
 
-<div class="wpsg_voucher" id="wpsg-bs">
+<div class="content form-horizontal">
 
-    <nav class="navbar navbar-default">
+	<form method="POST" id="wpsg_voucher_form" autocomplete="off">
 
-		<div class="container-fluid">
-			<div class="navbar-header">
-				<a class="navbar-brand" href="#"><?php echo __('wpShopGermany', 'wpsg'); ?></a>
+		<?php wpsg_drawForm_AdminboxStart(); ?>
+			
+			<?php echo wpsg_drawForm_Input('wpsg_mod_gutschein_value', __('Betrag', 'wpsg'), wpsg_ff($this->view['mod_gutschein']['value'])); ?>
+		
+			<div style="margin-top:-15px;"> 
+				<?php echo wpsg_drawForm_Checkbox('wpsg_mod_gutschein_coupon', __('Als Wertgutschein behandeln', 'wpsg'), $this->view['mod_gutschein']['coupon']); ?>
 			</div>
-			<div class="collapse navbar-collapse" id="bs-customer-navbar-collapse-1">
-				<ul class="nav navbar-nav">
-					<li role="presentation" class="wpsg-voucher-tab-a active"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Voucher&action=index"><?php echo __("Gutscheinverwaltung", "wpsg"); ?></a></li>
-                    <li role="presentation" class="active"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Voucher&action=add"><span class="glyphicon glyphicon-plus"></span><?php echo __("Neuer Gutschein", "wpsg"); ?></a></li>
-				</ul>
-				<ul class="nav navbar-nav navbar-right">
+		
+			<div class="wpsg_mod_gutschein_coupon wpsg_mod_gutschein_coupon_0">
+				<?php echo wpsg_drawForm_Select('wpsg_mod_gutschein_calc', __('Berechnung', 'wpsg'), array(
+					'w' => __('Absoluter Betrag', 'wpsg'),
+					'p' => __('Prozentual', 'wpsg')
+				), $this->view['mod_gutschein']['calc']); ?>
+			</div>
 
-				</ul>
-			</div>
-		</div>
+			<?php echo wpsg_drawForm_Input('wpsg_mod_gutschein_start', __('GÃŒltig ab', 'wpsg'), $this->view['mod_gutschein']['start'], array('datepicker' => true)); ?>
+			<?php echo wpsg_drawForm_Input('wpsg_mod_gutschein_end', __('GÃŒltig bis', 'wpsg'), $this->view['mod_gutschein']['end'], array('datepicker' => true)); ?>
 
-    </nav>
+			<?php if (!wpsg_isSizedInt($this->view['edit_id'])) { ?>
+			
+				<?php echo wpsg_drawForm_Select('wpsg_mod_gutschein_gen', __('Code Generierung', 'wpsg'), array(
+					'0' => __('Automatisch', 'wpsg'),
+					'1' => __('Manuell', 'wpsg')
+				), wpsg_getStr($this->view['mod_gutschein']['gen']), array('help' => 'wpsg_mod_gutschein_gen')); ?>
+				<div id="wpsg_mod_gutschein_layercode">
+					<?php echo wpsg_drawForm_Input('wpsg_mod_gutschein_code', __('Code', 'wpsg'), wpsg_getStr($this->view['mod_gutschein']['code']), array('help' => 'wpsg_mod_gutschein_code')); ?>
+				</div>
+		
+			<?php } else { ?>
 
-	<div class="wpsg_clear"></div>
+				<?php echo wpsg_drawForm_Input('wpsg_mod_gutschein_code', __('Code', 'wpsg'), wpsg_getStr($this->view['mod_gutschein']['code']), array('help' => 'wpsg_mod_gutschein_code')); ?>
+				
+			<?php } ?>                
+		
+			<?php echo wpsg_drawForm_Input('wpsg_mod_gutschein_minvalue', __('Minimaler Warenwert', 'wpsg'), wpsg_getStr($this->view['mod_gutschein']['minvalue']), array('help' => 'wpsg_mod_gutschein_minvalue')); ?>
 
-	<div class="content form-horizontal">
+			<?php if (!wpsg_isSizedInt($this->view['edit_id'])) { ?>
+			<?php echo wpsg_drawForm_Input('wpsg_mod_gutschein_count', __('Menge', 'wpsg'), $this->view['mod_gutschein']['count']); ?>
+			<?php } ?>
+			
+			<?php echo wpsg_drawForm_Checkbox('wpsg_mod_gutschein_multi', __('Mehrfach verwendbar', 'wpsg'), $this->view['mod_gutschein']['multi']); ?>
+			<?php echo wpsg_drawForm_Textarea('wpsg_mod_gutschein_comment', __('Kommentar', 'wpsg'), @$this->view['mod_gutschein']['comment']); ?>
+			<?php if ($this->hasMod('wpsg_mod_productgroups') && wpsg_isSizedArray($this->view['wpsg_mod_gutschein']['arProductGroups'])) { ?>
+			<?php echo wpsg_drawForm_Select('wpsg_mod_gutschein_productgroups', __('BeschrÃ€nkung auf Produktgruppen', 'wpsg'), $this->view['wpsg_mod_gutschein']['arProductGroups'], $this->view['mod_gutschein']['productgroups'], array('multiple' => ((sizeof($this->view['wpsg_mod_gutschein']['arProductGroups']) > 5)?5:sizeof($this->view['wpsg_mod_gutschein']['arProductGroups'])), 'help' => 'wpsg_mod_gutschein_productgroups')); ?>
+			<?php } ?>
+			<?php echo wpsg_drawForm_Select('wpsg_mod_gutschein_products', __('BeschrÃ€nkung auf Produkte', 'wpsg'), @$this->view['wpsg_mod_gutschein']['arProducts'], @$this->view['mod_gutschein']['products'], array('multiple' => ((sizeof($this->view['wpsg_mod_gutschein']['arProducts']) > 5)?5:sizeof($this->view['wpsg_mod_gutschein']['arProducts'])), 'help' => 'wpsg_mod_gutschein_products')); ?>
+		<?php echo wpsg_drawForm_AdminboxEnd(); ?>
 
-        <form method="POST" action="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Voucher&action=save&noheader=1" enctype="multipart/form-data">
+		<?php if (wpsg_isSizedInt($this->view['edit_id'])) { ?>
+		
+			<input type="hidden" name="voucher_id" value="<?php echo $this->view['edit_id']; ?>" />
+		
+		<?php } ?>
 
-            <?php wpsg_drawForm_AdminboxStart(); ?>
-                <?php echo wpsg_drawForm_Input('wpsg_mod_gutschein_value', __('Wert', 'wpsg'), $this->view['mod_gutschein']['value']); ?>
-                <?php echo wpsg_drawForm_Select('wpsg_mod_gutschein_calc', __('Berechnung', 'wpsg'), array(
-                    'w' => __('Absoluter Betrag', 'wpsg'),
-                    'p' => __('Prozentual', 'wpsg')
-                ), $this->view['mod_gutschein']['calc']); ?>
-
-                <?php echo wpsg_drawForm_Input('wpsg_mod_gutschein_start', __('GÃŒltig ab', 'wpsg'), $this->view['mod_gutschein']['start'], array('datepicker' => true)); ?>
-                <?php echo wpsg_drawForm_Input('wpsg_mod_gutschein_end', __('GÃŒltig bis', 'wpsg'), $this->view['mod_gutschein']['end'], array('datepicker' => true)); ?>
-
-                <?php if (!wpsg_isSizedInt($this->view['edit_id'])) { ?>
-                
-                    <?php echo wpsg_drawForm_Select('wpsg_mod_gutschein_gen', __('Code Generierung', 'wpsg'), array(
-                        '0' => __('Automatisch', 'wpsg'),
-                        '1' => __('Manuell', 'wpsg')
-                    ), wpsg_getStr($this->view['mod_gutschein']['gen']), array('help' => 'wpsg_mod_gutschein_gen')); ?>
-                    <div id="wpsg_mod_gutschein_layercode">
-                        <?php echo wpsg_drawForm_Input('wpsg_mod_gutschein_code', __('Code', 'wpsg'), wpsg_getStr($this->view['mod_gutschein']['code']), array('help' => 'wpsg_mod_gutschein_code')); ?>
-                    </div>
-            
-                <?php } else { ?>
-
-                    <?php echo wpsg_drawForm_Input('wpsg_mod_gutschein_code', __('Code', 'wpsg'), wpsg_getStr($this->view['mod_gutschein']['code']), array('help' => 'wpsg_mod_gutschein_code')); ?>
-                    
-                <?php } ?>                
-            
-                <?php echo wpsg_drawForm_Input('wpsg_mod_gutschein_minvalue', __('Minimaler Warenwert', 'wpsg'), wpsg_getStr($this->view['mod_gutschein']['minvalue']), array('help' => 'wpsg_mod_gutschein_minvalue')); ?>
-
-                <?php if (!wpsg_isSizedInt($this->view['edit_id'])) { ?>
-                <?php echo wpsg_drawForm_Input('wpsg_mod_gutschein_count', __('Menge', 'wpsg'), $this->view['mod_gutschein']['count']); ?>
-                <?php } ?>
-                
-                <?php echo wpsg_drawForm_Checkbox('wpsg_mod_gutschein_multi', __('Mehrfach verwendbar', 'wpsg'), $this->view['mod_gutschein']['multi']); ?>
-                <?php echo wpsg_drawForm_Textarea('wpsg_mod_gutschein_comment', __('Kommentar', 'wpsg'), @$this->view['mod_gutschein']['comment']); ?>
-                <?php if ($this->hasMod('wpsg_mod_productgroups') && wpsg_isSizedArray($this->view['wpsg_mod_gutschein']['arProductGroups'])) { ?>
-                <?php echo wpsg_drawForm_Select('wpsg_mod_gutschein_productgroups', __('BeschrÃ€nkung auf Produktgruppen', 'wpsg'), $this->view['wpsg_mod_gutschein']['arProductGroups'], $this->view['mod_gutschein']['productgroups'], array('multiple' => ((sizeof($this->view['wpsg_mod_gutschein']['arProductGroups']) > 5)?5:sizeof($this->view['wpsg_mod_gutschein']['arProductGroups'])), 'help' => 'wpsg_mod_gutschein_productgroups')); ?>
-                <?php } ?>
-                <?php echo wpsg_drawForm_Select('wpsg_mod_gutschein_products', __('BeschrÃ€nkung auf Produkte', 'wpsg'), @$this->view['wpsg_mod_gutschein']['arProducts'], @$this->view['mod_gutschein']['products'], array('multiple' => ((sizeof($this->view['wpsg_mod_gutschein']['arProducts']) > 5)?5:sizeof($this->view['wpsg_mod_gutschein']['arProducts'])), 'help' => 'wpsg_mod_gutschein_products')); ?>
-            <?php echo wpsg_drawForm_AdminboxEnd(); ?>
-
-            <?php if (wpsg_isSizedInt($this->view['edit_id'])) { ?>
-            
-                <input type="hidden" name="edit_id" value="<?php echo $this->view['edit_id']; ?>" />
-                <input type="submit" value="<?php echo __('Gutschein speichern', 'wpsg'); ?>" class="button-primary" id="submit" name="submit" />
-                
-            <?php } else { ?>
-            
-                <input type="submit" value="<?php echo __('Gutschein anlegen', 'wpsg'); ?>" class="button-primary" id="submit" name="submit" />
-            
-            <?php } ?>
-
-        </form>
-
-    </div>
+	</form>
 
 </div>
 
-<script type="text/javascript">/* <![CDATA[ */
+<script>
 
     jQuery(document).ready(function() {
 
+		wpsg_ajaxBind();
+				
+		jQuery('#wpsg_mod_gutschein_coupon').on('change', function() {
+			
+			jQuery('.wpsg_mod_gutschein_coupon').hide();
+			
+			if (jQuery(this).prop('checked')) {
+
+				jQuery('.wpsg_mod_gutschein_coupon_1').show();	
+				
+			} else {
+
+				jQuery('.wpsg_mod_gutschein_coupon_0').show();
+				
+			}
+			
+		}).change();
+    	
         jQuery('#wpsg_mod_gutschein_gen').bind('change', function() {
 
@@ -114,3 +110,3 @@
     } );
 
-/* ]]> */</script>
+</script>
Index: /views/mods/mod_gutschein/basket_row_end_coupon.phtml
===================================================================
--- /views/mods/mod_gutschein/basket_row_end_coupon.phtml	(revision 7486)
+++ /views/mods/mod_gutschein/basket_row_end_coupon.phtml	(revision 7486)
@@ -0,0 +1,50 @@
+<?php
+	
+	/**
+	 * User: Daschmi (daschmi@daschmi.de)
+	 * Date: 20.07.2019
+	 * Time: 15:47
+	 */ 
+  	
+	$arCalculation = &$this->view['basket']['arCalculation'];
+	
+	if ($this->getFrontendTaxView() === WPSG_BRUTTO) $display_brutto_netto = 'brutto';
+	else $display_brutto_netto = 'netto';
+	
+?>
+
+<?php foreach ($arCalculation['coupon'] as $gs) { ?>
+	
+	<div class="basket_sum_row">
+		<div class="title">
+			<a class="wpsg_basket_removelink" href="<?php echo str_replace('&', '&amp;', $this->getRemoveLinkURL('voucher_'.$gs['id'])); ?>" title="<?php echo __('Wertgutschein aus dem Warenkorb entfernen', 'wpsg'); ?>" onclick="return confirm('<?php echo __('Sind Sie sich sicher, dass sie den Wertgutschein aus dem Warenkorb entfernen mÃ¶chten?', 'wpsg'); ?>');"><span class="glyphicon glyphicon-trash"></span></a>
+			<?php echo __('Wertgutschein', 'wpsg'); ?> <?php echo ((wpsg_isSizedString($gs['code']))?'('.$gs['code'].')':''); ?>
+		</div>
+		<?php if (sizeof($this->view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?>
+			<div class="colgsr"><?php echo __('anteilig', 'wpsg'); ?></div>
+		<?php } ?>
+		<div class="value"><?php
+				
+				echo '-'.wpsg_ff($gs[$display_brutto_netto], $this->get_option('wpsg_currency'));
+				
+				if (strpos($gs['set'], '%') !== false) {
+					
+					echo '<span class="procent_payship">('.wpsg_ff(wpsg_tf($gs['set']), '%').')</span>';
+					
+				}
+			
+			?></div>
+	
+	</div>
+
+<?php } ?>
+
+<div class="basket_sum_row">
+	<div class="title2">
+		<?php echo __('Zu zahlen', 'wpsg'); ?>:
+	</div>
+	<div class="sum">
+		<?php echo wpsg_ff($arCalculation['sum']['topay_brutto'], $this->get_option('wpsg_currency')); ?>
+	</div>
+</div>
+<div class="wpsg_spacer"></div>
Index: /views/mods/mod_gutschein/index.phtml
===================================================================
--- /views/mods/mod_gutschein/index.phtml	(revision 7485)
+++ /views/mods/mod_gutschein/index.phtml	(revision 7486)
@@ -18,5 +18,5 @@
 					<li role="presentation" class="wpsg-voucher-tab-a active"><a href="#" onclick="return false;"><?php echo __("Gutscheinverwaltung", "wpsg"); ?></a></li>
 					<li role="presentation" class="wpsg-voucher-tab-a wpsg_showhide_filter <?php echo ((($this->view['hasFilter']) && (wpsg_getStr($this->view['arFilter']['s']) != ''))?'active':''); ?>" id="wpsg-voucher-tab-0"><a href="#" onclick="return false;"><span class="glyphicon glyphicon-search"></span><?php echo __("Suche", "wpsg"); ?></a></li>
-                    <li role="presentation" class="<?php echo ((wpsg_isSizedString($_REQUEST['action'], 'add'))?'active':''); ?>"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Voucher&action=add"><span class="glyphicon glyphicon-plus"></span><?php echo __("HinzufÃŒgen", "wpsg"); ?></a></li>
+                    <li role="presentation" class="wpsg-voucher-add" onclick="return false;"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Voucher&action=add"><span class="glyphicon glyphicon-plus"></span><?php echo __("HinzufÃŒgen", "wpsg"); ?></a></li>
 				</ul>
 				<ul class="nav navbar-nav navbar-right">
@@ -91,19 +91,33 @@
                             <td class="col_code">
 
-                                <a title="<?php echo __('Gutschein bearbeiten', 'wpsg'); ?>" href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Voucher&action=edit&edit_id=<?php echo $oVoucher->id; ?>"><?php echo $oVoucher->code; ?></a>
+								<span><?php echo $oVoucher->code; ?></span><br />
                                 
                                 <?php if ($this->hasMod('wpsg_mod_voucherproduct') && $oVoucher->isAutoCreated()) { ?>
                                 &nbsp;[&nbsp;<a href="<?php echo WPSG_URL_WP . 'wp-admin/admin.php?page=wpsg-Order&action=ajax&mod=wpsg_mod_voucherproduct&gs_id='.$oVoucher->id.'&order_id='.$oVoucher->autocreate_order.'&noheader=1&cmd=getVoucher'; ?>"><?php echo __('PDF', 'wpsg'); ?></a>&nbsp;]
                                 <?php } ?>
+
+								<div class="actions">
+									<span class="edit"><a title="<?php echo __("Diesen Gutschein bearbeiten", "wpsg"); ?>" href="#" class="wpsg_voucher_edit" onclick="return false;" data-voucher_id="<?php echo $oVoucher->getId(); ?>"><?php echo __("Bearbeiten", "wpsg"); ?></a></span>
+									|
+									<span class="delete"><a onclick="return confirm('<?php echo __('Sind Sie sich sicher, dass Sie diesen Gutschein lÃ¶schen mÃ¶chten?', 'wpsg'); ?>');" title="<?php echo __('Diese Gutschein lÃ¶schen', 'wpsg'); ?>" href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_gutschein&subaction=delete&noheader=1&voucher_id=<?php echo $oVoucher->getId(); ?>"><?php echo __('LÃ¶schen', 'wpsg'); ?></a></span>
+								</div>
                                                         
                             </td>                            
-                            <td class="col_start"><?php echo wpsg_formatTimestamp($oVoucher->start_date); ?></td>
-                            <td class="col_end"><?php echo wpsg_formatTimestamp($oVoucher->end_date); ?></td>
-                            <td class="col_value"><?php
+                            <td class="col_start"><?php echo wpsg_formatTimestamp($oVoucher->start_date, true); ?></td>
+                            <td class="col_end"><?php echo wpsg_formatTimestamp($oVoucher->end_date, true); ?></td>
+                            <td class="col_value"><span><?php
 
                                 if ($oVoucher->calc_typ == 'w') echo wpsg_ff($oVoucher->value, $this->get_option('wpsg_currency'));
                                 else if ($oVoucher->calc_typ == 'p') echo wpsg_ff($oVoucher->value, '%');
 
-                            ?></td>
+                            ?></span><?php 
+							
+								if ($oVoucher->isCoupon()) {
+									
+									echo '<br />'.__('Wertgutschein', 'wpsg');
+									
+								}
+								
+							?></td>
                             <td class="col_status">
 
@@ -124,5 +138,5 @@
                             </td>
                         </tr>
-                        <?php } ?>
+                        <?php } ?>					
                     </tbody>
                 </table>
@@ -135,12 +149,15 @@
 			</form>
         
-
-        <?php $this->render(WPSG_PATH_VIEW.'/admin/pager.phtml'); ?>
+        	<?php $this->render(WPSG_PATH_VIEW.'/admin/pager.phtml'); ?>
 
         <?php } else { ?>
-
-            <?php echo wpsg_drawForm_AdminboxStart(); ?>
-    		<?php echo __('Keine Gutscheine in der Datenbank.', 'wpsg'); ?>
-            <?php echo wpsg_drawForm_AdminboxEnd(); ?>
+ 
+			<div class="table wpsg_clear">
+            
+				<?php echo wpsg_drawForm_AdminboxStart(); ?>
+    			<?php echo __('Keine Gutscheine in der Datenbank.', 'wpsg'); ?>
+            	<?php echo wpsg_drawForm_AdminboxEnd(); ?>
+
+			</div>
 
         <?php } ?>
@@ -148,4 +165,21 @@
     </div>
 
+</div>
+
+<!-- Modaldialog fÃŒr Gutscheine -->
+<div class="modal fade" id="wpsg_voucher_dialog" tabindex="-1" role="dialog">
+	<div class="modal-dialog" role="document">
+		<div class="modal-content">
+			<div class="modal-header">
+				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
+				<h4 class="modal-title" id="myModalLabel"><?php echo __('Gutschein hinzufÃŒgen/bearbeiten', 'wpsg'); ?></h4>
+			</div>
+			<div class="modal-body"></div>
+			<div class="modal-footer">
+				<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo __('Abbrechen', 'wpsg'); ?></button>
+				<button type="button" class="btn btn-primary wpsg-voucher-save" onclick="return false;"><?php echo __('OK', 'wpsg'); ?></button>
+			</div>
+		</div>
+	</div>
 </div>
 
@@ -155,5 +189,71 @@
     jQuery('th[data-order="<?php echo $this->view['arFilter']['order']; ?>"]').addClass('wpsg_order_<?php echo strtolower($this->view['arFilter']['ascdesc']); ?>');
     <?php } ?>
-
+	
+	jQuery('.wpsg-voucher-add').on('click', function() {
+
+		jQuery('#wpsg_voucher_dialog .modal-body').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+		jQuery('#wpsg_voucher_dialog').modal( { } ).modal('show');
+
+		jQuery.ajax({
+			url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_gutschein&subaction=addedit&noheader=1',
+			success: function(data) {
+
+				jQuery('#wpsg_voucher_dialog .modal-body').html(data);
+				
+			}
+		});
+		
+		return false;
+		
+	}).attr("onclick", null);
+
+	jQuery('.wpsg_voucher_edit').on('click', function() {
+
+		jQuery('#wpsg_voucher_dialog .modal-body').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+		jQuery('#wpsg_voucher_dialog').modal( { } ).modal('show');
+
+		jQuery.ajax({
+			url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_gutschein&subaction=addedit&noheader=1&voucher_id=' + jQuery(this).data("voucher_id"),
+			success: function(data) {
+
+				jQuery('#wpsg_voucher_dialog .modal-body').html(data);
+
+			}
+		});
+
+		return false;
+		
+	}).attr("onclick", null);
+	
+	jQuery('.wpsg-voucher-save').on('click', function() {
+
+		//jQuery('#wpsg_voucher_dialog .modal-body').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+		//jQuery('#wpsg_voucher_dialog').modal('hide');
+		
+		wpsg_loading('#wpsg_voucher_dialog .modal-body');
+		
+		jQuery.ajax({
+			url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_gutschein&subaction=save&noheader=1',
+			data: {
+				form_data: jQuery('#wpsg_voucher_form').serialize()
+			},
+			success: function(data) {
+
+				wpsg_loading_done('#wpsg_voucher_dialog .modal-body');
+								
+				if (data !== "1") alert(data);
+				else {
+				
+					location.reload();
+					
+				}
+
+			}
+		});
+		
+		return false;
+		
+	}).attr("onclick", null);
+	
 	function wpsg_setFilterStatus(state)
 	{
Index: /views/mods/mod_gutschein/overview_row_end_coupon.phtml
===================================================================
--- /views/mods/mod_gutschein/overview_row_end_coupon.phtml	(revision 7486)
+++ /views/mods/mod_gutschein/overview_row_end_coupon.phtml	(revision 7486)
@@ -0,0 +1,52 @@
+<?php
+	
+	declare(strict_types=1);
+	
+	/**
+	 * User: Daschmi (daschmi@daschmi.de)
+	 * Date: 20.07.2019
+	 * Time: 16:11
+	 */ 
+    
+	$arCalculation = &$this->view['basket']['arCalculation'];
+	
+	if ($this->getFrontendTaxView() === WPSG_BRUTTO) $display_brutto_netto = 'brutto';
+	else $display_brutto_netto = 'netto';
+	
+?>
+
+<?php if (wpsg_isSizedArray($arCalculation['coupon'])) { ?>
+	
+	<?php foreach ($arCalculation['coupon'] as $gs) { ?>
+		
+		<div class="overview_sum_row">
+			<div class="title">
+				<?php echo __('Wertgutschein', 'wpsg'); ?> <?php echo ($gs['code'] != '')? '('.$gs['code'].')':'' ?>
+			</div>
+			<div class="value"><?php
+					
+					echo '-'.wpsg_ff($gs[$display_brutto_netto], $this->get_option('wpsg_currency'));
+					
+					if (strpos($gs['set'], '%') !== false) {
+						
+						echo '<span class="procent_payship">('.wpsg_ff(wpsg_tf($gs['set']), '%').')</span>';
+						
+					}
+				
+				?></div>
+		</div>
+	
+	<?php } ?>
+
+<?php } ?>
+
+<div class="wpsg_spacer"></div>
+<div class="overview_sum_row">
+	<div class="title2">
+		<?php echo __('Zu zahlen', 'wpsg'); ?>:
+	</div>
+	<div class="sum">
+		<?php echo wpsg_ff($arCalculation['topay_'.$display_brutto_netto], $this->get_option('wpsg_currency')); ?>
+	</div>
+</div>
+<div class="wpsg_spacer"></div>
Index: /views/order/backendEdit/addVoucher.phtml
===================================================================
--- /views/order/backendEdit/addVoucher.phtml	(revision 7485)
+++ /views/order/backendEdit/addVoucher.phtml	(revision 7486)
@@ -16,13 +16,32 @@
 	
 	$arCalculation = $oCalculation->getCalculationArray();
+	$voucher = [
+		'code' => '',
+		'id' => 0,
+		'set' => 0,
+		'type' => 'voucher'
+	];
 	
-	$strVal = ((isset($arCalculation['voucher'][0]['set']))?$arCalculation['voucher'][0]['set']:0); 
+	// Voucher suchen
+	foreach (array_merge($arCalculation['voucher'], $arCalculation['coupon']) as $v) {
+		
+		if ($v['order_voucher_id'] == $_REQUEST['order_voucher_id']) {
+			
+			$voucher = $v;
+			
+		}
+		
+	}
+	  
+	$strVal = ((isset($voucher['set']))?$voucher['set']:0); 
 	
 	if (strpos($strVal, '%') !== false) $strVal = wpsg_ff(wpsg_tf($strVal), '%');
 	else $strVal = wpsg_ff(wpsg_tf($strVal), $this->get_option('wpsg_currency'));
-	
+ 	
 ?>
 
 <form id="wpsg_be_voucher_form">
+	
+	<input type="hidden" name="order_voucher_id" value="<?php echo wpsg_getInt($_REQUEST['order_voucher_id']); ?>" />
 	
 	<div class="autocomplete_wrap">
@@ -32,7 +51,8 @@
 	<br />
 				
-	<?php echo wpsg_drawForm_Input('be_voucher_code', __('Code (Optional)', 'wpsg'), @$arCalculation['voucher'][0]['code']); ?>
-	<?php echo wpsg_drawForm_Input('be_voucher_id', __('Guschein ID (Optional)', 'wpsg'), @$arCalculation['voucher'][0]['id']); ?>
+	<?php echo wpsg_drawForm_Input('be_voucher_code', __('Code (Optional)', 'wpsg'), @$voucher['code']); ?>
+	<?php echo wpsg_drawForm_Input('be_voucher_id', __('Guschein ID', 'wpsg'), @$voucher['id']); ?>
 	<?php echo wpsg_drawForm_Input('be_voucher_amount', wpsg_translate(__('Gutscheinwert in #1# (#2#) oder % ', 'wpsg'), $this->get_option('wpsg_currency'), $strBN), $strVal); ?>
+	<?php echo wpsg_drawForm_Checkbox('be_voucher_coupon', __('Wertgutschein'), (($voucher['type'] === 'coupon')?'1':'0')); ?>
 		
 </form>
Index: /views/order/product_table.phtml
===================================================================
--- /views/order/product_table.phtml	(revision 7485)
+++ /views/order/product_table.phtml	(revision 7486)
@@ -99,6 +99,6 @@
 							<?php } ?>
 
-							<a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Gutschein bearbeiten', 'wpsg'); ?>" onclick="return WPSG_BE_Voucher.editVoucher();"><span class="glyphicon glyphicon-pencil"></span></a>
-							<a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Gutschein lÃ¶schen', 'wpsg'); ?>" onclick="return WPSG_BE_Voucher.removeVoucher();"><span class="glyphicon glyphicon-trash"></span></a>
+							<a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Gutschein bearbeiten', 'wpsg'); ?>" onclick="return WPSG_BE_Voucher.editVoucher(<?php echo $v['order_voucher_id']; ?>);"><span class="glyphicon glyphicon-pencil"></span></a>
+							<a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Gutschein lÃ¶schen', 'wpsg'); ?>" onclick="return WPSG_BE_Voucher.removeVoucher(<?php echo $v['order_voucher_id']; ?>);"><span class="glyphicon glyphicon-trash"></span></a>
 						</div>
 						<div>
@@ -110,5 +110,5 @@
 						
 						<?php if (strpos($v['set'], '%') === false) { ?>
-							<?php echo wpsg_ff($arCalculation['sum']['voucher_'.$display], $this->get_option('wpsg_currency')); ?>
+							<?php echo wpsg_ff($v[$display], $this->get_option('wpsg_currency')); ?>
 						<?php } else { ?>
 							<?php echo wpsg_ff($v['set'], '%'); ?>
@@ -122,9 +122,9 @@
 					<td class="wpsg_cell_mwst_value wpsg_cell_gesamtpreis"><?php 
 							
-						echo wpsg_ff($arCalculation['sum']['voucher_'.$display]); ?> <?php echo $this->get_option('wpsg_currency');
-						
-						if (strpos($arCalculation['voucher'][0]['set'], '%') !== false) { 
-
-							echo '<span class="procent_payship">('.wpsg_ff(wpsg_tf($arCalculation['voucher'][0]['set']), '%').')</span>';
+						echo wpsg_ff($v[$display]); ?> <?php echo $this->get_option('wpsg_currency');
+						
+						if (strpos($v['set'], '%') !== false) { 
+
+							echo '<span class="procent_payship">('.wpsg_ff(wpsg_tf($v['set']), '%').')</span>';
 
 						} 
@@ -315,4 +315,73 @@
 			
 		<?php } ?>
+		
+		<?php // Wertgutscheine  ?>
+		<?php if (wpsg_isSizedArray($arCalculation['coupon'])) { ?>
+			
+			<?php foreach ($arCalculation['coupon'] as $c) { ?>
+
+				<tr class="wpsg_row_discount wpsg_row_small">
+					<td colspan="" class="wpsg_cell_mwst_label">
+
+						<div>
+							<?php echo __('Wertgutschein', 'wpsg'); ?>
+							
+							<?php if ($this->getBackendTaxView() === WPSG_BRUTTO) { ?>
+								<?php echo __('(inkl. MwSt.)', 'wpsg'); ?>
+							<?php } else { ?>
+								<?php echo __('(zzgl. MwSt.)', 'wpsg'); ?>
+							<?php } ?>
+
+							<a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Wertgtschein bearbeiten', 'wpsg'); ?>" onclick="return WPSG_BE_Voucher.editVoucher(<?php echo $c['order_voucher_id']; ?>);"><span class="glyphicon glyphicon-pencil"></span></a>
+							<a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Wertgutschein lÃ¶schen', 'wpsg'); ?>" onclick="return WPSG_BE_Voucher.removeVoucher(<?php echo $c['order_voucher_id']; ?>);"><span class="glyphicon glyphicon-trash"></span></a>
+						</div>
+						<div>
+							Code: <?php echo $c['code']; ?>
+						</div>
+
+					</td>
+					<td class="wpsg_cell_preis">
+						
+						<?php if (strpos($c['set'], '%') === false) { ?>
+							<?php echo wpsg_ff($c[$display], $this->get_option('wpsg_currency')); ?>
+						<?php } else { ?>
+							<?php echo wpsg_ff($c['set'], '%'); ?>
+						<?php } ?>
+
+					</td>
+					<?php if (sizeof($arCalculation['tax']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?>
+						<td class="wpsg_cell_mwst"><?php echo $arTaxShort[$c['tax_key']]; ?></td>
+					<?php } ?>
+					<td>1</td>
+					<td class="wpsg_cell_mwst_value wpsg_cell_gesamtpreis"><?php
+							
+							echo wpsg_ff($c[$display]); ?> <?php echo $this->get_option('wpsg_currency');
+							
+							if (strpos($c['set'], '%') !== false) {
+								
+								echo '<span class="procent_payship">('.wpsg_ff(wpsg_tf($c['set']), '%').')</span>';
+								
+							}
+						
+						?></td>
+				</tr>
+			
+			<?php } ?>
+
+			<tr class="wpsg_row_gesamt">
+				<td colspan="<?php echo $this->view['colspan']; ?>" class="wpsg_cell_summe_label">
+					<strong><?php echo __('Zu zahlen', 'wpsg'); ?></strong>
+					<?php if ($this->getBackendTaxView() === WPSG_BRUTTO) { ?>
+						<?php echo __('(inkl. MwSt.)', 'wpsg'); ?>
+					<?php } else { ?>
+						<?php echo __('(zzgl. MwSt.)', 'wpsg'); ?>
+					<?php } ?>
+				</td>
+				<td class="wpsg_cell_gesamt_value wpsg_cell_gesamtpreis">
+					<strong><?php echo wpsg_ff($arCalculation['sum']['topay_brutto']); ?> <?php echo $this->get_option('wpsg_currency'); ?></strong>
+				</td>
+			</tr>
+		
+		<?php } ?>	
 	
 	</tbody>
Index: /views/order/view_orderdata.phtml
===================================================================
--- /views/order/view_orderdata.phtml	(revision 7485)
+++ /views/order/view_orderdata.phtml	(revision 7486)
@@ -183,5 +183,5 @@
 		var WPSG_BE_Voucher = {
 			
-			editVoucher: function() {
+			editVoucher: function(order_voucher_id) {
 	
 				jQuery('#wpsg_voucher_dialog .modal-body').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
@@ -189,5 +189,5 @@
 	
 				jQuery.ajax( {
-					url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=view&subaction=editVoucher&edit_id=<?php echo $_REQUEST['edit_id']; ?>&noheader=1',
+					url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=view&subaction=editVoucher&edit_id=<?php echo $_REQUEST['edit_id']; ?>&order_voucher_id=' + order_voucher_id + '&noheader=1',
 					success: function(data) {
 	
@@ -201,10 +201,10 @@
 			},
 			
-			removeVoucher: function() {
-	
-				jQuery('#wpsg_product_table_wrap').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
-	
-				jQuery.ajax( {
-					url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=view&subaction=editVoucher&do=remove&edit_id=<?php echo $_REQUEST['edit_id']; ?>&noheader=1',
+			removeVoucher: function(order_voucher_id) {
+	
+				jQuery('#wpsg_product_table_wrap').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+	
+				jQuery.ajax( {
+					url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=view&subaction=editVoucher&do=remove&edit_id=<?php echo $_REQUEST['edit_id']; ?>&order_voucher_id=' + order_voucher_id + '&noheader=1',
 					success: function(data) {
 	
Index: /views/warenkorb/basket.phtml
===================================================================
--- /views/warenkorb/basket.phtml	(revision 7485)
+++ /views/warenkorb/basket.phtml	(revision 7486)
@@ -6,4 +6,5 @@
 
 	//wpsg_debug($this->view['basket']);
+	//wpsg_debug($this->view['basket']['arCalculation']);
 	//wpsg_debug($_SESSION);
 	//wpsg_debug($this->arShipping);
@@ -11,4 +12,7 @@
 	//wpsg_debug(__('Deutschland', 'wpsg'));
 
+	if ($this->getFrontendTaxView() === WPSG_BRUTTO) $display_brutto_netto = 'brutto';
+	else $display_brutto_netto = 'netto';
+	
 ?>
 <div class="wpsg wpsg_basket <?php echo ((isset($_REQUEST['wpsg_basket_ajax']))?'wpsg_basket_ajax':''); ?>">
@@ -141,27 +145,34 @@
 
 			<?php $bLine = false; ?>
-			<?php if (isset($this->view['basket']['gs'])) { $bLine = true; ?>
+			
+			
+			
+			<?php if (wpsg_isSizedArray($this->view['basket']['arCalculation']['voucher'])) { $bLine = true; ?>
 				
-				<div class="basket_sum_row">
-					<div class="title">
-						<a class="wpsg_basket_removelink" href="<?php echo str_replace('&', '&amp;', $this->getRemoveLinkURL('gs')); ?>" title="<?php echo __('Gutschein aus dem Warenkorb entfernen', 'wpsg'); ?>" onclick="return confirm('<?php echo __('Sind Sie sich sicher, dass sie den Gutschein aus dem Warenkorb entfernen mÃ¶chten?', 'wpsg'); ?>');"><span class="glyphicon glyphicon-trash"></span></a>
-						<?php echo __('Gutschein', 'wpsg'); ?> <?php echo ($this->view['basket']['gs']['code'] != '')? '('.$this->view['basket']['gs']['code'].')':'' ?>
-					</div>
-					<?php if (sizeof($this->view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?>
-						<div class="colgsr"><?php echo __('anteilig', 'wpsg'); ?></div>
-					<?php } ?>
-					<div class="value"><?php
-							
-						echo '-'.wpsg_ff($this->view['basket']['sum']['gs'], $this->get_option('wpsg_currency'));
-						
-						if (strpos($this->view['basket']['arCalculation']['voucher'][0]['set'], '%') !== false) {
-							
-							echo '<span class="procent_payship">('.wpsg_ff(wpsg_tf($this->view['basket']['arCalculation']['voucher'][0]['set']), '%').')</span>';
-							
-						}
-					 
-					?></div>
+				<?php foreach ($this->view['basket']['arCalculation']['voucher'] as $gs) { ?>
+				
+					<div class="basket_sum_row">
+						<div class="title">
+							<a class="wpsg_basket_removelink" href="<?php echo str_replace('&', '&amp;', $this->getRemoveLinkURL('voucher_'.$gs['id'])); ?>" title="<?php echo __('Gutschein aus dem Warenkorb entfernen', 'wpsg'); ?>" onclick="return confirm('<?php echo __('Sind Sie sich sicher, dass sie den Gutschein aus dem Warenkorb entfernen mÃ¶chten?', 'wpsg'); ?>');"><span class="glyphicon glyphicon-trash"></span></a>
+							<?php echo __('Gutschein', 'wpsg'); ?> <?php echo ((wpsg_isSizedString($gs['code']))?'('.$gs['code'].')':''); ?>
+						</div>
+						<?php if (sizeof($this->view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?>
+							<div class="colgsr"><?php echo __('anteilig', 'wpsg'); ?></div>
+						<?php } ?>
+						<div class="value"><?php
+								
+							echo wpsg_ff($gs[$display_brutto_netto], $this->get_option('wpsg_currency'));
+							
+							if (strpos($gs['set'], '%') !== false) {
+								
+								echo '<span class="procent_payship">('.wpsg_ff(wpsg_tf($gs['set']), '%').')</span>';
+								
+							}
+						 
+						?></div>
+						
+					</div>				
 					
-				</div>
+				<?php } ?>
 				
 			<?php } ?>
@@ -374,5 +385,7 @@
 				<div class="wpsg_spacer"></div>
 			<?php } ?>
-
+			
+			<?php $this->callMod('wpsg_mod_gutschein', 'basket_row_end_coupon'); ?>
+			
 			<?php $this->callMods('basket_row_end', array(&$this->view)); ?>
 
Index: /views/warenkorb/overview.phtml
===================================================================
--- /views/warenkorb/overview.phtml	(revision 7485)
+++ /views/warenkorb/overview.phtml	(revision 7486)
@@ -7,4 +7,7 @@
 
 	//wpsg_debug($this->view['basket']);
+	
+	if ($this->getFrontendTaxView() === WPSG_BRUTTO) $display_brutto_netto = 'brutto';
+	else $display_brutto_netto = 'netto';
 
 ?>
@@ -268,23 +271,29 @@
 
 			<?php $bLine = false; ?>
-			<?php if (isset($this->view['basket']['gs'])) { $bLine = true; ?>
-				<div class="overview_sum_row">
-					<div class="title">
-						<?php echo __('Gutschein', 'wpsg'); ?> <?php echo ($this->view['basket']['gs']['code'] != '')? '('.$this->view['basket']['gs']['code'].')':'' ?>
-					</div>
-					<div class="value"><?php 
-							
-						echo '-'.wpsg_ff($this->view['basket']['sum']['gs'], $this->get_option('wpsg_currency'));
-							
-						if (strpos($this->view['basket']['arCalculation']['voucher'][0]['set'], '%') !== false) {
-							
-							echo '<span class="procent_payship">('.wpsg_ff(wpsg_tf($this->view['basket']['arCalculation']['voucher'][0]['set']), '%').')</span>';
-							
-						}
-							
-					?></div>					
-				</div>
-			<?php } ?>
-
+			<?php if (wpsg_isSizedArray($this->view['basket']['arCalculation']['voucher'])) { $bLine = true; ?>
+			
+				<?php foreach ($this->view['basket']['arCalculation']['voucher'] as $gs) { ?>
+
+					<div class="overview_sum_row">
+						<div class="title">
+							<?php echo __('Gutschein', 'wpsg'); ?> <?php echo ($gs['code'] != '')? '('.$gs['code'].')':'' ?>
+						</div>
+						<div class="value"><?php
+								
+							echo wpsg_ff($gs[$display_brutto_netto], $this->get_option('wpsg_currency'));
+							
+							if (strpos($gs['set'], '%') !== false) {
+								
+								echo '<span class="procent_payship">('.wpsg_ff(wpsg_tf($gs['set']), '%').')</span>';
+								
+							}
+							
+						?></div>
+					</div>
+					
+				<?php } ?>
+			
+			<?php } ?>
+			 
 			<div class="overview_sum_row">
 				<?php if (isset($this->view['basket']['sum']['preis_rabatt']) && wpsg_tf($this->view['basket']['sum']['preis_rabatt']) > 0) { ?>
@@ -461,5 +470,8 @@
 			<?php } ?>
 
+			<?php echo $this->callMod('wpsg_mod_gutschein', 'overview_row_end_coupon'); ?>
+			
 			<?php $this->callMods('overview_row_end', array(&$this->view)); ?>
+			
 			<div class="wpsg_spacer"></div>
 
Index: /wpshopgermany.php
===================================================================
--- /wpshopgermany.php	(revision 7485)
+++ /wpshopgermany.php	(revision 7486)
@@ -33,4 +33,5 @@
 	define('WPSG_TBL_MWST', $prefix.'wpsg_mwst'); // Deprecated ab 3.5 nur noch fÃŒr Migrationszwecke! 
 	define('WPSG_TBL_ORDER', $prefix.'wpsg_order');
+	define('WPSG_TBL_ORDER_VOUCHER', $prefix.'wpsg_order_voucher');
 	define('WPSG_TBL_ORDERPRODUCT', $prefix.'wpsg_order_products');
 	define('WPSG_TBL_KU', $prefix.'wpsg_kunden');
@@ -84,4 +85,6 @@
 	define('WPSG_SANITIZE_HEXCOLOR', 11);
 	define('WPSG_SANITIZE_PAGEID', 12);
+	define('WPSG_SANITIZE_DATETIME', 13);
+	define('WPSG_SANITIZE_ARRAY_INT', 14);
  	
 	// Ist in Multiblog manchma nicht definiert :? Sonst ist hier das Verzeichnis drin
