Index: /changelog
===================================================================
--- /changelog	(revision 8132)
+++ /changelog	(revision 8134)
@@ -529,2 +529,3 @@
 - Feature: Exportprofile: Automatischer Export bei Bestellung
 - Feature: Vorgabe Standardversand je Versandzone
+- Feature: Steuerberechnung nach Lieferland (Option)
Index: /controller/wpsg_AdminController.class.php
===================================================================
--- /controller/wpsg_AdminController.class.php	(revision 8132)
+++ /controller/wpsg_AdminController.class.php	(revision 8134)
@@ -2426,4 +2426,5 @@
 				$this->update_option('wpsg_hideemptypayment', $_REQUEST['wpsg_hideemptypayment'], false, false, WPSG_SANITIZE_CHECKBOX);
 				$this->update_option('wpsg_noroundamount', $_REQUEST['wpsg_noroundamount'], false, false, WPSG_SANITIZE_CHECKBOX);
+				$this->update_option('wpsg_deliverycountrytax', $_REQUEST['wpsg_deliverycountrytax'], false, false, WPSG_SANITIZE_CHECKBOX);
 
 				$this->addBackendMessage(__('Einstellung gespeichert.', 'wpsg'));
Index: /controller/wpsg_BasketController.class.php
===================================================================
--- /controller/wpsg_BasketController.class.php	(revision 8132)
+++ /controller/wpsg_BasketController.class.php	(revision 8134)
@@ -103,5 +103,5 @@
 			// gewÃ€hlte Lieferanschrift im Warenkorb setzen
 			if (isset($_REQUEST['set_land'])) {
-				
+			
 				$set_land = $_REQUEST['set_land'];
 				
Index: /controller/wpsg_ShopController.class.php
===================================================================
--- /controller/wpsg_ShopController.class.php	(revision 8132)
+++ /controller/wpsg_ShopController.class.php	(revision 8134)
@@ -2134,17 +2134,32 @@
 
 		/**
+		 * Gibt das aktuelle Lieferland zurÃŒck
+		 *
+		 * @param $getId
+		 *
+		 * @return void
+		 */
+		public function getFrontendShippingCountry($getId = false) {
+			
+			if (wpsg_isSizedInt($_SESSION['wpsg']['checkout']['shipping_land'])) $shipping_country = $_SESSION['wpsg']['checkout']['shipping_land'];
+			else if (wpsg_isSizedInt($_SESSION['wpsg']['checkout']['land'])) $shipping_country = $_SESSION['wpsg']['checkout']['land'];
+			else $shipping_country = $this->getDefaultCountry(true);
+
+			if ($getId === false) return wpsg_country::getInstance($getId);
+			else return $shipping_country;
+			
+		}
+		
+		/**
 		 * Gibt das aktuelle Land fÃŒr die Frontendausgabe zurÃŒck
 		 * ist wichtig fÃŒr die Preisberechnung (Mehrwertsteuer)
 		 */
 		public function getFrontendCountry($id = false) {
-
-			if (wpsg_isSizedInt($_SESSION['wpsg']['checkout']['land']))
-			{
+			 
+			if (wpsg_isSizedInt($_SESSION['wpsg']['checkout']['land'])) {
 
 				$country_id = $_SESSION['wpsg']['checkout']['land'];
 
-			}
-			else
-			{
+			} else {
 
 				return $this->getDefaultCountry($id);
@@ -2152,13 +2167,11 @@
 			}
 
-			if ($id === false)
-			{
+			if ($id === false) {
 
 				$oCountry = wpsg_country::getInstance($country_id);
+				
 				return $oCountry;
 
-			}
-			else
-			{
+			} else {
 
 				return $country_id;
Index: /lib/wpsg_calculation.class.php
===================================================================
--- /lib/wpsg_calculation.class.php	(revision 8132)
+++ /lib/wpsg_calculation.class.php	(revision 8134)
@@ -1337,10 +1337,20 @@
 			$this->addCountry($oDefaultCountry->id, $oDefaultCountry->mwst, $oDefaultCountry->mwst_a, $oDefaultCountry->mwst_b, $oDefaultCountry->mwst_c, $oDefaultCountry->mwst_d,true);
 			
-			if ($ses['checkout']['land'] != $oDefaultCountry->id) {
-				
-				$oInvoiceCountry = \wpsg_country::getInstance($ses['checkout']['land']);
-				$this->addCountry($oInvoiceCountry->id, $oInvoiceCountry->mwst, $oInvoiceCountry->mwst_a, $oInvoiceCountry->mwst_b, $oInvoiceCountry->mwst_c, $oInvoiceCountry->mwst_d,false);
-				
-			}
+			// "Mwst. gemÃ€Ã Lieferland berechnen" beachten
+			if (\wpsg_ShopController::getShop()->get_option('wpsg_deliverycountrytax') === '1' && ($ses['checkout']['shipping_land']??0) != $oDefaultCountry->id) {
+			
+				$oShippingCountry = \wpsg_country::getInstance($ses['checkout']['shipping_land']);
+				$this->addCountry($oShippingCountry->id, $oShippingCountry->mwst, $oShippingCountry->mwst_a, $oShippingCountry->mwst_b, $oShippingCountry->mwst_c, $oShippingCountry->mwst_d, false);
+				
+			} else {
+				
+				if ($ses['checkout']['land'] != $oDefaultCountry->id) {
+				
+					$oInvoiceCountry = \wpsg_country::getInstance($ses['checkout']['land']);
+					$this->addCountry($oInvoiceCountry->id, $oInvoiceCountry->mwst, $oInvoiceCountry->mwst_a, $oInvoiceCountry->mwst_b, $oInvoiceCountry->mwst_c, $oInvoiceCountry->mwst_d,false);
+					
+				} 
+				
+			} 
 			
 			if (wpsg_isSizedArray($ses['basket'])) {
Index: /views/admin/kalkulation.phtml
===================================================================
--- /views/admin/kalkulation.phtml	(revision 8132)
+++ /views/admin/kalkulation.phtml	(revision 8134)
@@ -45,5 +45,6 @@
 				<?php echo wpsg_drawForm_Checkbox('wpsg_hideemptypayment', __('Zahlungskosten bei 0 ausblenden', 'wpsg'), $this->get_option('wpsg_hideemptypayment'), array('help' => 'Preiskalkulation_wpsg_hideemptypayment')); ?>
 				<?php echo wpsg_drawForm_Checkbox('wpsg_noroundamount', __('Vor Multiplikation mit Menge nicht runden', 'wpsg'), $this->get_option('wpsg_noroundamount'), ['help' => 'Preiskalkulation_wpsg_noroundamount']); ?>
-												
+				<?php echo wpsg_drawForm_Checkbox('wpsg_deliverycountrytax', __('Mwst. gemÃ€Ã Lieferland berechnen', 'wpsg'), $this->get_option('wpsg_deliverycountrytax'), ['help' => 'Preiskalkulation_wpsg_deliverycountrytax']); ?>								
+                
 			</div>
 		</div>
Index: /views/warenkorb/basket.phtml
===================================================================
--- /views/warenkorb/basket.phtml	(revision 8132)
+++ /views/warenkorb/basket.phtml	(revision 8134)
@@ -11,5 +11,5 @@
 
 	//wpsg_debug(__('Deutschland', 'wpsg'));
-	
+ 
 	if ($this->getFrontendTaxView() === WPSG_BRUTTO) $display_brutto_netto = 'brutto';
 	else $display_brutto_netto = 'netto';
@@ -246,5 +246,5 @@
 					<select name="set_land" id="set_land" class="wpsg_form_submit set_land">
 						<?php foreach ($this->view['arLander'] as $l_id => $l) { ?>
-						<option <?php echo (($l_id == $this->getFrontendCountry(true))?'selected="selected"':''); ?> value="<?php echo $l_id; ?>"><?php echo wpsg_hspc(__($l, 'wpsg')); ?></option>
+						<option <?php echo (($l_id == $this->getFrontendShippingCountry(true))?'selected="selected"':''); ?> value="<?php echo $l_id; ?>"><?php echo wpsg_hspc(__($l, 'wpsg')); ?></option>
 						<?php } ?>
 					</select>
