mwthoden
This commit is contained in:
1 parent
301443d8c4
commit
8c34730c41
9 files changed
+534
-38
No files matched your search
@@ -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,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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user