wip
This commit is contained in:
1 parent
30563ee98d
commit
622b37bb90
12 files changed
+56
-56
No files matched your search
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Generate\Tabellen;
|
||||
|
||||
use App\Actions\Generate\Utilities\Format;
|
||||
use App\Actions\Generate\Utilities\Html;
|
||||
use App\Models\ProjektMerkmale;
|
||||
use App\Models\ProjektMethode;
|
||||
use App\Models\ProjektObjekte;
|
||||
|
||||
class ZuUndAbschlaege
|
||||
{
|
||||
public static function load(int $projekte_id)
|
||||
{
|
||||
|
||||
$objekte = ProjektObjekte::select()
|
||||
->with('orientierung')
|
||||
->with('projektobjekteimdetail')
|
||||
->where('projekte_id', $projekte_id)
|
||||
->where('nicht_in_orientierung', 0)
|
||||
->get()
|
||||
->toArray();
|
||||
|
||||
$has_loggien = ProjektMethode::where('projekte_id', $projekte_id)->where('methode_id', 2)->count();
|
||||
|
||||
if ($has_loggien) {
|
||||
$header_row = ['Top Nummer', 'Geschoß', 'Typ', 'Nutzfläche', 'Loggia / Zusatzflächen', 'Gesamtnutzfläche'];
|
||||
} else {
|
||||
$header_row = ['Top Nummer', 'Geschoß', 'Typ', 'Nutzfläche'];
|
||||
}
|
||||
|
||||
$projekt_merkmale = ProjektMerkmale::where('projekte_id', $projekte_id)->pluck('name', 'code');
|
||||
|
||||
$markmale_codes = [];
|
||||
foreach ($projekt_merkmale as $key => $value) {
|
||||
$markmale_codes[] = $key;
|
||||
$header_row[] = $value;
|
||||
}
|
||||
$header_row[] = 'Summe ProjektMerkmale';
|
||||
$header_row[] = 'Wohnungsbewertung';
|
||||
|
||||
$html = '<table class="table-striped">';
|
||||
$html .= Html::table_header_90($header_row);
|
||||
|
||||
foreach ($objekte as $objekt) {
|
||||
|
||||
// dd($objekt);
|
||||
|
||||
$flaeche = 0;
|
||||
foreach ($objekt['projektobjekteimdetail'] as $key => $value) {
|
||||
$geschoss = $value['geschoss'];
|
||||
$flaeche += $value['flaeche'];
|
||||
}
|
||||
|
||||
// dd($markmale_codes);
|
||||
|
||||
$html .= '<tr>';
|
||||
$html .= Html::td($objekt['top_nummer'], 'left bl br bb');
|
||||
$html .= Html::td($geschoss, 'center br bb');
|
||||
$html .= Html::td($objekt['type'], 'wp20 br bb');
|
||||
// Nutzfläache
|
||||
$html .= Html::td(Format::dezimal($flaeche, 2).' m²', 'center br bb');
|
||||
// Loggia
|
||||
// $loggia = Raumalles::loggia($id);
|
||||
// $gesnutzfl = $loggia + $objekt->qm_m1;
|
||||
// $loggia = $loggia != 0 ? $loggia : '';
|
||||
// $html .= Html::td($loggia, 'right br bb');
|
||||
// // Gesammtnutzfläche = Nutzfläache + Loggia
|
||||
// $html .= Html::td(Format::numeric($gesnutzfl, 2), 'right br bb');
|
||||
// dd($objekt);
|
||||
foreach ($markmale_codes as $code) {
|
||||
$html .= Html::td($objekt[$code], 'center br bb');
|
||||
}
|
||||
$html .= Html::td(Format::dezimal($objekt['nutzwert'], 2), 'center br bb');
|
||||
$html .= Html::td(Format::dezimal(100 + $objekt['nutzwert'], 2), 'right br bb');
|
||||
$html .= '</tr>';
|
||||
}
|
||||
$html .= '</table>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user