This commit is contained in:
salam committed 2026-08-02 08:52:59 +02:00
1 parent 301443d8c4
commit 8c34730c41
9 files changed
+534 -38

No files matched your search

+123
View File
@@ -0,0 +1,123 @@
<?php
namespace HermannTelser\Gutachten\Downloads\Nutzflaeche;
use HermannTelser\Gutachten\DB\DbFunction;
use HermannTelser\Gutachten\DB\Select\Select;
use HermannTelser\Gutachten\Utility\Helper;
class NutzwertBerechnungM5
{
/**
* @return array
*/
public static function berechnen()
{
// DbFunction::$debug = 1;
$res = DbFunction::select('tx_gutachten_orientierung', ['id', 'orientierung'], ['ORDER' => 'sortierung']);
$map = [];
foreach ($res as $field => $value) {
$map[$value['id']] = $value['orientierung'];
}
// $basis_stellplaetze = DbFunction::select('tx_gutachten_raume_all', 'tt_raume_basis_id', ['pid' => $projektid, 'raum' => ['Stellplatz+', 'Stellplatz']]);
$_objekte_all = DbFunction::select('tx_gutachten_raume_basis', '*', ['pid' => DbFunction::$projektid, 'noDispInOrientierung' => 1, 'ORDER' => 'topNr']);
foreach ($_objekte_all as $key => $value) {
$_objekte_all[$key]['orientierung'] = $map[$value['tt_orientierung_id']];
}
foreach ($_objekte_all as $key => $value) {
$_objekte_all[$key]['id'] = (int) $value['id'];
$_objekte_all[$key]['pid'] = (int) $value['pid'];
$_objekte_all[$key]['uid'] = (int) $value['uid'];
$_objekte_all[$key]['GNO'] = (int) $value['GNO'];
$_objekte_all[$key]['tt_orientierung_id'] = (int) $value['tt_orientierung_id'];
$_objekte_all[$key]['noDispInOrientierung'] = (int) $value['noDispInOrientierung'];
}
// print_r($_objekte_all);
// exit;
$html = '';
foreach ($_objekte_all as $key => $_objekte) {
$tt_raume_basis_id = $_objekte['id'];
// Notizen
// if ($value['notizen']!="") {
// $str = "|".$v['notizen'];
// $pdf->nwbTabelle($str, "13|13|120", 7);
// }
//if methode 5+ Zubehöhr in liste schreiben
$_raume = DbFunction::select('tx_gutachten_raume_all', '*',
[
'AND' => [
'tt_raume_basis_id' => $tt_raume_basis_id,
'tt_raumart_id' => [5, 6, 9]
],
'ORDER' => ['tt_raumart_id' => 'ASC']
]);
// if(86917 == $tt_raume_basis_id){
// print_r($_objekte);
// print_r($_raume);
// exit;
// }
if (\count($_raume) > 0) {
$html .= '<table class="pure-table nutzwert-neu" style="page-break-inside:avoid;">';
$html .= '<tr class="header-row">';
$html .= '<td style="border-left: 1px solid #cbcbcb;">Top&nbsp;Nr.</td>';
$html .= '<td>Geschoß</td>';
$html .= '<td>Orientierung</td>';
$html .= '<td>Typ</td>';
$html .= '<td></td>';
$html .= '<td>qm</td>';
$html .= '<td colspan="4"></td>';
$html .= '<td class="center">NW</td>';
$html .= '</tr>';
$zubehoer = 6 == $_raume[0]['tt_raumart_id'] ? 'Zubehör' : $_objekte['typ'];
// Methode 5
foreach ($_raume as $key => $value) {
if ($key > 0) {
$_objekte['topNr'] = '';
$value['geschoss'] = '';
$_objekte['orientierung'] = '';
$_objekte['typ'] = '';
}
$html .= '<tr>';
$html .= '<td class="first">'.$_objekte['topNr'].'</td>';
$html .= '<td>'.$value['geschoss'].'</td>';
$html .= '<td>'.$_objekte['orientierung'].'</td>';
$html .= '<td>'.$zubehoer.'</td>';
$html .= '<td>'.$value['raum'].'</td>';
$html .= '<td class="center">'.Helper::number_format_de($value['qm'], 2).'</td>';
$html .= '<td class="center">x</td>';
$html .= '<td class="center">'.Helper::number_format_de($value['factor'], 3).'</td>';
$html .= '<td class="center">=</td>';
$tmp = $value['qm'] * $value['factor'];
$html .= '<td class="center">'.Helper::number_format_de($tmp, 3).'</td>';
if (9 == $value['tt_raumart_id']) {
$html .= '<td class="center">'.round($value['NWungerundet']).'</td>';
} else {
$html .= '<td class="center">'.$value['NW'].'</td>';
}
$html .= '</tr>';
}
$html .= '<tr class="header-row">';
$html .= '<td class="abschluss-first" colspan="10">Nutzwert gerundet</td>';
$html .= '<td class="abschluss center">'.$_objekte['GNO'].'</td>';
$html .= '</tr>';
$html .= '</table>';
}
}
return $html;
}
}