Index: pro-violet-viettel/sourcecode/application/modules/admin/controllers/report.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/controllers/report.php	(revision 838)
+++ pro-violet-viettel/sourcecode/application/modules/admin/controllers/report.php	(revision 883)
@@ -15,7 +15,8 @@
     public function index() {
         $data = array();
+
         $admin_info = $this->session->userdata('adminInfo');
         if ($admin_info) {
-            $data['statistics'] = $this->getStatistics();
+			$data['statistics'] = $this->getStatistics();
             $data['content'] = $this->getPaidlogs();
             $this->load->view('report/index', $data);
@@ -30,5 +31,5 @@
         return $this->load->view('report/statistics', $data, true);
     }
-
+	
 
     public function getPaidlogs($filters = array()) {
@@ -69,5 +70,4 @@
 			$data ['paid_type'] = ( int ) $this->input->post ( 'paid_type' );
 		}
-		
 		$data['daterange_start'] = "";
 		$data['daterange_end'] = "";
@@ -78,11 +78,15 @@
 		}
         $data['start'] = ($data['current_page'] - 1) * $data['perpage'];
+		
         $data['total'] = $this->paidlog_model->countPaidlog($data);
-        $data['paidlogs'] = $this->paidlog_model->getPaidlogs($data)['paid_logs'];
-		$data['total_amount'] = $this->paidlog_model->getPaidlogs($data)['total_amount'];
+		$result = $this->paidlog_model->getPaidlogs($data);
+		$data['paidlogs'] = $result['paid_logs'];
+		$data['total_amount'] = $result['total_amount'];
 		
         $data['paging_url'] = base_url() . "/admin/doanh_thu_tong_hop/trang/";
         $data['num_links'] = 2;
         $data['paging'] = pagging($data);
+		
+
         foreach ($data['paidlogs'] as $index => $paidlog) {
             $data['paidlogs'][$index]['username'] = @$this->get_fullname($paidlog['us_id']); 
@@ -93,4 +97,5 @@
         }
         return $this->load->view('report/listview', $data, true);
+		
     }
 
@@ -137,6 +142,7 @@
         }
     }
-	
+
 	public function export(){
+		
         $this->load->model('paidlog_model');
 		$data ['paid_types'] = array (
@@ -157,7 +163,9 @@
 			$data['daterange_end'] = date('Y-m-d 23:59:59', strtotime($daterange[1]));
 		}
+		
         $data['total'] = $this->paidlog_model->countPaidlog($data);
-        $data['paidlogs'] = $this->paidlog_model->getPaidlogs($data)['paid_logs'];
-		$data['total_amount'] = $this->paidlog_model->getPaidlogs($data)['total_amount'];
+		$result = $this->paidlog_model->getPaidlogs($data);
+        $data['paidlogs'] = $result['paid_logs'];
+		$data['total_amount'] = $result['total_amount'];
 		
         foreach ($data['paidlogs'] as $index => $paidlog) {
@@ -177,5 +185,5 @@
 
 		
-	
+		
 		$sheet->setCellValue('B1', "Táº¬P ÄOÃN VIá»N THÃNG QUÃN Äá»I");
 		$style = array(
@@ -278,5 +286,5 @@
 			)
 		);
-
+		
         $dem=0;
         foreach ($data['paidlogs'] as $index => $paidlog) {
@@ -297,8 +305,10 @@
             $dem++;
         }
+		
         $writer = new PHPExcel_Writer_Excel5($this->phpexcel);
 		header('Content-Type: application/vnd.ms-excel');
         header('Content-Disposition: attachment; filename="bao_cao_tong_hop_'.date('d-m-Y').'.xls"');
         $writer->save('php://output');
+		
 	}
 }
Index: pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportpackage.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportpackage.php	(revision 838)
+++ pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportpackage.php	(revision 883)
@@ -29,13 +29,17 @@
 
         $this->load->model('reportmodel');
