Exemplo n.º 1
0
 /**
  * Renders tags assign report
  * 
  * @return void
  */
 public function renderReport()
 {
     $result = $this->panel();
     $messages = new UbillingMessageHelper();
     $months = months_array_localized();
     $reportTmp = array();
     $totalCount = 0;
     if (!empty($this->allnames)) {
         $result .= wf_tag('br');
         $inputs = wf_YearSelector('reportyear', __('Year'), false) . ' ';
         $curTagid = wf_CheckPost(array('reporttagid')) ? vf($_POST['reporttagid'], 3) : '';
         $inputs .= wf_Selector('reporttagid', $this->allnames, __('Tag'), $curTagid, false) . ' ';
         $inputs .= wf_Submit(__('Show'));
         $result .= wf_Form('', 'POST', $inputs, 'glamour');
     } else {
         $result .= $messages->getStyledMessage(__('Nothing found'), 'info');
     }
     if (wf_CheckPost(array('reportyear', 'reporttagid'))) {
         $tagid = vf($_POST['reporttagid'], 3);
         $year = vf($_POST['reportyear'], 3);
         $datemask = $year . '-%';
         $query = "SELECT * from `weblogs` WHERE `date` LIKE '" . $datemask . "' AND `event` LIKE 'TAGADD (%' AND `event` LIKE '%TAGID%';";
         $raw = simple_queryall($query);
         if (!empty($raw)) {
             foreach ($raw as $io => $each) {
                 $eventtagid = preg_match("/\\[[^\\]]*\\]/", $each['event'], $matches);
                 @($eventtagid = vf($matches[0], 3));
                 if (!empty($eventtagid)) {
                     if ($eventtagid == $tagid) {
                         $eventTime = strtotime($each['date']);
                         $eventMonth = date("m", $eventTime);
                         if (!isset($reportTmp[$eventMonth])) {
                             $reportTmp[$eventMonth] = 1;
                         } else {
                             $reportTmp[$eventMonth]++;
                         }
                         $totalCount++;
                     }
                 }
             }
         }
         $cells = wf_TableCell($year);
         $cells .= wf_TableCell(__('Month'));
         $cells .= wf_TableCell($this->allnames[$tagid]);
         $cells .= wf_TableCell(__('Visual'));
         $rows = wf_TableRow($cells, 'row1');
         foreach ($months as $monthNumber => $monthName) {
             $cells = wf_TableCell($monthNumber);
             $cells .= wf_TableCell($monthName);
             $monthData = isset($reportTmp[$monthNumber]) ? $reportTmp[$monthNumber] : 0;
             $cells .= wf_TableCell($monthData);
             $cells .= wf_TableCell(web_bar($monthData, $totalCount), '', '', 'sorttable_customkey="' . $monthData . '"');
             $rows .= wf_TableRow($cells, 'row3');
         }
         $result .= wf_TableBody($rows, '100%', '0', 'sortable');
         $result .= wf_tag('b') . __('Total') . ':' . wf_tag('b', true) . ' ' . $totalCount;
     }
     show_window(__('Tags'), $result);
 }
