Пример #1
0
 /**
  * Renders per-payment system openpayz transaction charts
  * 
  * @return string
  */
 public function renderGraphs()
 {
     $psysdata = array();
     $gcAllData = array();
     $gcMonthData = array();
     $result = wf_Link('?module=openpayz', __('Back'), true, 'ubButton');
     if (!empty($this->allTransactions)) {
         foreach ($this->allTransactions as $io => $each) {
             $timestamp = strtotime($each['date']);
             $curMonth = curmonth();
             $date = date("Y-m-01", $timestamp);
             if (isset($psysdata[$each['paysys']][$date]['count'])) {
                 $psysdata[$each['paysys']][$date]['count']++;
                 $psysdata[$each['paysys']][$date]['summ'] = $psysdata[$each['paysys']][$date]['summ'] + $each['summ'];
             } else {
                 $psysdata[$each['paysys']][$date]['count'] = 1;
                 $psysdata[$each['paysys']][$date]['summ'] = $each['summ'];
             }
             //all time stats
             if (isset($gcAllData[$each['paysys']])) {
                 $gcAllData[$each['paysys']]++;
             } else {
                 $gcAllData[$each['paysys']] = 1;
             }
             //current month stats
             if (ispos($date, $curMonth . '-')) {
                 if (isset($gcMonthData[$each['paysys']])) {
                     $gcMonthData[$each['paysys']]++;
                 } else {
                     $gcMonthData[$each['paysys']] = 1;
                 }
             }
         }
     }
     $chartOpts = "chartArea: {  width: '90%', height: '90%' }, legend : {position: 'right'}, ";
     if (!empty($gcAllData)) {
         $gcAllPie = wf_gcharts3DPie($gcAllData, __('All time'), '400px', '400px', $chartOpts);
     } else {
         $gcAllPie = '';
     }
     if (!empty($gcMonthData)) {
         $gcMonthPie = wf_gcharts3DPie($gcMonthData, __('Current month'), '400px', '400px', $chartOpts);
     } else {
         $gcMonthPie = '';
     }
     $gcells = wf_TableCell($gcAllPie);
     $gcells .= wf_TableCell($gcMonthPie);
     $grows = wf_TableRow($gcells);
     $result .= wf_TableBody($grows, '100%', 0, '');
     if (!empty($psysdata)) {
         foreach ($psysdata as $psys => $opdate) {
             $gdata = __('Date') . ',' . __('Count') . ',' . __('Cash') . "\n";
             foreach ($opdate as $datestamp => $optrans) {
                 $gdata .= $datestamp . ',' . $optrans['count'] . ',' . $optrans['summ'] . "\n";
             }
             $result .= wf_tag('div', false, '', '');
             $result .= wf_tag('h2') . $psys . wf_tag('h2', true) . wf_delimiter();
             $result .= wf_Graph($gdata, '800', '200', false);
             $result .= wf_tag('div', true);
         }
     }
     return $result;
 }
Пример #2
0
 /**
  * Renders all-time funeral charts
  * 
  * @return string
  */
 public function renderChart()
 {
     $data = __('Month') . ',' . __('Subscriber is connected') . ',' . __('Subscriber is not connected') . "\n";
     $tmpArr = array();
     $totalCount = 0;
     if (!empty($this->allDead)) {
         foreach ($this->allDead as $io => $each) {
             $time = strtotime($each['date']);
             $month = date("Y-m-d", $time);
             if (isset($tmpArr[$month])) {
                 if ($each['state']) {
                     $tmpArr[$month]['inactive']++;
                 } else {
                     $tmpArr[$month]['active']++;
                 }
                 $totalCount++;
             } else {
                 if ($each['state']) {
                     $tmpArr[$month]['inactive'] = 1;
                     $tmpArr[$month]['active'] = 0;
                 } else {
                     $tmpArr[$month]['active'] = 1;
                     $tmpArr[$month]['inactive'] = 0;
                 }
                 $totalCount++;
             }
         }
     }
     if (!empty($tmpArr)) {
         foreach ($tmpArr as $ia => $each) {
             $data .= $ia . ',' . ($totalCount - $each['active']) . ',' . ($totalCount - $each['inactive']) . "\n";
         }
     }
     $result = wf_tag('div', false, '', '');
     $result .= wf_Graph($data, '800', '300', false) . wf_tag('div', true);
     return $result;
 }