-        $data['date']=1;
+        $data['date']=date("d");
         $data['month'] = date("m");
         $data['year'] = date("Y");
-        $data['to_date']= 31;
+        $data['to_date']= date("d");
         $data['to_month'] = date("m");
         $data['to_year'] = date("Y");
         if ($this->input->post('month')) {
+			$data['date']= $this->input->post('date');
             $data['month'] = $this->input->post('month');
             $data['year'] = $this->input->post('year');
+			$data['to_date'] = $this->input->post('to_date');
+            $data['to_month'] = $this->input->post('to_month');
+            $data['to_year'] = $this->input->post('to_year');
         }
         $data = $this->getdays($data);
@@ -70,11 +74,12 @@
     public function export() {
         $this->load->model('reportmodel');
-		$data['date']=1;
-        $data['month'] = $this->uri->segment(4);
-        $data['year'] = $this->uri->segment(5);
-		$data['to_date']=31;
-        $data['to_month'] = date("m");
-        $data['to_year'] = date("Y");
-        $data = $this->getdays($data);
+		//$data['date']=1;
+        $data['date'] = $this->uri->segment(4);
+		$data['month'] = $this->uri->segment(5);
+        $data['year'] = $this->uri->segment(6);
+		$data['to_date'] = $this->uri->segment(8);
+		$data['to_month'] = $this->uri->segment(9);
+        $data['to_year'] = $this->uri->segment(10);
+        //$data = $this->getdays($data);
         $result = $this->reportmodel->getPackages($data);
         $data['provinces'] = $result['provinces'];
@@ -85,51 +90,169 @@
         $sheet = $this->phpexcel->getActiveSheet();
         $sheet->setTitle("bao cao thue bao " . $data['month'] . " - " . $data['year']);
-        $sheet->getColumnDimension('A')->setWidth(10);
+         $sheet->getColumnDimension('A')->setWidth(10);
         $sheet->getColumnDimension('B')->setWidth(25);
-        $sheet->getColumnDimension('C')->setWidth(15);
+        $sheet->getColumnDimension('C')->setWidth(25);
         $sheet->getColumnDimension('D')->setWidth(15);
         $sheet->getColumnDimension('E')->setWidth(15);
         $sheet->getColumnDimension('F')->setWidth(15);
         $sheet->getColumnDimension('G')->setWidth(15);
-        $sheet->getColumnDimension('H')->setWidth(15);
-        $sheet->setCellValue('A1', "BÃ¡o cÃ¡o doanh thu theo tá»nh");
-        $sheet->setCellValue('A2', "Thá»i gian: " . $data['month'] . " - " . $data['year']);
-        $sheet->setCellValue('A4', "STT");
-        $sheet->setCellValue('B4', "MÃ£ Tá»nh/ThÃ nh phá»");
-        $sheet->setCellValue('C4', "Tá»nh/ThÃ nh phá»");
+        $sheet->getColumnDimension('H')->setWidth(15); 
+        $sheet->getColumnDimension('I')->setWidth(15);
+        $sheet->getColumnDimension('J')->setWidth(15);
+		
+		$sheet->setCellValue('B1', "Táº¬P ÄOÃN VIá»N THÃNG QUÃN Äá»I");
+		$style = array(
+			'font' => array('bold' => true, 'size' => 12, 'name' =>'Cambria', 'color' => array('rgb' => '0070bf')),
+			'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
+								'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
+								'wrap' => true )
+		);
+		$sheet->mergeCells('B1:K1');
+		$sheet->getStyle('B1')->applyFromArray($style);
+		
+		$sheet->setCellValue('B2', "Tá»NG CÃNG TY VIá»N THÃNG VIETTEL");
+		
+		$style = array(
+			'font' => array('size' => 12, 'name' =>'Cambria', 'color' => array('rgb' => '0070bf')),
+			'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
+								'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
+								'wrap' => true )
+		);
+		$sheet->mergeCells('B2:K2');
+		$sheet->getStyle('B2')->applyFromArray($style);
+		
+		$style = array(
+			'font' => array('bold' => true,'size' => 12, 'name' =>'Cambria'),
+			'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
+								'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
+								'wrap' => true )
+		);
+		$sheet->setCellValue('A4', "BÃO CÃO DOANH THU THEO Tá»NH");
+		$sheet->mergeCells('A4:L4');
+		$sheet->getStyle('A4:L4')->applyFromArray($style);
+		
+		
+		$style = array(
+			'font' => array('size' => 11, 'name' =>'Cambria'),
+			'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
+								'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
+								'wrap' => true ),
+			'borders' =>	array(
+				'allborders' => array(
+					'style' => \PHPExcel_Style_Border::BORDER_THIN
+					)
+			)
+		);
+		
+		$sheet->setCellValue('B6', "Tá»« ngÃ y: ".$data['date']."/".$data['month']."/".$data['year']);
+		$sheet->setCellValue('C6', "Äáº¿n ngÃ y: ".$data['to_date']."/".$data['to_month']."/".$data['to_year']);
+		$sheet->setCellValue('B7', "NgÃ y káº¿t xuáº¥t: ".date("d")."/".date("m")."/".date("Y"));
+		$sheet->setCellValue('C7', "NhÃ¢n viÃªn káº¿t xuáº¥t: ");
+		
+		$sheet->getStyle('B6:C7')->applyFromArray($style);
+		
+		$style = array(
+			'font' => array('bold' => true, 'size' => 11, 'name' =>'Cambria'),
+			'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
+								'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
+								'wrap' => true ),
+			'borders' =>	array(
+				'allborders' => array(
+					'style' => \PHPExcel_Style_Border::BORDER_THIN
+					)
+			)
+		);
+
+        $sheet->setCellValue('A9', "STT");
+        $sheet->setCellValue('B9', "MÃ£ Tá»nh/ThÃ nh phá»");
+        $sheet->setCellValue('C9', "Tá»nh/ThÃ nh phá»");
+		$sheet->getStyle('A9:C9')->applyFromArray($style);
+		
         $chars = array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L");
         $dem = 2;