Exemplo n.º 2
0
function web_MonthSelector()
{
    $mcells = '';
    $allmonth = months_array_localized();
    foreach ($allmonth as $io => $each) {
        if (isset($_GET['citysel'])) {
            if (isset($_GET['year'])) {
                $mcells .= wf_TableCell(wf_Link("?module=per_city_action&action=city_payments&monthsel=" . $io . "&year=" . $_GET['year'] . "&citysel=" . $_GET['citysel'], $each, false, 'ubButton'));
            } else {
                $mcells .= wf_TableCell(wf_Link("?module=per_city_action&action=city_payments&monthsel=" . $io . "&citysel=" . $_GET['citysel'], $each, false, 'ubButton'));
            }
        } elseif (isset($_GET['citysearch'])) {
            if (isset($_GET['year'])) {
                $mcells .= wf_TableCell(wf_Link("?module=per_city_action&action=city_payments&monthsel=" . $io . "&year=" . $_GET['year'] . "&citysearch=" . $_GET['citysearch'], $each, false, 'ubButton'));
            } else {
                $mcells .= wf_TableCell(wf_Link("?module=per_city_action&action=city_payments&monthsel=" . $io . "&citysearch=" . $_GET['citysearch'], $each, false, 'ubButton'));
            }
        } else {
            if (isset($_GET['year'])) {
                $mcells .= wf_TableCell(wf_Link("?module=per_city_action&action=city_payments&monthsel=" . $io . "&year=" . $_GET['year'], $each, false, 'ubButton'));
            } else {
                $mcells .= wf_TableCell(wf_Link("?module=per_city_action&action=city_payments&monthsel=" . $io, $each, false, 'ubButton'));
            }
        }
    }
    return $mcells;
}
Exemplo n.º 3
0
 /**
  * returns module control panel
  * 
  * @return string
  */
 protected function panel()
 {
     $result = wf_Link('?module=report_finance', __('Back'), false, 'ubButton');
     $result .= wf_modal(web_icon_settings() . ' ' . __('Settings'), __('Settings'), $this->configForm(), 'ubButton', '700', '200');
     $result .= wf_delimiter();
     $monthArr = months_array_localized();
     $inputs = wf_YearSelectorPreset('yearsel', __('Year'), false, $this->year);
     $inputs .= wf_Selector('monthsel', $monthArr, __('Month'), $this->month, false);
     $inputs .= wf_Submit(__('Show'));
     $result .= wf_Form('', 'POST', $inputs, 'glamour');
     $result .= wf_CleanDiv();
     return $result;
 }
