Files
thetool/Layout/default/Invoice/Print.pdf.php
2024-07-01 11:44:19 +02:00

159 lines
6.1 KiB
PHP

<?php
/**
* @var string $ressourcePathPrefix
* @var Invoice $invoice
* @var float $vat
*/
$net_total = $invoice->total + $invoice->total_setup;
$gross_total = $invoice->total_gross + $invoice->total_setup_gross;
$is_credit = $net_total < 0;
?>
<html>
<head>
<title>Xinon Billing - Rechnung <?=$invoice->invoice_number?></title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link href="<?=$ressourcePathPrefix?>css/sknx_print.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table id="adressen">
<tr>
<td class="left">
<div class="adresse">
<div><?=$invoice->company?><br />
<?php if($invoice->firstname && $invoice->lastname): ?><?=$invoice->firstname?> <?=$invoice->lastname?><br /><?php endif; ?>
<?=nl2br($invoice->street)?><br />
<?=$invoice->zip?> <?=$invoice->city?><br />
<?php if($invoice->country != "Österreich"):?><?=$invoice->country?><br /><?php endif; ?>
</div>
<div style="height:40pt;"></div>
<h2><?php if($is_credit):?>Gutschrift<?php else: ?>Rechnung<?php endif; ?> <?=$invoice->invoice_number?></h2>
<div><b><?php if($is_credit):?>Belegdatum<?php else: ?>Rechnungsdatum<?php endif; ?>: <?=date("d.m.Y",$invoice->invoice_date)?></b>
<?php if($invoice->uid): ?><br />Ihre UID: <?=$invoice->uid?><?php endif; ?>
</div>
</td>
<td class="right">
<div class="adresse header_sknx">
<div>
<div><img src="<?=$ressourcePathPrefix?>assets/images/xinon-dark.png" style="width:100%;" /></div>
<div><b>Xinon GmbH</b></div>
<div>Fladnitz im Raabtal 150<br />
A-8322 Studenzen<br />
&nbsp;<br />
Tel +43 3115 40800<br />
office@xinon.at - https://xinon.at/<br />
UID: ATU68711968<br />
FB: FN 416556 h<br />
&nbsp;<br />
Bankverbindung:<br />
Steiermärkische Bank und Sparkassen AG<br />
BIC: STSPAT2GXXX<br />
IBAN: AT84 2081 5000 4007 9121
</div>
</div>
</div>
</td></tr>
</table>
<div style="height:28pt;"></div>
<div id="rechnungspositionen">
<?php if(is_array($invoice->positions) && count($invoice->positions)): ?>
<table class="position">
<tr class="head dontsplit">
<th class="name">Bezeichnung</th>
<th class="preis">Einzelpreis</th>
<th class="menge">Menge</th>
<th class="preis">Gesamtpreis</th>
<th class="preis">Ust.</th>
<th class="preis">Gesamt Brutto</th>
</tr>
<?php $i=0; ?>
<?php foreach($invoice->positions as $p): ?>
<?php
$start_date = new DateTime($p->start_date);
$end_date = new DateTime($p->end_date);
$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, 2, ",",".");
?>
<tr class="<?=($i%2 == 0) ? "even" : "odd" ?> one-position">
<td class="name">
<span class="product-name"><?=$p->product_name?></span>
<?php if($start_date->format("d.m.Y") != $end_date->format("d.m.Y")): ?>
&nbsp;(<?=$start_date->format("d.m.Y")?> - <?=$end_date->format("d.m.Y")?>)
<?php endif; ?>
<?=($p->matchcode) ? "<div class='pl-2'>".$p->matchcode."</div>" : ""?>
<?=($p->product_info) ? "<div class='pl-2'>".nl2br($p->product_info)."</div>" : ""?>
</td>
<td class="preis"><?=$price?> €</td>
<td class="preis"><?=$amount?></td>
<td class="preis"><?=$price_total?> €</td>
<td class="preis"><?=$vatrate?>%</td>
<td class="preis"><?=$price_gross?> €</td>
</tr>
<?php $i++; ?>
<?php endforeach; ?>
</table>
<?php endif; ?>
</div>
<div style="height:40pt;"></div>
<table id="total">
<?php if(!$reversecharge): ?>
<tr class="netto">
<th>Gesamtbetrag Netto:</th>
<td><?=number_format($net_total, 2, ",", ".")?> €</td>
</tr>
<?php foreach($vat as $vatrate => $vat_total): ?>
<?php if($vat_total != 0 && $vatrate > 0): ?>
<tr class="ust">
<th>+ Umsatzsteuer <?=$vatrate?>%:</th>
<td><?=number_format($vat_total, 2, ",", ".")?> €</td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
<tr class="brutto">
<?php if($reversecharge): ?>
<th>Gesamtbetrag:</th>
<?php else: ?>
<th>Gesamtbetrag Brutto:</th>
<?php endif; ?>
<td><?=number_format($gross_total, 2, ",", ".")?> €</td>
</tr>
</table>
<?php if($reversecharge): ?>
<p style="font-weight:bold;">Hinweis: Die Umsatzsteuerschuld geht auf den Leistungsempfänger über (Reverse Charge)</p>
<?php endif; ?>
<?php if($is_credit): ?>
<p>Gutschrift! Bitte nicht überweisen.</p>
<?php else: ?>
Ohne Abzug zu bezahlen bis <?=(new DateTime("@".$invoice->invoice_date))->modify("+14 days")->format("d.m.Y")?>.<br />
Bitte geben Sie als Verwendungszweck unbedingt die Rechnungsnummer an, nur so können wir Ihre Zahlung eindeutig zuordnen
<?php endif; ?>
</body>
</html>