-        $stt=1;
+        $stt = 1;
         foreach ($data['packages'] as $package) {
             $dem++;
-            $sheet->setCellValue($chars[$dem] . "4", $package['p_name']);
+            $sheet->setCellValue($chars[$dem] . "9", $package['p_name']);
             $dem++;
-            $sheet->setCellValue($chars[$dem] . "4", "Tá» lá» %");
+            $sheet->setCellValue($chars[$dem] . "9", "Tá» lá» %");
         
             $stt++;
         }
         $dem++;
-        $sheet->setCellValue($chars[$dem] . ($index + 4), "Tá»ng TB");
-
-$stt=1;
+		$sheet->setCellValue($chars[$dem] . ($index + 9), "Tá»ng TB");
+		$sheet->getStyle('A9:'.$chars[$dem] . ($index + 9))->applyFromArray($style);
+		
+		//$sheet->getStyle($chars[$dem].($index + 9))->applyFromArray($style);
+		
+		$sheet->setCellValue('A10', "Tá»ng");
+		$sheet->mergeCells('A10:C10');
+		$sheet->getStyle('A10:'.$chars[$dem].($index + 10))->applyFromArray($style);
+
+		$dem = 2;
+		
+		foreach ($data['totalVip'] as $vipName=>$totalVip){
+			$dem++;
+			$sheet->setCellValue($chars[$dem] . '10', $totalVip);
+			$sheet->getStyle($chars[$dem] . '10')->applyFromArray($style);
+			$dem++;
+		}
+		
+		//$sheet->getStyle('A10:'.$chars[$dem].($index + 10))->applyFromArray($style);
+		
+		$styleSTT = array(
+			'font' => array('size' => 11, 'name' =>'Cambria'),
+			'alignment' => array('bold' => true,
+								'horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
+								'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
+								'wrap' => true ),
+			'borders' =>	array(
+				'allborders' => array(
+					'style' => \PHPExcel_Style_Border::BORDER_THIN
+					)
+			)
+		);
+		
+		$style = array(
+			'font' => array('size' => 11, 'name' =>'Cambria'),
+			'alignment' => array('bold' => true,
+								'horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
+								'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
+								'wrap' => true ),
+			'borders' =>	array(
+				'allborders' => array(
+					'style' => \PHPExcel_Style_Border::BORDER_THIN
+					)
+			)
+		);
+		
+		$stt=1;
         foreach ($data['provinces'] as $index => $provinces) {
 
-            $sheet->setCellValue('A' . ($stt + 5), $provinces['stt']);
-            $sheet->setCellValue('B' . ($stt + 5), $index);
-            $sheet->setCellValue('C' . ($stt + 5), $provinces['province']);
+            $sheet->setCellValue('A' . ($stt + 10), $provinces['stt']);
+			$sheet->getStyle('A'.($stt + 10))->applyFromArray($styleSTT);
+            $sheet->setCellValue('B' . ($stt + 10), $index);
+            $sheet->setCellValue('C' . ($stt + 10), $provinces['province']);
+			$sheet->getStyle('B'.($stt + 10).":C".($stt + 10))->applyFromArray($style);
             $dem = 2;
             foreach ($provinces['packages'] as $package) {
                 $dem++;
-                $sheet->setCellValue($chars[$dem] . ($stt + 5), $package['total']);
+                $sheet->setCellValue($chars[$dem] . ($stt + 10), $package['total']);
+				$sheet->getStyle($chars[$dem] . ($stt + 10))->applyFromArray($style);
                 $dem++;
-                $sheet->setCellValue($chars[$dem] . ($stt + 5), $package['percent']);
+                $sheet->setCellValue($chars[$dem] . ($stt + 10), $package['percent']);
+				$sheet->getStyle($chars[$dem] . ($stt + 10))->applyFromArray($style);
             }
             $dem++;
             
-            $sheet->setCellValue($chars[$dem] . ($stt + 5), $provinces['total']);
+            $sheet->setCellValue($chars[$dem] . ($stt + 10), $provinces['total']);
+			$sheet->getStyle($chars[$dem] . ($stt + 10))->applyFromArray($style);
+			
             $stt++;
         }
