Contract WIP

This commit is contained in:
Frank Schubert
2023-02-23 13:06:04 +01:00
parent 0c5f463ec1
commit aa373b5f4e
10 changed files with 624 additions and 154 deletions

View File

@@ -27,163 +27,187 @@
</div>
</div>
<div class="card">
<div class="card-body">
<h3 class="text-center mb-3"><?=$address->getCompanyOrName()?><?=($address->customer_number) ? " [".$address->customer_number."]" : ""?></h3>
<div class="row">
<div class="col-8">
<table class="table table-sm table-striped view-table">
<tr>
<th>Kundennummer</th>
<td><?=$address->customer_number?></td>
</tr><tr>
<th>Firmenname</th>
<td><?=nl2br($address->company)?></td>
</tr><tr>
<th>Vorname</th>
<td><?=$address->firstname?></td>
</tr><tr>
<th>Nachname</th>
<td><?=$address->lastname?></td>
</tr><tr>
<th>Straße</th>
<td><?=$address->street?></td>
</tr><tr>
<th>PLZ / Ort</th>
<td><?=$address->zip?> <?=$address->city?></td>
</tr><tr>
<th>Land</th>
<td><?=$address->country?></td>
</tr><tr>
<th>Telefon</th>
<td><?=$address->phone?></td>
</tr><tr>
<th>Mobil</th>
<td><?=$address->mobile?></td>
</tr><tr>
<th>Fax</th>
<td><?=$address->fax?></td>
</tr><tr>
<th>Email</th>
<td><?=$address->email?></td>
</tr><tr>
<th></th>
<td></td>
</tr><tr>
<th>Service PIN</th>
<td><?=$address->spin?></td>
</tr><tr>
<th>Einwilligungen</th>
<td>
<p><i class="mr-1 fas <?=($address->allow_contact) ? "fa-check text-success" : "fa-xmark-large text-danger"?>"></i> Informationen per Post/Email/Telefon</p>
<p><i class="mr-1 fas <?=($address->allow_spin) ? "fa-check text-success" : "fa-xmark-large text-danger"?>"></i>Auskunft mit Service PIN</p>
</td>
</tr><tr>
<th>Rollen</th>
<td>
<?php if(is_array($address->types) && count($address->types)): ?>
<?php foreach(TT_ROLES as $role): ?>
<ul>
<?php if(array_key_exists($role, $address->types)): ?>
<li><?=__($role)?></li>
<div class="card border-top-primary">
<div class="card-body">
<h3 class="text-center mb-3"><?=$address->getCompanyOrName()?><?=($address->customer_number) ? " [".$address->customer_number."]" : ""?></h3>
<table class="table table-sm table-striped view-table">
<tr>
<th>Kundennummer</th>
<td><?=$address->customer_number?></td>
</tr><tr>
<th>Firmenname</th>
<td><?=nl2br($address->company)?></td>
</tr><tr>
<th>Vorname</th>
<td><?=$address->firstname?></td>
</tr><tr>
<th>Nachname</th>
<td><?=$address->lastname?></td>
</tr><tr>
<th>Straße</th>
<td><?=$address->street?></td>
</tr><tr>
<th>PLZ / Ort</th>
<td><?=$address->zip?> <?=$address->city?></td>
</tr><tr>
<th>Land</th>
<td><?=$address->country?></td>
</tr><tr>
<th>Telefon</th>
<td><?=$address->phone?></td>
</tr><tr>
<th>Mobil</th>
<td><?=$address->mobile?></td>
</tr><tr>
<th>Fax</th>
<td><?=$address->fax?></td>
</tr><tr>
<th>Email</th>
<td><?=$address->email?></td>
</tr><tr>
<th></th>
<td></td>
</tr><tr>
<th>Service PIN</th>
<td><?=$address->spin?></td>
</tr><tr>
<th>Einwilligungen</th>
<td>
<p><i class="mr-1 fas <?=($address->allow_contact) ? "fa-check text-success" : "fa-xmark-large text-danger"?>"></i> Informationen per Post/Email/Telefon</p>
<p><i class="mr-1 fas <?=($address->allow_spin) ? "fa-check text-success" : "fa-xmark-large text-danger"?>"></i>Auskunft mit Service PIN</p>
</td>
</tr><tr>
<th>Rollen</th>
<td>
<?php if(is_array($address->types) && count($address->types)): ?>
<?php foreach(TT_ROLES as $role): ?>
<ul>
<?php if(array_key_exists($role, $address->types)): ?>
<li><?=__($role)?></li>
<?php endif; ?>
</ul>
<?php endforeach; ?>
<?php endif; ?>
</ul>
<?php endforeach; ?>
<?php endif; ?>
</td>
</tr><tr>
<td colspan="2"><h4>Verrechnungsdaten</h4></td>
</tr><tr>
<th>UID</th>
<td><?=$address->uid?></td>
</tr><tr>
<th>Verrechnungsart</th>
<td><?=($address->billing_type == "sepa") ? "SEPA Bankeinzug" : "Rechnung"?></td>
</tr><tr>
<th>Rechnungsversand</th>
<td><?=($address->billing_delivery == "paper") ? "POST" : "Email"?></td>
</tr><tr>
<th>Kreditinstitut</th>
<td><?=$address->bank_account_bank?></td>
</tr><tr>
<th>Kontoinhaber</th>
<td><?=$address->bank_account_owner?></td>
</tr><tr>
<th>IBAN</th>
<td><?=$address->bank_account_iban?></td>
</tr><tr>
<th>BIC</th>
<td><?=$address->bank_account_bic?></td>
</tr><tr>
<td colspan="2"><h4>Zusatzdaten</h4></td>
</tr><tr>
<th>RTR Code</th>
<td><?=$address->attributes['rtrcode']->value?></td>
</tr>
</table>
<h4>Verknüpfungen</h4>
<?php if(is_array($address->links) && count($address->links)): ?>
<div class="card">
<div class="card-body" id="link-container">
<table class="table table-striped table-sm table-bordered">
<tr>
<th>Typ</th>
<th>Firma</th>
<th>Name</th>
<th>Telefon</th>
<th>Mobil</th>
<th>Email</th>
<th></th>
</tr>
<?php foreach(TT_ADDRESS_LINK_TYPES as $type): ?>
<?php if(array_key_exists($type, $address->links)): ?>
<?php foreach($address->links[$type] as $link): ?>
<tr>
<td class="font-weight-bold"><?=__($type)?></td>
<td><a href="<?=self::getUrl("Address", "view", ["id" => $link->address_id])?>"><?=$link->address->company?></a></td>
<td><a href="<?=self::getUrl("Address", "view", ["id" => $link->address_id])?>"><?=$link->address->getFullName()?></a></td>
<td><?=$link->address->phone?></td>
<td><?=$link->address->mobile?></td>
<td><?=$link->address->email?></td>
<td>
<a class="mr-2" href="<?=self::getUrl("Address", "view", ["id" => $link->address_id])?>"><i class="far fa-eyes" title="Anzeigen"></i></a>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
</td>
</tr><tr>
<td colspan="2"><h4>Verrechnungsdaten</h4></td>
</tr><tr>
<th>UID</th>
<td><?=$address->uid?></td>
</tr><tr>
<th>Verrechnungsart</th>
<td><?=($address->billing_type == "sepa") ? "SEPA Bankeinzug" : "Rechnung"?></td>
</tr><tr>
<th>Rechnungsversand</th>
<td><?=($address->billing_delivery == "paper") ? "POST" : "Email"?></td>
</tr><tr>
<th>Kreditinstitut</th>
<td><?=$address->bank_account_bank?></td>
</tr><tr>
<th>Kontoinhaber</th>
<td><?=$address->bank_account_owner?></td>
</tr><tr>
<th>IBAN</th>
<td><?=$address->bank_account_iban?></td>
</tr><tr>
<th>BIC</th>
<td><?=$address->bank_account_bic?></td>
</tr><tr>
<td colspan="2"><h4>Zusatzdaten</h4></td>
</tr><tr>
<th>RTR Code</th>
<td><?=$address->attributes['rtrcode']->value?></td>
</tr>
</table>
<h4>Verknüpfungen</h4>
<?php if(is_array($address->links) && count($address->links)): ?>
<div class="card border-top-warning">
<div class="card-body" id="link-container">
<table class="table table-striped table-sm table-bordered">
<tr>
<th>Typ</th>
<th>Firma</th>
<th>Name</th>
<th>Telefon</th>
<th>Mobil</th>
<th>Email</th>
<th></th>
</tr>
<?php foreach(TT_ADDRESS_LINK_TYPES as $type): ?>
<?php if(array_key_exists($type, $address->links)): ?>
<?php foreach($address->links[$type] as $link): ?>
<tr>
<td class="font-weight-bold"><?=__($type)?></td>
<td><a href="<?=self::getUrl("Address", "view", ["id" => $link->address_id])?>"><?=$link->address->company?></a></td>
<td><a href="<?=self::getUrl("Address", "view", ["id" => $link->address_id])?>"><?=$link->address->getFullName()?></a></td>
<td><?=$link->address->phone?></td>
<td><?=$link->address->mobile?></td>
<td><?=$link->address->email?></td>
<td>
<a class="mr-2" href="<?=self::getUrl("Address", "view", ["id" => $link->address_id])?>"><i class="far fa-eyes" title="Anzeigen"></i></a>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
</table>
</div>
</div>
<?php endif; ?>
<?php if(is_array($address->linked_as) && count($address->linked_as)): ?>
<h4>Verknüpft als</h4>
<div class="card">
<div class="card-body" id="link-container">
<table class="table-sm table-striped">
<?php foreach(TT_ADDRESS_LINK_TYPES as $type): ?>
<?php if(array_key_exists($type, $address->linked_as)): ?>
<?php foreach($address->linked_as[$type] as $link): ?>
<tr>
<td><strong><?=__($type)?></strong> für:</td>
<td><a href="<?=self::getUrl("Address", "view", ['id' => $link->origin_address_id])?>"><?=$link->origin->getCompanyOrName()?><?=($link->origin->customer_number) ? " [".$link->origin->customer_number."]" : ""?></a></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
</table>
</div>
</div>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<?php if(is_array($address->linked_as) && count($address->linked_as)): ?>
<h4>Verknüpft als</h4>
<div class="card">
<div class="card-body" id="link-container">
<table class="table-sm table-striped">
<?php foreach(TT_ADDRESS_LINK_TYPES as $type): ?>
<?php if(array_key_exists($type, $address->linked_as)): ?>
<?php foreach($address->linked_as[$type] as $link): ?>
<tr>
<td><strong><?=__($type)?></strong> für:</td>
<td><a href="<?=self::getUrl("Address", "view", ['id' => $link->origin_address_id])?>"><?=$link->origin->getCompanyOrName()?><?=($link->origin->customer_number) ? " [".$link->origin->customer_number."]" : ""?></a></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
</table>
</div>
</div>
<?php endif; ?>
</div>
<div class="col-4">
<div class="card border-top-success">
<div class="card-header">
Aktive Produkte (Contracts)
</div>
<?php if(is_array($address->contracts) && count($address->contracts)): ?>
<ul class="list-group list-group-flush">
<?php foreach($address->contracts as $contract): ?>
<li class="list-group-item"><a href="<?=self::getUrl("Contract", "View", ["id" => $contract->id])?>"><?=$contract->product_name?> [<?=$contract->matchcode?>]</a> (<?=($contract->finish_date) ? "Fertigstellung: ".date('d.m.Y', $contract->finish_date) : ""?>)</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
</div>
</div>
<?php if(is_array($address->contracts) && count($address->contracts)): ?>
<div class="card">
<?php if(is_array($address->active_contracts) && count($address->active_contracts)): ?>
<div class="card border-top-success">
<div class="card-header">
Verträge
</div>
<div class="card-body">
<h4>Verträge</h4>
<table class="table table-striped table-sm table-bordered table-hover">
<tr>
@@ -194,9 +218,8 @@
<th>Bestelldatum</th>
<th>Fertigstellung</th>
<th>Kündigung</th>
<th></th>
</tr>
<?php foreach($address->contracts as $contract): ?>
<?php foreach($address->active_contracts as $contract): ?>
<tr>
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>">
<a href="<?=self::getUrl("Contract", "View", ["id" => $contract->id])?>">
@@ -213,9 +236,7 @@
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>"><?=($contract->order_date) ? date('d.m.Y', $contract->order_date) : ""?></td>
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>"><?=($contract->finish_date) ? date('d.m.Y', $contract->finish_date) : ""?></td>
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>"><?=($contract->cancel_date) ? date('d.m.Y', $contract->cancel_date) : ""?></td>
<td>
<a href="<?=self::getUrl("Contract", "deleteLink", ["link_id" => $contract->id])?>" onclick="if(!confirm('Verknüpfung wirklich entfernen?')) return false;" class="text-danger" title="Verknüpfung entfernen"><i class="fas fa-xmark-large"></i></a>
</td>
</tr>
<?php endforeach; ?>
</table>

