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');
+		
+	}
+	
 }
Index: pro-violet-viettel/sourcecode/application/modules/admin/models/paidlog_model.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/models/paidlog_model.php	(revision 838)
+++ pro-violet-viettel/sourcecode/application/modules/admin/models/paidlog_model.php	(revision 883)
@@ -13,4 +13,5 @@
 	}
 	function getPaidlogs($data) {
+		
 		if ($data['paid_type'] == 0){
 			$sql = "SELECT SUM(amount) as total_amount FROM tblpaidlog";
@@ -19,4 +20,5 @@
 		}
 		$r = $this->db->query($sql)->row_array();
+		
 		$total_amount = (int)$r['total_amount'];
         $sql = "SELECT * FROM " . $this->table_name. " INNER JOIN tbluser ON tbluser.us_id = tblpaidlog.us_id ";
@@ -54,10 +56,15 @@
 			}
 		}
-		if ($data['start']){
+
+		//if ($data['start']){
+		
 			$sql=$sql . " " . $order . " LIMIT " . $data['start'] . ", " . $data['perpage'] . " ";
-		}
+		//}
+	
         //return $this->db->query($sql)->result_array();
 		$re = $this->db->query($sql)->result_array();
+		
 		$result['paid_logs'] = $re;
+		
 		$result['total_amount'] = $total_amount;
 		return $result;
Index: pro-violet-viettel/sourcecode/application/modules/admin/models/reportmodel.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/models/reportmodel.php	(revision 838)
+++ pro-violet-viettel/sourcecode/application/modules/admin/models/reportmodel.php	(revision 883)
@@ -28,5 +28,6 @@
 		$provinces = lang ( '_PROVINCES_' );
 		// Tinh doanh thu theo tinh theo nam
-		$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";
+		//$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";
+		$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";
 		$query = $this->db->query ( $sql );
 		$dtns = $query->result_array ();
@@ -46,7 +47,7 @@
 		
 		// Tinh thue bao theo tinh theo nam
-		$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";
-		$query = $this->db->query ( $sql );
-		write_file('./log/test.log', date('d-m-Y H:i:s').": ".$sql."\n", FOPEN_WRITE_CREATE);
+		//$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";
+		$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";
+		$query = $this->db->query ( $sql );
 		$tbns = $query->result_array ();
 		
@@ -146,7 +147,8 @@
 		// tinh thue bao theo thang
 		//$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 ";
-		$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'] . "'";
+		$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'";
 		$query = $this->db->query ( $sql );
 		$users = $query->result_array ();
+		//write_file('./log/sql.log', date("d-m-Y H:i:s").": ".$sql."\n", FOPEN_WRITE_CREATE);
 		
 		$sql = "SELECT * FROM tblservicepackage WHERE p_period>0";
Index: pro-violet-viettel/sourcecode/application/modules/admin/models/user_model.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/models/user_model.php	(revision 838)
+++ pro-violet-viettel/sourcecode/application/modules/admin/models/user_model.php	(revision 883)
@@ -40,7 +40,13 @@
 			if (strlen($data['keyword'])>0){
 				if ($data['status']==0){
-					if (strlen($data['province_code'])>0){
-						if(strlen($data['daterange_start'])>0){
-							$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']."')";
+					if (strlen($data['province'])>0){
+						if (strlen($data['district'])>0){
+							if(strlen($data['daterange_start'])>0){
+								$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']."')";
+							}
+						}else{
+							if(strlen($data['daterange_start'])>0){
+								$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']."')";
+							}
 						}
 					}else{
@@ -54,10 +60,19 @@
 				}else
 				{
-					if (strlen($data['province_code'])>0){
-						if(strlen($data['daterange_start'])>0){
-							$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']."')";
-						}else{
-							$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']."%') ";
-						}
+					if (strlen($data['province'])>0){
+						if (strlen($data['district'])>0){
+							if(strlen($data['daterange_start'])>0){
+								$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']."')";
+							}else{
+								$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']."%') ";
+							}
+						}else{
+							if(strlen($data['daterange_start'])>0){
+								$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']."')";
+							}else{
+								$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']."%') ";
+							}
+						}
+						
 					}
 				}
