52 lines
2.9 KiB
PHP
52 lines
2.9 KiB
PHP
<?php
|
|
$term_id = $order->terminations[0]->id;
|
|
$op = OrderProductModel::getFirst(['order_id' => $order->id, 'termination_id' => $term_id]);
|
|
|
|
$billing_start = date('U');
|
|
if($op->billing_delay) {
|
|
$billing_start = strtotime("+".$op->billing_delay." months");
|
|
}
|
|
//var_dump($order->terminations[0]->building);exit;
|
|
$this->setReturnValue([
|
|
'subject' => $order->terminations[0]->building->network->name." - "
|
|
.(($order->terminations[0]->building->networksection_id) ? $order->terminations[0]->building->networksection->name : "<kein Bauabschnitt>")." - "
|
|
."Verrechnung ab ".date("m", $billing_start)."/".date("Y", $billing_start)." - "
|
|
.$order->owner->customer_number." - "
|
|
.str_replace("\n", "", str_replace("\r\n", " ", $order->owner->getCompanyOrName()))." - ",
|
|
|
|
'from_email' => TT_OUTGOING_EMAIL,
|
|
'from_email_name' => TT_OUTGOING_EMAIL_NAME
|
|
]);
|
|
|
|
$nne_products = [];
|
|
?>
|
|
|
|
Rechnungspositionen
|
|
====================
|
|
|
|
Anzahl | Produktname | Verrechungsperiode | Preis periodisch | Preis Herstellung
|
|
-----------------------------------------------------------------------------------------------------------------------
|
|
<?php foreach($order->products as $op): ?>
|
|
<?php if($op->product->price_nne > 0.0) $nne_products[] = $op; ?>
|
|
<?=sprintf("%-12s", substr($op->amount,0,12))?> | <?=utf8_encode(sprintf("%-42s", utf8_decode(substr($op->product->name,0,42))))?> | <?=utf8_encode(sprintf("%-18s", utf8_decode(($op->billing_period == 12) ? "Jährlich " : (($op->billing_period == 1) ? "Monatlich" : $op->billing_period."-monatlich")) ))?> | <?=sprintf("EUR %-12s", substr($op->price,0,12))?> | EUR <?=$op->price_setup?>
|
|
|
|
-----------------------------------------------------------------------------------------------------------------------
|
|
<?php endforeach; ?>
|
|
|
|
<?php if(count($nne_products)): ?>
|
|
|
|
Gutschriften
|
|
=============
|
|
|
|
Anzahl | Produktname | Verrechungsperiode | Bauabschnitt | NNE
|
|
-----------------------------------------------------------------------------------------------------------------------
|
|
<?php foreach($nne_products as $op): ?>
|
|
<?=sprintf("%-12s", substr($op->amount,0,12))?> | <?=utf8_encode(sprintf("%-42s", utf8_decode(substr($op->product->name,0,42))))?> | <?=utf8_encode(sprintf("%-18s", utf8_decode(($op->billing_period == 12) ? "Jährlich " : (($op->billing_period == 1) ? "Monatlich" : $op->billing_period."-monatlich")) ))?> | <?=sprintf("%-24s", substr(($op->termination->building->networksection_id) ? $op->termination->building->networksection->name : "<Kein Bauabschnitt>",0,24))?> | EUR <?=$op->price_nne?>
|
|
|
|
-----------------------------------------------------------------------------------------------------------------------
|
|
<?php endforeach; ?>
|
|
|
|
<?php endif; // (count($nne_products))?>
|
|
|
|
|