Files
thetool/Layout/default/Invoice/Index.php
2024-08-20 17:48:29 +02:00

296 lines
16 KiB
PHP

<?php
$pagination_baseurl = $this->getUrl($Mod, "Index");
$pagination_baseurl_params = ["filter" => $filter];
$pagination_entity_name = "Rechnungen";
?>
<?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">
<div class="row">
<div class="col">
<a href="https://thetool.xinon.at/xfarm/" class="btn btn-primary" target="_blank"><i class="far fa-arrows-to-circle fa-fw"></i> AR-Merge / Fibu Konten Import</a>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-8">
<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-2">
<label class="form-label" for="filter_invoice_number">Rechnungsnummer</label>
<input type="text" class="form-control" name="filter[invoice_number]" id="filter_invoice_number" value="<?=(array_key_exists("invoice_number", $filter)) ? $filter['invoice_number'] : ""?>"/>
</div>
<div class="col-2">
<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-2">
<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-2">
<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 class="col-2">
<label class="form-label" for="filter_invoice_date_from">Rechnungsdatum von</label>
<input type="text" class="form-control" name="filter[invoice_date_from]" id="filter_invoice_date_from" value="<?=(array_key_exists("invoice_date_from", $filter)) ? $filter['invoice_date_from'] : ""?>"/>
</div>
<div class="col-2">
<label class="form-label" for="filter_invoice_date_to">Rechnungsdatum bis</label>
<input type="text" class="form-control" name="filter[invoice_date_to]" id="filter_invoice_date_to" value="<?=(array_key_exists("invoice_date_to", $filter)) ? $filter['invoice_date_to'] : ""?>"/>
</div>
</div>
<div class="row mt-2">
<div class="col-6">
<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 class="col-6 justify-content-end text-right">
<button type="submit" name="export_type" value="bmd-credit" class="btn btn-outline-danger"><i class="far fa-fw fa-file-export"></i> Provisionsexport für BMD</button>
<button type="submit" name="export_type" value="bmd-invoice" class="btn btn-outline-primary ml-2"><i class="far fa-fw fa-file-export"></i> Rechnungsexport für BMD</button>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="col-4">
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-8">
<h4>Rechnungsversand</h4>
<form method="post" action="<?=self::getUrl("Invoice","sendInvoices")?>">
<div class="row">
<div class="col-6">
<label class="form-label" for="delivery_start_date">Rechungsdatum von</label>
<input type="text" class="form-control" name="delivery_start_date" id="delivery_start_date" value="" />
</div>
<div class="col-6">
<label class="form-label" for="delivery_end_date">Rechungsdatum bis</label>
<input type="text" class="form-control" name="delivery_end_date" id="delivery_end_date" value="" />
</div>
</div>
<div class="row mt-2">
<div class="col-12">
<button name="type" value="paper" class="btn btn-lg btn-purple"><i class="far fa-fw fa-print"></i> Rechnungen für Postversand drucken</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-body mb-3">
<div class="row">
<div class="col-12">
<h4 class="header-title">Rechnungen</h4>
</div>
</div>
<div class="row justify-content-end">
<div class="col-4">
<div>
<table class="table table-sm table-striped table-bordered">
<tr>
<th class="text-right">
Summe Rechnungen Netto:<br/>
Summe Rechnungen Brutto:
</th>
<td class="text-monospace">
€ <?=number_format($sum_price, 2, ",", ".")?><br />
€ <?=number_format($sum_price_gross, 2, ",", ".")?>
</td>
</tr><tr>
<th class="text-right">
Summe Rechnungen Bankeinzug Netto:<br />
Summe Rechnungen Bankeinzug Brutto:
</th>
<td class="text-monospace">
€ <?=number_format($sum_price_sepa, 2, ",", ".")?><br />
€ <?=number_format($sum_price_sepa_gross, 2, ",", ".")?>
</td>
</tr><tr>
<th class="text-right">
Summe Gutschriften Netto:<br />
Summe Gutschriften Brutto:
</th>
<td class="text-monospace">
€ <?=number_format($sum_credit_price, 2, ",", ".")?><br />
€ <?=number_format($sum_credit_price_gross, 2, ",", ".")?>
</td>
</tr><tr>
<th class="text-right">
Summe Gesprächsgebühren Netto:<br />
Summe Gesprächsgebühren Brutto:
</th>
<td class="text-monospace">
€ <?=number_format($sum_voicecalls_price, 2, ",", ".")?><br />
€ <?=number_format($sum_voicecalls_price_gross, 2, ",", ".")?>
</td>
</tr><tr>
<th class="text-right">
Summe Gesprächsgebühren Bankeinzug Netto:<br />
Summe Gesprächsgebühren Bankeinzug Brutto:
</th>
<td class="text-monospace">
€ <?=number_format($sum_voicecalls_price_sepa, 2, ",", ".")?><br />
€ <?=number_format($sum_voicecalls_price_sepa_gross, 2, ",", ".")?>
</td>
</tr>
</table>
</div>
</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>
<?php if($invoice->pdf): ?>
<i class="fas fa-fw fa-check" title="PDF generiert"></i>
<?php endif; ?>
<?php if($invoice->date_delivered): ?>
<i class="fas fa-fw fa-mail" title="per Email versendet am <?=date("d.m.Y H:i", $invoice->date_delivered)?>"></i>
<?php endif; ?>
</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 >€ <?=number_format($total_gross - $total,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", "downloadInvoiceCsv", ["id" => $invoice->id])?>" title="CSV-Download"><i class="fas fa-file-csv 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>
<script>
$('#delivery_start_date').datepicker({
orientation: "bottom",
language: 'de',
format: "dd.mm.yyyy",
showWeekDays: true,
todayBtn: 'linked',
autoclose: true
});
$('#delivery_end_date').datepicker({
orientation: "bottom",
language: 'de',
format: "dd.mm.yyyy",
showWeekDays: true,
todayBtn: 'linked',
autoclose: true
});
$('#filter_invoice_date_from').datepicker({
orientation: "bottom",
language: 'de',
format: "dd.mm.yyyy",
showWeekDays: true,
todayBtn: 'linked',
autoclose: true
});
$('#filter_invoice_date_to').datepicker({
orientation: "bottom",
language: 'de',
format: "dd.mm.yyyy",
showWeekDays: true,
todayBtn: 'linked',
autoclose: true
});
</script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>