wip zusammmenstellung
This commit is contained in:
1 parent
f0e1e801c0
commit
2f6ae7e4a1
9 files changed
+163
-118
No files matched your search
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Generate\Tabellen;
|
||||
|
||||
use App\Actions\Generate\Utilities\Format;
|
||||
use App\Actions\Generate\Utilities\Html;
|
||||
use App\Models\ProjektObjekte;
|
||||
use App\Models\ProjektObjekteImDetail;
|
||||
|
||||
class Zusammenstellung
|
||||
{
|
||||
public static function load(int $projekte_id)
|
||||
{
|
||||
|
||||
$summe_prozent = [];
|
||||
$summe_nutzwert = [];
|
||||
|
||||
$html = Html::table_header(['Top', 'Geschoß', 'Orientierung', 'Typ', 'Nutzwert', 'x2 *', '%']);
|
||||
|
||||
$nutzwert_gesammt = ProjektObjekteImDetail::where('projekte_id', $projekte_id)->sum('nutzwert');
|
||||
|
||||
$objekte = ProjektObjekte::select()
|
||||
->with('orientierung')
|
||||
->where('projekte_id', $projekte_id)
|
||||
->orderBy('nicht_in_orientierung', 'ASC')
|
||||
->orderBy('top_nummer', 'ASC')
|
||||
->get();
|
||||
|
||||
foreach ($objekte as $objekt) {
|
||||
|
||||
$objektimdetail = ProjektObjekteImDetail::where('projekt_objekte_id', $objekt->id)->get();
|
||||
|
||||
$nutzwert = $objektimdetail->sum('nutzwert');
|
||||
|
||||
$tmp = '';
|
||||
$str = '';
|
||||
if ($nutzwert > 0) {
|
||||
|
||||
$str = $nutzwert * 2 .' / '.$nutzwert_gesammt * 2 .' tel Anteil =';
|
||||
|
||||
$tmp = ($nutzwert * 2) / ($nutzwert_gesammt * 2) * 100;
|
||||
$prozent = Format::dezimal($tmp, 3).'%';
|
||||
}
|
||||
$summe_prozent[] = $tmp;
|
||||
$summe_nutzwert[] = $nutzwert;
|
||||
|
||||
$html .= '<tr>';
|
||||
$html .= Html::td($objekt->top_nummer, 'bl bb br');
|
||||
$html .= Html::td($objekt->projektobjekteimdetail?->geschoss, 'center br bb');
|
||||
$html .= Html::td($objekt->orientierung?->name, 'center br bb');
|
||||
$html .= Html::td($objekt?->type, 'center br bb');
|
||||
$html .= Html::td(round($nutzwert), 'center bb br');
|
||||
$html .= Html::td($str, 'center bb br');
|
||||
$html .= Html::td($prozent ?? '', 'center bb br');
|
||||
$html .= '</tr>';
|
||||
}
|
||||
$html .= '<tr>';
|
||||
$html .= Html::td('', 'head bl bb', 4);
|
||||
$html .= Html::td(array_sum($summe_nutzwert), 'head center bb');
|
||||
$html .= Html::td(array_sum($summe_nutzwert) * 2 .'/'.round($nutzwert_gesammt) * 2 .' tel Anteil =', 'head center bb');
|
||||
$html .= Html::td(round(array_sum($summe_prozent)).'%', 'head center bb br');
|
||||
$html .= '</tr>';
|
||||
$html .= '<tr style="background-color: #fff !important;">';
|
||||
$html .= Html::td('* Die Anteile wurden verdoppelt, sodaß die Mindestanteile jederzeit durch zwei geteilt werden können.', 'right small', 7, 'background-color: #fff !important;');
|
||||
$html .= '</tr>';
|
||||
|
||||
$html .= '</table>';
|
||||
// $html .= '<p class="small">* Die Anteile wurden verdoppelt, sodaß die Mindestanteile jederzeit durch zwei geteilt werden können.';
|
||||
|
||||
return $html;
|
||||
|
||||
// $_obj = Zusammenstellung_Methode5::load($projekte_id);
|
||||
|
||||
// foreach ($_obj as $row) {
|
||||
// $row['nutzwert_summe2'] = $row['nutzwert_summe'] * 2 .' / '.$nutzwert_summe * 2 .' tel Anteil =';
|
||||
// $tmp = ($row['nutzwert_summe'] * 2) / ($nutzwert_summe * 2) * 100;
|
||||
// $row['prozent'] = Format::numeric($tmp, 3).'%';
|
||||
|
||||
// $summe_prozent[] = $tmp;
|
||||
// $summe_nutzwert[] = $row['nutzwert_summe'];
|
||||
|
||||
// $html .= '<tr>';
|
||||
// $html .= Html::td($row['top_nr'], 'bl bb br');
|
||||
// $html .= Html::td($row['geschoss'], 'bb br');
|
||||
// $html .= Html::td($row['orientierung'], 'center bb br');
|
||||
// $html .= Html::td($row['type'], 'bb br');
|
||||
// $html .= Html::td(round($row['nutzwert_summe']), 'center bb br');
|
||||
// $html .= Html::td($row['nutzwert_summe2'], 'center bb br');
|
||||
// $html .= Html::td($row['prozent'], 'center bb br');
|
||||
// $html .= '</tr>';
|
||||
// }
|
||||
|
||||
// $html .= '<tr>';
|
||||
// $html .= Html::td('', 'head bl bb', 4);
|
||||
// $html .= Html::td(array_sum($summe_nutzwert), 'head center bb');
|
||||
// $html .= Html::td(array_sum($summe_nutzwert) * 2 .'/'.round($nutzwert_summe) * 2 .' tel Anteil =', 'head center bb');
|
||||
// $html .= Html::td(round(array_sum($summe_prozent)).'%', 'head center bb br');
|
||||
// $html .= '</tr>';
|
||||
// $html .= '</table>';
|
||||
// $html .= '<p class="text-small">* Die Anteile wurden verdoppelt, sodaß die Mindestanteile jederzeit durch zwei geteilt werden können.';
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user