View File

@@ -27,7 +27,7 @@
</div>
</div>
<div class="card">
<div class="card border-top-success">
<div class="card-body">
<?php if(!$contract->finish_date || $contract->finish_date > date('U')): ?>
<h2 class="text-center mb-3 text-secondary">In Herstellung</h2>
@@ -215,8 +215,50 @@
</div>
</div>
<?php if(is_array($contract->journals) && count($contract->journals)): ?>
<div class="card border-top-warning">
<div class="card-header">
<h5>Journaleinträge</h5>
</div>
<div class="card-body">
<div class="row justify-content-center">
<div class="col-8">
<table class="table table-striped table-sm">
<?php foreach($contract->journals as $j): ?>
<tr>
<td style="white-space: nowrap" class="text-monospace"><?=date("d.m.Y H:i", $j->create)?> (<?=$j->creator?>)</td>
<td style="width: 100%">
<?php if($j->type == "text"):?>
<?=self::strtrim(str_replace(["\n", "\r", "\t"]," ", $j->text), 128)?>
<?php elseif($j->type == "phone"): ?>
<i class="fas fa-phone text-white bg-warning p-1"></i> <?=self::strtrim(str_replace(["\n", "\r", "\t"]," ", $j->text), 128)?>
<?php elseif($j->type == "file"): ?>
<?php if($j->text): ?>
<?=self::strtrim(str_replace(["\n", "\r", "\t"]," ", $j->text), 128)?><br />
<?php endif; ?>
<a class="text-monospace" href="<?=self::getUrl("File", "download", ["id" => $j->contractfile->file_id])?>"> <i class="fas fa-download"></i> <?=$j->contractfile->name?></a>
<?php elseif($j->type == "created_from"): ?>
<?php if($j->value == "manual"): ?>
<em>Vertrag manuell angelegt.</em>
<?php endif; ?>
<?php endif; ?>
</td>
<td style="white-space: nowrap">
<a href="<?=self::getUrl("Contractjournal", "edit", ["journal_id" => $j->id])?>" title="Journaleintrag bearbeiten"><i class="fas fa-edit"></i></a>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>
</div>
</div>
<?php endif; ?>
<?php if((is_array($contract->linkFrom) && count($contract->linkFrom)) || (is_array($contract->linkTo) && count($contract->linkTo))): ?>
<div class="card">
<div class="card border-top-success">
<div class="card-body">
<h4>Verknüpfte Verträge <small><a href="<?=self::getUrl("Contract", "add", ["origin_contract_id" => $contract->id])?>"><i class="fas fa-plus"></i>Neuen Contract anlegen</a></small></h4>