Chore: Verschiebe Git-Repository in das Hauptverzeichnis und richte .gitignore ein
This commit is contained in:
commit
96d0545193
502 files changed
+176027
No files matched your search
@@ -0,0 +1,119 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,333 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Downloads\Nutzflaeche;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use HermannTelser\Gutachten\DB\Select\Select;
|
||||
use HermannTelser\Gutachten\Downloads\PdfNutzflaeche;
|
||||
use HermannTelser\Gutachten\Utility\Helper;
|
||||
|
||||
class NutzwertberechnungM1M4
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function berechnen()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
// OBSOLET
|
||||
// $_raum['NWm2'];
|
||||
|
||||
$exception = 364106;
|
||||
|
||||
|
||||
$join = [];
|
||||
$join['[>]tx_gutachten_orientierung']['tx_gutachten_raume_basis.tt_orientierung_id'] = 'id';
|
||||
|
||||
$fields = [];
|
||||
$fields[] = 'tx_gutachten_raume_basis.id';
|
||||
$fields[] = 'tx_gutachten_raume_basis.uid';
|
||||
$fields[] = 'tx_gutachten_raume_basis.topNr';
|
||||
$fields[] = 'tx_gutachten_raume_basis.typ';
|
||||
$fields[] = 'tx_gutachten_raume_basis.factor';
|
||||
$fields[] = 'tx_gutachten_raume_basis.GNO';
|
||||
$fields[] = 'tx_gutachten_raume_basis.qmM1';
|
||||
$fields[] = 'tx_gutachten_raume_basis.qmM1uM2bis';
|
||||
$fields[] = 'tx_gutachten_raume_basis.qmM1uM2';
|
||||
$fields[] = 'tx_gutachten_raume_basis.NWM1uM2';
|
||||
$fields[] = 'tx_gutachten_raume_basis.summe_az';
|
||||
$fields[] = 'tx_gutachten_raume_basis.bewertung';
|
||||
$fields[] = 'tx_gutachten_orientierung.orientierung';
|
||||
foreach (range('a', 'u') as $key => $feld) {
|
||||
$fields[] = 'tx_gutachten_raume_basis.'.$feld;
|
||||
}
|
||||
$where = [];
|
||||
$where['AND']['tx_gutachten_raume_basis.noDispInOrientierung'] = 0;
|
||||
$where['AND']['tx_gutachten_raume_basis.pid'] = DbFunction::$projektid;
|
||||
$where['ORDER']['tx_gutachten_raume_basis.topNr'] = 'ASC';
|
||||
// $where['LIMIT'] = 2;
|
||||
$_raeume_alle = DbFunction::selectJoin(
|
||||
'tx_gutachten_raume_basis',
|
||||
$join,
|
||||
$fields,
|
||||
$where
|
||||
);
|
||||
|
||||
// $part1 = [];
|
||||
// $part2 = [];
|
||||
// foreach ($_raeume_alle as $key => $_raum) {
|
||||
// if ('' != $_raum['typ']) {
|
||||
// $part1[] = $_raum;
|
||||
// } else {
|
||||
// $part2[] = $_raum;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// $topNr = array_column($part1, 'topNr');
|
||||
// array_multisort($topNr, SORT_ASC, $part1);
|
||||
//
|
||||
// $topNr = array_column($part2, 'topNr');
|
||||
// array_multisort($topNr, SORT_ASC, $part2);
|
||||
//
|
||||
// $_raeume_alle = array_merge($part1, $part2);
|
||||
|
||||
$html = '';
|
||||
foreach ($_raeume_alle as $key => $_objekte) {
|
||||
$tt_raume_basis_id = $_objekte['id'];
|
||||
|
||||
$_raume_m1 = Select::raume_all(DbFunction::$projektid, $tt_raume_basis_id, [1]);
|
||||
$_raume_m2 = Select::raume_all(DbFunction::$projektid, $tt_raume_basis_id, [2, 8]);
|
||||
$_raume_m3 = Select::raume_all(DbFunction::$projektid, $tt_raume_basis_id, [3, 7], $exception);
|
||||
|
||||
$pagebrake = \count($_raume_m1) + \count($_raume_m2) + \count($_raume_m3);
|
||||
|
||||
// Header
|
||||
if ($pagebrake > 45) {
|
||||
$html .= '<table class="pure-table nutzwert-neu">';
|
||||
} else {
|
||||
$html .= '<table class="pure-table nutzwert-neu" style="page-break-inside:avoid;">';
|
||||
}
|
||||
$html .= '<tr class="header-row">';
|
||||
$html .= '<td>Top Nr.</td>';
|
||||
$html .= '<td>Geschoß</td>';
|
||||
$html .= '<td>Orientierung</td>';
|
||||
$html .= '<td>Typ</td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td class="right">qm</td>';
|
||||
$html .= '<td colspan="6"></td>';
|
||||
$html .= '<td>NW</td>';
|
||||
$html .= '</tr>';
|
||||
|
||||
// if($tt_raume_basis_id == 86321){
|
||||
// print_r($_objekte);
|
||||
// exit;
|
||||
// }
|
||||
|
||||
// METHODE 1
|
||||
foreach ($_raume_m1 as $key => $_raum) {
|
||||
if ($key > 0) {
|
||||
$_objekte['topNr'] = '';
|
||||
$_raum['geschoss'] = '';
|
||||
$_objekte['orientierung'] = '';
|
||||
$_objekte['typ'] = '';
|
||||
} else {
|
||||
$_raum['geschoss'] = PdfNutzflaeche::$_objekte_geschosse[$tt_raume_basis_id];
|
||||
}
|
||||
|
||||
$html .= '<tr>';
|
||||
$html .= '<td class="first">'.$_objekte['topNr'].'</td>';
|
||||
$html .= '<td>'.$_raum['geschoss'].'</td>';
|
||||
$html .= '<td>'.$_objekte['orientierung'].'</td>';
|
||||
$html .= '<td>'.$_objekte['typ'].'</td>';
|
||||
$html .= '<td>'.$_raum['raum'].'</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($_raum['qm'], 2).'</td>';
|
||||
$html .= '<td colspan="7"></td>';
|
||||
$html .= '</tr>';
|
||||
}
|
||||
$NutzwertSummeGerundet = 0;
|
||||
|
||||
// METHODE 2 + 2b
|
||||
if (\count($_raume_m2) > 0) {
|
||||
// Methode 2 summen
|
||||
|
||||
// if($_objekte['id'] == 84964){
|
||||
// print_r($_objekte);
|
||||
// print_r($_raume_m2);
|
||||
// exit;
|
||||
// }
|
||||
|
||||
|
||||
$nw = $_objekte['qmM1'] * $_objekte['factor'];
|
||||
$html .= '<tr>';
|
||||
$html .= '<td class="first"></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($_objekte['qmM1'], 2).'</td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td class="center">x</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($_objekte['factor'], 3).'</td>';
|
||||
$html .= '<td>=</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($nw, 3).'</td>';
|
||||
$html .= '<td class="right">'.round($nw).'</td>';
|
||||
$html .= '</tr>';
|
||||
|
||||
$factorSumme = 0;
|
||||
// $zunutzwert = 0;
|
||||
foreach ($_raume_m2 as $key => $_raum) {
|
||||
$html .= '<tr>';
|
||||
$html .= '<td class="first"></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td>'.$_raum['raum'].'</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($_raum['qm'], 2).'</td>';
|
||||
$html .= '<td class="center">x</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($_raum['factor'], 3).'</td>';
|
||||
|
||||
if (2 == $_raum['tt_raumart_id']) {
|
||||
// Methode 2 (2)
|
||||
$html .= '<td class="center">x</td>';
|
||||
$html .= '<td>'.Helper::number_format_de($_objekte['factor'], 3).'</td>';
|
||||
$html .= '<td>=</td>';
|
||||
$factorSumme = $_raum['qm'] * $_raum['factor'] * $_objekte['factor'];
|
||||
$nw += $factorSumme;
|
||||
$html .= '<td class="right">'.Helper::number_format_de($factorSumme, 3).'</td>';
|
||||
} else {
|
||||
// Methode 2b (8) )
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td>=</td>';
|
||||
$factorSumme = $_raum['qm'] * $_raum['factor'];
|
||||
$nw += $factorSumme;
|
||||
$html .= '<td class="right">'.Helper::number_format_de($factorSumme, 3).'</td>';
|
||||
}
|
||||
$html .= '<td></td>';
|
||||
$html .= '</tr>';
|
||||
}
|
||||
$ungerundet = $nw;
|
||||
|
||||
$NutzwertSummeGerundet = round($ungerundet);
|
||||
|
||||
// if ($zunutzwert) {
|
||||
// $zunutzwert = $zunutzwert + $_objekte['qmM1'];
|
||||
$html .= '<tr>';
|
||||
$html .= '<td class="first"></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
// $html .= '<td>Gesamtnutzfläche</td>';
|
||||
// $html .= '<td class="right">'.Helper::number_format_de($zunutzwert, 2).'</td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($ungerundet, 3).'</td>';
|
||||
$html .= '<td class="right">'.$NutzwertSummeGerundet.'</td>';
|
||||
$html .= '</tr>';
|
||||
} else {
|
||||
// UNGERUNDETE CALCULATION
|
||||
$ungerundet = $_objekte['qmM1'] * $_objekte['factor'];
|
||||
$NutzwertSummeGerundet = round($ungerundet);
|
||||
|
||||
$html .= '<tr>';
|
||||
$html .= '<td class="first"></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($_objekte['qmM1'], 2).'</td>';
|
||||
$html .= '<td class="center">x</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($_objekte['factor'], 3).'</td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td class="center">=</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($ungerundet, 3).'</td>';
|
||||
$html .= '<td class="right">'.$NutzwertSummeGerundet.'</td>';
|
||||
$html .= '</tr>';
|
||||
}
|
||||
|
||||
/********************************************************
|
||||
METHODE 3 + 3b
|
||||
(wie Methode 3 aber ohne Wohnungsfactor)
|
||||
********************************************************/
|
||||
foreach ($_raume_m3 as $key => $_raum) {
|
||||
$html .= '<tr>';
|
||||
$html .= '<td class="first"></td>';
|
||||
$html .= '<td>'.$_raum['geschoss'].'</td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td>'.$_raum['raum'].'</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($_raum['qm'], 2).'</td>';
|
||||
|
||||
|
||||
if (3 == $_raum['tt_raumart_id']) { //Methode 3
|
||||
|
||||
$html .= '<td class="center">x</td>';
|
||||
$html .= '<td>'.Helper::number_format_de($_objekte['factor'], 3).'</td>';
|
||||
$html .= '<td class="center">x</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($_raum['factor'], 3).'</td>';
|
||||
$html .= '<td class="center">=</td>';
|
||||
|
||||
// $nw = $_raum['qm'] * $_raum['factor'] * $_objekte['factor'];
|
||||
$nw = $_raum['qm'] * $_raum['factor'] * $_objekte['factor'];
|
||||
$html .= '<td class="right">'.Helper::number_format_de($nw, 3).'</td>';
|
||||
$nw_gerundet = round($nw) < 1 ? 1 : round($nw);
|
||||
} else { //Methode 3b
|
||||
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td class="center">x</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($_raum['factor'], 3).'</td>';
|
||||
$html .= '<td class="center">=</td>';
|
||||
|
||||
$nw = $_raum['qm'] * $_raum['factor'];
|
||||
// $nw = $_raum['qm'] * $_raum['factor'];
|
||||
$html .= '<td class="right">'.Helper::number_format_de($nw, 3).'</td>';
|
||||
$nw_gerundet = round($nw) < 1 ? 1 : round($nw);
|
||||
}
|
||||
$html .= '<td class="right">'.round($nw_gerundet).'</td>';
|
||||
$html .= '</tr>';
|
||||
|
||||
$NutzwertSummeGerundet += $nw_gerundet;
|
||||
|
||||
// $html .= Helper::table_row(explode('|', $str));
|
||||
}
|
||||
|
||||
// METHODE 4
|
||||
$_raume = Select::raume_all(DbFunction::$projektid, $tt_raume_basis_id, 4, 0, $exception);
|
||||
|
||||
// if($tt_raume_basis_id == 82909){
|
||||
// print_r($_raume);
|
||||
// exit;
|
||||
// }
|
||||
|
||||
foreach ($_raume as $key => $_raum) {
|
||||
$nw = $_raum['qm'] * $_raum['factor'];
|
||||
$nw_gerundet = round($nw) < 1 ? 1 : round($nw);
|
||||
$NutzwertSummeGerundet += $nw_gerundet;
|
||||
|
||||
$html .= '<tr>';
|
||||
$html .= '<td class="first"></td>';
|
||||
$html .= '<td>'.$_raum['geschoss'].'</td>';
|
||||
$html .= '<td></td>';
|
||||
if($_raum['tt_raumart_id'] == 4){
|
||||
$html .= '<td>Zubehör</td>';
|
||||
}
|
||||
else{
|
||||
// exception type methode 7 and 4 anhängen, ist kein Zubehör
|
||||
$html .= '<td>*</td>';
|
||||
}
|
||||
|
||||
$html .= '<td>'.$_raum['raum'].'</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($_raum['qm'], 2).'</td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td class="center">x</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($_raum['factor'], 3).'</td>';
|
||||
$html .= '<td class="center">=</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($nw, 3).'</td>';
|
||||
$html .= '<td class="right">'.round($nw_gerundet).'</td>';
|
||||
$html .= '</tr>';
|
||||
}
|
||||
|
||||
// Nutzwert gerundet
|
||||
$html .= '<tr class="header-row">';
|
||||
$html .= '<td class="abschluss-first right" colspan="12">Nutzwert gerundet</td>';
|
||||
$html .= '<td class="abschluss right">'.$NutzwertSummeGerundet.'</td>';
|
||||
$html .= '</tr>';
|
||||
|
||||
$html .= '</table>';
|
||||
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_basis', ['GNO' => $NutzwertSummeGerundet], ['id' => $_objekte['id']]);
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
@@ -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 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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Downloads\Nutzflaeche;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
|
||||
class ObjectAufGeschossen
|
||||
{
|
||||
public static function load()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$_arr = DbFunction::select(
|
||||
'tx_gutachten_raume_all',
|
||||
['tt_raume_basis_id', 'geschoss'],
|
||||
[
|
||||
'AND' => ['pid' => DbFunction::$projektid, 'tt_raumart_id[!]' => 4],
|
||||
'GROUP' => ['tt_raume_basis_id', 'geschoss'],
|
||||
]
|
||||
);
|
||||
|
||||
$_objekte_geschosse = [];
|
||||
foreach ($_arr as $key => $value) {
|
||||
$basisid = $value['tt_raume_basis_id'];
|
||||
$geschoss = $value['geschoss'];
|
||||
$_objekte_geschosse[$basisid][] = $geschoss;
|
||||
}
|
||||
|
||||
foreach ($_objekte_geschosse as $key => $value) {
|
||||
$_objekte_geschosse[$key] = implode(',', $value);
|
||||
}
|
||||
|
||||
return $_objekte_geschosse;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Downloads\Nutzflaeche;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use HermannTelser\Gutachten\Downloads\PdfNutzflaeche;
|
||||
use HermannTelser\Gutachten\Utility\Helper;
|
||||
|
||||
class TabelleZuAbschlaege
|
||||
{
|
||||
/**
|
||||
* @param mixed $_projekt
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function load($_projekt)
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$projektid = $_projekt[0]['id'];
|
||||
|
||||
$header_row = ['Top', 'Geschoß', 'Typ', 'Nutzfläche'];
|
||||
$header_row[] = 0 != $_projekt[0]['loggia_title'] ? $_projekt[0]['loggia_title'] : 'Loggia / sonst. Zusatzflächen';
|
||||
$header_row[] = 'Gesamtnutzfläche';
|
||||
|
||||
$_column_titel = DbFunction::select(
|
||||
'tx_gutachten_help',
|
||||
['colid', 'coltitel'],
|
||||
['pid' => $projektid]
|
||||
);
|
||||
foreach ($_column_titel as $key => $value) {
|
||||
$header_row[] = $value['coltitel'];
|
||||
}
|
||||
$header_row[] = 'Summe A-Z';
|
||||
$header_row[] = 'Wohnungsbewertung';
|
||||
$html = Helper::table_header_row_r($header_row);
|
||||
|
||||
$_fields = [
|
||||
'tx_gutachten_raume_basis.id',
|
||||
'tx_gutachten_raume_basis.topNr',
|
||||
'tx_gutachten_raume_all.geschoss',
|
||||
'tx_gutachten_raume_basis.typ',
|
||||
'tx_gutachten_raume_basis.u(nutzflaeche)',
|
||||
'tx_gutachten_raume_basis.u(loggia)',
|
||||
'tx_gutachten_raume_basis.u(gesammtnutzflaeche)',
|
||||
];
|
||||
foreach ($_column_titel as $key => $value) {
|
||||
$_fields[] = 'tx_gutachten_raume_basis.'.$value['colid'];
|
||||
}
|
||||
$_fields[] = 'tx_gutachten_raume_basis.summe_az';
|
||||
$_fields[] = 'tx_gutachten_raume_basis.bewertung';
|
||||
|
||||
$_where = [];
|
||||
$_where['AND']['tx_gutachten_raume_basis.pid'] = $projektid;
|
||||
$_where['AND']['tx_gutachten_raume_basis.noDispInOrientierung'] = 0;
|
||||
$_where['AND']['tx_gutachten_raume_all.tt_raumart_id'] = 1;
|
||||
// $_where['AND']['tx_gutachten_raume_basis.typ[!]'] = '';
|
||||
$_where['GROUP'] = 'tx_gutachten_raume_basis.id';
|
||||
$_where['ORDER']['tx_gutachten_raume_basis.topNr'] = 'ASC';
|
||||
|
||||
$_raeume = DbFunction::selectJoin(
|
||||
'tx_gutachten_raume_basis',
|
||||
['[>]tx_gutachten_raume_all' => ['tx_gutachten_raume_basis.id' => 'tt_raume_basis_id']],
|
||||
$_fields,
|
||||
$_where
|
||||
);
|
||||
|
||||
|
||||
|
||||
// $part1 = [];
|
||||
// $part2 = [];
|
||||
// foreach ($_raeume as $key => $value) {
|
||||
// if($value['typ'] != '')
|
||||
// {
|
||||
// $part1[] = $value;
|
||||
//
|
||||
// }
|
||||
// else {
|
||||
// $part2[] = $value;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// $topNr = array_column($part1, 'topNr');
|
||||
// array_multisort($topNr, SORT_ASC, $part1);
|
||||
//
|
||||
// $topNr = array_column($part2, 'topNr');
|
||||
// array_multisort($topNr, SORT_ASC, $part2);
|
||||
|
||||
// $_raeume = array_merge($part1, $part2);
|
||||
|
||||
$summe_nutzfache = 0;
|
||||
$summe_loggien = 0;
|
||||
|
||||
foreach ($_raeume as $key => $value) {
|
||||
unset($_raeume[$key]['id']);
|
||||
|
||||
$tt_raume_basis_id = $value['id'];
|
||||
|
||||
$nutzflaeche = DbFunction::sum('tx_gutachten_raume_all', 'qm', ['AND' => ['tt_raumart_id' => 1, 'tt_raume_basis_id' => $tt_raume_basis_id]]);
|
||||
|
||||
$summe_nutzfache += $nutzflaeche;
|
||||
|
||||
$_raeume[$key]['nutzflaeche'] = Helper::number_format_de($nutzflaeche, 2);
|
||||
|
||||
$res = DbFunction::selectJoin(
|
||||
'tx_gutachten_raume_all',
|
||||
['[>]tx_gutachten_raume_generell' => 'tt_raumart_id'],
|
||||
'tx_gutachten_raume_all.qm',
|
||||
[
|
||||
'AND' => [
|
||||
'tx_gutachten_raume_all.pid' => $projektid,
|
||||
'tx_gutachten_raume_all.tt_raume_basis_id' => $tt_raume_basis_id,
|
||||
'tx_gutachten_raume_all.tt_raumart_id' => [2, 8],
|
||||
'tx_gutachten_raume_generell.zunutzwert' => 1,
|
||||
],
|
||||
'GROUP' => 'tx_gutachten_raume_all.id',
|
||||
]
|
||||
);
|
||||
$loggia = array_sum($res);
|
||||
$summe_loggien += $loggia;
|
||||
$_raeume[$key]['tt_raume_basis_id'] = $tt_raume_basis_id;
|
||||
$_raeume[$key]['loggia'] = round($loggia, 2);
|
||||
$sum = round($nutzflaeche + $loggia, 2);
|
||||
$_raeume[$key]['gesammtnutzflaeche'] = Helper::number_format_de($sum, 2);
|
||||
}
|
||||
|
||||
$_columns = range('a', 'u');
|
||||
$_columns[] = 'loggia';
|
||||
$_raeume = Helper::zero_to_null($_raeume, $_columns);
|
||||
|
||||
// print_r(PdfNutzflaeche::$_objekte_geschosse);
|
||||
//
|
||||
foreach ($_raeume as $key => $_row) {
|
||||
$basisid = $_row['tt_raume_basis_id'];
|
||||
|
||||
if (isset(PdfNutzflaeche::$_objekte_geschosse[$basisid])) {
|
||||
$_row['geschoss'] = PdfNutzflaeche::$_objekte_geschosse[$basisid];
|
||||
}
|
||||
unset($_row['tt_raume_basis_id']);
|
||||
|
||||
$html .= '<tr>';
|
||||
$i = 1;
|
||||
foreach ($_row as $key => $value) {
|
||||
if (is_numeric($value)) {
|
||||
$value = Helper::number_format_de($value, 2);
|
||||
}
|
||||
if ($i > 3) {
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;" class="right">'.$value.'</td>';
|
||||
} else {
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$value.'</td>';
|
||||
}
|
||||
++$i;
|
||||
}
|
||||
$html .= '</tr>';
|
||||
}
|
||||
|
||||
// SUMMEN
|
||||
$html .= '<tr>';
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;" colspan="3">Summen</td>';
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;" class="right">'.Helper::number_format_de($summe_nutzfache, 2).'</td>';
|
||||
if($summe_loggien){
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;" class="right">'.Helper::number_format_de($summe_loggien, 2).'</td>';
|
||||
}else {
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;"> </td>';
|
||||
}
|
||||
$sum_total = $summe_nutzfache + $summe_loggien;
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb; border-right: 0.1mm solid #cbcbcb;" class="right">'.Helper::number_format_de($sum_total, 2).'</td>';
|
||||
$html .= '</tr>';
|
||||
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user