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 906)
@@ -14,175 +14,37 @@
 		$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'];
+			$data['username'] = $collaborator_info['login_name'];
+			$data['fullname'] = $collaborator_info['fullname'];
 			$this->load->view('collaborator/collaborator_profile', $data);
+		}else{
+			$this->load->view('login');
+		}
+	}
+	
+	public function updateCollaborator(){
+		$this->load->model('collaborator_model');
+		$collaborator_info = $this->session->userdata('collaboratorInfo');
+		$result['success'] = 0;
+        if ($collaborator_info) {
+			
+			$collaborator_id = $collaborator_info['id'];
+			$login_name = $collaborator_info['login_name'];
+			$input = $this->input->post();
+			if (strlen($input['fullname']) == 0) {
+				$result['errors'][] = array("content"=>lang('_SBG_FULLNAME_REQUIRED_MSG'),"field"=>"fullname_err");
+			}
+			if (!isset($result['errors'])) {
+				$collaborator = array('full_name' => $input['fullname']);
+				$result['success'] = 1;
+				$result['data'] = $this->collaborator_model->updateCollaborator($collaborator_id, $collaborator);
+                $collaboratorData = array('login_name' => $login_name, 'id' => $collaborator_id, 'fullname' => $input['fullname'], 'logined_in' => TRUE);
+                $this->session->set_userdata('collaboratorInfo', $collaboratorData);
+			}
+			echo json_encode($result);
 		}else{
 			$this->load->view('login');
@@ -192,5 +54,4 @@
 	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) {
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 906)
@@ -20,7 +20,6 @@
         if ($collaborator_info) {
 			$id = $collaborator_info['id'];
-            $data['id'] = $id;
             $data['statistics'] = $this->getStatistics($id);
-            $data['content'] = $this->getCollaboratorsUsers(array(), $id);
+			$data['content'] = $this->getCollaboratorsUsers();
             $this->load->view('collaborator/reportAsistant/indexCollaborator', $data);
         } else {
@@ -122,68 +121,68 @@
 
 
-    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 {
+    public function getCollaboratorsUsers() {
+		$collaborator_info = $this->session->userdata('collaboratorInfo');
+        if ($collaborator_info) {
+			$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;
+			$id = $collaborator_info['id'];
             $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['keyword'] = "";
+			$data['sorting_order'] = "sorting_desc";
+			$data['sorting_field'] = "user_created_time";
+
+			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['date_start'] = $daterange[0];
+				$data['date_end'] = $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() . "collaborator/home/getCollaboratorsUsers/".$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);
+		}else{
+			$this->load->view('login');
 		}
-		
-        $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);
     }
 
@@ -202,3 +201,157 @@
     }
 	
