RTR Reporting A10 done

This commit is contained in:
Frank Schubert
2024-12-06 18:20:27 +01:00
parent 33d7a4e5f1
commit 0ad4d8dd29
2 changed files with 54 additions and 15 deletions
+18 -7
View File
@@ -42,11 +42,16 @@ class Admin_RtrReporting {
$rasterpunkte = [];
foreach(BuildingModel::getAll() as $building) {
$raster = $building->laea;
if(!$raster) continue;
$prod_code = 14310;
$bb = "1000,00"; // glas = 1000, funk = 50
$user_count = TerminationModel::count(["building_id" => $building->id]);
//$user_count = TerminationModel::count(["building_id" => $building->id]);
$rtr100m = Rtr100mRaster::getFirst(["raster" => $raster]);
if(!$rtr100m) {
die("RTR Raster fehlt ".$raster);
}
$user_count = $rtr100m->unit_count;
if(!array_key_exists($raster, $rasterpunkte)) {
$rasterpunkte[$raster] = [];
@@ -67,11 +72,12 @@ class Admin_RtrReporting {
$address = $contract->owner;
if(!$address->gps_lat || !$address->gps_long || !$address->laea) {
//$address->getCoords();
$address->save();
$address->save(); // gets gps and laea
}
$raster = $address->laea;
if(!$raster) continue;
$rtr_code = $contract->product->attributes["rtr_tech_code"]->value;
if(substr($rtr_code, 0, 4) == 1431) {
$prod_code = 14310;
@@ -82,8 +88,6 @@ class Admin_RtrReporting {
} else {
continue; // incompatible product
}
$user_count = 1;
// get laea
if(!array_key_exists($raster, $rasterpunkte)) {
$rasterpunkte[$raster] = [];
@@ -94,7 +98,14 @@ class Admin_RtrReporting {
"user_count" => 0
];
}
$rasterpunkte[$raster][$prod_code]["user_count"] += $user_count;
$rtr100m = Rtr100mRaster::getFirst(["raster" => $raster]);
if(!$rtr100m) {
$this->log->warn(__METHOD__.": RTR Raster fehlt ".$raster);
continue;
}
$rasterpunkte[$raster][$prod_code]["user_count"] += $rtr100m->unit_count;
}