Index: /lib/wpsg_basket.class.php
===================================================================
--- /lib/wpsg_basket.class.php	(revision 7263)
+++ /lib/wpsg_basket.class.php	(revision 7264)
@@ -1941,5 +1941,7 @@
 				$arReturn['produkte'][$product_index]['preis_netto'] = $p['netto_single'];
 				$arReturn['produkte'][$product_index]['preis_brutto'] = $p['brutto_single'];
-				$arReturn['produkte'][$product_index]['mwst_value'] = $arCalculation['tax'][$p['tax_key']]['tax_value'];
+				
+				if ($p['tax'] == '0') $arReturn['produkte'][$product_index]['mwst_value'] = 0;
+				else $arReturn['produkte'][$product_index]['mwst_value'] = $arCalculation['tax'][$p['tax_key']]['tax_value'];
 				
 			}
@@ -1962,8 +1964,9 @@
 			];
 			
-			//wpsg_debug($arReturn['sum']); die(wpsg_debug($arCalculation['sum']));         
-			
-			//$arReturn['noMwSt'] = '0';
-			
+			$arReturn['shipping']['mwst'] = ($arCalculation['shipping'][0]['tax']??0);
+			$arReturn['shipping']['preis_shipping_netto'] = ($arCalculation['shipping'][0]['netto']??0);
+			$arReturn['shipping']['preis_shipping_brutto'] = ($arCalculation['shipping'][0]['brutto']??0);
+			$arReturn['shipping']['tax_value'] = $arCalculation['tax'][$arCalculation['shipping'][0]['tax_key']]['tax_value'];
+			 
 			$arReturn['mwst'] = [];
 			
@@ -1987,4 +1990,8 @@
 			}
 			
+			// Alte Templates greifen auf den Shipping Array zu, deshalb dort auch korrigieren
+			//$this->shop->arShipping[$arCalculation['shipping'][0]['shipping_key']]['']			
+			//$this->shop->arShipping[$arCalculation['shipping'][0]['shipping_key']]['mwst_value'] = $arCalculation['tax'][$arCalculation['shipping'][0]['tax_key']]['tax_value'];
+			 
 			return $arReturn;
 			
Index: /lib/wpsg_calculation.class.php
===================================================================
--- /lib/wpsg_calculation.class.php	(revision 7263)
+++ /lib/wpsg_calculation.class.php	(revision 7264)
@@ -380,5 +380,5 @@
             		
 				});
-	            	
+	            	 
                 foreach ($this->arCalculationRow as $cr) {
                 	             
@@ -934,5 +934,5 @@
 				
 				$shipping = $this->shop->arShipping[$_SESSION['wpsg']['checkout']['shipping']];
-				$this->addShipping($shipping['price'], $this->shop->getBackendTaxview(), $shipping['mwst_key'], $_SESSION['wpsg']['checkout']['shipping']);
+				$this->addShipping($shipping['price_backend'], $this->shop->getBackendTaxview(), $shipping['mwst_key'], $_SESSION['wpsg']['checkout']['shipping']);
 				
 			}
