Changeset 765


Ignore:
Timestamp:
Feb 14, 2015 10:38:40 AM (10 years ago)
Author:
dungnv
Message:
 
Location:
pro-violet-viettel/sourcecode
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/sourcecode/application/modules/admin/controllers/user.php

    r742 r765  
    1 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
     1<?php
    22
    3 class User extends MX_Controller
    4 {
    5        
     3if (! defined ( 'BASEPATH' ))
     4        exit ( 'No direct script access allowed' );
     5
     6class User extends MX_Controller {
    67        const TOKENPW = 'violet';
    7        
    8         public function __construct()
    9         {
    10                 parent::__construct();
    11                 $this->load->helper('cookie');
     8        public function __construct() {
     9                parent::__construct ();
     10                $this->load->helper ( 'cookie' );
     11                $this->load->helper('language');
     12                $this->lang->load('messages', 'message');
    1213        }
    1314       
    14         public function index()
    15         {
    16                 $admin_info = $this->session->userdata('adminInfo');
    17                 if ($admin_info)
    18                 {
    19                         $data['content'] = $this->get_users();
    20                         $this->load->view('user/index', $data);
    21                 }else
    22                 {
    23                         $this->load->view('login');
     15        public function index() {
     16                $admin_info = $this->session->userdata ( 'adminInfo' );
     17                if ($admin_info) {
     18                        $data ['content'] = $this->get_users ();
     19                        $this->load->view ( 'user/index', $data );
     20                } else {
     21                        $this->load->view ( 'login' );
    2422                }
    2523        }
    2624       
    27         public function get_users()
    28         {
    29                 $this->load->helper('pagging');
    30                 $this->load->model('user_model');
    31                 $data['current_page'] = $this->uri->segment(4, 1);
    32                 $data['itemsoptions'] = array(10, 25, 50, 100);
    33                 $data['perpage'] = 10;
    34                 $data['statusoptions'] = array(0=>"Tất cả", 1=>"Đã đăng kÜ", 2=>"Dùng thá»­");
    35                 $data['status'] = 0;
    36                 if ($this->input->post('status'))
    37                 {
    38                         $data['status'] = (int)$this->input->post('status') ;
     25        public function get_users() {
     26                $this->load->helper ( 'pagging' );
     27                $this->load->model ( 'user_model' );
     28                $provinces = lang('_PROVINCES_');
     29                error_log(var_export($provinces, TRUE), 3, '/srv/www/sbg/log/provinces.log');
     30               
     31                $data ['current_page'] = $this->uri->segment ( 4, 1 );
     32                $data ['itemsoptions'] = array (
     33                                10,
     34                                25,
     35                                50,
     36                                100
     37                );
     38                $data ['perpage'] = 10;
     39                $data ['statusoptions'] = array (
     40                                0 => "Tất cả",
     41                                1 => "Đã đăng kÜ",
     42                                2 => "Dùng thá»­"
     43                );
     44                $data ['status'] = 0;
     45                if ($this->input->post ( 'status' )) {
     46                        $data ['status'] = ( int ) $this->input->post ( 'status' );
    3947                }
    40                 $data['keyword'] = "";
    41                 $data['sorting_order']="sorting_desc";
    42         $data['sorting_field']="created_time";
    43                 if ($this->input->post('sorting_order')) {
    44                         if ($this->input->post('sorting_order') != "sorting")
    45                         {
    46                                 $data['sorting_order'] = $this->input->post('sorting_order');
    47                                 $data['sorting_field'] = $this->input->post('sorting_field');
     48                $data ['keyword'] = "";
     49                $data ['sorting_order'] = "sorting_desc";
     50                $data ['sorting_field'] = "created_time";
     51                if ($this->input->post ( 'sorting_order' )) {
     52                        if ($this->input->post ( 'sorting_order' ) != "sorting") {
     53                                $data ['sorting_order'] = $this->input->post ( 'sorting_order' );
     54                                $data ['sorting_field'] = $this->input->post ( 'sorting_field' );
    4855                        }
    4956                }
    50                 if ($this->input->post('items'))
    51                 {
    52                         $data['perpage'] = $this->input->post('items');
     57                if ($this->input->post ( 'items' )) {
     58                        $data ['perpage'] = $this->input->post ( 'items' );
    5359                }
    54                 if ($this->input->post('keyword')) {
    55             $data['keyword'] = $this->input->post('keyword');
    56         }
    57                 $data['daterange_start'] = "";
    58                 $data['daterange_end'] = "";
    59                 if ($this->input->post('daterange')){
    60                         $daterange = explode(" - ", $this->input->post('daterange'));
    61                         $daterange[0] = str_replace('/', '-', $daterange[0]);
    62                         $daterange[1] = str_replace('/', '-', $daterange[1]);
    63                         $data['daterange_start'] = date('Y-m-d H:i:s', strtotime($daterange[0]));
    64                         $data['daterange_end'] = date('Y-m-d H:is:s', strtotime($daterange[1].' + 1 day'));
     60                if ($this->input->post ( 'keyword' )) {
     61                        $data ['keyword'] = $this->input->post ( 'keyword' );
    6562                }
    66                 $data['start'] = ($data['current_page'] - 1) * $data['perpage'];
    67                 $data['total'] = $this->user_model->get_total_users($data);
    68                 $us = $this->user_model->get_list_users($data);
    69                 $users = array();
     63                $data ['daterange_start'] = "";
     64                $data ['daterange_end'] = "";
     65                if ($this->input->post ( 'daterange' )) {
     66                        $daterange = explode ( " - ", $this->input->post ( 'daterange' ) );
     67                        $daterange [0] = str_replace ( '/', '-', $daterange [0] );
     68                        $daterange [1] = str_replace ( '/', '-', $daterange [1] );
     69                        $data ['daterange_start'] = date ( 'Y-m-d H:i:s', strtotime ( $daterange [0] ) );
     70                        $data ['daterange_end'] = date ( 'Y-m-d H:is:s', strtotime ( $daterange [1] . ' + 1 day' ) );
     71                }
     72                $data ['start'] = ($data ['current_page'] - 1) * $data ['perpage'];
     73                $data ['total'] = $this->user_model->get_total_users ( $data );
     74                $us = $this->user_model->get_list_users ( $data );
     75                $users = array ();
    7076               
    71                 foreach($us as $u) {
    72                         $id = $u['us_id'];
    73                         //$username = $this->get_username($id);
    74                         $userinfo = $this->get_userinfo($id);
    75                         if($userinfo){
    76                                 $u['username'] = $userinfo['username'];
    77                                 $u['province'] = $userinfo['province'];
    78                                 array_push($users, $u);
     77                foreach ( $us as $u ) {
     78                        $u ['province'] = isset($provinces[$u ['province']]) ? $provinces[$u ['province']] : $u ['province'];
     79                        $userinfo = $this->get_userinfo ( $u ['us_id'] );
     80                        if ($userinfo) {
     81                                $u ['username'] = $userinfo ['username'];
    7982                        }
     83                        array_push ( $users, $u );
    8084                }
    8185               
    82                 $data['users'] = $users;
    83                 $data['paging_url'] = base_url() . "admin/nguoi_dung/trang/";
    84                 $data['num_links'] = 2;
    85                 $data['paging'] = pagging($data);
    86                 if ($this->input->is_ajax_request())
    87                 {
    88                         return $this->load->view('user/listview', $data);
     86                $data ['users'] = $users;
     87                $data ['paging_url'] = base_url () . "admin/nguoi_dung/trang/";
     88                $data ['num_links'] = 2;
     89                $data ['paging'] = pagging ( $data );
     90               
     91                if ($this->input->is_ajax_request ()) {
     92                        return $this->load->view ( 'user/listview', $data );
    8993                }
    90                 return $this->load->view('user/listview', $data, true);
     94                return $this->load->view ( 'user/listview', $data, true );
    9195        }
    9296       
    93         public function edit_user()
    94         {
    95                 $admin_info = $this->session->userdata('adminInfo');
    96                 if ($admin_info)
    97                 {
    98                         $input = $this->input->post();
    99                         $result = array();
    100                         $result['success'] = 0;
    101                         $us_id = (int)$this->uri->segment(4, 0);
    102                         if ($us_id==0){
    103                                 $result['success'] = 0;
    104                         }else
    105                         {
    106                                 $this->load->model('user_model');
    107                                 $input['updated_time'] = date("Y-m-d H:i:s");
    108                                 $this->user_model->update($us_id, $input);
    109                                 $result['success'] = 1;
     97        public function edit_user() {
     98                $admin_info = $this->session->userdata ( 'adminInfo' );
     99                if ($admin_info) {
     100                        $input = $this->input->post ();
     101                        $result = array ();
     102                        $result ['success'] = 0;
     103                        $us_id = ( int ) $this->uri->segment ( 4, 0 );
     104                        if ($us_id == 0) {
     105                                $result ['success'] = 0;
     106                        } else {
     107                                $this->load->model ( 'user_model' );
     108                                $input ['updated_time'] = date ( "Y-m-d H:i:s" );
     109                                $this->user_model->update ( $us_id, $input );
     110                                $result ['success'] = 1;
    110111                        }
    111                         echo json_encode($result);
    112                 }else
    113                 {
    114                         $this->load->view('login');
     112                        echo json_encode ( $result );
     113                } else {
     114                        $this->load->view ( 'login' );
    115115                }
    116116        }
    117117       
    118         public function delete_user()
    119         {
    120                 $admin_info = $this->session->userdata('adminInfo');
    121                 if ($admin_info)
    122                 {
    123                         $result = array();
    124                         $result['success'] = 0;
    125                         $us_id = (int)$this->uri->segment(4, 0);
    126                         if ($us_id == 0){
    127                                 $result['success'] = 0;
    128                         }else
    129                         {
    130                                 $this->load->model('user_model');
    131                                 $this->user_model->delete($us_id);
    132                                 $result['success'] = 1;
     118        public function delete_user() {
     119                $admin_info = $this->session->userdata ( 'adminInfo' );
     120                if ($admin_info) {
     121                        $result = array ();
     122                        $result ['success'] = 0;
     123                        $us_id = ( int ) $this->uri->segment ( 4, 0 );
     124                        if ($us_id == 0) {
     125                                $result ['success'] = 0;
     126                        } else {
     127                                $this->load->model ( 'user_model' );
     128                                $this->user_model->delete ( $us_id );
     129                                $result ['success'] = 1;
    133130                        }
    134                         echo json_encode($result);
    135                 }else
    136                 {
    137                         $this->load->view('login');
     131                        echo json_encode ( $result );
     132                } else {
     133                        $this->load->view ( 'login' );
    138134                }
    139135        }
    140136       
    141         public function get_user_by_id()
    142         {
    143                 $admin_info = $this->session->userdata('adminInfo');
    144                 if ($admin_info)
    145                 {
    146                         $result = array();
    147                         $result['success'] = 0;
    148                         $us_id = (int)$this->uri->segment(4, 0);
    149                         if ($us_id == 0)
    150                         {
    151                                 $result['success'] = 0;
    152                         }else
    153                         {
    154                                 $this->load->model('user_model');
    155                                 $data = $this->user_model->search_by_id($us_id);
    156                                 $result['item'] = $data;
    157                                 $result['success'] = 1;
     137        public function get_user_by_id() {
     138                $admin_info = $this->session->userdata ( 'adminInfo' );
     139                if ($admin_info) {
     140                        $result = array ();
     141                        $result ['success'] = 0;
     142                        $us_id = ( int ) $this->uri->segment ( 4, 0 );
     143                        if ($us_id == 0) {
     144                                $result ['success'] = 0;
     145                        } else {
     146                                $this->load->model ( 'user_model' );
     147                                $data = $this->user_model->search_by_id ( $us_id );
     148                                $result ['item'] = $data;
     149                                $result ['success'] = 1;
    158150                        }
    159                         echo json_encode($result);
    160                 }else
    161                 {
    162                         $this->load->view('login');
     151                        echo json_encode ( $result );
     152                } else {
     153                        $this->load->view ( 'login' );
    163154                }
    164155        }
    165156       
    166         private function get_userinfo($us_id)
    167         {
     157        private function get_userinfo($us_id) {
    168158                $src = 'violet';
    169                 $token = md5($us_id.self::TOKENPW);
    170                 $this->load->model('user_model');
    171                 $data = $this->user_model->get_user_info($src, $us_id, $token);
    172                 //var_dump($data);
    173                 $result = array();
    174                 parse_str($data, $result);
     159                $token = md5 ( $us_id . self::TOKENPW );
     160                $this->load->model ( 'user_model' );
     161                $data = $this->user_model->get_user_info ( $src, $us_id, $token );
     162                // var_dump($data);
     163                $result = array ();
     164                parse_str ( $data, $result );
    175165                return $result;
    176166                /*
    177                 if (strpos($data, '&')){
    178                         $arr_users = explode("&", $data);
    179                         $str_username = $arr_users[1];
    180                         $arr_username = explode("=", $str_username);
    181                         return $arr_username[1];
    182                 }else
    183                 {
    184                         return "";
    185                 }*/
    186 
     167                 * if (strpos($data, '&')){ $arr_users = explode("&", $data); $str_username = $arr_users[1]; $arr_username = explode("=", $str_username); return $arr_username[1]; }else { return ""; }
     168                 */
    187169        }
    188        
    189170}
  • pro-violet-viettel/sourcecode/application/modules/admin/models/reportmodel.php

    r764 r765  
    11<?php
    2 
    3 if (!defined('BASEPATH'))
    4     exit('No direct script access allowed');
     2if (! defined ( 'BASEPATH' ))
     3        exit ( 'No direct script access allowed' );
    54
    65class Reportmodel extends MY_Model {
    7 
    8     protected $table_name = 'tblpaidlog';
    9     protected $id_name = 'id';
    10 
    11     function __construct() {
    12         parent::__construct();
    13         $this->load->helper('language');
    14         $this->lang->load('messages', 'message');
    15     }
    16 
    17     function getProvinces($input) {
    18 
    19         $from="tblpaidlog.paid_time >= '" . $input['year'] . "-" . $input['month'] . "-" . $input['date'] . " 00:00:00'";
    20         $to="tblpaidlog.paid_time <= '" . $input['to_year'] . "-" . $input['to_month'] . "-" . $input['to_date'] . " 23:59:59'";
    21        
    22         $provinces = lang('_PROVINCES_');
    23         // Tinh doanh thu theo tinh theo nam
    24         $sql = "SELECT *,SUM(amount) as total FROM tblpaidlog LEFT JOIN tbluser ON tbluser.us_id=tblpaidlog.us_id WHERE tblpaidlog.paid_time >= '" . $input['year'] . "-01-01' AND tblpaidlog.paid_time <= '" . ($input['year'] + 1) . "-01-01' GROUP BY tbluser.province";
    25         $query = $this->db->query($sql);
    26         $dtns = $query->result_array();
    27        
    28         // tinh doanh thu theo thang
    29         $sql = "SELECT *,SUM(amount) as total FROM tblpaidlog LEFT JOIN tbluser ON tbluser.us_id=tblpaidlog.us_id WHERE $from AND $to  GROUP BY tbluser.province";
    30         $query = $this->db->query($sql);
    31         $dtts = $query->result_array();
    32        
    33         // tinh doanh thu trong ngay hien tai
    34         if (isset($input['to_month']))
    35         {
    36         $sql = "SELECT *,SUM(amount) as total FROM tblpaidlog LEFT JOIN tbluser ON tbluser.us_id=tblpaidlog.us_id WHERE tblpaidlog.paid_time >= '" . $input['to_year'] . "-" . $input['to_month'] . "-".$input['to_date']." 00:00:00' AND  tblpaidlog.paid_time <= '" . $input['to_year'] . "-" . $input['to_month'] . "-".$input['to_date']." 23:59:59'  GROUP BY tbluser.province";
    37         }
    38         $query = $this->db->query($sql);
    39         $dtng = $query->result_array();
    40 
    41         // Tinh thue bao theo tinh theo nam
    42         $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >= '" . $input['year'] . "-01-01' AND tbluser.created_time <= '" . ($input['year'] + 1) . "-01-01' GROUP BY tbluser.province";
    43         $query = $this->db->query($sql);
    44         $tbns = $query->result_array();
    45 
    46         // tinh thue bao theo thang
    47         $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE $from AND  $to GROUP BY tbluser.province";
    48         $query = $this->db->query($sql);
    49         $tbts = $query->result_array();
    50        
    51          // tinh thue bao theo ngay
    52         $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >='" . $input['to_year'] . "-" . $input['to_month'] . "-".$input['to_date']." 00:00:00' AND tbluser.created_time <= '" . $input['to_year'] . "-" . $input['to_month'] . "-".$input['to_date']." 23:59:59'  GROUP BY tbluser.province";
    53        
    54         $query = $this->db->query($sql);
    55         $tbng = $query->result_array();
    56        
    57 
    58         $dem=1;
    59         foreach ($provinces as $index2 => $province) {
    60             $provinces[$index2] = array("stt" => ($dem), "province" => $province, "dtn" => 0, "dtt" => 0, "dtng" => 0, "tbn" => 0, "tbt" => 0, "tbng" => 0);
    61             foreach ($dtns as $data) {
    62                 if ($index2 == $data['province']) {
    63                     $provinces[$index2]['dtn'] = $data['total'];
    64                 }
    65             }
    66             foreach ($dtng as $data) {
    67                 if ($index2 == $data['province']) {
    68                     $provinces[$index2]['dtng'] = $data['total'];
    69                 }
    70             }
    71             foreach ($dtts as $data) {
    72                 if ($index2 == $data['province']) {
    73                     $provinces[$index2]['dtt'] = $data['total'];
    74                    
    75                 }
    76             }
    77 
    78             foreach ($tbns as $data) {
    79                 if ($index2 == $data['province']) {
    80                     $provinces[$index2]['tbn'] = $data['total'];
    81                 }
    82             }
    83             foreach ($tbng as $data) {
    84                 if ($index2 == $data['province']) {
    85                     $provinces[$index2]['tbng'] = $data['total'];
    86                 }
    87             }
    88             foreach ($tbts as $data) {
    89                 if ($index2 == $data['province']) {
    90                     $provinces[$index2]['tbt'] = $data['total'];
    91                 }
    92             }
    93             $dem++;
    94         }
    95        
    96         return $provinces;
    97     }
    98 
    99     function getPackages($input) {
    100 
    101         $provinces = lang('_PROVINCES_');
    102         // tinh thue bao theo thang
    103         $sql = "SELECT * FROM tbluser LEFT JOIN tblservicepackage ON tbluser.p_id=tblservicepackage.p_id  WHERE tbluser.created_time >= '" . $input['year'] . "-" . $input['month'] . "-" . $input['date'] . "' AND tbluser.created_time <= '" . $input['to_year'] . "-" . $input['to_month'] . "-" . $input['to_date'] . "' AND tblservicepackage.p_period > 0 ";
    104         $query = $this->db->query($sql);
    105         $users = $query->result_array();
    106 
    107 
    108         $sql = "SELECT * FROM tblservicepackage WHERE p_period>0";
    109         $query = $this->db->query($sql);
    110         $packages = $query->result_array();
    111         foreach ($packages as $index => $package) {
    112             $packages[$index]['users'] = array();
    113             foreach ($users as $user) {
    114                 if ($user['p_id'] == $package['p_id']) {
    115                     $packages[$index]['users'][] = $user;
    116                 }
    117             }
    118         }
    119 
    120         foreach ($provinces as $index => $province) {
    121             $provinces[$index] = array("province" => $province);
    122         }
    123         $dem=1;
    124         foreach ($provinces as $index => $province) {
    125             $provinces[$index]['stt'] = $dem;
    126             $provinces[$index]['total'] = 0;
    127             $totaluser = 0;
    128             foreach ($packages as $index2 => $package) {
    129                 $provinces[$index]['packages'][$package['p_name']]['users'] = array();
    130                 $provinces[$index]['packages'][$package['p_name']]['total'] = 0;
    131                 $total = 0;
    132                 foreach ($package['users'] as $user) {
    133                     if ($index == $user['province']) {
    134                         $total = $total + 1;
    135                         $totaluser = $totaluser + 1;
    136                         $provinces[$index]['total'] = $totaluser;
    137                         $provinces[$index]['packages'][$package['p_name']]['total'] = $total;
    138 
    139                         $provinces[$index]['packages'][$package['p_name']]['users'][] = $user;
    140                     }
    141                 }
    142             }
    143             $dem++;
    144         }
    145         foreach ($provinces as $index => $province) {
    146             foreach ($packages as $index2 => $package) {
    147                 $provinces[$index]['packages'][$package['p_name']]['percent'] = 0;
    148                 if ($provinces[$index]['packages'][$package['p_name']]['total'] > 0 && $province['total'] > 0) {
    149                     $provinces[$index]['packages'][$package['p_name']]['percent'] = round($provinces[$index]['packages'][$package['p_name']]['total'] / $province['total'], 2) * 100;
    150                 }
    151             }
    152         }
    153 
    154         $data['packages'] = $packages;
    155         $data['provinces'] = $provinces;
    156         return $data;
    157     }
    158     public function exportProvince($input)
    159     {   
    160         //$input['date']=1;
    161         //$input['month']=1;
    162         //$input['year']=2014;
    163         //$input['to_month']=1;
    164         //$input['to_year']=2015;
    165         //$input['to_date']=15;
    166         if (isset($input['to_month']))
    167         {
    168             $date=$input['to_year'].$input['to_month'].$input['to_date'];
    169         }
    170         else {
    171             $date=date("Ymd");
    172         }
    173         $provinces=array();
    174         $data=$this->getProvinces($input);
    175         foreach ($data as $index=>$province)
    176         {
    177             $provinces[]=array("stt"=>$province['stt'],"ngay"=>$date,"ma"=>$index,"tinh"=>$province['province'],"thue_bao_ngay"=>$province['tbng'],"thue_bao_thang"=>$province['tbt'],"thue_bao_nam"=>$province['tbn'],"doanh_thu_ngay"=>$province['dtng'],"doanh_thu_thang"=>$province['dtt'],"doanh_thu_nam"=>$province['dtn']);
    178         }
    179         return $provinces;
    180     }
    181     public function exportPackage($input)
    182     {
    183        // $input['date']=1;
    184         //$input['month']=1;
    185       //  $input['year']=2014;
    186       // $input['to_month']=1;
    187        // $input['to_year']=2015;
    188        // $input['to_date']=15;
    189         if (isset($input['month']))
    190         {
    191             $date=$input['year'].$input['month'];
    192         }
    193         else {
    194             $date=date("Ym");
    195         }
    196         $result=array();
    197         $data=$this->getPackages($input);
    198         $data=$data['provinces'];
    199         foreach ($data as $index=>$province)
    200         {
    201                 $package=array();
    202                 foreach ($province['packages'] as $index2=>$packages)
    203                 {
    204                     $package=  array_merge($package,array("tong_so_".$index2=>$packages['total'],"ti_le_".$index2=>$packages['percent']));
    205                 }
    206                 $tong=array("tong_so_tb"=>$province['total']);
    207                 $province=array("stt"=>$province['stt'],"ngay"=>$date,"ma"=>$index,"tinh"=>$province['province']);
    208                 $provinces[]= array_merge($province,$package,$tong);
    209         }
    210         return $provinces;
    211     }
    212 
     6       
     7        protected $table_name = 'tblpaidlog';   
     8        protected $id_name = 'id';
     9       
     10        /**
     11         *
     12         */
     13        function __construct() {
     14                parent::__construct ();
     15                $this->load->helper ( 'language' );
     16                $this->lang->load ( 'messages', 'message' );
     17        }
     18       
     19        /**
     20         *
     21         * @param unknown $input
     22         * @return Ambigous <multitype:number unknown , unknown, string>
     23         */
     24        function getProvinces($input) {
     25                $from = "tblpaidlog.paid_time >= '" . $input ['year'] . "-" . $input ['month'] . "-" . $input ['date'] . " 00:00:00'";
     26                $to = "tblpaidlog.paid_time <= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" . $input ['to_date'] . " 23:59:59'";
     27               
     28                $provinces = lang ( '_PROVINCES_' );
     29                // Tinh doanh thu theo tinh theo nam
     30                $sql = "SELECT *,SUM(amount) as total FROM tblpaidlog LEFT JOIN tbluser ON tbluser.us_id=tblpaidlog.us_id WHERE tblpaidlog.paid_time >= '" . $input ['year'] . "-01-01' AND tblpaidlog.paid_time <= '" . ($input ['year'] + 1) . "-01-01' GROUP BY tbluser.province";
     31                $query = $this->db->query ( $sql );
     32                $dtns = $query->result_array ();
     33               
     34                // tinh doanh thu theo thang
     35                $sql = "SELECT *,SUM(amount) as total FROM tblpaidlog LEFT JOIN tbluser ON tbluser.us_id=tblpaidlog.us_id WHERE $from AND $to  GROUP BY tbluser.province";
     36                $query = $this->db->query ( $sql );
     37                $dtts = $query->result_array ();
     38               
     39                // tinh doanh thu trong ngay hien tai
     40                if (isset ( $input ['to_month'] )) {
     41                        $sql = "SELECT *,SUM(amount) as total FROM tblpaidlog LEFT JOIN tbluser ON tbluser.us_id=tblpaidlog.us_id WHERE tblpaidlog.paid_time >= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" . $input ['to_date'] . " 00:00:00' AND  tblpaidlog.paid_time <= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" . $input ['to_date'] . " 23:59:59'  GROUP BY tbluser.province";
     42                }
     43                $query = $this->db->query ( $sql );
     44                $dtng = $query->result_array ();
     45               
     46                // Tinh thue bao theo tinh theo nam
     47                $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >= '" . $input ['year'] . "-01-01' AND tbluser.created_time <= '" . ($input ['year'] + 1) . "-01-01' GROUP BY tbluser.province";
     48                $query = $this->db->query ( $sql );
     49                $tbns = $query->result_array ();
     50               
     51                // tinh thue bao theo thang
     52                $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE $from AND  $to GROUP BY tbluser.province";
     53                $query = $this->db->query ( $sql );
     54                $tbts = $query->result_array ();
     55               
     56                // tinh thue bao theo ngay
     57                $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >='" . $input ['to_year'] . "-" . $input ['to_month'] . "-" . $input ['to_date'] . " 00:00:00' AND tbluser.created_time <= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" . $input ['to_date'] . " 23:59:59'  GROUP BY tbluser.province";
     58               
     59                $query = $this->db->query ( $sql );
     60                $tbng = $query->result_array ();
     61               
     62                $dem = 1;
     63               
     64                foreach ( $provinces as $index2 => $province ) {
     65                        $provinces [$index2] = array (
     66                                        "stt" => ($dem),
     67                                        "province" => $province,
     68                                        "dtn" => 0,
     69                                        "dtt" => 0,
     70                                        "dtng" => 0,
     71                                        "tbn" => 0,
     72                                        "tbt" => 0,
     73                                        "tbng" => 0
     74                        );
     75                        foreach ( $dtns as $data ) {
     76                                if ($index2 == $data ['province']) {
     77                                        $provinces [$index2] ['dtn'] = $data ['total'];
     78                                }
     79                        }
     80                        foreach ( $dtng as $data ) {
     81                                if ($index2 == $data ['province']) {
     82                                        $provinces [$index2] ['dtng'] = $data ['total'];
     83                                }
     84                        }
     85                        foreach ( $dtts as $data ) {
     86                                if ($index2 == $data ['province']) {
     87                                        $provinces [$index2] ['dtt'] = $data ['total'];
     88                                }
     89                        }
     90                       
     91                        foreach ( $tbns as $data ) {
     92                                if ($index2 == $data ['province']) {
     93                                        $provinces [$index2] ['tbn'] = $data ['total'];
     94                                }
     95                        }
     96                        foreach ( $tbng as $data ) {
     97                                if ($index2 == $data ['province']) {
     98                                        $provinces [$index2] ['tbng'] = $data ['total'];
     99                                }
     100                        }
     101                        foreach ( $tbts as $data ) {
     102                                if ($index2 == $data ['province']) {
     103                                        $provinces [$index2] ['tbt'] = $data ['total'];
     104                                }
     105                        }
     106                        $dem ++;
     107                }
     108               
     109                return $provinces;
     110        }
     111       
     112        /**
     113         *
     114         * @param unknown $input
     115         * @return Ambigous <multitype:, number, string>
     116         */
     117        function getPackages($input) {
     118                $provinces = lang ( '_PROVINCES_' );
     119                // tinh thue bao theo thang
     120                $sql = "SELECT * FROM tbluser LEFT JOIN tblservicepackage ON tbluser.p_id=tblservicepackage.p_id  WHERE tbluser.created_time >= '" . $input ['year'] . "-" . $input ['month'] . "-" . $input ['date'] . "' AND tbluser.created_time <= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" . $input ['to_date'] . "' AND tblservicepackage.p_period > 0 ";
     121                $query = $this->db->query ( $sql );
     122                $users = $query->result_array ();
     123               
     124                $sql = "SELECT * FROM tblservicepackage WHERE p_period>0";
     125                $query = $this->db->query ( $sql );
     126                $packages = $query->result_array ();
     127                foreach ( $packages as $index => $package ) {
     128                        $packages [$index] ['users'] = array ();
     129                        foreach ( $users as $user ) {
     130                                if ($user ['p_id'] == $package ['p_id']) {
     131                                        $packages [$index] ['users'] [] = $user;
     132                                }
     133                        }
     134                }
     135               
     136                foreach ( $provinces as $index => $province ) {
     137                        $provinces [$index] = array (
     138                                        "province" => $province
     139                        );
     140                }
     141                $dem = 1;
     142                foreach ( $provinces as $index => $province ) {
     143                        $provinces [$index] ['stt'] = $dem;
     144                        $provinces [$index] ['total'] = 0;
     145                        $totaluser = 0;
     146                        foreach ( $packages as $index2 => $package ) {
     147                                $provinces [$index] ['packages'] [$package ['p_name']] ['users'] = array ();
     148                                $provinces [$index] ['packages'] [$package ['p_name']] ['total'] = 0;
     149                                $total = 0;
     150                                foreach ( $package ['users'] as $user ) {
     151                                        if ($index == $user ['province']) {
     152                                                $total = $total + 1;
     153                                                $totaluser = $totaluser + 1;
     154                                                $provinces [$index] ['total'] = $totaluser;
     155                                                $provinces [$index] ['packages'] [$package ['p_name']] ['total'] = $total;
     156                                               
     157                                                $provinces [$index] ['packages'] [$package ['p_name']] ['users'] [] = $user;
     158                                        }
     159                                }
     160                        }
     161                        $dem ++;
     162                }
     163                foreach ( $provinces as $index => $province ) {
     164                        foreach ( $packages as $index2 => $package ) {
     165                                $provinces [$index] ['packages'] [$package ['p_name']] ['percent'] = 0;
     166                                if ($provinces [$index] ['packages'] [$package ['p_name']] ['total'] > 0 && $province ['total'] > 0) {
     167                                        $provinces [$index] ['packages'] [$package ['p_name']] ['percent'] = round ( $provinces [$index] ['packages'] [$package ['p_name']] ['total'] / $province ['total'], 2 ) * 100;
     168                                }
     169                        }
     170                }
     171               
     172                $data ['packages'] = $packages;
     173                $data ['provinces'] = $provinces;
     174                return $data;
     175        }
     176       
     177        /**
     178         *
     179         * @param unknown $input
     180         * @return multitype:multitype:unknown string Ambigous <Ambigous, multitype:number unknown , unknown, string>
     181         */
     182        public function exportProvince($input) {
     183                // $input['date']=1;
     184                // $input['month']=1;
     185                // $input['year']=2014;
     186                // $input['to_month']=1;
     187                // $input['to_year']=2015;
     188                // $input['to_date']=15;
     189                if (isset ( $input ['to_month'] )) {
     190                        $date = $input ['to_year'] . $input ['to_month'] . $input ['to_date'];
     191                } else {
     192                        $date = date ( "Ymd" );
     193                }
     194                $provinces = array ();
     195                $data = $this->getProvinces ( $input );
     196                foreach ( $data as $index => $province ) {
     197                        $provinces [] = array (
     198                                        "stt" => $province ['stt'],
     199                                        "ngay" => $date,
     200                                        "ma" => $index,
     201                                        "tinh" => $province ['province'],
     202                                        "thue_bao_ngay" => $province ['tbng'],
     203                                        "thue_bao_thang" => $province ['tbt'],
     204                                        "thue_bao_nam" => $province ['tbn'],
     205                                        "doanh_thu_ngay" => $province ['dtng'],
     206                                        "doanh_thu_thang" => $province ['dtt'],
     207                                        "doanh_thu_nam" => $province ['dtn']
     208                        );
     209                }
     210                return $provinces;
     211        }
     212       
     213        /**
     214         *
     215         * @param unknown $input
     216         * @return multitype:
     217         */
     218        public function exportPackage($input) {
     219                // $input['date']=1;
     220                // $input['month']=1;
     221                // $input['year']=2014;
     222                // $input['to_month']=1;
     223                // $input['to_year']=2015;
     224                // $input['to_date']=15;
     225                if (isset ( $input ['month'] )) {
     226                        $date = $input ['year'] . $input ['month'];
     227                } else {
     228                        $date = date ( "Ym" );
     229                }
     230                $result = array ();
     231                $data = $this->getPackages ( $input );
     232                $data = $data ['provinces'];
     233                foreach ( $data as $index => $province ) {
     234                        $package = array ();
     235                        foreach ( $province ['packages'] as $index2 => $packages ) {
     236                                $package = array_merge ( $package, array (
     237                                                "tong_so_" . $index2 => $packages ['total'],
     238                                                "ti_le_" . $index2 => $packages ['percent']
     239                                ) );
     240                        }
     241                        $tong = array (
     242                                        "tong_so_tb" => $province ['total']
     243                        );
     244                        $province = array (
     245                                        "stt" => $province ['stt'],
     246                                        "ngay" => $date,
     247                                        "ma" => $index,
     248                                        "tinh" => $province ['province']
     249                        );
     250                        $provinces [] = array_merge ( $province, $package, $tong );
     251                }
     252                return $provinces;
     253        }
    213254}
  • pro-violet-viettel/sourcecode/application/modules/admin/views/user/listview.php

    r742 r765  
    150150<?php
    151151foreach ($users as $user) {
    152     ?>
     152?>
    153153                                <tr class="odd">
    154154                                    <td class="center  sorting_1">
  • pro-violet-viettel/sourcecode/application/modules/frontend/controllers/lecture.php

    r717 r765  
    5454               $first_visit=1;
    5555            }
     56           
     57            $isOverDate = strtotime($u['expire_date']) < strtotime(date('Y-m-d')) ? 0:1;
    5658 
    57           $this->load->view('lecture_editor', array('username' => $username, 'licenseAvailable' => $licenseAvailable, 'first_visit' => $first_visit, 'licflashVars' => $aryParams,'update_user_info'=>$update_user_info,'us_id'=>$us_id,"p_period"=>$u['p_period'],"expire_date"=>date("d-m-Y", strtotime($u['expire_date'])), "fullname"=>$info['fullname'], "school"=>$info['school'], "province"=>$u['province'], "provinces"=>lang('_PROVINCES_')));
     59            $this->load->view('lecture_editor', array('username' => $username, 'licenseAvailable' => $licenseAvailable, 'first_visit' => $first_visit, 'licflashVars' => $aryParams,'update_user_info'=>$update_user_info,'us_id'=>$us_id,"p_period"=>$u['p_period'],"expire_date"=>date("d-m-Y", strtotime($u['expire_date'])), 'isOverDate' => $isOverDate , "fullname"=>$info['fullname'], "school"=>$info['school'], "province"=>$u['province'], "provinces"=>lang('_PROVINCES_')));
    5860        } else {
    5961            redirect('/frontend/home/');
  • pro-violet-viettel/sourcecode/application/modules/frontend/controllers/user.php

    r731 r765  
    6464            $result['can_buy'] = 1;
    6565            $result['can_edit'] = 0;
     66           
    6667            if ($user['acc_balanced'] < $package['p_price']) {
    6768                $result['can_buy'] = 0;
     
    142143        $user['acc_balanced'] = $user['acc_balanced'] - $package['p_price'];
    143144       
    144         $currentExpireDate = $user['expire_date'] == NULL || trim($user['expire_date']) == '' ? date('Y-m-d 00:00:00') : $user['expire_date'];
     145        $today_dt = new DateTime(date('Y-m-d 00:00:00'));
     146        $expire_dt = new DateTime($user['expire_date']);
     147       
     148        $currentExpireDate = $user['expire_date'] == NULL || trim($user['expire_date']) == '' || $today_dt > $expire_dt  ? date('Y-m-d 00:00:00') : $user['expire_date'];
    145149        $user['expire_date'] = date('Y-m-d', strtotime("+" . $package['p_period'] . " ".$package['p_unit'], strtotime($currentExpireDate)));
    146150        $user['p_id'] = $package['p_id'];
     
    175179        } else {
    176180            $user['acc_balanced'] = $user['acc_balanced'] - $package['p_price'];
    177             $currentExpireDate = $user['expire_date'] == NULL || trim($user['expire_date']) == '' ? date('Y-m-d 00:00:00') : $user['expire_date'];
     181           
     182            $today_dt = new DateTime(date('Y-m-d 00:00:00'));
     183            $expire_dt = new DateTime($user['expire_date']);
     184           
     185            $currentExpireDate = $user['expire_date'] == NULL || trim($user['expire_date']) == ''  || $today_dt > $expire_dt ? date('Y-m-d 00:00:00') : $user['expire_date'];
    178186
    179187            $user['expire_date'] = date('Y-m-d', strtotime("+" . $package['p_period'] . " " . $package['p_unit'], strtotime($currentExpireDate)));
  • pro-violet-viettel/sourcecode/application/modules/frontend/views/lecture_editor.php

    r753 r765  
    117117    var update_user_info="<?php echo $update_user_info;?>";
    118118    var us_id="<?php echo $us_id;?>";
     119    var is_overdate = <?php echo $isOverDate;?>
    119120</script>               
    120121<?php
  • pro-violet-viettel/sourcecode/application/modules/services/controllers/report.php

    r758 r765  
    1 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
     1<?php
     2
     3if (! defined ( 'BASEPATH' ))
     4        exit ( 'No direct script access allowed' );
    25/**
    36 * Report Class
    4  * 
     7 *
    58 * @author dzungnv02
    6  *
     9 *       
    710 */
    8 
    911class Report extends MX_Controller {
    10        
    1112        private $_server = null;
    1213       
     14        /**
     15         *
     16         */
    1317        function __construct() {
    1418                parent::__construct ();
     
    1721                                'soap_version' => SOAP_1_2,
    1822                                'encoding' => 'UTF-8',
    19                                 'uri' => 'http://tempuri.org/'
     23                                'uri' => 'http://tempuri.org/' 
    2024                ) );
    2125        }
    2226       
     27        /**
     28         *
     29         */
    2330        function __destruct() {
    2431                ini_set ( "soap.wsdl_cache_enabled", "0" );
    2532        }
    2633       
     34        /**
     35         *
     36         */
    2737        public function index() {
    2838                if ($this->uri->segment ( 3 ) == "wsdl") {
     
    3040                        $this->load->view ( 'reportwsdl' );
    3141                        return;
    32                 }
    33                 else {
     42                } else {
    3443                        header ( 'Content-Type: text/html; charset: utf-8' );
    3544                        echo '<div>See Report service <a href="', base_url (), 'violetservice/report/wsdl">WSDL page</a></div>';
     
    3746        }
    3847       
     48        /**
     49         *
     50         * @return multitype:string number |string
     51         */
    3952        public function get() {
    40                 function revenueReport () {
    41                         $aryArgs = func_get_args ();   
    42                         list ( $username, $password, $fromDate, $toDate) = $aryArgs;
    43 
     53               
     54                /**
     55                 *
     56                 * @return multitype:string number
     57                 */
     58                function revenueReport() {
     59                        $aryArgs = func_get_args ();
     60                        list ( $username, $password, $fromDate, $toDate ) = $aryArgs;
     61                       
    4462                        $CI = & get_instance ();
    45                         if (!$toDate) $toDate = date('Y-m-d');
    46                         $message = validate ($aryArgs);                 
    47                         $success = $message == '' ? 1 : 0;// 0:error; 1:Success;
     63                        if (! $toDate)
     64                                $toDate = date ( 'Y-m-d' );
     65                        $message = validate ( $aryArgs );
     66                        $success = $message == '' ? 1 : 0; // 0:error; 1:Success;
    4867                       
    4968                        if ($success == 1) {
    5069                                $CI->load->model ( 'Services_model' );
    5170                                $CI->load->model ( 'admin/Reportmodel', 'objReportModel' );
    52                                 $from = explode('-', $fromDate);
    53                                 $to = explode('-', $toDate);
    54                                 $input = array('year' => $from[0], 'month' => $from[1], 'to_year' => $to[0], 'to_month' => $to[1], 'to_date' => $to[2]);
    55                                 $result = $CI->objReportModel->exportProvince( $input );
    56                                
    57                                 if (count($result) > 0 && is_array($result)) {
    58                                         //1|20140915|A076|0|0|0|100000|0|0
    59                                         $aryTmp = array();
    60                                         $aryResult = array();
    61                                         foreach ($result as $provinceCode => $record) {
    62                                                 //No|toDate|ProvCode|TBngay|LKTBThang|TongTBNam|DTngay|LuyKeTBThang|TongDTNam
    63                                                 $aryTmp[] = $record['stt'];
    64                                                 $aryTmp[] = implode('', $to);
    65                                                 $aryTmp[] = $provinceCode;
    66                                                 $aryTmp[] = $record['tbng'];
    67                                                 $aryTmp[] = $record['tbt'];
    68                                                 $aryTmp[] = $record['tbn'];
    69                                                 $aryTmp[] = $record['dtng'];
    70                                                 $aryTmp[] = $record['dtt'];
    71                                                 $aryTmp[] = $record['dtn'];
    72                                                 $aryResult[] = implode('|', $aryTmp);
    73                                                 $aryTmp = array();
     71                                $from = explode ( '-', $fromDate );
     72                                $to = explode ( '-', $toDate );
     73                                $input = array (
     74                                                'year' => $from [0],
     75                                                'month' => $from [1],
     76                                                'to_year' => $to [0],
     77                                                'to_month' => $to [1],
     78                                                'to_date' => $to [2]
     79                                );
     80                                $result = $CI->objReportModel->exportProvince ( $input );
     81                               
     82                                if (count ( $result ) > 0 && is_array ( $result )) {
     83                                        // 1|20140915|A076|0|0|0|100000|0|0
     84                                        $aryTmp = array ();
     85                                        $aryResult = array ();
     86                                        foreach ( $result as $provinceCode => $record ) {
     87                                                // No|toDate|ProvCode|TBngay|LKTBThang|TongTBNam|DTngay|LuyKeTBThang|TongDTNam
     88                                                $aryTmp [] = $record ['stt'];
     89                                                $aryTmp [] = implode ( '', $to );
     90                                                $aryTmp [] = $record ['ma'];
     91                                                $aryTmp [] = $record ['thue_bao_ngay'];
     92                                                $aryTmp [] = $record ['thue_bao_thang'];
     93                                                $aryTmp [] = $record ['thue_bao_nam'];
     94                                                $aryTmp [] = $record ['doanh_thu_ngay'];
     95                                                $aryTmp [] = $record ['doanh_thu_thang'];
     96                                                $aryTmp [] = $record ['doanh_thu_nam'];
     97                                                $aryResult [] = implode ( '|', $aryTmp );
     98                                                $aryTmp = array ();
    7499                                        }
    75100                                       
    76                                         $message = implode("\n", $aryResult);
     101                                        $message = implode ( "\n", $aryResult );
    77102                                        $success = 1;
    78103                                }
    79104                        }
    80105                       
    81                         return array($message, $success, date('YmdHis'));
    82                 }
    83                
    84                 function subscribersReport () {
    85                         $aryArgs = func_get_args ();   
    86                         list ( $username, $password, $fromDate, $toDate) = $aryArgs;
    87 
     106                        return array (
     107                                        $message,
     108                                        $success,
     109                                        date ( 'YmdHis' )
     110                        );
     111                }
     112               
     113                /**
     114                 *
     115                 * @return multitype:string number
     116                 */
     117                function subscribersReport() {
     118                        $aryArgs = func_get_args ();
     119                        list ( $username, $password, $fromDate, $toDate ) = $aryArgs;
     120                       
    88121                        $CI = & get_instance ();
    89                         $message = validate ($aryArgs);
    90                         $success = $message == '' ? 1 : 0;// 0:error; 1:Success;
    91                         $message = $message == '' ? 'subscribersReport' : $message;
     122                        $message = validate ( $aryArgs );
     123                        $success = $message == '' ? 1 : 0; // 0:error; 1:Success;
     124                       
     125                        if ($success == 1) {
     126                                $CI->load->model ( 'Services_model' );
     127                                $CI->load->model ( 'admin/Reportmodel', 'objReportModel' );
     128                                $from = explode ( '-', $fromDate );
     129                                $to = explode ( '-', $toDate );
     130                                $input = array (
     131                                                'year' => $from [0],
     132                                                'month' => $from [1],
     133                                                'date' => $from [2],
     134                                                'to_year' => $to [0],
     135                                                'to_month' => $to [1],
     136                                                'to_date' => $to [2]
     137                                );
     138                                $result = $CI->objReportModel->exportPackage ( $input );
     139                               
     140                                if (count ( $result ) > 0 && is_array ( $result )) {
     141                                        $aryTmp = array ();
     142                                        $aryResult = array ();
     143                                        foreach ( $result as $provinceCode => $record ) {
     144                                                $aryTmp [] = $record ['stt'];
     145                                                $aryTmp [] = implode ( '', $to );
     146                                                $aryTmp [] = $record ['ma'];
     147                                                $aryTmp [] = $record ['tong_so_VIP 1'];
     148                                                $aryTmp [] = $record ['ti_le_VIP 1'];
     149                                                $aryTmp [] = $record ['tong_so_VIP 3'];
     150                                                $aryTmp [] = $record ['ti_le_VIP 3'];
     151                                                $aryTmp [] = $record ['tong_so_VIP 6'];
     152                                                $aryTmp [] = $record ['ti_le_VIP 6'];
     153                                                $aryTmp [] = $record ['tong_so_VIP 12'];
     154                                                $aryTmp [] = $record ['ti_le_VIP 12'];
     155                                                $aryTmp [] = $record ['tong_so_tb'];
     156                                                $aryResult [] = implode ( '|', $aryTmp );
     157                                                $aryTmp = array ();
     158                                        }
     159                                       
     160                                        $message = implode ( "\n", $aryResult );
     161                                        $success = 1;
     162                                }
     163                        }
    92164                       
    93165                        $CI->load->model ( 'Services_model' );
    94                         $CI->load->model ( 'admin/Reportmodel', 'objReportModel' );                     
    95                        
    96                         return array($message, $success, date('YmdHis'));
    97                 }
    98                
    99                 function validate ($aryArgs) {
    100                         list ( $username, $password, $fromDate, $toDate) = $aryArgs;
     166                        $CI->load->model ( 'admin/Reportmodel', 'objReportModel' );
     167                       
     168                        return array (
     169                                        $message,
     170                                        $success,
     171                                        date ( 'YmdHis' )
     172                        );
     173                }
     174               
     175                /**
     176                 *
     177                 * @param unknown $aryArgs
     178                 * @return string
     179                 */
     180                function validate($aryArgs) {
     181                        list ( $username, $password, $fromDate, $toDate ) = $aryArgs;
    101182                       
    102183                        $CI = & get_instance ();
    103184                        $predefUsername = $CI->config->item ( 'report_username' );
    104185                        $predefPassword = $CI->config->item ( 'report_password' );
    105                                
     186                       
    106187                        $message = '';
    107                                
     188                       
    108189                        if (! $username) {
    109190                                $message = 'Username is required!';
    110                         }else if (! $password) {
    111                                 $message =  'Password is required!';
    112                         }else if ($username != $predefUsername) {
    113                                 $message =  'Username is not corrected!';
    114                         }else if ($password != $predefPassword) {
    115                                 $message =  'Password is not corrected!';
    116                         }else if (! $fromDate) {
    117                                 $message =  'fromDate is required!';
    118                         }else if (!preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $fromDate)) {
    119                                 $message =  'fromDate is not corrected!';
    120                         }else if ($toDate && !preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $toDate)) {
    121                                 $message =  'toDate is not corrected!';
    122                         }
    123 
     191                        } else if (! $password) {
     192                                $message = 'Password is required!';
     193                        } else if ($username != $predefUsername) {
     194                                $message = 'Username is not corrected!';
     195                        } else if ($password != $predefPassword) {
     196                                $message = 'Password is not corrected!';
     197                        } else if (! $fromDate) {
     198                                $message = 'fromDate is required!';
     199                        } else if (! preg_match ( '/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $fromDate )) {
     200                                $message = 'fromDate is not corrected!';
     201                        } else if ($toDate && ! preg_match ( '/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $toDate )) {
     202                                $message = 'toDate is not corrected!';
     203                        }
     204                       
    124205                        return $message;
    125206                }
    126207               
    127                 $this->_server->addFunction ( array('revenueReport', 'subscribersReport'));
     208                $this->_server->addFunction ( array (
     209                                'revenueReport',
     210                                'subscribersReport'
     211                ) );
    128212               
    129213                try {
     
    136220                                $soapOutput = ob_get_clean ();
    137221                        }
    138                                
     222                       
    139223                        if ($soapOutput != '') {
    140                                 error_log(var_export($soapOutput, true) . "\n\n\n", 3, '/srv/www/sbg/log/reportservicexml.log');
    141                                
    142                                 $response = preg_match('/revenueReportResponse/', $soapOutput) ? 'revenueReportResponse' : (preg_match('/subscribersReportResponse/', $soapOutput) ? 'subscribersReportResponse':'');
     224                                error_log ( var_export ( $soapOutput, true ) . "\n\n\n", 3, '/srv/www/sbg/log/reportservicexml.log' );
     225                               
     226                                $response = preg_match ( '/revenueReportResponse/', $soapOutput ) ? 'revenueReportResponse' : (preg_match ( '/subscribersReportResponse/', $soapOutput ) ? 'subscribersReportResponse' : '');
    143227                               
    144228                                $pattern = '/<[^>]*[^\/]>/i';
    145229                                $aryOutput = preg_split ( $pattern, $soapOutput, - 1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
    146                                 error_log(var_export($aryOutput, true) . "\n\n\n", 3, '/srv/www/sbg/log/reportservice.log');
     230                                error_log ( var_export ( $aryOutput, true ) . "\n\n\n", 3, '/srv/www/sbg/log/reportservice.log' );
    147231                                $aryData = array ();
    148232                                $aryData ['message'] = $aryOutput [1];
     
    159243                } catch ( Exception $e ) {
    160244                        $this->_server->fault ( 'Sender', $e->getMessage () );
    161                 }               
     245                }
    162246        }
    163247}
  • pro-violet-viettel/sourcecode/assets/js/frontend/lecture.js

    r744 r765  
    66    }
    77}
    8 //if (first_visit == '1') {
    98
    10 if (p_period == -1)
     9if (p_period == -1 && is_overdate == 1)
    1110{
    1211        $('#alert-trial-services').modal('show');
     
    2524        }
    2625}
    27 
    28 //}
    29 
    3026
    3127$("#update_user_info.btn").click(function () {
Note: See TracChangeset for help on using the changeset viewer.