[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:', 'editorLabel' => 'Sachbearbeiter:', 'usageLabel' => 'Zweck:', 'customerReferenceLabel' => 'Kundenreferenz:', 'validUntilLabel' => 'Gültig bis:', 'vatLabel' => 'USt-IdNr.:', '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' ], 'paymentTerms' => [ 'net30' => 'Zahlungsbedingungen: 30 Tage netto', 'net60' => 'Zahlungsbedingungen: 60 Tage netto', 'immediate' => 'Zahlungsbedingungen: Sofort fällig' ], 'summary' => [ 'subTotal' => 'Nettobetrag', '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.', ] // 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['editorLabel'] ?> | = $offerEditorName ?> | = $text['validUntilLabel'] ?> | = $formattedValidUntil ?> |
| = $text['usageLabel'] ?> | = $offer->purpose ?? 'Keine Angabe' ?> | customerVAT)) : ?>= $text['vatLabel'] ?> | = htmlspecialchars($offer->customerVAT) ?> |
| = $text['customerReferenceLabel'] ?> | = $offer->reference ?? 'Keine Angabe' ?> |
| = $text['table']['pos'] ?> | = $text['table']['article'] ?> | = $text['table']['amount'] ?> | = $text['table']['unit'] ?> | = $text['table']['unitPrice'] ?> | = $text['table']['totalPrice'] ?> |
|---|---|---|---|---|---|
| = htmlspecialchars($groupName) ?> | |||||
| = $posCounter ?> |
= htmlspecialchars($p['articleNumber']) ?> |
= 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 ?>
= $text['paymentTerms'][$offer->paymentTerms] ?? $text['paymentTerms']['immediate'] ?>
Lieferzeit: nach Vereinbarung.
= nl2br(htmlspecialchars($offer->closingText ?? '')) ?>