[position1, position2,...]] * @var float $subTotal Calculated subtotal of all positions * @var string $offerNumber Offer number * @var int $offerDate Timestamp of offer creation * @var int|null $validUntilDate Timestamp of offer validity end, or null * @var bool $includeTax Whether to calculate and show VAT * @var float $vatRate The VAT rate (e.g., 0.20 for 20%) * @var string $offerText Additional text from the offer record * * // Bank details are also available but typically used in footer * @var string $bank_iban * @var string $bank_bic * @var string $bank_bank * @var string $bank_owner */ // Set filename for download (optional, can also be set in controller) // $this->setReturnValue(['filename' => ($offerNumber ?? $offer->id) . "_Angebot.pdf"]); // --- Text Elements (Simple German Example - Extend for EN like in Order) --- $texts = [ 'DE' => [ 'title' => 'Angebot', 'offerNumberLabel' => 'Angebotsnr.:', 'offerDateLabel' => 'Datum:', 'validUntilLabel' => 'Gültig bis:', 'pageLabel' => 'Seite', // For page numbering in content if needed 'table' => [ 'pos' => 'Pos', 'article' => 'Artikel / Beschreibung', // 'description' => 'Beschreibung', // Combined with Article 'amount' => 'Menge', 'unit' => 'Einheit', 'unitPrice' => 'Einzelpreis', 'totalPrice' => 'Gesamtpreis' ], 'summary' => [ 'subTotal' => 'Zwischensumme', 'vatFormatted' => 'zzgl. {VAT_RATE}% MwSt.', // Placeholder for rate 'total' => 'Gesamtbetrag', 'currency' => '€' // Currency symbol ], 'notes' => 'Anmerkungen:', 'defaultOfferText' => 'Vielen Dank für Ihre Anfrage. Es gelten unsere Allgemeinen Geschäftsbedingungen.', 'taxInfoNet' => '(Alle Preise exkl. MwSt.)', // Info if tax is added at the end 'taxInfoGross' => '(Alle Preise inkl. MwSt.)', // Info if prices already include tax (less common in B2B offers) ] // Add 'EN' => [...] section if needed ]; // Simple language selection (default to DE) - enhance if customer language is known $lang = 'DE'; $text = $texts[$lang]; $currencySymbol = $text['summary']['currency']; // --- Calculations --- $vatAmount = 0; $grandTotal = $subTotal; if ($includeTax) { $vatAmount = $subTotal * $vatRate; $grandTotal = $subTotal + $vatAmount; } // Format dates $formattedOfferDate = date("d.m.Y", $offerDate); $formattedValidUntil = $validUntilDate ? date("d.m.Y", $validUntilDate) : date("d.m.Y", strtotime("+14 days", $offerDate)); ?>
| = $text['offerNumberLabel'] ?> | = htmlspecialchars($offerNumber) ?> | = $text['offerDateLabel'] ?> | = $formattedOfferDate ?> |
| = $text['validUntilLabel'] ?> | = $formattedValidUntil ?> |
| = $text['table']['pos'] ?> | = $text['table']['article'] ?> | = $text['table']['amount'] ?> | = $text['table']['unit'] ?> | = $text['table']['unitPrice'] ?> | = $text['table']['totalPrice'] ?> |
|---|---|---|---|---|---|
| = htmlspecialchars($groupName) ?> | |||||
| = $posCounter ?> |
= htmlspecialchars($p['articleText']) ?>
= nl2br(htmlspecialchars($p['articleDescription'])) ?>
|
= number_format($p['amount'], 2, ',', '.') // Format amount as needed ?> | = htmlspecialchars($p['articleUnit']) ?> | = number_format($p['price'], 2, ',', '.') ?> = $currencySymbol ?> | = number_format($p['totalPrice'], 2, ',', '.') ?> = $currencySymbol ?> |
| Keine Positionen im Angebot enthalten. | |||||
| = $text['summary']['subTotal'] ?>: | = number_format($subTotal, 2, ',', '.') ?> = $currencySymbol ?> |
| = $vatLabel ?>: | = number_format($vatAmount, 2, ',', '.') ?> = $currencySymbol ?> |
| = $text['summary']['total'] ?>: | = number_format($grandTotal, 2, ',', '.') ?> = $currencySymbol ?> |
| = $text['summary']['total'] ?>: | = number_format($grandTotal, 2, ',', '.') ?> = $currencySymbol ?> |
= $text['notes'] ?>
= $text['defaultOfferText'] // Add default closing text ?>
Zahlungsbedingungen: 14 Tage netto.
Lieferzeit: nach Vereinbarung.