WIP Contract/Billing/Invoice 2024-06-28

This commit is contained in:
Frank Schubert
2024-07-01 11:44:19 +02:00
parent 4589e61ab8
commit ae298a0665
30 changed files with 1898 additions and 212 deletions
+128
View File
@@ -0,0 +1,128 @@
<?php
$pagination_baseurl = $this->getUrl($Mod, "Index");
$pagination_baseurl_params = ["filter" => $filter];
$pagination_entity_name = "Billingrecords";
?>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?=self::getUrl("Dashboard")?>"><?=MFAPPNAME_SLUG?></a>
</li>
<li class="breadcrumb-item active">Rechnungen</li>
</ol>
</div>
<h4 class="page-title">Rechnungen</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body mb-3">
<h4 class="header-title mb-3">Filter</h4>
<form method="get" action="<?=self::getUrl("Invoice")?>">
<div class="row">
<div class="col-1">
<label class="form-label" for="filter_customer_number">Kundennummer</label>
<input type="text" class="form-control" name="filter[customer_number]" id="filter_customer_number" value="<?=(array_key_exists("customer_number", $filter)) ? $filter['customer_number'] : ""?>"/>
</div>
<div class="col-1">
<label class="form-label" for="filter_customer">Kunde</label>
<input type="text" class="form-control" name="filter[customer]" id="filter_customer" value="<?=(array_key_exists("customer", $filter)) ? $filter['customer'] : ""?>"/>
</div>
<div class="col-1">
<label class="form-label" for="filter_address">Adresse</label>
<input type="text" class="form-control" name="filter[address]" id="filter_address" value="<?=(array_key_exists("address", $filter)) ? $filter['address'] : ""?>"/>
</div>
</div>
<div class="row mt-2">
<div class="col">
<button type="submit" class="btn btn-primary">Filter anwenden</button>
<a class="btn btn-secondary" href="<?=self::getUrl("Invoice")?>?resetFilter=1">Filter zurücksetzen</a>
</div>
</div>
</form>
</div>
</div>
<div class="card">
<div class="card-body mb-3">
<div class="row">
<div class="col-12">
<h4 class="header-title">Rechnungen</h4>
<!--button type="submit" class="btn btn-primary"><i class="fas fa-fw fa-check"></i> Markierte Elemente als Contract übernehmen</button-->
</div>
</div>
<div class="row">
<div class="col-12">
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
<table class="table table-sm table-striped table-hover">
<tr>
<th>Rechungsnummer</th>
<th>Rechnungsdatum</th>
<th>Kundennummer</th>
<th>Rechnungsadresse</th>
<th>Netto</th>
<th>Ust.</th>
<th>Brutto</th>
<th>Zahlung</th>
<th>Zustellung</th>
<th></th>
</tr>
<?php foreach($invoices as $invoice): ?>
<?php $total = $invoice->total + $invoice->total_setup; ?>
<?php $total_gross = $invoice->total_gross + $invoice->total_setup_gross; ?>
<tr>
<td><a href="<?=self::getUrl("Invoice", "downloadInvoice", ["id" => $invoice->id])?>"><i class="fas fa-download fa-fw"></i> <?=$invoice->invoice_number?></a></td>
<td><?=date("d.m.Y", $invoice->invoice_date)?></td>
<td><?=$invoice->customer_number?></td>
<td>
<?=($invoice->company) ? $invoice->company."<br />" : ""?>
<?=($invoice->firstname || $invoice->lastname) ? $invoice->firstname." ".$invoice->lastname."<br />" : ""?>
<?=$invoice->street?><br />
<?=$invoice->zip?> <?=$invoice->city?><br />
<?=$invoice->country?>
</td>
<td class="<?=($total < 0) ? "text-danger" : ""?>">€ <?=number_format($total,2,",",".")?></td>
<td class="<?=($invoice->total_vat < 0) ? "text-danger" : ""?>">€ <?=number_format($invoice->total_vat,2,",",".")?></td>
<td class="<?=($total_gross < 0) ? "text-danger" : ""?>">€ <?=number_format($total_gross,2,",",".")?></td>
<td><?=($invoice->billing_type == "sepa") ? "SEPA" : "Überweisung"?></td>
<td><?=($invoice->billing_delivery == "email") ? "Email" : "Papier"?></td>
<td><a href="<?=self::getUrl("Invoice", "downloadInvoice", ["id" => $invoice->id])?>"><i class="fas fa-download fa-fw"></i></a></td>
</tr>
<?php endforeach; ?>
</table>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
+158
View File
@@ -0,0 +1,158 @@
<?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>