Ignore:
Timestamp:
Apr 23, 2015 12:00:06 PM (10 years ago)
Author:
namnd
Message:
 
Location:
pro-violet-viettel/sourcecode/application/modules/collaborator
Files:
10 edited

Legend:

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

    r883 r906  
    1414                $this->lang->load('messages', 'message');
    1515    }
    16 
    17     public function index() {
    18         $data = array();
    19         $collaborator_info = $this->session->userdata('collaboratorInfo');
    20         if ($collaborator_info) {
    21             $data['statistics'] = $this->getStatistics();
    22             $data['content'] = $this->getCollaborators();
    23             $this->load->view('collaborator/reportAsistant/index', $data);
    24         } else {
    25             $this->load->view('login');
    26         }
    27     }
    28 
    29     public function viewAsistant() {
    30         $data = array();
    31 
    32         $collaborator_info = $this->session->userdata('collaboratorInfo');
    33         if ($collaborator_info) {
    34             $id = $this->uri->segment(2);
    35             $data['id'] = $id;
    36             $data['statistics'] = $this->getStatistics($id);
    37             $data['content'] = $this->getCollaboratorsUsers(array(), $id);
    38             $this->load->view('collaborator/reportAsistant/indexCollaborator', $data);
    39         } else {
    40             $this->load->view('login');
    41         }
    42     }
    43 
    44     public function getStatistics($id = false) {
    45         $data = array();
    46 
    47         $this_year['start'] = strtotime(date("Y") . "-01-01 00:00:00");
    48 
    49         $this->load->model('admin/collabolator_model');
    50         $collaborators = $this->collabolator_model->getAllCollaboratorUser($this_year['start'], $id);
    51         for ($i = 1; $i <= 12; $i++) {
    52             $statistics[$i] = 0;
    53         }
    54         $y = date("Y");
    55         foreach ($collaborators as $collaborator) {
    56             for ($i = 1; $i <= 12; $i++) {
    57                 if ($i < 12) {
    58                     if (($collaborator['time'] > strtotime($y . "-" . $i . "-1 00:00:00")) && (($collaborator['time'] < strtotime($y . "-" . ($i + 1) . "-1 00:00:00")))) {
    59                         $statistics[$i] ++;
    60                     }
    61                 } else {
    62                     if (($collaborator['time'] > strtotime($y . "-" . $i . "-1 00:00:00")) && (($collaborator['time'] < strtotime(($y + 1) . "-1-1 00:00:00")))) {
    63                         $statistics[$i] ++;
    64                     }
    65                 }
    66             }
    67         }
    68 
    69         $max = 0;
    70         foreach ($statistics as $index => $total) {
    71             if ($total > $max) {
    72                 $max = $total;
    73             }
    74             $chart[] = array($index, $total);
    75         }
    76 
    77         $data['max'] = $max;
    78         $chard[] = array("color" => "#e67e22", "label" => "Lượng người dùng giới thiệu bởi cộng tác viên theo từng tháng", "data" => $chart);
    79         $data['chard'] = $chard;
    80          
    81         return $this->load->view('collaborator/reportAsistant/statistics', $data, true);
    82     }
    83 
    84     public function getLastquarter() {
    85         $current_month = date('m');
    86         $current_year = date('Y');
    87 
    88         if ($current_month >= 1 && $current_month <= 3) {
    89             $start_date = strtotime('1-October-' . ($current_year - 1));  // timestamp or 1-October Last Year 12:00:00 AM
    90             $end_date = strtotime('1-Janauary-' . $current_year);  // // timestamp or 1-January  12:00:00 AM means end of 31 December Last year
    91         } else if ($current_month >= 4 && $current_month <= 6) {
    92             $start_date = strtotime('1-January-' . $current_year);  // timestamp or 1-Janauray 12:00:00 AM
    93             $end_date = strtotime('1-April-' . $current_year);  // timestamp or 1-April 12:00:00 AM means end of 31 March
    94         } else if ($current_month >= 7 && $current_month <= 9) {
    95             $start_date = strtotime('1-April-' . $current_year);  // timestamp or 1-April 12:00:00 AM
    96             $end_date = strtotime('1-July-' . $current_year);  // timestamp or 1-July 12:00:00 AM means end of 30 June
    97         } else if ($current_month >= 10 && $current_month <= 12) {
    98             $start_date = strtotime('1-July-' . $current_year);  // timestamp or 1-July 12:00:00 AM
    99             $end_date = strtotime('1-October-' . $current_year);  // timestamp or 1-October 12:00:00 AM means end of 30 September
    100         }
    101         return array("start" => $start_date, "end" => $end_date);
    102     }
    103 
    104 
    105     public function getCollaboratorsUsers($filters = array(), $id = false) {
    106 
    107         $this->load->helper('pagging');
    108         $this->load->model('admin/collabolator_model');
    109         $data['current_page'] = $this->uri->segment(5, 1);
    110 
    111         $data['itemsoptions'] = array(10, 25, 50, 100);
    112         $data['perpage'] = 10;
    113         if (!$id) {
    114             $data['id'] = $this->uri->segment(4, 1);
    115         } else {
    116             $data['id'] = $id;
    117         }
    118 
    119         $data['keyword'] = "";
    120         $data['sorting_order'] = "sorting_desc";
    121         $data['sorting_field'] = "id";
    122 
    123         if ($this->input->post('sorting_order')) {
    124             if ($this->input->post('sorting_order') != "sorting") {
    125                 $data['sorting_order'] = $this->input->post('sorting_order');
    126                 $data['sorting_field'] = $this->input->post('sorting_field');
    127             }
    128         }
    129         if ($this->input->post('items')) {
    130             $data['perpage'] = $this->input->post('items');
    131         }
    132         if ($this->input->post('keyword')) {
    133             $data['search_field'] = "";
    134             $data['keyword'] = $this->input->post('keyword');
    135 
    136             if (preg_match("/[0-9]/", $data['keyword'])) {
    137                 $data['search_field'] = "cellphone";
    138             }
    139         }
    140 
    141                 $data['daterange_start'] = "";
    142                 $data['daterange_end'] = "";
    143                 if ($this->input->post('daterange')){
    144                         $daterange = explode(" - ", $this->input->post('daterange'));
    145                         $daterange[0] = str_replace('/', '-', $daterange[0]);
    146                         $daterange[1] = str_replace('/', '-', $daterange[1]);
    147                         $data['daterange_start'] = date('Y-m-d H:i:s', strtotime($daterange[0]));
    148                         $data['daterange_end'] = date('Y-m-d H:is:s', strtotime($daterange[1].' + 1 day'));
    149                 }
    150                
    151         $data['start'] = ($data['current_page'] - 1) * $data['perpage'];
    152         $data['total'] = $this->collabolator_model->countCountCollaboratorUsers($data);
    153         $data['paidlogs'] = $this->collabolator_model->getCountCollaboratorUsers($data);
    154         foreach ($data['paidlogs'] as $index=>$paidlog)
    155         {
    156             $data['paidlogs'][$index]['username']=$this->get_fullname($paidlog['us_id']);
    157         }
    158         $data['paging_url'] = base_url() . "/cong_tac_vien/thong_ke_cong_tac_vien/trang_ctv/" . $data['id'];
    159         $data['num_links'] = 2;
    160         $data['paging'] = pagging($data);
    161 
    162         if ($this->input->is_ajax_request()) {
    163             return $this->load->view('collaborator/reportAsistant/listview_user', $data);
    164         }
    165         return $this->load->view('collaborator/reportAsistant/listview_user', $data, true);
    166     }
    167 
    168     private function get_fullname($us_id) {
    169         $fullname="";
    170         $src = 'violet';
    171         $token = md5($us_id . self::TOKENPW);
    172         $this->load->model('admin/user_model');
    173         $data = $this->user_model->get_user_info($src, $us_id, $token);
    174         parse_str($data,$data);
    175         if (isset($data['fullname']))
    176         {
    177             $fullname=$data['fullname'];
    178         }
    179         return $fullname;
    180     }
    181 
     16       
    18217        public function profile(){
    18318                $collaborator_info = $this->session->userdata('collaboratorInfo');
    18419        if ($collaborator_info) {
    18520                        $data['collaborator_id'] = $collaborator_info['id'];
     21                        $data['username'] = $collaborator_info['login_name'];
     22                        $data['fullname'] = $collaborator_info['fullname'];
    18623                        $this->load->view('collaborator/collaborator_profile', $data);
     24                }else{
     25                        $this->load->view('login');
     26                }
     27        }
     28       
     29        public function updateCollaborator(){
     30                $this->load->model('collaborator_model');
     31                $collaborator_info = $this->session->userdata('collaboratorInfo');
     32                $result['success'] = 0;
     33        if ($collaborator_info) {
     34                       
     35                        $collaborator_id = $collaborator_info['id'];
     36                        $login_name = $collaborator_info['login_name'];
     37                        $input = $this->input->post();
     38                        if (strlen($input['fullname']) == 0) {
     39                                $result['errors'][] = array("content"=>lang('_SBG_FULLNAME_REQUIRED_MSG'),"field"=>"fullname_err");
     40                        }
     41                        if (!isset($result['errors'])) {
     42                                $collaborator = array('full_name' => $input['fullname']);
     43                                $result['success'] = 1;
     44                                $result['data'] = $this->collaborator_model->updateCollaborator($collaborator_id, $collaborator);
     45                $collaboratorData = array('login_name' => $login_name, 'id' => $collaborator_id, 'fullname' => $input['fullname'], 'logined_in' => TRUE);
     46                $this->session->set_userdata('collaboratorInfo', $collaboratorData);
     47                        }
     48                        echo json_encode($result);
    18749                }else{
    18850                        $this->load->view('login');
     
    19254        public function change_password(){
    19355                $this->load->model('collaborator_model');
    194                 //$collaborator_id = $this->uri->segment(4, 1);
    19556                $collaborator_info = $this->session->userdata('collaboratorInfo');
    19657        if ($collaborator_info) {
  • pro-violet-viettel/sourcecode/application/modules/collaborator/controllers/home.php

    r883 r906  
    2020        if ($collaborator_info) {
    2121                        $id = $collaborator_info['id'];
    22             $data['id'] = $id;
    2322            $data['statistics'] = $this->getStatistics($id);
    24             $data['content'] = $this->getCollaboratorsUsers(array(), $id);
     23                        $data['content'] = $this->getCollaboratorsUsers();
    2524            $this->load->view('collaborator/reportAsistant/indexCollaborator', $data);
    2625        } else {
     
    122121
    123122
    124     public function getCollaboratorsUsers($filters = array(), $id = false) {
    125 
    126         $this->load->helper('pagging');
    127         $this->load->model('admin/collabolator_model');
    128         $data['current_page'] = $this->uri->segment(5, 1);
    129 
    130         $data['itemsoptions'] = array(10, 25, 50, 100);
    131         $data['perpage'] = 10;
    132         if (!$id) {
    133             $data['id'] = $this->uri->segment(4, 1);
    134         } else {
     123    public function getCollaboratorsUsers() {
     124                $collaborator_info = $this->session->userdata('collaboratorInfo');
     125        if ($collaborator_info) {
     126                        $this->load->helper('pagging');
     127                        $this->load->model('admin/collabolator_model');
     128                        $data['current_page'] = $this->uri->segment(5, 1);
     129                       
     130                        $data['itemsoptions'] = array(10, 25, 50, 100);
     131                        $data['perpage'] = 10;
     132                        $id = $collaborator_info['id'];
    135133            $data['id'] = $id;
    136         }
    137        
    138         $data['keyword'] = "";
    139         $data['sorting_order'] = "sorting_desc";
    140         $data['sorting_field'] = "id";
    141 
    142         if ($this->input->post('sorting_order')) {
    143             if ($this->input->post('sorting_order') != "sorting") {
    144                 $data['sorting_order'] = $this->input->post('sorting_order');
    145                 $data['sorting_field'] = $this->input->post('sorting_field');
    146             }
    147         }
    148         if ($this->input->post('items')) {
    149             $data['perpage'] = $this->input->post('items');
    150         }
    151         if ($this->input->post('keyword')) {
    152             $data['search_field'] = "";
    153             $data['keyword'] = $this->input->post('keyword');
    154 
    155             if (preg_match("/[0-9]/", $data['keyword'])) {
    156                 $data['search_field'] = "cellphone";
    157             }
    158         }
    159 
    160                 $data['daterange_start'] = "";
    161                 $data['daterange_end'] = "";
    162                 if ($this->input->post('daterange')){
    163                         $daterange = explode(" - ", $this->input->post('daterange'));
    164                         $daterange[0] = str_replace('/', '-', $daterange[0]);
    165                         $daterange[1] = str_replace('/', '-', $daterange[1]);
    166                         $data['daterange_start'] = date('Y-m-d H:i:s', strtotime($daterange[0]));
    167                         $data['daterange_end'] = date('Y-m-d H:is:s', strtotime($daterange[1].' + 1 day'));
     134                       
     135                        $data['keyword'] = "";
     136                        $data['sorting_order'] = "sorting_desc";
     137                        $data['sorting_field'] = "user_created_time";
     138
     139                        if ($this->input->post('sorting_order')) {
     140                                if ($this->input->post('sorting_order') != "sorting") {
     141                                        $data['sorting_order'] = $this->input->post('sorting_order');
     142                                        $data['sorting_field'] = $this->input->post('sorting_field');
     143                                }
     144                        }
     145                        if ($this->input->post('items')) {
     146                                $data['perpage'] = $this->input->post('items');
     147                        }
     148                        if ($this->input->post('keyword')) {
     149                                $data['search_field'] = "";
     150                                $data['keyword'] = $this->input->post('keyword');
     151
     152                                if (preg_match("/[0-9]/", $data['keyword'])) {
     153                                        $data['search_field'] = "cellphone";
     154                                }
     155                        }
     156
     157                        $data['daterange_start'] = "";
     158                        $data['daterange_end'] = "";
     159                        if ($this->input->post('daterange')){
     160                                $daterange = explode(" - ", $this->input->post('daterange'));
     161                                $daterange[0] = str_replace('/', '-', $daterange[0]);
     162                                $daterange[1] = str_replace('/', '-', $daterange[1]);
     163                                $data['date_start'] = $daterange[0];
     164                                $data['date_end'] = $daterange[1];
     165                                $data['daterange_start'] = date('Y-m-d H:i:s', strtotime($daterange[0]));
     166                                $data['daterange_end'] = date('Y-m-d H:is:s', strtotime($daterange[1].' + 1 day'));
     167                        }
     168                       
     169                        $data['start'] = ($data['current_page'] - 1) * $data['perpage'];
     170                        $data['total'] = $this->collabolator_model->countCountCollaboratorUsers($data);
     171                        $data['paidlogs'] = $this->collabolator_model->getCountCollaboratorUsers($data);
     172                        foreach ($data['paidlogs'] as $index => $paidlog)
     173                        {
     174                                $data['paidlogs'][$index]['username'] = $this->get_fullname($paidlog['us_id']);
     175                        }
     176                        $data['paging_url'] = base_url() . "collaborator/home/getCollaboratorsUsers/".$data['id'];
     177                        $data['num_links'] = 2;
     178                        $data['paging'] = pagging($data);
     179               
     180                        if ($this->input->is_ajax_request()) {
     181                                return $this->load->view('collaborator/reportAsistant/listview_user', $data);
     182                        }
     183                        return $this->load->view('collaborator/reportAsistant/listview_user', $data, true);
     184                }else{
     185                        $this->load->view('login');
    168186                }
    169                
    170         $data['start'] = ($data['current_page'] - 1) * $data['perpage'];
    171         $data['total'] = $this->collabolator_model->countCountCollaboratorUsers($data);
    172         $data['paidlogs'] = $this->collabolator_model->getCountCollaboratorUsers($data);
    173 
    174         foreach ($data['paidlogs'] as $index => $paidlog)
    175         {
    176 
    177             $data['paidlogs'][$index]['username'] = $this->get_fullname($paidlog['us_id']);
    178         }
    179                
    180         $data['paging_url'] = base_url() . "cong_tac_vien/thong_ke_nguoi_dung/trang/" ;
    181         $data['num_links'] = 2;
    182         $data['paging'] = pagging($data);
    183                
    184         if ($this->input->is_ajax_request()) {
    185             return $this->load->view('collaborator/reportAsistant/listview_user', $data);
    186         }
    187         return $this->load->view('collaborator/reportAsistant/listview_user', $data, true);
    188187    }
    189188
     
    202201    }
    203202       
     203       
     204        public function export(){
     205               
     206                $collaborator_info = $this->session->userdata('collaboratorInfo');
     207        if ($collaborator_info) {
     208                        $id = $collaborator_info['id'];
     209            $data['id'] = $id;
     210                        $data['fullname'] = $collaborator_info['fullname'];
     211                        $this->load->model('admin/collabolator_model');
     212                        //$data['perpage'] = $this->uri->segment(4, 10);
     213                        $data['keyword'] = $this->uri->segment(5);
     214                        if ($data['keyword'] == 'default') $data['keyword'] = null;
     215                        if (preg_match("/[0-9]/", $data['keyword'])) {
     216                                        $data['search_field'] = "cellphone";
     217                        }
     218                        $data['daterange_start'] = $this->uri->segment(6);
     219                        $data['daterange_end'] = $this->uri->segment(7);
     220                        if ($data['daterange_start'] == 'default') $data['daterange_start'] = null;
     221                        if ($data['daterange_end'] == 'default') $data['daterange_end'] = null;
     222                        if ($data['daterange_start'])
     223                                $data['daterange_start'] = date ( 'Y-m-d H:i:s', strtotime ( $data ['daterange_start'] ) );
     224                        if ($data['daterange_end'])
     225                                $data['daterange_end'] = date ( 'Y-m-d H:i:s', strtotime ( $data['daterange_end'] . ' + 1 day' ) );
     226                       
     227                        $data['sorting_field'] = "user_created_time";
     228                        $data['sorting_order'] = $this->uri->segment(8);
     229                       
     230                        $data['paidlogs'] = $this->collabolator_model->getCountCollaboratorUsers($data);
     231                       
     232                        foreach ($data['paidlogs'] as $index => $paidlog)
     233                        {
     234                                $data['paidlogs'][$index]['username'] = $this->get_fullname($paidlog['us_id']);
     235                        }
     236                        $users = $data['paidlogs'];
     237                       
     238                        ob_end_clean();
     239                        $this->load->library("PHPExcel");
     240                        $sheet = $this->phpexcel->getActiveSheet();
     241                       
     242                        $sheet->setTitle("bao cao cua CTV " . date('m') . " - " . date('Y'));
     243                        $sheet->getColumnDimension('A')->setWidth(10);
     244                        $sheet->getColumnDimension('B')->setWidth(25);
     245                        $sheet->getColumnDimension('C')->setWidth(25);
     246                        $sheet->getColumnDimension('D')->setWidth(25);
     247                        $sheet->getColumnDimension('E')->setWidth(15);
     248                        $sheet->getColumnDimension('F')->setWidth(15);
     249                        $sheet->getColumnDimension('G')->setWidth(15);
     250                        $sheet->getColumnDimension('H')->setWidth(25);
     251                        $sheet->getColumnDimension('I')->setWidth(25);
     252                       
     253                       
     254                        $sheet->setCellValue('B1', "TẬP ĐOÀN VIỄN THÔNG QUÂN ĐỘI");
     255                        $style = array(
     256                                'font' => array('bold' => true, 'size' => 12, 'name' =>'Cambria', 'color' => array('rgb' => '0070bf')),
     257                                'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
     258                                                                        'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
     259                                                                        'wrap' => true )
     260                        );
     261                        $sheet->mergeCells('B1:E1');
     262                        $sheet->getStyle('B1')->applyFromArray($style);
     263                       
     264                        $sheet->setCellValue('B2', "TỔNG CÔNG TY VIỄN THÔNG VIETTEL");
     265                        $style = array(
     266                                'font' => array('size' => 12, 'name' =>'Cambria', 'color' => array('rgb' => '0070bf')),
     267                                'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
     268                                                                        'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
     269                                                                        'wrap' => true )
     270                        );
     271                        $sheet->mergeCells('B2:E2');
     272                        $sheet->getStyle('B2')->applyFromArray($style);
     273                       
     274                       
     275                        $sheet->setCellValue('A4', "DANH SÁCH NGƯỜI DÙNG DO CỘNG TÁC VIÊN GIỚI THIỆU");
     276                        $style = array(
     277                                'font' => array('bold' => true, 'size' => 14, 'name' =>'Cambria'),
     278                                'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
     279                                                                        'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
     280                                                                        'wrap' => true )
     281                        );
     282                        $sheet->mergeCells('A4:E4');
     283                        $sheet->getStyle('A4')->applyFromArray($style);
     284                       
     285                       
     286                       
     287                        $style = array(
     288                                'font' => array('size' => 11, 'name' =>'Cambria'),
     289                                'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
     290                                                                        'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
     291                                                                        'wrap' => true),
     292                                'borders' =>    array(
     293                                        'allborders' => array(
     294                                                'style' => \PHPExcel_Style_Border::BORDER_THIN
     295                                                )
     296                                )
     297                        );
     298                       
     299                        $sheet->setCellValue('B6', "Từ ngày: ".$data['daterange_start']);
     300                        $sheet->setCellValue('C6', "Đến ngày: ".$data['daterange_end']);
     301                        $sheet->setCellValue('B7', "Ngày kết xuất: ".date("d")."/".date("m")."/".date("Y"));
     302                        $sheet->setCellValue('C7', "CTV: ".$data['fullname']);
     303                       
     304                        $sheet->getStyle('B6')->applyFromArray($style);
     305                        $sheet->getStyle('C6')->applyFromArray($style);
     306                        $sheet->getStyle('B7')->applyFromArray($style);
     307                        $sheet->getStyle('C7')->applyFromArray($style);
     308                       
     309                        $sheet->setCellValue('A9', 'STT');
     310                        $sheet->setCellValue('B9', 'Tên người dùng');
     311                        $sheet->setCellValue('C9', 'Số thuê bao');
     312                        $sheet->setCellValue('D9', 'Ngày giờ giới thiệu');
     313                        $style = array(
     314                                'font' => array('bold' => true, 'size' => 11, 'name' =>'Cambria'),
     315                                'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
     316                                                                        'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
     317                                                                        'wrap' => true),
     318                                'borders' =>    array(
     319                                        'allborders' => array(
     320                                                'style' => \PHPExcel_Style_Border::BORDER_THIN
     321                                                )
     322                                )
     323                        );
     324                        $sheet->getStyle('A9:D9')->applyFromArray($style);
     325                       
     326                        $style = array(
     327                                'font' => array('size' => 11, 'name' =>'Cambria'),
     328                                'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
     329                                                                        'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
     330                                                                        'wrap' => true),
     331                                'borders' =>    array(
     332                                        'allborders' => array(
     333                                                'style' => \PHPExcel_Style_Border::BORDER_THIN
     334                                                )
     335                                )
     336                        );
     337                       
     338                        $dem = 0;
     339                        foreach ($users as $index => $user):
     340                                $sheet->setCellValue('A' . ($dem + 10), $index + 1);
     341                                $sheet->setCellValue('B' . ($dem + 10), $user['username']);
     342                                $sheet->setCellValueExplicit('C' . ($dem + 10), $user['user_cellphone'], PHPExcel_Cell_DataType::TYPE_STRING);
     343                                $sheet->setCellValue('D' . ($dem + 10), $user['user_created_time']);
     344                                $sheet->getStyle('A' . ($dem + 10).':D'.($dem + 10))->applyFromArray($style);
     345                                $dem++;
     346                        endforeach;
     347                       
     348                        $writer = new PHPExcel_Writer_Excel5($this->phpexcel);
     349                        header('Content-Type: application/vnd.ms-excel');
     350                        header('Content-Disposition: attachment; filename="danhsachnguoidung_ctv_'.date('d/m/Y').'.xls"');
     351                        $writer->save('php://output');
     352                }else{
     353                        $this->load->view('login');
     354                }
     355        }
     356       
    204357}
  • pro-violet-viettel/sourcecode/application/modules/collaborator/controllers/user.php

    r883 r906  
    2222                        $this->load->view('collaborator/user/index', $data);
    2323                }else{
    24                         show_404();
     24                        $this->load->view(login);
    2525                }
    2626        }
     
    3232                        $collaborator = $collaborator_info['login_name'];
    3333                        $config['upload_path'] = './upload/uploads/';
    34                         $config['allowed_types'] = 'xls|xlsx';
    35                         /*$config['max_size']   = '100';
    36                         $config['max_width']  = '1024';
    37                         $config['max_height']  = '768';*/
    38                        
     34                        $config['allowed_types'] = '*';
    3935                        $this->load->library('upload', $config);
    4036                       
     
    4339                                $error = array('error' => $this->upload->display_errors('', ''));
    4440                                $data['success'] = 0;
    45                                 $data['process'] = $error;
     41                                $data['upload_error'] = $error;
    4642                        }
    4743                        else
     
    4945                                $data = array('upload_data' => $this->upload->data());
    5046                                $file = $data['upload_data']['full_path'];
    51                                 //$result = $this->processData($file);
    5247                                $process = $this->processData($file, $collaborator);
    5348                                if ($process){
    5449                                        $data['process'] = $process;
    55                                        
    5650                                }else{
    57                                         $data['process'] = null;
     51                                        $data['process'] = null;                               
    5852                                }
    5953                                $data['success'] = 1;
     
    6155                        $result = $this->load->view('collaborator/user/result', $data, true);
    6256                        echo json_encode($result);
     57
    6358                }else{
    64                         show_404();
     59                        $this->load->view('login');
    6560                }
    6661        }
     
    9388                $this->load->model('collaborator_model');
    9489                $data = $this->readExcelFile($file);
     90
    9591                $result = array();
    9692                $user = array();
     
    104100                                $user['district'] = $arrPD['district'];
    105101                                $user['school'] = $value['E'];
    106                                 $user['username'] = $this->services_model->formatPhoneNumber($value['F'], 2);
     102                                $user['username'] = $this->services_model->formatPhoneNumber((string)$value['F'], 2);
    107103                                $user['service'] = $value['G'];
    108104                                $user['amount'] = $value['H'];
    109105                                $user['collboratorId'] = $value['I'];
    110106                               
     107                               
    111108                                if ($user['username']){
    112109       
    113110                                        if (!preg_match('/^([0-9]{10,11}$)$/', $user['username'])) {
    114                                                 $result[$index]['success'] = 0;
    115                                                 $result[$index]['error'] = lang('_SBG_MO_PHONENUM_WRONG_FORMAT_MSG');
    116                                                 $result[$index]['user'] = $user;
     111                                                $result[$index-1]['success'] = 0;
     112                                                $result[$index-1]['error'] = lang('_SBG_MO_PHONENUM_WRONG_FORMAT_MSG');
     113                                                $result[$index-1]['user'] = $user;
    117114                                        }else{
    118                                                 $result[$index] = $this->collaborator_model->processUser($user, $sentNumber);
    119                                                
    120                                                
     115                                                $result[$index-1] = $this->collaborator_model->processUser($user, $sentNumber);
    121116                                        }
    122                                         $result[$index]['date'] = date('d-m-Y H:i:s');
    123117                                }
    124118                               
    125119                        endforeach;
    126120                }
    127                
    128121                return $result;
    129122        }
  • pro-violet-viettel/sourcecode/application/modules/collaborator/models/collaborator_model.php

    r883 r906  
    77if ( ! defined('_SBG_REGISTER_VIP_FOR'))                                define('_SBG_REGISTER_VIP_FOR',                                 'VIP');
    88if ( ! defined('_SBG_CHARGING_FOR'))                                    define('_SBG_CHARGING_FOR',                             'NAP');
    9 if ( ! defined('_SBG_SYNTAX_ERR'))                                      define('_SBG_SYNTAX_ERR',                       'SYNTAX_ERR');
     9if ( ! defined('_SBG_SYNTAX_ERR'))                                              define('_SBG_SYNTAX_ERR',                       'SYNTAX_ERR');
    1010
    1111if ( ! defined('_SBG_CHARGING_SUCCESS'))                                define('_SBG_CHARGING_SUCCESS', 1);
     
    2424if ( ! defined('_SBG_PAIDTYPE_CARD')) define('_SBG_PAIDTYPE_CARD', 2);
    2525
     26if ( ! defined('_SBG_MO_PROCCESS_ERR'))                                 define('_SBG_MO_PROCCESS_ERR', 0);
     27
    2628class Collaborator_model extends CI_Model {
    2729       
     
    4042                $this->load->helper('language');
    4143                $this->lang->load('messages', 'message');
    42         }
    43        
    44         public function isExistUser($username){
    45                 return false;
    4644        }
    4745       
     
    6664                }
    6765               
     66               
    6867                return array('case' => $case, 'content' => $aryContent);
    6968        }
    7069       
    71         public function processUser($user, $sentNumber){
     70        public function isExistUser($cellphone)
     71        {
     72                $sql = "SELECT * FROM tbluser WHERE cellphone = ?";
     73                $this->db->query($sql, array('cellphone'=>$cellphone));
     74                if ($this->db->affected_rows() >0){
     75                        return true;
     76                }else{
     77                        return false;
     78                }
     79        }
     80       
     81        public function processUser($user, $sentNumber)
     82        {
     83                $this->load->model('frontend/user_model');
     84                $data = array();
     85                $data['charging'] = array();
     86                $data['register-vip'] = array();
     87                $data['register'] = array();
     88                $username = $user['username'];
     89                $service = $user['service'];
     90                $amount = $user['amount'];
     91                $isExist = $this->isExistUser($username);
     92                //$isExist = false;
     93                if (!$isExist){
     94                        $data['register']['data'] = $this->registerUser($user, $sentNumber);
     95                        $user['service'] = "Đăng kÜ";
     96                        $user['amount'] = null;
     97                        $data['register']['user'] = $user;
     98                        $data['register']['date'] = date('d-m-Y H:i:s');
     99                }else{
     100                        $data['register']['data']['success'] = 0;
     101                        $data['register']['data']['error'] = "Người dùng đã tồn tại";
     102                        $user['service'] = "Đăng kÜ";
     103                        $user['amount'] = null;
     104                        $data['register']['user'] = $user;
     105                        $data['register']['date'] = date('d-m-Y H:i:s');
     106                }
     107               
     108                // NAP
     109                if ($amount){
     110                        $user['amount'] = $amount;
     111                        $data['charging']['data'] = $this->chargingForUser($user, $sentNumber);
     112                        $user['service'] = "Nạp tiền";
     113                        $data['charging']['user'] = $user;
     114                        $data['charging']['date'] = date('d-m-Y H:i:s');
     115                }
     116                if ($service){
     117                        // ĐK VIP
     118                       
     119                        $aryMatched = explode(' ', trim($service));
     120                        $p_code = $aryMatched[1];
     121                        $package = $package = $this->user_model->get_package ( $p_code );
     122                        $amount = $package['p_price'];
     123                        $user['amount'] = $amount;
     124                        $data['chargingvip']['data'] = $this->chargingForUser($user, $sentNumber);
     125                        $user['service'] = "Nạp tiền";
     126                        $data['chargingvip']['user'] = $user;
     127                        $data['chargingvip']['date'] = date('d-m-Y H:i:s');
     128                       
     129                        if ($data['chargingvip']['data']['success'] == 1){
     130                       
     131                                $data['register-vip']['data'] = $this->registerVipUser($user, $p_code);
     132                                $user['service'] = "Đăng kÜ ".trim($service);
     133                                $user['amount'] = -$amount;
     134                                $data['register-vip']['user'] = $user;
     135                                $data['register-vip']['date'] = date('d-m-Y H:i:s');
     136                        }else{
     137                                $data['register-vip']['data']['success'] = 0;
     138                                $data['register-vip']['data']['error'] = "Tài khoản chính cá»§a thuê bao ".$sentNumber. " khÃŽng đủ để thá»±c hiện giao dịch này";
     139                                $user['service'] = "Đăng kÜ ".trim($service);
     140                                $user['amount'] = -$amount;
     141                                $data['register-vip']['user'] = $user;
     142                                $data['register-vip']['date'] = date('d-m-Y H:i:s');
     143                        }
     144                       
     145                }
     146                /*     
     147                }elseif ($service){
     148                        // ĐK VIP
     149                        $aryMatched = explode(' ', trim($service));
     150                        $p_code = $aryMatched[1];
     151                        $data['register-vip']['data'] = $this->registerVipUser($user, $p_code);
     152                        $user['service'] = "Đăng kÜ ".trim($service);
     153                        $data['register-vip']['user'] = $user;
     154                        $data['register-vip']['date'] = date('d-m-Y H:i:s');
     155                }else{
     156                        // DK
     157                        $data['register']['data'] = $this->registerUser($user, $sentNumber);
     158                        $user['service'] = "Đăng kÜ";
     159                        $data['register']['user'] = $user;
     160                        $data['register']['date'] = date('d-m-Y H:i:s');
     161                }*/
     162                return $data;
     163        }
     164        /*
     165        public function processUser($user, $sentNumber)
     166        {
    72167                $data = array();       
    73168                $serviceAnalys = $this->serviceAnalys($user['service']);
    74169               
    75170                $case = $serviceAnalys['case'];
    76                 $aryContents = isset($serviceAnalys['content']) ? $serviceAnalys['content']: null;
     171                $aryContents = isset($serviceAn
     172                alys['content']) ? $serviceAnalys['content']: null;
    77173               
    78174                switch($case){
    79175                        case _SBG_REGISTER_FOR:
    80                                 $data = $this->registerUser($user);
     176                                $data = $this->registerUser($user, $sentNumber);
    81177                                break;
    82178                        case _SBG_REGISTER_VIP_FOR:
     
    98194               
    99195        }
    100 
    101         public function registerUser($user){
     196*/
     197        public function registerUser($user, $sentNumber)
     198        {
    102199
    103200                $data = array();
    104                 $data['user'] = $user;
     201                //$data['user'] = $user;
    105202                $this->load->model('frontend/user_model');
    106203                $this->load->model('services/services_model');
     
    108205                $token = md5($user['username'] . self::TOKENPW);
    109206                $sms = '';
    110                 $collborator = $user['collboratorId'];
     207                $collboratorId = $user['collboratorId'];
    111208                $username = $user['username'];
    112209                $password = $this->createRandomPassword();
     
    139236                                $arrUser['us_id'] = $us_id;
    140237                                $arrUser['cellphone'] = $username;
    141                                 $arrUser['collborator'] = $collborator;
     238                                $arrUser['collaborator'] = $sentNumber;
    142239                                $arrUser['acc_balanced'] = 0;
    143240                                $arrUser['p_id'] = $trialpackage['p_id'];
     
    178275        }
    179276       
    180         public function registerVipUser($arrUser, $p_code){
     277        public function registerVipUser($arrUser, $p_code)
     278        {
    181279                $data = array();
    182                 $data['user'] = $arrUser;
     280                //$data['user'] = $arrUser;
    183281                $this->load->model('frontend/user_model');
    184282                $username = $arrUser['username'];
     
    232330        }
    233331       
    234         public function chargingForUser($user, $sentNumber){
     332        public function chargingForUser($user, $sentNumber)
     333        {
    235334
    236335                $this->load->model('services/services_model');
    237336                $this->load->model('frontend/user_model');
    238337                $data = array();
    239                 $data['user'] = $user;
     338                //$data['user'] = $user;
    240339                $username = $user['username'];
    241340                $amount = $user['amount'];
     341               
     342                if (!preg_match('/^[0-9]{3,}$/', $amount)) {
     343                        $smsReturn = lang('_SBG_MO_AMOUNT_WRONG_FORMAT_MSG');
     344                        $data['success'] = 0;
     345                        $data['error'] = $smsReturn;
     346                }
    242347       
    243348                $result =$this->services_model->chargeRootAccountProcess($sentNumber, $amount, $sentNumber.' paid for SBG');
     
    284389        }
    285390       
    286        
    287         public function createRandomPassword(){
     391        public function getCollaboratorByPhone($sentNumber){
     392                $sql = "SELECT * from tblcollaborator where login_name = ? LIMIT 0,1";
     393                $query = $this->db->query ( $sql, array ( $sentNumber  ) );
     394                $row = $query->row_array ();
     395                return $row;
     396        }
     397       
     398        public function getPassword($sentNumber){
     399                $collaborator = array();
     400                $collaborator = $this->getCollaboratorByPhone($sentNumber);
     401                if ($collaborator){
     402                        $passwd = $this->createRandomPassword();
     403                        $collaborator['passwd'] = md5($passwd);
     404                        $this->updateCollaborator($collaborator['id'], $collaborator);
     405                        $aryPatterns = array('/:password:/');
     406                        $sms = preg_replace($aryPatterns, array($passwd), lang('_SBG_COLLABORATOR_PASSWORD_MSG'));
     407                        $status = 1;
     408                       
     409                }else{
     410                        $aryPatterns = array('/:collaborator:/');
     411                        $sms = preg_replace($aryPatterns, array($sentNumber), lang('_SBG_MO_COLLABORATOR_NOT_FOUND_MSG'));
     412                        $status = 0;
     413                }
     414                return $status . '|' . $sms;
     415        }
     416       
     417        public function createRandomPassword()
     418        {
    288419                $alphabet = "0123456789";
    289420                $pass = array ();
     
    296427        }
    297428       
    298         public function getProvinceAndDistict($province, $district){
    299                 $result['province'] = $province;
    300                 $result['district'] = $district;
     429        public function getProvinceAndDistict($province, $district)
     430        {
     431                $result['province'] = '';
     432                $p = trim(ucwords($province));
     433                $result['district'] = '';
     434                $d = trim(ucwords($district));
    301435                $provinces = lang('_PROVINCES_');
    302436
    303437                foreach ($provinces as $key => $pro):
    304                         if($province == $pro){
     438                        if($p == $pro){
    305439                                $result['province'] = $key;
    306440                                break;
    307441                        }
    308442                endforeach;
    309                 $sql = "SELECT * FROM tbldistrict where province_id = ? AND district_name = ?";
    310                
    311                 $query = $this->db->query ( $sql, array ($result['province'], $result['district']) );
     443                //$sql = "SELECT * FROM tbldistrict where province_id = ? AND district_name LIKE '%".$d."%'";
     444                $sql = "SELECT * FROM tbldistrict where province_id = ? AND INSTR(?, district_name)>0";
     445                //write_file('./log/sql.log', date('d-m-Y H:i:s') . ": " . $sql . "\n", FOPEN_WRITE_CREATE);
     446                $query = $this->db->query ( $sql, array ($result['province'], $d) );
    312447                if ($query->num_rows () > 0) {
    313448                        $row = $query->row_array ();
     
    317452        }
    318453       
    319         public function updateCollaborator($id, $collaborator){
     454        public function updateCollaborator($id, $collaborator)
     455        {
    320456                $this->db->where ( 'id', $id );
    321457                return $this->db->update ( 'tblcollaborator', $collaborator );
    322458        }
    323459       
    324         public function checkPassCollaborator($id, $passwd){
     460        public function checkPassCollaborator($id, $passwd)
     461        {
    325462                $passwd = md5($passwd);;
    326463                $sql = "SELECT * FROM tblcollaborator WHERE id = ? AND passwd = ?";
     
    332469                }
    333470        }
     471       
     472        public function insertUser($user)
     473        {
     474                $this->db->insert ( 'tbluser', $user );
     475                //var_dump($user);
     476                if ($this->db->affected_rows()>0){
     477                        return true;
     478                }else{
     479                        return false;
     480                }
     481        }
    334482}
  • pro-violet-viettel/sourcecode/application/modules/collaborator/views/collaborator_profile.php

    r883 r906  
    1818                <div class="collaborator-profile row" id="collaborator-profile-3">
    1919                    <div class="col-sm-offset-1 col-sm-10">
    20 
    2120                        <div class="tabbable">
    2221                            <ul class="nav nav-tabs padding-16">
    23 
    24                                 <li class="active">
    25                                     <a id="edit-password-tab" href="" data-toggle="tab">
     22                                                                <li class="active">
     23                                    <a id="edit-basic-tab" href="#edit-basic" data-toggle="tab">
     24                                        <i class="blue icon-key bigger-125"></i>
     25                                       ThÃŽng tin cá nhân
     26                                    </a>
     27                                </li>
     28                                <li>
     29                                    <a id="edit-password-tab" href="#edit-password" data-toggle="tab">
    2630                                        <i class="blue icon-key bigger-125"></i>
    2731                                       Thay đổi mật khẩu
    2832                                    </a>
    2933                                </li>
    30 
    3134                            </ul>
    32 
     35                                                       
    3336                            <div class="tab-content profile-edit-tab-content">
    34                                 <div class="tab-pane active" id="edit-password">
    35                                                                         <!--<form id="frm-change-password" class="form-horizontal" role="form" action="<?php echo $base_url; ?>collaborator/collaborator/change_password" method="POST">-->
     37                                                                <div class="tab-pane active" id="edit-basic">           
     38                                                                        <form id="frm-update-info" class="form-horizontal" role="form">
     39                                                                                <h4 class="header blue bolder smaller">ThÃŽng tin cá nhân</h4>
     40                                                                                <div class="row">
     41                                            <div class="col-sm-9">
     42                                                                                                <div class="form-group">
     43                                                                                                        <label for="form-field-username" class="col-sm-4 control-label no-padding-right">Số điện thoại</label>
     44                                                                                                        <div class="col-sm-8">
     45                                                                                                                <input type="text" name="username" value="<?php echo $username; ?>" placeholder="Số điện thoại" id="form-field-username" class="col-xs-12 col-sm-10" disabled>
     46                                                                                                        </div>
     47                                                                                                </div>
     48                                                                                                <div class="form-group">
     49                                                                                                        <label for="form-field-first" class="col-sm-4 control-label no-padding-right">Họ và tên</label>
     50                                                                                                        <label class="block clearfix has-error">                                                                               
     51                                                                                                                <div class="col-sm-8">
     52                                                                                                                        <input type="text" name="fullname" value="<?php echo $fullname; ?>" placeholder="Họ và tên" id="form-field-first" class="col-xs-12 col-sm-10">
     53                                                                                                                </div>
     54                                                                                                                <small><div class="col-sm-8 help-block" id="fullname_err"> </div></small>
     55                                                                                                        </label>
     56                                                                                                </div>
     57                                                                                        </div>
     58                                        </div>
     59                                        <div class="clearfix form-actions">
     60                                            <div class="col-md-offset-3 col-md-9">
     61                                                <button type="button" onclick="return updateInfo();" class="btn btn-info">
     62                                                    <i class="icon-ok bigger-110"></i>
     63                                                    Cập nhật
     64                                                </button>       
     65                                            </div>
     66                                        </div>
     67                                                                        </form>
     68                                                                </div>
     69                                                               
     70                                <div class="tab-pane" id="edit-password">
     71                                                                       
    3672                                                                        <form id="frm-change-password" class="form-horizontal" role="form">
    3773                                                                                <h4 class="header blue bolder smaller">Thay đổi mật khẩu</h4>
     
    81117                                                                                        <div class="col-md-offset-3 col-md-9">
    82118                                                                                                <button type="button" onclick="return changePassword(<?php echo $collaborator_id; ?>);"  class="btn btn-info">
    83                                                                                                 <!--<button type="submit"  class="btn btn-info">-->
    84119                                                                                                        <i class="icon-ok bigger-110"></i>
    85120                                                                                                        Thay đổi
     
    90125                                                                                </form>
    91126                                </div>
     127                                                               
    92128
    93129                            </div>
     
    103139</div><!-- /.main-container-inner -->
    104140</div><!-- /.main-container -->
     141
     142<div class="modal fade" id="updateInfoSuccess" tabindex="-1" role="dialog"aria-hidden="true">
     143        <div class="modal-dialog">
     144                <div class="modal-content">
     145                        <div class="modal-header">
     146                                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
     147                                <h4 class="modal-title">Cập nhật thÃŽng tin</h4>
     148                        </div>
     149                        <div class="modal-body">
     150                                <div class="alert alert-block alert-success"><center><?php echo lang('_SBG_USER_UPDATE_INFO_SUCCESS_MSG'); ?><center></div>
     151                                <center><button id="close" class="btn btn-primary" data-dismiss="modal">Đóng</button></center>
     152                        </div>
     153               
     154                </div>
     155        </div>
     156</div>
    105157
    106158<div class="modal fade" id="changePassSuccess" tabindex="-1" role="dialog"aria-hidden="true">
  • pro-violet-viettel/sourcecode/application/modules/collaborator/views/login.php

    r883 r906  
    8080                                                                                                                <div class="help-block"> </div>
    8181                                                                                                        </label>
     82                                                                                                       
     83                                                                                                        <label class="block clearfix alert-success">
     84                                                                                                                        Nếu chưa có hoặc quên mật khẩu, soạn tin nhắn theo cú pháp: <strong>SBG CTV</strong> gá»­i <strong>8062</strong>
     85                                                                                                        </label>
     86                                                                                                       
     87                                                                                               
    8288
    8389                                                                                                        <div class="space"></div>
  • pro-violet-viettel/sourcecode/application/modules/collaborator/views/reportAsistant/indexCollaborator.php

    r883 r906  
    1616                {
    1717                    // $result = jQuery.parseJSON(data);
     18                                        console.log(data);
    1819                    $("#content").html(data);
    1920                    init_page();
     
    122123                daterange = $('input[name="daterange"]').val();
    123124        $.ajax({
    124             url: '<?php echo base_url();?>cong_tac_vien/thong_ke_cong_tac_vien/trang_ctv/<?php echo $id;?>/1',
     125            url: '<?php echo base_url();?>collaborator/home/getCollaboratorsUsers/<?php echo $id;?>/1',
    125126            type: "POST",
    126127            data: $("#collaborator").serialize(),
     
    219220</div><!-- /.modal-dialog -->
    220221<?php
    221 $this->load->view('layout/admin/footer', array('base_url' => $base_url,'adminjs' => array('assets/js/admin/collaborator.js')));
     222$this->load->view('layout/collaborator/footer', array('base_url' => $base_url,'collaboratorjs' => array('assets/js/collaborator/collaborator.js')));
    222223?>
  • pro-violet-viettel/sourcecode/application/modules/collaborator/views/reportAsistant/listview_user.php

    r883 r906  
    33            <!-- PAGE CONTENT BEGINS -->
    44            <div style="padding-bottom:4px" class="table-header">
     5                       
    56                Đã giới thiệu
     7                                <div class="pull-right" style="margin:5px;">
     8                                        <a style="color:#fff" href="<?php echo base_url();?>collaborator/home/export/<?php echo $perpage?>/<?php echo ($keyword)?$keyword:'default'; ?>/<?php echo ($date_start)?$date_start:'default'; ?>/<?php echo ($date_end)?$date_end:'default'; ?>/<?php echo $sorting_order; ?>">Xuất ra Excel</a>
     9                                </div>
    610            </div>
    711
     
    4347                                <th class="<?php if ($sorting_field == 'full_name') {echo $sorting_order;} else {echo "";}?>" id="full_name" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 176px;" aria-label="Số điện thoại: activate to sort column ascending">Tên người dùng</th>
    4448                                <th class="<?php if ($sorting_field == 'collaborator_cellphone') {echo $sorting_order;} else {echo "sorting";}?>" id="collaborator_cellphone" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 283px;" aria-label="Họ tên: activate to sort column ascending">Số thuê bao</th>
    45                                 <th class="<?php if ($sorting_field == 'total_user') {echo $sorting_order;} else {echo "sorting";}?>" id="total_user" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 176px;" aria-label="Số điện thoại: activate to sort column ascending">Ngày giới thiệu</th> 
     49                                <th class="<?php if ($sorting_field == 'user_created_time') {echo $sorting_order;} else {echo "sorting";}?>" id="user_created_time" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 176px;" aria-label="Ngày giới thiệu: activate to sort column ascending">Ngày giới thiệu</th> 
    4650                                <!--<th class="<?php if ($sorting_field == 'collaborator_created_time') {echo $sorting_order;} else {echo "sorting";}?>" id="collaborator_created_time" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 209px;" aria-label="Ngày đăng kÜ: activate to sort column ascending">Ngày đăng kÜ</th>-->
    4751                                 
     
    5256                           
    5357                            <?php
     58                                                        //var_dump($paidlogs);
    5459                            foreach ($paidlogs as $paidlog) {
    5560                                ?>
  • pro-violet-viettel/sourcecode/application/modules/collaborator/views/user/index.php

    r883 r906  
    2929     <div class="row" id="content">
    3030                <div class="col-xs-12">
    31                         <div class="row">
    32                                 <div class="col-sm-offset-1 col-sm-10">
    33                                         <form method="POST" id="frm-upload" action="" enctype="multipart/form-data" class="form-horizontal">
    34                                                 <h4 class="header blue bolder smaller">Chọn và tải file từ máy tính</h4>
    35                                                 <div class="row">
    36                                                         <div class="col-sm-9">
    37                                                                 <div class="form-group">
    38                                                                         <div class="col-sm-8" >
     31                        <div class="col-sm-offset-0 col-sm-12">
     32                                <div class="row">
     33                                <h4 class="header blue bolder smaller"> Bước 1: Tải file Đăng kÜ <a href="<?php echo $base_url ?>assets/Mau dang ky cua CTV.xls"><span style="color: red;">Tại đây</span></a></h4>
     34                                </div>
     35                                <div class="row">
     36                                        <h4 class="header blue bolder smaller">Bước 2: Điền thÃŽng tin vào file Đăng kÜ</h4>
     37                                        <h5>
     38                                        <ul class="nav">
     39                                                <li>    <b>Tên khách hàng</b>: KhÃŽng bắt buộc</li>
     40                                                <li>    <b>Tỉnh</b>: KhÃŽng bắt buộc</li>
     41                                                <li>    <b>Quận/Huyện</b>: KhÃŽng bắt buộc</li>
     42                                                <li>    <b>Đơn vị</b>: KhÃŽng bắt buộc</li>
     43                                                <li>    <b>Số điện thoại khách hàng</b>: Bắt buộc (có thể có số 0 đứng đầu hoặc khÃŽng có; phải là số điện thoại đi động, chỉ hỗ trợ Viettel, Vinaphone và Mobifone)</li>
     44                                                <li>    <b>Đăng kÜ gói dịch vụ</b>: KhÃŽng bắt buộc (Chọn VIP 1 hoặc VIP 3 hoặc để trống)</li>
     45                                                <li>    <b>Số tiền nạp vào TK SBG cá»§a khách hàng</b>: KhÃŽng bắt buộc (Nếu chọn thì chọn các giá trị có sẵn hoặc để trống)</li>
     46                                                <li>    <b>Mã CTV</b>: KhÃŽng bắt buộc</li>
     47                                        </ul>
     48                                        </h5>
     49                                </div>
     50                                <div class="row">
     51                                        <h4 class="header blue bolder smaller">Lưu Ü:</h4>
     52                                        <h5><ul>
     53                                                <li>    File đăng kÜ mẫu phải giữ nguyên định dạng XLS. KhÃŽng sá»­a định dạng cá»§a file mẫu, mọi sá»± thay đổi khÃŽng đúng sẜ có thể dẫn đến việc trừ tiền từ tài khoản cá»§a CTV khÃŽng đúng.</li>
     54                                                <li>    Các giao dịch trên file, nếu có tính phí thì phí sẜ được trừ trá»±c tiếp từ tài khoản chính cá»§a số điện thoại CTV (chính là số ĐT dùng để đăng nhập).</li>
     55                                        </ul></h5>
     56                                </div>
     57                               
     58                                <div class="row">
     59                                        <h4 class="header blue bolder smaller">Buớc 3: Upload file Đăng kÜ</h4>
     60                                        <div class="col-sm-offset-1 col-sm-10">
     61                                                <!--<h4 class="header blue bolder smaller">Chọn và tải file từ máy tính</h4>-->
     62                                                <form method="POST" id="frm-upload" action="" enctype="multipart/form-data" class="form-horizontal">
     63                                                       
     64                                                        <div class="row">
     65                                                                <div class="col-sm-9">
     66                                                                        <div class="form-group">
     67                                                                                <div class="col-sm-8" >
     68                                                                                       
     69                                                                                        <input type="text" id="input-upload" class="form-control"/>
     70                                                                                        <div class="file-upload btn btn-success">
     71                                                                                                <span>Chọn file ...</span>
     72                                                                                       
     73                                                                                                <input id="userfile" type="file" class="upload" name="userfile" />
     74                                                                                        </div>
     75                                                                                        <input type="submit" id="btn-submit" class="btn btn-primary" value="Tải lên" />
     76                                                                                </div>
    3977                                                                               
    40                                                                                 <input type="text" id="input-upload" class="form-control"/>
    41                                                                                 <div class="file-upload btn btn-success">
    42                                                                                         <span>Chọn file ...</span>
    43                                                                                
    44                                                                                         <input id="userfile" type="file" class="upload" name="userfile" />
    45                                                                                 </div>
    46                                                                                 <input type="submit" id="btn-submit" class="btn btn-primary" value="Tải lên" />
    4778                                                                        </div>
    48                                                                        
    4979                                                                </div>
    5080                                                        </div>
    51                                                 </div>
    52                                                 <h4 class="header blue bolder smaller"></h4>
    53                                                
     81                                                        <h4 class="header blue bolder smaller"></h4>
     82                                                       
    5483
    55                                         </form>
     84                                                </form>
     85                                        </div>
    5686                                </div>
    5787                        </div>
     
    6191        <center><label id="charging" style="display: none;"><h4><span class="icon-refresh icon-refresh-animate"></span> Đang xá»­ lÜ. Xin vui lòng chờ...</h4></label></center>
    6292        <div id="result">
    63         </div> 
     93        </div>
     94       
     95       
    6496</div><!-- /.main-content -->
    6597</div><!-- /.main-container-inner -->
  • pro-violet-viettel/sourcecode/application/modules/collaborator/views/user/result.php

    r883 r906  
    1 <?php if($success==0){ ?>
     1<?php if ($success == 0){ ?>
    22        <div id="error-upload" class="alert alert-danger" role="alert">
    33                <span class="icon-exclamation-sign" aria-hidden="true"></span>
    4                 <span class="sr-only">Error:</span> <?php echo " ".$process['error']; ?>
     4                <span class="sr-only">Error:</span> <?php echo " ".$upload_error['error']; ?>
    55        </div>
    6 <?php }elseif($success == 1){ ?>
    7         <?php if ($process){?>
     6<?php }else { ?>
     7        <?php if($process){ ?>
    88                <div class="row">
    99                        <div class="col-xs-12">
    10                                 <!-- PAGE CONTENT BEGINS -->
    1110                                <div style="padding-bottom:4px" class="table-header">
    1211                                Kết quả
    1312                                </div>
    14                         <?php //if ($success == 0){ ?>
    15                                
    16                         <?php //}elseif($success == 1){ ?>
    1713                                <div class="table-responsive">
    1814                                        <div role="grid" class="dataTables_wrapper" id="sample-table-2_wrapper">
     
    2117                                                                <thead>
    2218                                                                        <tr role="row">
    23                                                                                 <th class="center sorting_disabled" role="columnheader" rowspan="1" colspan="1" style="width: 44px;" aria-label="">
    24                                                                                         <label>
    25                                                                                                 <input type="checkbox" class="ace">
    26                                                                                                 <span class="lbl"></span>
    27                                                                                         </label>
    2819                                                                                </th>
    2920                                                                                <th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 156px;">Số điện thoại</th>
    3021                                                                                <th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 156px;">Họ và tên</th>
    31                                                                                 <th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 156px;">Gói dịch vụ</th>
    32                                                                                 <th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 156px;">Số tiền nạp vào</th>
     22                                                                                <th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 156px;">Tên dịch vụ</th>
     23                                                                                <th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 156px;">Số tiền</th>
    3324                                                                                <th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 156px;">Ngày giờ thá»±c hiện</th>
    3425                                                                                <th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 156px;">Kết quả</th>
    3526                                                                                <th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 156px;">LÜ do</th>
    3627                                                                        </tr>
    37                                                                          <tbody role="alert" aria-live="polite" aria-relevant="all">
    38 
    39                                                                                 <?php
    40                                                                                 foreach ($process as $user): ?>
    41                                                                                 <tr class="odd">
    42                                                                                         <td class="center  sorting_1">
    43                                                                                                 <label>
    44                                                                                                         <input type="checkbox" class="ace">
    45                                                                                                         <span class="lbl"></span>
    46                                                                                                 </label>
    47                                                                                         </td>
    48                                                                                         <td class=" "><?php echo $user['user']['username']; ?></td>
    49                                                                                         <td class=" "><?php echo $user['user']['fullname']; ?></td>
    50                                                                                         <td class=" "><?php echo $user['user']['service']; ?></td>
    51                                                                                         <td class=" "><?php echo $user['user']['amount']; ?></td>
    52                                                                                         <td class=" "><?php echo $user['date']; ?></td>
    53                                                                                         <td class=" "><?php echo ($user['success'] == 1? "Thành cÃŽng": "KhÃŽng thành cÃŽng"); ?></td>
    54                                                                                         <td class=" "><?php  echo $user['error']; ?></td>
    55                                                                                 </tr>
    56                                                                                 <?php endforeach; ?>
     28                                                                        <tbody role="alert" aria-live="polite" aria-relevant="all">
     29                                                                        <?php foreach ($process as $result ){ ?>
     30                                                                       
     31                                                                                <?php if ($result['register']){ ?>
     32                                                                                        <tr>
     33                                                                                                <td class=" "><?php echo $result['register']['user']['username']; ?></td>
     34                                                                                                <td class=" "><?php echo $result['register']['user']['fullname']; ?></td>
     35                                                                                                <td class=" "><?php echo $result['register']['user']['service']; ?></td>
     36                                                                                                <td class=" "><?php echo $result['register']['user']['amount']; ?></td>
     37                                                                                                <td class=" "><?php echo $result['register']['date']; ?></td>
     38                                                                                                <td class=" "><?php echo ($result['register']['data']['success'] == 1? "Thành cÃŽng": "KhÃŽng thành cÃŽng"); ?></td>
     39                                                                                                <td class=" "><?php echo $result['register']['data']['error']; ?></td>
     40                                                                                        </tr>                                                                   
     41                                                                                <?php } ?>
     42                                                                               
     43                                                                                <?php if ($result['charging']){ ?>
     44                                                                                        <tr>
     45                                                                                                <td class=" "><?php echo $result['charging']['user']['username']; ?></td>
     46                                                                                                <td class=" "><?php echo $result['charging']['user']['fullname']; ?></td>
     47                                                                                                <td class=" "><?php echo $result['charging']['user']['service']; ?></td>
     48                                                                                                <td class=" "><?php echo number_format($result['charging']['user']['amount'], 0); ?></td>
     49                                                                                                <td class=" "><?php echo $result['charging']['date']; ?></td>
     50                                                                                                <td class=" "><?php echo ($result['charging']['data']['success'] == 1? "Thành cÃŽng": "KhÃŽng thành cÃŽng"); ?></td>
     51                                                                                                <td class=" "><?php echo $result['charging']['data']['error']; ?></td>
     52                                                                                        </tr>                                                                   
     53                                                                                <?php } ?>
     54                                                                               
     55                                                                                <?php if ($result['chargingvip']){ ?>
     56                                                                                        <tr>
     57                                                                                                <td class=" "><?php echo $result['chargingvip']['user']['username']; ?></td>
     58                                                                                                <td class=" "><?php echo $result['chargingvip']['user']['fullname']; ?></td>
     59                                                                                                <td class=" "><?php echo $result['chargingvip']['user']['service']; ?></td>
     60                                                                                                <td class=" "><?php echo number_format($result['chargingvip']['user']['amount'], 0); ?></td>
     61                                                                                                <td class=" "><?php echo $result['chargingvip']['date']; ?></td>
     62                                                                                                <td class=" "><?php echo ($result['chargingvip']['data']['success'] == 1? "Thành cÃŽng": "KhÃŽng thành cÃŽng"); ?></td>
     63                                                                                                <td class=" "><?php echo $result['chargingvip']['data']['error']; ?></td>
     64                                                                                        </tr>                                                                   
     65                                                                                <?php } ?>
     66                                                                               
     67                                                                                <?php if ($result['register-vip']){ ?>
     68                                                                                        <tr>
     69                                                                                                <td class=" "><?php echo $result['register-vip']['user']['username']; ?></td>
     70                                                                                                <td class=" "><?php echo $result['register-vip']['user']['fullname']; ?></td>
     71                                                                                                <td class=" "><?php echo $result['register-vip']['user']['service']; ?></td>
     72                                                                                                <td class=" "><?php echo number_format($result['register-vip']['user']['amount'], 0); ?></td>
     73                                                                                                <td class=" "><?php echo $result['register-vip']['date']; ?></td>
     74                                                                                                <td class=" "><?php echo ($result['register-vip']['data']['success'] == 1? "Thành cÃŽng": "KhÃŽng thành cÃŽng"); ?></td>
     75                                                                                                <td class=" "><?php echo $result['register-vip']['data']['error']; ?></td>
     76                                                                                        </tr>                                                                   
     77                                                                                <?php } ?>
     78                                                                               
     79                                                                               
     80                                                                        <?php } ?>
     81                                                                       
    5782                                                                        </tbody>
    5883                                                                </thead>
    59                                                                 </table>
     84                                                        </table>
    6085                                                </div>
    6186                                        </div>
    6287                                </div>
    6388                        </div>
    64                         </div>
    65         <?php }else{ ?>
    66                 <div id="error-upload" class="alert alert-danger" role="alert">
    67                         <span class="icon-exclamation-sign" aria-hidden="true"></span>
    68                         <span class="sr-only">Error:</span> KhÃŽng đọc được file</div>
     89                </div>                                                 
    6990        <?php } ?>
    7091<?php } ?>
Note: See TracChangeset for help on using the changeset viewer.