+	
+	public function export(){
+		
+		$collaborator_info = $this->session->userdata('collaboratorInfo');
+        if ($collaborator_info) {
+			$id = $collaborator_info['id'];
+            $data['id'] = $id;
+			$data['fullname'] = $collaborator_info['fullname'];
+			$this->load->model('admin/collabolator_model');
+			//$data['perpage'] = $this->uri->segment(4, 10);
+			$data['keyword'] = $this->uri->segment(5);
+			if ($data['keyword'] == 'default') $data['keyword'] = null;
+			if (preg_match("/[0-9]/", $data['keyword'])) {
+					$data['search_field'] = "cellphone";
+			}
+			$data['daterange_start'] = $this->uri->segment(6);
+			$data['daterange_end'] = $this->uri->segment(7);
+			if ($data['daterange_start'] == 'default') $data['daterange_start'] = null;
+			if ($data['daterange_end'] == 'default') $data['daterange_end'] = null;
+			if ($data['daterange_start'])
+				$data['daterange_start'] = date ( 'Y-m-d H:i:s', strtotime ( $data ['daterange_start'] ) );
+			if ($data['daterange_end'])
+				$data['daterange_end'] = date ( 'Y-m-d H:i:s', strtotime ( $data['daterange_end'] . ' + 1 day' ) );
+			
+			$data['sorting_field'] = "user_created_time";
+			$data['sorting_order'] = $this->uri->segment(8);
+			
+			$data['paidlogs'] = $this->collabolator_model->getCountCollaboratorUsers($data);
+			
+			foreach ($data['paidlogs'] as $index => $paidlog)
+			{
+				$data['paidlogs'][$index]['username'] = $this->get_fullname($paidlog['us_id']);
+			}
+			$users = $data['paidlogs'];
+			
+			ob_end_clean();
+			$this->load->library("PHPExcel");
+			$sheet = $this->phpexcel->getActiveSheet();
+			
+			$sheet->setTitle("bao cao cua CTV " . date('m') . " - " . date('Y'));
+			$sheet->getColumnDimension('A')->setWidth(10);
+			$sheet->getColumnDimension('B')->setWidth(25);
+			$sheet->getColumnDimension('C')->setWidth(25);
+			$sheet->getColumnDimension('D')->setWidth(25);
+			$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:E1');
+			$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:E2');
+			$sheet->getStyle('B2')->applyFromArray($style);
+			
+			
+			$sheet->setCellValue('A4', "DANH SÃCH NGÆ¯á»I DÃNG DO Cá»NG TÃC VIÃN GIá»I THIá»U");
+			$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:E4');
+			$sheet->getStyle('A4')->applyFromArray($style);
+			
+			
+			
+			$style = array(
+				'font' => array('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', "Tá»« ngÃ y: ".$data['daterange_start']);
+			$sheet->setCellValue('C6', "Äáº¿n ngÃ y: ".$data['daterange_end']);
+			$sheet->setCellValue('B7', "NgÃ y káº¿t xuáº¥t: ".date("d")."/".date("m")."/".date("Y"));
+			$sheet->setCellValue('C7', "CTV: ".$data['fullname']);
+			
+			$sheet->getStyle('B6')->applyFromArray($style);
+			$sheet->getStyle('C6')->applyFromArray($style);
+			$sheet->getStyle('B7')->applyFromArray($style);
+			$sheet->getStyle('C7')->applyFromArray($style);
+			
+			$sheet->setCellValue('A9', 'STT');
+			$sheet->setCellValue('B9', 'TÃªn ngÆ°á»i dÃ¹ng');
+			$sheet->setCellValue('C9', 'Sá» thuÃª bao');
+			$sheet->setCellValue('D9', 'NgÃ y giá» giá»i thiá»u');
+			$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('A9:D9')->applyFromArray($style);
+			
+			$style = array(
+				'font' => array('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
+						)
+				)
+			);
+			
+			$dem = 0;
+			foreach ($users as $index => $user):
+				$sheet->setCellValue('A' . ($dem + 10), $index + 1);
+				$sheet->setCellValue('B' . ($dem + 10), $user['username']);
+				$sheet->setCellValueExplicit('C' . ($dem + 10), $user['user_cellphone'], PHPExcel_Cell_DataType::TYPE_STRING);
+				$sheet->setCellValue('D' . ($dem + 10), $user['user_created_time']);
+				$sheet->getStyle('A' . ($dem + 10).':D'.($dem + 10))->applyFromArray($style);
+				$dem++;
+			endforeach;
+			
+			$writer = new PHPExcel_Writer_Excel5($this->phpexcel);
+			header('Content-Type: application/vnd.ms-excel');
+			header('Content-Disposition: attachment; filename="danhsachnguoidung_ctv_'.date('d/m/Y').'.xls"');
+			$writer->save('php://output');
+		}else{
+			$this->load->view('login');
+		}
+	}
+	
 }
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 906)
@@ -22,5 +22,5 @@
 			$this->load->view('collaborator/user/index', $data);
 		}else{
-			show_404();
+			$this->load->view(login);
 		}
 	}
@@ -32,9 +32,5 @@
 			$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';*/
-			
+			$config['allowed_types'] = '*';
 			$this->load->library('upload', $config);
 			
@@ -43,5 +39,5 @@
 				$error = array('error' => $this->upload->display_errors('', ''));
 				$data['success'] = 0;
-				$data['process'] = $error;
+				$data['upload_error'] = $error;
 			}
 			else
@@ -49,11 +45,9 @@
 				$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['process'] = null;				
 				}
 				$data['success'] = 1;
@@ -61,6 +55,7 @@
 			$result = $this->load->view('collaborator/user/result', $data, true);
 			echo json_encode($result);
+
 		}else{
-			show_404();
+			$this->load->view('login');
 		}
 	}
@@ -93,4 +88,5 @@
 		$this->load->model('collaborator_model');
 		$data = $this->readExcelFile($file);
