Contract WIP & Contractqueue WIP 2024-04-18

This commit is contained in:
Frank Schubert
2024-04-18 14:01:02 +02:00
parent 1819b8ee9c
commit bede016157
8 changed files with 685 additions and 352 deletions

View File

@@ -156,10 +156,10 @@
<td><?=($contract->product_external) ? "Ja" : "Nein"?></td>
</tr><tr>
<th>Setup Preis:</th>
<td>€ <?=$contract->price_setup?></td>
<td class="<?=($contract->price_setup < 0) ? "text-danger" : ""?>">€ <?=$contract->price_setup?></td>
</tr><tr>
<th>Preis Periodisch:</th>
<td>€ <?=$contract->price?></td>
<td class="<?=($contract->price < 0) ? "text-danger" : ""?>">€ <?=$contract->price?></td>
</tr><tr>
<th>Verrechnungsperiode:</th>
<td>
@@ -261,9 +261,15 @@
<em>Vertrag manuell angelegt</em>
<?php elseif($j->value == "import"): ?>
<em>Vertrag importiert: <?=nl2br(htmlentities($j->text))?>
<?php elseif($j->value == "order"): ?>
<em>Vertrag aus Bestellung #<a href="<?=self::getUrl("Order", "edit", ["id" => $contract->orderproduct->order_id])?>"><?=$contract->orderproduct->order_id?></a> erstellt
<?php endif; ?>
</td>
<?php elseif($j->type == "credit_created"): ?>
<td><i class="far fa-money-bill-simple-wave text-secondary pl-1"></i></td>
<td style="width: 100%"><em>Gutschrift-Vertrag <a href="<?=self::getUrl("Contract", "View", ["contract_id" => $j->value])?>"><?=$j->value?></a> erstellt</em>
</td>
<?php elseif($j->type == "link"): ?>
<?php $link = new Contract($j->value); ?>
<td><i class="fas fa-link text-secondary pl-1"></i></td>
@@ -321,45 +327,56 @@
<?php if((is_array($contract->linkFrom) && count($contract->linkFrom)) || (is_array($contract->linkTo) && count($contract->linkTo))): ?>
<table class="table table-striped table-sm table-bordered table-hover">
<tr>
<th>Typ</th>
<th>Kunde</th>
<th>Contract ID</th>
<th>Typ</th>
<th>Produkt</th>
<th>Bestelldatum</th>
<th>Fertigstellung</th>
<th>Kündigung</th>
<th></th>
</tr>
<?php foreach($contract->links as $link): ?>
<?php
if($link->contract_id == $contract->id) {
$direction = "von";
$linkcontract = $link->origin;
} else {
$linkcontract = $link->contract;
if($link->type == "upgrade" || $link->type == "downgrade") {
$direction = "auf";
}
if($link->type == "relocation") {
$direction = "nach";
}
}
?>
<tr>
<td><a href="<?=self::getUrl("Address", "View", ["id" => $linkcontract->owner_id])?>"><?=$linkcontract->owner->getCompanyOrName()?></a></td>
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["contract_id" => $linkcontract->id])?>"><?=$linkcontract->id?></a></td>
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><?=__($link->type, "contract")?> <?=($link->type != "link") ? $direction : ""?></td>
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["contract_id" => $linkcontract->id])?>"><?=$linkcontract->product_name?> [<?=$linkcontract->matchcode?>]</a></td>
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><?=($linkcontract->order_date) ? date('d.m.Y', $linkcontract->order_date) : ""?></td>
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><?=($linkcontract->finish_date) ? date('d.m.Y', $linkcontract->finish_date) : ""?></td>
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><?=($linkcontract->cancel_date) ? date('d.m.Y', $linkcontract->cancel_date) : ""?></td>
<td>
<a href="<?=self::getUrl("Contract", "deleteLink", ["link_id" => $link->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 foreach([$contract->linkFrom, $contract->linkTo] as $links): ?>
<?php foreach($links as $link): ?>
<?php
if($link->contract_id == $contract->id) {
$direction = "von";
$linkcontract = $link->origin;
if($link->type == "credit") {
$direction = "";
//continue;
}
} else {
$linkcontract = $link->contract;
if($link->type == "upgrade" || $link->type == "downgrade") {
$direction = "auf";
}
if($link->type == "relocation") {
$direction = "nach";
}
if($link->type == "credit") {
$direction = "zu";
//continue;
}
}
?>
<tr>
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><?=__($link->type, "contract")?> <?=($link->type != "link") ? $direction : ""?></td>
<td><a href="<?=self::getUrl("Address", "View", ["id" => $linkcontract->owner_id])?>"><?=$linkcontract->owner->getCompanyOrName()?></a></td>
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["contract_id" => $linkcontract->id])?>"><?=$linkcontract->id?></a></td>
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["contract_id" => $linkcontract->id])?>"><?=$linkcontract->product_name?> [<?=$linkcontract->matchcode?>]</a></td>
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><?=($linkcontract->order_date) ? date('d.m.Y', $linkcontract->order_date) : ""?></td>
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><?=($linkcontract->finish_date) ? date('d.m.Y', $linkcontract->finish_date) : ""?></td>
<td class="contract <?=($linkcontract->isCancelled()) ? "canceled" : ""?>"><?=($linkcontract->cancel_date) ? date('d.m.Y', $linkcontract->cancel_date) : ""?></td>
<td>
<a href="<?=self::getUrl("Contract", "deleteLink", ["link_id" => $link->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; ?>
<?php endforeach; ?>
</table>
<?php endif; ?>