Index: /lib/wpsg_calculation.class.php
===================================================================
--- /lib/wpsg_calculation.class.php	(revision 8056)
+++ /lib/wpsg_calculation.class.php	(revision 8057)
@@ -447,5 +447,5 @@
    
                 	if ($cr['type'] === 'coupon') continue;
-                	 
+                	  
                 	$this->addTax($cr['tax_key']);
                 	$this->calculateTaxProportionally($cr['bruttonetto']);
@@ -548,5 +548,5 @@
 													
 							} else {
-																					
+													
 								if (wpsg_isTrue($cr['data']['targetCountry'])) {
 								
@@ -1380,5 +1380,5 @@
 			else if ($typ === 'g') $value = $this->dWeight; // Gewicht
 			else { 
-				die(debug_print_backtrace());
+				
 				throw new \Exception(wpsg_translate(__('Typ (#1#) fÃŒr KostenschlÃŒssel nicht definiert.', 'wpsg'), $typ)); 
 			
Index: /model/wpsg_order_product.class.php
===================================================================
--- /model/wpsg_order_product.class.php	(revision 8056)
+++ /model/wpsg_order_product.class.php	(revision 8057)
@@ -32,4 +32,10 @@
 		} // public function getTaxValue()
 		
+		public function getTaxKey() {
+			
+			return $this->mwst_key;
+			
+		}
+		
 		public function getOneTaxAmount()
 		{
Index: /mods/wpsg_mod_rechnungen.class.php
===================================================================
--- /mods/wpsg_mod_rechnungen.class.php	(revision 8056)
+++ /mods/wpsg_mod_rechnungen.class.php	(revision 8057)
@@ -1203,23 +1203,5 @@
 			$oDefaultCountry = $oOrder->getInvoiceCountry();			
 			$oCalculation->addCountry($oDefaultCountry->id, $oDefaultCountry->mwst, $oDefaultCountry->mwst_a,$oDefaultCountry->mwst_b, $oDefaultCountry->mwst_c, $oDefaultCountry->mwst_d, true);
-					
-			if (($_REQUEST['wpsg_rechnungen_shippay']??'0') === '1') {
-				
-				$oCalculation->addShipping(
-					$oOrder->__get('shipping_set'), 
-					$oOrder->__get('shipping_bruttonetto'),
-					$oOrder->__get('shipping_tax_key'),
-					$oOrder->__get('shipping_key')
-				);
-				
-				$oCalculation->addPayment(
-					$oOrder->__get('payment_set'), 
-					$oOrder->__get('payment_bruttonetto'),
-					$oOrder->__get('payment_tax_key'),
-					$oOrder->__get('payment_key')
-				);
-				
-			}
-			
+						
 			$arProduct = [];
 			
@@ -1248,5 +1230,5 @@
 						'price' => $oOrderProduct->getPrice($tax_view),
 						'anr' => $oOrderProduct->getProduct()->getNr(), 
-						'mwst_value' => 0,
+						'mwst_value' => $oOrder->getInvoiceCountry()->getTax($oOrderProduct->getTaxKey()),
 						'preis_netto' => $oOrderProduct->getPrice(WPSG_NETTO),
 						'preis_brutto' => $oOrderProduct->getPrice(WPSG_BRUTTO),
@@ -1277,4 +1259,22 @@
 			}
 			
+			if (($_REQUEST['wpsg_rechnungen_shippay']??'0') === '1') {
+				 
+				$oCalculation->addShipping(
+					$oOrder->__get('shipping_set'), 
+					$oOrder->__get('shipping_bruttonetto'),
+					$oOrder->__get('shipping_tax_key'),
+					$oOrder->__get('shipping_key')
+				);
+				
+				$oCalculation->addPayment(
+					$oOrder->__get('payment_set'), 
+					$oOrder->__get('payment_bruttonetto'),
+					$oOrder->__get('payment_tax_key'),
+					$oOrder->__get('payment_key')
+				);
+				
+			}
+			
 			$this->shop->view['basket'] = [
 				'arCalculation' => $oCalculation->getCalculationArray(),
@@ -1283,7 +1283,22 @@
 					'preis_gesamt_netto' => $oCalculation->getSum(WPSG_NETTO),
 					'preis_gesamt_brutto' => $oCalculation->getSum(WPSG_BRUTTO)
-				]
+				],
+				'mwst' => []
 			];
