Merge branch 'fronkdev' of code.fronk.at:fronk/thetool into fronkdev
This commit is contained in:
@@ -335,6 +335,10 @@
|
||||
<a href="<?=self::getUrl("AddressDB", "view", ["id" => $address->id])?>"><i class="far fa-fw fa-eye" title="Adresse Anzeigen"></i></a>
|
||||
<a href="<?=self::getUrl("AddressDB", "edit", ["id" => $address->id])?>" class="pl-1"><i class="far fa-fw fa-edit" title="Adresse Bearbeiten"></i></a>
|
||||
<a href="<?=self::getUrl("AddressDB", "delete", ["id" => $address->id])?>" onclick="if(!confirm('Addresse und alle Wohneinheiten wirklich löschen?')) return false;"><i class="far fa-fw fa-trash-alt text-danger" title="Adresse Löschen"></i></a>
|
||||
|
||||
<?php if($me->is("Admin")): ?>
|
||||
<a href="<?=self::getUrl("Building", "createFromAdb", ["adb_hausnummer_id" => $address->id])?>" target="_blank"><i class="far fa-fw fa-person-digging text-success ml-2" title="Adresse in Netzbau anlegen"></i></a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
<div class="card-body">
|
||||
|
||||
<input type="hidden" name="id" value="<?=$building->id?>" />
|
||||
<?php if(isset($adb_hausnummer_id)): ?>
|
||||
<input type="hidden" name="adb_hausnummer_id" value="<?=$adb_hausnummer_id?>" />
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="network_id">Netzgebiet *</label>
|
||||
@@ -70,7 +73,11 @@
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="units">Nutzungseinheiten *</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="number" class="form-control" name="units" id="units" value="<?=$building->units?>" />
|
||||
<?php if($building->units == "from_adb"): ?>
|
||||
<input type="text" class="form-control" name="units" id="units" value="(auto)" disabled="disabled" />
|
||||
<?php else: ?>
|
||||
<input type="number" class="form-control" name="units" id="units" value="<?=$building->units?>" />
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -342,7 +342,8 @@ $pagination_entity_name = "Rechnungen";
|
||||
<td><?=($invoice->billing_type == "sepa") ? "SEPA" : "Überweisung"?></td>
|
||||
<td><?=($invoice->billing_delivery == "email") ? "Email" : "Papier"?></td>
|
||||
<td>
|
||||
<a href="<?=self::getUrl("Invoice", "downloadInvoiceCsv", ["id" => $invoice->id])?>" title="CSV-Download"><i class="fas fa-file-csv fa-fw"></i></a>
|
||||
<a href="<?=self::getUrl("Invoice", "downloadInvoiceCsv", ["id" => $invoice->id])?>" title="CSV-Download"><i class="far fa-file-csv fa-fw"></i></a>
|
||||
<a href="<?=self::getUrl("Invoice", "downloadInvoiceVoiceDetails", ["id" => $invoice->id])?>" title="Download EGN"><i class="far fa-square-phone-flip fa-fw ml-2"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
@@ -1860,7 +1860,7 @@
|
||||
|
||||
|
||||
}
|
||||
reader.readAsText(selectedFile);
|
||||
reader.readAsArrayBuffer(selectedFile);
|
||||
|
||||
|
||||
});
|
||||
|
||||
@@ -130,9 +130,13 @@ class AddressDB {
|
||||
}
|
||||
|
||||
|
||||
$netowner = $hausnummer->getNetowner();
|
||||
if(!$netowner || !$netowner->id) {
|
||||
$log->debug(__METHOD__.": Unable to determine netowner for Hausnummer ".$hausnummer->id);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
$status_matrix = array_reverse(TT_PREORDER_RIMO_STATUS_MATRIX);
|
||||
$status_matrix = array_reverse(TT_PREORDER_RIMO_STATUS_MATRIX[$netowner->id]);
|
||||
|
||||
$log->debug(__METHOD__.": b_ex_state: ".$b_ex_state);
|
||||
$log->debug(__METHOD__.": b_op_state: ".$b_op_state);
|
||||
@@ -218,7 +222,6 @@ class AddressDB {
|
||||
if($hausnummer->status_id != $old_status) {
|
||||
$hausnummer->save();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//$wohneinheit = new ADBWohneinheit($wohneinheit->id);
|
||||
@@ -234,9 +237,18 @@ class AddressDB {
|
||||
|
||||
}
|
||||
|
||||
if(array_key_exists("hf", $matrix)) {
|
||||
$hausnummer_flag = $matrix["hf"];
|
||||
if($hausnummer_flag) {
|
||||
$log->debug(__METHOD__.": new Hausnummer (".$wohneinheit->id.") statusflag: ".$matrix["hf"]);
|
||||
$hausnummer->setStatusflag($hausnummer_flag, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
// commented, for 140/141
|
||||
//break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ class BillingController extends mfBaseController {
|
||||
$contract_search = [
|
||||
"finish_date<" => mktime(2,0,0,$now_month, $now_day, $now_year),
|
||||
"cancel_date_null_or_gte" => mktime(0,0,0,$now_month, 1, $now_year),
|
||||
//"owner_id" => 1221
|
||||
//"owner_id" => 7719
|
||||
];
|
||||
|
||||
foreach(ContractModel::search($contract_search) as $contract) {
|
||||
@@ -715,6 +715,7 @@ class BillingController extends mfBaseController {
|
||||
}
|
||||
if (!array_key_exists($zone->id, $voicebills[$number][$call_date_start])) {
|
||||
$voicebills[$number][$call_date_start][$zone->id] = [
|
||||
//"zone_id" => $zone->id,
|
||||
"zone_name" => $zone->name,
|
||||
"voiceplan" => $voiceplan->name,
|
||||
"duration" => 0,
|
||||
@@ -738,8 +739,8 @@ class BillingController extends mfBaseController {
|
||||
// save to BillingVoicenumber
|
||||
foreach($voicebills as $vbnumber => $zones) {
|
||||
|
||||
foreach($zones as $zone_id => $zone) {
|
||||
foreach($zone as $zone_start_date => $vb) {
|
||||
foreach($zones as $zone_start_date => $zone) {
|
||||
foreach($zone as $zone_id => $vb) {
|
||||
$vbdata = [];
|
||||
$vbdata["billing_id"] = $billing->id;
|
||||
$vbdata["contract_id"] = $contract->id;
|
||||
@@ -747,6 +748,7 @@ class BillingController extends mfBaseController {
|
||||
$vbdata["start_date"] = $vb["start_date"];
|
||||
$vbdata["end_date"] = $vb["end_date"];
|
||||
$vbdata["voiceplan"] = $vb["voiceplan"];
|
||||
$vbdata["zone_id"] = $zone_id;
|
||||
$vbdata["zone"] = $vb["zone_name"];
|
||||
$vbdata["call_count"] = $vb["count"];
|
||||
$vbdata["duration"] = $vb["duration"];
|
||||
@@ -756,6 +758,7 @@ class BillingController extends mfBaseController {
|
||||
$vbdata["increment_first"] = $vb["increment_first"];
|
||||
|
||||
$bill_voice = BillingVoicenumberModel::create($vbdata);
|
||||
$this->log->debug(__METHOD__.": billingvoicenumber record created: ".print_r($vbdata, true));
|
||||
if(!$bill_voice->save()) {
|
||||
var_dump($vbdata);
|
||||
die("Error saving Billing Voicenumber!");
|
||||
|
||||
@@ -7,6 +7,7 @@ class BillingVoicenumberModel {
|
||||
public $start_date;
|
||||
public $end_date;
|
||||
public $voiceplan;
|
||||
public $zone_id;
|
||||
public $zone;
|
||||
public $call_count;
|
||||
public $duration;
|
||||
|
||||
@@ -177,6 +177,9 @@ class BuildingController extends mfBaseController {
|
||||
protected function saveAction() {
|
||||
$r = $this->request;
|
||||
$id = $r->id;
|
||||
|
||||
$adb_hausnummer_id = null;
|
||||
|
||||
//var_dump($r);exit;
|
||||
if(is_numeric($id) && $id > 0) {
|
||||
$mode = "edit";
|
||||
@@ -187,6 +190,9 @@ class BuildingController extends mfBaseController {
|
||||
}
|
||||
} else {
|
||||
$mode = "add";
|
||||
if($r->adb_hausnummer_id) {
|
||||
$adb_hausnummer_id = $r->adb_hausnummer_id;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$r->network_id || !$r->type_id) {
|
||||
@@ -215,10 +221,17 @@ class BuildingController extends mfBaseController {
|
||||
$data['contact'] = trim($r->contact);
|
||||
$data['phone'] = trim($r->phone);
|
||||
$data['email'] = trim($r->email);
|
||||
$data['units'] = trim($r->units);
|
||||
|
||||
$data['description'] = trim($r->description);
|
||||
$data['note'] = trim($r->note);
|
||||
|
||||
|
||||
if($adb_hausnummer_id) {
|
||||
$data["adb_hausnummer_id"] = $adb_hausnummer_id;
|
||||
$data['units'] = 0;
|
||||
} else {
|
||||
$data['units'] = trim($r->units);
|
||||
}
|
||||
|
||||
if($this->me->is(["Admin", "netowner"])) {
|
||||
if($r->gps_lat) $data['gps_lat'] = trim($r->gps_lat);
|
||||
if($r->gps_long) $data['gps_long'] = trim($r->gps_long);
|
||||
@@ -235,7 +248,7 @@ class BuildingController extends mfBaseController {
|
||||
|
||||
// check if building exists already
|
||||
$checkBuilding = BuildingModel::search(['=street' => $data['street'], '=city' => $data['city'], '=zip' => $data['zip']]);
|
||||
|
||||
|
||||
if($checkBuilding) {
|
||||
$this->layout()->setFlash("Objekt ist <a target='_blank' href='".self::getUrl("Building")."#building=".$checkBuilding[0]->id."'>bereits vorhanden</a>!", "error");
|
||||
$this->layout()->set("building", $building);
|
||||
@@ -283,30 +296,49 @@ class BuildingController extends mfBaseController {
|
||||
}
|
||||
|
||||
// Anschlüsse anlegen
|
||||
|
||||
if(!$building->terminations && $building->units > 0) {
|
||||
for($i = 1; $i <= $building->units; $i++) {
|
||||
$data = [];
|
||||
$data['building_id'] = $building->id;
|
||||
$data['code'] = $building->code . "." . sprintf("%03d", $i);
|
||||
|
||||
if($building->units == 1) {
|
||||
$data['contact'] = $building->contact;
|
||||
$data['phone'] = $building->phone;
|
||||
$data['email'] = $building->email;
|
||||
}
|
||||
/*
|
||||
// no more lineworker_id in Termination
|
||||
if($building->lineworker_id) {
|
||||
$data['lineworker_id'] = $building->lineworker_id;
|
||||
}*/
|
||||
if($building->oaid) {
|
||||
$data['oaid'] = $building->oaid. "." . sprintf("%03d", $i);
|
||||
}
|
||||
|
||||
$term = TerminationModel::create($data);
|
||||
$term->save();
|
||||
}
|
||||
|
||||
if($mode == "add" && $adb_hausnummer_id) {
|
||||
$i = 1;
|
||||
foreach(ADBWohneinheitModel::search(["hausnummer_id" => $adb_hausnummer_id]) as $wohneinheit) {
|
||||
$data = [];
|
||||
$data['building_id'] = $building->id;
|
||||
|
||||
$oaid_parts = explode(".", $wohneinheit->oaid);
|
||||
if($wohneinheit->oaid && array_key_exists(1, $oaid_parts)) {
|
||||
$data['code'] = $building->oaid . "." . $oaid_parts[1];
|
||||
} else {
|
||||
$data['code'] = $building->code . "." . sprintf("%04d", $i);
|
||||
}
|
||||
$data['oaid'] = $data['code'];
|
||||
|
||||
$term = TerminationModel::create($data);
|
||||
$term->save();
|
||||
|
||||
$i++;
|
||||
}
|
||||
} elseif(!$building->terminations && $building->units > 0) {
|
||||
for($i = 1; $i <= $building->units; $i++) {
|
||||
$data = [];
|
||||
$data['building_id'] = $building->id;
|
||||
$data['code'] = $building->code . "." . sprintf("%03d", $i);
|
||||
|
||||
if($building->units == 1) {
|
||||
$data['contact'] = $building->contact;
|
||||
$data['phone'] = $building->phone;
|
||||
$data['email'] = $building->email;
|
||||
}
|
||||
/*
|
||||
// no more lineworker_id in Termination
|
||||
if($building->lineworker_id) {
|
||||
$data['lineworker_id'] = $building->lineworker_id;
|
||||
}*/
|
||||
if($building->oaid) {
|
||||
$data['oaid'] = $building->oaid. "." . sprintf("%03d", $i);
|
||||
}
|
||||
|
||||
$term = TerminationModel::create($data);
|
||||
$term->save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -343,7 +375,55 @@ class BuildingController extends mfBaseController {
|
||||
$this->layout()->setFlash("Objekt gelöscht", "success");
|
||||
$this->redirect("Building");
|
||||
}
|
||||
|
||||
|
||||
protected function createFromAdbAction() {
|
||||
$adb_hausnummer_id = $this->request->adb_hausnummer_id;
|
||||
|
||||
if(!$adb_hausnummer_id) {
|
||||
$this->layout()->setFlash("AddressDB Adresse nicht gefunden.", "error");
|
||||
$this->redirect("AddressDB");
|
||||
}
|
||||
|
||||
$hausnummer = new ADBHausnummer($adb_hausnummer_id);
|
||||
if(!$hausnummer->id) {
|
||||
$this->layout()->setFlash("AddressDB Adresse nicht gefunden.", "error");
|
||||
$this->redirect("AddressDB");
|
||||
}
|
||||
|
||||
$network = NetworkModel::getFirst(["adb_netzgebiet_id" => $hausnummer->netzgebiet_id]);
|
||||
if(!$network) {
|
||||
$this->layout()->setFlash("AddressDB-Netzgebiet ist keinem Netzbau-Netzgebiet zugeordnet!", "error");
|
||||
$this->redirect("AddressDB");
|
||||
}
|
||||
|
||||
$building_data = [];
|
||||
$building_data["adb_hausnummer_id"] = $hausnummer->id;
|
||||
$building_data["network_id"] = $network->id;
|
||||
$building_data["type_id"] = ($hausnummer->tool_building_type <= 1) ? 1 : 3; // 1 = EFH | 2 = MPH
|
||||
$building_data["status_id"] = 1;
|
||||
|
||||
if($hausnummer->oaid) {
|
||||
if(!BuildingModel::getFirst(["code" => $hausnummer->oaid])) {
|
||||
$building_data["code"] = $hausnummer->oaid;
|
||||
}
|
||||
$building_data["oaid"] = $hausnummer->oaid;
|
||||
}
|
||||
|
||||
$building_data["street"] = $hausnummer->strasse->name . " ".$hausnummer->hausnummer;
|
||||
$building_data["city"] = $hausnummer->strasse->gemeinde->name;
|
||||
$building_data["zip"] = $hausnummer->plz->plz;
|
||||
$building_data["gps_lat"] = $hausnummer->gps_lat;
|
||||
$building_data["gps_long"] = $hausnummer->gps_long;
|
||||
$building_data["units"] = "from_adb";
|
||||
$building_data["note"] = "Created from ADB Address {$hausnummer->id}";
|
||||
|
||||
$building = BuildingModel::create($building_data);
|
||||
$this->layout()->set("building", $building);
|
||||
$this->layout()->set("adb_hausnummer_id", $hausnummer->id);
|
||||
|
||||
return $this->addAction();
|
||||
}
|
||||
|
||||
|
||||
protected function apiAction() {
|
||||
if(!$this->me->is(["Admin","netowner","pipeplanner"])) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
class BuildingModel {
|
||||
public $adb_hausnummer_id = null;
|
||||
public $network_id = null;
|
||||
public $pop_id = null;
|
||||
public $type_id = null;
|
||||
|
||||
@@ -212,6 +212,119 @@ class InvoiceController extends mfBaseController {
|
||||
exit;
|
||||
}
|
||||
|
||||
protected function downloadInvoiceVoiceDetailsAction() {
|
||||
$id = $this->request->id;
|
||||
if (!is_numeric($id) || !$id) {
|
||||
$this->layout()->setFlash("Rechnung nicht gefunden", "error");
|
||||
$this->redirect("Invoice");
|
||||
}
|
||||
|
||||
$invoice = new Invoice($id);
|
||||
if (!$invoice->id) {
|
||||
$this->layout()->setFlash("Rechnung nicht gefunden", "error");
|
||||
$this->redirect("Invoice");
|
||||
}
|
||||
|
||||
$csv = "Startzeit;Abgehende Nummer;Zielnummer;Zone;Dauer;Kosten\n";
|
||||
|
||||
$total = 0;
|
||||
$destinations_cache = [];
|
||||
//var_dump($invoice->voicenumbers);exit;
|
||||
foreach($invoice->voicenumbers as $voicenumber) {
|
||||
$start_date = new DateTime($voicenumber->start_date);
|
||||
//$start_date->setTimezone(new DateTimeZone("Europe/Vienna"));
|
||||
$start_date->setTime(0,0,0);
|
||||
$end_date = new DateTime($voicenumber->end_date);
|
||||
//$end_date->setTimezone(new DateTimeZone("Europe/Vienna"));
|
||||
$end_date->setTime(23,59,59);
|
||||
|
||||
$call_date_start = $start_date->format("Y-m-d");
|
||||
|
||||
foreach(VoiceCallHistoryModel::getVoiceCallHistoryAsEntity([
|
||||
"voice_account" => $voicenumber->voicenumber,
|
||||
"start" => [
|
||||
"from" => $start_date->getTimestamp(),
|
||||
"to" => $end_date->getTimestamp()
|
||||
],
|
||||
"billable" => 1,
|
||||
], null, 0, ["key" => "start", "order" => "ASC"]) as $call) {
|
||||
if(!$call->contract_id) continue;
|
||||
|
||||
//$voiceplan = new Voiceplan($voicenumber->voiceplan_id);
|
||||
$voiceplan = VoiceplanModel::getFirst(["name" => $voicenumber->voiceplan]);
|
||||
if(!$voiceplan) {
|
||||
$this->log->warning(__METHOD__.": Voiceplan not found");
|
||||
exit;
|
||||
}
|
||||
|
||||
$number = $voicenumber->voicenumber;
|
||||
$dest_nummer = $call->destination;
|
||||
if (substr($dest_nummer, 0, 2) == "00") {
|
||||
$dest_nummer = substr($dest_nummer, 2);
|
||||
}
|
||||
|
||||
if (substr($dest_nummer, 0, 1) == "+") {
|
||||
$dest_nummer = substr($dest_nummer, 1);
|
||||
}
|
||||
|
||||
if (array_key_exists($dest_nummer, $destinations_cache)) {
|
||||
$destination = $destinations_cache[$dest_nummer];
|
||||
} else {
|
||||
$destination = $voiceplan->getDestinationByNumber($dest_nummer);
|
||||
if (!$destination) {
|
||||
die("Destination für Zielrufnummer " . $call->destination . " nicht gefunden");
|
||||
}
|
||||
$destinations_cache[$dest_nummer] = $destination;
|
||||
}
|
||||
//var_dump($destination);
|
||||
|
||||
$zone = $destination->voiceplanzone;
|
||||
|
||||
if (!$zone) {
|
||||
die("Keine Zone für Destination " . $dest_nummer . " gefunden");
|
||||
}
|
||||
|
||||
//var_dump($zone);exit;
|
||||
|
||||
// inc_first - first minimumm duration to bill
|
||||
// inc - subsequent minimum duration to bill
|
||||
$inc_first = $zone->increment_first;
|
||||
$inc = $zone->increment;
|
||||
|
||||
$billable_duration = $call->duration;
|
||||
if ($billable_duration <= 0) continue;
|
||||
|
||||
// calculate price of first duration unit
|
||||
// then subtract first minimum duration from duration
|
||||
$sec_price = $zone->price / 60;
|
||||
$call_price = $inc_first * $sec_price;
|
||||
$billable_duration -= $inc_first;
|
||||
|
||||
// calculate price of remaining duration and make sure to bill in full duration units
|
||||
if ($billable_duration > 0) {
|
||||
$multi = ceil($billable_duration / $inc);
|
||||
$call_price += ($multi * $inc) * $sec_price;
|
||||
}
|
||||
|
||||
$csv .= '"'.$call->start.'";';
|
||||
$csv .= '"'.$call->source.'"; ';
|
||||
$csv .= '"'.$call->destination.'"; ';
|
||||
$csv .= '"'.$zone->name.'"; ';
|
||||
$csv .= $call->duration.'; ';
|
||||
$csv .= '"'.str_replace(".",",", $call_price).'"';
|
||||
$csv .= "\n";
|
||||
|
||||
$total += $call_price;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
header("Content-type: text/csv; charset=utf-8");
|
||||
header('Content-disposition: attachment; filename="'.$invoice->invoice_number.'-egn.csv"');
|
||||
echo $csv;
|
||||
exit;
|
||||
}
|
||||
|
||||
protected function createJob() {
|
||||
$r = $this->request;
|
||||
@@ -380,34 +493,38 @@ class InvoiceController extends mfBaseController {
|
||||
$inc = reset($voicebills)->increment;
|
||||
$inc_first = reset($voicebills)->increment_first;
|
||||
|
||||
$zoneId2ZoneName = [];
|
||||
|
||||
$voice_rows = [];
|
||||
foreach ($voicebills as $voicebill) {
|
||||
$number = $voicebill->voicenumber;
|
||||
$zone_id = $voicebill->zone_id;
|
||||
$zone = $voicebill->zone;
|
||||
$call_count = $voicebill->call_count;
|
||||
$duration = $voicebill->duration;
|
||||
$price = $voicebill->price;
|
||||
$price_total = $voicebill->price_total;
|
||||
|
||||
$zoneId2ZoneName[$zone_id] = $zone;
|
||||
|
||||
if (!array_key_exists($number, $voice_rows)) {
|
||||
$voice_rows[$number] = [];
|
||||
}
|
||||
|
||||
if (!array_key_exists($zone, $voice_rows[$number])) {
|
||||
$voice_rows[$number][$zone] = [];
|
||||
if (!array_key_exists($zone_id, $voice_rows[$number])) {
|
||||
$voice_rows[$number][$zone_id] = [];
|
||||
}
|
||||
|
||||
if (!array_key_exists($price, $voice_rows[$number][$zone])) {
|
||||
$voice_rows[$number][$zone][$price] = [];
|
||||
$voice_rows[$number][$zone][$price]["call_count"] = 0;
|
||||
$voice_rows[$number][$zone][$price]["duration"] = 0;
|
||||
$voice_rows[$number][$zone][$price]["price_total"] = 0;
|
||||
if (!array_key_exists($price, $voice_rows[$number][$zone_id])) {
|
||||
$voice_rows[$number][$zone_id][$price] = [];
|
||||
$voice_rows[$number][$zone_id][$price]["call_count"] = 0;
|
||||
$voice_rows[$number][$zone_id][$price]["duration"] = 0;
|
||||
$voice_rows[$number][$zone_id][$price]["price_total"] = 0;
|
||||
}
|
||||
|
||||
$voice_rows[$number][$zone][$price]["call_count"] += $call_count;
|
||||
$voice_rows[$number][$zone][$price]["duration"] = $duration;
|
||||
$voice_rows[$number][$zone][$price]["price_total"] = $price_total;
|
||||
$voice_rows[$number][$zone_id][$price]["call_count"] += $call_count;
|
||||
$voice_rows[$number][$zone_id][$price]["duration"] = $duration;
|
||||
$voice_rows[$number][$zone_id][$price]["price_total"] = $price_total;
|
||||
}
|
||||
|
||||
//var_dump($voice_rows);exit;
|
||||
@@ -427,10 +544,10 @@ class InvoiceController extends mfBaseController {
|
||||
$invoice_voicenumber->voicenumberzones = [];
|
||||
|
||||
|
||||
foreach ($zones as $zone => $prices) {
|
||||
foreach ($zones as $zone_id => $prices) {
|
||||
foreach ($prices as $price => $row_values) {
|
||||
$zone_data = [];
|
||||
$zone_data["zone"] = $zone;
|
||||
$zone_data["zone"] = $zoneId2ZoneName[$zone_id];
|
||||
$zone_data["call_count"] = $row_values["call_count"];
|
||||
$zone_data["duration"] = $row_values["duration"];
|
||||
$zone_data["price"] = $price;
|
||||
|
||||
36
db/migrations/20251111171837_termination_resize_code.php
Normal file
36
db/migrations/20251111171837_termination_resize_code.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class TerminationResizeCode extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("Termination");
|
||||
$table->changeColumn("code", "string", ["length" => 64, "null" => true, "default" => null]);
|
||||
$table->update();
|
||||
|
||||
$table = $this->table("Building");
|
||||
$table->changeColumn("code", "string", ["length" => 64, "null" => true, "default" => null]);
|
||||
$table->changeColumn("oaid", "string", ["length" => 255, "null" => true, "default" => null]);
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class BillingVoicenumberAddZoneId extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("BillingVoicenumber");
|
||||
$table->addColumn("zone_id", "integer", ["null" => true, "default" => null, "after" => "voiceplan"]);
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$this->table("BillingVoicenumber")->removeColumn("zone_id")->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user