pdf nutzwerte wip

This commit is contained in:
salam committed 2025-11-10 15:41:59 +01:00
1 parent 054654fb9c
commit 53cdc0413e
7 files changed
+74 -21

No files matched your search

@@ -8,6 +8,7 @@ use App\Models\ProjektMerkmale;
use App\Models\ProjektMethode; use App\Models\ProjektMethode;
use App\Models\ProjektObjekte; use App\Models\ProjektObjekte;
use App\Models\ProjektObjekteImDetail; use App\Models\ProjektObjekteImDetail;
use DB;
class ZuUndAbschlaege class ZuUndAbschlaege
{ {
@@ -42,24 +43,57 @@ class ZuUndAbschlaege
foreach ($objekte as $objekt) { foreach ($objekte as $objekt) {
$detail = ProjektObjekteImDetail::where('projekt_objekte_id', $objekt->id)->get(); // $detail = ProjektObjekteImDetail::join('projekt_methodes', 'projekt_objekte_im_details.raumart', '=', 'projekt_methodes.name')
// ->where('projekt_methodes.projekte_id', $projekte_id)
// ->where('projekt_objekte_im_details.projekt_objekte_id', $objekt->id)
// ->get();
// dd($detail);
$detail = DB::table('projekt_objekte_im_details')
->join('projekt_methodes', 'projekt_objekte_im_details.raumart', '=', 'projekt_methodes.raumart')
->select(
'projekt_objekte_im_details.geschoss',
'projekt_objekte_im_details.raumart',
'projekt_objekte_im_details.faktor',
'projekt_objekte_im_details.flaeche',
'projekt_objekte_im_details.nutzwert',
)
->where('projekt_methodes.methode_id', 1)
->where('projekt_methodes.projekte_id', $projekte_id)
->where('projekt_objekte_im_details.projekt_objekte_id', $objekt->id)
->get();
$flaeche = $detail->sum('flaeche'); $flaeche = $detail->sum('flaeche');
$geschoss = $detail->first()->geschoss; $geschoss = $detail->first()->geschoss;
$html .= '<tr>'; $html .= '<tr>';
$html .= Html::td($objekt['top_nummer'], 'left bl br bb'); $html .= Html::td($objekt['top_nummer'], 'center bl br bb');
$html .= Html::td($geschoss, 'center br bb'); $html .= Html::td($geschoss, 'center br bb');
$html .= Html::td($objekt['type'], 'wp20 br bb'); $html .= Html::td($objekt['type'], 'wp20 br bb');
// Nutzfläache // Nutzfläache
$html .= Html::td(Format::dezimal($flaeche, 2).' m&sup2;', 'center br bb'); $html .= Html::td(Format::dezimal($flaeche, 2).' m&sup2;', 'center br bb w30');
// Loggia // Loggia
// $loggia = Raumalles::loggia($id); if ($has_loggien) {
// $gesnutzfl = $loggia + $objekt->qm_m1;
// $loggia = $loggia != 0 ? $loggia : ''; $loggien = DB::table('projekt_objekte_im_details')
// $html .= Html::td($loggia, 'right br bb'); ->join('projekt_methodes', 'projekt_objekte_im_details.raumart', '=', 'projekt_methodes.raumart')
// // Gesammtnutzfläche = Nutzfläache + Loggia ->select('projekt_objekte_im_details.flaeche')
// $html .= Html::td(Format::numeric($gesnutzfl, 2), 'right br bb'); ->where('projekt_methodes.methode_id', 2)
// dd($objekt); ->where('projekt_methodes.projekte_id', $projekte_id)
->where('projekt_objekte_im_details.projekt_objekte_id', $objekt->id)
->get();
$flaeche_loggien = $loggien->sum('flaeche');
if ($flaeche_loggien) {
$html .= Html::td($flaeche_loggien, 'right br bb');
} else {
$html .= Html::td('', 'br bb');
}
$gesammt = $flaeche + $flaeche_loggien;
$html .= Html::td(Format::dezimal($gesammt, 2).' m&sup2;', 'center br bb w30');
}
$nutwert = 0; $nutwert = 0;
foreach ($markmale_codes as $code) { foreach ($markmale_codes as $code) {
$nutwert += $objekt[$code]; $nutwert += $objekt[$code];
@@ -32,7 +32,7 @@ class Zusammenstellung
$nutzwert = $objektimdetail->sum('nutzwert'); $nutzwert = $objektimdetail->sum('nutzwert');
$tmp = ''; $tmp = 0;
$str = ''; $str = '';
if ($nutzwert > 0) { if ($nutzwert > 0) {
@@ -54,6 +54,7 @@ class Zusammenstellung
$html .= Html::td($prozent ?? '', 'center bb br'); $html .= Html::td($prozent ?? '', 'center bb br');
$html .= '</tr>'; $html .= '</tr>';
} }
$html .= '<tr>'; $html .= '<tr>';
$html .= Html::td('', 'head bl bb', 4); $html .= Html::td('', 'head bl bb', 4);
$html .= Html::td(array_sum($summe_nutzwert), 'head center bb'); $html .= Html::td(array_sum($summe_nutzwert), 'head center bb');
@@ -57,7 +57,7 @@ class ProjektObjekteImDetailRelationManager extends RelationManager
->columnSpan(2), ->columnSpan(2),
TextInput::make('flaeche') TextInput::make('flaeche')
->suffix(new HtmlString(' m&sup2;')) ->suffix(new HtmlString(' m&sup2;'))
->rules(['required', 'flaeche' => 'decimal:2']) ->rules(['required'])
->label('Fläche') ->label('Fläche')
->validationMessages([ ->validationMessages([
'required' => 'Die Eingabe einer Fläche ist erforderlich.', 'required' => 'Die Eingabe einer Fläche ist erforderlich.',
@@ -69,7 +69,6 @@ class ProjektObjekteImDetailRelationManager extends RelationManager
->columnSpan(2), ->columnSpan(2),
TextInput::make('faktor') TextInput::make('faktor')
->suffixIcon('phosphor-function') ->suffixIcon('phosphor-function')
->rules(['required', 'faktor' => 'decimal:0,2'])
->afterStateUpdated(function (Component $livewire) { ->afterStateUpdated(function (Component $livewire) {
$livewire->dispatch('refreshProjektObjekteImDetail'); $livewire->dispatch('refreshProjektObjekteImDetail');
})->validationMessages([ })->validationMessages([
@@ -97,10 +96,16 @@ class ProjektObjekteImDetailRelationManager extends RelationManager
->extraInputAttributes(['onClick' => 'this.select()']) ->extraInputAttributes(['onClick' => 'this.select()'])
->suffixIcon('phosphor-function') ->suffixIcon('phosphor-function')
->width('1rem') ->width('1rem')
->rules(['required', 'faktor' => 'decimal:0,2']) ->rules(['required'])
->searchable() ->searchable()
->afterStateUpdated(function (Component $livewire) { ->afterStateUpdated(function ($record, Component $livewire) {
$object = ProjektObjekteImDetail::find($record['id']);
$object->nutzwert = round($object->faktor * $object->flaeche, 2);
$object->save();
$livewire->dispatch('refreshProjektObjekteImDetail'); $livewire->dispatch('refreshProjektObjekteImDetail');
})->validationMessages([ })->validationMessages([
'required' => 'Die Eingabe eines Faktors ist erforderlich.', 'required' => 'Die Eingabe eines Faktors ist erforderlich.',
'decimal' => 'Für den Faktors sind zwei Dezimalstellen erforderlich.', 'decimal' => 'Für den Faktors sind zwei Dezimalstellen erforderlich.',
@@ -113,11 +118,17 @@ class ProjektObjekteImDetailRelationManager extends RelationManager
->suffix(new HtmlString(' m&sup2;')) ->suffix(new HtmlString(' m&sup2;'))
->width('2rem') ->width('2rem')
->alignment('right') ->alignment('right')
->rules(['required', 'flaeche' => 'decimal:2']) ->rules(['required'])
->label('Fläche') ->label('Fläche')
->searchable() ->searchable()
->afterStateUpdated(function (Component $livewire) { ->afterStateUpdated(function ($record, Component $livewire) {
$object = ProjektObjekteImDetail::find($record['id']);
$object->nutzwert = round($object->faktor * $object->flaeche, 2);
$object->save();
$livewire->dispatch('refreshProjektObjekteImDetail'); $livewire->dispatch('refreshProjektObjekteImDetail');
})->validationMessages([ })->validationMessages([
'required' => 'Die Eingabe einer Fläche ist erforderlich.', 'required' => 'Die Eingabe einer Fläche ist erforderlich.',
'decimal' => 'Für die Fläche sind zwei Dezimalstellen erforderlich.', 'decimal' => 'Für die Fläche sind zwei Dezimalstellen erforderlich.',
@@ -131,7 +142,7 @@ class ProjektObjekteImDetailRelationManager extends RelationManager
SelectFilter::make('top_nummer') SelectFilter::make('top_nummer')
->label('Top Nummer') ->label('Top Nummer')
->relationship('top_nummer', 'top_nummer', fn (Builder $query) => $query->where('projekte_id', $this->getOwnerRecord()->id)) ->relationship('top_nummer', 'top_nummer', fn (Builder $query) => $query->where('projekte_id', $this->getOwnerRecord()->id))
->searchable(), ->preload(),
SelectFilter::make('geschoss') SelectFilter::make('geschoss')
->preload() ->preload()
->options(function (): array { ->options(function (): array {
@@ -143,6 +154,7 @@ class ProjektObjekteImDetailRelationManager extends RelationManager
return ProjektObjekteImDetail::where('projekte_id', $this->getOwnerRecord()->id)->groupBy('raumart')->orderBy('raumart')->pluck('raumart', 'raumart')->toArray(); return ProjektObjekteImDetail::where('projekte_id', $this->getOwnerRecord()->id)->groupBy('raumart')->orderBy('raumart')->pluck('raumart', 'raumart')->toArray();
}), }),
]) ])
->deferFilters(false)
->headerActions([ ->headerActions([
CreateAction::make() CreateAction::make()
->icon('phosphor-file-plus') ->icon('phosphor-file-plus')
@@ -150,7 +162,8 @@ class ProjektObjekteImDetailRelationManager extends RelationManager
]) ])
->recordActions([ ->recordActions([
EditAction::make()->iconButton() EditAction::make()->iconButton()
->mutateDataUsing(function (array $data): array { ->mutateDataUsing(function ($data): array {
$data['nutzwert'] = round($data['faktor'] * $data['flaeche']); $data['nutzwert'] = round($data['faktor'] * $data['flaeche']);
return $data; return $data;
+3 -2
View File
@@ -14,7 +14,7 @@ class AuftraggeberSeeder extends Seeder
{ {
$sql = "INSERT INTO `auftraggebers` (`id`, `konto_id`, `title`, `gender`, `name`, `company`, `logo`, `email`, `phone`, `logo_align`, `referenz_formatting`, `logo_anzeigen`, `text_anzeigen`, `created_at`, `updated_at`) $sql = "INSERT INTO `auftraggebers` (`id`, `konto_id`, `title`, `gender`, `name`, `company`, `logo`, `email`, `phone`, `logo_align`, `referenz_formatting`, `logo_anzeigen`, `text_anzeigen`, `created_at`, `updated_at`)
VALUES VALUES
('1', '1', NULL, 'Herr', 'Moser Hans', 'NEUE HEIMAT TIROL', NULL, 'h.moser@gnh.at', '+43512547895', 'right', '{\"type\":\"doc\",\"content\":[{\"type\":\"heading\",\"attrs\":{\"textAlign\":\"start\",\"level\":3},\"content\":[{\"type\":\"text\",\"text\":\"NEUE HEIMAT TIROL\",\"marks\":[{\"type\":\"textColor\",\"attrs\":{\"data-color\":\"#fb2c36\"}}]}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":\"start\"},\"content\":[{\"type\":\"text\",\"text\":\"Gemeinnützige WohnungsGmbH\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":\"start\"},\"content\":[{\"type\":\"text\",\"text\":\"Gumppstraße 47 - 6020 Innsbruck\"}]}]}', '0', '1', NULL, '2025-10-21 04:21:21'), ('1', '1', NULL, 'Herr', 'Moser Hans', 'NEUE HEIMAT TIROL', NULL, 'h.moser@gnh.at', '+43512547895', 'right', '{\"type\":\"doc\",\"content\":[{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":\"start\"},\"content\":[{\"type\":\"text\",\"text\":\"NEUE HEIMAT TIROL\",\"marks\":[{\"type\":\"bold\"}]}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":\"start\"},\"content\":[{\"type\":\"text\",\"text\":\"Gemeinn\\u00fctzige WohnungsGmbH\"}]},{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":\"start\"},\"content\":[{\"type\":\"text\",\"text\":\"Gumppstra\\u00dfe 47 - 6020 Innsbruck\"}]}]}', '0', '1', NULL, '2025-11-10 12:06:15'),
('2', '1', NULL, 'Herr', 'Rudi Sommer', 'BauArt Immobilien GmbH', NULL, 'r.sommer@BauArtImmobilien.at', '+43512226688', 'right', 'BauArt Immobilien GmbH<br /> Maximilianstra&szlig;e 2 <br /> 6020 Innsbruck', '0', '0', NULL, '2025-10-17 10:07:53'), ('2', '1', NULL, 'Herr', 'Rudi Sommer', 'BauArt Immobilien GmbH', NULL, 'r.sommer@BauArtImmobilien.at', '+43512226688', 'right', 'BauArt Immobilien GmbH<br /> Maximilianstra&szlig;e 2 <br /> 6020 Innsbruck', '0', '0', NULL, '2025-10-17 10:07:53'),
('3', '1', NULL, 'Herr', 'Notar Schwarz', 'Ch. Stabel, H. Pechlaner, B. Augustin, S. Baumgartner', NULL, 'schwarz@notar.cc', '0512/59969-0', 'right', 'Christine Stabel, Omes 14, 6094 Axams<br /> Hansj&ouml;rg Pechlaner, Andreas Hofer-Strasse 18, 6020 Innsbruck<br /> Barbara Augustin, St. Georgs-Weg 8, 6020 Innsbruck<br /> Sabine Baumgartner, Hervicusgasse 4/4/10, 1120 Wien', '0', '0', NULL, NULL), ('3', '1', NULL, 'Herr', 'Notar Schwarz', 'Ch. Stabel, H. Pechlaner, B. Augustin, S. Baumgartner', NULL, 'schwarz@notar.cc', '0512/59969-0', 'right', 'Christine Stabel, Omes 14, 6094 Axams<br /> Hansj&ouml;rg Pechlaner, Andreas Hofer-Strasse 18, 6020 Innsbruck<br /> Barbara Augustin, St. Georgs-Weg 8, 6020 Innsbruck<br /> Sabine Baumgartner, Hervicusgasse 4/4/10, 1120 Wien', '0', '0', NULL, NULL),
('4', '1', NULL, 'Herr', 'Hr Atz', 'BUWOG', NULL, 'office@buwog.at', '++43 (0)1/878 28-0', 'right', 'BUWOG - Bauen und Wohnen Gesellschaft mbH<br /> Hietzinger Kai 131<br /> A-1130 Wien', '0', '0', NULL, NULL), ('4', '1', NULL, 'Herr', 'Hr Atz', 'BUWOG', NULL, 'office@buwog.at', '++43 (0)1/878 28-0', 'right', 'BUWOG - Bauen und Wohnen Gesellschaft mbH<br /> Hietzinger Kai 131<br /> A-1130 Wien', '0', '0', NULL, NULL),
@@ -52,7 +52,8 @@ class AuftraggeberSeeder extends Seeder
('36', '1', NULL, 'Herr', 'Peter Walde', 'Ing. Peter Walde', NULL, 'peter@walde.at', '0699 17282166', 'right', '', '0', '0', NULL, NULL), ('36', '1', NULL, 'Herr', 'Peter Walde', 'Ing. Peter Walde', NULL, 'peter@walde.at', '0699 17282166', 'right', '', '0', '0', NULL, NULL),
('37', '1', NULL, 'Herr', 'Ing. Sandra Peer', 'HYPO TIROL', NULL, 'sandra.peer@hypotirol.com', '', 'right', '<div>Hypo Tirol Bank AG</div><div>Meraner Straße 8</div><div>6020 Innsbruck</div>', '0', '0', NULL, NULL), ('37', '1', NULL, 'Herr', 'Ing. Sandra Peer', 'HYPO TIROL', NULL, 'sandra.peer@hypotirol.com', '', 'right', '<div>Hypo Tirol Bank AG</div><div>Meraner Straße 8</div><div>6020 Innsbruck</div>', '0', '0', NULL, NULL),
('38', '1', NULL, 'Herr', 'Hanno', 'Hanno Vogl-Fernheim', NULL, 'office@vogl-fernheim.eu', '0512/560303', 'right', '<div>Hanno Vogl-Fernheim</div><div>Richardsweg 1</div><div>6020 Innsbruck<br /></div>', '0', '0', NULL, NULL); ('38', '1', NULL, 'Herr', 'Hanno', 'Hanno Vogl-Fernheim', NULL, 'office@vogl-fernheim.eu', '0512/560303', 'right', '<div>Hanno Vogl-Fernheim</div><div>Richardsweg 1</div><div>6020 Innsbruck<br /></div>', '0', '0', NULL, NULL);
"; ";
DB::unprepared($sql); DB::unprepared($sql);
} }
} }
+4
View File
@@ -183,6 +183,10 @@ th {
padding: 5px 7px; padding: 5px 7px;
} }
.w30 {
width: 30mm;
}
.wp10 { .wp10 {
width: 10%; width: 10%;
} }
Binary file not shown.
Binary file not shown.