-			
+			 
+			// Die Templates brauchen es leider noch etwas anders
+			foreach ($this->shop->view['basket']['arCalculation']['tax'] as $tax_key => $tax) {
+				
+				if ($tax_key !== 0) {
+					
+					$this->shop->view['basket']['mwst'][] = [
+						'value' => $tax['tax_value'],
+						'sum' => $tax['sum']
+					];
+					
+				}
+				
+			} 
+			 
 			if (($_REQUEST['wpsg_rechnungen_shippay']??'0') === '1') {
 				
Index: /views/mods/mod_rechnungen/invoice_pdf.phtml
===================================================================
--- /views/mods/mod_rechnungen/invoice_pdf.phtml	(revision 8056)
+++ /views/mods/mod_rechnungen/invoice_pdf.phtml	(revision 8057)
@@ -314,5 +314,4 @@
 		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1') {
 			
-			
 			$pdf->setXY($prod_left + 97, $prod_top + $offset);
 			$pdf->Cell(15, 8, (($this->view['basket']['noMwSt'] == '1')?'0.00 %':wpsg_ff($p['mwst_value'], '%')), 0, 0, 'C');
Index: /views/mods/mod_rechnungen/order_view_orderdata_after.phtml
===================================================================
--- /views/mods/mod_rechnungen/order_view_orderdata_after.phtml	(revision 8056)
+++ /views/mods/mod_rechnungen/order_view_orderdata_after.phtml	(revision 8057)
@@ -157,9 +157,5 @@
                         
                         <input class="button" style="" id="invoice_wpsg_rechnungen_preview" name="wpsg_rechnungen_preview" type="submit" value="Vorschau">
-                        <input class="button" style="" id="invoice_wpsg_rechnungen_submit" onclick="window.setTimeout(function() { location.href = '<?php 
-                        
-                            echo wpsg_admin_url('Order', 'view', ['edit_id' => $oOrder->getId()]);
-                        
-                        ?>'; }, 1000);" name="wpsg_rechnungen_write" type="submit" value="Rechnung schreiben">
+                        <input class="button" style="" id="invoice_wpsg_rechnungen_submit" onclick="" name="wpsg_rechnungen_write" type="submit" value="Rechnung schreiben">
                         
                     </span>
@@ -183,6 +179,50 @@
                         
                         let el_invoice_wpsg_rechnungen_preview = document.getElementById('invoice_wpsg_rechnungen_preview');
-                        let el_invoice_wpsg_rechnungen_submit = document.getElementById('el_invoice_wpsg_rechnungen_submit');
+                        let el_invoice_wpsg_rechnungen_submit = document.getElementById('invoice_wpsg_rechnungen_submit');
                                                                 
+						function check_invoice_amount(event) {
+							
+							let ok = false;
+							
+							for (let el_checkbox of document.getElementsByClassName('wpsg_check_amount')) {
+								
+								if (el_checkbox.checked) {
+									
+									if (parseInt(el_checkbox.nextElementSibling.value) > 0) {
+										
+										ok = true; break;
+										
+                                    }
+									
+                                }
+								
+                            }
+							
+							if (ok) {
+                                
+								if (event.target.getAttribute("id") === 'invoice_wpsg_rechnungen_submit') {
+                                        
+                                    window.setTimeout(function() { location.href = '<?php 
+                                
+                                        echo wpsg_admin_url('Order', 'view', ['edit_id' => $oOrder->getId()]);
+                                    
+                                    ?>'; }, 1000);
+
+								}
+									
+							} else {
+								
+								alert('<?php echo __('Bitte mindestens ein Produkt auswÃ€hlen!', 'wpsg'); ?>');
+								
+								event.stopPropagation();
+							    event.preventDefault();
+								
+                            }
+							
+                        }
+						
+						el_invoice_wpsg_rechnungen_preview.addEventListener('click', check_invoice_amount);
+						el_invoice_wpsg_rechnungen_submit.addEventListener('click', check_invoice_amount);
+						
                     </script>
                                     
@@ -257,9 +297,5 @@
                         
                         <input class="button" style="" id="invoice_wpsg_storno_preview" name="wpsg_storno_preview" type="submit" value="Vorschau">
-                        <input class="button" style="" id="invoice_wpsg_storno_submit" onclick="window.setTimeout(function() { location.href = '<?php 
-                        
-                            echo wpsg_admin_url('Order', 'view', ['edit_id' => $oOrder->getId()]);
-                        
-                        ?>'; }, 1000);" name="wpsg_storno_write" type="submit" value="Rechnungskorrektur schreiben">
+                        <input class="button" style="" id="invoice_wpsg_storno_submit" onclick="" name="wpsg_storno_write" type="submit" value="Rechnungskorrektur schreiben">
                         
                     </span>
@@ -271,5 +307,49 @@
                         let el_invoice_wpsg_storno_preview = document.getElementById('invoice_wpsg_storno_preview');
                         let el_invoice_wpsg_storno_submit = document.getElementById('invoice_wpsg_storno_submit');
-                                             
+                                   
+						function check_invoice_amount(event) {
+							
+							let ok = false;
+							
+							for (let el_checkbox of document.getElementsByClassName('wpsg_check_amount')) {
+								
+								if (el_checkbox.checked) {
+									
+									if (parseInt(el_checkbox.nextElementSibling.value) > 0) {
+										
+										ok = true; break;
+										
+                                    }
+									
+                                }
+								
+                            }
+						 
+							if (ok) {
+                                
+								if (event.target.getAttribute("id") === 'invoice_wpsg_storno_submit') {
+                                        
+                                    window.setTimeout(function() { location.href = '<?php 
+                        
+                                        echo wpsg_admin_url('Order', 'view', ['edit_id' => $oOrder->getId()]);
+                                    
+                                    ?>'; }, 1000);
+
+								}
+									
+							} else {
+								
+								alert('<?php echo __('Bitte mindestens ein Produkt auswÃ€hlen!', 'wpsg'); ?>');
+								
+								event.stopPropagation();
+							    event.preventDefault();
+								
+                            }
+							
+                        }
+						
+						el_invoice_wpsg_storno_preview.addEventListener('click', check_invoice_amount);
+						el_invoice_wpsg_storno_submit.addEventListener('click', check_invoice_amount);
+						
                     </script>
                     
@@ -305,5 +385,6 @@
     label[for="storno_shippay"] .link_invoice { padding:0; }
 
-    .wpsg_mod_rechnungen_row { display:block; width:100%; padding:5px; }
+    .wpsg_mod_rechnungen_row { display:block; width:100%; }
+    .wpsg_mod_rechnungen_row > div { padding:5px; }
     .wpsg_mod_rechnungen_row .invoice_wrap:not(:only-child) { margin-top:0.5rem; }
     .wpsg_mod_rechnungen_row .invoice_wrap > a:first-child { padding-left:0; }
Index: /views/mods/mod_rechnungen/order_view_row.phtml
===================================================================
--- /views/mods/mod_rechnungen/order_view_row.phtml	(revision 8056)
+++ /views/mods/mod_rechnungen/order_view_row.phtml	(revision 8057)
@@ -37,6 +37,6 @@
                     <span><?php echo __('Menge'); ?></span>
                     
-                    <input form="invoice_form" type="hidden" name="invoice_products[<?php echo $p['order_product_id']; ?>][set]" value="0" />
-                    <input checked="checked" form="invoice_form" type="checkbox" class="wpsg_mod_deliverynote_product" name="invoice_products[<?php echo $p['order_product_id']; ?>][set]" value="1" style="margin:0;" />
+                    <input form="invoice_form" type="hidden" name="invoice_products[<?php echo $p['order_product_id']; ?>][set]" value="0" class="" />
+                    <input checked="checked" form="invoice_form" type="checkbox" class="wpsg_mod_deliverynote_product wpsg_check_amount" name="invoice_products[<?php echo $p['order_product_id']; ?>][set]" value="1" style="margin:0;" />
                     
                     <input form="invoice_form" name="invoice_products[<?php echo $p['order_product_id']; ?>][amount]" type="number" max="<?php echo $invoice_amount; ?>" min="1" value="<?php echo min($invoice_amount, $p['amount']); ?>" style="padding:0; font-size:14px; line-height:22px; min-height:initial; height:22px; width:50px; text-indent:5px; border:1px solid black; margin:0;" />
@@ -64,6 +64,6 @@
                     <span><?php echo __('Menge'); ?></span>
                     
-                    <input form="storno_form" type="hidden" name="storno_products[<?php echo $p['order_product_id']; ?>][set]" value="0" />
-                    <input form="storno_form" type="checkbox" class="wpsg_mod_deliverynote_product" name="storno_products[<?php echo $p['order_product_id']; ?>][set]" value="1" style="margin:0;" />
+                    <input form="storno_form" type="hidden" name="storno_products[<?php echo $p['order_product_id']; ?>][set]" value="0" class="" />
+                    <input form="storno_form" type="checkbox" class="wpsg_mod_deliverynote_product wpsg_check_amount" name="storno_products[<?php echo $p['order_product_id']; ?>][set]" value="1" style="margin:0;" />
                     
                     <input form="storno_form" oninput="event.target.previousElementSibling.checked = true;" onchange="event.target.previousElementSibling.checked = true;" name="storno_products[<?php echo $p['order_product_id']; ?>][amount]" type="number" max="<?php echo $storno_amount; ?>" min="1" value="<?php echo min($storno_amount, $p['amount']); ?>" style="padding:0; font-size:14px; line-height:22px; min-height:initial; height:22px; width:50px; text-indent:5px; border:1px solid black; margin:0;" />
