Added Address Invoice view
This commit is contained in:
@@ -22,8 +22,13 @@
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<a href="<?=self::getUrl("Address","Index", ['s' => $s])?>" class="btn btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Übersicht</a>
|
||||
<a href="<?=self::getUrl("Address","edit", ['id' => $address->id, 's' => $s, 'f' => "view"])?>" class="btn btn-outline-success"><i class="fas fa-edit"></i> Adresse bearbeiten</a>
|
||||
<div class="float-left">
|
||||
<a href="<?=self::getUrl("Address","Index", ['s' => $s])?>" class="btn btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Übersicht</a>
|
||||
<a href="<?=self::getUrl("Address","edit", ['id' => $address->id, 's' => $s, 'f' => "view"])?>" class="btn btn-outline-success"><i class="fas fa-edit"></i> Adresse bearbeiten</a>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
<a href="<?=self::getUrl("Address","invoice", ["address_id" => $address->id])?>" class="btn btn-purple mr-1"><i class="far fa-file-invoice-dollar"></i> Rechungsübersicht</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
95
Layout/default/Address/invoice.php
Normal file
95
Layout/default/Address/invoice.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?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="javascript: void(0);"><?=MFAPPNAME_SLUG?></a></li>
|
||||
<li class="breadcrumb-item"><a href="<?=self::getUrl("Address")?>">Personen & Firmen</a></li>
|
||||
<li class="breadcrumb-item"><a href="<?=self::getUrl("Address", "view", ["address_id" => $address->id])?>"><?=$address->getCompanyOrName()?> [<?=$address->customer_number?>]</a></li>
|
||||
<li class="breadcrumb-item active"><?=$address->getCompanyOrName()?> [<?=$address->customer_number?>]</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Personen & Firmen</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<a href="<?=self::getUrl("Address","view", ["id" => $address->id])?>" class="btn btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Addresse</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
|
||||
<div class="card border-top-purple">
|
||||
<div class="card-body">
|
||||
<h3 class="text-center mb-3">Rechnungen</h3>
|
||||
|
||||
<div><?=$address->getCompanyOrName()?></div>
|
||||
<div><?=$address->street?></div>
|
||||
<div><?=$address->zip?> <?=$address->city?></div>
|
||||
<div><?=$address->country->name?></div>
|
||||
|
||||
<table class="table table-sm table-striped">
|
||||
<tr>
|
||||
<th>Typ</th>
|
||||
<th>Rechnungsnummer</th>
|
||||
<th>Rechnungsdatum</th>
|
||||
<th>Betrag Netto</th>
|
||||
<th>Betrag Brutto</th>
|
||||
<th>Zahlungsart</th>
|
||||
<th>Versand</th>
|
||||
</tr>
|
||||
<?php foreach($invoices as $invoice): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<ul>
|
||||
<?php if($invoice->owner_id == $address->id):?>
|
||||
<li>Vertragsinhaber</li>
|
||||
<?php endif; ?>
|
||||
<?php if($invoice->billingaddress_id == $address->id):?>
|
||||
<li>Rechnungsempfänger</li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</td>
|
||||
<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 class="<?=($invoice->total < 0) ? "text-danger" : ""?>">€ <?=number_format($invoice->total, 2, ",", ".")?></td>
|
||||
<td class="<?=($invoice->total_gross < 0) ? "text-danger" : ""?>">€ <?=number_format($invoice->total_gross, 2, ",", ".")?></td>
|
||||
<td><?=($invoices->billing_type == "sepa") ? "Einzug" : "Einzahlung" ?></td>
|
||||
<td><?=($invoices->billing_delivery == "email") ? "Email (".$invoice->email.")" : "Postversand" ?></td>
|
||||
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<a href="<?=self::getUrl("Address","view", ["id" => $address->id])?>" class="btn btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Addresse</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
|
||||
@@ -140,6 +140,29 @@ class AddressController extends mfBaseController {
|
||||
$this->redirect("Address");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function invoiceAction() {
|
||||
$this->layout()->setTemplate("Address/invoice");
|
||||
|
||||
$address_id = $this->request->address_id;
|
||||
if(!is_numeric($address_id) || $address_id < 1) {
|
||||
$this->layout()->setFlash("Addresse nicht gefunden", "error");
|
||||
$this->redirect("Address");
|
||||
}
|
||||
|
||||
$address = new Address($address_id);
|
||||
if(!$address->id) {
|
||||
$this->layout()->setFlash("Addresse nicht gefunden", "error");
|
||||
$this->redirect("Address");
|
||||
}
|
||||
|
||||
$invoices = InvoiceModel::search(["owner_or_billingaddress_id" => $address->id], false, "invoice_date DESC");
|
||||
$this->layout()->set("invoices", $invoices);
|
||||
$this->layout()->set("address", $address);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function editAction() {
|
||||
|
||||
@@ -15,6 +15,9 @@ class InvoiceController extends mfBaseController {
|
||||
}
|
||||
|
||||
protected function indexAction() {
|
||||
if(!$this->me->is("Billing")) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
$this->layout()->setTemplate("Invoice/Index");
|
||||
|
||||
if ($this->request->resetFilter) {
|
||||
@@ -99,6 +102,7 @@ class InvoiceController extends mfBaseController {
|
||||
$ifile = InvoiceFileModel::createFromInvoice($invoice);
|
||||
if(!$ifile) {
|
||||
$this->layout()->setFlash("Fehler beim PDF erstellen");
|
||||
$this->redirect("Invoice");
|
||||
}
|
||||
$pdf = $ifile->file;
|
||||
}
|
||||
@@ -106,8 +110,9 @@ class InvoiceController extends mfBaseController {
|
||||
$pdf_path = $pdf->getFullPath();
|
||||
$filename = $pdf->filename;
|
||||
|
||||
if(!file_exists($filename)) {
|
||||
if(!file_exists($pdf_path)) {
|
||||
$this->layout()->setFlash("PDF-Datei nicht gefunden");
|
||||
$this->redirect("Invoice");
|
||||
}
|
||||
|
||||
header('Content-Type: application/octet-stream');
|
||||
@@ -177,6 +182,10 @@ class InvoiceController extends mfBaseController {
|
||||
|
||||
|
||||
protected function runInvoicingAction() {
|
||||
if(!$this->me->is("Billing")) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
$p = 0;
|
||||
|
||||
@@ -564,6 +573,9 @@ class InvoiceController extends mfBaseController {
|
||||
}
|
||||
|
||||
protected function exportBmdAction() {
|
||||
if(!$this->me->is("Billing")) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
/*
|
||||
* satzart;konto;gkonto;belegnr;belegdatum;buchsymbol;buchcode;prozent;steuercode;betrag;steuer;text;kost;bank-iban-nr;bank-swiftcode;bank-mandatsid;bank-mandatsdatum;bank-mandatskz;bank-letztereinzug;zvsperre;bankeinzug
|
||||
* 0;234941;40010;TEST-1;23.01.2024;AR;1;20;1;1,2;-0,2;RNTEST-01;;AT293828200003027919;RZSTAT2G282;KJ2813;13.01.2023;0;;0;1
|
||||
@@ -695,6 +707,10 @@ class InvoiceController extends mfBaseController {
|
||||
}
|
||||
|
||||
protected function sendInvoicesAction() {
|
||||
if(!$this->me->is("Billing")) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
|
||||
$r = $this->request;
|
||||
$type = $r->type;
|
||||
|
||||
@@ -751,6 +767,10 @@ class InvoiceController extends mfBaseController {
|
||||
}
|
||||
|
||||
public function printInvoices() {
|
||||
if(!$this->me->is("Billing")) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
|
||||
$start = $this->request->delivery_start_date;
|
||||
$end = $this->request->delivery_end_date;
|
||||
|
||||
@@ -819,19 +839,15 @@ class InvoiceController extends mfBaseController {
|
||||
$pdf_unite_cmd = PDFUNITE_BIN_PATH." '$src_file' '$file' '$tmp_file'";
|
||||
}
|
||||
|
||||
|
||||
//echo "$pdf_unite_cmd\n<br />";
|
||||
shell_exec($pdf_unite_cmd);
|
||||
|
||||
$i++;
|
||||
}
|
||||
//exit;
|
||||
|
||||
rename($tmp_file, $output_filepath);
|
||||
unlink($tmp_file1);
|
||||
unlink($tmp_file2);
|
||||
|
||||
//exit;
|
||||
|
||||
if(!file_exists($output_filepath)) {
|
||||
$this->layout()->setFlash("Fehler beim PDFs zusammenführen: Ausgabedatei nicht gefunden", "error");
|
||||
$this->redirect("Invoice");
|
||||
|
||||
@@ -301,13 +301,27 @@ class InvoiceModel {
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("owner_id", $filter)) {
|
||||
$owner_id = $filter['owner_id'];
|
||||
if(is_numeric($owner_id)) {
|
||||
$where .= " AND Invoice.owner_id=$owner_id";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("billingaddress_id", $filter)) {
|
||||
$Invoiceaddress_id = $filter['billingaddress_id'];
|
||||
if(is_numeric($Invoiceaddress_id)) {
|
||||
$where .= " AND Invoice.billingaddress_id=$Invoiceaddress_id";
|
||||
$billingaddress_id = $filter['billingaddress_id'];
|
||||
if(is_numeric($billingaddress_id)) {
|
||||
$where .= " AND Invoice.billingaddress_id=$billingaddress_id";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("owner_or_billingaddress_id", $filter)) {
|
||||
$address_id = $filter['owner_or_billingaddress_id'];
|
||||
if(is_numeric($address_id)) {
|
||||
$where .= " AND (Invoice.owner_id=$address_id OR Invoice.billingaddress_id=$address_id)";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("customer_number", $filter)) {
|
||||
$customer_number = $filter['customer_number'];
|
||||
if(is_numeric($customer_number)) {
|
||||
|
||||
Reference in New Issue
Block a user