@@ -66,31 +81,52 @@
 				if(strlen($data['daterange_start'])>0){
 					if ($data['status']==0){
-						if (strlen($data['province_code'])>0){
-							$sql.=" WHERE province = '".$data['province_code']."' AND created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."'";
+						if (strlen($data['province'])>0){
+							if (strlen($data['district'])>0){
+								$sql.=" WHERE province = '".$data['province']."' AND district = '".$data['district']."' AND created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."'";
+							}else{
+								$sql.=" WHERE province = '".$data['province']."' AND created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."'";
+							}
 						}else{
 							$sql.=" WHERE (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
 						}
 					}else{
-						if (strlen($data['province_code'])>0){
-							$sql.=" AND province = '".$data['province_code']."' AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
+						if (strlen($data['province'])>0){
+							if (strlen($data['district'])>0){
+								$sql.=" AND province = '".$data['province']."' AND district = '".$data['district']."' AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
+							}else{
+								$sql.=" AND province = '".$data['province']."' AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
+							}
 						}else{
 							$sql.=" AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
 						}
+
 					}		
 				}
 				else{
 					if ($data['status']==0){
-						if (strlen($data['province_code'])>0){
-							$sql.=" WHERE province = '".$data['province_code']."'"; 
-						}
-					}else{
-						if (strlen($data['province_code'])>0){
-							$sql.=" AND province = '".$data['province_code']."'";
-						}
+						if (strlen($data['province'])>0){
+							if (strlen($data['district'])>0){
+								$sql.=" WHERE province = '".$data['province']."' AND district = '".$data['district']."'";
+							}else{
+								$sql.=" WHERE province = '".$data['province']."'";
+							}
+						}
+					}else{
+						if (strlen($data['province'])>0){
+							if (strlen($data['district'])>0){
+								$sql.=" AND province = '".$data['province']."' AND district = '".$data['district']."'";
+							}else{
+								$sql.=" AND province = '".$data['province']."'";
+
+							}
+						}
+						
 					}		
 				}
 			}
 		}
+	
 		$order = "";
+		
 		if ($data['sorting_order'] != "sorting") {
 			if($data['sorting_field'] != "status"){
@@ -101,5 +137,5 @@
 			}
 		}
-		write_file('./log/test.log', date("d-m-Y: H:i:s"). ": ".$sql." ".$order." LIMIT ".$data['start'].", ".$data['perpage'] , FOPEN_WRITE_CREATE);
+		//write_file('./log/sql.log', date("d-m-Y: H:i:s"). ": ".$sql." ".$order." LIMIT ".$data['start'].", ".$data['perpage']."\n" , FOPEN_WRITE_CREATE);
 		return $this->db->query($sql." ".$order." LIMIT ".$data['start'].", ".$data['perpage']." ")->result_array();
 	}
@@ -126,8 +162,15 @@
 			if (strlen($data['keyword'])>0){
 				if ($data['status']==0){
-					if (strlen($data['province_code'])>0){
-						if(strlen($data['daterange_start'])>0){
-							$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']."')";
-						}
+					if (strlen($data['province'])>0){
+						if (strlen($data['district'])>0){
+							if(strlen($data['daterange_start'])>0){
+							$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']."')";
+						}
+						}else{
+							if(strlen($data['daterange_start'])>0){
+							$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']."')";
+						}
+						}
+						
 					}else{
 						if(strlen($data['daterange_start'])>0){
@@ -140,9 +183,17 @@
 				}else
 				{
-					if (strlen($data['province_code'])>0){
-						if(strlen($data['daterange_start'])>0){
-							$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']."')";
-						}else{
-							$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']."%') ";
+					if (strlen($data['province'])>0){
+						if (strlen($data['district'])>0){
+							if(strlen($data['daterange_start'])>0){
+								$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']."')";
+							}else{
+								$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']."%') ";
+							}	
+						}else{
+							if(strlen($data['daterange_start'])>0){
+								$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']."')";
+							}else{
+								$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']."%') ";
+							}
 						}
 					}
