Files
thetool/Layout/default/WarehouseOrder/PDF_MAIN.php
2025-02-13 11:56:27 +01:00

191 lines
6.4 KiB
PHP

<?php
/**
* @var string $ressourcePathPrefix
* @var WarehouseOrderModel $order
* @var Array $positions
* @var Array $textElements
*/
$this->setReturnValue(['filename' => $order["id"] . ".pdf"]);
$texts = [
'EN' => [
'header' => 'XINON Supplier Order from ' . date("d.m.Y", $order["create"]),
'sum' => 'Sum',
'vat' => '20% VAT',
'total' => 'Total',
'taxFree' => 'Please provide tax-free delivery according to § 6a UStG (Austrian Sales tax law).<br>Our VAT ID number: ATU68711968. Delivery to Austria.',
'orderConfirmation' => 'Please send the order confirmation to office@xinon.at',
'table' => [
'pos' => 'POS',
'article' => 'Article',
'articleNumber' => 'Dist. art. nr.',
'amount' => 'Amount',
'unitPrice' => 'Unit price',
'totalPrice' => 'Total price'
]
],
'DE' => [
'header' => 'XINON Lieferantenbestellung vom ' . date("d.m.Y", $order["create"]),
'sum' => 'Summe',
'vat' => '20% MwSt',
'total' => 'Gesamt',
'taxFree' => 'Bitte um steuerfreie Lieferung gemäß § 6a UStG.<br> Unsere UID-Nr.: ATU68711968. Lieferung nach Österreich.',
'orderConfirmation' => 'Wir bitten um Zusendung der Auftragsbestätigung für die Bestellung an office@xinon.at.',
'table' => [
'pos' => 'POS',
'article' => 'Artikel',
'articleNumber' => 'Art.-Nr. Lieferant',
'amount' => 'Menge',
'unitPrice' => 'Einzelpreis',
'totalPrice' => 'Gesamtpreis'
]
]];
$text = $texts[in_array($distributorCountryText, ["Österreich", "Deutschland", "Schweiz"]) ? "DE" : "EN"];
?>
<!DOCTYPE html>
<html>
<head>
<title><?= $text['header'] ?></title>
<meta charset="utf-8"/>
<style>
body {
margin-top: 0;
/*padding-top: 20pt;*/
font-family: "Open Sans", sans-serif, Verdana;
font-size: 12px;
}
tr {
page-break-inside: avoid;
}
.uneven {
background-color: #ebebeb;
}
table tr td:last-child {
text-align: right;
}
.additionalRow td:first-child {
text-align: left;
padding-left: 20pt;
}
th {
height: 28px;
}
#invoiceTable tr *:nth-child(5),
#invoiceTable tr *:nth-child(4),
#invoiceTable tr *:nth-child(3) {
text-align: right;
}
#invoiceTable tr *:not(:first-child) {
padding: 4px 0;
}
#invoiceTable tr td {
font-size: 11px;
}
tr.position td {
vertical-align: top;
}
tr.position td:first-child {
vertical-align: middle !important;
padding-left: 4pt;
}
#invoiceTable tr td:first-child {
max-width: 200pt;
}
</style>
</head>
<body>
<div>
<h2 style="text-align: center;color: #005384"><?= $text['header'] ?></h2>
<table style="border-collapse: collapse; width: 100%;" id="invoiceTable">
<tr style="font-weight: bold; border-bottom: 1px solid black;" class="uneven">
<th style="text-align: center;padding-right: 6pt"><?= $text['table']['pos'] ?></th>
<th style="text-align: center;padding-right: 6pt"><?= $text['table']['article'] ?></th>
<th style="text-align: center;padding-right: 6pt"><?= $text['table']['articleNumber'] ?></th>
<th style="text-align: right"><?= $text['table']['amount'] ?></th>
<th style="text-align: right"><?= $text['table']['unitPrice'] ?></th>
<th style="text-align: right;padding-right: 8pt"><?= $text['table']['totalPrice'] ?></th>
</tr>
<?php $i = 0;
foreach ($order['positions'] as $p): ?>
<tr class="position <?= ($i % 2 == 0) ? "even" : "uneven" ?>">
<td style="text-align: center;"><?= $i + 1 ?></td>
<td style="text-align: left;padding-right: 8pt"><?= $p["articleName"] ?></td>
<td style="text-align: center;padding-right: 8pt"><?= $p["distributorArticleNumber"] ?></td>
<td style="text-align: right"><?= $p["amount"] ?></td>
<td style="text-align: right"><?= number_format($p["buyPrice"], 2, ",", ".") ?> €</td>
<td style="text-align: right;padding-right: 8pt"><?= number_format($p["amount"] * $p["buyPrice"], 2, ",", ".") ?> €</td>
</tr>
<tr class="<?= ($i % 2 == 0) ? "even" : "uneven" ?>">
<td></td>
<td style="text-align: left;max-width: 200px"><?= $p["articleDescription"] ?></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<?php $i++; endforeach; ?>
<tr class="uneven">
<?php
$sum = 0;
foreach ($order['positions'] as $p) {
$sum += $p["amount"] * $p["buyPrice"];
}
?>
<td colspan="5" style="text-align: right;border-top: 1px solid black;font-weight: bold
;border-bottom: 1px solid black;
"><?= $text['sum'] ?>
</td>
<td style="text-align: right;border-top: 1px solid black;font-weight: bold
;border-bottom: 1px solid black;
"><?= number_format($sum, 2, ",", ".") ?> €
</td>
</tr>
<?php if ($distributorCountryText === "Österreich"): ?>
<tr style="font-weight: bold; border-bottom: 1px solid black; background-color: #ebebeb;">
<td colspan="5" style="text-align: right;font-weight: bold;">20% MwSt</td>
<td style="text-align: right;font-weight: bold;"><?= number_format($sum * 0.2, 2, ",", ".") ?> €</td>
</tr>
<tr class="uneven" style="font-weight: bold; border-bottom: 3px double black; background-color: #ebebeb;">
<td colspan="5" style="text-align: right;font-weight: bold;"><?= $text['total'] ?></td>
<td style="text-align: right;font-weight: bold;"><?= number_format($sum * 1.2, 2, ",", ".") ?> €</td>
</tr>
<?php endif; ?>
</table>
<div>
<?php if ($distributorCountryText !== "Österreich"): ?>
<?= $text['taxFree'] ?>
<?php endif; ?>
<?= $text['orderConfirmation'] ?>
</div>
</body>
</html>