Index: /pro-violet-viettel/sourcecode/application/config/routes.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/config/routes.php	(revision 882)
+++ /pro-violet-viettel/sourcecode/application/config/routes.php	(revision 883)
@@ -136,4 +136,12 @@
 $route['frontend/lecture/help.pdf'] = 'frontend/lecture/help';
 
+$route['cong_tac_vien'] = 'collaborator/home';
+$route['collaborator'] = 'collaborator/home';
+$route['cong_tac_vien/:any'] = 'collaborator/home/viewAsistant';
+$route['cong_tac_vien/thong_ke_nguoi_dung/trang/:any'] = 'collaborator/home/getCollaboratorsUsers/$1';
+$route['cong_tac_vien/nguoi_dung'] = 'collaborator/user';
+$route['cong_tac_vien/thong_tin_ca_nhan'] = 'collaborator/collaborator/profile';
+//$route['cong_tac_vien/thong_tin_ca_nhan/thay_doi_mat_khau/:any'] = 'collaborator/collaborator/change_password/$1';
+
 /* End of file routes.php */
 /* Location: ./application/config/routes.php */
Index: /pro-violet-viettel/sourcecode/application/language/message/messages_lang.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/language/message/messages_lang.php	(revision 882)
+++ /pro-violet-viettel/sourcecode/application/language/message/messages_lang.php	(revision 883)
@@ -21,4 +21,9 @@
 $lang['_SBG_ADMIN_LOGIN_NAME_REQUIRED_MSG'] = 'ChÆ°a nháº­p tÃ i khoáº£n admin';
 $lang['_SBG_ADMIN_PASSWORD_REQUIRED_MSG'] = 'Vui lÃ²ng nháº­p máº­t kháº©u';
+
+// collaborator
+$lang['_SBG_COLLABORATOR_LOGIN_FAIL_MSG'] = 'Sai username hoáº·c password!';
+$lang['_SBG_COLLABORATOR_LOGIN_NAME_REQUIRED_MSG'] = 'ChÆ°a nháº­p tÃ i khoáº£n cá»ng tÃ¡c viÃªn';
+$lang['_SBG_COLLABORATOR_PASSWORD_REQUIRED_MSG'] = 'Vui lÃ²ng nháº­p máº­t kháº©u';
 
 // frontend