Index: /model/wpsg_product.class.php
===================================================================
--- /model/wpsg_product.class.php	(revision 7263)
+++ /model/wpsg_product.class.php	(revision 7264)
@@ -472,6 +472,4 @@
 		{
 
-		    return true;
-		    
 			$arAllowedShipping = explode(',', $this->allowedshipping);
 			$arAllowedShipping = wpsg_trim($arAllowedShipping, array('', '0'));
@@ -485,5 +483,5 @@
 
 			if ($this->shop->hasMod('wpsg_mod_downloadprodukte') && $this->shop->callMod('wpsg_mod_downloadprodukte', 'getProdFiles',[$this->id]) !== false) {
-			    
+							    
 			    return true;
 			    
Index: /mods/wpsg_mod_basic.class.php
===================================================================
--- /mods/wpsg_mod_basic.class.php	(revision 7263)
+++ /mods/wpsg_mod_basic.class.php	(revision 7264)
@@ -427,4 +427,7 @@
 		public function basket_afterRemove() { }
 		
+		/** Integriert sich in die LÃ€nderverwaltung beim bearbeiten/anlegen eines Landes */
+		public function laender_edit() {}
+		
 		/**
 		 * Wird nach der Aktualisierung des Warenkorbs aufgerufen
Index: /mods/wpsg_mod_coverletter.class.php
===================================================================
--- /mods/wpsg_mod_coverletter.class.php	(revision 7263)
+++ /mods/wpsg_mod_coverletter.class.php	(revision 7264)
@@ -109,4 +109,13 @@
 		public function order_view($order_id, &$arSidebarArray) {
 			
+			$this->shop->view['mod_coverletter']['arCoverLetter'] = $this->db->fetchAssoc("
+				SELECT
+					CL.*
+				FROM
+					`".WPSG_TBL_COVERLETTER."` AS CL
+				WHERE
+					CL.`order_id` = '".wpsg_q($order_id)."'
+			");
+			
 			$arSidebarArray[$this->id] = array(
 				'title' => $this->name,
@@ -184,6 +193,6 @@
 		
 		public function order_ajax() {
-
-			if (isset($_REQUEST['wpsg_coverletter_preview'])) {
+ 
+			if (isset($_REQUEST['wpsg_mod_coverletter_preview'])) {
 
 				// Vorschau eines Anschreibenes aus der Bestellverwaltung
@@ -197,5 +206,16 @@
 			
 				die();
-			
+				
+			} else if (isset($_REQUEST['wpsg_mod_coverletter_get'])) {
+				
+				$order_id = intval($_REQUEST['order_id']);
+				$cl_id = intval($_REQUEST['cl_id']);
+				
+				$file = $this->getFilePath($order_id).'coverletter_'.intval($cl_id).'.pdf';
+				
+				wpsg_header::PDFPlugin($file);
+				
+				exit;
+				
 			} else if (isset($_REQUEST['wpsg_mod_coverletter_write'])) {
 				 
@@ -210,5 +230,21 @@
 				
 				$filename = $this->getFilePath($_REQUEST['edit_id']).'/coverletter_'.$cl_id.'.pdf';
-								
+				
+				$arCustomReplace = [];
+				
+				if ($_REQUEST['target'] === '2') {
+				
+					$arCustomReplace = [
+						'/%shopinfo_street%/i' => $this->shop->get_option('wpsg_shopdata_2_street'),
+						'/%shopinfo_zip%/i' => $this->shop->get_option('wpsg_shopdata_2_zip'),
+						'/%shopinfo_city%/i' => $this->shop->get_option('wpsg_shopdata_2_city'),
+						'/%shopinfo_country%/i' => $this->shop->get_option('wpsg_shopdata_2_country'),
+						'/%shopinfo_tel%/i' => $this->shop->get_option('wpsg_shopdata_2_tel'),
+						'/%shopinfo_fax%/i' => $this->shop->get_option('wpsg_shopdata_2_fax'),
+						'/%shopinfo_email%/i' => $this->shop->get_option('wpsg_shopdata_2_email')
+					];
+					
+				} 
+				
 				// Anschreiben erstellen
 				$bOK = $this->writeCoverLetter(
@@ -217,5 +253,6 @@
 					false,
 					$cl_id,
-					$filename
+					$filename,
+					$arCustomReplace
 				);
 				
@@ -303,5 +340,5 @@
 		 * Generiert das Anschreiben fÃŒr eine Bestellung
 		 */
-		public function writeCoverLetter($order_id, $text, $preview, $clnr, $filename) {
+		public function writeCoverLetter($order_id, $text, $preview, $clnr, $filename, $arCustomReplace = []) {
 
 			if ($preview === true && !wpsg_isSizedInt($order_id)) {
@@ -364,5 +401,12 @@
 			foreach ($this->shop->view['arTexts'] as $k => $t) {
 				
-				$this->shop->view['arTexts'][$k]['text'] = $this->shop->replaceUniversalPlatzhalter($t['text'], $oOrder->id);
+				$this->shop->view['arTexts'][$k]['text'] = $this->shop->replaceUniversalPlatzhalter(
+					$t['text'], 
+					$oOrder->id,
+					false,
+					false,
+					false,
+					$arCustomReplace
+				);
 				
 			}
Index: /mods/wpsg_mod_versandarten.class.php
===================================================================
--- /mods/wpsg_mod_versandarten.class.php	(revision 7263)
+++ /mods/wpsg_mod_versandarten.class.php	(revision 7264)
@@ -272,8 +272,11 @@
 				$va = $this->getVaKosten($arBasket, $va);
 				
-				if (wpsg_isSizedInt($this->shop->country)) $oCountry = wpsg_country::getInstance($this->shop->country);
-				if (wpsg_isSizedInt($this->shop->basket->arCheckout['land'])) $oCountry = wpsg_country::getInstance($this->shop->basket->arCheckout['land']);
-				if (!isset($oCountry)) $oCountry = $this->shop->getDefaultCountry();
+				//if (wpsg_isSizedInt($this->shop->country)) $oCountry = wpsg_country::getInstance($this->shop->country);
+				//if (wpsg_isSizedInt($this->shop->basket->arCheckout['land'])) $oCountry = wpsg_country::getInstance($this->shop->basket->arCheckout['land']);
+				//if (!isset($oCountry)) $oCountry = $this->shop->getDefaultCountry();
 				//$mwst_value = $this->getTaxValue($va['mwst_key'], $this->shop->getDefaultCountry());
+				
+				$oCountry = $this->shop->getDefaultCountry();				
+				
 				$mwst_value = $this->getTaxValue($va['mwst_key'], $oCountry);
 				
@@ -303,4 +306,5 @@
 						$shipping_brutto = $this->calculatePreis($va, $arBasket);
 						$shipping_netto = wpsg_calculatePreis($shipping_brutto, WPSG_NETTO, $mwst_value);
+						$arShipping[$this->id.'_'.$va['id']]['price_backend'] = $shipping_brutto;
 						
 					}
@@ -310,9 +314,13 @@
 						$shipping_netto = $this->calculatePreis($va, $arBasket);
 						$shipping_brutto = wpsg_calculatePreis($shipping_netto, WPSG_BRUTTO, $mwst_value);
-						
-					}
+						$arShipping[$this->id.'_'.$va['id']]['price_backend'] = $shipping_netto;
+						
+					}
+					
+					$arShipping[$this->id.'_'.$va['id']]['price_netto'] = $shipping_netto;
+					$arShipping[$this->id.'_'.$va['id']]['price_brutto'] = $shipping_brutto;
 					
 					if ($arBasket['noMwSt'] == '1') $shipping_brutto = $shipping_netto;
-					
+										
 					// Entsprechenden Preis anzeigen
 					if ($this->shop->getFrontendTaxview() == WPSG_NETTO || @$arBasket['noMwst'] == '1')
@@ -529,5 +537,5 @@
 				
 			}
-						
+					
 			$arKosten = explode('|', $kosten);
 			if (sizeof($arKosten) == 1) $kosten = $arKosten[0];
Index: /mods/wpsg_mod_willcollect.class.php
===================================================================
--- /mods/wpsg_mod_willcollect.class.php	(revision 7263)
+++ /mods/wpsg_mod_willcollect.class.php	(revision 7264)
@@ -261,5 +261,6 @@
 					$shipping_netto = $this->getPreis($this->shop->get_option('wpsg_mod_autodebit_gebuehr'), $arBasket['sum']['preis']);
 					$shipping_brutto = wpsg_calculatePreis($shipping_netto, WPSG_BRUTTO, $mwst_value);
-						
+					$arShipping[$this->id]['price_backend'] = $shipping_netto;
+					
 				}
 				else