Пример #3
0
 function zb_AskoziaParseCallHistory($data)
 {
     global $altcfg;
     $normalData = array();
     $callersData = array();
     $data = explodeRows($data);
     if (!empty($data)) {
         foreach ($data as $eachline) {
             $explode = explode(';', $eachline);
             //in 2.2.8 delimiter changed from ," to ;
             if (!empty($eachline)) {
                 $normalData[] = str_replace('"', '', $explode);
             }
         }
     }
     //custom caller options
     if (isset($altcfg['ASKOZIA_CUSTOM'])) {
         if (!empty($altcfg['ASKOZIA_CUSTOM'])) {
             // 0 - internal peers
             // 1 - external gateways
             // 2 - group prefix
             // 3 - parking
             $customCfg = explode(',', $altcfg['ASKOZIA_CUSTOM']);
         } else {
             $customCfg = array();
         }
     } else {
         $customCfg = array();
     }
     if (!empty($normalData)) {
         $totalTime = 0;
         $callsCounter = 0;
         $answerCounter = 0;
         $noAnswerCounter = 0;
         $chartData = array();
         $cells = wf_TableCell('#');
         $cells .= wf_TableCell(__('Time'));
         $cells .= wf_TableCell(__('From'));
         $cells .= wf_TableCell(__('To'));
         $cells .= wf_TableCell(__('Picked up'));
         $cells .= wf_TableCell(__('Type'));
         $cells .= wf_TableCell(__('Status'));
         $cells .= wf_TableCell(__('Talk time'));
         $rows = wf_TableRow($cells, 'row1');
         foreach ($normalData as $io => $each) {
             //fix parsing for askozia 2.2.8
             if ($each[0] != 'accountcode') {
                 $callsCounter++;
                 $debugData = wf_tag('pre') . print_r($each, true) . wf_tag('pre', true);
                 $startTime = explode(' ', $each[9]);
                 @($startDate = $startTime[0]);
                 @($startTime = $startTime[1]);
                 @($startHour = date("H:00:00", strtotime($startTime)));
                 $endTime = explode(' ', $each[11]);
                 @($endTime = $endTime[1]);
                 $answerTime = explode(' ', $each[10]);
                 @($answerTime = $answerTime[1]);
                 $tmpStats = __('Taken up the phone') . ': ' . $answerTime . "\n";
                 $tmpStats .= __('End of call') . ': ' . $endTime;
                 $sessionTimeStats = wf_tag('abbr', false, '', 'title="' . $tmpStats . '"');
                 $sessionTimeStats .= $startTime;
                 $sessionTimeStats .= wf_tag('abbr', true);
                 $callDirection = '';
                 //detectiong direction icon
                 if (!empty($customCfg)) {
                     if (isset($customCfg[0]) and $customCfg[1]) {
                         if (zb_AskoziaCheckPrefix($customCfg[0], $each[1])) {
                             $callDirection = wf_img('skins/calls/outgoing.png') . ' ';
                         }
                         if (zb_AskoziaCheckPrefix($customCfg[1], $each[1])) {
                             $callDirection = wf_img('skins/calls/incoming.png') . ' ';
                         }
                     }
                 }
                 $cells = wf_TableCell(wf_modal($callsCounter, $callsCounter, $debugData, '', '500', '600'), '', '', 'sorttable_customkey="' . $callsCounter . '"');
                 $cells .= wf_TableCell($callDirection . $sessionTimeStats, '', '', 'sorttable_customkey="' . strtotime($each[9]) . '"');
                 $cells .= wf_TableCell(zb_AskoziaGetNumAlias($each[1]));
                 $cells .= wf_TableCell(zb_AskoziaGetNumAlias($each[2]));
                 $receiveCid = '';
                 if (!empty($each[6])) {
                     $tmpRcid = explode('-', $each[6]);
                     @($receiveCid = vf($tmpRcid[0], 3));
                 }
                 $cells .= wf_TableCell(zb_AskoziaGetNumAlias($receiveCid));
                 $CallType = __('Dial');
                 if (ispos($each[3], 'internal-caller-transfer')) {
                     $CallType = __('Call transfer');
                 }
                 if (ispos($each[7], 'VoiceMail')) {
                     $CallType = __('Voice mail');
                 }
                 $cells .= wf_TableCell($CallType);
                 $callStatus = $each[14];
                 $statusIcon = '';
                 if (ispos($each[14], 'ANSWERED')) {
                     $callStatus = __('Answered');
                     $statusIcon = wf_img('skins/calls/phone_green.png');
                     $answerCounter++;
                     if (isset($chartData[$startDate . ' ' . $startHour]['answered'])) {
                         $chartData[$startDate . ' ' . $startHour]['answered']++;
                     } else {
                         $chartData[$startDate . ' ' . $startHour]['answered'] = 1;
                     }
                 }
                 if (ispos($each[14], 'NO ANSWER')) {
                     $callStatus = __('No answer');
                     $statusIcon = wf_img('skins/calls/phone_red.png');
                     $noAnswerCounter++;
                     if (isset($chartData[$startDate . ' ' . $startHour]['noanswer'])) {
                         $chartData[$startDate . ' ' . $startHour]['noanswer']++;
                     } else {
                         $chartData[$startDate . ' ' . $startHour]['noanswer'] = 1;
                     }
                 }
                 if (ispos($each[14], 'BUSY')) {
                     $callStatus = __('Busy');
                     $statusIcon = wf_img('skins/calls/phone_yellow.png');
                 }
                 if (ispos($each[14], 'FAILED')) {
                     $callStatus = __('Failed');
                     $statusIcon = wf_img('skins/calls/phone_fail.png');
                 }
                 $cells .= wf_TableCell($statusIcon . ' ' . $callStatus);
                 $speekTimeRaw = $each[13];
                 $totalTime = $totalTime + $each[13];
                 $speekTime = zb_AskoziaFormatTime($speekTimeRaw);
                 //current caller stats
                 if (isset($callersData[$each[1]])) {
                     $callersData[$each[1]]['calls'] = $callersData[$each[1]]['calls'] + 1;
                     $callersData[$each[1]]['time'] = $callersData[$each[1]]['time'] + $speekTimeRaw;
                 } else {
                     $callersData[$each[1]]['calls'] = 1;
                     $callersData[$each[1]]['time'] = $speekTimeRaw;
                 }
                 if (isset($callersData[$each[2]])) {
                     $callersData[$each[2]]['calls'] = $callersData[$each[2]]['calls'] + 1;
                     $callersData[$each[2]]['time'] = $callersData[$each[2]]['time'] + $speekTimeRaw;
                 } else {
                     $callersData[$each[2]]['calls'] = 1;
                     $callersData[$each[2]]['time'] = $speekTimeRaw;
                 }
                 if (!empty($receiveCid)) {
                     if (isset($callersData[$receiveCid])) {
                         $callersData[$receiveCid]['calls'] = $callersData[$receiveCid]['calls'] + 1;
                         $callersData[$receiveCid]['time'] = $callersData[$receiveCid]['time'] + $speekTimeRaw;
                     } else {
                         $callersData[$receiveCid]['calls'] = 1;
                         $callersData[$receiveCid]['time'] = $speekTimeRaw;
                     }
                 }
                 $cells .= wf_TableCell($speekTime, '', '', 'sorttable_customkey="' . $each[13] . '"');
                 $rows .= wf_TableRow($cells, 'row3');
             }
         }
         if (!empty($callersData)) {
             if (!empty($customCfg)) {
                 $gcells = wf_TableCell(__('Phone'));
                 $gcells .= wf_TableCell(__('Total calls'));
                 $gcells .= wf_TableCell(__('Time'));
                 $grows = wf_TableRow($gcells, 'row1');
             }
             foreach ($callersData as $cix => $eachcdat) {
                 if (!empty($customCfg)) {
                     if (zb_AskoziaCheckPrefix($customCfg[0], $cix) and strlen($cix) < 4) {
                         $gcells = wf_TableCell(zb_AskoziaGetNumAlias($cix));
                         $gcells .= wf_TableCell($eachcdat['calls']);
                         $gcells .= wf_TableCell(zb_AskoziaFormatTime($eachcdat['time']), '', '', 'sorttable_customkey="' . $eachcdat['time'] . '"');
                         $grows .= wf_TableRow($gcells, 'row3');
                     }
                 }
             }
         }
         //total time stats
         $result = '';
         if (!empty($chartData)) {
             if (sizeof($chartData) >= 2) {
                 $gdata = __('Date') . ',' . __('Total') . ',' . __('Answered') . ',' . __('No answer') . "\n";
                 foreach ($chartData as $io => $each) {
                     @($gdata .= $io . ',' . ($each['answered'] + $each['noanswer']) . ',' . $each['answered'] . ',' . $each['noanswer'] . "\n");
                 }
                 $result .= wf_tag('div', false, '', '');
                 $result .= wf_tag('h2') . __('Stats') . wf_tag('h2', true) . wf_tag('br');
                 $result .= wf_Graph($gdata, '800', '200', false);
                 $result .= wf_tag('div', true);
                 $result .= wf_delimiter();
             }
         }
         $result .= __('Time spent on calls') . ': ' . zb_AskoziaFormatTime($totalTime) . wf_tag('br');
         $result .= __('Answered') . ' / ' . __('No answer') . ': ' . $answerCounter . ' / ' . $noAnswerCounter . wf_tag('br');
         $result .= __('Total calls') . ': ' . $callsCounter;
         if (!empty($customCfg)) {
             @($result .= wf_delimiter() . wf_TableBody($grows, '100%', '0', 'sortable') . wf_delimiter());
         }
         $result .= wf_TableBody($rows, '100%', '0', 'sortable');
         show_window('', $result);
     }
 }
