$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 .= ''; $i = 1; foreach ($_row as $key => $value) { if (is_numeric($value)) { $value = Helper::number_format_de($value, 2); } if ($i > 3) { $html .= ''.$value.''; } else { $html .= ''.$value.''; } ++$i; } $html .= ''; } // SUMMEN $html .= ''; $html .= 'Summen'; $html .= ''.Helper::number_format_de($summe_nutzfache, 2).''; if($summe_loggien){ $html .= ''.Helper::number_format_de($summe_loggien, 2).''; }else { $html .= ' '; } $sum_total = $summe_nutzfache + $summe_loggien; $html .= ''.Helper::number_format_de($sum_total, 2).''; $html .= ''; return $html; } }