120 lines
5.2 KiB
PHP
120 lines
5.2 KiB
PHP
<?php
|
|
|
|
namespace HermannTelser\Gutachten\Downloads\Nutzflaeche;
|
|
|
|
use HermannTelser\Gutachten\DB\DbFunction;
|
|
use HermannTelser\Gutachten\DB\Select\ObjektProjektByMethode;
|
|
use HermannTelser\Gutachten\Utility\Helper;
|
|
use HermannTelser\Gutachten\Downloads\PdfNutzflaeche;
|
|
|
|
class NutzflaecheZusammenstellung
|
|
{
|
|
/**
|
|
* @param mixed $_projekt
|
|
* @param mixed DbFunction::$projektid
|
|
*
|
|
* @return array
|
|
*/
|
|
public static function load($_projekt) :string
|
|
{
|
|
// ZUSAMMENSTELLUNG
|
|
|
|
// DbFunction::$debug = 1;
|
|
|
|
$_objekte_all = ObjektProjektByMethode::select(1);
|
|
|
|
$summeNW = DbFunction::sum('tx_gutachten_raume_basis', 'GNO', ['pid' => DbFunction::$projektid]);
|
|
|
|
// print_r($_objekte_all);
|
|
// exit;
|
|
|
|
$countProzent = [];
|
|
$countNW = [];
|
|
|
|
// $html = '<table class="pure-table nutzwert" style="page-break-inside:avoid;">';
|
|
$html = '<table class="pure-table pure-table-striped nutzwert-neu">';
|
|
$html .= '<thead><tr class="header-row">';
|
|
$html .= '<th style="border-bottom: 0.1mm solid #cbcbcb;">Top</th>';
|
|
$html .= '<th style="border-bottom: 0.1mm solid #cbcbcb;">Geschoß</th>';
|
|
$html .= '<th style="border-bottom: 0.1mm solid #cbcbcb;">Orientierung</th>';
|
|
$html .= '<th style="border-bottom: 0.1mm solid #cbcbcb;">Typ</th>';
|
|
$html .= '<th style="border-bottom: 0.1mm solid #cbcbcb;">NW</th>';
|
|
$html .= '<th style="border-bottom: 0.1mm solid #cbcbcb;">x2 *</th>';
|
|
$html .= '<th style="border-bottom: 0.1mm solid #cbcbcb;">%</th>';
|
|
$html .= '</tr></thead>';
|
|
|
|
// $html .= Helper::table_header_row(explode('|', 'Top|Geschoß|Orientierung|Typ|NW|x2*|%'));
|
|
|
|
foreach ($_objekte_all as $key => $row) {
|
|
if ($summeNW > 0) {
|
|
$row['GNO2'] = $row['GNO'] * 2 .' / '.$summeNW * 2 .' tel Anteil =';
|
|
$tmp = ($row['GNO'] * 2) / ($summeNW * 2) * 100;
|
|
$row['prozent'] = Helper::number_format_de($tmp, 3).'%';
|
|
} else {
|
|
$row['GNO2'] = '';
|
|
$row['prozent'] = '';
|
|
}
|
|
$countProzent[] = $tmp;
|
|
$countNW[] = $row['GNO'];
|
|
|
|
$row['geschoss'] = PdfNutzflaeche::$_objekte_geschosse[$row['id']];
|
|
|
|
$html .= '<tr>';
|
|
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$row['topNr'].'</td>';
|
|
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$row['geschoss'].'</td>';
|
|
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$row['orientierung'].'</td>';
|
|
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$row['typ'].'</td>';
|
|
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;" class="right">'.$row['GNO'].'</td>';
|
|
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb; text-align:center;">'.$row['GNO2'].'</td>';
|
|
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$row['prozent'].'</td>';
|
|
$html .= '</tr>';
|
|
}
|
|
|
|
$_objekte_all = ObjektProjektByMethode::select([5, 9]);
|
|
|
|
foreach ($_objekte_all as $key => $row) {
|
|
$row['GNO2'] = $row['GNO'] * 2 .' / '.$summeNW * 2 .' tel Anteil =';
|
|
|
|
$tmp = ($row['GNO'] * 2) / ($summeNW * 2) * 100;
|
|
$row['prozent'] = Helper::number_format_de($tmp, 3).'%';
|
|
$countProzent[] = $tmp;
|
|
$countNW[] = $row['GNO'];
|
|
|
|
$html .= '<tr>';
|
|
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$row['topNr'].'</td>';
|
|
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$row['geschoss'].'</td>';
|
|
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$row['orientierung'].'</td>';
|
|
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$row['typ'].'</td>';
|
|
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;" class="right">'.$row['GNO'].'</td>';
|
|
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb; text-align:center;">'.$row['GNO2'].'</td>';
|
|
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$row['prozent'].'</td>';
|
|
$html .= '</tr>';
|
|
}
|
|
|
|
$str = '||||'.array_sum($countNW).'|'.$summeNW * 2 .' / '.$summeNW * 2 .' tel Anteil =|'.round(array_sum($countProzent)).'%';
|
|
$html .= Helper::table_row_abschluss(explode('|', $str));
|
|
$html .= '</table>';
|
|
|
|
$html .= '<p class="size07">* Die Anteile wurden verdoppelt, sodaß die Mindestanteile jederzeit durch zwei geteilt werden können.</p>';
|
|
|
|
// $_gutachter = DbFunction::select(
|
|
// 'tx_gutachten_gutachter',
|
|
// '*',
|
|
// ['id' => $_projekt[0]['gutachter_id']]
|
|
// );
|
|
|
|
// $html .= '<br><br><br><br><br><br><br><table class="nutzwert-neu">';
|
|
// $html .= '<tr>';
|
|
// $html .= '<td>'.$_projekt[0]['erstellung'].'</td>';
|
|
// if (!\count($_gutachter)) {
|
|
// $html .= '<td class="right">Gutacher Fehlt</td>';
|
|
// } else {
|
|
// $html .= '<td class="right">'.$_gutachter[0]['kopf'].'</td>';
|
|
// }
|
|
// $html .= '</tr>';
|
|
// $html .= '</table>';
|
|
|
|
return $html;
|
|
}
|
|
}
|