diff --git a/shop/components/invoice-pdf.tsx b/shop/components/invoice-pdf.tsx
index 61e6609..36c5151 100644
--- a/shop/components/invoice-pdf.tsx
+++ b/shop/components/invoice-pdf.tsx
@@ -99,9 +99,29 @@ export const InvoicePDF = ({ order, orderSnapshot, customer }: any) => {
const taxRate = orderSnapshot?.tax_rate ?? 19;
const isSubscription = order?.type === 'subscription' || orderSnapshot?.billing_cycle === 'monthly';
- const totalNet = items.reduce((sum: number, item: any) => sum + (item.item_total || 0), 0);
- const totalTax = Math.round(totalNet * (taxRate / 100) * 100) / 100;
- const totalGross = Math.round((totalNet + totalTax) * 100) / 100;
+ let oneTimeNet = 0;
+ let monthlyNet = 0;
+
+ items.forEach((item: any) => {
+ if (item.billing_interval === 'monthly') {
+ monthlyNet += item.base_price || 0;
+ } else {
+ oneTimeNet += item.base_price || 0;
+ }
+
+ item.selected_modules?.forEach((mod: any) => {
+ const qty = mod.quantity || 1;
+ const price = mod.total_price ?? (mod.price * qty);
+ // Module sind monatliche wiederkehrende Beträge (Abo/Miete)
+ monthlyNet += price;
+ });
+ });
+
+ const oneTimeTax = Math.round(oneTimeNet * (taxRate / 100) * 100) / 100;
+ const oneTimeGross = Math.round((oneTimeNet + oneTimeTax) * 100) / 100;
+
+ const monthlyTax = Math.round(monthlyNet * (taxRate / 100) * 100) / 100;
+ const monthlyGross = Math.round((monthlyNet + monthlyTax) * 100) / 100;
const formattedPrice = (val: number) =>
new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(val);
@@ -170,7 +190,7 @@ export const InvoicePDF = ({ order, orderSnapshot, customer }: any) => {
- {formattedPrice(item.base_price)} {isSubscription ? 'mtl.' : 'einmalig'}
+ {formattedPrice(item.base_price)} {item.billing_interval === 'one_time' ? 'einmalig' : 'mtl.'}
@@ -186,7 +206,7 @@ export const InvoicePDF = ({ order, orderSnapshot, customer }: any) => {
- +{formattedPrice(price)}
+ +{formattedPrice(price)} mtl.
@@ -199,23 +219,42 @@ export const InvoicePDF = ({ order, orderSnapshot, customer }: any) => {
-
-
- Netto-Zwischensumme:
- {formattedPrice(totalNet)}{isSubscription ? ' / mtl.' : ''}
-
-
- zzgl. {taxRate}% USt:
- {formattedPrice(totalTax)}{isSubscription ? ' / mtl.' : ''}
-
-
-
- Gesamtbetrag (brutto):
-
-
- {formattedPrice(totalGross)}{isSubscription ? ' / mtl.' : ''}
-
-
+
+ {oneTimeNet > 0 && (
+
+ Einmalige Beträge:
+
+ Netto-Zwischensumme:
+ {formattedPrice(oneTimeNet)}
+
+
+ zzgl. {taxRate}% USt:
+ {formattedPrice(oneTimeTax)}
+
+
+ Gesamt einmalig (brutto):
+ {formattedPrice(oneTimeGross)}
+
+
+ )}
+
+ {monthlyNet > 0 && (
+ 0 ? 1 : 0, borderTopColor: '#e2e8f0' }}>
+ Monatlich wiederkehrende Beträge:
+
+ Netto-Zwischensumme:
+ {formattedPrice(monthlyNet)} / mtl.
+
+
+ zzgl. {taxRate}% USt:
+ {formattedPrice(monthlyTax)} / mtl.
+
+
+ Gesamt monatlich (brutto):
+ {formattedPrice(monthlyGross)} / mtl.
+
+
+ )}