96 lines
3.3 KiB
PHP
96 lines
3.3 KiB
PHP
<?php
|
|
$term_id = $order->terminations[0]->id;
|
|
$op = OrderProductModel::getFirst(['order_id' => $order->id, 'termination_id' => $term_id]);
|
|
|
|
if($order->finish_date) {
|
|
$billing_start = $order->finish_date;
|
|
} else {
|
|
$billing_start = date('U');
|
|
}
|
|
|
|
if($op->billing_delay) {
|
|
$billing_start = strtotime("+".$op->billing_delay." months");
|
|
}
|
|
|
|
|
|
|
|
$subject = "";
|
|
if($order->upgrade) {
|
|
$subject .= "[UPGRADE] ";
|
|
}
|
|
/*$subject .= $order->terminations[0]->building->network->name." - "
|
|
."Verr. ab ".date("m", $billing_start)."/".date("Y", $billing_start)." - "
|
|
.$order->owner->customer_number." - "
|
|
.str_replace("\n", "", str_replace("\r\n", " ", $order->owner->getCompanyOrName()));
|
|
*/
|
|
|
|
if(is_array($order->terminations) && count($order->terminations)) {
|
|
$subject .= $order->terminations[0]->building->network->name." - ";
|
|
}
|
|
|
|
$subject .= $order->owner->customer_number." - "
|
|
.str_replace("\n", "", str_replace("\r\n", " ", $order->owner->getCompanyOrName()));
|
|
|
|
$this->setReturnValue([
|
|
'subject' => $subject,
|
|
|
|
'from_email' => "workspace.admin@xinon.at",
|
|
'from_email_name' => "thetool"
|
|
]);
|
|
|
|
$nne_products = [];
|
|
?>
|
|
<?php if($order->upgrade): ?>
|
|
Achtung: UPGRADE
|
|
<?php endif; ?>
|
|
|
|
|
|
project: verrechnung
|
|
type: Verrechnung
|
|
status: Neu
|
|
priority: Standard
|
|
start date: <?=date("Y-m-01", $billing_start)?>
|
|
|
|
due date: <?=date("Y-m-01", $billing_start)?>
|
|
|
|
Kundennummer: <?=$order->owner->customer_number?>
|
|
|
|
Kundenname: <?=str_replace("\n", "", str_replace("\r\n", " ", $order->owner->getCompanyOrName()))?>
|
|
|
|
Telefon: <?=($order->owner->phone) ? $order->owner->phone : "null"?>
|
|
|
|
Netzgebiet: <?=$order->terminations[0]->building->network->name?>
|
|
|
|
Bauabschnitt: <?=(($order->terminations[0]->building->networksection_id) ? $order->terminations[0]->building->networksection->name : "<kein Bauabschnitt>")?>
|
|
|
|
Verrechungsstart: <?=date("m", $billing_start)?>/<?=date("Y", $billing_start)?>
|
|
|
|
|
|
### Rechnungspositionen
|
|
|
|
| Anzahl | Produktname | Verrechungsperiode | Preis periodisch | Preis Herstellung |
|
|
|--------|-------------|--------------------|-------------------|-------------------|
|
|
<?php foreach($order->products as $op): ?>
|
|
<?php if($op->price_nne > 0.0) $nne_products[] = $op; ?>
|
|
| <?=$op->amount?> | <?=$op->product->name?> | <?=($op->billing_period == 12) ? "Jährlich " : (($op->billing_period == 1) ? "Monatlich" : $op->billing_period."-monatlich")?> | EUR <?=$op->price?> | EUR <?=$op->price_setup?> |
|
|
<?php endforeach; ?>
|
|
|
|
<?php if(count($nne_products)): ?>
|
|
|
|
### Gutschriften
|
|
|
|
<?php if($order->terminations[0]->building->network->owner): ?>
|
|
Netzeigentümer: <?=$order->terminations[0]->building->network->owner->getCompanyOrName()?>
|
|
|
|
<?php endif; ?>
|
|
|
|
| Anzahl | Produktname | Verrechungsperiode | Bauabschnitt | NNE |
|
|
|--------|-------------|--------------------|--------------|-----|
|
|
<?php foreach($nne_products as $op): ?>
|
|
<?=$op->amount?> | <?=$op->product->name?> | <?=($op->billing_period == 12) ? "Jährlich " : (($op->billing_period == 1) ? "Monatlich" : $op->billing_period."-monatlich")?> | <?=($op->termination->building->networksection_id) ? $op->termination->building->networksection->name : "<Kein Bauabschnitt>"?> | EUR <?=$op->price_nne?> |
|
|
<?php endforeach; ?>
|
|
|
|
<?php endif; // (count($nne_products))?>
|
|
|
|
|