Пример #4
0
 /**
  * Renders ONU signal history chart
  * 
  * @param int $onuId
  * @return string
  */
 protected function onuSignalHistory($onuId)
 {
     $onuId = vf($onuId, 3);
     $result = '';
     if (isset($this->allOnu[$onuId])) {
         //not empty MAC
         if ($this->allOnu[$onuId]['mac']) {
             if (file_exists(self::ONUSIG_PATH . md5($this->allOnu[$onuId]['mac']))) {
                 $historyKey = self::ONUSIG_PATH . md5($this->allOnu[$onuId]['mac']);
             } elseif (file_exists(self::ONUSIG_PATH . md5($this->allOnu[$onuId]['serial']))) {
                 $historyKey = self::ONUSIG_PATH . md5($this->allOnu[$onuId]['serial']);
             } else {
                 $historyKey = '';
             }
             if (!empty($historyKey)) {
                 $rawData = file_get_contents($historyKey);
                 $result .= wf_delimiter();
                 $result .= wf_tag('h2') . __('ONU signal history') . wf_tag('h2', true);
                 //current day signal levels
                 $todaySignal = '';
                 $curdate = curdate();
                 if (!empty($rawData)) {
                     $todayTmp = explodeRows($rawData);
                     if (!empty($todayTmp)) {
                         foreach ($todayTmp as $io => $each) {
                             if (ispos($each, $curdate)) {
                                 $todaySignal .= $each . "\n";
                             }
                         }
                     }
                 }
                 $result .= __('Today');
                 $result .= wf_tag('div', false, '', '');
                 $result .= wf_Graph($todaySignal, '800', '300', false);
                 $result .= wf_tag('div', true);
                 $result .= wf_tag('br');
                 //current month signal levels
                 $monthSignal = '';
                 $curmonth = curmonth();
                 if (!empty($rawData)) {
                     $monthTmp = explodeRows($rawData);
                     if (!empty($monthTmp)) {
                         foreach ($monthTmp as $io => $each) {
                             if (ispos($each, $curmonth)) {
                                 $monthSignal .= $each . "\n";
                             }
                         }
                     }
                 }
                 $result .= __('Month');
                 $result .= wf_tag('div', false, '', '');
                 $result .= wf_Graph($monthSignal, '800', '300', false);
                 $result .= wf_tag('div', true);
                 $result .= wf_tag('br');
                 //all time signal history
                 $result .= __('All time');
                 $result .= wf_tag('div', false, '', '');
                 $result .= wf_GraphCSV($historyKey, '800', '300', false);
                 $result .= wf_tag('div', true);
             }
         }
     }
     return $result;
 }