+		
+		
         $writer = new PHPExcel_Writer_Excel5($this->phpexcel);
-        header('Content-Disposition: attachment; filename="doanh_thu_' . $data['month'] . "_" . $data['year'] . '.xls"');
+        header('Content-Disposition: attachment; filename="doanh_thu_'. $data['date'] . "_" . $data['month'] . "_" . $data['year']  .'-'. $data['to_date'] . "_" . $data['to_month'] . "_" . $data['to_year'] . '.xls"');
         $writer->save('php://output');
     }
Index: pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportprovince.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportprovince.php	(revision 838)
+++ pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportprovince.php	(revision 883)
@@ -30,5 +30,5 @@
 
         $this->load->model('reportmodel');
-        $data['date'] = date("d");
+        $data['date'] = 1;
         $data['month'] = date("m");
         $data['year'] = date("Y");
@@ -37,7 +37,8 @@
         $data['to_year'] = date("Y");
         if ($this->input->post()) {
-			$data['date'] = $this->input->post('date');
-            $data['month'] = $this->input->post('month');
-            $data['year'] = $this->input->post('year');
+            //$data['month'] = $this->input->post('month');
+            //$data['year'] = $this->input->post('year');
+			$data['month'] = $this->input->post('to_month');
+            $data['year'] = $this->input->post('to_year');
 			$data['to_date'] = $this->input->post('to_date');
             $data['to_month'] = $this->input->post('to_month');
@@ -130,5 +131,5 @@
 	public function exportProvince(){
 		$this->load->model('reportmodel');
-		$data['date'] = date("d");
+		$data['date'] = 1;
         $data['month'] = $this->uri->segment(4);
         $data['year'] = $this->uri->segment(5);
@@ -137,7 +138,7 @@
         $data['to_year'] = date("Y");
         if ($this->input->post()) {
-			$data['date'] = $this->input->post('date');
-            $data['month'] = $this->input->post('month');
-            $data['year'] = $this->input->post('year');
+			//$data['date'] = $this->input->post('date');
+            $data['month'] = $this->input->post('to_month');
+            $data['year'] = $this->input->post('to_year');
 			$data['to_date'] = $this->input->post('to_date');
             $data['to_month'] = $this->input->post('to_month');
@@ -362,5 +363,5 @@
         $writer = new PHPExcel_Writer_Excel5($this->phpexcel);
 		header('Content-Type: application/vnd.ms-excel');
-        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"');
+        header('Content-Disposition: attachment; filename="thue_bao_va_doanh_thu_theo_tinh_' . $data["to_date"].'_'. $data['to_month'].'_'. $data['to_year'] . '.xls"');
         $writer->save('php://output');
 	}
Index: pro-violet-viettel/sourcecode/application/modules/admin/controllers/user.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/controllers/user.php	(revision 838)
+++ pro-violet-viettel/sourcecode/application/modules/admin/controllers/user.php	(revision 883)
@@ -27,4 +27,5 @@
 		$this->load->helper ( 'pagging' );
 		$this->load->model ( 'user_model' );
+		
 		$provinces = lang('_PROVINCES_');
 		error_log(var_export($provinces, TRUE), 3, '/srv/www/sbg/log/provinces.log');
@@ -50,7 +51,12 @@
 		}
 		$data['provinces'] = $provinces;
-		$data['province_code'] = '';
-		if ($this->input->post ( 'province-code' )) {
-			$data ['province_code'] = $this->input->post ( 'province-code' );
+		$data['province'] = '';
+		if ($this->input->post ( 'province' )) {
+			$data ['province'] = $this->input->post ( 'province' );
+		}
+		if ($data['province'])
+			$data['districts'] = $this->user_model->getDistrictByProvince($data ['province']);
+		if ($this->input->post ( 'district' )) {
+			$data['district'] = $this->input->post ( 'district' );
 		}
 		$data ['keyword'] = "";
@@ -58,5 +64,5 @@
 		$data ['sorting_field'] = "created_time";
 		if ($this->input->post ( 'sorting_order' )) {
-			if ($this->input->post ( 'sorting_order' ) != "sorting") {
+			if ($this->input->post ( 'sorting_ord	er' ) != "sorting") {
 				$data ['sorting_order'] = $this->input->post ( 'sorting_order' );
 				$data ['sorting_field'] = $this->input->post ( 'sorting_field' );
@@ -84,5 +90,8 @@
 		
 		foreach ( $us as $u ) {
+			$dist = $this->user_model->getDistrictByIdAndProvince($u['district'], $u['province']);
+			$u['district_name'] = $dist['type']." ".$dist['district_name'];
 			$u ['province'] = isset($provinces[$u ['province']]) ? $provinces[$u ['province']] : $u ['province'];
+			
 			$userinfo = $this->get_userinfo ( $u ['us_id'] );
 			if ($userinfo) {
@@ -171,11 +180,249 @@
 		$this->load->model ( 'user_model' );
 		$data = $this->user_model->get_user_info ( $src, $us_id, $token );
-		// var_dump($data);
 		$result = array ();
 		parse_str ( $data, $result );
 		return $result;
+	}
+	
+	public function export(){
+		
+		$this->load->helper ( 'pagging' );
+		$this->load->model ( 'user_model' );
+		$provinces = lang('_PROVINCES_');
+	
+		$data ['current_page'] = $this->uri->segment ( 4, 1 );
+		$data ['itemsoptions'] = array (
+				10,
+				25,
+				50,
+				100 
+		);
+
+		$data ['perpage'] = $this->uri->segment (5, 10);
+		$data ['statusoptions'] = array (
+				0 => "Táº¥t cáº£",
+				1 => "ÄÃ£ ÄÄng kÃœ VIP",
+				2 => "DÃ¹ng thá»­ 7 ngÃ y",
+				3=> "DÃ¹ng thá»­ háº¡n cháº¿",
+				4=> "Háº¿t háº¡n"
+		);
+		$data ['status'] = $this->uri->segment (7, 0);
 		/*
-		 * if (strpos($data, '&')){ $arr_users = explode("&", $data); $str_username = $arr_users[1]; $arr_username = explode("=", $str_username); return $arr_username[1]; }else { return ""; }
-		 */
-	}
+		if ($this->input->post ( 'status' )) {
+			$data ['status'] = ( int ) $this->input->post ( 'status' );
+		}
+		*/
+		$data['provinces'] = $provinces;
+		$data['province'] = $this->uri->segment (8);
+		if ($data['province'] == 'default') $data['province'] = null;
+		if ($this->input->post ( 'province' )) {
+			$data ['province'] = $this->input->post ( 'province' );
+		}
+		if ($data['province'])
+			$data['districts'] = $this->user_model->getDistrictByProvince($data ['province']);
+		if ($this->input->post ( 'district' )) {
+			$data['district'] = $this->input->post ( 'district' );
+		}
+		
+		$data['district'] = $this->uri->segment (9);
+		if ($data['district'] == 'default') $data['district'] = null;
+		$data ['keyword'] = $this->uri->segment (6);
+		if ($data['keyword'] == 'default') $data['keyword'] = null;
+		$data ['sorting_order'] = "sorting_desc";
+		$data ['sorting_field'] = "created_time";
+		$data ['sorting_order'] = $this->uri->segment (11);
+		$data ['sorting_field'] = $this->uri->segment (12);
+		
+		if ($this->input->post ( 'sorting_order' )) {
+			if ($this->input->post ( 'sorting_order' ) != "sorting") {
+				$data ['sorting_order'] = $this->input->post ( 'sorting_order' );
+				$data ['sorting_field'] = $this->input->post ( 'sorting_field' );
+			}
+		}
+		
+		if ($this->input->post ( 'items' )) {
+			$data ['perpage'] = $this->input->post ( 'items' );
+		}
+		
+		if ($this->input->post ( 'keyword' )) {
+			$data ['keyword'] = $this->input->post ( 'keyword' );
+		}
+		
+		$data ['daterange_start'] = "";
+		$data ['daterange_end'] = "";
+		$daterange = $this->uri->segment (10);
+		if ($daterange == 'default') $daterange = null;
+		if($daterange){
+			$daterange = explode ( " - ", $daterange );
+			$daterange [0] = str_replace ( '/', '-', $daterange [0] );
+			$daterange [1] = str_replace ( '/', '-', $daterange [1] );
+			$data ['daterange_start'] = date ( 'Y-m-d H:i:s', strtotime ( $daterange [0] ) );
+			$data ['daterange_end'] = date ( 'Y-m-d H:is:s', strtotime ( $daterange [1] . ' + 1 day' ) );
+		}
+		if ($this->input->post ( 'daterange' )) {
+			$daterange = explode ( " - ", $this->input->post ( 'daterange' ) );
+			$daterange [0] = str_replace ( '/', '-', $daterange [0] );
+			$daterange [1] = str_replace ( '/', '-', $daterange [1] );
+			$data ['daterange_start'] = date ( 'Y-m-d H:i:s', strtotime ( $daterange [0] ) );
+			$data ['daterange_end'] = date ( 'Y-m-d H:is:s', strtotime ( $daterange [1] . ' + 1 day' ) );
+		}
+		$data ['start'] = ($data ['current_page'] - 1) * $data ['perpage'];
+		$data ['total'] = $this->user_model->get_total_users ( $data );
+		$us = $this->user_model->get_list_users ( $data );
+		$users = array ();
+		
+		foreach ( $us as $u ) {
+			$dist = $this->user_model->getDistrictByIdAndProvince($u['district'], $u['province']);
+			$u['district_name'] = $dist['type']." ".$dist['district_name'];
+			$u ['province'] = isset($provinces[$u ['province']]) ? $provinces[$u ['province']] : $u ['province'];
+			
+			$userinfo = $this->get_userinfo ( $u ['us_id'] );
+			if ($userinfo) {
+				$u ['username'] = $userinfo ['username'];
+				$u['fullname'] = $userinfo['fullname'];
+			}
+			
+			if (strtotime($u['expire_date']) > time() && $u['p_id'] != 5 ){
+				$u['status'] = 'ÄÃ£ ÄÄng kÃœ VIP';
+			}elseif(strtotime($u['expire_date']) > time() && $u['p_id'] == 5){
+				$u['status'] = 'DÃ¹ng thá»­ 7 ngÃ y';
+			}elseif(strtotime($u['expire_date']) < time() && $u['p_id'] == 5){
+				$u['status'] = 'DÃ¹ng thá»­ háº¡n cháº¿';
+			}else{
+				$u['status'] = 'Háº¿t háº¡n';
+			}
+			
+			array_push ( $users, $u );
+		}
+	
+		$data ['users'] = $users;
+		$data ['paging_url'] = base_url () . "admin/nguoi_dung/trang/";
+		$data ['num_links'] = 2;
+		$data ['paging'] = pagging ( $data );
+		
+		$this->load->library("PHPExcel");
+        $sheet = $this->phpexcel->getActiveSheet();
+		
+        $sheet->setTitle("bao cao thue bao " . $data['month'] . " - " . $data['year']);
+        $sheet->getColumnDimension('A')->setWidth(10);
+        $sheet->getColumnDimension('B')->setWidth(25);
+        $sheet->getColumnDimension('C')->setWidth(25);
+        $sheet->getColumnDimension('D')->setWidth(15);
+        $sheet->getColumnDimension('E')->setWidth(15);
+        $sheet->getColumnDimension('F')->setWidth(15);
+        $sheet->getColumnDimension('G')->setWidth(15);
+        $sheet->getColumnDimension('H')->setWidth(25); 
+        $sheet->getColumnDimension('I')->setWidth(25);
+		
+		
+		$sheet->setCellValue('B1', "Táº¬P ÄOÃN VIá»N THÃNG QUÃN Äá»I");
+		$style = array(
+			'font' => array('bold' => true, 'size' => 12, 'name' =>'Cambria', 'color' => array('rgb' => '0070bf')),
+			'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
+								'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
+								'wrap' => true )
+		);
+		$sheet->mergeCells('B1:I1');
+		$sheet->getStyle('B1')->applyFromArray($style);
+		
+		$sheet->setCellValue('B2', "Tá»NG CÃNG TY VIá»N THÃNG VIETTEL");
+		$style = array(
+			'font' => array('size' => 12, 'name' =>'Cambria', 'color' => array('rgb' => '0070bf')),
+			'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
+								'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
+								'wrap' => true )
+		);
+		$sheet->mergeCells('B2:I2');
+		$sheet->getStyle('B2')->applyFromArray($style);
+		
+		
+		$sheet->setCellValue('A4', "DANH SÃCH NGÆ¯á»I DÃNG");
+		$style = array(
+			'font' => array('bold' => true, 'size' => 14, 'name' =>'Cambria'),
+			'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
+								'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
+								'wrap' => true )
+		);
+		$sheet->mergeCells('A4:I4');
+		$sheet->getStyle('A4')->applyFromArray($style);
+		
+		$sheet->setCellValue('A6', 'STT');
+		$style = array(
+			'font' => array('bold' => true, 'size' => 11, 'name' =>'Cambria'),
+			'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
+								'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
+								'wrap' => true),
+			'borders' =>	array(
+				'allborders' => array(
+					'style' => \PHPExcel_Style_Border::BORDER_THIN
+					)
+			)
+		);
+		$sheet->getStyle('A6')->applyFromArray($style);
+		$style = array(
+			'font' => array('bold' => true, 'size' => 11, 'name' =>'Cambria'),
+			'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
+								'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER,
+								'wrap' => true),
+			'borders' =>	array(
+				'allborders' => array(
+					'style' => \PHPExcel_Style_Border::BORDER_THIN
+					)
+			)
+		);
+		
+		$sheet->setCellValue('B6', 'Sá» Äiá»n thoáº¡i');
+		$sheet->setCellValue('C6', "Há» tÃªn)");
+		$sheet->setCellValue('D6', "TÃ i khoáº£n SBG");
+		$sheet->setCellValue('E6', "NgÃ y ÄÄng kÃœ");
+		$sheet->setCellValue('F6', "NgÃ y háº¿t háº¡n");
+		$sheet->setCellValue('G6', "Tá»nh/ThÃ nh phá»");
+		$sheet->setCellValue('H6', "Quáº­n/Huyá»n");
+		$sheet->setCellValue('I6', "TÃ¬nh tráº¡ng");
+		$sheet->getStyle('A6:I6')->applyFromArray($style);
+		
+		$styleSTT = array(
+			'font' => array('size' => 11, 'name' =>'Cambria'),
+			'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
+								'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER),
+			'borders' =>	array(
+				'allborders' => array(
+					'style' => \PHPExcel_Style_Border::BORDER_THIN
+					)
+			)
+		);
+		$style = array(
+			'font' => array('size' => 11, 'name' =>'Cambria'),
+			'alignment' => array('vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER),
+			'borders' =>	array(
+				'allborders' => array(
+					'style' => \PHPExcel_Style_Border::BORDER_THIN
+					)
+			)
+		);
+		$dem = 0;
+		foreach ($users as $index => $user):
+			$sheet->setCellValue('A' . ($dem + 7), $index + 1);
+			$sheet->setCellValueExplicit('B' . ($dem + 7), $user['username'], PHPExcel_Cell_DataType::TYPE_STRING);
+            $sheet->setCellValue('C' . ($dem + 7), $user['fullname']);
+            $sheet->setCellValue('D' . ($dem + 7), $user['acc_balanced']);
+            $sheet->setCellValue('E' . ($dem + 7), date('d/m/Y', strtotime($user['created_time'])));
+            $sheet->setCellValue('F' . ($dem + 7), isset($user['expire_date']) && strtotime($user['expire_date']) > 0 ? date('d/m/Y', strtotime($user['expire_date'])) : '');
+            $sheet->setCellValue('G' . ($dem + 7), $user['province']);
+            $sheet->setCellValue('H' . ($dem + 7), $user['district_name']);
+			$sheet->setCellValue('I' . ($dem + 7), $user['status']);
+			$sheet->getStyle('A' . ($dem + 7))->applyFromArray($styleSTT);
+			$sheet->getStyle('B' . ($dem + 7).':I'.($dem + 7))->applyFromArray($style);
+			
+			
+			$dem++;
+		endforeach;
+		
+		$writer = new PHPExcel_Writer_Excel5($this->phpexcel);
+		header('Content-Type: application/vnd.ms-excel');
+        header('Content-Disposition: attachment; filename="danhsachnguoidung_trang_'.$data['current_page'].'.xls"');
+        $writer->save('php://output');
+		
+	}
+	
 }
