Ejemplo n.º 1
0
 /**
  * Renders year-month search interface
  * 
  * @return void
  */
 function web_CardShowDateForm()
 {
     $curmonth = wf_CheckPost(array('monthsel')) ? vf($_POST['monthsel'], 3) : date("m");
     $curyear = wf_CheckPost(array('yearsel')) ? vf($_POST['yearsel'], 3) : date("Y");
     $inputs = wf_YearSelectorPreset('yearsel', __('Year'), false, $curyear) . ' ';
     $inputs .= wf_MonthSelector('monthsel', 'Month', $curmonth, false);
     $inputs .= wf_Submit('Show');
     $form = wf_Form("", 'POST', $inputs, 'glamour');
     show_window(__('Date'), $form);
 }
Ejemplo n.º 2
0
             $today = curdate();
             show_window(__('Today payments'), web_PaymentsShow("SELECT * from `payments` WHERE `date` LIKE '" . $today . "%' ORDER by `date` DESC;"));
         }
     } else {
         // show monthly payments
         $paymonth = mysql_real_escape_string($_GET['month']);
         show_window(__('Month payments'), web_PaymentsShow("SELECT * from `payments` WHERE `date` LIKE '" . $paymonth . "%'  ORDER by `date` DESC;"));
     }
 } else {
     //show finance analytics info
     if (wf_CheckPost(array('anyearsel'))) {
         $currentYear = $_POST['anyearsel'];
     } else {
         $currentYear = date("Y");
     }
     $yearinputs = wf_YearSelectorPreset('anyearsel', __('Year'), false, $currentYear) . ' ';
     $yearinputs .= wf_Submit(__('Show'));
     $yearform = wf_Form("", 'POST', $yearinputs, 'glamour');
     show_window(__('Analytics'), $yearform);
     $graphs = wf_Link("?module=report_finance", __('Back'), true, 'ubButton');
     $ubCache = new UbillingCache();
     //try to cache rendered charts
     $graphs .= $ubCache->getCallback('ANALYTICSCHARTS_' . $currentYear, function () {
         if (wf_CheckPost(array('anyearsel'))) {
             $currentYear = $_POST['anyearsel'];
         } else {
             $currentYear = date("Y");
         }
         return web_AnalyticsAllGraphs($currentYear);
     }, 3600);
     show_window('', $graphs);
Ejemplo n.º 3
0
 /**
  * Returns openpayz search form
  * 
  * @return string
  */
 public function renderSearchForm()
 {
     $curYear = wf_CheckPost(array('searchyear')) ? vf($_POST['searchyear'], 3) : date("Y");
     $curMonth = wf_CheckPost(array('searchmonth')) ? vf($_POST['searchmonth'], 3) : date("m");
     $curPaysys = wf_CheckPost(array('searchpaysys')) ? vf($_POST['searchpaysys']) : '';
     /**
      * No lights, no sights, every fright, every night
      * Alone, hurt and cold, she‘s shackled to the pipes
      */
     $paySysSelector['ANY'] = __('All');
     $paySysSelector += $this->allPaySys;
     $inputs = wf_YearSelectorPreset('searchyear', __('Year'), false, $curYear) . ' ';
     $inputs .= wf_MonthSelector('searchmonth', __('Month'), $curMonth, false) . ' ';
     $inputs .= wf_Selector('searchpaysys', $paySysSelector, __('Payment system'), $curPaysys, false) . ' ';
     $inputs .= wf_Submit(__('Search'));
     $result = wf_Form("", 'POST', $inputs, 'glamour');
     return $result;
 }
Ejemplo n.º 4
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;
 }
Ejemplo n.º 5
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;
 }