Index: /pro-violet-viettel/sourcecode/application/modules/admin/controllers/report.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/modules/admin/controllers/report.php	(revision 882)
+++ /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 882)
+++ /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 882)
+++ /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 882)
+++ /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 882)
+++ /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 882)
+++ /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 882)
+++ /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 882)
+++ /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 882)
+++ /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 882)
+++ /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 882)
+++ /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 882)
+++ /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 882)
+++ /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>
Index: /pro-violet-viettel/sourcecode/application/modules/collaborator/controllers/collaborator.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/modules/collaborator/controllers/collaborator.php	(revision 883)
+++ /pro-violet-viettel/sourcecode/application/modules/collaborator/controllers/collaborator.php	(revision 883)
@@ -0,0 +1,239 @@
+<?php
+
+if (!defined('BASEPATH'))
+    exit('No direct script access allowed');
+
+class Collaborator extends MX_Controller {
+
+    const TOKENPW = 'violet';
+
+    public function __construct() {
+        parent::__construct();
+        $this->load->helper('cookie');
+		$this->load->helper('language');
+		$this->lang->load('messages', 'message');
+    }
+
+    public function index() {
+        $data = array();
+        $collaborator_info = $this->session->userdata('collaboratorInfo');
+        if ($collaborator_info) {
+            $data['statistics'] = $this->getStatistics();
+            $data['content'] = $this->getCollaborators();
+            $this->load->view('collaborator/reportAsistant/index', $data);
+        } else {
+            $this->load->view('login');
+        }
+    }
+
+    public function viewAsistant() {
+        $data = array();
+
+        $collaborator_info = $this->session->userdata('collaboratorInfo');
+        if ($collaborator_info) {
+            $id = $this->uri->segment(2);
+            $data['id'] = $id;
+            $data['statistics'] = $this->getStatistics($id);
+            $data['content'] = $this->getCollaboratorsUsers(array(), $id);
+            $this->load->view('collaborator/reportAsistant/indexCollaborator', $data);
+        } else {
+            $this->load->view('login');
+        }
+    }
+
+    public function getStatistics($id = false) {
+        $data = array();
+
+        $this_year['start'] = strtotime(date("Y") . "-01-01 00:00:00");
+
+        $this->load->model('admin/collabolator_model');
+        $collaborators = $this->collabolator_model->getAllCollaboratorUser($this_year['start'], $id);
+        for ($i = 1; $i <= 12; $i++) {
+            $statistics[$i] = 0;
+        }
+        $y = date("Y");
+        foreach ($collaborators as $collaborator) {
+            for ($i = 1; $i <= 12; $i++) {
+                if ($i < 12) {
+                    if (($collaborator['time'] > strtotime($y . "-" . $i . "-1 00:00:00")) && (($collaborator['time'] < strtotime($y . "-" . ($i + 1) . "-1 00:00:00")))) {
+                        $statistics[$i] ++;
+                    }
+                } else {
+                    if (($collaborator['time'] > strtotime($y . "-" . $i . "-1 00:00:00")) && (($collaborator['time'] < strtotime(($y + 1) . "-1-1 00:00:00")))) {
+                        $statistics[$i] ++;
+                    }
+                }
+            }
+        }
+
+        $max = 0;
+        foreach ($statistics as $index => $total) {
+            if ($total > $max) {
+                $max = $total;
+            }
+            $chart[] = array($index, $total);
+        }
+
+        $data['max'] = $max;
+        $chard[] = array("color" => "#e67e22", "label" => "LÆ°á»£ng ngÆ°á»i dÃ¹ng giá»i thiá»u bá»i cá»ng tÃ¡c viÃªn theo tá»«ng thÃ¡ng", "data" => $chart);
+        $data['chard'] = $chard;
+         
+        return $this->load->view('collaborator/reportAsistant/statistics', $data, true);
+    }
+
+    public function getLastquarter() {
+        $current_month = date('m');
+        $current_year = date('Y');
+
+        if ($current_month >= 1 && $current_month <= 3) {
+            $start_date = strtotime('1-October-' . ($current_year - 1));  // timestamp or 1-October Last Year 12:00:00 AM
+            $end_date = strtotime('1-Janauary-' . $current_year);  // // timestamp or 1-January  12:00:00 AM means end of 31 December Last year
+        } else if ($current_month >= 4 && $current_month <= 6) {
+            $start_date = strtotime('1-January-' . $current_year);  // timestamp or 1-Janauray 12:00:00 AM
+            $end_date = strtotime('1-April-' . $current_year);  // timestamp or 1-April 12:00:00 AM means end of 31 March
+        } else if ($current_month >= 7 && $current_month <= 9) {
+            $start_date = strtotime('1-April-' . $current_year);  // timestamp or 1-April 12:00:00 AM
+            $end_date = strtotime('1-July-' . $current_year);  // timestamp or 1-July 12:00:00 AM means end of 30 June
+        } else if ($current_month >= 10 && $current_month <= 12) {
+            $start_date = strtotime('1-July-' . $current_year);  // timestamp or 1-July 12:00:00 AM
+            $end_date = strtotime('1-October-' . $current_year);  // timestamp or 1-October 12:00:00 AM means end of 30 September
+        }
+        return array("start" => $start_date, "end" => $end_date);
+    }
+
+
+    public function getCollaboratorsUsers($filters = array(), $id = false) {
+
+        $this->load->helper('pagging');
+        $this->load->model('admin/collabolator_model');
+        $data['current_page'] = $this->uri->segment(5, 1);
+
+        $data['itemsoptions'] = array(10, 25, 50, 100);
+        $data['perpage'] = 10;
+        if (!$id) {
+            $data['id'] = $this->uri->segment(4, 1);
+        } else {
+            $data['id'] = $id;
+        }
+
+        $data['keyword'] = "";
+        $data['sorting_order'] = "sorting_desc";
+        $data['sorting_field'] = "id";
+
+        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['search_field'] = "";
+            $data['keyword'] = $this->input->post('keyword');
+
+            if (preg_match("/[0-9]/", $data['keyword'])) {
+                $data['search_field'] = "cellphone";
+            }
+        }
+
+		$data['daterange_start'] = "";
+		$data['daterange_end'] = "";
+		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->collabolator_model->countCountCollaboratorUsers($data);
+        $data['paidlogs'] = $this->collabolator_model->getCountCollaboratorUsers($data);
+        foreach ($data['paidlogs'] as $index=>$paidlog)
+        {
+            $data['paidlogs'][$index]['username']=$this->get_fullname($paidlog['us_id']);
+        }
+        $data['paging_url'] = base_url() . "/cong_tac_vien/thong_ke_cong_tac_vien/trang_ctv/" . $data['id'];
+        $data['num_links'] = 2;
+        $data['paging'] = pagging($data);
+
+        if ($this->input->is_ajax_request()) {
+            return $this->load->view('collaborator/reportAsistant/listview_user', $data);
+        }
+        return $this->load->view('collaborator/reportAsistant/listview_user', $data, true);
+    }
+
+    private function get_fullname($us_id) {
+        $fullname="";
+        $src = 'violet';
+        $token = md5($us_id . self::TOKENPW);
+        $this->load->model('admin/user_model');
+        $data = $this->user_model->get_user_info($src, $us_id, $token);
+        parse_str($data,$data);
+        if (isset($data['fullname']))
+        {
+            $fullname=$data['fullname'];
+        }
+        return $fullname;
+    }
+
+	public function profile(){
+		$collaborator_info = $this->session->userdata('collaboratorInfo');
+        if ($collaborator_info) {
+			$data['collaborator_id'] = $collaborator_info['id'];
+			$this->load->view('collaborator/collaborator_profile', $data);
+		}else{
+			$this->load->view('login');
+		}
+	}
+	
+	public function change_password(){
+		$this->load->model('collaborator_model');
+		//$collaborator_id = $this->uri->segment(4, 1);
+		$collaborator_info = $this->session->userdata('collaboratorInfo');
+        if ($collaborator_info) {
+			$collaborator_id = (int)$collaborator_info['id'];
+			$input = $this->input->post();
+            if (strlen($input['passwd']) == 0) {
+                $result['errors']['passwd_old_err'] = lang('_SBG_PASSWORD_REQUIRED_MSG');
+            }
+			
+            if (strlen($input['passwd_new']) == 0) {
+                $result['errors']['passwd_new_err'] = lang('_SBG_PASSWORD_REQUIRED_MSG');
+            } else if (strcmp($input['passwd'], $input['passwd_new']) == 0) {
+                $result['errors']['passwd_new_err'] = lang('_SBG_PASSWORD_DUPLICATE_MSG');
+            }else
+			{
+				if (!preg_match('/^([0-9a-zA-Z]{6,65})*$/', $input['passwd_new']))
+				{
+					$result['errors']['passwd_new_err'] = lang('_SBG_USER_PASSWORD_CHANGE_REQUIRED_MSG');
+				}
+			}
+			
+            if ($input['passwd_new'] != $input['confirm_passwd_new']) {
+                $result['errors']['confirm_passwd_new_err'] = lang('_SBG_PASSWORD_CONFIRM_MSG');
+            }
+			$passwd = $input['passwd'];
+			$checkPass = $this->collaborator_model->checkPassCollaborator($collaborator_id, $passwd);
+			if ($checkPass == false){
+				 $result['errors']['passwd_old_err'] = lang('_SBG_OLD_PASSWORD_FAIL_MSG');
+			}
+	
+			if (!isset($result['errors'])) {
+				$collaborator = array('passwd'=>md5($input['passwd_new']));
+				$check = $this->collaborator_model->updateCollaborator($collaborator_id, $collaborator);
+				if ($check){
+					$result['success'] = 1;
+				}else{
+					$result['success'] = 0;
+				}
+			}
+			echo json_encode($result);
+			
+		}else{
+			$this->load->view('login');
+		}
+	}
+}
Index: /pro-violet-viettel/sourcecode/application/modules/collaborator/controllers/home.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/modules/collaborator/controllers/home.php	(revision 883)
+++ /pro-violet-viettel/sourcecode/application/modules/collaborator/controllers/home.php	(revision 883)
@@ -0,0 +1,204 @@
+<?php
+
+if (!defined('BASEPATH'))
+    exit('No direct script access allowed');
+
+class Home extends MX_Controller {
+
+	const TOKENPW = 'violet';
+
+    public function __construct() {
+        parent::__construct();
+        $this->load->helper('cookie');
+		$this->load->helper('language');
+		$this->lang->load('messages', 'message');
+    }
+
+    public function index() {
+		
+        $collaborator_info = $this->session->userdata('collaboratorInfo');
+        if ($collaborator_info) {
+			$id = $collaborator_info['id'];
+            $data['id'] = $id;
+            $data['statistics'] = $this->getStatistics($id);
+            $data['content'] = $this->getCollaboratorsUsers(array(), $id);
+            $this->load->view('collaborator/reportAsistant/indexCollaborator', $data);
+        } else {
+            $this->load->view('login');
+        }
+    }
+
+    public function login() {
+		
+        $login_name = $this->input->post('login_name');
+        $passwd = $this->input->post('passwd');
+		
+        $this->load->model('admin/Collabolator_model');
+        $data = $this->Collabolator_model->check_login($login_name, $passwd);
+        if ($data == null) {
+            $this->session->set_flashdata('login_error', TRUE);
+            redirect("/cong_tac_vien");
+        } else {
+            $collaboratorData = array('login_name' => $login_name, 'id' => $data->id, 'fullname' => $data->full_name, 'logined_in' => TRUE);
+            $this->session->set_userdata('collaboratorInfo', $collaboratorData);
+            redirect("/cong_tac_vien");
+        }
+    }
+
+    public function logout() {
+		$this->session->unset_userdata('collaboratorInfo');
+        redirect("/collaborator");
+    }
+    
+    public function is_timeout()
+    {
+        $result['login']=1;
+        $collaborator_infor = $this->session->userdata('collaboratorInfo');
+        if (!$collaborator_infor) {
+            $result['login']=0;
+        }
+        echo json_encode($result);
+    }
+
+    public function getStatistics($id = false) {
+        $data = array();
+
+        $this_year['start'] = strtotime(date("Y") . "-01-01 00:00:00");
+
+        $this->load->model('admin/collabolator_model');
+        $collaborators = $this->collabolator_model->getAllCollaboratorUser($this_year['start'], $id);
+        for ($i = 1; $i <= 12; $i++) {
+            $statistics[$i] = 0;
+        }
+        $y = date("Y");
+        foreach ($collaborators as $collaborator) {
+            for ($i = 1; $i <= 12; $i++) {
+                if ($i < 12) {
+                    if (($collaborator['time'] > strtotime($y . "-" . $i . "-1 00:00:00")) && (($collaborator['time'] < strtotime($y . "-" . ($i + 1) . "-1 00:00:00")))) {
+                        $statistics[$i] ++;
+                    }
+                } else {
+                    if (($collaborator['time'] > strtotime($y . "-" . $i . "-1 00:00:00")) && (($collaborator['time'] < strtotime(($y + 1) . "-1-1 00:00:00")))) {
+                        $statistics[$i] ++;
+                    }
+                }
+            }
+        }
+
+        $max = 0;
+        foreach ($statistics as $index => $total) {
+            if ($total > $max) {
+                $max = $total;
+            }
+            $chart[] = array($index, $total);
+        }
+
+        $data['max'] = $max;
+        $chard[] = array("color" => "#e67e22", "label" => "LÆ°á»£ng ngÆ°á»i dÃ¹ng giá»i thiá»u bá»i cá»ng tÃ¡c viÃªn theo tá»«ng thÃ¡ng", "data" => $chart);
+        $data['chard'] = $chard;
+         
+        return $this->load->view('collaborator/reportAsistant/statistics', $data, true);
+    }
+
+    public function getLastquarter() {
+        $current_month = date('m');
+        $current_year = date('Y');
+
+        if ($current_month >= 1 && $current_month <= 3) {
+            $start_date = strtotime('1-October-' . ($current_year - 1));  // timestamp or 1-October Last Year 12:00:00 AM
+            $end_date = strtotime('1-Janauary-' . $current_year);  // // timestamp or 1-January  12:00:00 AM means end of 31 December Last year
+        } else if ($current_month >= 4 && $current_month <= 6) {
+            $start_date = strtotime('1-January-' . $current_year);  // timestamp or 1-Janauray 12:00:00 AM
+            $end_date = strtotime('1-April-' . $current_year);  // timestamp or 1-April 12:00:00 AM means end of 31 March
+        } else if ($current_month >= 7 && $current_month <= 9) {
+            $start_date = strtotime('1-April-' . $current_year);  // timestamp or 1-April 12:00:00 AM
+            $end_date = strtotime('1-July-' . $current_year);  // timestamp or 1-July 12:00:00 AM means end of 30 June
+        } else if ($current_month >= 10 && $current_month <= 12) {
+            $start_date = strtotime('1-July-' . $current_year);  // timestamp or 1-July 12:00:00 AM
+            $end_date = strtotime('1-October-' . $current_year);  // timestamp or 1-October 12:00:00 AM means end of 30 September
+        }
+        return array("start" => $start_date, "end" => $end_date);
+    }
+
+
+    public function getCollaboratorsUsers($filters = array(), $id = false) {
+
+        $this->load->helper('pagging');
+        $this->load->model('admin/collabolator_model');
+        $data['current_page'] = $this->uri->segment(5, 1);
+
+        $data['itemsoptions'] = array(10, 25, 50, 100);
+        $data['perpage'] = 10;
+        if (!$id) {
+            $data['id'] = $this->uri->segment(4, 1);
+        } else {
+            $data['id'] = $id;
+        }
+	
+        $data['keyword'] = "";
+        $data['sorting_order'] = "sorting_desc";
+        $data['sorting_field'] = "id";
+
+        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['search_field'] = "";
+            $data['keyword'] = $this->input->post('keyword');
+
+            if (preg_match("/[0-9]/", $data['keyword'])) {
+                $data['search_field'] = "cellphone";
+            }
+        }
+
+		$data['daterange_start'] = "";
+		$data['daterange_end'] = "";
+		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->collabolator_model->countCountCollaboratorUsers($data);
+        $data['paidlogs'] = $this->collabolator_model->getCountCollaboratorUsers($data);
+
+        foreach ($data['paidlogs'] as $index => $paidlog)
+        {
+
+            $data['paidlogs'][$index]['username'] = $this->get_fullname($paidlog['us_id']);
+        }
+		
+        $data['paging_url'] = base_url() . "cong_tac_vien/thong_ke_nguoi_dung/trang/" ;
+        $data['num_links'] = 2;
+        $data['paging'] = pagging($data);
+		
+        if ($this->input->is_ajax_request()) {
+            return $this->load->view('collaborator/reportAsistant/listview_user', $data);
+        }
+        return $this->load->view('collaborator/reportAsistant/listview_user', $data, true);
+    }
+
+    private function get_fullname($us_id) {
+        $fullname="";
+        $src = 'SBG';
+        $token = md5($us_id . self::TOKENPW);
+        $this->load->model('admin/user_model');
+        $data = $this->user_model->get_user_info($src, $us_id, $token);
+        parse_str($data,$data);
+        if (isset($data['fullname']))
+        {
+            $fullname=$data['fullname'];
+        }
+        return $fullname;
+    }
+	
+}
Index: /pro-violet-viettel/sourcecode/application/modules/collaborator/controllers/user.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/modules/collaborator/controllers/user.php	(revision 883)
+++ /pro-violet-viettel/sourcecode/application/modules/collaborator/controllers/user.php	(revision 883)
@@ -0,0 +1,130 @@
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+
+if ( ! defined('_SBG_REGISTER_FOR')) 					define('_SBG_REGISTER_FOR', 				'DK');
+if ( ! defined('_SBG_REGISTER_VIP_FOR')) 				define('_SBG_REGISTER_VIP_FOR', 				'VIP');
+if ( ! defined('_SBG_CHARGING_FOR')) 					define('_SBG_CHARGING_FOR', 				'NAP');
+
+class User extends MX_Controller {
+	
+	function __construct()
+	{
+		parent::__construct();
+		$this->load->helper('cookie');
+		$this->load->helper('language');
+		$this->lang->load('messages', 'message');
+		$this->load->helper(array('form', 'url'));
+	}
+	
+	public function index(){
+		$collaborator_info = $this->session->userdata('collaboratorInfo');
+		if ($collaborator_info) {
+			$data = array();
+			$this->load->view('collaborator/user/index', $data);
+		}else{
+			show_404();
+		}
+	}
+	
+	public function upload()
+	{
+		$collaborator_info = $this->session->userdata('collaboratorInfo');
+        if ($collaborator_info) {
+			$collaborator = $collaborator_info['login_name'];
+			$config['upload_path'] = './upload/uploads/';
+			$config['allowed_types'] = 'xls|xlsx';
+			/*$config['max_size']	= '100';
+			$config['max_width']  = '1024';
+			$config['max_height']  = '768';*/
+			
+			$this->load->library('upload', $config);
+			
+			if ( $this->upload->do_upload() == false)
+			{
+				$error = array('error' => $this->upload->display_errors('', ''));
+				$data['success'] = 0;
+				$data['process'] = $error;
+			}
+			else
+			{
+				$data = array('upload_data' => $this->upload->data());
+				$file = $data['upload_data']['full_path'];
+				//$result = $this->processData($file);
+				$process = $this->processData($file, $collaborator);
+				if ($process){
+					$data['process'] = $process;
+					
+				}else{
+					$data['process'] = null;
+				}
+				$data['success'] = 1;
+			}
+			$result = $this->load->view('collaborator/user/result', $data, true);
+			echo json_encode($result);
+		}else{
+			show_404();
+		}
+	}
+	
+	protected function readExcelFile($file){
+		$this->load->library("PHPExcel");
+		$objPHPExcel = PHPExcel_IOFactory::load($file);
+		$cell_collection = $objPHPExcel->getActiveSheet()->getCellCollection();
+		
+		foreach ($cell_collection as $cell):
+			$column = $objPHPExcel->getActiveSheet()->getCell($cell)->getColumn();
+			$row = $objPHPExcel->getActiveSheet()->getCell($cell)->getRow();
+			$data_value = $objPHPExcel->getActiveSheet()->getCell($cell)->getValue();
+			
+			if ($row == 1){
+				$header[$row][$column] = $data_value;
+			} else {
+				$arr_data[$row][$column] = $data_value;
+			}
+		endforeach;
+		$data['header'] = $header;
+		$data['values'] = $arr_data;
+		return $data['values'];
+	}
+	
+	protected function processData($file, $collaborator){
+		$sentNumber = $collaborator;
+		$this->load->model('services/services_model');
+		$this->load->model('frontend/user_model');
+		$this->load->model('collaborator_model');
+		$data = $this->readExcelFile($file);
+		$result = array();
+		$user = array();
+		if ($data){
+			foreach ($data as $index => $value):
+				$user['fullname'] = $value['B'];
+				$user['province'] = $value['C'];
+				$user['district'] = $value['D'];
+				$arrPD = $this->collaborator_model->getProvinceAndDistict($user['province'], $user['district']);
+				$user['province'] = $arrPD['province'];
+				$user['district'] = $arrPD['district'];
+				$user['school'] = $value['E'];
+				$user['username'] = $this->services_model->formatPhoneNumber($value['F'], 2);
+				$user['service'] = $value['G'];
+				$user['amount'] = $value['H'];
+				$user['collboratorId'] = $value['I'];
+				
+				if ($user['username']){
+	
+					if (!preg_match('/^([0-9]{10,11}$)$/', $user['username'])) {
+						$result[$index]['success'] = 0;
+						$result[$index]['error'] = lang('_SBG_MO_PHONENUM_WRONG_FORMAT_MSG');
+						$result[$index]['user'] = $user;
+					}else{
+						$result[$index] = $this->collaborator_model->processUser($user, $sentNumber);
+						
+						
+					}
+					$result[$index]['date'] = date('d-m-Y H:i:s');
+				}
+				
+			endforeach;
+		}
+		
+		return $result;
+	}
+}
Index: /pro-violet-viettel/sourcecode/application/modules/collaborator/models/collaborator_model.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/modules/collaborator/models/collaborator_model.php	(revision 883)
+++ /pro-violet-viettel/sourcecode/application/modules/collaborator/models/collaborator_model.php	(revision 883)
@@ -0,0 +1,334 @@
+<?php
+
+if (! defined ( 'BASEPATH' ))
+	exit ( 'No direct script access allowed' );
+
+if ( ! defined('_SBG_REGISTER_FOR')) 					define('_SBG_REGISTER_FOR', 				'DK');
+if ( ! defined('_SBG_REGISTER_VIP_FOR')) 				define('_SBG_REGISTER_VIP_FOR', 				'VIP');
+if ( ! defined('_SBG_CHARGING_FOR')) 					define('_SBG_CHARGING_FOR', 				'NAP');
+if ( ! defined('_SBG_SYNTAX_ERR')) 					define('_SBG_SYNTAX_ERR', 			'SYNTAX_ERR');
+
+if ( ! defined('_SBG_CHARGING_SUCCESS')) 				define('_SBG_CHARGING_SUCCESS', 1);
+if ( ! defined('_SBG_CHARGING_FAIL')) 					define('_SBG_CHARGING_FAIL', -1);
+if ( ! defined('_SBG_CHARGING_FAIL_NOT_ENOUGH')) 		define('_SBG_CHARGING_FAIL_NOT_ENOUGH', 401);
+if ( ! defined('_SBG_CHARGING_FAIL_NOT_VIETTEL')) 		define('_SBG_CHARGING_FAIL_NOT_VIETTEL', 402);
+if ( ! defined('_SBG_CHARGING_NUMBER_NOT_EXISTED')) 	define('_SBG_CHARGING_NUMBER_NOT_EXISTED', 403);
+if ( ! defined('_SBG_CHARGING_NUMBER_NOT_AVAILABLE')) 	define('_SBG_CHARGING_NUMBER_NOT_AVAILABLE', 404);
+if ( ! defined('_SBG_CHARGING_NUMBER_CHANGED_OWNER')) 	define('_SBG_CHARGING_NUMBER_CHANGED_OWNER', 405);
+if ( ! defined('_SBG_CHARGING_FAIL_MORETHAN_LIMIT')) 	define('_SBG_CHARGING_FAIL_MORETHAN_LIMIT', 406);
+if ( ! defined('_SBG_CHARGING_GENERAL_ERROR')) 			define('_SBG_CHARGING_GENERAL_ERROR', 440);
+if ( ! defined('_SBG_CHARGING_NUMBER_NOT_REGISTED')) 	define('_SBG_CHARGING_NUMBER_NOT_REGISTED', 501);
+if ( ! defined('_SBG_CHARGING_MAX_VALUE')) 				define('_SBG_CHARGING_MAX_VALUE', 50000);
+
+if ( ! defined('_SBG_PAIDTYPE_SMS')) define('_SBG_PAIDTYPE_SMS', 1);
+if ( ! defined('_SBG_PAIDTYPE_CARD')) define('_SBG_PAIDTYPE_CARD', 2);
+
+class Collaborator_model extends CI_Model {
+	
+	const TOKENPW = 'violet';
+	const SRC = 'SBG';
+	private $arrServicesPattern = array(
+									_SBG_REGISTER_FOR => array('pattern' => '/^(DK)$/'),
+									_SBG_REGISTER_VIP_FOR => array('pattern' => '/^(VIP)([[:blank:]])([a-zA-Z0-9]{1,})$/'),
+									_SBG_CHARGING_FOR => array('pattern' => '/^(NAP)$/')
+								);
+	
+	public function __construct() {
+		parent::__construct ();
+		$this->vservices->setApiUrl ( $this->config->item ( 'api_url' ) );
+		$this->vservices->setConnection ( $this->curl );
+		$this->load->helper('language');
+		$this->lang->load('messages', 'message');
+	}
+	
+	public function isExistUser($username){
+		return false;
+	}
+	
+	public function serviceAnalys($service){
+		
+		$aryMatched = array();	
+		$aryContent = array();
+		$result = FALSE;
+		foreach ($this->arrServicesPattern as $case => $pattern)
+		{
+			$result = preg_match($pattern['pattern'], strtoupper(trim($service)));
+			if ((bool)$result) {
+				$aryMatched = explode(' ', trim($service));
+				break;
+			}
+		}
+		
+		$case = (bool)$result ? $case:_SBG_SYNTAX_ERR;
+		
+		foreach($aryMatched as $k => $val) {
+			if ($k > 0) $aryContent[] = $val;
+		}
+		
+		return array('case' => $case, 'content' => $aryContent);
+	}
+	
+	public function processUser($user, $sentNumber){
+		$data = array();	
+		$serviceAnalys = $this->serviceAnalys($user['service']);
+		
+		$case = $serviceAnalys['case'];
+		$aryContents = isset($serviceAnalys['content']) ? $serviceAnalys['content']: null;
+		
+		switch($case){
+			case _SBG_REGISTER_FOR:
+				$data = $this->registerUser($user);
+				break;
+			case _SBG_REGISTER_VIP_FOR:
+				$p_code = $aryContents[0];
+				$data = $this->registerVipUser($user, $p_code);
+				break;
+			case _SBG_CHARGING_FOR:
+				$data = $this->chargingForUser($user, $sentNumber);
+				break;
+			case _SBG_SYNTAX_ERR:
+			default:
+				$data['success'] = 0;
+				$data['user'] = $user;
+				$data['error'] = lang('_SBG_MO_SYNTAX_ERR_MSG');
+				break;
+		}
+		
+		return $data;
+		
+	}
+
+	public function registerUser($user){
+
+		$data = array();
+		$data['user'] = $user;
+		$this->load->model('frontend/user_model');
+		$this->load->model('services/services_model');
+		$src = self::SRC;
+		$token = md5($user['username'] . self::TOKENPW);
+		$sms = '';
+		$collborator = $user['collboratorId'];
+		$username = $user['username'];
+		$password = $this->createRandomPassword();
+		$fullname = $user['fullname'];
+		$school = $user['school'];
+		$province = $user['province'];
+		$district = $user['district'];
+		
+		$strResult = $this->vservices->actionExecute ( 'update', array (
+				'token' => $token,
+				'src' => $src,
+				'username' => $username,
+				'fullname' => $fullname,
+				'phone' => $username,
+				'password' => $password,
+				'school' => $school,
+				'province' => $province
+			), 'user' );
+		
+		$arrUser = array();
+		$arrResult = array();
+		parse_str($strResult, $arrResult);
+		$status = (int)$arrResult['status'];
+
+		switch ($status){
+			case 0 :
+				$this->load->model('frontend/servicepackage_model');
+				$trialpackage=$this->servicepackage_model->getTrialPackage();
+				$us_id = $arrResult['id'];
+				$arrUser['us_id'] = $us_id;
+				$arrUser['cellphone'] = $username;
+				$arrUser['collborator'] = $collborator;
+				$arrUser['acc_balanced'] = 0;
+				$arrUser['p_id'] = $trialpackage['p_id'];
+				$arrUser['expire_date'] = date('Y-m-d', strtotime("+" . $this->config->item("trial_period") . " days", time()));
+				$arrUser['province'] = $province;
+				$arrUser['district'] = $district;
+				$arrUser['created_time'] = date ( 'Y-m-d H:i:s' );
+				$arrUser ['updated_time'] = date ( 'Y-m-d H:i:s' );
+				$this->db->insert ( 'tbluser', $arrUser );
+				$aryPatterns = array ('/:trialdays:/', '/:username:/', '/:password:/');
+				$trialdays = $this->config->item('trial_period');
+				$trialdays = strlen($trialdays) < 2 ? '0'. $trialdays : $trialdays;
+				if ($this->user_model->isViettel($username)){
+					$sms = preg_replace($aryPatterns, array($trialdays. ' ngay', $username, $password), lang('_SBG_MO_USER_VIETTEL_REGISTER_SUCCESS_MSG'));
+				}else{
+					$aryPatterns = array ('/:username:/', '/:password:/');
+					$sms = preg_replace($aryPatterns, array($username, $password), lang('_SBG_MO_USER_NOT_VIETTEL_REGISTER_SUCCESS_MSG'));
+				}
+				$sendMT = $this->services_model->sendMT($username, $sms);
+				$data['success'] = 1;
+				break;
+			case 2:
+			case 4:
+				$sms = lang('_SBG_MO_USER_REGISTER_DUPLICATE_MSG');
+				$sendMT = $this->services_model->sendMT($username, $sms);
+				$aryPatterns = array('/:username:/');
+				$error = preg_replace($aryPatterns, array($username), lang('_SBG_MO_COLLABOLATOR_REGISTER_DUPLICATE_MSG'));
+				$data['success'] = 0;
+				$data['error'] = $error;
+				break;
+			default:
+				$data['success'] = 0;
+				$data['error'] = $arrUser['errMsg'];
+				break;
+		}
+	
+		return $data;
+	}
+	
+	public function registerVipUser($arrUser, $p_code){
+		$data = array();
+		$data['user'] = $arrUser;
+		$this->load->model('frontend/user_model');
+		$username = $arrUser['username'];
+		$result = $this->user_model->get_user_by_cellphone ( $username );
+		$package = $this->user_model->get_package ( ( int ) $p_code );
+		if (!$package)
+		{
+			$data['success'] = 0;
+			$data['error'] = lang('_SBG_MO_USER_REGISTER_VIP_NOT_FOUND_MSG');
+			$data['user'] = $arrUser;
+			return $data;
+		}
+		if ($result) {
+			if ($result ['acc_balanced'] >= $package ['p_price']) {
+				$us_id = $result ['us_id'];
+				$user ['acc_balanced'] = $result ['acc_balanced'] - $package ['p_price'];
+				if ($this->user_model->checkLicense ( $us_id )) {
+					$user ['expire_date'] = date ( 'Y-m-d', strtotime ( $result ['expire_date'] . ' + ' . $package ['p_period'] . ' month' ) );
+				} else {
+					$user ['expire_date'] = date ( 'Y-m-d', strtotime ( 'now + ' . $package ['p_period'] . ' month' ) );
+				}
+				
+				$user ['p_id'] = $package ['p_id'];
+				$user ['updated_time'] = date ( 'Y-m-d H:i:s' );
+				
+				$this->user_model->updateUser ( $us_id, $user );
+				$aryPatterns = array('/:period:/');
+				$sms = preg_replace($aryPatterns, array(date ( 'd/m/Y', strtotime ( $user ['expire_date'] ) )), lang('_SBG_MO_USER_REGISTER_VIP_SUCCESS_MSG'));
+				$sendMT = $this->services_model->sendMT($username, $sms);
+		
+				
+				$data['success'] = 1;
+				$this->user_model->insertRegisterVipLog($username, $package['p_id'], $true);
+			} else {
+				$sms = lang('_SBG_MO_USER_REGISTER_VIP_FAIL_NOT_ENOUGH_MSG');
+				$sendMT = $this->services_model->sendMT($username, $sms);
+				
+				$data['success'] = 0;
+				$data['error'] = $sms;
+			}
+		} else {
+			$aryPatterns = array('/:username:/');
+			$sms = preg_replace($aryPatterns, array($username), lang('_SBG_MO_ACCOUNT_NOT_FOUND_MSG'));
+			$sendMT = $this->services_model->sendMT($username, $sms);
+			
+			$data['success'] = 0;
+			$data['error'] = $sms;
+		}
+	
+		return $data;
+	}
+	
+	public function chargingForUser($user, $sentNumber){
+
+		$this->load->model('services/services_model');
+		$this->load->model('frontend/user_model');
+		$data = array();
+		$data['user'] = $user;
+		$username = $user['username'];
+		$amount = $user['amount'];
+	
+		$result =$this->services_model->chargeRootAccountProcess($sentNumber, $amount, $sentNumber.' paid for SBG');
+
+		if ($result == _SBG_CHARGING_SUCCESS) {
+			$smsReturn = $this->user_model->rechargeAccount($username, $amount);
+			
+			$arySmsReturn = explode ('|', $smsReturn);
+			$aryPatterns = array('/:amount:/', '/:sentNumber:/');
+			$smsMT = preg_replace($aryPatterns, array($amount, $sentNumber), lang('_SBG_MO_PAY_TO_ACCOUNT_FOR_MSG'));
+			
+			$sendMT = $this->services_model->sendMT($this->services_model->formatPhoneNumber($username, -1), $smsMT);
+			$data['success'] = 1;
+			
+			//write to paid log
+			$paidTime = date('Y-m-d H:i:s');
+			$this->user_model->insertPaidlog($sentNumber, $username, _SBG_PAIDTYPE_SMS, $amount, $paidTime);
+		}
+		else if ($result == _SBG_CHARGING_FAIL_NOT_ENOUGH) {
+			$aryPatterns = array ('/:sentNumber:/');
+			$smsReturn = preg_replace($aryPatterns, array($sentNumber), lang('_SBG_MO_CHARGING_FAIL_NOT_ENOUGH_MSG'));	
+
+			$data['success'] = 0;
+			$data['error'] = $smsReturn;
+		}
+		else if ($result == _SBG_CHARGING_FAIL_MORETHAN_LIMIT) {
+			$aryPatterns = array ('/:sendid:/');
+			$smsReturn = preg_replace($aryPatterns, array($sentNumber), lang('_SBG_MO_CHARGING_FAIL_MORETHAN_LIMIT_MSG'));
+			//$smsReturn = _SBG_MO_PROCCESS_ERR.'|'.$smsReturn;
+			$data['success'] = 0;
+			$data['error'] = $smsReturn;
+		}else if ($result == _SBG_CHARGING_FAIL_NOT_VIETTEL || $result == _SBG_CHARGING_NUMBER_NOT_EXISTED || $result == _SBG_CHARGING_NUMBER_NOT_AVAILABLE) {
+			$smsReturn = lang('_SBG_MO_CHARGING_FAIL_NOT_VIETTEL_MSG');
+			$data['success'] = 0;
+			$data['error'] = $smsReturn;
+		}				
+		else {
+			$smsReturn = lang('_SBG_MO_CHARGING_FAIL_MSG');
+			$data['success'] = 0;
+			$data['error'] = $smsReturn;
+		}
+	
+		return $data;
+	}
+	
+	
+	public function createRandomPassword(){
+		$alphabet = "0123456789";
+		$pass = array ();
+		$alphaLength = strlen ( $alphabet ) - 1;
+		for($i = 0; $i < 6; $i ++) {
+			$n = rand ( 0, $alphaLength );
+			$pass [] = $alphabet [$n];
+		}
+		return implode ( $pass );
+	}
+	
+	public function getProvinceAndDistict($province, $district){
+		$result['province'] = $province;
+		$result['district'] = $district;
+		$provinces = lang('_PROVINCES_');
+
+		foreach ($provinces as $key => $pro):
+			if($province == $pro){
+				$result['province'] = $key;
+				break;
+			}
+		endforeach;
+		$sql = "SELECT * FROM tbldistrict where province_id = ? AND district_name = ?";
+		
+		$query = $this->db->query ( $sql, array ($result['province'], $result['district']) );
+		if ($query->num_rows () > 0) {
+			$row = $query->row_array ();
+			$result['district'] = $row['district_id'];
+		}
+		return $result;
+	}
+	
+	public function updateCollaborator($id, $collaborator){
+		$this->db->where ( 'id', $id );
+		return $this->db->update ( 'tblcollaborator', $collaborator );
+	}
+	
+	public function checkPassCollaborator($id, $passwd){
+		$passwd = md5($passwd);;
+		$sql = "SELECT * FROM tblcollaborator WHERE id = ? AND passwd = ?";
+		$this->db->query($sql, array('id'=>$id, 'passwd'=>$passwd));
+		if ($this->db->affected_rows() >0){
+			return true;
+		}else{
+			return false;
+		}
+	}
+}
Index: /pro-violet-viettel/sourcecode/application/modules/collaborator/views/collaborator_profile.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/modules/collaborator/views/collaborator_profile.php	(revision 883)
+++ /pro-violet-viettel/sourcecode/application/modules/collaborator/views/collaborator_profile.php	(revision 883)
@@ -0,0 +1,124 @@
+<?php
+$base_url = base_url();
+$this->load->view('layout/collaborator/header', array('base_url' => $base_url));
+$this->load->view('layout/collaborator/sidebar', array('base_url' => $base_url));
+?>
+<div class="main-content">
+
+    <div class="page-content">
+        <div class="page-header">
+            <h1>
+               ThÃŽng tin cÃ¡ nhÃ¢n
+            </h1>
+        </div><!-- /.page-header -->
+
+        <div class="row">
+            <div class="col-xs-12">
+                <!-- PAGE CONTENT BEGINS -->
+                <div class="collaborator-profile row" id="collaborator-profile-3">
+                    <div class="col-sm-offset-1 col-sm-10">
+
+                        <div class="tabbable">
+                            <ul class="nav nav-tabs padding-16">
+
+                                <li class="active">
+                                    <a id="edit-password-tab" href="" data-toggle="tab">
+                                        <i class="blue icon-key bigger-125"></i>
+                                       Thay Äá»i máº­t kháº©u
+                                    </a>
+                                </li>
+
+                            </ul>
+
+                            <div class="tab-content profile-edit-tab-content">
+                                <div class="tab-pane active" id="edit-password">
+									<!--<form id="frm-change-password" class="form-horizontal" role="form" action="<?php echo $base_url; ?>collaborator/collaborator/change_password" method="POST">-->
+									<form id="frm-change-password" class="form-horizontal" role="form">
+										<h4 class="header blue bolder smaller">Thay Äá»i máº­t kháº©u</h4>
+										<div class="form-group">
+											<label for="form-field-passwd" class="col-sm-3 control-label no-padding-right">Máº­t kháº©u cÅ©</label>
+											<div class="col-sm-9">
+												<label class="block clearfix has-error">
+													<span class="input-icon">
+														<input type="password" name="passwd" id="form-field-pass1">
+														<i class="icon-lock blue"></i>
+													</span>
+
+													<small><div class="help-block" id="passwd_old_err"> </div></small>
+												</label>
+												
+											</div>
+										</div>
+										
+										<div class="form-group">
+											<label for="form-field-pass1" class="col-sm-3 control-label no-padding-right">Máº­t kháº©u má»i</label>
+
+											<div class="col-sm-9">
+												<label class="block clearfix has-error">
+													<span class="input-icon">
+														<input type="password" name="passwd_new" id="form-field-pass1">
+														<i class="icon-lock blue"></i>
+													</span>
+													<small><div class="help-block" id="passwd_new_err"> </div></small>
+												</label>
+											</div>
+										</div>
+
+										<div class="space-4"></div>
+
+										<div class="form-group">
+											<label for="form-field-pass2" class="col-sm-3 control-label no-padding-right">GÃµ láº¡i máº­t kháº©u má»i</label>
+											<div class="col-sm-9">
+												<label class="block clearfix has-error">
+													<span class="input-icon">
+														<input type="password" name="confirm_passwd_new" id="form-field-pass2">
+													</span>
+													<small><div class="help-block" id="confirm_passwd_new_err"> </div></small>
+												</label>
+											</div>
+										</div>
+										<div class="clearfix form-actions">
+											<div class="col-md-offset-3 col-md-9">
+												<button type="button" onclick="return changePassword(<?php echo $collaborator_id; ?>);"  class="btn btn-info">
+												<!--<button type="submit"  class="btn btn-info">-->
+													<i class="icon-ok bigger-110"></i>
+													Thay Äá»i
+												</button>
+											</div>
+										</div>
+										
+										</form>
+                                </div>
+
+                            </div>
+                        </div>
+                    </div><!-- /span -->
+                </div>
+
+                <!-- PAGE CONTENT ENDS -->
+            </div><!-- /.col -->
+        </div><!-- /.row -->
+    </div><!-- /.page-content -->
+</div><!-- /.main-content -->
+</div><!-- /.main-container-inner -->
+</div><!-- /.main-container -->
+
+<div class="modal fade" id="changePassSuccess" tabindex="-1" role="dialog"aria-hidden="true">
+	<div class="modal-dialog">
+		<div class="modal-content">
+			<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">Äá»i máº­t kháº©u</h4>
+			</div>
+			<div class="modal-body">
+				<div class="alert alert-block alert-success"><center><?php echo lang('_SBG_USER_PASSWORD_CHANGE_SUCCESS_MSG'); ?></center></div>
+				<center><button class="btn btn-primary" data-dismiss="modal">ÄÃ³ng</button></center>
+			</div>
+		
+		</div>
+	</div>
+</div>
+
+<?php
+$this->load->view('layout/collaborator/footer', array('base_url' => $base_url, 'collaboratorjs' => array('assets/js/collaborator/collaborator.js') ));
+?>
Index: /pro-violet-viettel/sourcecode/application/modules/collaborator/views/index.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/modules/collaborator/views/index.php	(revision 883)
+++ /pro-violet-viettel/sourcecode/application/modules/collaborator/views/index.php	(revision 883)
@@ -0,0 +1,201 @@
+<?php
+$base_url = base_url();
+$this->load->view('layout/admin/header', array('base_url' => $base_url));
+$this->load->view('layout/admin/sidebar', array('base_url' => $base_url, 'method'=>$this->router->method, 'class'=>$this->router->class  ));
+?>
+<script type="text/javascript">
+    function init_page()
+    {
+
+        $(".ajax_paging").click(function () {
+            $.ajax({
+                url: $(this).attr("href"),
+                type: "POST",
+                data: $("#collaborator").serialize(),
+                success: function (data, textStatus, jqXHR)
+                {
+                    // $result = jQuery.parseJSON(data);
+                    $("#content").html(data);
+                    init_page();
+
+                },
+                error: function (jqXHR, textStatus, errorThrown)
+                {
+                    $(".ajaxloading").hide();
+                }
+            });
+            return false;
+        })
+        $('#keyword').keyup(function (event) {
+            if (event.keyCode == '13') {
+                filter();
+            }
+            return false;
+        });
+        
+        
+        $( '.sorting, .sorting_desc, .sorting_asc' ).click(function( index ) {
+            var current_class=$( this ).attr('class');
+            $(".sorting_desc").attr("class","sorting");
+            $(".sorting_asc").attr("class","sorting");
+     
+            if(current_class=='sorting')
+            {
+                $(this).attr("class","sorting_desc");
+            }
+            else
+            {
+                if(current_class=='sorting_desc')
+                {
+                    $(this).attr("class","sorting_asc");
+                }
+                else
+                    {
+                    if(current_class=='sorting_asc')
+                    {
+                        $(this).attr("class","sorting");
+                    }
+                }
+            }
+            $("#sorting_field").val($(this).attr("id"));
+            $("#sorting_order").val($(this).attr("class"));
+            filter();
+        });
+        $('[data-toggle="ajaxModal"]').on('click',
+              function(e) {
+                $('#ajaxModal').remove();
+                e.preventDefault();
+                var $this = $(this)
+                  , $remote = $this.data('remote') || $this.attr('href')
+                  , $modal = $('<div class="modal" id="ajaxModal"><div class="modal-body"></div></div>');
+                $('body').append($modal);
+                $modal.modal({backdrop: 'static', keyboard: false});
+                $modal.load($remote);
+              }
+            );
+
+
+ 
+				$('#sales-charts').css({'width':'100%' , 'height':'200px'});
+				$.plot("#sales-charts", <?php echo json_encode($chard) ?>, {
+					hoverable: true,
+					shadowSize: 0,
+					series: {
+						lines: { show: true },
+						points: { show: true }
+					},
+					xaxis: {
+						tickLength: 0
+					},
+					yaxis: {
+						ticks: 10,
+						min: 0,
+						max:<?php echo $max;?>,
+						tickDecimals: 0
+					},
+					grid: {
+						backgroundColor: { colors: [ "#fff", "#fff" ] },
+						borderWidth: 1,
+						borderColor:'#555'
+					}
+				});
+    }
+
+
+    function filter()
+    {
+        $.ajax({
+            url: '<?php echo base_url();?>admin/doanh_thu_tong_hop/trang/1',
+            type: "POST",
+            data: $("#collaborator").serialize(),
+            success: function (data, textStatus, jqXHR)
+            {
+                // $result = jQuery.parseJSON(data);
+                $("#content").html(data);
+                init_page();
+                $("#keyword").focus();
+                $("#keyword").setCursorToTextEnd();
+
+            },
+            error: function (jqXHR, textStatus, errorThrown)
+            {
+                $(".ajaxloading").hide();
+            }
+        });
+    }
+
+
+</script>
+<style type="text/css" media="screen">
+			.widget-header-flat {
+				background: #307ecc;
+				color: #fff
+			}
+			.widget-toolbar>[data-action="collapse"], .header-color-dark>.widget-toolbar>[data-action="collapse"] {
+				color: #fff
+			}
+			.widget-header, .widget-content {
+				width: auto
+			}
+			.widget-body .table thead:first-child tr {
+				background: #EDECEC;
+			    color: #707070;
+			    font-weight: normal;
+			}
+		</style>
+             
+<div class="main-content" >
+    <div id="breadcrumbs" class="breadcrumbs">
+
+    <ul class="breadcrumb">
+        <li>
+            <i class="icon-home home-icon"></i>
+            <a href="<?php echo $base_url;?>/admin/home">Trang chá»§</a>
+        </li>
+
+        <li>
+            <a href="<?php echo $base_url;?>/admin/home"">Báº£ng Äiá»u khiá»n</a>
+        </li>
+        
+    </ul><!-- .breadcrumb -->
+
+    <div id="nav-search" class="nav-search">
+        <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 ...">
+                <i class="icon-search nav-search-icon"></i>
+            </span>
+        </form>
+    </div><!-- #nav-search -->
+</div>
+    
+    
+    
+    
+<div class="page-content">
+    
+    <div class="page-header">
+       
+    </div><!-- /.page-header -->
+    
+     <div class="row">  
+    <?php echo $statistics; ?>   
+     </div>
+     <div class="row" id="content">    
+    <?php echo $content; ?>
+     </div>
+    </div>
+</div><!-- /.main-content -->
+</div><!-- /.main-container-inner -->
+
+<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
+    <i class="icon-double-angle-up icon-only bigger-110"></i>
+</a>
+</div><!-- /.main-container -->
+
+
+
+</div><!-- /.modal-dialog -->
+<?php
+$this->load->view('layout/admin/footer', array('base_url' => $base_url));
+?>
Index: /pro-violet-viettel/sourcecode/application/modules/collaborator/views/login.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/modules/collaborator/views/login.php	(revision 883)
+++ /pro-violet-viettel/sourcecode/application/modules/collaborator/views/login.php	(revision 883)
@@ -0,0 +1,176 @@
+<?php $base_url = base_url(); ?>
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8" />
+		<title>ÄÄng nháº­p |SBG</title>
+
+		<meta name="description" content="User login page" />
+		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
+
+		<!-- basic styles -->
+
+		<link href="<?php echo $base_url;?>assets/css/bootstrap.min.css" rel="stylesheet" />
+		<link rel="stylesheet" href="<?php echo $base_url;?>assets/css/font-awesome.min.css" />
+
+		<link rel="stylesheet" href="<?php echo $base_url;?>assets/css/ace-fonts.css" />
+
+		<!-- ace styles -->
+
+		<link rel="stylesheet" href="<?php echo $base_url;?>assets/css/ace.min.css" />
+		<link rel="stylesheet" href="<?php echo $base_url;?>assets/css/ace-rtl.min.css" />
+
+		<!--[if lte IE 8]>
+		  <link rel="stylesheet" href="<?php echo $base_url;?>assets/css/ace-ie.min.css" />
+		<![endif]-->
+
+		<!-- inline styles related to this page -->
+
+		<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+
+		<!--[if lt IE 9]>
+		<script src="<?php echo $base_url;?>assets/js/html5shiv.js"></script>
+		<script src="<?php echo $base_url;?>assets/js/respond.min.js"></script>
+		<![endif]-->
+	</head>
+
+	<body class="login-layout">
+		<div class="main-container">
+			<div class="main-content">
+				<div class="row">
+					<div class="col-sm-10 col-sm-offset-1">
+						<div class="login-container">
+
+							<div class="space-6"></div>
+
+							<div class="position-relative">
+								<div id="login-box" class="login-box visible widget-box no-border">
+									<div class="widget-body">
+										<div class="widget-main">
+											<h4 class="header blue lighter bigger">
+												<i class="icon-cloud-upload green"></i>
+												SBGOnline CTV | <small>ÄÄng nháº­p</small>
+											</h4>
+
+											<form action="<?php echo $base_url;?>collaborator/home/login" id="frmLogin" method="POST">
+												<fieldset>
+													<label class="block clearfix has-error">
+														<div class="help-block">
+														<?php 
+															if($this->session->flashdata('login_error')){
+																//echo 'Sai username hoáº·c password!';
+																echo lang('_SBG_ADMIN_LOGIN_FAIL_MSG');
+															}
+														?>
+														</div>
+													</label>
+													<label class="block clearfix">
+														<span class="block input-icon input-icon-right">
+															<input type="text" name="login_name" class="form-control" placeholder="Sá» Äiá»n thoáº¡i" />
+															<i class="icon-user"></i>
+														</span>
+														<div class="help-block"> </div>
+													</label>
+
+													<label class="block clearfix">
+														<span class="block input-icon input-icon-right">
+															<input type="password" name="passwd" class="form-control" placeholder="Máº­t kháº©u" />
+															<i class="icon-lock"></i>
+														</span>
+														<div class="help-block"> </div>
+													</label>
+
+													<div class="space"></div>
+
+													<div class="clearfix">
+														<label class="inline">
+															<input type="checkbox" class="ace" />
+															<span class="lbl"> Ghi nhá»</span>
+														</label>
+															<!--a href="index.htm" title=""-->
+															<button type="submit" name="submit" id="login-button" class="pull-right btn btn-sm btn-primary">
+																<i class="icon-key"></i>
+																ÄÄng nháº­p
+															</button>
+														<!--/a-->
+													</div>
+
+													<div class="space-4"></div>
+												</fieldset>
+											</form>
+										</div><!-- /widget-main -->
+									</div><!-- /widget-body -->
+								</div><!-- /login-box -->
+
+							</div><!-- /position-relative -->
+						</div>
+					</div><!-- /.col -->
+				</div><!-- /.row -->
+			</div>
+		</div><!-- /.main-container -->
+
+		<!-- basic scripts -->
+
+		<!--[if !IE]> -->
+
+		<script type="text/javascript">
+			window.jQuery || document.write("<script src='<?php echo $base_url;?>assets/js/jquery-2.0.3.min.js'>"+"<"+"/script>");
+		</script>
+		<script src="<?php echo $base_url;?>assets/js/bootstrap.min.js"></script>
+		<script src="<?php echo $base_url;?>assets/js/jquery.validate.min.js"></script>
+		
+		<script src="<?php echo $base_url;?>assets/js/ace-elements.min.js"></script>
+		<script src="<?php echo $base_url;?>assets/js/ace.min.js"></script>
+		<!-- <![endif]-->
+
+		<!--[if IE]>
+<script type="text/javascript">
+ window.jQuery || document.write("<script src='/assets/js/jquery-1.10.2.min.js'>"+"<"+"/script>");
+</script>
+<![endif]-->
+
+		<script type="text/javascript">
+			if("ontouchend" in document) document.write("<script src='<?php echo $base_url;?>assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
+		</script>
+
+		<!-- inline scripts related to this page -->
+
+		<script type="text/javascript">
+			function show_box(id) {
+			 jQuery('.widget-box.visible').removeClass('visible');
+			 jQuery('#'+id).addClass('visible');
+			}
+			$('#frmLogin').validate({
+				errorElement: 'label',
+				errorClass: 'help-block',
+				focusInvalid: true,
+				rules: {
+					passwd: {
+						required: true,
+					},
+					login_name: {
+						required: true
+					}
+				},
+		
+				messages: {
+					login_name: {
+						required: "ChÆ°a nháº­p tÃ i khoáº£n admin",
+					},
+					passwd: {
+						required: "Vui lÃ²ng nháº­p máº­t kháº©u.",
+					}
+				},
+
+				highlight: function (e) {
+					$(e).closest('label').removeClass('has-info').addClass('has-error');
+				},
+		
+				success: function (e) {
+					$(e).closest('label').removeClass('has-error').addClass('has-info');
+					$(e).remove();
+				},
+			});
+		</script>
+	</body>
+</html>
Index: /pro-violet-viettel/sourcecode/application/modules/collaborator/views/reportAsistant/indexCollaborator.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/modules/collaborator/views/reportAsistant/indexCollaborator.php	(revision 883)
+++ /pro-violet-viettel/sourcecode/application/modules/collaborator/views/reportAsistant/indexCollaborator.php	(revision 883)
@@ -0,0 +1,222 @@
+<?php
+$base_url = base_url();
+$this->load->view('layout/collaborator/header', array('base_url' => $base_url));
+$this->load->view('layout/collaborator/sidebar', array('base_url' => $base_url, 'method'=>$this->router->method, 'class'=>$this->router->class  ));
+?>
+<script type="text/javascript">
+    function init_page()
+    {
+
+        $(".ajax_paging").click(function () {
+            $.ajax({
+                url: $(this).attr("href"),
+                type: "POST",
+                data: $("#collaborator").serialize(),
+                success: function (data, textStatus, jqXHR)
+                {
+                    // $result = jQuery.parseJSON(data);
+                    $("#content").html(data);
+                    init_page();
+					$('.daterangepicker').daterangepicker({
+						format: 'DD/MM/YYYY'
+					});
+					
+                },
+                error: function (jqXHR, textStatus, errorThrown)
+                {
+                    $(".ajaxloading").hide();
+                }
+            });
+            return false;
+        })
+        $('#keyword').keyup(function (event) {
+            if (event.keyCode == '13') {
+                filter();
+            }
+            return false;
+        });
+        
+		$(document).on('click', '.applyBtn', function(){
+			$('#loading').css('display', 'block');
+			$('#table_content').hide();
+			filter();
+		});
+		
+		$('#daterange').keyup(function (event) {
+            if (event.keyCode == '13') {
+                filter();
+            }
+            return false;
+        });
+        
+        $( '.sorting, .sorting_desc, .sorting_asc' ).click(function( index ) {
+            var current_class=$( this ).attr('class');
+            $(".sorting_desc").attr("class","sorting");
+            $(".sorting_asc").attr("class","sorting");
+     
+            if(current_class=='sorting')
+            {
+                $(this).attr("class","sorting_desc");
+            }
+            else
+            {
+                if(current_class=='sorting_desc')
+                {
+                    $(this).attr("class","sorting_asc");
+                }
+                else
+                    {
+                    if(current_class=='sorting_asc')
+                    {
+                        $(this).attr("class","sorting");
+                    }
+                }
+            }
+            $("#sorting_field").val($(this).attr("id"));
+            $("#sorting_order").val($(this).attr("class"));
+            filter();
+        });
+        $('[data-toggle="ajaxModal"]').on('click',
+              function(e) {
+                $('#ajaxModal').remove();
+                e.preventDefault();
+                var $this = $(this)
+                  , $remote = $this.data('remote') || $this.attr('href')
+                  , $modal = $('<div class="modal" id="ajaxModal"><div class="modal-body"></div></div>');
+                $('body').append($modal);
+                $modal.modal({backdrop: 'static', keyboard: false});
+                $modal.load($remote);
+              }
+            );
+
+
+
+				$('#sales-charts').css({'width':'100%' , 'height':'200px'});
+				$.plot("#sales-charts", <?php echo json_encode($chard) ?>, {
+					hoverable: true,
+					shadowSize: 0,
+					series: {
+						lines: { show: true },
+						points: { show: true }
+					},
+					xaxis: {
+						tickLength: 0
+					},
+					yaxis: {
+						ticks: 10,
+						min: 0,
+						max:<?php echo $max;?>,
+						tickDecimals: 0
+					},
+					grid: {
+						backgroundColor: { colors: [ "#fff", "#fff" ] },
+						borderWidth: 1,
+						borderColor:'#555'
+					}
+				});
+    }
+
+
+    function filter()
+    {
+		daterange = $('input[name="daterange"]').val();
+        $.ajax({
+            url: '<?php echo base_url();?>cong_tac_vien/thong_ke_cong_tac_vien/trang_ctv/<?php echo $id;?>/1',
+            type: "POST",
+            data: $("#collaborator").serialize(),
+            success: function (data, textStatus, jqXHR)
+            {
+                // $result = jQuery.parseJSON(data);
+                $("#content").html(data);
+               
+                $("#keyword").focus();
+                $("#keyword").setCursorToTextEnd();
+				$('.daterangepicker').daterangepicker({
+					format: 'DD/MM/YYYY'
+				});
+				$('input[name="daterange"]').val(daterange);
+				init_page();
+            },
+            error: function (jqXHR, textStatus, errorThrown)
+            {
+                $(".ajaxloading").hide();
+            }
+        });
+    }
+
+
+</script>
+<style type="text/css" media="screen">
+			.widget-header-flat {
+				background: #307ecc;
+				color: #fff
+			}
+			.widget-toolbar>[data-action="collapse"], .header-color-dark>.widget-toolbar>[data-action="collapse"] {
+				color: #fff
+			}
+			.widget-header, .widget-content {
+				width: auto
+			}
+			.widget-body .table thead:first-child tr {
+				background: #EDECEC;
+			    color: #707070;
+			    font-weight: normal;
+			}
+		</style>
+             
+<div class="main-content" >
+    <div id="breadcrumbs" class="breadcrumbs">
+
+    <ul class="breadcrumb">
+        <li>
+            <a href="<?php echo $base_url; ?>cong_tac_vien">Thá»ng kÃª doanh thu</a>
+        </li>
+        
+    </ul><!-- .breadcrumb -->
+	<!--
+    <div id="nav-search" class="nav-search">
+        <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 ...">
+                <i class="icon-search nav-search-icon"></i>
+            </span>
+        </form>
+    </div><!-- #nav-search -->
+</div>
+    
+    
+    
+    
+<div class="page-content">
+    
+    <div class="page-header">
+        <h1>
+            <a href="<?php echo $base_url; ?>cong_tac_vien">Cá»ng tÃ¡c viÃªn</a>
+            <small>
+                <i class="icon-double-angle-right"></i>
+                Thá»ng kÃª doanh thu
+            </small>
+        </h1>
+    </div><!-- /.page-header -->
+    
+     <div class="row">  
+    <?php echo $statistics; ?>   
+     </div>
+     <div class="row" id="content">    
+    <?php echo $content; ?>
+     </div>
+    </div>
+</div><!-- /.main-content -->
+</div><!-- /.main-container-inner -->
+
+<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
+    <i class="icon-double-angle-up icon-only bigger-110"></i>
+</a>
+</div><!-- /.main-container -->
+
+
+
+</div><!-- /.modal-dialog -->
+<?php
+$this->load->view('layout/admin/footer', array('base_url' => $base_url,'adminjs' => array('assets/js/admin/collaborator.js')));
+?>
Index: /pro-violet-viettel/sourcecode/application/modules/collaborator/views/reportAsistant/listview_user.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/modules/collaborator/views/reportAsistant/listview_user.php	(revision 883)
+++ /pro-violet-viettel/sourcecode/application/modules/collaborator/views/reportAsistant/listview_user.php	(revision 883)
@@ -0,0 +1,101 @@
+
+        <div class="col-xs-12">
+            <!-- PAGE CONTENT BEGINS -->
+            <div style="padding-bottom:4px" class="table-header">
+                ÄÃ£ giá»i thiá»u
+            </div>
+
+            <div class="table-responsive">
+                <div role="grid" class="dataTables_wrapper" id="sample-table-2_wrapper">
+                    <form autocomplete="off" onsubmit="return false;" id="collaborator" >
+                        <div class="row">
+                            <div class="col-sm-6">
+                                <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>
+
+                                </div>
+                            </div>
+
+                            <div class="col-sm-6">
+                                <div class="dataTables_filter" id="sample-table-2_filter">
+                                    <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 style="clear: both;"></div>
+                                <div id="daterangepicker" class="selectbox pull-right">
+                                    <i class="icon-calendar"></i>
+									<!--<i id="remove" class="btn-sm btn-danger icon-remove"></i>-->
+                                    <input id="daterange" type="text" name="daterange" class="daterangepicker" style="background: #ffffff; width: 176px; height: 28px; position: inherit;">
+                                </div>
+                            </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;?>"/>
+                    </form>
+					
+                    <table class="table table-striped table-bordered table-hover dataTable" id="sample-table-2" aria-describedby="sample-table-2_info">
+                        <thead>
+                            <tr role="row">                               
+                                <th class="<?php if ($sorting_field == 'full_name') {echo $sorting_order;} else {echo "";}?>" id="full_name" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 176px;" aria-label="Sá» Äiá»n thoáº¡i: activate to sort column ascending">TÃªn ngÆ°á»i dÃ¹ng</th>
+                                <th class="<?php if ($sorting_field == 'collaborator_cellphone') {echo $sorting_order;} else {echo "sorting";}?>" id="collaborator_cellphone" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 283px;" aria-label="Há» tÃªn: activate to sort column ascending">Sá» thuÃª bao</th>
+                                <th class="<?php if ($sorting_field == 'total_user') {echo $sorting_order;} else {echo "sorting";}?>" id="total_user" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 176px;" aria-label="Sá» Äiá»n thoáº¡i: activate to sort column ascending">NgÃ y giá»i thiá»u</th>  
+                                <!--<th class="<?php if ($sorting_field == 'collaborator_created_time') {echo $sorting_order;} else {echo "sorting";}?>" id="collaborator_created_time" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 209px;" aria-label="NgÃ y ÄÄng kÃœ: activate to sort column ascending">NgÃ y ÄÄng kÃœ</th>-->
+                                  
+                        </thead>
+
+
+                        <tbody role="alert" aria-live="polite" aria-relevant="all">
+                            
+                            <?php
+                            foreach ($paidlogs as $paidlog) {
+                                ?>
+                            <tr class="odd">
+                                
+								
+                                <td class=" ">
+									<?php echo $paidlog['username']; ?>                                    
+                                </td>
+                                <td class=" "><?php echo $paidlog['user_cellphone']?></td>                                
+                                <td class="hidden-480 "><?php echo $paidlog['user_created_time'];?></td>
+                                <!--<td class="hidden-480 "><?php echo $paidlog['collaborator_created_time'];?></td>-->
+                            </tr>
+                            <?php } ?>
+
+
+
+
+
+
+
+                        </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>
+                        <div class="col-sm-6">
+                            <div class="dataTables_paginate paging_bootstrap">
+                                <ul class="pagination">
+                                    <?php echo $paging; ?>
+                                </ul>
+                            </div>
+                        </div>
+                    </div>
+
+                </div>
+            </div>
+
+            
+        </div>
+
+
+<script type="text/javascript">
+    window.onload = function ()
+    {
+        init_page();
+    }
+
+
+</script>
Index: /pro-violet-viettel/sourcecode/application/modules/collaborator/views/reportAsistant/statistics.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/modules/collaborator/views/reportAsistant/statistics.php	(revision 883)
+++ /pro-violet-viettel/sourcecode/application/modules/collaborator/views/reportAsistant/statistics.php	(revision 883)
@@ -0,0 +1,28 @@
+<div class="col-xs-12">
+    <!-- PAGE CONTENT BEGINS -->
+    <div class="col-xs-12 no-padding">
+        <div class="widget-box no-border">
+            <div class="widget-header widget-header-flat">
+                <h4 class="lighter">
+                    <i class="icon-signal"></i>
+                    Biá»u Äá» ngÆ°á»i dÃ¹ng do cá»ng tÃ¡c viÃªn giá»i thiá»u
+                </h4>
+
+                <div class="widget-toolbar">
+                    <a data-action="collapse" href="#">
+                        <i class="icon-chevron-up"></i>
+                    </a>
+                </div>
+            </div>
+            
+            <div class="widget-body">
+                <div class="widget-main padding-4">
+                    <div id="sales-charts"></div>
+                </div><!-- /widget-main -->
+            </div>
+            
+        </div><!-- /widget-box -->
+    </div>
+
+    <div class="clearfix"></div>
+</div>
Index: /pro-violet-viettel/sourcecode/application/modules/collaborator/views/user/index.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/modules/collaborator/views/user/index.php	(revision 883)
+++ /pro-violet-viettel/sourcecode/application/modules/collaborator/views/user/index.php	(revision 883)
@@ -0,0 +1,76 @@
+<?php
+$base_url = base_url();
+$this->load->view('layout/collaborator/header', array('base_url' => $base_url));
+$this->load->view('layout/collaborator/sidebar', array('base_url' => $base_url, 'method'=>$this->router->method, 'class'=>$this->router->class  ));
+?>
+<div class="main-content" >
+    <div id="breadcrumbs" class="breadcrumbs">
+
+    <ul class="breadcrumb">
+        <li>
+            <i class="icon-home home-icon"></i>
+            <a href="<?php echo $base_url;?>cong_tac_vien">Trang chá»§</a>
+        </li>
+        
+    </ul><!-- .breadcrumb -->
+</div>
+   
+<div class="page-content">
+    
+    <div class="page-header">
+         <h1>
+            <a href="<?php echo $base_url;?>cong_tac_vien">Cá»ng tÃ¡c viÃªn</a>
+            <small>
+                <i class="icon-double-angle-right"></i>
+				<a href="<?php echo $base_url;?>cong_tac_vien/nguoi_dung">ThÃªm ngÆ°á»i dÃ¹ng</a>
+            </small>
+        </h1>
+    </div><!-- /.page-header -->
+     <div class="row" id="content">
+		<div class="col-xs-12">
+			<div class="row">
+				<div class="col-sm-offset-1 col-sm-10">
+					<form method="POST" id="frm-upload" action="" enctype="multipart/form-data" class="form-horizontal">
+						<h4 class="header blue bolder smaller">Chá»n vÃ  táº£i file tá»« mÃ¡y tÃ­nh</h4>
+						<div class="row">
+							<div class="col-sm-9">
+								<div class="form-group">
+									<div class="col-sm-8" >
+										
+										<input type="text" id="input-upload" class="form-control"/>
+										<div class="file-upload btn btn-success">
+											<span>Chá»n file ...</span>
+										
+											<input id="userfile" type="file" class="upload" name="userfile" />
+										</div>
+										<input type="submit" id="btn-submit" class="btn btn-primary" value="Táº£i lÃªn" />
+									</div>
+									
+								</div>
+							</div>
+						</div>
+						<h4 class="header blue bolder smaller"></h4>
+						
+
+					</form>
+				</div>
+			</div>
+		</div>
+	</div>
+</div>
+	<center><label id="charging" style="display: none;"><h4><span class="icon-refresh icon-refresh-animate"></span> Äang xá»­ lÃœ. Xin vui lÃ²ng chá»...</h4></label></center>
+	<div id="result">
+	</div>	
+</div><!-- /.main-content -->
+</div><!-- /.main-container-inner -->
+
+<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
+    <i class="icon-double-angle-up icon-only bigger-110"></i>
+</a>
+</div><!-- /.main-container -->
+</div><!-- /.modal-dialog -->
+<script>
+</script>
+<?php
+$this->load->view('layout/collaborator/footer', array('base_url' => $base_url, 'collaboratorjs' => array('assets/js/collaborator/collaborator.js') ));
+?>
Index: /pro-violet-viettel/sourcecode/application/modules/collaborator/views/user/result.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/modules/collaborator/views/user/result.php	(revision 883)
+++ /pro-violet-viettel/sourcecode/application/modules/collaborator/views/user/result.php	(revision 883)
@@ -0,0 +1,70 @@
+<?php if($success==0){ ?>
+	<div id="error-upload" class="alert alert-danger" role="alert">
+		<span class="icon-exclamation-sign" aria-hidden="true"></span>
+		<span class="sr-only">Error:</span> <?php echo " ".$process['error']; ?>
+	</div>
+<?php }elseif($success == 1){ ?>
+	<?php if ($process){?>
+		<div class="row">
+			<div class="col-xs-12">
+				<!-- PAGE CONTENT BEGINS -->
+				<div style="padding-bottom:4px" class="table-header">
+				Káº¿t quáº£
+				</div>
+			<?php //if ($success == 0){ ?>
+				
+			<?php //}elseif($success == 1){ ?>
+				<div class="table-responsive">
+					<div role="grid" class="dataTables_wrapper" id="sample-table-2_wrapper">
+						 <div id="table_result">
+							<table class="table table-striped table-bordered table-hover dataTable" id="sample-table-2" aria-describedby="sample-table-2_info">
+								<thead>
+									<tr role="row">
+										<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 role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 156px;">Sá» Äiá»n thoáº¡i</th>
+										<th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 156px;">Há» vÃ  tÃªn</th>
+										<th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 156px;">GÃ³i dá»ch vá»¥</th>
+										<th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 156px;">Sá» tiá»n náº¡p vÃ o</th>
+										<th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 156px;">NgÃ y giá» thá»±c hiá»n</th>
+										<th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 156px;">Káº¿t quáº£</th>
+										<th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 156px;">LÃœ do</th>
+									</tr>
+									 <tbody role="alert" aria-live="polite" aria-relevant="all">
+
+										<?php
+										foreach ($process as $user): ?>
+										<tr class="odd">
+											<td class="center  sorting_1">
+												<label>
+													<input type="checkbox" class="ace">
+													<span class="lbl"></span>
+												</label>
+											</td>
+											<td class=" "><?php echo $user['user']['username']; ?></td>
+											<td class=" "><?php echo $user['user']['fullname']; ?></td>
+											<td class=" "><?php echo $user['user']['service']; ?></td>
+											<td class=" "><?php echo $user['user']['amount']; ?></td>
+											<td class=" "><?php echo $user['date']; ?></td>
+											<td class=" "><?php echo ($user['success'] == 1? "ThÃ nh cÃŽng": "KhÃŽng thÃ nh cÃŽng"); ?></td>
+											<td class=" "><?php  echo $user['error']; ?></td>
+										</tr>
+										<?php endforeach; ?>
+									</tbody>
+								</thead>
+								</table>
+						</div>
+					</div>
+				</div>
+			</div>
+			</div>
+	<?php }else{ ?>
+		<div id="error-upload" class="alert alert-danger" role="alert">
+			<span class="icon-exclamation-sign" aria-hidden="true"></span>
+			<span class="sr-only">Error:</span> KhÃŽng Äá»c ÄÆ°á»£c file</div>
+	<?php } ?>
+<?php } ?>
Index: /pro-violet-viettel/sourcecode/application/modules/frontend/controllers/home.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/modules/frontend/controllers/home.php	(revision 882)
+++ /pro-violet-viettel/sourcecode/application/modules/frontend/controllers/home.php	(revision 883)
@@ -181,48 +181,13 @@
 	
 	public function test(){
-		$provinces = lang('_PROVINCES_');
-		$this->load->library("PHPExcel");
-		$file = './assets/danhsachquanhuyen.xls';
-		$objPHPExcel = PHPExcel_IOFactory::load($file);
-		$cell_collection = $objPHPExcel->getActiveSheet()->getCellCollection();
-		foreach ($cell_collection as $cell) {
-			$column = $objPHPExcel->getActiveSheet()->getCell($cell)->getColumn();
-			$row = $objPHPExcel->getActiveSheet()->getCell($cell)->getRow();
-			$data_value = $objPHPExcel->getActiveSheet()->getCell($cell)->getValue();
-			
-			if ($row == 1) {
-				$header[$row][$column] = $data_value;
-			} else {
-				$arr_data[$row][$column] = $data_value;
-			}
+		$aryMatch = array();
+		$phoneNumber = '987133325';
+		$regex = '/^[1,9][0-9]{8,9}$/';
+		if (preg_match('/^[1,9]([0-9]{8,9})$/', $phoneNumber, $aryMatch)){
+			$phoneNumber = "0".$phoneNumber;
+			echo $phoneNumber;
+		}else{
+			echo "Not match";
 		}
-		
-		$data['header'] = $header;
-		$data['values'] = $arr_data;
-		
-		foreach ($data['values'] as $index => $value){
-			foreach ($provinces as $provinceId => $province){
-				if ($value['C'] == $province) $data['values'][$index]['C'] = $provinceId;
-				if ($value['B'] >= 10){
-					$data['values'][$index]['B'] = "0".$value['B'];
-				}else{
-					$data['values'][$index]['B'] = "00".$value['B'];
-				}
-			}
-			
-		}
-		
-		$dt = array();
-		foreach ($data['values'] as $index => $value){
-			
-			$dt[$index]['district_id'] = $value['B'];
-			$dt[$index]['province_id'] = $value['C'];
-			$dt[$index]['district_name'] = $value['D'];
-			$dt[$index]['type'] = $value['E'];
-		}
-		//var_dump($dt);
-		//$this->load->model ( 'user_model' );
-		//$result = $this->user_model->insertDistrict($dt);
-		//var_dump($result);
 	}
 }
Index: /pro-violet-viettel/sourcecode/application/modules/frontend/controllers/user.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/modules/frontend/controllers/user.php	(revision 882)
+++ /pro-violet-viettel/sourcecode/application/modules/frontend/controllers/user.php	(revision 883)
@@ -449,4 +449,5 @@
 	public function regis_history()
 	{
+		$this->load->model('servicepackage_model');
 		$this->load->helper('pagging');
 		$us_id = $this->uri->segment(4);
@@ -466,10 +467,18 @@
 			$this->load->model('user_model');
 			$result = $this->user_model->getPackagelog($data);
-			$data['total'] = $this->user_model->countPackagelogs($username);
+			$results = array();
+			foreach($result as $re){
+				if ($re['p_code']>0){
+					$p_price =  $this->servicepackage_model->getPackagePriceByCode($re['p_code']);
+					$re['amount'] = -$p_price;
+				}
+				array_push($results, $re);
+			}
+			$data['total'] = $this->user_model->countPackagelogs($username, $us_id);
 			$data['num_links'] = 2;
 			$data['paging_url'] = base_url() . "frontend/user/regis_history/".$us_id."/page/";
 			$data['paging'] = pagging($data);
 			$packagelogs = array();
-			foreach ($result as $packagelog):
+			foreach ($results as $packagelog):
 				$packagelog['created_time'] = date('d/m/Y H:i:s', strtotime($packagelog['created_time']));
 				array_push($packagelogs, $packagelog);
@@ -487,5 +496,6 @@
 		
 		$user_info = $this->session->userdata('userInfo');
-		if ($user_info) {
+		$admin_info = $this->session->userdata('adminInfo');
+		if ($user_info || $admin_info) {
 			$result = array();
 			$provinceId = $this->uri->segment(4);
Index: /pro-violet-viettel/sourcecode/application/modules/frontend/models/user_model.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/modules/frontend/models/user_model.php	(revision 882)
+++ /pro-violet-viettel/sourcecode/application/modules/frontend/models/user_model.php	(revision 883)
@@ -576,5 +576,5 @@
 		$this->db->query ( 'UNLOCK TABLES' );
 		//$sql="SELECT tblregisterpackagelog.source,tblservicepackage.p_name,tblregisterpackagelog.created_time FROM tblregisterpackagelog INNER JOIN tblservicepackage ON tblservicepackage.p_code = tblregisterpackagelog.p_code where username = ? UNION SELECT tblpaidlog.source,tblpaidlog.amount,tblpaidlog.paid_time FROM tblpaidlog where us_id = ? ORDER BY created_time DESC LIMIT ".$data['start'].", ".$data['perpage']."";
-		$sql="SELECT tblregisterpackagelog.source,0 as amount,tblservicepackage.p_name,tblregisterpackagelog.created_time FROM tblregisterpackagelog INNER JOIN tblservicepackage ON tblservicepackage.p_code = tblregisterpackagelog.p_code where username = ? UNION SELECT tblpaidlog.source,tblpaidlog.amount,'Nạp tiền' as name,tblpaidlog.paid_time FROM tblpaidlog where us_id = ? ORDER BY created_time DESC LIMIT ".$data['start'].", ".$data['perpage']."";
+		$sql="SELECT tblregisterpackagelog.source,0 as amount,tblservicepackage.p_name,tblregisterpackagelog.created_time, tblregisterpackagelog.p_code FROM tblregisterpackagelog INNER JOIN tblservicepackage ON tblservicepackage.p_code = tblregisterpackagelog.p_code where username = ? UNION SELECT tblpaidlog.source,tblpaidlog.amount,'Nạp tiền' as name,tblpaidlog.paid_time, 0 as p_code FROM tblpaidlog where us_id = ? ORDER BY created_time DESC LIMIT ".$data['start'].", ".$data['perpage']."";
 		$query = $this->db->query ( $sql, array ("$username", $us_id) );
 		$row = $query->result_array();
@@ -582,12 +582,22 @@
 	}
 	
-	public function countPackagelogs($username)
+	public function countPackagelogs($username, $us_id)
 	{
 		$this->db->query ( 'UNLOCK TABLES' );
 		$sql="SELECT COUNT(id) AS total FROM tblregisterpackagelog WHERE username = ?";
+		
 		$query = $this->db->query ( $sql, array (
 				$username
 		) );
 		$result = $query->row_array();
+		$total = $result['total'];
+		$sql="SELECT COUNT(paid_id) AS total FROM tblpaidlog WHERE us_id = ?";
+		$query = $this->db->query ( $sql, array (
+				$us_id
+		) );
+		$result = $query->row_array();
+		$total = $total + $result['total'];
+		$result['total'] = $total;
+		
 		return $result['total'];
 	}
Index: /pro-violet-viettel/sourcecode/application/modules/frontend/views/user_infor.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/modules/frontend/views/user_infor.php	(revision 882)
+++ /pro-violet-viettel/sourcecode/application/modules/frontend/views/user_infor.php	(revision 883)
@@ -59,9 +59,12 @@
 <script>
 var district_id = "<?php echo $user['district']; ?>";
-$(".form-field-province").change(function(){
-	changeEventProvince();
+var province_id = "<?php echo $user['province']; ?>";
+$(document).ready(function(){
+	$(".form-field-province").change(function(){
+		changeEventProvince(province_id);
+	});
+	if ($(".form-field-province").val() !== 'undefined'){
+		checkSelectedDistrict(province_id);
+	}
 });
-if ($(".form-field-province").val() !== 'undefined'){
-	checkSelecteDistrict();
-}
 </script>
Index: /pro-violet-viettel/sourcecode/application/modules/services/models/services_model.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/modules/services/models/services_model.php	(revision 882)
+++ /pro-violet-viettel/sourcecode/application/modules/services/models/services_model.php	(revision 883)
@@ -336,5 +336,5 @@
 		);
 
-		$xml = $this->load->view('charging', $aryParams, true);
+		$xml = $this->load->view('services/charging', $aryParams, true);
 		$client = new nusoap_client($url);
 		$client->useHTTPPersistentConnection();
@@ -342,5 +342,4 @@
 		$client->operation = $action;
 		$result = $client->send($xml, $action);
-
 		if ($client->fault) {
 			return _SBG_CHARGING_FAIL;
@@ -395,5 +394,5 @@
 		);
 		
-		$xml = $this->load->view('mt', $aryParams, true);
+		$xml = $this->load->view('services/mt', $aryParams, true);
 		$url = $this->config->item('mt_service_url');
 		$client = new nusoap_client($url);
Index: /pro-violet-viettel/sourcecode/application/views/layout/collaborator/footer.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/views/layout/collaborator/footer.php	(revision 883)
+++ /pro-violet-viettel/sourcecode/application/views/layout/collaborator/footer.php	(revision 883)
@@ -0,0 +1,157 @@
+<!-- basic scripts -->
+
+<!--[if !IE]> -->
+
+<script type="text/javascript">
+    window.jQuery || document.write("<script src='<?php echo $base_url; ?>assets/js/jquery-2.0.3.min.js'>" + "<" + "/script>");
+</script>
+
+<!-- <![endif]-->
+
+<!--[if IE]>
+<script type="text/javascript">
+window.jQuery || document.write("<script src='<?php echo $base_url; ?>assets/js/jquery-1.10.2.min.js'>"+"<"+"/script>");
+</script>
+<![endif]-->
+
+<script type="text/javascript">
+    if ("ontouchend" in document)
+        document.write("<script src='<?php echo $base_url; ?>assets/js/jquery.mobile.custom.min.js'>" + "<" + "/script>");
+</script>
+<script src="<?php echo $base_url; ?>assets/js/bootstrap.min.js"></script>
+<script src="<?php echo $base_url; ?>assets/js/typeahead-bs2.min.js"></script>
+
+<!-- page specific plugin scripts -->
+
+<!--[if lte IE 8]>
+  <script src="<?php echo $base_url; ?>assets/js/excanvas.min.js"></script>
+<![endif]-->
+
+<script src="<?php echo $base_url; ?>assets/js/jquery-ui-1.10.3.custom.min.js"></script>
+<script src="<?php echo $base_url; ?>assets/js/jquery.ui.touch-punch.min.js"></script>
+<script src="<?php echo $base_url; ?>assets/js/jquery.slimscroll.min.js"></script>
+<script src="<?php echo $base_url; ?>assets/js/jquery.easy-pie-chart.min.js"></script>
+<script src="<?php echo $base_url; ?>assets/js/jquery.sparkline.min.js"></script>
+<script src="<?php echo $base_url; ?>assets/js/flot/jquery.flot.min.js"></script>
+<script src="<?php echo $base_url; ?>assets/js/flot/jquery.flot.pie.min.js"></script>
+<script src="<?php echo $base_url; ?>assets/js/flot/jquery.flot.resize.min.js"></script>
+<script src="<?php echo $base_url; ?>assets/js/jquery.validate.min.js"></script>
+<!-- ace scripts -->
+
+<script src="<?php echo $base_url; ?>assets/js/ace-elements.min.js"></script>
+<script src="<?php echo $base_url; ?>assets/js/ace.min.js"></script>
+
+<script src="<?php echo $base_url; ?>assets/js/date-time/moment.min.js"></script>
+<script src="<?php echo $base_url; ?>assets/js/date-time/daterangepicker.min.js"></script>
+
+<!-- inline scripts related to this page -->
+
+<script type="text/javascript">	
+	$('.daterangepicker').daterangepicker({
+		format: 'DD/MM/YYYY'
+	});
+	
+    function show_box(id) {
+        jQuery('.widget-box.visible').removeClass('visible');
+        jQuery('#' + id).addClass('visible');
+    }
+
+    $('#register-button').click(function () {
+        $('#modal-login').modal('show')
+    })
+
+    $('#validation-edit-form').validate({
+        errorElement: 'label',
+        errorClass: 'help-block',
+        focusInvalid: true,
+        rules: {
+            password: {
+                required: true,
+            },
+            username: {
+                required: true
+            }
+        },
+        messages: {
+            username: {
+                required: "Vui lÃ²ng nháº­p tÃ i khoáº£n !",
+            },
+            password: {
+                required: "Vui lÃ²ng nháº­p máº­t kháº©u !",
+            }
+        },
+        highlight: function (e) {
+            $(e).closest('label').removeClass('has-info').addClass('has-error');
+        },
+        success: function (e) {
+            $(e).closest('label').removeClass('has-error').addClass('has-info');
+            $(e).remove();
+        },
+    });
+
+</script>
+<?php
+if (isset($collaboratorjs)) {
+    foreach ($collaboratorjs as $file) {
+        ?>
+        <script type="text/javascript" src="<?php echo $base_url; ?><?php echo $file ?>"></script>
+        <?php
+    }
+}
+?>
+<script>
+    $('#validation-add-form').validate({
+        errorElement: 'label',
+        errorClass: 'help-block',
+        focusInvalid: true,
+        rules: {
+            password: {
+                required: true,
+            },
+            username: {
+                required: true
+            }
+        },
+        messages: {
+            username: {
+                required: "Vui lÃ²ng nháº­p tÃ i khoáº£n !",
+            },
+            password: {
+                required: "Vui lÃ²ng nháº­p máº­t kháº©u !",
+            }
+        },
+        /*
+         highlight: function (e) {
+         $(e).closest('label').removeClass('has-info').addClass('has-error');
+         },
+         
+         success: function (e) {
+         $(e).closest('label').removeClass('has-error').addClass('has-info');
+         $(e).remove();
+         },*/
+    });
+	/*
+    var last_time=0;
+    $(document).ajaxStart(function () {
+       if ($.now()>(last_time+60000))
+       {
+            $.ajax({
+                url: "<?php echo $base_url; ?>collaborator/home/is_timeout",
+                type: "POST",
+                data: $("#package_register").serialize(),
+                success: function (data, textStatus, jqXHR)
+                {
+                    var results = jQuery.parseJSON(data);
+                    if (results.login==0)
+                    {
+                    window.location.href = "<?php echo $base_url; ?>collaborator/home";
+                    }
+                },
+            });
+            last_time=$.now();
+        }
+    });*/
+</script>
+
+</body>
+</html>
Index: /pro-violet-viettel/sourcecode/application/views/layout/collaborator/header.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/views/layout/collaborator/header.php	(revision 883)
+++ /pro-violet-viettel/sourcecode/application/views/layout/collaborator/header.php	(revision 883)
@@ -0,0 +1,115 @@
+<?php 
+$collaboratorInfo = $this->session->userdata('collaboratorInfo');
+$fullname = $collaboratorInfo['fullname'];
+?>
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8" />
+		<title>SBG|Admin</title>
+
+		<meta name="description" content="overview &amp; stats" />
+		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
+
+		<link href="<?php echo $base_url;?>assets/css/bootstrap.min.css" rel="stylesheet" />
+	
+		<link rel="stylesheet" href="<?php echo $base_url;?>assets/css/font-awesome.min.css" />
+
+		<!-- page specific plugin styles -->
+
+		<link rel="stylesheet" href="<?php echo $base_url;?>assets/css/jquery-ui-1.10.3.full.min.css" />
+		<link rel="stylesheet" href="<?php echo $base_url;?>assets/css/datepicker.css" />
+		<link rel="stylesheet" href="<?php echo $base_url;?>assets/css/ui.jqgrid.css" />
+		
+		<link rel="stylesheet" href="<?php echo $base_url;?>assets/css/ace-fonts.css" />
+
+		<link rel="stylesheet" href="<?php echo $base_url;?>assets/css/ace.min.css" />
+		<link rel="stylesheet" href="<?php echo $base_url;?>assets/css/ace-rtl.min.css" />
+		<link rel="stylesheet" href="<?php echo $base_url;?>assets/css/ace-skins.min.css" />
+        <link rel="stylesheet" href="<?php echo $base_url;?>assets/css/custom.css" />
+		<link rel="stylesheet" href="<?php echo $base_url;?>assets/css/daterangepicker.css" />
+		
+		<script src="<?php echo $base_url;?>assets/js/ace-extra.min.js"></script>
+		
+		<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+
+		<!--[if lt IE 9]>
+		<script src="<?php echo $base_url;?>assets/js/html5shiv.js"></script>
+		<script src="<?php echo $base_url;?>assets/js/respond.min.js"></script>
+		<![endif]-->
+		<style>
+			.icon-refresh-animate {
+				-animation: spin .7s infinite linear;
+				-webkit-animation: spin2 .7s infinite linear;
+			}
+
+			@-webkit-keyframes spin2 {
+				from { -webkit-transform: rotate(0deg);}
+				to { -webkit-transform: rotate(360deg);}
+			}
+
+			@keyframes spin {
+				from { transform: scale(1) rotate(0deg);}
+				to { transform: scale(1) rotate(360deg);}
+			}
+			table a
+			{
+				cursor: pointer;
+				font-size: 13px;
+				font-weight: normal;
+			}
+		</style>
+	</head>
+
+	<body>
+		<div class="navbar navbar-default navbar-fixed-top" id="navbar">
+			<script type="text/javascript">
+				try{ace.settings.check('navbar' , 'fixed')}catch(e){}
+			</script>
+
+			<div class="navbar-container" id="navbar-container">
+				<div class="navbar-header pull-left">
+					<a href="#" class="navbar-brand">
+						<img src="<?php echo $base_url;?>assets/img/logo_soanbai_online_white.png" width="350" class="img-responsive">
+					</a><!-- /.brand -->
+				</div><!-- /.navbar-header -->
+
+				<div class="navbar-header pull-right" role="navigation">
+					<ul class="nav ace-nav">
+						<li>
+							<a data-toggle="dropdown" href="#" class="dropdown-toggle">
+								<span class="user-info">
+									<small>Xin chÃ o,</small>
+									<?php echo $fullname; ?>
+								</span>
+
+								<i class="icon-caret-down"></i>
+							</a>
+
+							<ul class="user-menu pull-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
+								<li>
+									<a href="<?php echo $base_url; ?>cong_tac_vien/thong_tin_ca_nhan">
+										<i class="icon-user"></i>
+										ThÃŽng tin cÃ¡ nhÃ¢n
+									</a>
+								</li>
+
+								<li class="divider"></li>
+
+								<li>
+									<a href="<?php echo $base_url; ?>collaborator/home/logout">
+										<i class="icon-off"></i>
+										ThoÃ¡t
+									</a>
+								</li>
+							</ul>
+						</li>
+					</ul><!-- /.ace-nav -->
+				</div><!-- /.navbar-header -->
+			</div><!-- /.container -->
+		</div>
+
+		<div class="main-container" id="main-container">
+			<script type="text/javascript">
+				try{ace.settings.check('main-container' , 'fixed')}catch(e){}
+			</script>
Index: /pro-violet-viettel/sourcecode/application/views/layout/collaborator/sidebar.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/views/layout/collaborator/sidebar.php	(revision 883)
+++ /pro-violet-viettel/sourcecode/application/views/layout/collaborator/sidebar.php	(revision 883)
@@ -0,0 +1,52 @@
+<?php
+$class = $this->router->class;
+$method = $this->router->method;
+$collaboratorInfo = $this->session->userdata('collaboratorInfo');
+$collaboratorId = $collaboratorInfo['id'];
+?>
+			<div class="main-container-inner">
+				<a class="menu-toggler" id="menu-toggler" href="#">
+					<span class="menu-text"></span>
+				</a>
+
+				<div class="sidebar sidebar-fixed" id="sidebar">
+					<script type="text/javascript">
+						try{ace.settings.check('sidebar' , 'fixed')}catch(e){}
+					</script>
+
+					<nav class="navbar navbar-minimal animate open" role="navigation" style="background:transparent">
+						<ul class="navbar-menu animate">
+						
+							<li>
+								<a href="<?php echo $base_url; ?>cong_tac_vien">
+									<span class="menu-text"> Doanh thu</span>
+								</a>
+							</li>
+							
+							<li>
+								<a href="<?php echo $base_url; ?>cong_tac_vien/nguoi_dung">
+									<span class="menu-text"> NgÆ°á»i dÃ¹ng </span>
+								</a>
+							</li>
+							
+							<li>
+								<a href="<?php echo $base_url; ?>cong_tac_vien/thong_tin_ca_nhan">
+									<span class="menu-text"> ThÃŽng tin cÃ¡ nhÃ¢n </span>
+								</a>
+							</li>
+							
+						</ul>
+					</nav>
+					<div class="sidebar-collapse" id="sidebar-collapse">
+						<i class="icon-double-angle-left" data-icon1="icon-double-angle-left" data-icon2="icon-double-angle-right"></i>
+					</div>
+
+					<script type="text/javascript">
+						try{ace.settings.check('sidebar' , 'collapsed')}catch(e){}
+					</script>
+
+					<ul class="logo-group list-inline">
+						<li><img src="<?php echo $base_url;?>assets/img/logo_Violet.png" width="64" class="img-responsive"></li>
+						<li><img src="<?php echo $base_url;?>assets/img/logo_viettel.png" width="64" class="img-responsive"></li>
+					</ul>
+				</div>
Index: /pro-violet-viettel/sourcecode/assets/css/custom.css
===================================================================
--- /pro-violet-viettel/sourcecode/assets/css/custom.css	(revision 882)
+++ /pro-violet-viettel/sourcecode/assets/css/custom.css	(revision 883)
@@ -311,2 +311,29 @@
 #form-field-province {padding-left: 0;}
 #form-field-district {padding-left: 0;}
+
+.file-upload {
+	position: relative;
+	overflow: hidden;
+	margin: 8px;
+	border-radius: 4px;
+}
+.file-upload input.upload {
+	position: absolute;
+	top: 0;
+	right: 0;
+	margin: 0;
+	padding: 0;
+	font-size: 20px;
+	cursor: pointer;
+	opacity: 0;
+	filter: alpha(opacity=0);
+}
+#input-upload{
+	padding: 10px 12px;
+	font-size: 14px;
+	border: 1px solid #D8D8D8;
+
+}
+#btn-submit{
+	border-radius: 4px;
+}
Index: /pro-violet-viettel/sourcecode/assets/js/admin/user.js
===================================================================
--- /pro-violet-viettel/sourcecode/assets/js/admin/user.js	(revision 882)
+++ /pro-violet-viettel/sourcecode/assets/js/admin/user.js	(revision 883)
@@ -89,5 +89,5 @@
                         {
                             $('#user-history').modal('hide');
-                            //alert("ÄÃ£ cáº­p nháº­t");
+                         
                             location.reload();
                         }
@@ -97,6 +97,5 @@
 }
 
-function checkSelecteDistrict(){
-	provinceId = $(".form-field-province").val();
+function checkSelectedDistrict(provinceId){
 	$.ajax({
         url: '/frontend/user/getDistrict/' + provinceId,
@@ -120,7 +119,6 @@
 }
 
-function changeEventProvince(){
+function changeEventProvince(provinceId){
 	$(".form-field-district").html("");
-	provinceId = $("#form-field-province").val();
 	$.ajax({
         url: '/frontend/user/getDistrict/' + provinceId,
@@ -139,2 +137,12 @@
     });
 }
+
+$(document).ready(function(){
+	$(".form-field-province").change(function(){
+		//alert("OK");
+		changeEventProvince();
+	});
+	if ($(".form-field-province").val() !== 'undefined'){
+		checkSelectedDistrict();
+	}
+});
Index: /pro-violet-viettel/sourcecode/assets/js/collaborator/collaborator.js
===================================================================
--- /pro-violet-viettel/sourcecode/assets/js/collaborator/collaborator.js	(revision 883)
+++ /pro-violet-viettel/sourcecode/assets/js/collaborator/collaborator.js	(revision 883)
@@ -0,0 +1,61 @@
+$(document).on('change', '.upload', function() {
+		var path = this.value;
+		var filename = path.replace(/^.*\\/, "");
+		$("#input-upload").val(filename);
+});
+	
+$(document).ready(function(){
+	
+	$('#btn-submit').click(function(){
+		$("#charging").css('display', 'block');
+		$("#result").html("");
+		var data = new FormData($("#frm-upload")[0]);
+		//console.log(data);
+		$.ajax({
+			url: '/collaborator/user/upload',
+			type: 'POST',
+			data: data,
+			dataType: 'json',
+			mimeType: "multipart/form-data",
+			contentType: false,
+			processData: false,
+			cache: false,
+			success: function(data){
+				$("#charging").css('display', 'none');
+				$("#result").html(data);
+			},
+			error: function(data){
+			}
+		});
+		return false;
+	});
+	
+});
+
+function changePassword(collaborator_id)
+{
+	$('#passwd_old_err').html("");
+	$('#passwd_new_err').html("");
+	$('#confirm_passwd_new_err').html("");
+	$.ajax({
+		url: '/collaborator/collaborator/change_password/' + collaborator_id,
+		type: 'POST',
+		data: $("#frm-change-password").serialize(),
+		success: function (data, textStatus, jqXHR)
+		{	
+			console.log(data);
+			result = jQuery.parseJSON(data);
+			if (result.success == "1")
+			{   
+				$("#changePassSuccess").modal('show');
+			}
+			else
+			{
+				for (var key in result.errors)
+				{
+					$('#'+key).html(result.errors[key]);
+				}
+			}
+		}
+	});
+}
Index: /pro-violet-viettel/sourcecode/assets/js/frontend/user.js
===================================================================
--- /pro-violet-viettel/sourcecode/assets/js/frontend/user.js	(revision 882)
+++ /pro-violet-viettel/sourcecode/assets/js/frontend/user.js	(revision 883)
@@ -45,5 +45,5 @@
 			
 			if ($(".form-field-province").val() !== 'undefined'){
-				checkSelecteDistrict();
+				checkSelectedDistrict();
 			}
 			$(".form-field-province").change(function(){
@@ -121,5 +121,4 @@
 		success: function (data, textStatus, jqXHR)
 		{	
-		console.log(data);
 			result = jQuery.parseJSON(data);
 			if (result.success == "1")
@@ -286,5 +285,5 @@
 }
 
-function checkSelecteDistrict(){
+function checkSelectedDistrict(){
 	provinceId = $(".form-field-province").val();
 	$.ajax({
@@ -309,8 +308,4 @@
 }
 
-if ($(".form-field-province").val() !== 'undefined'){
-	checkSelecteDistrict();
-}
-
 function changeEventProvince(){
 	$(".form-field-district").html("");
@@ -332,6 +327,10 @@
     });
 }
-
-$(".form-field-province").change(function(){
-	changeEventProvince();
+$(document).ready(function(){
+	if ($(".form-field-province").val() !== 'undefined'){
+		checkSelectedDistrict();
+	}
+	$(".form-field-province").change(function(){
+		changeEventProvince();
+	});
 });