+
 		$result = array();
 		$user = array();
@@ -104,26 +100,23 @@
 				$user['district'] = $arrPD['district'];
 				$user['school'] = $value['E'];
-				$user['username'] = $this->services_model->formatPhoneNumber($value['F'], 2);
+				$user['username'] = $this->services_model->formatPhoneNumber((string)$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;
+						$result[$index-1]['success'] = 0;
+						$result[$index-1]['error'] = lang('_SBG_MO_PHONENUM_WRONG_FORMAT_MSG');
+						$result[$index-1]['user'] = $user;
 					}else{
-						$result[$index] = $this->collaborator_model->processUser($user, $sentNumber);
-						
-						
+						$result[$index-1] = $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 906)
@@ -7,5 +7,5 @@
 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_SYNTAX_ERR')) 						define('_SBG_SYNTAX_ERR', 			'SYNTAX_ERR');
 
 if ( ! defined('_SBG_CHARGING_SUCCESS')) 				define('_SBG_CHARGING_SUCCESS', 1);
@@ -24,4 +24,6 @@
 if ( ! defined('_SBG_PAIDTYPE_CARD')) define('_SBG_PAIDTYPE_CARD', 2);
 
+if ( ! defined('_SBG_MO_PROCCESS_ERR')) 				define('_SBG_MO_PROCCESS_ERR', 0);
+
 class Collaborator_model extends CI_Model {
 	
@@ -40,8 +42,4 @@
 		$this->load->helper('language');
 		$this->lang->load('messages', 'message');
-	}
-	
-	public function isExistUser($username){
-		return false;
 	}
 	
@@ -66,17 +64,115 @@
 		}
 		
+		
 		return array('case' => $case, 'content' => $aryContent);
 	}
 	
