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,97 @@
|
||||
<?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 MitOrientierung
|
||||
{
|
||||
/**
|
||||
* @param mixed $tt_raume_basis_id
|
||||
* @param mixed $rfM1
|
||||
*
|
||||
* @return false
|
||||
*/
|
||||
public static function berechne($tt_raume_basis_id, $rfM1)
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
// METHODEN 1, 2, 2b , 3, 3b, 4
|
||||
|
||||
if (DbFunction::$debug) {
|
||||
Message::note('MIT Orientierung');
|
||||
}
|
||||
|
||||
// METHODE 2 & 2b
|
||||
// Summe
|
||||
$qmM1bis = DbFunction::sum('tx_gutachten_raume_all', 'qm', ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => [2, 8]]]);
|
||||
|
||||
//# METHODE 1 ###
|
||||
$qmM1 = DbFunction::sum('tx_gutachten_raume_all', 'qm', ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => 1]]);
|
||||
$result = $qmM1 + $qmM1bis;
|
||||
if ($result) {
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_basis', ['qmM1uM2bis' => $result, 'qmM1' => $qmM1], ['id' => $tt_raume_basis_id]);
|
||||
}
|
||||
|
||||
// METHODE 2
|
||||
$res = DbFunction::select('tx_gutachten_raume_all', ['qm', 'factor'], ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => [2, 8]]]);
|
||||
foreach ($res as $key => $value) {
|
||||
$nw = round($value['qm'] * $value['factor']);
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_all', ['NWm2' => $nw], ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => [2, 8]]]);
|
||||
}
|
||||
|
||||
// FINAL METHODE 1 & METHODE 2
|
||||
$NWm2 = DbFunction::sum('tx_gutachten_raume_all', 'NWm2', ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => 2]]);
|
||||
$NWm2b = DbFunction::sum('tx_gutachten_raume_all', 'NWm2', ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => 8]]);
|
||||
$qmM1uM2 = $qmM1 + $NWm2;
|
||||
$NWM1uM2 = round(($qmM1uM2 * $rfM1) + $NWm2b);
|
||||
if ($NWM1uM2) {
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_basis', ['NWM1uM2' => $NWM1uM2, 'qmM1uM2' => $qmM1uM2], ['id' => $tt_raume_basis_id]);
|
||||
}
|
||||
|
||||
// METHODE 3 & 3b
|
||||
$res = DbFunction::select('tx_gutachten_raume_all', ['qm', 'factor', 'tt_raumart_id'], ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => [3, 7]]]);
|
||||
foreach ($res as $key => $value) {
|
||||
if (3 == $value['tt_raumart_id']) {
|
||||
$nw = round($value['qm'] * $value['factor'] * $rfM1);
|
||||
$this_tt_raumart_id = 3;
|
||||
} else { // M3b ohne Wohnungsfactor
|
||||
$nw = round($value['qm'] * $value['factor']);
|
||||
$this_tt_raumart_id = 7;
|
||||
}
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_all', ['NW' => $nw], ['AND' => ['id' => $tt_raume_basis_id, 'tt_raumart_id' => $this_tt_raumart_id]]);
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_all', ['NW' => 1], ['AND' => ['NW' => 1, 'id' => $tt_raume_basis_id, 'tt_raumart_id' => $this_tt_raumart_id]]);
|
||||
}
|
||||
|
||||
// METHODE 4
|
||||
$res = DbFunction::select('tx_gutachten_raume_all', ['qm', 'factor'], ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => 4]]);
|
||||
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' => 4]]);
|
||||
}
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_all', ['NW' => 1], ['AND' => ['NW' => 0, 'tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => 4]]);
|
||||
|
||||
//## GNO ###
|
||||
$NWM3uM4 = DbFunction::sum('tx_gutachten_raume_all', 'nw', ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => [3, 4]]]);
|
||||
$GNO = round($NWM1uM2 + $NWM3uM4);
|
||||
if ($GNO) {
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_basis', ['GNO' => $GNO], ['id' => $tt_raume_basis_id]);
|
||||
}
|
||||
|
||||
if (DbFunction::$debug) {
|
||||
Message::note('GNO: ' . $GNO);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user