Пример #5
0
/**
 * Returns graph of planned tasks in taskmanager
 * 
 * @param int $year
 * @return string
 */
function web_AnalyticsTaskmanMonthGraph($year)
{
    $allmonths = months_array();
    $yearcount = zb_AnalyticsTaskmanGetCountYear($year);
    $data = __('Month') . ',' . __('Jobs') . "\n";
    foreach ($yearcount as $eachmonth => $count) {
        $data .= $year . '-' . $eachmonth . '-' . '-01,' . $count . "\n";
    }
    $result = wf_tag('div', false, '', '') . __('Task manager activity during the year');
    $result .= wf_Graph($data, '800', '300', false) . wf_tag('div', true);
    return $result;
}
Пример #6
0
 public function renderMonthGraph()
 {
     /*
      * Танцуй, пока тебе бреют череп,
      * Танцуй, пока тебе сверлят лоб.
      * Прыгнул карась на раскалённый берег,
      * Жги лезгинку – хоп, хоп.
      */
     $this->loadMonthData();
     $result = '';
     $result .= wf_TableBody($this->tabledata, '100%', '0', 'sortable');
     $result .= wf_tag('span', false, 'glamour') . __('Our final profit') . ': ' . $this->yearsumm . wf_tag('span', true);
     $result .= wf_tag('span', false, 'style="clear:both;"') . wf_tag('div', true);
     $result .= wf_delimiter();
     $result .= wf_tag('div', false, '', '');
     $result .= wf_Graph($this->chartdata, '800', '400', false);
     $result .= wf_tag('div', true);
     return $result;
 }