-	public function processUser($user, $sentNumber){
+	public function isExistUser($cellphone)
+	{
+		$sql = "SELECT * FROM tbluser WHERE cellphone = ?";
+		$this->db->query($sql, array('cellphone'=>$cellphone));
+		if ($this->db->affected_rows() >0){
+			return true;
+		}else{
+			return false;
+		}
+	}
+	
+	public function processUser($user, $sentNumber)
+	{
+		$this->load->model('frontend/user_model');
+		$data = array();
+		$data['charging'] = array();
+		$data['register-vip'] = array();
+		$data['register'] = array();
+		$username = $user['username'];
+		$service = $user['service'];
+		$amount = $user['amount'];
+		$isExist = $this->isExistUser($username);
+		//$isExist = false;
+		if (!$isExist){
+			$data['register']['data'] = $this->registerUser($user, $sentNumber);
+			$user['service'] = "ÄÄng kÃœ";
+			$user['amount'] = null;
+			$data['register']['user'] = $user;
+			$data['register']['date'] = date('d-m-Y H:i:s');
+		}else{
+			$data['register']['data']['success'] = 0;
+			$data['register']['data']['error'] = "NgÆ°á»i dÃ¹ng ÄÃ£ tá»n táº¡i";
+			$user['service'] = "ÄÄng kÃœ";
+			$user['amount'] = null;
+			$data['register']['user'] = $user;
+			$data['register']['date'] = date('d-m-Y H:i:s');
+		}
+		
+		// NAP
+		if ($amount){
+			$user['amount'] = $amount;
+			$data['charging']['data'] = $this->chargingForUser($user, $sentNumber);
+			$user['service'] = "Náº¡p tiá»n";
+			$data['charging']['user'] = $user;
+			$data['charging']['date'] = date('d-m-Y H:i:s');
+		}
+		if ($service){
+			// ÄK VIP
+			
+			$aryMatched = explode(' ', trim($service));
+			$p_code = $aryMatched[1];
+			$package = $package = $this->user_model->get_package ( $p_code );
+			$amount = $package['p_price'];
+			$user['amount'] = $amount;
+			$data['chargingvip']['data'] = $this->chargingForUser($user, $sentNumber);
+			$user['service'] = "Náº¡p tiá»n";
+			$data['chargingvip']['user'] = $user;
+			$data['chargingvip']['date'] = date('d-m-Y H:i:s');
+			
+			if ($data['chargingvip']['data']['success'] == 1){
+			
+				$data['register-vip']['data'] = $this->registerVipUser($user, $p_code);
+				$user['service'] = "ÄÄng kÃœ ".trim($service);
+				$user['amount'] = -$amount;
+				$data['register-vip']['user'] = $user;
+				$data['register-vip']['date'] = date('d-m-Y H:i:s');
+			}else{
+				$data['register-vip']['data']['success'] = 0;
+				$data['register-vip']['data']['error'] = "TÃ i khoáº£n chÃ­nh cá»§a thuÃª bao ".$sentNumber. " khÃŽng Äá»§ Äá» thá»±c hiá»n giao dá»ch nÃ y";
+				$user['service'] = "ÄÄng kÃœ ".trim($service);
+				$user['amount'] = -$amount;
+				$data['register-vip']['user'] = $user;
+				$data['register-vip']['date'] = date('d-m-Y H:i:s');
+			}
+			
+		}
+		/*	
+		}elseif ($service){
+			// ÄK VIP
+			$aryMatched = explode(' ', trim($service));
+			$p_code = $aryMatched[1];
+			$data['register-vip']['data'] = $this->registerVipUser($user, $p_code);
+			$user['service'] = "ÄÄng kÃœ ".trim($service);
+			$data['register-vip']['user'] = $user;
+			$data['register-vip']['date'] = date('d-m-Y H:i:s');
+		}else{
+			// DK
+			$data['register']['data'] = $this->registerUser($user, $sentNumber);
+			$user['service'] = "ÄÄng kÃœ";
+			$data['register']['user'] = $user;
+			$data['register']['date'] = date('d-m-Y H:i:s');
+		}*/
+		return $data;
+	}
+	/*
+	public function processUser($user, $sentNumber)
+	{
 		$data = array();	
 		$serviceAnalys = $this->serviceAnalys($user['service']);
 		
 		$case = $serviceAnalys['case'];
-		$aryContents = isset($serviceAnalys['content']) ? $serviceAnalys['content']: null;
+		$aryContents = isset($serviceAn
+		alys['content']) ? $serviceAnalys['content']: null;
 		
 		switch($case){
 			case _SBG_REGISTER_FOR:
-				$data = $this->registerUser($user);
+				$data = $this->registerUser($user, $sentNumber);
 				break;
 			case _SBG_REGISTER_VIP_FOR:
@@ -98,9 +194,10 @@
 		
 	}
-
-	public function registerUser($user){
+*/
+	public function registerUser($user, $sentNumber)
+	{
 
 		$data = array();
-		$data['user'] = $user;
+		//$data['user'] = $user;
 		$this->load->model('frontend/user_model');
 		$this->load->model('services/services_model');
@@ -108,5 +205,5 @@
 		$token = md5($user['username'] . self::TOKENPW);
 		$sms = '';
-		$collborator = $user['collboratorId'];
+		$collboratorId = $user['collboratorId'];
 		$username = $user['username'];
 		$password = $this->createRandomPassword();
@@ -139,5 +236,5 @@
 				$arrUser['us_id'] = $us_id;
 				$arrUser['cellphone'] = $username;
-				$arrUser['collborator'] = $collborator;
+				$arrUser['collaborator'] = $sentNumber;
 				$arrUser['acc_balanced'] = 0;
 				$arrUser['p_id'] = $trialpackage['p_id'];
@@ -178,7 +275,8 @@
 	}
 	
-	public function registerVipUser($arrUser, $p_code){
+	public function registerVipUser($arrUser, $p_code)
+	{
 		$data = array();
-		$data['user'] = $arrUser;
+		//$data['user'] = $arrUser;
 		$this->load->model('frontend/user_model');
 		$username = $arrUser['username'];
@@ -232,12 +330,19 @@
 	}
 	
-	public function chargingForUser($user, $sentNumber){
+	public function chargingForUser($user, $sentNumber)
+	{
 
 		$this->load->model('services/services_model');
 		$this->load->model('frontend/user_model');
 		$data = array();
-		$data['user'] = $user;
+		//$data['user'] = $user;
 		$username = $user['username'];
 		$amount = $user['amount'];
+		
+		if (!preg_match('/^[0-9]{3,}$/', $amount)) {
+			$smsReturn = lang('_SBG_MO_AMOUNT_WRONG_FORMAT_MSG');
+			$data['success'] = 0;
+			$data['error'] = $smsReturn;
+		}
 	
 		$result =$this->services_model->chargeRootAccountProcess($sentNumber, $amount, $sentNumber.' paid for SBG');
@@ -284,6 +389,32 @@
 	}
 	
-	
-	public function createRandomPassword(){
+	public function getCollaboratorByPhone($sentNumber){
+		$sql = "SELECT * from tblcollaborator where login_name = ? LIMIT 0,1";
+		$query = $this->db->query ( $sql, array ( $sentNumber  ) );
+		$row = $query->row_array ();
+		return $row;
+	}
+	
+	public function getPassword($sentNumber){
+		$collaborator = array();
+		$collaborator = $this->getCollaboratorByPhone($sentNumber);
+		if ($collaborator){
+			$passwd = $this->createRandomPassword();
+			$collaborator['passwd'] = md5($passwd);
+			$this->updateCollaborator($collaborator['id'], $collaborator);
+			$aryPatterns = array('/:password:/');
+			$sms = preg_replace($aryPatterns, array($passwd), lang('_SBG_COLLABORATOR_PASSWORD_MSG'));
+			$status = 1;
+			
+		}else{
+			$aryPatterns = array('/:collaborator:/');
+			$sms = preg_replace($aryPatterns, array($sentNumber), lang('_SBG_MO_COLLABORATOR_NOT_FOUND_MSG'));
+			$status = 0;
+		}
+		return $status . '|' . $sms;
+	}
+	
+	public function createRandomPassword()
+	{
 		$alphabet = "0123456789";
 		$pass = array ();
@@ -296,18 +427,22 @@
 	}
 	
-	public function getProvinceAndDistict($province, $district){
-		$result['province'] = $province;
-		$result['district'] = $district;
+	public function getProvinceAndDistict($province, $district)
+	{
+		$result['province'] = '';
+		$p = trim(ucwords($province));
+		$result['district'] = '';
+		$d = trim(ucwords($district));
 		$provinces = lang('_PROVINCES_');
 
 		foreach ($provinces as $key => $pro):
-			if($province == $pro){
+			if($p == $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']) );
+		//$sql = "SELECT * FROM tbldistrict where province_id = ? AND district_name LIKE '%".$d."%'";
+		$sql = "SELECT * FROM tbldistrict where province_id = ? AND INSTR(?, district_name)>0";
+		//write_file('./log/sql.log', date('d-m-Y H:i:s') . ": " . $sql . "\n", FOPEN_WRITE_CREATE);
+		$query = $this->db->query ( $sql, array ($result['province'], $d) );
 		if ($query->num_rows () > 0) {
 			$row = $query->row_array ();
@@ -317,10 +452,12 @@
 	}
 	
-	public function updateCollaborator($id, $collaborator){
+	public function updateCollaborator($id, $collaborator)
+	{
 		$this->db->where ( 'id', $id );
 		return $this->db->update ( 'tblcollaborator', $collaborator );
 	}
 	
-	public function checkPassCollaborator($id, $passwd){
+	public function checkPassCollaborator($id, $passwd)
+	{
 		$passwd = md5($passwd);;
 		$sql = "SELECT * FROM tblcollaborator WHERE id = ? AND passwd = ?";
@@ -332,3 +469,14 @@
 		}
 	}
+	
+	public function insertUser($user)
+	{
+		$this->db->insert ( 'tbluser', $user );
+		//var_dump($user);
+		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 906)
@@ -18,20 +18,56 @@
                 <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">
+								<li class="active">
+                                    <a id="edit-basic-tab" href="#edit-basic" data-toggle="tab">
+                                        <i class="blue icon-key bigger-125"></i>
+                                       ThÃŽng tin cÃ¡ nhÃ¢n
+                                    </a>
+                                </li>
+                                <li>
+                                    <a id="edit-password-tab" href="#edit-password" 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">-->
+								<div class="tab-pane active" id="edit-basic">		
+									<form id="frm-update-info" class="form-horizontal" role="form">
+										<h4 class="header blue bolder smaller">ThÃŽng tin cÃ¡ nhÃ¢n</h4>
+										<div class="row">
+                                            <div class="col-sm-9">
+												<div class="form-group">
+													<label for="form-field-username" class="col-sm-4 control-label no-padding-right">Sá» Äiá»n thoáº¡i</label>
+													<div class="col-sm-8">
+														<input type="text" name="username" value="<?php echo $username; ?>" placeholder="Sá» Äiá»n thoáº¡i" id="form-field-username" class="col-xs-12 col-sm-10" disabled>
+													</div>
+												</div>
+												<div class="form-group">
+													<label for="form-field-first" class="col-sm-4 control-label no-padding-right">Há» vÃ  tÃªn</label>
+													<label class="block clearfix has-error">										
+														<div class="col-sm-8">
+															<input type="text" name="fullname" value="<?php echo $fullname; ?>" placeholder="Há» vÃ  tÃªn" id="form-field-first" class="col-xs-12 col-sm-10">
+														</div>
+														<small><div class="col-sm-8 help-block" id="fullname_err"> </div></small>
+													</label>
+												</div>
+											</div>
+                                        </div>
+                                        <div class="clearfix form-actions">
+                                            <div class="col-md-offset-3 col-md-9">
+                                                <button type="button" onclick="return updateInfo();" class="btn btn-info">
+                                                    <i class="icon-ok bigger-110"></i>
+                                                    Cáº­p nháº­t
+                                                </button>	
+                                            </div>
+                                        </div>
+									</form>
+								</div>
+								
+                                <div class="tab-pane" id="edit-password">
+									
 									<form id="frm-change-password" class="form-horizontal" role="form">
 										<h4 class="header blue bolder smaller">Thay Äá»i máº­t kháº©u</h4>
@@ -81,5 +117,4 @@
 											<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
@@ -90,4 +125,5 @@
 										</form>
                                 </div>
+								
 
                             </div>
@@ -103,4 +139,20 @@
 </div><!-- /.main-container-inner -->
 </div><!-- /.main-container -->
+
+<div class="modal fade" id="updateInfoSuccess" 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">Cáº­p nháº­t thÃŽng tin</h4>
+			</div>
+			<div class="modal-body">
+				<div class="alert alert-block alert-success"><center><?php echo lang('_SBG_USER_UPDATE_INFO_SUCCESS_MSG'); ?><center></div>
+				<center><button id="close" class="btn btn-primary" data-dismiss="modal">ÄÃ³ng</button></center>
+			</div>
+		
+		</div>
+	</div>
+</div>
 
 <div class="modal fade" id="changePassSuccess" tabindex="-1" role="dialog"aria-hidden="true">
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 906)
@@ -80,4 +80,10 @@
 														<div class="help-block"> </div>
 													</label>
+													
+													<label class="block clearfix alert-success">
+															Náº¿u chÆ°a cÃ³ hoáº·c quÃªn máº­t kháº©u, soáº¡n tin nháº¯n theo cÃº phÃ¡p: <strong>SBG CTV</strong> gá»­i <strong>8062</strong>
+													</label>
+													
+												
 
 													<div class="space"></div>
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 906)
@@ -16,4 +16,5 @@
                 {
                     // $result = jQuery.parseJSON(data);
+					console.log(data);
                     $("#content").html(data);
                     init_page();
@@ -122,5 +123,5 @@
 		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',
+            url: '<?php echo base_url();?>collaborator/home/getCollaboratorsUsers/<?php echo $id;?>/1',
             type: "POST",
             data: $("#collaborator").serialize(),
@@ -219,4 +220,4 @@
 </div><!-- /.modal-dialog -->
 <?php
-$this->load->view('layout/admin/footer', array('base_url' => $base_url,'adminjs' => array('assets/js/admin/collaborator.js')));
+$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/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 906)
@@ -3,5 +3,9 @@
             <!-- PAGE CONTENT BEGINS -->
             <div style="padding-bottom:4px" class="table-header">
+			
                 ÄÃ£ giá»i thiá»u
+				<div class="pull-right" style="margin:5px;">
+					<a style="color:#fff" href="<?php echo base_url();?>collaborator/home/export/<?php echo $perpage?>/<?php echo ($keyword)?$keyword:'default'; ?>/<?php echo ($date_start)?$date_start:'default'; ?>/<?php echo ($date_end)?$date_end:'default'; ?>/<?php echo $sorting_order; ?>">Xuáº¥t ra Excel</a>
+				</div>
             </div>
 
@@ -43,5 +47,5 @@
                                 <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 == 'user_created_time') {echo $sorting_order;} else {echo "sorting";}?>" id="user_created_time" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 176px;" aria-label="NgÃ y giá»i thiá»u: activate to sort column ascending">NgÃ y giá»i thiá»u</th>  
                                 <!--<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>-->
                                   
@@ -52,4 +56,5 @@
                             
                             <?php
+							//var_dump($paidlogs);
                             foreach ($paidlogs as $paidlog) {
                                 ?>
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 906)
@@ -29,29 +29,59 @@
      <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" >
+			<div class="col-sm-offset-0 col-sm-12">
+				<div class="row">
+				<h4 class="header blue bolder smaller"> BÆ°á»c 1: Táº£i file ÄÄng kÃœ <a href="<?php echo $base_url ?>assets/Mau dang ky cua CTV.xls"><span style="color: red;">Táº¡i ÄÃ¢y</span></a></h4>
+				</div>
+				<div class="row">
+					<h4 class="header blue bolder smaller">BÆ°á»c 2: Äiá»n thÃŽng tin vÃ o file ÄÄng kÃœ</h4>
+					<h5>
+					<ul class="nav">
+						<li>	<b>TÃªn khÃ¡ch hÃ ng</b>: KhÃŽng báº¯t buá»c</li>
+						<li>	<b>Tá»nh</b>: KhÃŽng báº¯t buá»c</li>
+						<li>	<b>Quáº­n/Huyá»n</b>: KhÃŽng báº¯t buá»c</li>
+						<li>	<b>ÄÆ¡n vá»</b>: KhÃŽng báº¯t buá»c</li>
+						<li>	<b>Sá» Äiá»n thoáº¡i khÃ¡ch hÃ ng</b>: Báº¯t buá»c (cÃ³ thá» cÃ³ sá» 0 Äá»©ng Äáº§u hoáº·c khÃŽng cÃ³; pháº£i lÃ  sá» Äiá»n thoáº¡i Äi Äá»ng, chá» há» trá»£ Viettel, Vinaphone vÃ  Mobifone)</li>
+						<li>	<b>ÄÄng kÃœ gÃ³i dá»ch vá»¥</b>: KhÃŽng báº¯t buá»c (Chá»n VIP 1 hoáº·c VIP 3 hoáº·c Äá» trá»ng)</li>
+						<li>	<b>Sá» tiá»n náº¡p vÃ o TK SBG cá»§a khÃ¡ch hÃ ng</b>: KhÃŽng báº¯t buá»c (Náº¿u chá»n thÃ¬ chá»n cÃ¡c giÃ¡ trá» cÃ³ sáºµn hoáº·c Äá» trá»ng)</li>
+						<li>	<b>MÃ£ CTV</b>: KhÃŽng báº¯t buá»c</li>
+					</ul>
+					</h5>
+				</div>
+				<div class="row">
+					<h4 class="header blue bolder smaller">LÆ°u Ãœ:</h4>
+					<h5><ul>
+						<li>	File ÄÄng kÃœ máº«u pháº£i giá»¯ nguyÃªn Äá»nh dáº¡ng XLS. KhÃŽng sá»­a Äá»nh dáº¡ng cá»§a file máº«u, má»i sá»± thay Äá»i khÃŽng ÄÃºng sáºœ cÃ³ thá» dáº«n Äáº¿n viá»c trá»« tiá»n tá»« tÃ i khoáº£n cá»§a CTV khÃŽng ÄÃºng.</li>
+						<li>	CÃ¡c giao dá»ch trÃªn file, náº¿u cÃ³ tÃ­nh phÃ­ thÃ¬ phÃ­ sáºœ ÄÆ°á»£c trá»« trá»±c tiáº¿p tá»« tÃ i khoáº£n chÃ­nh cá»§a sá» Äiá»n thoáº¡i CTV (chÃ­nh lÃ  sá» ÄT dÃ¹ng Äá» ÄÄng nháº­p).</li>
+					</ul></h5>
+				</div>
+				
+				<div class="row">
+					<h4 class="header blue bolder smaller">Buá»c 3: Upload file ÄÄng kÃœ</h4>
+					<div class="col-sm-offset-1 col-sm-10">
+						<!--<h4 class="header blue bolder smaller">Chá»n vÃ  táº£i file tá»« mÃ¡y tÃ­nh</h4>-->
+						<form method="POST" id="frm-upload" action="" enctype="multipart/form-data" class="form-horizontal">
+							
+							<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>
 										
-										<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>
-						
+							<h4 class="header blue bolder smaller"></h4>
+							
 
-					</form>
+						</form>
+					</div>
 				</div>
 			</div>
@@ -61,5 +91,7 @@
 	<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>
+	
+	
 </div><!-- /.main-content -->
 </div><!-- /.main-container-inner -->
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 906)
@@ -1,18 +1,14 @@
-<?php if($success==0){ ?>
+<?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']; ?>
+		<span class="sr-only">Error:</span> <?php echo " ".$upload_error['error']; ?>
 	</div>
-<?php }elseif($success == 1){ ?>
-	<?php if ($process){?>
+<?php }else { ?>
+	<?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">
@@ -21,50 +17,75 @@
 								<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;">TÃªn dá»ch vá»¥</th>
+										<th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 156px;">Sá» tiá»n</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 role="alert" aria-live="polite" aria-relevant="all">
+									<?php foreach ($process as $result ){ ?>
+									
+										<?php if ($result['register']){ ?>
+											<tr>
+												<td class=" "><?php echo $result['register']['user']['username']; ?></td>
+												<td class=" "><?php echo $result['register']['user']['fullname']; ?></td>
+												<td class=" "><?php echo $result['register']['user']['service']; ?></td>
+												<td class=" "><?php echo $result['register']['user']['amount']; ?></td>
+												<td class=" "><?php echo $result['register']['date']; ?></td>
+												<td class=" "><?php echo ($result['register']['data']['success'] == 1? "ThÃ nh cÃŽng": "KhÃŽng thÃ nh cÃŽng"); ?></td>
+												<td class=" "><?php echo $result['register']['data']['error']; ?></td>
+											</tr>									
+										<?php } ?>
+										
+										<?php if ($result['charging']){ ?>
+											<tr>
+												<td class=" "><?php echo $result['charging']['user']['username']; ?></td>
+												<td class=" "><?php echo $result['charging']['user']['fullname']; ?></td>
+												<td class=" "><?php echo $result['charging']['user']['service']; ?></td>
+												<td class=" "><?php echo number_format($result['charging']['user']['amount'], 0); ?></td>
+												<td class=" "><?php echo $result['charging']['date']; ?></td>
+												<td class=" "><?php echo ($result['charging']['data']['success'] == 1? "ThÃ nh cÃŽng": "KhÃŽng thÃ nh cÃŽng"); ?></td>
+												<td class=" "><?php echo $result['charging']['data']['error']; ?></td>
+											</tr>									
+										<?php } ?>
+										
+										<?php if ($result['chargingvip']){ ?>
+											<tr>
+												<td class=" "><?php echo $result['chargingvip']['user']['username']; ?></td>
+												<td class=" "><?php echo $result['chargingvip']['user']['fullname']; ?></td>
+												<td class=" "><?php echo $result['chargingvip']['user']['service']; ?></td>
+												<td class=" "><?php echo number_format($result['chargingvip']['user']['amount'], 0); ?></td>
+												<td class=" "><?php echo $result['chargingvip']['date']; ?></td>
+												<td class=" "><?php echo ($result['chargingvip']['data']['success'] == 1? "ThÃ nh cÃŽng": "KhÃŽng thÃ nh cÃŽng"); ?></td>
+												<td class=" "><?php echo $result['chargingvip']['data']['error']; ?></td>
+											</tr>									
+										<?php } ?>
+										
+										<?php if ($result['register-vip']){ ?>
+											<tr>
+												<td class=" "><?php echo $result['register-vip']['user']['username']; ?></td>
+												<td class=" "><?php echo $result['register-vip']['user']['fullname']; ?></td>
+												<td class=" "><?php echo $result['register-vip']['user']['service']; ?></td>
+												<td class=" "><?php echo number_format($result['register-vip']['user']['amount'], 0); ?></td>
+												<td class=" "><?php echo $result['register-vip']['date']; ?></td>
+												<td class=" "><?php echo ($result['register-vip']['data']['success'] == 1? "ThÃ nh cÃŽng": "KhÃŽng thÃ nh cÃŽng"); ?></td>
+												<td class=" "><?php echo $result['register-vip']['data']['error']; ?></td>
+											</tr>									
+										<?php } ?>
+										
+										
+									<?php } ?>
+									
 									</tbody>
 								</thead>
-								</table>
+							</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>
+		</div>							
 	<?php } ?>
 <?php } ?>
