Index: /mods/wpsg_mod_export.class.php
===================================================================
--- /mods/wpsg_mod_export.class.php	(revision 8221)
+++ /mods/wpsg_mod_export.class.php	(revision 8222)
@@ -1731,5 +1731,6 @@
                         'rechnung_nr' => __('Rechnungsnummer', 'wpsg'),
                         'gutschrift_nr' => __('Rechnungskorrekturnummer', 'wpsg'),
-                        'rdatum' => __('Datum der Rechnung/Rechnungskorrektur', 'wpsg')
+                        'rdatum' => __('Datum der Rechnung', 'wpsg'),
+                        'stornodatum' => __('Datum der Rechnungskorrektur', 'wpsg')
                     )
                 );
@@ -1885,30 +1886,4 @@
                 $order = $oOrder->data;
                 $order['custom_data'] = unserialize($oOrder->__get('custom_data'));
-
-                if ($this->shop->hasMod('wpsg_mod_rechnungen')) {
-
-                    $last_invoice = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_RECHNUNGEN."` WHERE `o_id` = '".wpsg_q($order['id'])."' AND `rnr` != '' ORDER BY `datum` DESC LIMIT 1 ");
-                    $last_storno = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_RECHNUNGEN."` WHERE `o_id` = '".wpsg_q($order['id'])."' AND `gnr` != '' ORDER BY `datum` DESC LIMIT 1 ");
-                    $last = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_RECHNUNGEN."` WHERE `o_id` = '".wpsg_q($order['id'])."' ORDER BY `datum` DESC LIMIT 1 ");
-
-                    $order['gnr'] = '--';
-                    $order['rnr'] = '--';
-                    $order['rdatum'] = '--';
-
-                    if (wpsg_isSizedInt($last_invoice['id'])) {
-
-                        $order['rnr'] = $last_invoice['rnr'];
-                        $order['rdatum'] = $last_invoice['datum'];
-
-                    }
-
-                    if (wpsg_isSizedInt($last_storno['id']) && $last['id'] === $last_storno['id']) {
-
-                        $order['gnr'] = $last_storno['gnr'];
-                        $order['rdatum'] = $last_storno['datum'];
-
-                    }
-
-                }
 
                 /* Bestellvariablen */
@@ -2199,18 +2174,38 @@
                     break;
 
-                case 'rechnung_nr': $return = $order['rnr']; break;
+                case 'rechnung_nr':
+
+                    $arInvoiceNr = [];
+                    foreach (\wpsg\wpsg_invoice::findByOrderId(intval($order['id'])) as $oInvoice) if ($oInvoice->isInvoice()) $arInvoiceNr[] = $oInvoice->getNr();
+
+                    $return = implode('/', $arInvoiceNr);
+
+                    break;
+
                 case 'rechnungskorrektur_nr':
-                case 'gutschrift_nr': $return = $order['gnr']; break;
+                case 'gutschrift_nr':
+
+                    $arInvoiceNr = [];
+                    foreach (\wpsg\wpsg_invoice::findByOrderId(intval($order['id'])) as $oInvoice) if ($oInvoice->isStorno()) $arInvoiceNr[] = $oInvoice->getNr();
+
+                    $return = implode('/', $arInvoiceNr);
+
+                    break;
+
                 case 'rdatum':
 
-                    if (strtotime($order['rdatum']) !== false) {
-						
-                        $return = date('d.m.Y H:i:s', strtotime($order['rdatum']));
-						
-                    } else {
-						
-                        $return = '--';
-						
-                    }
+                    $arInvoiceDate = [];
+                    foreach (\wpsg\wpsg_invoice::findByOrderId(intval($order['id'])) as $oInvoice) if ($oInvoice->isInvoice()) $arInvoiceDate[] = $oInvoice->getDate('d.m.Y H:i:s');
+
+                    $return = implode('/', $arInvoiceDate);
+
+                    break;
+
+                case 'stornodatum':
+
+                    $arInvoiceDate = [];
+                    foreach (\wpsg\wpsg_invoice::findByOrderId(intval($order['id'])) as $oInvoice) if ($oInvoice->isStorno()) $arInvoiceDate[] = $oInvoice->getDate('d.m.Y H:i:s');
+
+                    $return = implode('/', $arInvoiceDate);
 
                     break;
@@ -2396,6 +2391,6 @@
                     case 100: $return = number_format(floatval(wpsg_tf($return)), 2, '.', ''); break;
                     case 200: $return = number_format(floatval(wpsg_tf($return)), 2, ',', ''); break;
-                    case 300: $reutrn = wpsg_ff(wpsg_tf($return), $this->shop->get_option('wpsg_currency')); break;
-                    case 400: $return = date('d.m.Y', strtotime($return)); break;
+                    case 300: $return = wpsg_ff(wpsg_tf($return), $this->shop->get_option('wpsg_currency')); break;
+                    case 400: $return = ((strtotime($return) !== false)?date('d.m.Y', strtotime($return)):''); break;
                     case 500: $return = date('H:i:s', strtotime($return)); break;
                     case 600: $return = date('d.m.Y H:i:s', strtotime($return)); break;