Пример #7
0
 /**
  * Renders parsed calls data
  * 
  * @global array $altcfg
  * @param string $data
  * 
  * @return void
  */
 function zb_AskoziaParseCallHistory($data)
 {
     global $altcfg;
     $debugFlag = false;
     $answeredFlag = true;
     $prevTimeStart = '';
     $prevTimeEnd = '';
     if (isset($altcfg['ASKOZIA_DEBUG'])) {
         if ($altcfg['ASKOZIA_DEBUG']) {
             $debugFlag = true;
         }
     }
     //working time setup
     $rawWorkTime = $altcfg['WORKING_HOURS'];
     $rawWorkTime = explode('-', $rawWorkTime);
     $workStartTime = $rawWorkTime[0];
     $workEndTime = $rawWorkTime[1];
     $normalData = array();
     $callersData = array();
     $data = explodeRows($data);
     if (!empty($data)) {
         foreach ($data as $eachline) {
             $explode = explode(';', $eachline);
             //in 2.2.8 delimiter changed from ," to ;
             if (!empty($eachline)) {
                 $normalData[] = str_replace('"', '', $explode);
             }
         }
     }
     //custom caller options
     if (isset($altcfg['ASKOZIA_CUSTOM'])) {
         if (!empty($altcfg['ASKOZIA_CUSTOM'])) {
             // 0 - internal peers
             // 1 - external gateways
             // 2 - group prefix
             // 3 - parking
             $customCfg = explode(',', $altcfg['ASKOZIA_CUSTOM']);
         } else {
             $customCfg = array();
         }
     } else {
         $customCfg = array();
     }
     if (!empty($normalData)) {
         $totalTime = 0;
         $callsCounter = 0;
         $answerCounter = 0;
         $noAnswerCounter = 0;
         $WorkHoursAnswerCounter = 0;
         $WorkHoursNoAnswerCounter = 0;
         $busycount = 0;
         $chartData = array();
         $cells = wf_TableCell('#');
         $cells .= wf_TableCell(__('Time'));
         $cells .= wf_TableCell(__('From'));
         $cells .= wf_TableCell(__('To'));
         $cells .= wf_TableCell(__('Picked up'));
         $cells .= wf_TableCell(__('Type'));
         $cells .= wf_TableCell(__('Status'));
         $cells .= wf_TableCell(__('Talk time'));
         $rows = wf_TableRow($cells, 'row1');
         foreach ($normalData as $io => $each) {
             //fix parsing for askozia 2.2.8
             if ($each[0] != 'accountcode') {
                 $callsCounter++;
                 $debugData = wf_tag('pre') . print_r($each, true) . wf_tag('pre', true);
                 $startTime = explode(' ', $each[9]);
                 @($startDate = $startTime[0]);
                 @($startTime = $startTime[1]);
                 @($startHour = date("H:00:00", strtotime($startTime)));
                 $endTime = explode(' ', $each[11]);
                 @($endTime = $endTime[1]);
                 $answerTime = explode(' ', $each[10]);
                 @($answerTime = $answerTime[1]);
                 $tmpStats = __('Taken up the phone') . ': ' . $answerTime . "\n";
                 $tmpStats .= __('End of call') . ': ' . $endTime;
                 $sessionTimeStats = wf_tag('abbr', false, '', 'title="' . $tmpStats . '"');
                 $sessionTimeStats .= $startTime;
                 $sessionTimeStats .= wf_tag('abbr', true);
                 $callDirection = '';
                 if ($each[16] == 'outbound') {
                     $toNumber = $each[2];
                     $callDirection = wf_img('skins/calls/outgoing.png') . ' ';
                 } else {
                     $toNumber = $each[18];
                     $callDirection = wf_img('skins/calls/incoming.png') . ' ';
                 }
                 if ($debugFlag) {
                     $callIdData = wf_modal($callsCounter, $callsCounter, $debugData, '', '500', '600');
                 } else {
                     $callIdData = $callsCounter;
                 }
                 $cells = wf_TableCell($callIdData, '', '', 'sorttable_customkey="' . $callsCounter . '"');
                 $cells .= wf_TableCell($callDirection . $sessionTimeStats, '', '', 'sorttable_customkey="' . strtotime($each[9]) . '"');
                 $cells .= wf_TableCell(zb_AskoziaGetNumAlias($each[1]));
                 $cells .= wf_TableCell(zb_AskoziaGetNumAlias($toNumber));
                 $receiveCid = '';
                 if (!empty($each[6])) {
                     $tmpRcid = explode('-', $each[6]);
                     @($receiveCid = vf($tmpRcid[0], 3));
                 }
                 $cells .= wf_TableCell(zb_AskoziaGetNumAlias($receiveCid));
                 $CallType = __('Dial');
                 if (ispos($each[3], 'internal-caller-transfer')) {
                     $CallType = __('Call transfer');
                 }
                 if (ispos($each[7], 'VoiceMail')) {
                     $CallType = __('Voice mail');
                 }
                 $cells .= wf_TableCell($CallType);
                 $callStatus = $each[14];
                 $statusIcon = '';
                 if (ispos($each[14], 'ANSWERED') and !ispos($each[7], 'VoiceMail')) {
                     $answeredFlag = true;
                     $callStatus = __('Answered');
                     $statusIcon = wf_img('skins/calls/phone_green.png');
                     $answerCounter++;
                     //work time controls
                     if (zb_isTimeBetween($workStartTime, $workEndTime, $startTime)) {
                         $WorkHoursAnswerCounter++;
                     }
                     if (isset($chartData[$startDate . ' ' . $startHour]['answered'])) {
                         $chartData[$startDate . ' ' . $startHour]['answered']++;
                     } else {
                         $chartData[$startDate . ' ' . $startHour]['answered'] = 1;
                     }
                 }
                 if (ispos($each[14], 'NO ANSWER') or ispos($each[7], 'VoiceMail')) {
                     $answeredFlag = false;
                     $callStatus = __('No answer');
                     $statusIcon = wf_img('skins/calls/phone_red.png');
                     //only incoming calls is unanswered
                     if ($each[16] != 'outbound') {
                         $noAnswerCounter++;
                         if (zb_isTimeBetween($workStartTime, $workEndTime, $startTime)) {
                             $WorkHoursNoAnswerCounter++;
                         }
                     }
                     if (isset($chartData[$startDate . ' ' . $startHour]['noanswer'])) {
                         $chartData[$startDate . ' ' . $startHour]['noanswer']++;
                     } else {
                         $chartData[$startDate . ' ' . $startHour]['noanswer'] = 1;
                     }
                 }
                 if (ispos($each[14], 'BUSY')) {
                     $callStatus = __('Busy');
                     $statusIcon = wf_img('skins/calls/phone_yellow.png');
                 }
                 if (ispos($each[14], 'FAILED')) {
                     $callStatus = __('Failed');
                     $statusIcon = wf_img('skins/calls/phone_fail.png');
                 }
                 $cells .= wf_TableCell($statusIcon . ' ' . $callStatus);
                 $speekTimeRaw = $each[13];
                 $totalTime = $totalTime + $each[13];
                 $speekTime = zb_AskoziaFormatTime($speekTimeRaw);
                 //current caller stats
                 if (isset($callersData[$each[1]])) {
                     $callersData[$each[1]]['calls'] = $callersData[$each[1]]['calls'] + 1;
                     $callersData[$each[1]]['time'] = $callersData[$each[1]]['time'] + $speekTimeRaw;
                 } else {
                     $callersData[$each[1]]['calls'] = 1;
                     $callersData[$each[1]]['time'] = $speekTimeRaw;
                 }
                 if (isset($callersData[$each[2]])) {
                     $callersData[$each[2]]['calls'] = $callersData[$each[2]]['calls'] + 1;
                     $callersData[$each[2]]['time'] = $callersData[$each[2]]['time'] + $speekTimeRaw;
                 } else {
                     $callersData[$each[2]]['calls'] = 1;
                     $callersData[$each[2]]['time'] = $speekTimeRaw;
                 }
                 if (!empty($receiveCid)) {
                     if (isset($callersData[$receiveCid])) {
                         $callersData[$receiveCid]['calls'] = $callersData[$receiveCid]['calls'] + 1;
                         $callersData[$receiveCid]['time'] = $callersData[$receiveCid]['time'] + $speekTimeRaw;
                     } else {
                         $callersData[$receiveCid]['calls'] = 1;
                         $callersData[$receiveCid]['time'] = $speekTimeRaw;
                     }
                 }
                 $cells .= wf_TableCell($speekTime, '', '', 'sorttable_customkey="' . $each[13] . '"');
                 //default rowclass
                 $rowClass = 'row3';
                 //non answered calls coloring
                 if ($answeredFlag == false) {
                     $rowClass = 'ukvbankstadup';
                 }
                 //time range processing
                 $curTimeStart = date("H:i:s", strtotime($each[9]));
                 $curTimeEnd = date("H:i:s", strtotime($each[11]));
                 if (empty($prevTimeStart) and empty($prevTimeEnd)) {
                     $prevTimeStart = $curTimeStart;
                     $prevTimeEnd = $curTimeEnd;
                 } else {
                     if ($answeredFlag == false) {
                         if (zb_isTimeBetween($prevTimeStart, $prevTimeEnd, $curTimeStart, true)) {
                             $rowClass = 'undone';
                             if (zb_isTimeBetween($workStartTime, $workEndTime, $startTime)) {
                                 $busycount++;
                             }
                         }
                     }
                     $prevTimeStart = $curTimeStart;
                     if (strtotime($curTimeEnd) > strtotime($prevTimeEnd)) {
                         $prevTimeEnd = $curTimeEnd;
                     }
                 }
                 $rows .= wf_TableRow($cells, $rowClass);
             }
         }
         if (!empty($callersData)) {
             if (!empty($customCfg)) {
                 $gcells = wf_TableCell(__('Phone'));
                 $gcells .= wf_TableCell(__('Total calls'));
                 $gcells .= wf_TableCell(__('Time'));
                 $grows = wf_TableRow($gcells, 'row1');
             }
             foreach ($callersData as $cix => $eachcdat) {
                 if (!empty($customCfg)) {
                     if (zb_AskoziaCheckPrefix($customCfg[0], $cix) and strlen($cix) < 4) {
                         $gcells = wf_TableCell(zb_AskoziaGetNumAlias($cix));
                         $gcells .= wf_TableCell($eachcdat['calls']);
                         $gcells .= wf_TableCell(zb_AskoziaFormatTime($eachcdat['time']), '', '', 'sorttable_customkey="' . $eachcdat['time'] . '"');
                         $grows .= wf_TableRow($gcells, 'row3');
                     }
                 }
             }
         }
         //total time stats
         $result = '';
         if (!empty($chartData)) {
             if (sizeof($chartData) >= 2) {
                 $gdata = __('Date') . ',' . __('Total') . ',' . __('Answered') . ',' . __('No answer') . "\n";
                 foreach ($chartData as $io => $each) {
                     @($gdata .= $io . ',' . ($each['answered'] + $each['noanswer']) . ',' . $each['answered'] . ',' . $each['noanswer'] . "\n");
                 }
                 $result .= wf_tag('div', false, '', '');
                 $result .= wf_tag('h2') . __('Stats') . wf_tag('h2', true) . wf_tag('br');
                 $result .= wf_Graph($gdata, '800', '200', false);
                 $result .= wf_tag('div', true);
                 $result .= wf_delimiter();
             }
         }
         $result .= __('Time spent on calls') . ': ' . zb_AskoziaFormatTime($totalTime) . wf_tag('br');
         $result .= __('Total') . ': ' . __('Answered') . ' / ' . __('No answer') . ': ' . $answerCounter . ' / ' . $noAnswerCounter . ' (' . zb_AskoziaPercentValue($answerCounter + $noAnswerCounter, $answerCounter) . '%)' . wf_tag('br');
         $result .= wf_tag('b') . __('Working hours') . ': ' . __('Answered') . ' / ' . __('No answer') . ': ' . $WorkHoursAnswerCounter . ' / ' . $WorkHoursNoAnswerCounter . ' (' . zb_AskoziaPercentValue($WorkHoursAnswerCounter + $WorkHoursNoAnswerCounter, $WorkHoursAnswerCounter) . '%)' . wf_tag('b', true) . wf_tag('br');
         $result .= __('Not working hours') . ': ' . __('Answered') . ' / ' . __('No answer') . ': ' . ($answerCounter - $WorkHoursAnswerCounter) . ' / ' . ($noAnswerCounter - $WorkHoursNoAnswerCounter) . ' (' . zb_AskoziaPercentValue($answerCounter - $WorkHoursAnswerCounter + ($noAnswerCounter - $WorkHoursNoAnswerCounter), $answerCounter - $WorkHoursAnswerCounter) . '%)' . wf_tag('br');
         $result .= __('Missing calls because of overlap with the previous by time') . ' (' . __('Working hours') . '): ' . $busycount . wf_tag('br');
         $result .= __('Total calls') . ': ' . $callsCounter;
         if (!empty($customCfg)) {
             @($result .= wf_delimiter() . wf_TableBody($grows, '100%', '0', 'sortable') . wf_delimiter());
         }
         $result .= wf_TableBody($rows, '100%', '0', 'sortable');
         show_window('', $result);
     }
 }