@@ -267,5 +268,6 @@
 												
 					$shipping_brutto = $this->getPreis($this->shop->get_option('wpsg_mod_autodebit_gebuehr'), $arBasket['sum']['preis']);																								
-					$shipping_netto = wpsg_calculatePreis($shipping_brutto, WPSG_NETTO, $mwst_value);						
+					$shipping_netto = wpsg_calculatePreis($shipping_brutto, WPSG_NETTO, $mwst_value);
+					$arShipping[$this->id]['price_backend'] = $shipping_brutto;
 						
 				}
Index: /views/admin/laender_edit.phtml
===================================================================
--- /views/admin/laender_edit.phtml	(revision 7263)
+++ /views/admin/laender_edit.phtml	(revision 7264)
@@ -19,3 +19,5 @@
 	<?php echo wpsg_drawForm_Checkbox('standard', __('Standardland', 'wpsg'), wpsg_getStr($this->view['land']['standard']), array('disabled' => ((isset($this->view['land']['standard']) && $this->view['land']['standard'] == '1')?true:false), 'help' => 'wpsg_land_standard')); ?>
 
+	<?php $this->callMods('laender_edit'); ?>
+	
 </form>
Index: /views/mods/mod_coverletter/order_view.phtml
===================================================================
--- /views/mods/mod_coverletter/order_view.phtml	(revision 7263)
+++ /views/mods/mod_coverletter/order_view.phtml	(revision 7264)
@@ -9,34 +9,26 @@
 <?php echo wpsg_drawForm_AdminboxStart(__('Anschreiben', 'wpsg'));?>
 
