Files
thetool/Layout/default/PreorderBillingInvoice/PDF_MAIN-4807.php
Frank Schubert 17405c8c5d PreorderBilling
2025-03-31 13:50:49 +02:00

194 lines
6.1 KiB
PHP

<?php
/*
* RML Preorder Invoice Layout
*/
/**
* @var string $ressourcePathPrefix
* @var Invoice $invoice
* @var array $vat
* @var string $qrcode
*/
$net_total = $invoice->total;
$gross_total = $invoice->total_gross;
$is_credit = $net_total < 0;
$invoice_date = new DateTime($invoice->invoice_date);
$this->setReturnValue(['filename' => $invoice->invoice_number . ".pdf"]);
?>
<!DOCTYPE html>
<html>
<head>
<title>Rechnung</title>
<meta charset="utf-8" />
<style>
body {
margin-top: 0;
padding-top: 0;
/*padding-top: 20pt;*/
font-family: "Calibri", Arial, sans-serif;
font-size: 14px;
}
.head-text {
font-family: Calibri, Arial, sans-serif;
font-size: 16px;
margin-bottom: 24px;
}
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 th,
#invoiceTable tr td {
padding: 4px;
}
#invoiceTable tr td {
font-size: 13px;
}
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><?=($is_credit) ? "Gutschrift" : "Rechnung"?> <?=$invoice->invoice_number?></h2>
<?php if($invoice->head_text):?>
<p class="head-text"><?=nl2br(htmlentities($invoice->head_text))?></p>
<?php endif; ?>
<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: left">Pos</th>
<th style="text-align: left">Artikel</th>
<th style="text-align: left">Leistung / Produkt</th>
<th style="text-align: right">Menge</th>
<th style="text-align: left">Einheit</th>
<th style="text-align: right">Preis €</th>
<th style="text-align: right; padding-right: 4pt">Gesamt €</th>
</tr>
<?php
$i = 0;
foreach($invoice->positions as $p):
$amount = (float) number_format($p->amount, 3, ",", ".");
$price = number_format($p->price, 2, ",",".");
$price_total = number_format($p->price_total, 2, ",",".");
$price_gross = number_format($p->price_gross, 2, ",",".");
$vatrate = number_format($p->vatrate, 0, ",",".");
?>
<tr class="position <?=($i%2 == 0) ? "even" : "uneven" ?>">
<td style="text-align: left; vertical-align: top;"><?=$i+1?></td>
<td style="text-align: left"><?=$p->article_number?></td>
<td style="text-align: left">
<?=$p->article_name?>
<?php if($p->article_info): ?>
<div style="padding-left: 2pt; font-style: italic;"><?=$p->article_info?></div>
<?php endif; ?>
</td>
<td style="text-align: right"><?=$amount?></td>
<td style="text-align: left"><?=$p->unit?></td>
<td style="text-align: right"><?=$price?> €</td>
<td style="padding-right: 4pt;"><?=$price_total?> €</td>
</tr>
<?php
$i++;
endforeach;
?>
<tr style="font-weight: bold; background-color: #ebebeb; border-bottom: 1px solid black;border-top: 1px solid black">
<td colspan="6">Gesamt Netto:</td>
<td colspan="2" style="text-align: right; padding-right: 4pt;"><?=number_format($net_total, 2, ",","."). " €"?></td>
</tr>
<?php foreach ($vat as $rate => $vat_total): ?>
<?php if($rate > 0): ?>
<tr style="font-size: 11px;border-bottom: 1px solid black;">
<td colspan="6">+ USt. <?=number_format($rate, 0, ",", ".")?>%:</td>
<td colspan="2" style="text-align: right; padding-right: 4pt;"><?=number_format($vat_total, 2, ",","."). " €"?></td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
<!-- double underline border on bottom -->
<tr style="font-weight: bold; border-bottom: 3px double black; background-color: #ebebeb;">
<td colspan="6">Gesamt Brutto:</td>
<td colspan="2" style="text-align: right; padding-right: 4pt;"><?=number_format($gross_total, 2, ",","."). " €"?></td>
</tr>
</table>
<div style="margin-top: 20pt;">
<?php if($invoice->tax_text): ?>
<p style="font-weight: bold;"><?=$invoice->tax_text?></p>
<?php endif; ?>
<table style="width: 100%; border-collapse: collapse;">
<tr>
<th style="width: 20%; text-align: left">Zahlungskondition:</th>
<td style="text-align: left;">Zahlbar sofort nach Erhalt der Rechnung ohne Abzug</td>
<td rowspan="3">
<img alt="QR-Code" src="<?=$qrcode?>" style="text-align:right;height: 3.1cm;">
</td>
</tr><tr>
<th style="text-align: left; vertical-align: top;">Bankverbindung:</th>
<td style="text-align: left; vertical-align: top;">
UniCredit Bank Austria AG<br />
IBAN: AT85 1200 0100 3986 5885 &nbsp; BIC: BKAUATWWXXX
</td>
</tr><tr>
<th style="width: 20%; text-align: left; vertical-align: top; padding-top: 16px;">Kontakt:</th>
<td style="text-align: left; vertical-align: top; padding-top: 16px;">
+43 664 128 1040<br />
rechnung@rmlinfrastruktur.at
</td>
</tr>
</table>
</div>
</body>
</html>