75 lines
3.1 KiB
PHP
75 lines
3.1 KiB
PHP
<?php
|
|
|
|
namespace HermannTelser\Gutachten\Berechnungen;
|
|
|
|
use HermannTelser\Gutachten\DB\DbFunction;
|
|
use HermannTelser\Gutachten\Utility\Message;
|
|
|
|
/***
|
|
*
|
|
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
|
*
|
|
* For the full copyright and license information, please read the
|
|
* LICENSE.txt file that was distributed with this source code.
|
|
*
|
|
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>
|
|
*
|
|
***/
|
|
|
|
class OhneOrientierung
|
|
{
|
|
/**
|
|
* @param mixed $tt_raume_basis_id
|
|
* @param mixed $factor
|
|
*
|
|
* @return false
|
|
*/
|
|
public static function berechne($tt_raume_basis_id)
|
|
{
|
|
// DbFunction::$debug = 1;
|
|
|
|
// METHODEN 5 (5), 5a (6), 5b (9)
|
|
|
|
if (DbFunction::$debug) {
|
|
Message::note('OHNE Orientierung');
|
|
}
|
|
|
|
if (0 == DbFunction::$projektid) {
|
|
die('No Projekt Id');
|
|
}
|
|
|
|
// METHODE 5
|
|
$res = DbFunction::select('tx_gutachten_raume_all', ['id', 'qm', 'factor', 'tt_raumart_id'], ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => 5]]);
|
|
foreach ($res as $key => $value) {
|
|
$nw = round($value['qm'] * $value['factor']);
|
|
|
|
DbFunction::secureUpdate('tx_gutachten_raume_all', ['NW' => $nw], ['id' => $value['id']]);
|
|
}
|
|
|
|
|
|
// METHODE 5a
|
|
$res = DbFunction::select('tx_gutachten_raume_all', ['qm', 'factor', 'tt_raumart_id'], ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => 6]]);
|
|
foreach ($res as $key => $value) {
|
|
$nw = round($value['qm'] * $value['factor']);
|
|
DbFunction::secureUpdate('tx_gutachten_raume_all', ['NW' => $nw], ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => 6]]);
|
|
}
|
|
|
|
// METHODE 5b
|
|
$res = DbFunction::select('tx_gutachten_raume_all', ['qm', 'factor', 'tt_raumart_id'], ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => 9]]);
|
|
foreach ($res as $key => $value) {
|
|
$nw = $value['qm'] * $value['factor'];
|
|
DbFunction::secureUpdate('tx_gutachten_raume_all', ['NWungerundet' => $nw], ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => 9]]);
|
|
}
|
|
|
|
DbFunction::secureUpdate('tx_gutachten_raume_basis', ['NW' => 1], ['AND' => ['NW' => 0, 'id' => $tt_raume_basis_id, 'tt_raumart_id' => [5, 6, 9]]]);
|
|
//
|
|
$t1 = DbFunction::sum('tx_gutachten_raume_all', 'NW', ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => [5, 6]]]);
|
|
$t2 = DbFunction::sum('tx_gutachten_raume_all', 'NWungerundet', ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => 9]]);
|
|
$NWM5 = round($t1 + $t2);
|
|
DbFunction::secureUpdate('tx_gutachten_raume_basis', ['GNO' => $NWM5], ['id' => $tt_raume_basis_id]);
|
|
|
|
// $qmM5 = DbFunction::sum('tx_gutachten_raume_all', 'qm', ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => [5, 6, 9]]]);
|
|
// DbFunction::secureUpdate('tx_gutachten_raume_basis', ['qmM5' => $qmM5], ['tt_raume_basis_id' => $tt_raume_basis_id]);
|
|
}
|
|
}
|