-	<?php if (sizeof($this->view['mod_anschreiben']['aranschreiben']) == 0 ) { ?>
+	<?php if (sizeof($this->view['mod_coverletter']['arCoverLetter']) == 0 ) { ?>
 	   
-	   <p><?php echo __('Bisher kein Anschreiben geschrieben.', 'wpsg'); ?></p>
+		<p><?php echo __('Bisher kein Anschreiben fÃŒr diese Bestellung geschrieben.', 'wpsg'); ?></p>
 	   
-	   <?php } else { ?>
-	   	<table>
-	        <?php foreach ($this->view['mod_anschreiben']['aranschreiben_gesamt'] as $a) { ?>
-	            <tr>
-	                <td>#<?php echo ($a['anr'] != ''); ?>
-						
-						<?php if ($a['anr'] != "") { ?>
-	                    	<?php echo wpsg_translate(__('Anschreiben gespeichert am #1#', 'wpsg'), date("d.m.Y", $a['ts_datum'])); ?>
-	                    <?php } ?>
+	<?php } else { ?>
+
+		<?php foreach ($this->view['mod_coverletter']['arCoverLetter'] as $a) { ?>
 	
-	                </td>
-	                <td style="text-align:right;">
-	
-	                    <?php if ($a['anr'] != "") {
-
-	                    	$rfile = $this->callMod('wpsg_mod_anschreiben', 'getFilePath', array($this->view['data']['id'], true)).'A'.$r['anr'].'.pdf';
-	                        
-	                    } ?>
-
-	            	</td>
-	        	</tr>
-	    	<?php } ?>
-	 	</table>
-	 <?php } ?>
-	
-	<br>
+			<div class="wpsg_flex wpsg_flex_justify_content_space_between">
+				<span>
+					<?php echo wpsg_translate(__('#2#: Anschreiben ##1#', 'wpsg'), $a['id'], wpsg_formatTimestamp(strtotime($a['cdate']))); ?>: <?php echo ((strlen($a['text']) > 50)?substr($a['text'],0,50).' ...':$a['text']); ?>
+				</span>
+				<a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&mod=wpsg_mod_coverletter&noheader=1&action=ajax&order_id=<?php echo $a['order_id']; ?>&cl_id=<?php echo $a['id']; ?>&wpsg_mod_coverletter_get" target="_new">
+					<?php echo __('Download', 'wpsg'); ?>
+				</a>
+			</div>
+		
+		<?php } ?>
+		
+	<?php } ?>
+		
+	<br />
 	
 	<div class="wpsg_clear"></div>
@@ -67,4 +59,5 @@
 				
 				<input type="submit" name="wpsg_mod_coverletter_write" value="<?php echo __("Speichern & Drucken", "wpsg"); ?>" style="float:left;" class="button button-primary" />
+				<input type="submit" name="wpsg_mod_coverletter_preview" onclick="wpsg_form_refresh = false;" value="<?php echo __('Vorschau', 'wpsg'); ?>" style="float:left; margin-left:15px;" class="button" />
 				
 				<div class="wpsg_clear"></div>
@@ -79,11 +72,19 @@
 <script>
 	
+	var wpsg_form_refresh = true;
+	
 	jQuery('#wpsg_mod_coverletter_form').on('submit', function() {
 		
-		setTimeout(function() {
+		if (wpsg_form_refresh) {
+		
+			setTimeout(function() {
 			
-			location.reload();
+				location.reload();
+				
+			}, 1000);
 			
-		}, 1000);
+		}
+
+		wpsg_form_refresh = true;
 				
 	} );
