Fixed invoicing only one of several voicezones with same name
This commit is contained in:
@@ -153,6 +153,7 @@ class BillingController extends mfBaseController {
|
||||
$v = 0;
|
||||
|
||||
$today = new DateTime("now");
|
||||
//$today = new DateTime("2026-01-09");
|
||||
$today->setTime(0,0,0);
|
||||
|
||||
$now_year = date("Y");
|
||||
@@ -191,7 +192,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 +716,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 +740,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 +749,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 +759,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!");
|
||||
|
||||
Reference in New Issue
Block a user