From 99b10b034c04e9a18cd746dc1bd07a90b41adc76 Mon Sep 17 00:00:00 2001 From: Luca Haid Date: Thu, 11 Sep 2025 08:01:35 +0200 Subject: [PATCH] show discount in pdf from now --- Layout/default/WarehouseOffer/PDF_MAIN.php | 6 +++++- application/WarehouseOffer/WarehouseOfferController.php | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Layout/default/WarehouseOffer/PDF_MAIN.php b/Layout/default/WarehouseOffer/PDF_MAIN.php index 859d58e78..365cd1dfc 100644 --- a/Layout/default/WarehouseOffer/PDF_MAIN.php +++ b/Layout/default/WarehouseOffer/PDF_MAIN.php @@ -23,6 +23,7 @@ $texts = [ 'amount' => 'Menge', 'unit' => 'Einheit', 'unitPrice' => 'Einzelpreis', + 'discount' => 'Rabatt', 'totalPrice' => 'Gesamtpreis' ], 'summary' => [ @@ -83,6 +84,7 @@ $formattedValidUntil = date("d.m.Y", strtotime("+14 days", $offerDate)); #positionsTable th.amount, #positionsTable td.amount { text-align: right; width: 50px;} #positionsTable th.unit, #positionsTable td.unit { text-align: center; width: 40px;} #positionsTable th.price, #positionsTable td.price { text-align: right; width: 80px;} + #positionsTable th.discount, #positionsTable td.discount { text-align: right; width: 50px;} #positionsTable th.total, #positionsTable td.total { text-align: right; width: 90px;} .position-group-header td { background-color: #e8f0f8; font-weight: bold; border-top: 1px solid #ccc; border-bottom: 1px solid #ccc; padding: 4px; } @@ -141,6 +143,7 @@ $formattedValidUntil = date("d.m.Y", strtotime("+14 days", $offerDate)); + @@ -151,7 +154,7 @@ $formattedValidUntil = date("d.m.Y", strtotime("+14 days", $offerDate)); $isAlternativeGroup = ($groupName === 'Alternativpositionen'); if (!empty($groupName)): ?> - + + diff --git a/application/WarehouseOffer/WarehouseOfferController.php b/application/WarehouseOffer/WarehouseOfferController.php index 4d19c3405..39211f47d 100644 --- a/application/WarehouseOffer/WarehouseOfferController.php +++ b/application/WarehouseOffer/WarehouseOfferController.php @@ -343,6 +343,7 @@ class WarehouseOfferController extends TTCrud $p['articleDescription'] = ($article->description !== $article->title) ? ($article->description ?? '') : ''; $p['articleUnit'] = $p['unit'] ?? $article->unit ?? 'Stk.'; $p['price'] = (float)($p['unitPrice'] ?? 0); + $p['discount'] = isset($p['discount']) ? (float)$p['discount'] : 0; $p['amount'] = (float)($p['amount'] ?? 0); $discount = isset($p['discount']) ? (float)$p['discount'] : 0; $p['totalPrice'] = ($p['price'] * $p['amount']) * (1 - $discount / 100);