wip zuabschlaege pdf

This commit is contained in:
salam committed 2025-10-28 13:40:01 +01:00
1 parent 88d561675d
commit 7917777b93
23 files changed
+510 -604

No files matched your search

@@ -2,72 +2,70 @@
namespace App\Actions\Generate\Nutzwerte;
use App\Actions\Generate\Utilities\Format;
use App\Actions\Generate\Utilities\Html;
use App\Models\Merkmale;
use App\Models\ProjektObjekte;
use App\Models\Raumalles;
use App\Models\Raumorientierung;
use App\Utilities\Format;
use App\Utilities\Html;
class ZuUndAbschlaege
{
public static function load(int $projekte_id)
{
$orientierungen = ProjektObjekte::select()
$objekte = ProjektObjekte::select()
->with('orientierung')
->with('projektobjekteimdetail')
->where('projekte_id', $projekte_id)
->where('nicht_in_orientierung', 0)
->get();
foreach ($orientierungen as $orientierung) {
dd($orientierung);
}
$header_row = ['Top Nummer', 'Geschoß', 'Typ', 'Nutzfläche', 'Loggia / sonst. Zusatzflächen', 'Gesamtnutzfläche'];
// $total = Invoice::where('status', 'Completed')->sum('amount');
$merkmale = Merkmale::where('projekte_id', $projekte_id)->pluck('name', 'code');
$header_row = ['Top', 'Geschoß', 'Typ', 'Nutzfläche', 'Loggia / sonst. Zusatzflächen', 'Gesamtnutzfläche'];
$merkmale = Merkmale::merkmale($projekte_id);
$markmale_col = [];
foreach ($merkmale as $value) {
$markmale_col[] = $value['col'];
$header_row[] = $value['name'];
$markmale_codes = [];
foreach ($merkmale as $key => $value) {
$markmale_codes[] = $key;
$header_row[] = $value;
}
$header_row[] = 'Summe Merkmale';
$header_row[] = 'Wohnungsbewertung';
$html = Html::table_header_90($header_row);
$res = Raumalles::select('raumorientierung_id', 'geschoss')->where('projekte_id', $projekte_id)->where('methodes_id', 1)->get();
$geschoss = [];
foreach ($res as $value) {
$id = $value->raumorientierung_id;
$geschoss[$id] = $value['geschoss'];
}
$html = '<table class="table-striped">';
$html .= Html::table_header_90($header_row);
$res = Raumorientierung::select()->where('projekte_id', $projekte_id)->where('nicht_in_orientierung', 0)->whereNotNull('top_nr')->orderBy('top_nr')->get();
foreach ($res as $value) {
$id = $value->id;
$html .= '<tr>';
$html .= Html::td($value->top_nr, 'left bl br bb');
$html .= Html::td($geschoss[$value['id']], 'center br bb');
$html .= Html::td($value->type, 'wp20 br bb');
// Nutzfläache
$html .= Html::td(Format::numeric($value->qm_m1, 2), 'right br bb');
// Loggia
$loggia = Raumalles::loggia($id);
$gesnutzfl = $loggia + $value->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');
foreach ($markmale_col as $col) {
$tmp = (float) $value[$col] != 0 ? $value[$col] : '';
$html .= Html::td(Format::numeric($tmp, 2), 'right br bb');
foreach ($objekte as $objekt) {
// dd($objekt);
$flaeche = 0;
foreach ($objekt->projektobjekteimdetail as $key => $value) {
$geschoss = $value['geschoss'];
$flaeche += $value['flaeche'];
}
$html .= Html::td(Format::numeric($value->summe_az, 2), 'right br bb');
$html .= Html::td(Format::numeric($value->bewertung, 2), 'right br bb');
$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), 'right 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');
// foreach ($markmale_codes as $code) {
// $tmp = (float) $objekt[$code] != 0 ? $objekt[$code] : '';
// $html .= Html::td(Format::numeric($tmp, 2), 'right br bb');
// }
// $html .= Html::td(Format::numeric($objekt->summe_az, 2), 'right br bb');
// $html .= Html::td(Format::numeric($objekt->bewertung, 2), 'right br bb');
$html .= '</tr>';
}
$html .= '</table>';
return $html;
}