@@ -152,12 +203,20 @@
 				if(strlen($data['daterange_start'])>0){
 					if ($data['status']==0){
-						if (strlen($data['province_code'])>0){
-							$sql.=" WHERE province = '".$data['province_code']."' AND created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."'";
+						if (strlen($data['province'])>0){
+							if (strlen($data['district'])>0){
+								$sql.=" WHERE province = '".$data['province']."' AND district = '".$data['district']."' AND created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."'";
+							}else{
+								$sql.=" WHERE province = '".$data['province']."' AND created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."'";
+							}
 						}else{
 							$sql.=" AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
 						}
 					}else{
-						if (strlen($data['province_code'])>0){
-							$sql.=" AND province = '".$data['province_code']."' AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
+						if (strlen($data['province'])>0){
+							if (strlen($data['district'])>0){
+								$sql.=" AND province = '".$data['province']."' AND district = '".$data['district']."' AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
+							}else{
+								$sql.=" AND province = '".$data['province']."' AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
+							}
 						}else{
 							$sql.=" AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";
@@ -167,10 +226,18 @@
 				else{
 					if ($data['status']==0){
-						if (strlen($data['province_code'])>0){
-							$sql.=" WHERE province = '".$data['province_code']."'"; 
-						}
-					}else{
-						if (strlen($data['province_code'])>0){
-							$sql.=" AND province = '".$data['province_code']."'";
+						if (strlen($data['province'])>0){
+							if (strlen($data['district'])>0){
+								$sql.=" WHERE province = '".$data['province']."' AND district = '".$data['district']."'";
+							}else{
+								$sql.=" WHERE province = '".$data['province']."'";
+							} 
+						}
+					}else{
+						if (strlen($data['province'])>0){
+							if (strlen($data['district'])>0){
+								$sql.=" AND province = '".$data['province']."' AND district = '".$data['district']."'";
+							}else{
+								$sql.=" AND province = '".$data['province']."'";
+							}
 						}
 					}		
@@ -191,3 +258,21 @@
 	}
 	
+	public function getDistrictByProvince($provinceId){
+		$sql = "SELECT * FROM tbldistrict WHERE province_id = ?";
+		$query = $this->db->query ( $sql, array (
+				$provinceId
+		) );
+		$results = $query->result_array();
+		return $results;
+	}
+	
+	public function getDistrictByIdAndProvince($districtId, $provinceId){
+		$sql = "SELECT * FROM tbldistrict WHERE district_id = ? AND province_id = ?";
+		$query = $this->db->query ( $sql,array ($districtId, $provinceId) );
+		if ($query->num_rows () > 0) {
+			$row = $query->row_array ();
+			return $row;
+		}
+		
+	}
 }
Index: pro-violet-viettel/sourcecode/application/modules/admin/views/report/index.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/views/report/index.php	(revision 838)
+++ pro-violet-viettel/sourcecode/application/modules/admin/views/report/index.php	(revision 883)
@@ -1,3 +1,3 @@
-﻿<?php
+<?php
 $base_url = base_url();
 $this->load->view('layout/admin/header', array('base_url' => $base_url));
@@ -157,9 +157,9 @@
         <li>
             <i class="icon-home home-icon"></i>
-            <a href="#">Trang chủ</a>
+            <a href="#">Trang chá»§</a>
         </li>
 
         <li>
-            <a href="#">Quản lý tin nhắn</a>
+            <a href="#">Quáº£n lÃœ tin nháº¯n</a>
         </li>
         
@@ -169,5 +169,5 @@
         <form class="form-search">
             <span class="input-icon">
-                <input type="text" autocomplete="off" id="nav-search-input" class="nav-search-input" placeholder="Tìm kiếm ...">
+                <input type="text" autocomplete="off" id="nav-search-input" class="nav-search-input" placeholder="TÃ¬m kiáº¿m ...">
                 <i class="icon-search nav-search-icon"></i>
             </span>
@@ -183,8 +183,8 @@
     <div class="page-header">
         <h1>
-            Tin nhắn
+            Tin nháº¯n
             <small>
                 <i class="icon-double-angle-right"></i>
-                Mẫu tin nhắn
+                Máº«u tin nháº¯n
             </small>
         </h1>
Index: pro-violet-viettel/sourcecode/application/modules/admin/views/report/listview.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/views/report/listview.php	(revision 838)
+++ pro-violet-viettel/sourcecode/application/modules/admin/views/report/listview.php	(revision 883)
@@ -1,8 +1,8 @@
-﻿<div class="col-xs-12">
+<div class="col-xs-12">
 		<!-- PAGE CONTENT BEGINS -->
 		<div style="padding-bottom:4px" class="table-header">
 			Doanh thu
 			<div class="pull-right" style="margin:5px;">
-					<a style="color:#fff" href="<?php echo base_url();?>admin/report/export">Xuất ra Excel</a>
+					<a style="color:#fff" href="<?php echo base_url();?>admin/report/export">Xuáº¥t ra Excel</a>
                 </div>
 		</div>
@@ -13,10 +13,10 @@
 					<div class="row">
 						<div class="col-sm-6">
-							<div id="sample-table-2_length" class="dataTables_length"><label>Hiện thị 
+							<div id="sample-table-2_length" class="dataTables_length"><label>Hiá»n thá» 
 									<select onchange="filter();" name="items" size="1" aria-controls="sample-table-2">                                      
 										<?php foreach ($itemsoptions as $option) { ?>
 										<option <?php if($option == $perpage) echo "selected"; ?> value="<?php echo $option;?>"><?php echo $option;?></option>
 										<?php } ?>
-									</select> bản ghi</label>
+									</select> báº£n ghi</label>
 
 							</div>
@@ -25,8 +25,8 @@
 						<div class="col-sm-6">
 							<!--<div class="dataTables_filter" id="sample-table-2_filter">
-								<label>Tìm kiếm: 
+								<label>TÃ¬m kiáº¿m: 
 									<input type="text" name="keyword" id="keyword" value='<?php echo $keyword;?>' style="width: 162px; height: 18px;" aria-controls="sample-table-2"></label>
 							</div>-->
-							<div class="dataTables_filter" id="sample-table-2_filter"><label>Lọc theo:
+							<div class="dataTables_filter" id="sample-table-2_filter"><label>Lá»c theo:
 								<select onchange="filter();" name="paid_type" size="1" style="width: 176px; height: 28px;">                                      
 									<?php foreach ($paid_types as $key => $type): ?>
@@ -51,9 +51,9 @@
 						<tr role="row">
 							
-							<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>
-							<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>
-							<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> 
-							<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> 
-							<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>
+							<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>
+							<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>
+							<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> 
+							<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> 
+							<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>
 							  
 					</thead>
@@ -90,5 +90,5 @@
 						<tr>
 						<td colspan=2>
-						Tổng tiền
+						Tá»ng tiá»n
 						</td>
 						<td colspan=3>
@@ -97,5 +97,5 @@
 						</tr>
 					</tbody></table><div class="row"><div class="col-sm-6">
-							<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>
+							<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>
 								
 						</div>
@@ -120,5 +120,5 @@
             <div class="modal-header">
                 <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
-                <h4 class="modal-title">Lịch sử</h4>
+                <h4 class="modal-title">Lá»ch sá»­</h4>
             </div>
             <div class="modal-body">
@@ -126,10 +126,10 @@
                     <li class="active" >
                         <a id="regis-tab" href="#regis" data-toggle="tab">
-                            Giao dịch
+                            Giao dá»ch
                         </a>
                     </li>
                     <li>
                         <a id="trade-tab" href="#trade" data-toggle="tab">
-                            Thông tin
+                            ThÃŽng tin
                         </a>
                     </li>
@@ -137,6 +137,6 @@
                 <div class="tab-content history-tab-content">
                     <div class="tab-pane in active" id="regis">
-						<div class="col-sm-12">
-							<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>
+						<div>
+							<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>
 						</div>
                         <div class="table-responsive">
@@ -145,11 +145,11 @@
                                     <tr>
                                         <th class="center">
-                                            Từ
+                                            Tá»«
                                         </th>
-										<th class="center"> Số tiền (VNĐ) </th>
-                                        <th class="center"> Gói dịch vụ </th>
+										<th class="center"> Sá» tiá»n (VNÄ) </th>
+                                        <th class="center"> GÃ³i dá»ch vá»¥ </th>
                                         <th>
                                             <i class="icon-time bigger-110 hidden-480"></i>
-                                            Thời gian
+                                            Thá»i gian
                                         </th>
                                     </tr>
Index: pro-violet-viettel/sourcecode/application/modules/admin/views/reportpackage/province.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/views/reportpackage/province.php	(revision 838)
+++ pro-violet-viettel/sourcecode/application/modules/admin/views/reportpackage/province.php	(revision 883)
@@ -9,5 +9,5 @@
                 BÃ¡o cÃ¡o doanh thu theo tá»nh / thÃ nh phá» theo gÃ³i cÆ°á»c.
             <div class="pull-right" style="margin:5px;">
-                    <a style="color:#fff" href="<?php echo base_url();?>admin/reportpackage/export/<?php echo $month;?>/<?php echo $year;?>">Xuáº¥t ra Excel</a>
+                    <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>
                 </div>
             </div>
@@ -17,6 +17,17 @@
                     <form autocomplete="off" onsubmit="return false;" id="province" >
                         <div class="row">
-                            <div class="col-sm-6">
-                                <div class="" style="display: inline-block"><label>ThÃ¡ng
+                            <div class="col-sm-1">
+                                <div class="" style="display: inline-block"><label><strong>Tá»«: </strong></label></div>
+							</div>
+							<div class="col-sm-6">
+								<div class="" style="display: inline-block"><label>NgÃ y</label>
+
+                                        <select aria-controls="sample-table-2" size="1" name="date" onchange="filter();">                                      
+                                            <?php for ($i=1;$i<=31;$i++) { ?>
+                                            <option value="<?php echo $i;?>" <?php if($date==$i) { ?> selected <?php }?>><?php echo $i;?></option>
+                                            <?php }?>
+                                        </select>
+                                </div>
+								<div class="" style="display: inline-block"><label>ThÃ¡ng</label>
 
                                         <select aria-controls="sample-table-2" size="1" name="month" onchange="filter();">                                      
@@ -34,5 +45,6 @@
                                         </select>
                                 </div>
-                            </div>
+							</div>
+							
 
                             <div class="col-sm-6">
@@ -40,4 +52,37 @@
                             </div>
                         </div>
+						
+						<div class="row">
+							<div class="col-sm-1">
+                                <div class="" style="display: inline-block"><label><strong>Äáº¿n: </strong></label></div>
+							</div>
+							<div class="col-sm-6">
+								<div class="" style="display: inline-block"><label>NgÃ y</label>
+
+                                        <select aria-controls="sample-table-2" size="1" name="to_date" onchange="filter();">                                      
+                                            <?php for ($i=1;$i<=31;$i++) { ?>
+                                            <option value="<?php echo $i;?>" <?php if($to_date==$i) { ?> selected <?php }?>><?php echo $i;?></option>
+                                            <?php }?>
+                                        </select>
+                                </div>
+                                <div class="" style="display: inline-block"><label>ThÃ¡ng</label>
+
+                                        <select aria-controls="sample-table-2" size="1" name="to_month" onchange="filter();">                                      
+                                            <?php for ($i=1;$i<=12;$i++) { ?>
+                                            <option value="<?php echo $i;?>" <?php if($to_month==$i) { ?> selected <?php }?>><?php echo $i;?></option>
+                                            <?php }?>
+                                        </select>
+                                </div>
+                                <div class=""  style="display: inline-block"><label>NÄm
+
+                                        <select aria-controls="sample-table-2" size="1" name="to_year" onchange="filter();">                                      
+                                            <?php for ($i=2014;$i<=date("Y");$i++) { ?>
+                                            <option value="<?php echo $i;?>" <?php if($to_year==$i) { ?> selected <?php }?>><?php echo $i;?></option>
+                                            <?php }?>
+                                        </select>
+                                </div>
+                            </div>
+						</div>
+						
                           </form>
                     <table class="table table-striped table-bordered table-hover dataTable" id="sample-table-2" aria-describedby="sample-table-2_info">
Index: pro-violet-viettel/sourcecode/application/modules/admin/views/reportprovince/province.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/views/reportprovince/province.php	(revision 838)
+++ pro-violet-viettel/sourcecode/application/modules/admin/views/reportprovince/province.php	(revision 883)
@@ -17,45 +17,5 @@
                 <div role="grid" class="dataTables_wrapper" id="sample-table-2_wrapper">
                     <form autocomplete="off" onsubmit="return false;" id="province" >
-                        <div class="row">
-                            <div class="col-sm-1">
-                                <div class="" style="display: inline-block"><label><strong>Tá»«: </strong></label></div>
-							</div>
-							<div class="col-sm-6">
-								<div class="" style="display: inline-block"><label>NgÃ y</label>
-
-                                        <select aria-controls="sample-table-2" size="1" name="date" onchange="filter();">                                      
-                                            <?php for ($i=1;$i<=31;$i++) { ?>
-                                            <option value="<?php echo $i;?>" <?php if($date==$i) { ?> selected <?php }?>><?php echo $i;?></option>
-                                            <?php }?>
-                                        </select>
-                                </div>
-								<div class="" style="display: inline-block"><label>ThÃ¡ng</label>
-
-                                        <select aria-controls="sample-table-2" size="1" name="month" onchange="filter();">                                      
-                                            <?php for ($i=1;$i<=12;$i++) { ?>
-                                            <option value="<?php echo $i;?>" <?php if($month==$i) { ?> selected <?php }?>><?php echo $i;?></option>
-                                            <?php }?>
-                                        </select>
-                                </div>
-                                <div class=""  style="display: inline-block"><label>NÄm
-
-                                        <select aria-controls="sample-table-2" size="1" name="year" onchange="filter();">                                      
-                                            <?php for ($i=2014;$i<=date("Y");$i++) { ?>
-                                            <option value="<?php echo $i;?>" <?php if($year==$i) { ?> selected <?php }?>><?php echo $i;?></option>
-                                            <?php }?>
-                                        </select>
-                                </div>
-							</div>
-							
-
-                            <div class="col-sm-6">
-
-                            </div>
-                        </div>
-						
 						<div class="row">
-							<div class="col-sm-1">
-								<div class="" style="display: inline-block"><label><strong>Äáº¿n: </strong></label></div>
-							</div>
 							<div class="col-sm-6">
 								<div class="" style="display: inline-block"><label>NgÃ y</label>
@@ -108,7 +68,7 @@
 								<td style="font-weight:bold;"><?php echo $totalTbth; ?></td>
 								<td style="font-weight:bold;"><?php echo $totalTbn; ?></td>
-								<td style="font-weight:bold;"><?php echo $totalDtng; ?></td>
-								<td style="font-weight:bold;"><?php echo $totalDtth; ?></td>
-								<td style="font-weight:bold;"><?php echo $totalDtn; ?></td>
+								<td style="font-weight:bold;"><?php echo number_format($totalDtng, 0); ?></td>
+								<td style="font-weight:bold;"><?php echo number_format($totalDtth, 0); ?></td>
+								<td style="font-weight:bold;"><?php echo number_format($totalDtn, 0); ?></td>
 								
 							</tr>
@@ -127,7 +87,7 @@
                                     <td class="hidden-480 "><?php echo $province['tbt']; ?></td>
                                     <td class=" "><?php echo $province['tbn']; ?></td>
-                                    <td class=" "><?php echo $province['dtng']; ?></td>
-                                    <td class=" "><?php echo $province['dtt']; ?></td>
-                                    <td class=" "><?php echo $province['dtn']; ?></td>
+                                    <td class=" "><?php echo number_format($province['dtng'], 0); ?></td>
+                                    <td class=" "><?php echo number_format($province['dtt'], 0); ?></td>
+                                    <td class=" "><?php echo number_format($province['dtn'], 0); ?></td>
 
                                 </tr>
Index: pro-violet-viettel/sourcecode/application/modules/admin/views/user/index.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/views/user/index.php	(revision 838)
+++ pro-violet-viettel/sourcecode/application/modules/admin/views/user/index.php	(revision 883)
@@ -90,11 +90,11 @@
 				$('#table_content').show();
 				$("#content").html(data);
-				$("#keyword").focus();
-				$("#keyword").setCursorToTextEnd();
 				$('.daterangepicker').daterangepicker({
 					format: 'DD/MM/YYYY'
 				});
+				$("#keyword").focus();
+				$("#keyword").setCursorToTextEnd();
+				init_page();
 				$('input[name="daterange"]').val(daterange);
-				init_page();
 			},
 			error: function (jqXHR, textStatus, errorThrown)
@@ -104,4 +104,8 @@
         });
 	}
+	//$(document).ready(function(){
+		
+	//});
+	
 		
 </script>
Index: pro-violet-viettel/sourcecode/application/modules/admin/views/user/listview.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/views/user/listview.php	(revision 838)
+++ pro-violet-viettel/sourcecode/application/modules/admin/views/user/listview.php	(revision 883)
@@ -45,4 +45,9 @@
                     ThÃªm ngÆ°á»i dÃ¹ng
                 </button-->
+				<div class="pull-right" style="margin:5px;">
+                    
+					<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>
+					
+                </div>
 
             </div>
@@ -76,10 +81,22 @@
                                 </div>
 								<div style="clear: both;"></div>
-								<div class="dataTables_status" style="float: right;" id="sample-table-2_status"><label>Lá»c theo Tá»nh/TP:
-									<select onchange="filter();" name="province-code" size="1" style="width: 176px; height: 28px;">
+								<div class="dataTables_province" style="float: right;" id="sample-table-2_status"><label>Lá»c theo Tá»nh/TP:
+									<select onchange="filter();" name="province" class="form-field-province" size="1" style="width: 176px; height: 28px;">
 										<option value=''></option>
+						
 										<?php foreach ($provinces as $key => $pro): ?>
-											<option <?php if ($key == $province_code) echo "selected"; ?> value="<?php echo $key; ?>"><?php echo $pro; ?></option>
+											<option <?php if ($key == $province) echo "selected"; ?> value="<?php echo $key; ?>"><?php echo $pro; ?></option>
 										<?php endforeach; ?>
+									</select>
+                                </div>
+								
+								<div class="dataTables_district" style="float: right;" id="sample-table-2_status"><label>Lá»c theo Quáº­n/Huyá»n:
+									<select onchange="filter();" name="district" id="form-field-district" class="form-field-district" size="1" style="width: 176px; height: 28px;">
+										<?php if ($districts):?>
+											<option value=''></option>
+											<?php foreach ($districts as $key => $dist): ?>
+												<option <?php if ($dist['district_id'] == $district) echo "selected"; ?> value="<?php echo $dist['district_id']; ?>"><?php echo $dist['district_name']; ?></option>
+											<?php endforeach; ?>
+											<?php endif;?>
 									</select>
                                 </div>
@@ -92,9 +109,8 @@
                             </div>
                         </div>
-
+						<input type="hidden" name="sorting_order" id="sorting_order" value="<?php echo $sorting_order; ?>" />
+						<input type="hidden" name="sorting_field" id="sorting_field" value="<?php echo $sorting_field; ?>"/>
                 </div>
 
-                <input type="hidden" name="sorting_order" id="sorting_order" value="<?php echo $sorting_order; ?>" />
-                <input type="hidden" name="sorting_field" id="sorting_field" value="<?php echo $sorting_field; ?>"/>
                 </form>
                 <!-- Table Content -->
@@ -104,10 +120,10 @@
                         <thead>
                             <tr role="row">
-                                <th class="center sorting_disabled" role="columnheader" rowspan="1" colspan="1" style="width: 44px;" aria-label="">
+                                <!--<th class="center sorting_disabled" role="columnheader" rowspan="1" colspan="1" style="width: 44px;" aria-label="">
                                     <label>
                                         <input type="checkbox" class="ace">
                                         <span class="lbl"></span>
                                     </label>
-                                </th>
+                                </th>-->
                                 <th class="<?php
                                 if ($sorting_field == 'cellphone') {
@@ -117,11 +133,5 @@
                                 }
                                 ?>" 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>
-                                <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: 156px;" aria-label="Sá» Äiá»n thoáº¡i: activate to sort column ascending">Há» tÃªn</th>
+                                <th style="width: 156px;">Há» tÃªn</th>
 								
                                 <th class="<?php
@@ -152,5 +162,6 @@
                                     NgÃ y háº¿t háº¡n
                                 </th>
-                                <th style="width: 140px;">Tá»nh/TP</th>
+                                <th style="width: 130px;">Tá»nh/TP</th>
+								 <th style="width: 150px;">Quáº­n/Huyá»n</th>
                                 <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>
                             </tr>
@@ -163,4 +174,5 @@
 							?>
                                 <tr class="odd">
+								<!--
                                     <td class="center  sorting_1">
                                         <label>
@@ -168,5 +180,5 @@
                                             <span class="lbl"></span>
                                         </label>
-                                    </td>
+                                    </td>-->
                                     <td class=" ">
                                         <a onclick="getUserHistory(<?php echo $user['us_id']; ?>, 1);" data-toggle="modal"><?php echo $user['username']; ?></a>
@@ -180,4 +192,5 @@
                                     <td class=" "><?php echo isset($user['expire_date']) && strtotime($user['expire_date']) > 0 ? date('d/m/Y', strtotime($user['expire_date'])) : ''; ?></td>
                                     <td><?php echo $user['province']; ?></td>
+									<td><?php echo $user['district_name']; ?></td>
 									<td class=" ">
 									<?php if (strtotime($user['expire_date']) > time() && $user['p_id'] != 5 ): ?>
@@ -242,5 +255,5 @@
                 <div class="tab-content history-tab-content">
                     <div class="tab-pane in active" id="regis">
-						<div class="col-sm-12">
+						<div>
 							<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>
 						</div>
