Changeset 883


Ignore:
Timestamp:
Apr 7, 2015 1:52:40 PM (10 years ago)
Author:
namnd
Message:
 
Location:
pro-violet-viettel/sourcecode
Files:
26 added
23 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/sourcecode/application/config/routes.php

    r821 r883  
    136136$route['frontend/lecture/help.pdf'] = 'frontend/lecture/help';
    137137
     138$route['cong_tac_vien'] = 'collaborator/home';
     139$route['collaborator'] = 'collaborator/home';
     140$route['cong_tac_vien/:any'] = 'collaborator/home/viewAsistant';
     141$route['cong_tac_vien/thong_ke_nguoi_dung/trang/:any'] = 'collaborator/home/getCollaboratorsUsers/$1';
     142$route['cong_tac_vien/nguoi_dung'] = 'collaborator/user';
     143$route['cong_tac_vien/thong_tin_ca_nhan'] = 'collaborator/collaborator/profile';
     144//$route['cong_tac_vien/thong_tin_ca_nhan/thay_doi_mat_khau/:any'] = 'collaborator/collaborator/change_password/$1';
     145
    138146/* End of file routes.php */
    139147/* Location: ./application/config/routes.php */
  • pro-violet-viettel/sourcecode/application/language/message/messages_lang.php

    r818 r883  
    2121$lang['_SBG_ADMIN_LOGIN_NAME_REQUIRED_MSG'] = 'Chưa nhập tài khoản admin';
    2222$lang['_SBG_ADMIN_PASSWORD_REQUIRED_MSG'] = 'Vui lòng nhập mật khẩu';
     23
     24// collaborator
     25$lang['_SBG_COLLABORATOR_LOGIN_FAIL_MSG'] = 'Sai username hoặc password!';
     26$lang['_SBG_COLLABORATOR_LOGIN_NAME_REQUIRED_MSG'] = 'Chưa nhập tài khoản cộng tác viên';
     27$lang['_SBG_COLLABORATOR_PASSWORD_REQUIRED_MSG'] = 'Vui lòng nhập mật khẩu';
    2328
    2429// frontend
  • pro-violet-viettel/sourcecode/application/modules/admin/controllers/report.php

    r818 r883  
    1515    public function index() {
    1616        $data = array();
     17
    1718        $admin_info = $this->session->userdata('adminInfo');
    1819        if ($admin_info) {
    19             $data['statistics'] = $this->getStatistics();
     20                        $data['statistics'] = $this->getStatistics();
    2021            $data['content'] = $this->getPaidlogs();
    2122            $this->load->view('report/index', $data);
     
    3031        return $this->load->view('report/statistics', $data, true);
    3132    }
    32 
     33       
    3334
    3435    public function getPaidlogs($filters = array()) {
     
    6970                        $data ['paid_type'] = ( int ) $this->input->post ( 'paid_type' );
    7071                }
    71                
    7272                $data['daterange_start'] = "";
    7373                $data['daterange_end'] = "";
     
    7878                }
    7979        $data['start'] = ($data['current_page'] - 1) * $data['perpage'];
     80               
    8081        $data['total'] = $this->paidlog_model->countPaidlog($data);
    81         $data['paidlogs'] = $this->paidlog_model->getPaidlogs($data)['paid_logs'];
    82                 $data['total_amount'] = $this->paidlog_model->getPaidlogs($data)['total_amount'];
     82                $result = $this->paidlog_model->getPaidlogs($data);
     83                $data['paidlogs'] = $result['paid_logs'];
     84                $data['total_amount'] = $result['total_amount'];
    8385               
    8486        $data['paging_url'] = base_url() . "/admin/doanh_thu_tong_hop/trang/";
    8587        $data['num_links'] = 2;
    8688        $data['paging'] = pagging($data);
     89               
     90
    8791        foreach ($data['paidlogs'] as $index => $paidlog) {
    8892            $data['paidlogs'][$index]['username'] = @$this->get_fullname($paidlog['us_id']);
     
    9397        }
    9498        return $this->load->view('report/listview', $data, true);
     99               
    95100    }
    96101
     
    137142        }
    138143    }
    139        
     144
    140145        public function export(){
     146               
    141147        $this->load->model('paidlog_model');
    142148                $data ['paid_types'] = array (
     
    157163                        $data['daterange_end'] = date('Y-m-d 23:59:59', strtotime($daterange[1]));
    158164                }
     165               
    159166        $data['total'] = $this->paidlog_model->countPaidlog($data);
    160         $data['paidlogs'] = $this->paidlog_model->getPaidlogs($data)['paid_logs'];
    161                 $data['total_amount'] = $this->paidlog_model->getPaidlogs($data)['total_amount'];
     167                $result = $this->paidlog_model->getPaidlogs($data);
     168        $data['paidlogs'] = $result['paid_logs'];
     169                $data['total_amount'] = $result['total_amount'];
    162170               
    163171        foreach ($data['paidlogs'] as $index => $paidlog) {
     
    177185
    178186               
    179        
     187               
    180188                $sheet->setCellValue('B1', "TẬP ĐOÀN VIỄN THÔNG QUÂN ĐỘI");
    181189                $style = array(
     
    278286                        )
    279287                );
    280 
     288               
    281289        $dem=0;
    282290        foreach ($data['paidlogs'] as $index => $paidlog) {
     
    297305            $dem++;
    298306        }
     307               
    299308        $writer = new PHPExcel_Writer_Excel5($this->phpexcel);
    300309                header('Content-Type: application/vnd.ms-excel');
    301310        header('Content-Disposition: attachment; filename="bao_cao_tong_hop_'.date('d-m-Y').'.xls"');
    302311        $writer->save('php://output');
     312               
    303313        }
    304314}
  • pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportpackage.php

    r818 r883  
    2929
    3030        $this->load->model('reportmodel');
    31         $data['date']=1;
     31        $data['date']=date("d");
    3232        $data['month'] = date("m");
    3333        $data['year'] = date("Y");
    34         $data['to_date']= 31;
     34        $data['to_date']= date("d");
    3535        $data['to_month'] = date("m");
    3636        $data['to_year'] = date("Y");
    3737        if ($this->input->post('month')) {
     38                        $data['date']= $this->input->post('date');
    3839            $data['month'] = $this->input->post('month');
    3940            $data['year'] = $this->input->post('year');
     41                        $data['to_date'] = $this->input->post('to_date');
     42            $data['to_month'] = $this->input->post('to_month');
     43            $data['to_year'] = $this->input->post('to_year');
    4044        }
    4145        $data = $this->getdays($data);
     
    7074    public function export() {
    7175        $this->load->model('reportmodel');
    72                 $data['date']=1;
    73         $data['month'] = $this->uri->segment(4);
    74         $data['year'] = $this->uri->segment(5);
    75                 $data['to_date']=31;
    76         $data['to_month'] = date("m");
    77         $data['to_year'] = date("Y");
    78         $data = $this->getdays($data);
     76                //$data['date']=1;
     77        $data['date'] = $this->uri->segment(4);
     78                $data['month'] = $this->uri->segment(5);
     79        $data['year'] = $this->uri->segment(6);
     80                $data['to_date'] = $this->uri->segment(8);
     81                $data['to_month'] = $this->uri->segment(9);
     82        $data['to_year'] = $this->uri->segment(10);
     83        //$data = $this->getdays($data);
    7984        $result = $this->reportmodel->getPackages($data);
    8085        $data['provinces'] = $result['provinces'];
     
    8590        $sheet = $this->phpexcel->getActiveSheet();
    8691        $sheet->setTitle("bao cao thue bao " . $data['month'] . " - " . $data['year']);
    87         $sheet->getColumnDimension('A')->setWidth(10);
     92         $sheet->getColumnDimension('A')->setWidth(10);
    8893        $sheet->getColumnDimension('B')->setWidth(25);
    89         $sheet->getColumnDimension('C')->setWidth(15);
     94        $sheet->getColumnDimension('C')->setWidth(25);
    9095        $sheet->getColumnDimension('D')->setWidth(15);
    9196        $sheet->getColumnDimension('E')->setWidth(15);
    9297        $sheet->getColumnDimension('F')->setWidth(15);
    9398        $sheet->getColumnDimension('G')->setWidth(15);
    94         $sheet->getColumnDimension('H')->setWidth(15);
    95         $sheet->setCellValue('A1', "Báo cáo doanh thu theo tỉnh");
    96         $sheet->setCellValue('A2', "Thời gian: " . $data['month'] . " - " . $data['year']);
    97         $sheet->setCellValue('A4', "STT");
    98         $sheet->setCellValue('B4', "Mã Tỉnh/Thành phố");
    99         $sheet->setCellValue('C4', "Tỉnh/Thành phố");
     99        $sheet->getColumnDimension('H')->setWidth(15);
     100        $sheet->getColumnDimension('I')->setWidth(15);
     101        $sheet->getColumnDimension('J')->setWidth(15);
     102               
     103                $sheet->setCellValue('B1', "TẬP ĐOÀN VIỄN THÔNG QUÂN ĐỘI");
     104                $style = array(
     105                        'font' => array('bold' => true, 'size' => 12, 'name' =>'Cambria', 'color' => array('rgb' => '0070bf')),
     106                        'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
     107                                                                'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
     108                                                                'wrap' => true )
     109                );
     110                $sheet->mergeCells('B1:K1');
     111                $sheet->getStyle('B1')->applyFromArray($style);
     112               
     113                $sheet->setCellValue('B2', "TỔNG CÔNG TY VIỄN THÔNG VIETTEL");
     114               
     115                $style = array(
     116                        'font' => array('size' => 12, 'name' =>'Cambria', 'color' => array('rgb' => '0070bf')),
     117                        'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
     118                                                                'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
     119                                                                'wrap' => true )
     120                );
     121                $sheet->mergeCells('B2:K2');
     122                $sheet->getStyle('B2')->applyFromArray($style);
     123               
     124                $style = array(
     125                        'font' => array('bold' => true,'size' => 12, 'name' =>'Cambria'),
     126                        'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
     127                                                                'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
     128                                                                'wrap' => true )
     129                );
     130                $sheet->setCellValue('A4', "BÁO CÁO DOANH THU THEO TỈNH");
     131                $sheet->mergeCells('A4:L4');
     132                $sheet->getStyle('A4:L4')->applyFromArray($style);
     133               
     134               
     135                $style = array(
     136                        'font' => array('size' => 11, 'name' =>'Cambria'),
     137                        'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
     138                                                                'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
     139                                                                'wrap' => true ),
     140                        'borders' =>    array(
     141                                'allborders' => array(
     142                                        'style' => \PHPExcel_Style_Border::BORDER_THIN
     143                                        )
     144                        )
     145                );
     146               
     147                $sheet->setCellValue('B6', "Từ ngày: ".$data['date']."/".$data['month']."/".$data['year']);
     148                $sheet->setCellValue('C6', "Đến ngày: ".$data['to_date']."/".$data['to_month']."/".$data['to_year']);
     149                $sheet->setCellValue('B7', "Ngày kết xuất: ".date("d")."/".date("m")."/".date("Y"));
     150                $sheet->setCellValue('C7', "Nhân viên kết xuất: ");
     151               
     152                $sheet->getStyle('B6:C7')->applyFromArray($style);
     153               
     154                $style = array(
     155                        'font' => array('bold' => true, 'size' => 11, 'name' =>'Cambria'),
     156                        'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
     157                                                                'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
     158                                                                'wrap' => true ),
     159                        'borders' =>    array(
     160                                'allborders' => array(
     161                                        'style' => \PHPExcel_Style_Border::BORDER_THIN
     162                                        )
     163                        )
     164                );
     165
     166        $sheet->setCellValue('A9', "STT");
     167        $sheet->setCellValue('B9', "Mã Tỉnh/Thành phố");
     168        $sheet->setCellValue('C9', "Tỉnh/Thành phố");
     169                $sheet->getStyle('A9:C9')->applyFromArray($style);
     170               
    100171        $chars = array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L");
    101172        $dem = 2;
    102         $stt=1;
     173        $stt = 1;
    103174        foreach ($data['packages'] as $package) {
    104175            $dem++;
    105             $sheet->setCellValue($chars[$dem] . "4", $package['p_name']);
     176            $sheet->setCellValue($chars[$dem] . "9", $package['p_name']);
    106177            $dem++;
    107             $sheet->setCellValue($chars[$dem] . "4", "Tỉ lệ %");
     178            $sheet->setCellValue($chars[$dem] . "9", "Tỉ lệ %");
    108179       
    109180            $stt++;
    110181        }
    111182        $dem++;
    112         $sheet->setCellValue($chars[$dem] . ($index + 4), "Tổng TB");
    113 
    114 $stt=1;
     183                $sheet->setCellValue($chars[$dem] . ($index + 9), "Tổng TB");
     184                $sheet->getStyle('A9:'.$chars[$dem] . ($index + 9))->applyFromArray($style);
     185               
     186                //$sheet->getStyle($chars[$dem].($index + 9))->applyFromArray($style);
     187               
     188                $sheet->setCellValue('A10', "Tổng");
     189                $sheet->mergeCells('A10:C10');
     190                $sheet->getStyle('A10:'.$chars[$dem].($index + 10))->applyFromArray($style);
     191
     192                $dem = 2;
     193               
     194                foreach ($data['totalVip'] as $vipName=>$totalVip){
     195                        $dem++;
     196                        $sheet->setCellValue($chars[$dem] . '10', $totalVip);
     197                        $sheet->getStyle($chars[$dem] . '10')->applyFromArray($style);
     198                        $dem++;
     199                }
     200               
     201                //$sheet->getStyle('A10:'.$chars[$dem].($index + 10))->applyFromArray($style);
     202               
     203                $styleSTT = array(
     204                        'font' => array('size' => 11, 'name' =>'Cambria'),
     205                        'alignment' => array('bold' => true,
     206                                                                'horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
     207                                                                'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
     208                                                                'wrap' => true ),
     209                        'borders' =>    array(
     210                                'allborders' => array(
     211                                        'style' => \PHPExcel_Style_Border::BORDER_THIN
     212                                        )
     213                        )
     214                );
     215               
     216                $style = array(
     217                        'font' => array('size' => 11, 'name' =>'Cambria'),
     218                        'alignment' => array('bold' => true,
     219                                                                'horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
     220                                                                'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
     221                                                                'wrap' => true ),
     222                        'borders' =>    array(
     223                                'allborders' => array(
     224                                        'style' => \PHPExcel_Style_Border::BORDER_THIN
     225                                        )
     226                        )
     227                );
     228               
     229                $stt=1;
    115230        foreach ($data['provinces'] as $index => $provinces) {
    116231
    117             $sheet->setCellValue('A' . ($stt + 5), $provinces['stt']);
    118             $sheet->setCellValue('B' . ($stt + 5), $index);
    119             $sheet->setCellValue('C' . ($stt + 5), $provinces['province']);
     232            $sheet->setCellValue('A' . ($stt + 10), $provinces['stt']);
     233                        $sheet->getStyle('A'.($stt + 10))->applyFromArray($styleSTT);
     234            $sheet->setCellValue('B' . ($stt + 10), $index);
     235            $sheet->setCellValue('C' . ($stt + 10), $provinces['province']);
     236                        $sheet->getStyle('B'.($stt + 10).":C".($stt + 10))->applyFromArray($style);
    120237            $dem = 2;
    121238            foreach ($provinces['packages'] as $package) {
    122239                $dem++;
    123                 $sheet->setCellValue($chars[$dem] . ($stt + 5), $package['total']);
     240                $sheet->setCellValue($chars[$dem] . ($stt + 10), $package['total']);
     241                                $sheet->getStyle($chars[$dem] . ($stt + 10))->applyFromArray($style);
    124242                $dem++;
    125                 $sheet->setCellValue($chars[$dem] . ($stt + 5), $package['percent']);
     243                $sheet->setCellValue($chars[$dem] . ($stt + 10), $package['percent']);
     244                                $sheet->getStyle($chars[$dem] . ($stt + 10))->applyFromArray($style);
    126245            }
    127246            $dem++;
    128247           
    129             $sheet->setCellValue($chars[$dem] . ($stt + 5), $provinces['total']);
     248            $sheet->setCellValue($chars[$dem] . ($stt + 10), $provinces['total']);
     249                        $sheet->getStyle($chars[$dem] . ($stt + 10))->applyFromArray($style);
     250                       
    130251            $stt++;
    131252        }
     253               
     254               
    132255        $writer = new PHPExcel_Writer_Excel5($this->phpexcel);
    133         header('Content-Disposition: attachment; filename="doanh_thu_' . $data['month'] . "_" . $data['year'] . '.xls"');
     256        header('Content-Disposition: attachment; filename="doanh_thu_'. $data['date'] . "_" . $data['month'] . "_" . $data['year']  .'-'. $data['to_date'] . "_" . $data['to_month'] . "_" . $data['to_year'] . '.xls"');
    134257        $writer->save('php://output');
    135258    }
  • pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportprovince.php

    r818 r883  
    3030
    3131        $this->load->model('reportmodel');
    32         $data['date'] = date("d");
     32        $data['date'] = 1;
    3333        $data['month'] = date("m");
    3434        $data['year'] = date("Y");
     
    3737        $data['to_year'] = date("Y");
    3838        if ($this->input->post()) {
    39                         $data['date'] = $this->input->post('date');
    40             $data['month'] = $this->input->post('month');
    41             $data['year'] = $this->input->post('year');
     39            //$data['month'] = $this->input->post('month');
     40            //$data['year'] = $this->input->post('year');
     41                        $data['month'] = $this->input->post('to_month');
     42            $data['year'] = $this->input->post('to_year');
    4243                        $data['to_date'] = $this->input->post('to_date');
    4344            $data['to_month'] = $this->input->post('to_month');
     
    130131        public function exportProvince(){
    131132                $this->load->model('reportmodel');
    132                 $data['date'] = date("d");
     133                $data['date'] = 1;
    133134        $data['month'] = $this->uri->segment(4);
    134135        $data['year'] = $this->uri->segment(5);
     
    137138        $data['to_year'] = date("Y");
    138139        if ($this->input->post()) {
    139                         $data['date'] = $this->input->post('date');
    140             $data['month'] = $this->input->post('month');
    141             $data['year'] = $this->input->post('year');
     140                        //$data['date'] = $this->input->post('date');
     141            $data['month'] = $this->input->post('to_month');
     142            $data['year'] = $this->input->post('to_year');
    142143                        $data['to_date'] = $this->input->post('to_date');
    143144            $data['to_month'] = $this->input->post('to_month');
     
    362363        $writer = new PHPExcel_Writer_Excel5($this->phpexcel);
    363364                header('Content-Type: application/vnd.ms-excel');
    364         header('Content-Disposition: attachment; filename="thue_bao_va_doanh_thu_theo_tinh_' .$data["date"]. $data['month'] . $data['year']."_".$data["to_date"]. $data['to_month']. $data['to_year'] . '.xls"');
     365        header('Content-Disposition: attachment; filename="thue_bao_va_doanh_thu_theo_tinh_' . $data["to_date"].'_'. $data['to_month'].'_'. $data['to_year'] . '.xls"');
    365366        $writer->save('php://output');
    366367        }
  • pro-violet-viettel/sourcecode/application/modules/admin/controllers/user.php

    r770 r883  
    2727                $this->load->helper ( 'pagging' );
    2828                $this->load->model ( 'user_model' );
     29               
    2930                $provinces = lang('_PROVINCES_');
    3031                error_log(var_export($provinces, TRUE), 3, '/srv/www/sbg/log/provinces.log');
     
    5051                }
    5152                $data['provinces'] = $provinces;
    52                 $data['province_code'] = '';
    53                 if ($this->input->post ( 'province-code' )) {
    54                         $data ['province_code'] = $this->input->post ( 'province-code' );
     53                $data['province'] = '';
     54                if ($this->input->post ( 'province' )) {
     55                        $data ['province'] = $this->input->post ( 'province' );
     56                }
     57                if ($data['province'])
     58                        $data['districts'] = $this->user_model->getDistrictByProvince($data ['province']);
     59                if ($this->input->post ( 'district' )) {
     60                        $data['district'] = $this->input->post ( 'district' );
    5561                }
    5662                $data ['keyword'] = "";
     
    5864                $data ['sorting_field'] = "created_time";
    5965                if ($this->input->post ( 'sorting_order' )) {
    60                         if ($this->input->post ( 'sorting_order' ) != "sorting") {
     66                        if ($this->input->post ( 'sorting_ord   er' ) != "sorting") {
    6167                                $data ['sorting_order'] = $this->input->post ( 'sorting_order' );
    6268                                $data ['sorting_field'] = $this->input->post ( 'sorting_field' );
     
    8490               
    8591                foreach ( $us as $u ) {
     92                        $dist = $this->user_model->getDistrictByIdAndProvince($u['district'], $u['province']);
     93                        $u['district_name'] = $dist['type']." ".$dist['district_name'];
    8694                        $u ['province'] = isset($provinces[$u ['province']]) ? $provinces[$u ['province']] : $u ['province'];
     95                       
    8796                        $userinfo = $this->get_userinfo ( $u ['us_id'] );
    8897                        if ($userinfo) {
     
    171180                $this->load->model ( 'user_model' );
    172181                $data = $this->user_model->get_user_info ( $src, $us_id, $token );
    173                 // var_dump($data);
    174182                $result = array ();
    175183                parse_str ( $data, $result );
    176184                return $result;
     185        }
     186       
     187        public function export(){
     188               
     189                $this->load->helper ( 'pagging' );
     190                $this->load->model ( 'user_model' );
     191                $provinces = lang('_PROVINCES_');
     192       
     193                $data ['current_page'] = $this->uri->segment ( 4, 1 );
     194                $data ['itemsoptions'] = array (
     195                                10,
     196                                25,
     197                                50,
     198                                100
     199                );
     200
     201                $data ['perpage'] = $this->uri->segment (5, 10);
     202                $data ['statusoptions'] = array (
     203                                0 => "Tất cả",
     204                                1 => "Đã đăng kÜ VIP",
     205                                2 => "Dùng thá»­ 7 ngày",
     206                                3=> "Dùng thá»­ hạn chế",
     207                                4=> "Hết hạn"
     208                );
     209                $data ['status'] = $this->uri->segment (7, 0);
    177210                /*
    178                  * if (strpos($data, '&')){ $arr_users = explode("&", $data); $str_username = $arr_users[1]; $arr_username = explode("=", $str_username); return $arr_username[1]; }else { return ""; }
    179                  */
    180         }
     211                if ($this->input->post ( 'status' )) {
     212                        $data ['status'] = ( int ) $this->input->post ( 'status' );
     213                }
     214                */
     215                $data['provinces'] = $provinces;
     216                $data['province'] = $this->uri->segment (8);
     217                if ($data['province'] == 'default') $data['province'] = null;
     218                if ($this->input->post ( 'province' )) {
     219                        $data ['province'] = $this->input->post ( 'province' );
     220                }
     221                if ($data['province'])
     222                        $data['districts'] = $this->user_model->getDistrictByProvince($data ['province']);
     223                if ($this->input->post ( 'district' )) {
     224                        $data['district'] = $this->input->post ( 'district' );
     225                }
     226               
     227                $data['district'] = $this->uri->segment (9);
     228                if ($data['district'] == 'default') $data['district'] = null;
     229                $data ['keyword'] = $this->uri->segment (6);
     230                if ($data['keyword'] == 'default') $data['keyword'] = null;
     231                $data ['sorting_order'] = "sorting_desc";
     232                $data ['sorting_field'] = "created_time";
     233                $data ['sorting_order'] = $this->uri->segment (11);
     234                $data ['sorting_field'] = $this->uri->segment (12);
     235               
     236                if ($this->input->post ( 'sorting_order' )) {
     237                        if ($this->input->post ( 'sorting_order' ) != "sorting") {
     238                                $data ['sorting_order'] = $this->input->post ( 'sorting_order' );
     239                                $data ['sorting_field'] = $this->input->post ( 'sorting_field' );
     240                        }
     241                }
     242               
     243                if ($this->input->post ( 'items' )) {
     244                        $data ['perpage'] = $this->input->post ( 'items' );
     245                }
     246               
     247                if ($this->input->post ( 'keyword' )) {
     248                        $data ['keyword'] = $this->input->post ( 'keyword' );
     249                }
     250               
     251                $data ['daterange_start'] = "";
     252                $data ['daterange_end'] = "";
     253                $daterange = $this->uri->segment (10);
     254                if ($daterange == 'default') $daterange = null;
     255                if($daterange){
     256                        $daterange = explode ( " - ", $daterange );
     257                        $daterange [0] = str_replace ( '/', '-', $daterange [0] );
     258                        $daterange [1] = str_replace ( '/', '-', $daterange [1] );
     259                        $data ['daterange_start'] = date ( 'Y-m-d H:i:s', strtotime ( $daterange [0] ) );
     260                        $data ['daterange_end'] = date ( 'Y-m-d H:is:s', strtotime ( $daterange [1] . ' + 1 day' ) );
     261                }
     262                if ($this->input->post ( 'daterange' )) {
     263                        $daterange = explode ( " - ", $this->input->post ( 'daterange' ) );
     264                        $daterange [0] = str_replace ( '/', '-', $daterange [0] );
     265                        $daterange [1] = str_replace ( '/', '-', $daterange [1] );
     266                        $data ['daterange_start'] = date ( 'Y-m-d H:i:s', strtotime ( $daterange [0] ) );
     267                        $data ['daterange_end'] = date ( 'Y-m-d H:is:s', strtotime ( $daterange [1] . ' + 1 day' ) );
     268                }
     269                $data ['start'] = ($data ['current_page'] - 1) * $data ['perpage'];
     270                $data ['total'] = $this->user_model->get_total_users ( $data );
     271                $us = $this->user_model->get_list_users ( $data );
     272                $users = array ();
     273               
     274                foreach ( $us as $u ) {
     275                        $dist = $this->user_model->getDistrictByIdAndProvince($u['district'], $u['province']);
     276                        $u['district_name'] = $dist['type']." ".$dist['district_name'];
     277                        $u ['province'] = isset($provinces[$u ['province']]) ? $provinces[$u ['province']] : $u ['province'];
     278                       
     279                        $userinfo = $this->get_userinfo ( $u ['us_id'] );
     280                        if ($userinfo) {
     281                                $u ['username'] = $userinfo ['username'];
     282                                $u['fullname'] = $userinfo['fullname'];
     283                        }
     284                       
     285                        if (strtotime($u['expire_date']) > time() && $u['p_id'] != 5 ){
     286                                $u['status'] = 'Đã đăng kÜ VIP';
     287                        }elseif(strtotime($u['expire_date']) > time() && $u['p_id'] == 5){
     288                                $u['status'] = 'Dùng thá»­ 7 ngày';
     289                        }elseif(strtotime($u['expire_date']) < time() && $u['p_id'] == 5){
     290                                $u['status'] = 'Dùng thá»­ hạn chế';
     291                        }else{
     292                                $u['status'] = 'Hết hạn';
     293                        }
     294                       
     295                        array_push ( $users, $u );
     296                }
     297       
     298                $data ['users'] = $users;
     299                $data ['paging_url'] = base_url () . "admin/nguoi_dung/trang/";
     300                $data ['num_links'] = 2;
     301                $data ['paging'] = pagging ( $data );
     302               
     303                $this->load->library("PHPExcel");
     304        $sheet = $this->phpexcel->getActiveSheet();
     305               
     306        $sheet->setTitle("bao cao thue bao " . $data['month'] . " - " . $data['year']);
     307        $sheet->getColumnDimension('A')->setWidth(10);
     308        $sheet->getColumnDimension('B')->setWidth(25);
     309        $sheet->getColumnDimension('C')->setWidth(25);
     310        $sheet->getColumnDimension('D')->setWidth(15);
     311        $sheet->getColumnDimension('E')->setWidth(15);
     312        $sheet->getColumnDimension('F')->setWidth(15);
     313        $sheet->getColumnDimension('G')->setWidth(15);
     314        $sheet->getColumnDimension('H')->setWidth(25);
     315        $sheet->getColumnDimension('I')->setWidth(25);
     316               
     317               
     318                $sheet->setCellValue('B1', "TẬP ĐOÀN VIỄN THÔNG QUÂN ĐỘI");
     319                $style = array(
     320                        'font' => array('bold' => true, 'size' => 12, 'name' =>'Cambria', 'color' => array('rgb' => '0070bf')),
     321                        'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
     322                                                                'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
     323                                                                'wrap' => true )
     324                );
     325                $sheet->mergeCells('B1:I1');
     326                $sheet->getStyle('B1')->applyFromArray($style);
     327               
     328                $sheet->setCellValue('B2', "TỔNG CÔNG TY VIỄN THÔNG VIETTEL");
     329                $style = array(
     330                        'font' => array('size' => 12, 'name' =>'Cambria', 'color' => array('rgb' => '0070bf')),
     331                        'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
     332                                                                'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
     333                                                                'wrap' => true )
     334                );
     335                $sheet->mergeCells('B2:I2');
     336                $sheet->getStyle('B2')->applyFromArray($style);
     337               
     338               
     339                $sheet->setCellValue('A4', "DANH SÁCH NGƯỜI DÙNG");
     340                $style = array(
     341                        'font' => array('bold' => true, 'size' => 14, 'name' =>'Cambria'),
     342                        'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
     343                                                                'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
     344                                                                'wrap' => true )
     345                );
     346                $sheet->mergeCells('A4:I4');
     347                $sheet->getStyle('A4')->applyFromArray($style);
     348               
     349                $sheet->setCellValue('A6', 'STT');
     350                $style = array(
     351                        'font' => array('bold' => true, 'size' => 11, 'name' =>'Cambria'),
     352                        'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
     353                                                                'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
     354                                                                'wrap' => true),
     355                        'borders' =>    array(
     356                                'allborders' => array(
     357                                        'style' => \PHPExcel_Style_Border::BORDER_THIN
     358                                        )
     359                        )
     360                );
     361                $sheet->getStyle('A6')->applyFromArray($style);
     362                $style = array(
     363                        'font' => array('bold' => true, 'size' => 11, 'name' =>'Cambria'),
     364                        'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
     365                                                                'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
     366                                                                'wrap' => true),
     367                        'borders' =>    array(
     368                                'allborders' => array(
     369                                        'style' => \PHPExcel_Style_Border::BORDER_THIN
     370                                        )
     371                        )
     372                );
     373               
     374                $sheet->setCellValue('B6', 'Số điện thoại');
     375                $sheet->setCellValue('C6', "Họ tên)");
     376                $sheet->setCellValue('D6', "Tài khoản SBG");
     377                $sheet->setCellValue('E6', "Ngày đăng kÜ");
     378                $sheet->setCellValue('F6', "Ngày hết hạn");
     379                $sheet->setCellValue('G6', "Tỉnh/Thành phố");
     380                $sheet->setCellValue('H6', "Quận/Huyện");
     381                $sheet->setCellValue('I6', "Tình trạng");
     382                $sheet->getStyle('A6:I6')->applyFromArray($style);
     383               
     384                $styleSTT = array(
     385                        'font' => array('size' => 11, 'name' =>'Cambria'),
     386                        'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
     387                                                                'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER),
     388                        'borders' =>    array(
     389                                'allborders' => array(
     390                                        'style' => \PHPExcel_Style_Border::BORDER_THIN
     391                                        )
     392                        )
     393                );
     394                $style = array(
     395                        'font' => array('size' => 11, 'name' =>'Cambria'),
     396                        'alignment' => array('vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER),
     397                        'borders' =>    array(
     398                                'allborders' => array(
     399                                        'style' => \PHPExcel_Style_Border::BORDER_THIN
     400                                        )
     401                        )
     402                );
     403                $dem = 0;
     404                foreach ($users as $index => $user):
     405                        $sheet->setCellValue('A' . ($dem + 7), $index + 1);
     406                        $sheet->setCellValueExplicit('B' . ($dem + 7), $user['username'], PHPExcel_Cell_DataType::TYPE_STRING);
     407            $sheet->setCellValue('C' . ($dem + 7), $user['fullname']);
     408            $sheet->setCellValue('D' . ($dem + 7), $user['acc_balanced']);
     409            $sheet->setCellValue('E' . ($dem + 7), date('d/m/Y', strtotime($user['created_time'])));
     410            $sheet->setCellValue('F' . ($dem + 7), isset($user['expire_date']) && strtotime($user['expire_date']) > 0 ? date('d/m/Y', strtotime($user['expire_date'])) : '');
     411            $sheet->setCellValue('G' . ($dem + 7), $user['province']);
     412            $sheet->setCellValue('H' . ($dem + 7), $user['district_name']);
     413                        $sheet->setCellValue('I' . ($dem + 7), $user['status']);
     414                        $sheet->getStyle('A' . ($dem + 7))->applyFromArray($styleSTT);
     415                        $sheet->getStyle('B' . ($dem + 7).':I'.($dem + 7))->applyFromArray($style);
     416                       
     417                       
     418                        $dem++;
     419                endforeach;
     420               
     421                $writer = new PHPExcel_Writer_Excel5($this->phpexcel);
     422                header('Content-Type: application/vnd.ms-excel');
     423        header('Content-Disposition: attachment; filename="danhsachnguoidung_trang_'.$data['current_page'].'.xls"');
     424        $writer->save('php://output');
     425               
     426        }
     427       
    181428}
  • pro-violet-viettel/sourcecode/application/modules/admin/models/paidlog_model.php

    r818 r883  
    1313        }
    1414        function getPaidlogs($data) {
     15               
    1516                if ($data['paid_type'] == 0){
    1617                        $sql = "SELECT SUM(amount) as total_amount FROM tblpaidlog";
     
    1920                }
    2021                $r = $this->db->query($sql)->row_array();
     22               
    2123                $total_amount = (int)$r['total_amount'];
    2224        $sql = "SELECT * FROM " . $this->table_name. " INNER JOIN tbluser ON tbluser.us_id = tblpaidlog.us_id ";
     
    5456                        }
    5557                }
    56                 if ($data['start']){
     58
     59                //if ($data['start']){
     60               
    5761                        $sql=$sql . " " . $order . " LIMIT " . $data['start'] . ", " . $data['perpage'] . " ";
    58                 }
     62                //}
     63       
    5964        //return $this->db->query($sql)->result_array();
    6065                $re = $this->db->query($sql)->result_array();
     66               
    6167                $result['paid_logs'] = $re;
     68               
    6269                $result['total_amount'] = $total_amount;
    6370                return $result;
  • pro-violet-viettel/sourcecode/application/modules/admin/models/reportmodel.php

    r838 r883  
    2828                $provinces = lang ( '_PROVINCES_' );
    2929                // 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";
     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                $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 00:00:00' AND tblpaidlog.paid_time <= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" .$input['to_date']. " 23:59:59' GROUP BY tbluser.province";
    3132                $query = $this->db->query ( $sql );
    3233                $dtns = $query->result_array ();
     
    4647               
    4748                // Tinh thue bao theo tinh theo nam
    48                 $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >= '" . $input ['year'] . "-01-01 00:00:00' AND tbluser.created_time <= '" . ($input ['year'] + 1) . "-01-01 23:59:59' GROUP BY tbluser.province";
    49                 $query = $this->db->query ( $sql );
    50                 write_file('./log/test.log', date('d-m-Y H:i:s').": ".$sql."\n", FOPEN_WRITE_CREATE);
     49                //$sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >= '" . $input ['year'] . "-01-01 00:00:00' AND tbluser.created_time <= '" . ($input ['year'] + 1) . "-01-01 23:59:59' GROUP BY tbluser.province";
     50                $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >= '" . $input ['year'] . "-01-01 00:00:00' AND tbluser.created_time <= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" .$input['to_date']. " 23:59:59' GROUP BY tbluser.province";
     51                $query = $this->db->query ( $sql );
    5152                $tbns = $query->result_array ();
    5253               
     
    146147                // tinh thue bao theo thang
    147148                //$sql = "SELECT * FROM tbluser LEFT JOIN tblservicepackage ON tbluser.p_id=tblservicepackage.p_id LEFT JOIN tblregisterpackagelog ON tbluser.cellphone = tblregisterpackagelog.username WHERE tbluser.updated_time >= '" . $input ['year'] . "-" . $input ['month'] . "-" . $input ['date'] . "' AND tbluser.updated_time <= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" . $input ['to_date'] . "' AND tblregisterpackagelog.created_time >= '" . $input ['year'] . "-" . $input ['month'] . "-" . $input ['date'] . "' AND tblregisterpackagelog.created_time <= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" . $input ['to_date'] . "' AND tblservicepackage.p_period > 0 ";
    148                 $sql = "SELECT * FROM tbluser LEFT JOIN tblregisterpackagelog ON tbluser.cellphone = tblregisterpackagelog.username WHERE tbluser.updated_time >= '" . $input ['year'] . "-" . $input ['month'] . "-" . $input ['date'] . "' AND tbluser.updated_time <= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" . $input ['to_date'] . "' AND tblregisterpackagelog.created_time >= '" . $input ['year'] . "-" . $input ['month'] . "-" . $input ['date'] . "' AND tblregisterpackagelog.created_time <= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" . $input ['to_date'] . "'";
     149                $sql = "SELECT * FROM tbluser LEFT JOIN tblregisterpackagelog ON tbluser.cellphone = tblregisterpackagelog.username WHERE tbluser.updated_time >= '" . $input ['year'] . "-" . $input ['month'] . "-" . $input ['date'] . " 00:00:00' AND tbluser.updated_time <= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" . $input ['to_date'] . " 23:59:59' AND tblregisterpackagelog.created_time >= '" . $input ['year'] . "-" . $input ['month'] . "-" . $input ['date'] . " 00:00:00' AND tblregisterpackagelog.created_time <= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" . $input ['to_date'] . " 23:59:59'";
    149150                $query = $this->db->query ( $sql );
    150151                $users = $query->result_array ();
     152                //write_file('./log/sql.log', date("d-m-Y H:i:s").": ".$sql."\n", FOPEN_WRITE_CREATE);
    151153               
    152154                $sql = "SELECT * FROM tblservicepackage WHERE p_period>0";
  • pro-violet-viettel/sourcecode/application/modules/admin/models/user_model.php

    r818 r883  
    4040                        if (strlen($data['keyword'])>0){
    4141                                if ($data['status']==0){
    42                                         if (strlen($data['province_code'])>0){
    43                                                 if(strlen($data['daterange_start'])>0){
    44                                                         $sql.=" WHERE province = '".$data['province_code']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     42                                        if (strlen($data['province'])>0){
     43                                                if (strlen($data['district'])>0){
     44                                                        if(strlen($data['daterange_start'])>0){
     45                                                                $sql.=" WHERE province = '".$data['province']."' AND district = '".$data['district']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     46                                                        }
     47                                                }else{
     48                                                        if(strlen($data['daterange_start'])>0){
     49                                                                $sql.=" WHERE province = '".$data['province']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     50                                                        }
    4551                                                }
    4652                                        }else{
     
    5460                                }else
    5561                                {
    56                                         if (strlen($data['province_code'])>0){
    57                                                 if(strlen($data['daterange_start'])>0){
    58                                                         $sql.=" AND province = '".$data['province_code']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
    59                                                 }else{
    60                                                         $sql.=" AND province = '".$data['province_code']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') ";
    61                                                 }
     62                                        if (strlen($data['province'])>0){
     63                                                if (strlen($data['district'])>0){
     64                                                        if(strlen($data['daterange_start'])>0){
     65                                                                $sql.=" AND province = '".$data['province']."' AND district = '".$data['district']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     66                                                        }else{
     67                                                                $sql.=" AND province = '".$data['province']."' AND district = '".$data['district']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') ";
     68                                                        }
     69                                                }else{
     70                                                        if(strlen($data['daterange_start'])>0){
     71                                                                $sql.=" AND province = '".$data['province']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     72                                                        }else{
     73                                                                $sql.=" AND province = '".$data['province']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') ";
     74                                                        }
     75                                                }
     76                                               
    6277                                        }
    6378                                }
     
    6681                                if(strlen($data['daterange_start'])>0){
    6782                                        if ($data['status']==0){
    68                                                 if (strlen($data['province_code'])>0){
    69                                                         $sql.=" WHERE province = '".$data['province_code']."' AND created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."'";
     83                                                if (strlen($data['province'])>0){
     84                                                        if (strlen($data['district'])>0){
     85                                                                $sql.=" WHERE province = '".$data['province']."' AND district = '".$data['district']."' AND created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."'";
     86                                                        }else{
     87                                                                $sql.=" WHERE province = '".$data['province']."' AND created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."'";
     88                                                        }
    7089                                                }else{
    7190                                                        $sql.=" WHERE (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
    7291                                                }
    7392                                        }else{
    74                                                 if (strlen($data['province_code'])>0){
    75                                                         $sql.=" AND province = '".$data['province_code']."' AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     93                                                if (strlen($data['province'])>0){
     94                                                        if (strlen($data['district'])>0){
     95                                                                $sql.=" AND province = '".$data['province']."' AND district = '".$data['district']."' AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     96                                                        }else{
     97                                                                $sql.=" AND province = '".$data['province']."' AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     98                                                        }
    7699                                                }else{
    77100                                                        $sql.=" AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
    78101                                                }
     102
    79103                                        }               
    80104                                }
    81105                                else{
    82106                                        if ($data['status']==0){
    83                                                 if (strlen($data['province_code'])>0){
    84                                                         $sql.=" WHERE province = '".$data['province_code']."'";
    85                                                 }
    86                                         }else{
    87                                                 if (strlen($data['province_code'])>0){
    88                                                         $sql.=" AND province = '".$data['province_code']."'";
    89                                                 }
     107                                                if (strlen($data['province'])>0){
     108                                                        if (strlen($data['district'])>0){
     109                                                                $sql.=" WHERE province = '".$data['province']."' AND district = '".$data['district']."'";
     110                                                        }else{
     111                                                                $sql.=" WHERE province = '".$data['province']."'";
     112                                                        }
     113                                                }
     114                                        }else{
     115                                                if (strlen($data['province'])>0){
     116                                                        if (strlen($data['district'])>0){
     117                                                                $sql.=" AND province = '".$data['province']."' AND district = '".$data['district']."'";
     118                                                        }else{
     119                                                                $sql.=" AND province = '".$data['province']."'";
     120
     121                                                        }
     122                                                }
     123                                               
    90124                                        }               
    91125                                }
    92126                        }
    93127                }
     128       
    94129                $order = "";
     130               
    95131                if ($data['sorting_order'] != "sorting") {
    96132                        if($data['sorting_field'] != "status"){
     
    101137                        }
    102138                }
    103                 write_file('./log/test.log', date("d-m-Y: H:i:s"). ": ".$sql." ".$order." LIMIT ".$data['start'].", ".$data['perpage'] , FOPEN_WRITE_CREATE);
     139                //write_file('./log/sql.log', date("d-m-Y: H:i:s"). ": ".$sql." ".$order." LIMIT ".$data['start'].", ".$data['perpage']."\n" , FOPEN_WRITE_CREATE);
    104140                return $this->db->query($sql." ".$order." LIMIT ".$data['start'].", ".$data['perpage']." ")->result_array();
    105141        }
     
    126162                        if (strlen($data['keyword'])>0){
    127163                                if ($data['status']==0){
    128                                         if (strlen($data['province_code'])>0){
    129                                                 if(strlen($data['daterange_start'])>0){
    130                                                         $sql.=" WHERE province = '".$data['province_code']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
    131                                                 }
     164                                        if (strlen($data['province'])>0){
     165                                                if (strlen($data['district'])>0){
     166                                                        if(strlen($data['daterange_start'])>0){
     167                                                        $sql.=" WHERE province = '".$data['province']."' AND district = '".$data['district']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     168                                                }
     169                                                }else{
     170                                                        if(strlen($data['daterange_start'])>0){
     171                                                        $sql.=" WHERE province = '".$data['province']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     172                                                }
     173                                                }
     174                                               
    132175                                        }else{
    133176                                                if(strlen($data['daterange_start'])>0){
     
    140183                                }else
    141184                                {
    142                                         if (strlen($data['province_code'])>0){
    143                                                 if(strlen($data['daterange_start'])>0){
    144                                                         $sql.=" AND province = '".$data['province_code']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
    145                                                 }else{
    146                                                         $sql.=" AND province = '".$data['province_code']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') ";
     185                                        if (strlen($data['province'])>0){
     186                                                if (strlen($data['district'])>0){
     187                                                        if(strlen($data['daterange_start'])>0){
     188                                                                $sql.=" AND province = '".$data['province']."' AND district = '".$data['district']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     189                                                        }else{
     190                                                                $sql.=" AND province = '".$data['province']."' AND district = '".$data['district']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') ";
     191                                                        }       
     192                                                }else{
     193                                                        if(strlen($data['daterange_start'])>0){
     194                                                                $sql.=" AND province = '".$data['province']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     195                                                        }else{
     196                                                                $sql.=" AND province = '".$data['province']."' AND (cellphone LIKE '%".$data['keyword']."%' OR collaborator LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%' OR acc_balanced LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') ";
     197                                                        }
    147198                                                }
    148199                                        }
     
    152203                                if(strlen($data['daterange_start'])>0){
    153204                                        if ($data['status']==0){
    154                                                 if (strlen($data['province_code'])>0){
    155                                                         $sql.=" WHERE province = '".$data['province_code']."' AND created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."'";
     205                                                if (strlen($data['province'])>0){
     206                                                        if (strlen($data['district'])>0){
     207                                                                $sql.=" WHERE province = '".$data['province']."' AND district = '".$data['district']."' AND created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."'";
     208                                                        }else{
     209                                                                $sql.=" WHERE province = '".$data['province']."' AND created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."'";
     210                                                        }
    156211                                                }else{
    157212                                                        $sql.=" AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
    158213                                                }
    159214                                        }else{
    160                                                 if (strlen($data['province_code'])>0){
    161                                                         $sql.=" AND province = '".$data['province_code']."' AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     215                                                if (strlen($data['province'])>0){
     216                                                        if (strlen($data['district'])>0){
     217                                                                $sql.=" AND province = '".$data['province']."' AND district = '".$data['district']."' AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     218                                                        }else{
     219                                                                $sql.=" AND province = '".$data['province']."' AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     220                                                        }
    162221                                                }else{
    163222                                                        $sql.=" AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
     
    167226                                else{
    168227                                        if ($data['status']==0){
    169                                                 if (strlen($data['province_code'])>0){
    170                                                         $sql.=" WHERE province = '".$data['province_code']."'";
    171                                                 }
    172                                         }else{
    173                                                 if (strlen($data['province_code'])>0){
    174                                                         $sql.=" AND province = '".$data['province_code']."'";
     228                                                if (strlen($data['province'])>0){
     229                                                        if (strlen($data['district'])>0){
     230                                                                $sql.=" WHERE province = '".$data['province']."' AND district = '".$data['district']."'";
     231                                                        }else{
     232                                                                $sql.=" WHERE province = '".$data['province']."'";
     233                                                        }
     234                                                }
     235                                        }else{
     236                                                if (strlen($data['province'])>0){
     237                                                        if (strlen($data['district'])>0){
     238                                                                $sql.=" AND province = '".$data['province']."' AND district = '".$data['district']."'";
     239                                                        }else{
     240                                                                $sql.=" AND province = '".$data['province']."'";
     241                                                        }
    175242                                                }
    176243                                        }               
     
    191258        }
    192259       
     260        public function getDistrictByProvince($provinceId){
     261                $sql = "SELECT * FROM tbldistrict WHERE province_id = ?";
     262                $query = $this->db->query ( $sql, array (
     263                                $provinceId
     264                ) );
     265                $results = $query->result_array();
     266                return $results;
     267        }
     268       
     269        public function getDistrictByIdAndProvince($districtId, $provinceId){
     270                $sql = "SELECT * FROM tbldistrict WHERE district_id = ? AND province_id = ?";
     271                $query = $this->db->query ( $sql,array ($districtId, $provinceId) );
     272                if ($query->num_rows () > 0) {
     273                        $row = $query->row_array ();
     274                        return $row;
     275                }
     276               
     277        }
    193278}
  • pro-violet-viettel/sourcecode/application/modules/admin/views/report/index.php

    r818 r883  
    1 <?php
     1<?php
    22$base_url = base_url();
    33$this->load->view('layout/admin/header', array('base_url' => $base_url));
     
    157157        <li>
    158158            <i class="icon-home home-icon"></i>
    159             <a href="#">Trang ch</a>
     159            <a href="#">Trang chá»§</a>
    160160        </li>
    161161
    162162        <li>
    163             <a href="#">Quản lý tin nhắn</a>
     163            <a href="#">Quản lÜ tin nhắn</a>
    164164        </li>
    165165       
     
    169169        <form class="form-search">
    170170            <span class="input-icon">
    171                 <input type="text" autocomplete="off" id="nav-search-input" class="nav-search-input" placeholder="Tìm kiếm ...">
     171                <input type="text" autocomplete="off" id="nav-search-input" class="nav-search-input" placeholder="Tìm kiếm ...">
    172172                <i class="icon-search nav-search-icon"></i>
    173173            </span>
     
    183183    <div class="page-header">
    184184        <h1>
    185             Tin nhn
     185            Tin nhắn
    186186            <small>
    187187                <i class="icon-double-angle-right"></i>
    188                 Mẫu tin nhắn
     188                Mẫu tin nhắn
    189189            </small>
    190190        </h1>
  • pro-violet-viettel/sourcecode/application/modules/admin/views/report/listview.php

    r818 r883  
    1 <div class="col-xs-12">
     1<div class="col-xs-12">
    22                <!-- PAGE CONTENT BEGINS -->
    33                <div style="padding-bottom:4px" class="table-header">
    44                        Doanh thu
    55                        <div class="pull-right" style="margin:5px;">
    6                                         <a style="color:#fff" href="<?php echo base_url();?>admin/report/export">Xut ra Excel</a>
     6                                        <a style="color:#fff" href="<?php echo base_url();?>admin/report/export">Xuất ra Excel</a>
    77                </div>
    88                </div>
     
    1313                                        <div class="row">
    1414                                                <div class="col-sm-6">
    15                                                         <div id="sample-table-2_length" class="dataTables_length"><label>Hiện thị
     15                                                        <div id="sample-table-2_length" class="dataTables_length"><label>Hiện thị
    1616                                                                        <select onchange="filter();" name="items" size="1" aria-controls="sample-table-2">                                     
    1717                                                                                <?php foreach ($itemsoptions as $option) { ?>
    1818                                                                                <option <?php if($option == $perpage) echo "selected"; ?> value="<?php echo $option;?>"><?php echo $option;?></option>
    1919                                                                                <?php } ?>
    20                                                                         </select> bn ghi</label>
     20                                                                        </select> bản ghi</label>
    2121
    2222                                                        </div>
     
    2525                                                <div class="col-sm-6">
    2626                                                        <!--<div class="dataTables_filter" id="sample-table-2_filter">
    27                                                                 <label>Tìm kiếm:
     27                                                                <label>Tìm kiếm:
    2828                                                                        <input type="text" name="keyword" id="keyword" value='<?php echo $keyword;?>' style="width: 162px; height: 18px;" aria-controls="sample-table-2"></label>
    2929                                                        </div>-->
    30                                                         <div class="dataTables_filter" id="sample-table-2_filter"><label>Lc theo:
     30                                                        <div class="dataTables_filter" id="sample-table-2_filter"><label>Lọc theo:
    3131                                                                <select onchange="filter();" name="paid_type" size="1" style="width: 176px; height: 28px;">                                     
    3232                                                                        <?php foreach ($paid_types as $key => $type): ?>
     
    5151                                                <tr role="row">
    5252                                                       
    53                                                         <th class="<?php if ($sorting_field == 'fullname') {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">Số điện thoại</th>
    54                                                         <th class="<?php if ($sorting_field == 'cellphone') {echo $sorting_order;} else {echo "sorting";}?>" id="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">Họ tên</th>
    55                                                         <th class="<?php if ($sorting_field == 'amount') {echo $sorting_order;} else {echo "sorting";}?>" id="amount" 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">Số tiền</th>
    56                                                         <th class="<?php if ($sorting_field == 'paid_type') {echo $sorting_order;} else {echo "sorting";}?>" id="paid_type" 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">SMS/Card</th>
    57                                                         <th class="<?php if ($sorting_field == 'paid_time') {echo $sorting_order;} else {echo "sorting";}?>" id="paid_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</th>
     53                                                        <th class="<?php if ($sorting_field == 'fullname') {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">Số điện thoại</th>
     54                                                        <th class="<?php if ($sorting_field == 'cellphone') {echo $sorting_order;} else {echo "sorting";}?>" id="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">Họ tên</th>
     55                                                        <th class="<?php if ($sorting_field == 'amount') {echo $sorting_order;} else {echo "sorting";}?>" id="amount" 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">Số tiền</th>
     56                                                        <th class="<?php if ($sorting_field == 'paid_type') {echo $sorting_order;} else {echo "sorting";}?>" id="paid_type" 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">SMS/Card</th>
     57                                                        <th class="<?php if ($sorting_field == 'paid_time') {echo $sorting_order;} else {echo "sorting";}?>" id="paid_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</th>
    5858                                                         
    5959                                        </thead>
     
    9090                                                <tr>
    9191                                                <td colspan=2>
    92                                                 Tổng tiền
     92                                                Tổng tiền
    9393                                                </td>
    9494                                                <td colspan=3>
     
    9797                                                </tr>
    9898                                        </tbody></table><div class="row"><div class="col-sm-6">
    99                                                         <div class="dataTables_info" id="sample-table-2_info">Hiển thị <?php echo ($start+1)?> đến <?php echo ($start+$perpage)?> của <?php echo $total?> bản ghi</div>
     99                                                        <div class="dataTables_info" id="sample-table-2_info">Hiển thị <?php echo ($start+1)?> đến <?php echo ($start+$perpage)?> cá»§a <?php echo $total?> bản ghi</div>
    100100                                                               
    101101                                                </div>
     
    120120            <div class="modal-header">
    121121                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
    122                 <h4 class="modal-title">Lịch sử</h4>
     122                <h4 class="modal-title">Lịch sá»­</h4>
    123123            </div>
    124124            <div class="modal-body">
     
    126126                    <li class="active" >
    127127                        <a id="regis-tab" href="#regis" data-toggle="tab">
    128                             Giao dch
     128                            Giao dịch
    129129                        </a>
    130130                    </li>
    131131                    <li>
    132132                        <a id="trade-tab" href="#trade" data-toggle="tab">
    133                             Thông tin
     133                            ThÃŽng tin
    134134                        </a>
    135135                    </li>
     
    137137                <div class="tab-content history-tab-content">
    138138                    <div class="tab-pane in active" id="regis">
    139                                                 <div class="col-sm-12">
    140                                                         <h5>Tài khoản SBG Online: <b><span class="blue"><span id="topup-money"><?php echo number_format($acc_balanced, 0); ?></span> VNĐ <span></b></h5>
     139                                                <div>
     140                                                        <h5>Tài khoản SBG Online: <b><span class="blue"><span id="topup-money"><?php echo number_format($acc_balanced, 0); ?></span> VNĐ <span></b></h5>
    141141                                                </div>
    142142                        <div class="table-responsive">
     
    145145                                    <tr>
    146146                                        <th class="center">
    147                                             T
     147                                            Từ
    148148                                        </th>
    149                                                                                 <th class="center"> Số tiền (VNĐ) </th>
    150                                         <th class="center"> Gói dịch vụ </th>
     149                                                                                <th class="center"> Số tiền (VNĐ) </th>
     150                                        <th class="center"> Gói dịch vụ </th>
    151151                                        <th>
    152152                                            <i class="icon-time bigger-110 hidden-480"></i>
    153                                             Thi gian
     153                                            Thời gian
    154154                                        </th>
    155155                                    </tr>
  • pro-violet-viettel/sourcecode/application/modules/admin/views/reportpackage/province.php

    r818 r883  
    99                Báo cáo doanh thu theo tỉnh / thành phố theo gói cước.
    1010            <div class="pull-right" style="margin:5px;">
    11                     <a style="color:#fff" href="<?php echo base_url();?>admin/reportpackage/export/<?php echo $month;?>/<?php echo $year;?>">Xuất ra Excel</a>
     11                    <a style="color:#fff" href="<?php echo base_url();?>admin/reportpackage/export/<?php echo $date;?>/<?php echo $month;?>/<?php echo $year;?>/-/<?php echo $to_date;?>/<?php echo $to_month;?>/<?php echo $to_year;?>">Xuất ra Excel</a>
    1212                </div>
    1313            </div>
     
    1717                    <form autocomplete="off" onsubmit="return false;" id="province" >
    1818                        <div class="row">
    19                             <div class="col-sm-6">
    20                                 <div class="" style="display: inline-block"><label>Tháng
     19                            <div class="col-sm-1">
     20                                <div class="" style="display: inline-block"><label><strong>Từ: </strong></label></div>
     21                                                        </div>
     22                                                        <div class="col-sm-6">
     23                                                                <div class="" style="display: inline-block"><label>Ngày</label>
     24
     25                                        <select aria-controls="sample-table-2" size="1" name="date" onchange="filter();">                                     
     26                                            <?php for ($i=1;$i<=31;$i++) { ?>
     27                                            <option value="<?php echo $i;?>" <?php if($date==$i) { ?> selected <?php }?>><?php echo $i;?></option>
     28                                            <?php }?>
     29                                        </select>
     30                                </div>
     31                                                                <div class="" style="display: inline-block"><label>Tháng</label>
    2132
    2233                                        <select aria-controls="sample-table-2" size="1" name="month" onchange="filter();">                                     
     
    3445                                        </select>
    3546                                </div>
    36                             </div>
     47                                                        </div>
     48                                                       
    3749
    3850                            <div class="col-sm-6">
     
    4052                            </div>
    4153                        </div>
     54                                               
     55                                                <div class="row">
     56                                                        <div class="col-sm-1">
     57                                <div class="" style="display: inline-block"><label><strong>Đến: </strong></label></div>
     58                                                        </div>
     59                                                        <div class="col-sm-6">
     60                                                                <div class="" style="display: inline-block"><label>Ngày</label>
     61
     62                                        <select aria-controls="sample-table-2" size="1" name="to_date" onchange="filter();">                                     
     63                                            <?php for ($i=1;$i<=31;$i++) { ?>
     64                                            <option value="<?php echo $i;?>" <?php if($to_date==$i) { ?> selected <?php }?>><?php echo $i;?></option>
     65                                            <?php }?>
     66                                        </select>
     67                                </div>
     68                                <div class="" style="display: inline-block"><label>Tháng</label>
     69
     70                                        <select aria-controls="sample-table-2" size="1" name="to_month" onchange="filter();">                                     
     71                                            <?php for ($i=1;$i<=12;$i++) { ?>
     72                                            <option value="<?php echo $i;?>" <?php if($to_month==$i) { ?> selected <?php }?>><?php echo $i;?></option>
     73                                            <?php }?>
     74                                        </select>
     75                                </div>
     76                                <div class=""  style="display: inline-block"><label>Năm
     77
     78                                        <select aria-controls="sample-table-2" size="1" name="to_year" onchange="filter();">                                     
     79                                            <?php for ($i=2014;$i<=date("Y");$i++) { ?>
     80                                            <option value="<?php echo $i;?>" <?php if($to_year==$i) { ?> selected <?php }?>><?php echo $i;?></option>
     81                                            <?php }?>
     82                                        </select>
     83                                </div>
     84                            </div>
     85                                                </div>
     86                                               
    4287                          </form>
    4388                    <table class="table table-striped table-bordered table-hover dataTable" id="sample-table-2" aria-describedby="sample-table-2_info">
  • pro-violet-viettel/sourcecode/application/modules/admin/views/reportprovince/province.php

    r838 r883  
    1717                <div role="grid" class="dataTables_wrapper" id="sample-table-2_wrapper">
    1818                    <form autocomplete="off" onsubmit="return false;" id="province" >
    19                         <div class="row">
    20                             <div class="col-sm-1">
    21                                 <div class="" style="display: inline-block"><label><strong>Từ: </strong></label></div>
    22                                                         </div>
    23                                                         <div class="col-sm-6">
    24                                                                 <div class="" style="display: inline-block"><label>Ngày</label>
    25 
    26                                         <select aria-controls="sample-table-2" size="1" name="date" onchange="filter();">                                     
    27                                             <?php for ($i=1;$i<=31;$i++) { ?>
    28                                             <option value="<?php echo $i;?>" <?php if($date==$i) { ?> selected <?php }?>><?php echo $i;?></option>
    29                                             <?php }?>
    30                                         </select>
    31                                 </div>
    32                                                                 <div class="" style="display: inline-block"><label>Tháng</label>
    33 
    34                                         <select aria-controls="sample-table-2" size="1" name="month" onchange="filter();">                                     
    35                                             <?php for ($i=1;$i<=12;$i++) { ?>
    36                                             <option value="<?php echo $i;?>" <?php if($month==$i) { ?> selected <?php }?>><?php echo $i;?></option>
    37                                             <?php }?>
    38                                         </select>
    39                                 </div>
    40                                 <div class=""  style="display: inline-block"><label>Năm
    41 
    42                                         <select aria-controls="sample-table-2" size="1" name="year" onchange="filter();">                                     
    43                                             <?php for ($i=2014;$i<=date("Y");$i++) { ?>
    44                                             <option value="<?php echo $i;?>" <?php if($year==$i) { ?> selected <?php }?>><?php echo $i;?></option>
    45                                             <?php }?>
    46                                         </select>
    47                                 </div>
    48                                                         </div>
    49                                                        
    50 
    51                             <div class="col-sm-6">
    52 
    53                             </div>
    54                         </div>
    55                                                
    5619                                                <div class="row">
    57                                                         <div class="col-sm-1">
    58                                                                 <div class="" style="display: inline-block"><label><strong>Đến: </strong></label></div>
    59                                                         </div>
    6020                                                        <div class="col-sm-6">
    6121                                                                <div class="" style="display: inline-block"><label>Ngày</label>
     
    10868                                                                <td style="font-weight:bold;"><?php echo $totalTbth; ?></td>
    10969                                                                <td style="font-weight:bold;"><?php echo $totalTbn; ?></td>
    110                                                                 <td style="font-weight:bold;"><?php echo $totalDtng; ?></td>
    111                                                                 <td style="font-weight:bold;"><?php echo $totalDtth; ?></td>
    112                                                                 <td style="font-weight:bold;"><?php echo $totalDtn; ?></td>
     70                                                                <td style="font-weight:bold;"><?php echo number_format($totalDtng, 0); ?></td>
     71                                                                <td style="font-weight:bold;"><?php echo number_format($totalDtth, 0); ?></td>
     72                                                                <td style="font-weight:bold;"><?php echo number_format($totalDtn, 0); ?></td>
    11373                                                               
    11474                                                        </tr>
     
    12787                                    <td class="hidden-480 "><?php echo $province['tbt']; ?></td>
    12888                                    <td class=" "><?php echo $province['tbn']; ?></td>
    129                                     <td class=" "><?php echo $province['dtng']; ?></td>
    130                                     <td class=" "><?php echo $province['dtt']; ?></td>
    131                                     <td class=" "><?php echo $province['dtn']; ?></td>
     89                                    <td class=" "><?php echo number_format($province['dtng'], 0); ?></td>
     90                                    <td class=" "><?php echo number_format($province['dtt'], 0); ?></td>
     91                                    <td class=" "><?php echo number_format($province['dtn'], 0); ?></td>
    13292
    13393                                </tr>
  • pro-violet-viettel/sourcecode/application/modules/admin/views/user/index.php

    r773 r883  
    9090                                $('#table_content').show();
    9191                                $("#content").html(data);
    92                                 $("#keyword").focus();
    93                                 $("#keyword").setCursorToTextEnd();
    9492                                $('.daterangepicker').daterangepicker({
    9593                                        format: 'DD/MM/YYYY'
    9694                                });
     95                                $("#keyword").focus();
     96                                $("#keyword").setCursorToTextEnd();
     97                                init_page();
    9798                                $('input[name="daterange"]').val(daterange);
    98                                 init_page();
    9999                        },
    100100                        error: function (jqXHR, textStatus, errorThrown)
     
    104104        });
    105105        }
     106        //$(document).ready(function(){
     107               
     108        //});
     109       
    106110               
    107111</script>
  • pro-violet-viettel/sourcecode/application/modules/admin/views/user/listview.php

    r818 r883  
    4545                    Thêm người dùng
    4646                </button-->
     47                                <div class="pull-right" style="margin:5px;">
     48                   
     49                                        <a style="color:#fff" href="<?php echo base_url();?>admin/user/export/<?php echo $current_page; ?>/<?php echo $perpage; ?>/<?php echo ($keyword)?$keyword:'default'; ?>/<?php echo $status; ?>/<?php echo ($province)?$povince:'default'; ?>/<?php echo ($district)?$district:'default';?>/<?php echo ($daterange)?$daterange:'default'; ?>/<?php echo $sorting_order; ?>/<?php echo $sorting_field;?>">Xuất ra Excel</a>
     50                                       
     51                </div>
    4752
    4853            </div>
     
    7681                                </div>
    7782                                                                <div style="clear: both;"></div>
    78                                                                 <div class="dataTables_status" style="float: right;" id="sample-table-2_status"><label>Lọc theo Tỉnh/TP:
    79                                                                         <select onchange="filter();" name="province-code" size="1" style="width: 176px; height: 28px;">
     83                                                                <div class="dataTables_province" style="float: right;" id="sample-table-2_status"><label>Lọc theo Tỉnh/TP:
     84                                                                        <select onchange="filter();" name="province" class="form-field-province" size="1" style="width: 176px; height: 28px;">
    8085                                                                                <option value=''></option>
     86                                               
    8187                                                                                <?php foreach ($provinces as $key => $pro): ?>
    82                                                                                         <option <?php if ($key == $province_code) echo "selected"; ?> value="<?php echo $key; ?>"><?php echo $pro; ?></option>
     88                                                                                        <option <?php if ($key == $province) echo "selected"; ?> value="<?php echo $key; ?>"><?php echo $pro; ?></option>
    8389                                                                                <?php endforeach; ?>
     90                                                                        </select>
     91                                </div>
     92                                                               
     93                                                                <div class="dataTables_district" style="float: right;" id="sample-table-2_status"><label>Lọc theo Quận/Huyện:
     94                                                                        <select onchange="filter();" name="district" id="form-field-district" class="form-field-district" size="1" style="width: 176px; height: 28px;">
     95                                                                                <?php if ($districts):?>
     96                                                                                        <option value=''></option>
     97                                                                                        <?php foreach ($districts as $key => $dist): ?>
     98                                                                                                <option <?php if ($dist['district_id'] == $district) echo "selected"; ?> value="<?php echo $dist['district_id']; ?>"><?php echo $dist['district_name']; ?></option>
     99                                                                                        <?php endforeach; ?>
     100                                                                                        <?php endif;?>
    84101                                                                        </select>
    85102                                </div>
     
    92109                            </div>
    93110                        </div>
    94 
     111                                                <input type="hidden" name="sorting_order" id="sorting_order" value="<?php echo $sorting_order; ?>" />
     112                                                <input type="hidden" name="sorting_field" id="sorting_field" value="<?php echo $sorting_field; ?>"/>
    95113                </div>
    96114
    97                 <input type="hidden" name="sorting_order" id="sorting_order" value="<?php echo $sorting_order; ?>" />
    98                 <input type="hidden" name="sorting_field" id="sorting_field" value="<?php echo $sorting_field; ?>"/>
    99115                </form>
    100116                <!-- Table Content -->
     
    104120                        <thead>
    105121                            <tr role="row">
    106                                 <th class="center sorting_disabled" role="columnheader" rowspan="1" colspan="1" style="width: 44px;" aria-label="">
     122                                <!--<th class="center sorting_disabled" role="columnheader" rowspan="1" colspan="1" style="width: 44px;" aria-label="">
    107123                                    <label>
    108124                                        <input type="checkbox" class="ace">
    109125                                        <span class="lbl"></span>
    110126                                    </label>
    111                                 </th>
     127                                </th>-->
    112128                                <th class="<?php
    113129                                if ($sorting_field == 'cellphone') {
     
    117133                                }
    118134                                ?>" id="cellphone" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 156px;" aria-label="Tài khoản: activate to sort column ascending">Số điện thoại</th>
    119                                 <th class="<?php
    120                                 if ($sorting_field == 'cellphone') {
    121                                     echo $sorting_order;
    122                                 } else {
    123                                     echo "sorting";
    124                                 }
    125                                 ?>" id="cellphone" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 156px;" aria-label="Số điện thoại: activate to sort column ascending">Họ tên</th>
     135                                <th style="width: 156px;">Họ tên</th>
    126136                                                               
    127137                                <th class="<?php
     
    152162                                    Ngày hết hạn
    153163                                </th>
    154                                 <th style="width: 140px;">Tỉnh/TP</th>
     164                                <th style="width: 130px;">Tỉnh/TP</th>
     165                                                                 <th style="width: 150px;">Quận/Huyện</th>
    155166                                <th class="sorting_disabled" id="status" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 156px;">Tình trạng</th>
    156167                            </tr>
     
    163174                                                        ?>
    164175                                <tr class="odd">
     176                                                                <!--
    165177                                    <td class="center  sorting_1">
    166178                                        <label>
     
    168180                                            <span class="lbl"></span>
    169181                                        </label>
    170                                     </td>
     182                                    </td>-->
    171183                                    <td class=" ">
    172184                                        <a onclick="getUserHistory(<?php echo $user['us_id']; ?>, 1);" data-toggle="modal"><?php echo $user['username']; ?></a>
     
    180192                                    <td class=" "><?php echo isset($user['expire_date']) && strtotime($user['expire_date']) > 0 ? date('d/m/Y', strtotime($user['expire_date'])) : ''; ?></td>
    181193                                    <td><?php echo $user['province']; ?></td>
     194                                                                        <td><?php echo $user['district_name']; ?></td>
    182195                                                                        <td class=" ">
    183196                                                                        <?php if (strtotime($user['expire_date']) > time() && $user['p_id'] != 5 ): ?>
     
    242255                <div class="tab-content history-tab-content">
    243256                    <div class="tab-pane in active" id="regis">
    244                                                 <div class="col-sm-12">
     257                                                <div>
    245258                                                        <h5>Tài khoản SBG Online: <b><span class="blue"><span id="topup-money"><?php echo number_format($acc_balanced, 0); ?></span> VNĐ <span></b></h5>
    246259                                                </div>
  • pro-violet-viettel/sourcecode/application/modules/frontend/controllers/home.php

    r838 r883  
    181181       
    182182        public function test(){
    183                 $provinces = lang('_PROVINCES_');
    184                 $this->load->library("PHPExcel");
    185                 $file = './assets/danhsachquanhuyen.xls';
    186                 $objPHPExcel = PHPExcel_IOFactory::load($file);
    187                 $cell_collection = $objPHPExcel->getActiveSheet()->getCellCollection();
    188                 foreach ($cell_collection as $cell) {
    189                         $column = $objPHPExcel->getActiveSheet()->getCell($cell)->getColumn();
    190                         $row = $objPHPExcel->getActiveSheet()->getCell($cell)->getRow();
    191                         $data_value = $objPHPExcel->getActiveSheet()->getCell($cell)->getValue();
    192                        
    193                         if ($row == 1) {
    194                                 $header[$row][$column] = $data_value;
    195                         } else {
    196                                 $arr_data[$row][$column] = $data_value;
    197                         }
     183                $aryMatch = array();
     184                $phoneNumber = '987133325';
     185                $regex = '/^[1,9][0-9]{8,9}$/';
     186                if (preg_match('/^[1,9]([0-9]{8,9})$/', $phoneNumber, $aryMatch)){
     187                        $phoneNumber = "0".$phoneNumber;
     188                        echo $phoneNumber;
     189                }else{
     190                        echo "Not match";
    198191                }
    199                
    200                 $data['header'] = $header;
    201                 $data['values'] = $arr_data;
    202                
    203                 foreach ($data['values'] as $index => $value){
    204                         foreach ($provinces as $provinceId => $province){
    205                                 if ($value['C'] == $province) $data['values'][$index]['C'] = $provinceId;
    206                                 if ($value['B'] >= 10){
    207                                         $data['values'][$index]['B'] = "0".$value['B'];
    208                                 }else{
    209                                         $data['values'][$index]['B'] = "00".$value['B'];
    210                                 }
    211                         }
    212                        
    213                 }
    214                
    215                 $dt = array();
    216                 foreach ($data['values'] as $index => $value){
    217                        
    218                         $dt[$index]['district_id'] = $value['B'];
    219                         $dt[$index]['province_id'] = $value['C'];
    220                         $dt[$index]['district_name'] = $value['D'];
    221                         $dt[$index]['type'] = $value['E'];
    222                 }
    223                 //var_dump($dt);
    224                 //$this->load->model ( 'user_model' );
    225                 //$result = $this->user_model->insertDistrict($dt);
    226                 //var_dump($result);
    227192        }
    228193}
  • pro-violet-viettel/sourcecode/application/modules/frontend/controllers/user.php

    r838 r883  
    449449        public function regis_history()
    450450        {
     451                $this->load->model('servicepackage_model');
    451452                $this->load->helper('pagging');
    452453                $us_id = $this->uri->segment(4);
     
    466467                        $this->load->model('user_model');
    467468                        $result = $this->user_model->getPackagelog($data);
    468                         $data['total'] = $this->user_model->countPackagelogs($username);
     469                        $results = array();
     470                        foreach($result as $re){
     471                                if ($re['p_code']>0){
     472                                        $p_price =  $this->servicepackage_model->getPackagePriceByCode($re['p_code']);
     473                                        $re['amount'] = -$p_price;
     474                                }
     475                                array_push($results, $re);
     476                        }
     477                        $data['total'] = $this->user_model->countPackagelogs($username, $us_id);
    469478                        $data['num_links'] = 2;
    470479                        $data['paging_url'] = base_url() . "frontend/user/regis_history/".$us_id."/page/";
    471480                        $data['paging'] = pagging($data);
    472481                        $packagelogs = array();
    473                         foreach ($result as $packagelog):
     482                        foreach ($results as $packagelog):
    474483                                $packagelog['created_time'] = date('d/m/Y H:i:s', strtotime($packagelog['created_time']));
    475484                                array_push($packagelogs, $packagelog);
     
    487496               
    488497                $user_info = $this->session->userdata('userInfo');
    489                 if ($user_info) {
     498                $admin_info = $this->session->userdata('adminInfo');
     499                if ($user_info || $admin_info) {
    490500                        $result = array();
    491501                        $provinceId = $this->uri->segment(4);
  • pro-violet-viettel/sourcecode/application/modules/frontend/models/user_model.php

    r838 r883  
    576576                $this->db->query ( 'UNLOCK TABLES' );
    577577                //$sql="SELECT tblregisterpackagelog.source,tblservicepackage.p_name,tblregisterpackagelog.created_time FROM tblregisterpackagelog INNER JOIN tblservicepackage ON tblservicepackage.p_code = tblregisterpackagelog.p_code where username = ? UNION SELECT tblpaidlog.source,tblpaidlog.amount,tblpaidlog.paid_time FROM tblpaidlog where us_id = ? ORDER BY created_time DESC LIMIT ".$data['start'].", ".$data['perpage']."";
    578                 $sql="SELECT tblregisterpackagelog.source,0 as amount,tblservicepackage.p_name,tblregisterpackagelog.created_time FROM tblregisterpackagelog INNER JOIN tblservicepackage ON tblservicepackage.p_code = tblregisterpackagelog.p_code where username = ? UNION SELECT tblpaidlog.source,tblpaidlog.amount,'Nạp tiền' as name,tblpaidlog.paid_time FROM tblpaidlog where us_id = ? ORDER BY created_time DESC LIMIT ".$data['start'].", ".$data['perpage']."";
     578                $sql="SELECT tblregisterpackagelog.source,0 as amount,tblservicepackage.p_name,tblregisterpackagelog.created_time, tblregisterpackagelog.p_code FROM tblregisterpackagelog INNER JOIN tblservicepackage ON tblservicepackage.p_code = tblregisterpackagelog.p_code where username = ? UNION SELECT tblpaidlog.source,tblpaidlog.amount,'Nạp tiền' as name,tblpaidlog.paid_time, 0 as p_code FROM tblpaidlog where us_id = ? ORDER BY created_time DESC LIMIT ".$data['start'].", ".$data['perpage']."";
    579579                $query = $this->db->query ( $sql, array ("$username", $us_id) );
    580580                $row = $query->result_array();
     
    582582        }
    583583       
    584         public function countPackagelogs($username)
     584        public function countPackagelogs($username, $us_id)
    585585        {
    586586                $this->db->query ( 'UNLOCK TABLES' );
    587587                $sql="SELECT COUNT(id) AS total FROM tblregisterpackagelog WHERE username = ?";
     588               
    588589                $query = $this->db->query ( $sql, array (
    589590                                $username
    590591                ) );
    591592                $result = $query->row_array();
     593                $total = $result['total'];
     594                $sql="SELECT COUNT(paid_id) AS total FROM tblpaidlog WHERE us_id = ?";
     595                $query = $this->db->query ( $sql, array (
     596                                $us_id
     597                ) );
     598                $result = $query->row_array();
     599                $total = $total + $result['total'];
     600                $result['total'] = $total;
     601               
    592602                return $result['total'];
    593603        }
  • pro-violet-viettel/sourcecode/application/modules/frontend/views/user_infor.php

    r838 r883  
    5959<script>
    6060var district_id = "<?php echo $user['district']; ?>";
    61 $(".form-field-province").change(function(){
    62         changeEventProvince();
     61var province_id = "<?php echo $user['province']; ?>";
     62$(document).ready(function(){
     63        $(".form-field-province").change(function(){
     64                changeEventProvince(province_id);
     65        });
     66        if ($(".form-field-province").val() !== 'undefined'){
     67                checkSelectedDistrict(province_id);
     68        }
    6369});
    64 if ($(".form-field-province").val() !== 'undefined'){
    65         checkSelecteDistrict();
    66 }
    6770</script>
  • pro-violet-viettel/sourcecode/application/modules/services/models/services_model.php

    r838 r883  
    336336                );
    337337
    338                 $xml = $this->load->view('charging', $aryParams, true);
     338                $xml = $this->load->view('services/charging', $aryParams, true);
    339339                $client = new nusoap_client($url);
    340340                $client->useHTTPPersistentConnection();
     
    342342                $client->operation = $action;
    343343                $result = $client->send($xml, $action);
    344 
    345344                if ($client->fault) {
    346345                        return _SBG_CHARGING_FAIL;
     
    395394                );
    396395               
    397                 $xml = $this->load->view('mt', $aryParams, true);
     396                $xml = $this->load->view('services/mt', $aryParams, true);
    398397                $url = $this->config->item('mt_service_url');
    399398                $client = new nusoap_client($url);
  • pro-violet-viettel/sourcecode/assets/css/custom.css

    r838 r883  
    311311#form-field-province {padding-left: 0;}
    312312#form-field-district {padding-left: 0;}
     313
     314.file-upload {
     315        position: relative;
     316        overflow: hidden;
     317        margin: 8px;
     318        border-radius: 4px;
     319}
     320.file-upload input.upload {
     321        position: absolute;
     322        top: 0;
     323        right: 0;
     324        margin: 0;
     325        padding: 0;
     326        font-size: 20px;
     327        cursor: pointer;
     328        opacity: 0;
     329        filter: alpha(opacity=0);
     330}
     331#input-upload{
     332        padding: 10px 12px;
     333        font-size: 14px;
     334        border: 1px solid #D8D8D8;
     335
     336}
     337#btn-submit{
     338        border-radius: 4px;
     339}
  • pro-violet-viettel/sourcecode/assets/js/admin/user.js

    r838 r883  
    8989                        {
    9090                            $('#user-history').modal('hide');
    91                             //alert("đã cập nhật");
     91                         
    9292                            location.reload();
    9393                        }
     
    9797}
    9898
    99 function checkSelecteDistrict(){
    100         provinceId = $(".form-field-province").val();
     99function checkSelectedDistrict(provinceId){
    101100        $.ajax({
    102101        url: '/frontend/user/getDistrict/' + provinceId,
     
    120119}
    121120
    122 function changeEventProvince(){
     121function changeEventProvince(provinceId){
    123122        $(".form-field-district").html("");
    124         provinceId = $("#form-field-province").val();
    125123        $.ajax({
    126124        url: '/frontend/user/getDistrict/' + provinceId,
     
    139137    });
    140138}
     139
     140$(document).ready(function(){
     141        $(".form-field-province").change(function(){
     142                //alert("OK");
     143                changeEventProvince();
     144        });
     145        if ($(".form-field-province").val() !== 'undefined'){
     146                checkSelectedDistrict();
     147        }
     148});
  • pro-violet-viettel/sourcecode/assets/js/frontend/user.js

    r838 r883  
    4545                       
    4646                        if ($(".form-field-province").val() !== 'undefined'){
    47                                 checkSelecteDistrict();
     47                                checkSelectedDistrict();
    4848                        }
    4949                        $(".form-field-province").change(function(){
     
    121121                success: function (data, textStatus, jqXHR)
    122122                {       
    123                 console.log(data);
    124123                        result = jQuery.parseJSON(data);
    125124                        if (result.success == "1")
     
    286285}
    287286
    288 function checkSelecteDistrict(){
     287function checkSelectedDistrict(){
    289288        provinceId = $(".form-field-province").val();
    290289        $.ajax({
     
    309308}
    310309
    311 if ($(".form-field-province").val() !== 'undefined'){
    312         checkSelecteDistrict();
    313 }
    314 
    315310function changeEventProvince(){
    316311        $(".form-field-district").html("");
     
    332327    });
    333328}
    334 
    335 $(".form-field-province").change(function(){
    336         changeEventProvince();
     329$(document).ready(function(){
     330        if ($(".form-field-province").val() !== 'undefined'){
     331                checkSelectedDistrict();
     332        }
     333        $(".form-field-province").change(function(){
     334                changeEventProvince();
     335        });
    337336});
Note: See TracChangeset for help on using the changeset viewer.