WIP PreorderBilling 2025-03-22
This commit is contained in:
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
/**
|
||||
* @var string $ressourcePathPrefix
|
||||
* @var Invoice $invoice
|
||||
* @var array $vat
|
||||
*/
|
||||
$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"]);
|
||||
|
||||
//die(json_encode($invoice->positions));
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Rechnung</title>
|
||||
<meta charset="utf-8" />
|
||||
<!-- <link href="-->
|
||||
<?php //= self::getResourcePath() ?><!--assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" />-->
|
||||
|
||||
<style>
|
||||
body {
|
||||
margin-top: 0;
|
||||
padding-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 th,
|
||||
#invoiceTable tr td {
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
#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><?=($is_credit) ? "Gutschrift" : "Rechnung"?> <?=$invoice->invoice_number?></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: left">Pos</th>
|
||||
<th style="text-align: left">Artikel</th>
|
||||
<th style="text-align: left">Leistung / Produkt</th>
|
||||
<th style="text-align: right">Preis</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"><?=$i+1?></td>
|
||||
<td style="text-align: left"><?=$p->article_number?></td>
|
||||
<td style="text-align: left"><?=$p->article_name?></td>
|
||||
<td style="text-align: right"><?=$price?> €</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; ?>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user