Feature/add historic bills

This commit is contained in:
Luca Haid
2024-11-06 12:39:14 +00:00
parent 13d14aab33
commit a696f60383
7 changed files with 111 additions and 2 deletions

View File

@@ -59,7 +59,7 @@ asort($Devices);
<div class="card-body">
<h4 class="header-title mb-2"><?= ($device->id) ? "Device bearbeiten" : "Neues Device" ?></h4>
<form class="form-horizontal" method="post"
action="<?= self::getUrl("Device", "save", ["returnto" => $_GET["returnto"]]) ?>">
action="<?= self::getUrl("Device", "save", ["returnto" => $_GET["returnto"] ?? ""]) ?>">
<div class="card">
<div class="card-body">
@@ -101,7 +101,7 @@ asort($Devices);
<select class="select2 form-control " name="pop_id" id="pop_id">
<option value="0">&nbsp;</option>
<?php foreach ($pops as $pop): ?>
<option value="<?= $pop->id ?>" <?= ($device->pop_id == $pop->id) ? "selected='selected'" : "" ?>><?= ($pop->devicemanufactor->name . " " . $pop->name) ?></option>
<option value="<?= $pop->id ?>" <?= ($device->pop_id == $pop->id) ? "selected='selected'" : "" ?>><?= ($pop->devicemanufactor->name ?? '' . " " . $pop->name) ?></option>
<?php endforeach; ?>
</select>
</div>

View File

@@ -98,6 +98,7 @@
<li class="has-sub-submenu"><a href="<?=self::getUrl("Contract", "AdvancedSearch")?>"><i class="far fa-fw fa-question-circle text-info"></i> Erweiterte Suche</a></li>
<?php if($me->is(["Admin"]) && $me->can("Billing")): ?><li><a href="<?=self::getUrl("Billing")?>"><i class="far fa-fw fa-cash-register text-info"></i> Verrechnung</a></li><?php endif; ?>
<?php if($me->is(["Admin"]) && $me->can("Billing")): ?><li><a href="<?=self::getUrl("Invoice")?>"><i class="far fa-fw fa-file-invoice-dollar text-info"></i> Rechnungen</a></li><?php endif; ?>
<?php if($me->is(["Admin"]) && $me->can("Billing")): ?><li><a href="<?=self::getUrl("HistoricBill")?>"><i class="far fa-fw fa-file-invoice-dollar text-info"></i> Historische Rechnungen</a></li><?php endif; ?>
</ul>
</li>
<?php endif; ?>

View File

@@ -0,0 +1,9 @@
<?php
/**
* @property mixed|null $name
*/
class HistoricBill extends mfBaseModel
{
}

View File

@@ -0,0 +1,16 @@
<?php
class HistoricBillController extends TTCrud {
protected string $headerTitle = 'Historische Rechnungen';
protected bool $createText = false;
protected array $columns = [
['key' => 'invoice_number', 'text' => 'Rechnungsnummer', 'required' => true],
['key' => 'cinvoice_number', 'text' => 'Kundennummer', 'required' => true],
['key' => 'address1', 'text' => 'Adresse 1', 'required' => true],
['key' => 'address2', 'text' => 'Adresse 2', 'required' => true],
['key' => 'address3', 'text' => 'Adresse 3', 'required' => true],
['key' => 'address4', 'text' => 'Adresse 4', 'required' => true],
['key' => 'date_outgoing', 'text' => 'Ausgangsdatum', 'required' => true],
];
}

View File

@@ -0,0 +1,19 @@
<?php
class HistoricBillModel extends TTCrudBaseModel {
public int $id;
public string $cinvoice_number;
public string $invoice_number;
public int $cid;
public string $address1;
public string $address2;
public string $address3;
public string $address4;
public string $date_outgoing;
public string $bankcode;
public string $accountnumber;
public string $BIC;
public string $IBAN;
public string $Mandatinvoice_number;
public int $payment;
}

View File

@@ -0,0 +1,46 @@
<?php /** @noinspection ALL */
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class AddHistoricBill extends AbstractMigration {
public function up(): void {
if ($this->getEnvironment() == "thetool") {
//HistoricTicket Table
$HistoricBills = $this->table("HistoricBill", ["signed" => true]);
$HistoricBills->addColumn("invoice_number", "integer", ["null" => true]);
$HistoricBills->addColumn("cinvoice_number", "string", ["null" => false, "limit" => 255]);
$HistoricBills->addColumn("invoice_number", "string", ["null" => false, "limit" => 255]);
$HistoricBills->addColumn("cid", "integer", ["null" => false, "default" => "0"]);
$HistoricBills->addColumn("address1", "string", ["null" => false, "limit" => 255]);
$HistoricBills->addColumn("address2", "string", ["null" => false, "limit" => 255]);
$HistoricBills->addColumn("address3", "string", ["null" => false, "limit" => 255]);
$HistoricBills->addColumn("address4", "string", ["null" => false, "limit" => 255]);
$HistoricBills->addColumn("date_outgoing", "date", ["null" => false]);
$HistoricBills->addColumn("bankcode", "string", ["null" => false, "limit" => 255]);
$HistoricBills->addColumn("accountnumber", "string", ["null" => false, "limit" => 255]);
$HistoricBills->addColumn("BIC", "string", ["null" => false, "limit" => 255]);
$HistoricBills->addColumn("IBAN", "string", ["null" => false, "limit" => 255]);
$HistoricBills->addColumn("Mandatinvoice_number", "string", ["null" => false, "limit" => 255]);
$HistoricBills->addColumn("payment", "integer", ["null" => false, "default" => "0"]);
$HistoricBills->save();
$HistoricBills->addIndex("invoice_number", ["name" => "invoice_number"]);
}
if ($this->getEnvironment() == "addressdb") {
}
}
public function down(): void {
if ($this->getEnvironment() == "thetool") {
$this->table("HistoricBill")->drop()->save();
}
if ($this->getEnvironment() == "addressdb") {
}
}
}

View File

@@ -0,0 +1,18 @@
Vue.component('historic-bill', {
//language=Vue
template: `
<tt-card>
<tt-table-crud>
<template v-slot:invoice_number="{ row }">
<a :href="'/HistoricBillData/' + row.invoice_number + '.pdf'" target="_blank">{{ row.invoice_number }}</a>
</template>
</tt-table-crud>
</tt-card>
`, data() {
return {
window: window, historyModal: false, historyModalId: null,
}
},
})