Exemplo n.º 4
0
 /**
  * Renders report for some year
  * 
  * @return string
  */
 public function renderReport()
 {
     $result = '';
     $months = months_array_localized();
     $yearData = $this->loadStoredData();
     $inputs = wf_YearSelectorPreset('yearsel', __('Year'), false, $this->showYear) . ' ';
     $chartsFlag = wf_CheckPost(array('showcharts')) ? true : false;
     $inputs .= wf_CheckInput('showcharts', __('Graphs'), false, $chartsFlag) . ' ';
     $inputs .= wf_Submit(__('Show'));
     $yearForm = wf_Form('', 'POST', $inputs, 'glamour');
     $yearForm .= wf_CleanDiv();
     $result .= $yearForm;
     //charts presets
     $chartsOptions = "\n            'focusTarget': 'category',\n                        'hAxis': {\n                        'color': 'none',\n                            'baselineColor': 'none',\n                    },\n                        'vAxis': {\n                        'color': 'none',\n                            'baselineColor': 'none',\n                    },\n                        'curveType': 'function',\n                        'pointSize': 5,\n                        'crosshair': {\n                        trigger: 'none'\n                    },";
     $usersChartData = array(0 => array(__('Month'), __('Total'), __('Active'), __('Inactive'), __('Frozen'), __('Signups')));
     $complexChartData = array(0 => array(__('Month'), __('Total'), __('Active'), __('Inactive')));
     $financeChartsData = array(0 => array(__('Month'), __('Money'), __('Payments count'), __('ARPU'), __('ARPAU')));
     $ukvChartData = array(0 => array(__('Month'), __('Total'), __('Active'), __('Inactive'), __('Illegal'), __('Complex'), __('Social'), __('Signups')));
     $ukvfChartData = array(0 => array(__('Month'), __('Money'), __('Payments count'), __('ARPU'), __('ARPAU'), __('Debt')));
     $askoziaChartData = array(0 => array(__('Month'), __('Total calls'), __('Total answered'), __('No answer')));
     $equipChartData = array(0 => array(__('Month'), __('Switches'), __('PON ONU'), __('DOCSIS modems')));
     if (!empty($yearData)) {
         //internet users
         $cells = wf_TableCell(__('Month'));
         $cells .= wf_TableCell(__('Total'));
         $cells .= wf_TableCell(__('Active'));
         $cells .= wf_TableCell(__('Inactive'));
         $cells .= wf_TableCell(__('Frozen'));
         $cells .= wf_TableCell(__('Signups'));
         $rows = wf_TableRow($cells, 'row1');
         foreach ($yearData as $monthNum => $each) {
             $cells = wf_TableCell($months[$monthNum]);
             $cells .= wf_TableCell($each['u_totalusers']);
             $cells .= wf_TableCell($each['u_activeusers'] . ' (' . $this->percentValue($each['u_totalusers'], $each['u_activeusers']) . '%)');
             $cells .= wf_TableCell($each['u_inactiveusers'] . ' (' . $this->percentValue($each['u_totalusers'], $each['u_inactiveusers']) . '%)');
             $cells .= wf_TableCell($each['u_frozenusers'] . ' (' . $this->percentValue($each['u_totalusers'], $each['u_frozenusers']) . '%)');
             if (!empty($each['u_citysignups'])) {
                 $signupData = '';
                 $sigDataTmp = base64_decode($each['u_citysignups']);
                 $sigDataTmp = unserialize($sigDataTmp);
                 $citySigs = '';
                 $cityRows = '';
                 if (!empty($sigDataTmp)) {
                     $cityCells = wf_TableCell(__('City'));
                     $cityCells .= wf_TableCell(__('Signups'));
                     $cityRows .= wf_TableRow($cityCells, 'row1');
                     foreach ($sigDataTmp as $sigCity => $cityCount) {
                         $cityCells = wf_TableCell($sigCity);
                         $cityCells .= wf_TableCell($cityCount);
                         $cityRows .= wf_TableRow($cityCells, 'row3');
                     }
                     $citySigs .= wf_TableBody($cityRows, '100%', 0, '');
                 }
                 $signupData .= wf_modalAuto($each['u_signups'], __('Cities'), $citySigs);
             } else {
                 $signupData = $each['u_signups'];
             }
             $cells .= wf_TableCell($signupData);
             $rows .= wf_TableRow($cells, 'row3');
             //chart data
             $usersChartData[] = array($months[$monthNum], $each['u_totalusers'], $each['u_activeusers'], $each['u_inactiveusers'], $each['u_frozenusers'], $each['u_signups']);
         }
         $result .= wf_tag('h2') . __('Internets users') . wf_tag('h2', true);
         $result .= wf_TableBody($rows, '100%', 0, '');
         if ($chartsFlag) {
             $result .= wf_gchartsLine($usersChartData, __('Internets users'), '100%', '300px', $chartsOptions);
         }
         //complex data
         if ($this->complexFlag) {
             $result .= wf_tag('h2') . __('Complex services') . wf_tag('h2', true);
             $cells = wf_TableCell(__('Month'));
             $cells .= wf_TableCell(__('Total'));
             $cells .= wf_TableCell(__('Active'));
             $cells .= wf_TableCell(__('Inactive'));
             $rows = wf_TableRow($cells, 'row1');
             foreach ($yearData as $monthNum => $each) {
                 $cells = wf_TableCell($months[$monthNum]);
                 $cells .= wf_TableCell($each['u_complextotal']);
                 $cells .= wf_TableCell($each['u_complexactive'] . ' (' . $this->percentValue($each['u_complextotal'], $each['u_complexactive']) . '%)');
                 $cells .= wf_TableCell($each['u_complexinactive'] . ' (' . $this->percentValue($each['u_complextotal'], $each['u_complexinactive']) . '%)');
                 $rows .= wf_TableRow($cells, 'row3');
                 //chart data
                 $complexChartData[] = array($months[$monthNum], $each['u_complextotal'], $each['u_complexactive'], $each['u_complexinactive']);
             }
             $result .= wf_TableBody($rows, '100%', 0, '');
             if ($chartsFlag) {
                 $result .= wf_gchartsLine($complexChartData, __('Complex services'), '100%', '300px', $chartsOptions);
             }
         }
         //finance data
         $result .= wf_tag('h2') . __('Financial highlights') . wf_tag('h2', true);
         $cells = wf_TableCell(__('Month'));
         $cells .= wf_TableCell(__('Money'));
         $cells .= wf_TableCell(__('Payments count'));
         $cells .= wf_TableCell(__('Cash payments'));
         $cells .= wf_TableCell(__('Cash payments count'));
         $cells .= wf_TableCell(__('ARPU'));
         $cells .= wf_TableCell(__('ARPAU'));
         $rows = wf_TableRow($cells, 'row1');
         foreach ($yearData as $monthNum => $each) {
             $cells = wf_TableCell($months[$monthNum]);
             $cells .= wf_TableCell($each['f_totalmoney']);
             $cells .= wf_TableCell($each['f_paymentscount']);
             $cells .= wf_TableCell($each['f_cashmoney'] . ' (' . $this->percentValue($each['f_totalmoney'], $each['f_cashmoney']) . '%)');
             $cells .= wf_TableCell($each['f_cashcount'] . ' (' . $this->percentValue($each['f_paymentscount'], $each['f_cashcount']) . '%)');
             $cells .= wf_TableCell($each['f_arpu']);
             $cells .= wf_TableCell($each['f_arpau']);
             $rows .= wf_TableRow($cells, 'row3');
             //chart data
             $financeChartsData[] = array($months[$monthNum], $each['f_totalmoney'], $each['f_paymentscount'], $each['f_arpu'], $each['f_arpau']);
         }
         $result .= wf_TableBody($rows, '100%', 0, '');
         if ($chartsFlag) {
             $result .= wf_gchartsLine($financeChartsData, __('Financial highlights'), '100%', '300px', $chartsOptions);
         }
         // UKV cable users
         if ($this->ukvFlag) {
             $result .= wf_tag('h2') . __('UKV users') . wf_tag('h2', true);
             $cells = wf_TableCell(__('Month'));
             $cells .= wf_TableCell(__('Total'));
             $cells .= wf_TableCell(__('Active'));
             $cells .= wf_TableCell(__('Inactive'));
             $cells .= wf_TableCell(__('Illegal'));
             if ($this->complexFlag) {
                 $cells .= wf_TableCell(__('Complex'));
             }
             $cells .= wf_TableCell(__('Social'));
             $cells .= wf_TableCell(__('Signups'));
             $rows = wf_TableRow($cells, 'row1');
             foreach ($yearData as $monthNum => $each) {
                 $cells = wf_TableCell($months[$monthNum]);
                 $cells .= wf_TableCell($each['c_totalusers']);
                 $cells .= wf_TableCell($each['c_activeusers'] . ' (' . $this->percentValue($each['c_totalusers'], $each['c_activeusers']) . '%)');
                 $cells .= wf_TableCell($each['c_inactiveusers'] . ' (' . $this->percentValue($each['c_totalusers'], $each['c_inactiveusers']) . '%)');
                 $cells .= wf_TableCell($each['c_illegal'] . ' (' . $this->percentValue($each['c_totalusers'], $each['c_illegal']) . '%)');
                 if ($this->complexFlag) {
                     $cells .= wf_TableCell($each['c_complex'] . ' (' . $this->percentValue($each['c_totalusers'], $each['c_complex']) . '%)');
                 }
                 $cells .= wf_TableCell($each['c_social'] . ' (' . $this->percentValue($each['c_totalusers'], $each['c_social']) . '%)');
                 $cells .= wf_TableCell($each['c_signups']);
                 $rows .= wf_TableRow($cells, 'row3');
                 //chart data
                 $ukvChartData[] = array($months[$monthNum], $each['c_totalusers'], $each['c_activeusers'], $each['c_inactiveusers'], $each['c_illegal'], $each['c_complex'], $each['c_social'], $each['c_signups']);
             }
             $result .= wf_TableBody($rows, '100%', 0, '');
             if ($chartsFlag) {
                 $result .= wf_gchartsLine($ukvChartData, __('UKV users'), '100%', '300px', $chartsOptions);
             }
             //UKV financial data
             $result .= wf_tag('h2') . __('UKV finance') . wf_tag('h2', true);
             $cells = wf_TableCell(__('Month'));
             $cells .= wf_TableCell(__('Money'));
             $cells .= wf_TableCell(__('Payments count'));
             $cells .= wf_TableCell(__('ARPU'));
             $cells .= wf_TableCell(__('ARPAU'));
             $cells .= wf_TableCell(__('Debt'));
             $rows = wf_TableRow($cells, 'row1');
             foreach ($yearData as $monthNum => $each) {
                 $cells = wf_TableCell($months[$monthNum]);
                 $cells .= wf_TableCell($each['c_totalmoney']);
                 $cells .= wf_TableCell($each['c_paymentscount']);
                 $cells .= wf_TableCell($each['c_arpu']);
                 $cells .= wf_TableCell($each['c_arpau']);
                 $cells .= wf_TableCell($each['c_totaldebt']);
                 $rows .= wf_TableRow($cells, 'row3');
                 //chart data
                 $ukvfChartData[] = array($months[$monthNum], $each['c_totalmoney'], $each['c_paymentscount'], $each['c_arpu'], $each['c_arpau'], $each['c_totaldebt']);
             }
             $result .= wf_TableBody($rows, '100%', 0, '');
             if ($chartsFlag) {
                 $result .= wf_gchartsLine($ukvfChartData, __('UKV users'), '100%', '300px', $chartsOptions);
             }
         }
         //Askozia PBX
         if ($this->askoziaFlag) {
             $result .= wf_tag('h2') . __('AskoziaPBX integration') . wf_tag('h2', true);
             $cells = wf_TableCell(__('Month'));
             $cells .= wf_TableCell(__('Incoming calls'));
             $cells .= wf_TableCell(__('Total answered'));
             $cells .= wf_TableCell(__('No answer'));
             $cells .= wf_TableCell(__('Total duration'));
             $cells .= wf_TableCell(__('Average duration'));
             $cells .= wf_TableCell(__('Answers percent'));
             $rows = wf_TableRow($cells, 'row1');
             foreach ($yearData as $monthNum => $each) {
                 $cells = wf_TableCell($months[$monthNum]);
                 $cells .= wf_TableCell($each['a_totalcalls']);
                 $cells .= wf_TableCell($each['a_totalanswered']);
                 $cells .= wf_TableCell($each['a_totalcalls'] - $each['a_totalanswered']);
                 $cells .= wf_TableCell($this->formatTime($each['a_totalcallsduration']));
                 $cells .= wf_TableCell($this->formatTime($each['a_averagecallduration']));
                 $cells .= wf_TableCell($this->percentValue($each['a_totalcalls'], $each['a_totalanswered']) . '%');
                 $rows .= wf_TableRow($cells, 'row3');
                 //chart data
                 $askoziaChartData[] = array($months[$monthNum], $each['a_totalcalls'], $each['a_totalanswered'], $each['a_totalcalls'] - $each['a_totalanswered']);
             }
             $result .= wf_TableBody($rows, '100%', 0, '');
             if ($chartsFlag) {
                 $result .= wf_gchartsLine($askoziaChartData, __('Askozia'), '100%', '300px', $chartsOptions);
             }
         }
         //Equipment
         $result .= wf_tag('h2') . __('Equipment') . wf_tag('h2', true);
         $cells = wf_TableCell(__('Month'));
         $cells .= wf_TableCell(__('Switches'));
         if ($this->ponFlag) {
             $cells .= wf_TableCell(__('PON ONU'));
         }
         if ($this->docsisFlag) {
             $cells .= wf_TableCell(__('DOCSIS Modems'));
         }
         $rows = wf_TableRow($cells, 'row1');
         foreach ($yearData as $monthNum => $each) {
             $cells = wf_TableCell($months[$monthNum]);
             $cells .= wf_TableCell($each['e_switches']);
             if ($this->ponFlag) {
                 $cells .= wf_TableCell($each['e_pononu']);
             }
             if ($this->docsisFlag) {
                 $cells .= wf_TableCell($each['e_docsis']);
             }
             $rows .= wf_TableRow($cells, 'row3');
             //chart data
             $equipChartData[] = array($months[$monthNum], $each['e_switches'], $each['e_pononu'], $each['e_docsis']);
         }
         $result .= wf_TableBody($rows, '100%', 0, '');
         if ($chartsFlag) {
             $result .= wf_gchartsLine($equipChartData, __('Equipment'), '100%', '300px', $chartsOptions);
         }
     } else {
         $result .= $this->messages->getStyledMessage(__('Nothing found'), 'info');
     }
     return $result;
 }