Index: pro-violet-viettel/sourcecode/application/modules/admin/controllers/collaborator.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/controllers/collaborator.php	(revision 883)
+++ pro-violet-viettel/sourcecode/application/modules/admin/controllers/collaborator.php	(revision 906)
@@ -17,5 +17,11 @@
         $admin_info = $this->session->userdata('adminInfo');
         if ($admin_info) {
-            $data['content'] = $this->getCollaborators();
+			$roles=array();
+            foreach ($admin_info['roles'] as $role)
+            {
+                $roles[]=$role['role_name'];
+            }
+            //$data['roles']=$roles;
+            $data['content'] = $this->getCollaborators(array(), $roles);
             $this->load->view('collaborator/index', $data);
         } else {
@@ -24,5 +30,5 @@
     }
 
-    public function getCollaborators($filters = array()) {
+    public function getCollaborators($filters = array(), $roles) {
         $this->load->helper('pagging');
         $this->load->model('collabolator_model');
@@ -76,5 +82,6 @@
         $data['num_links'] = 2;
         $data['paging'] = pagging($data);
-
+		$data['roles'] = $roles;
+		
         if ($this->input->is_ajax_request()) {
             return $this->load->view('collaborator/listview', $data);
@@ -88,49 +95,33 @@
         $input = $this->input->post();
         $this->load->model('collabolator_model');
-        if (strlen($input['full_name'])==0)
-        {
-            $result['errors'][]=array("content"=>"TÃªn cá»ng tÃ¡c viÃªn khÃŽng ÄÆ°á»£c Äá» trá»ng","field"=>"full_name");
-        }
-        if (strlen($input['login_name'])==0)
-        {
-            $result['errors'][]=array("content"=>"TÃªn ÄÄng nháº­p khÃŽng ÄÆ°á»£c Äá» trá»ng","field"=>"login_name");
+		
+        if (strlen($input['cellphone'])==0)
+        {
+            $result['errors'][] = array("content"=>lang('_SBG_PHONE_REQUIRED_MSG'),"field"=>"cellphone");
         }
         else
         {
-            if ($this->collabolator_model->isExist(array('field'=>'login_name','value'=>$input['login_name'])))
-            {
-                $result['errors'][]=array("content"=>"TÃªn ÄÄng nháº­p ÄÃ£ ÄÆ°á»£c sá»­ dá»¥ng","field"=>"login_name");
-            }
-        }
-        if (strlen($input['cellphone'])==0)
-        {
-            $result['errors'][]=array("content"=>"Sá» Äiá»n thoáº¡i khÃŽng ÄÆ°á»£c Äá» trá»ng","field"=>"cellphone");
-        }
-        else
-        {
+			if (!preg_match('/^([0-9]{10,11}$)$/', $input['cellphone'])) {
+				$result['errors'][] = array("content"=>lang('_SBG_PHONE_FORMAT_ERROR_MSG'), "field"=>"cellphone");
+			}
+			
             if ($this->collabolator_model->isExist(array('field'=>'cellphone','value'=>$input['cellphone'])))
             {
-                $result['errors'][]=array("content"=>"Sá» Äiá»n thoáº¡i ÄÃ£ ÄÆ°á»£c sá»­ dá»¥ng","field"=>"cellphone");
-            }
-        }
-        if (strlen($input['passwd'])==0)
-        {
-            $result['errors'][]=array("content"=>"Máº­t kháº©u khÃŽng ÄÆ°á»£c Äá» trá»ng","field"=>"passwd");
-        }
-        else
-        {
-            if ($input['passwd'] != $input['passwd2'])
-            {
-                $result['errors'][]=array("content"=>"Máº­t kháº©u pháº£i trÃ¹ng nhau","field"=>"passwd");
-            }
-        }
+                $result['errors'][] = array("content"=>lang("_SBG_PHONE_DUPLICATE_MSG"),"field"=>"cellphone");
+            }
+        }
+        
         if (!isset($result['errors']))
         {
-            unset($input['passwd2']);
-            $input['passwd']=md5($input['activated']);
-            $input['activated']=1;
-            $input['created_time']=date("Y-m-d H:i:s");
-            $input['updated_time']=date("Y-m-d H:i:s");
+   
+			$passwd = $this->collabolator_model->createRandomPassword();
+            $input['passwd'] = md5($input['activated']);
+			$input['login_name'] = $input['cellphone'];
+			$input['author'] = 1;
+            $input['activated'] = 1;
+            $input['created_time'] = date("Y-m-d H:i:s");
+            $input['updated_time'] = date("Y-m-d H:i:s");
             $this->load->model('collabolator_model');
+			
             $this->collabolator_model->insert($input);
             $result['success'] = 1;
Index: pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportAsistant.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportAsistant.php	(revision 883)
+++ pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportAsistant.php	(revision 906)
@@ -24,5 +24,5 @@
         }
     }
-
+	
     public function viewAsistant() {
         $data = array();
@@ -159,5 +159,5 @@
         $data['keyword'] = "";
         $data['sorting_order'] = "sorting_desc";
-        $data['sorting_field'] = "id";
+        $data['sorting_field'] = "user_created_time";
 
         if ($this->input->post('sorting_order')) {
@@ -181,4 +181,5 @@
 		$data['daterange_start'] = "";
 		$data['daterange_end'] = "";
+		
 		if ($this->input->post('daterange')){
 			$daterange = explode(" - ", $this->input->post('daterange'));
@@ -190,10 +191,14 @@
 		
         $data['start'] = ($data['current_page'] - 1) * $data['perpage'];
+		//write_file('./log/sql.log', date('d-m-Y H:i:s').": Start query \n", FOPEN_WRITE_CREATE);
         $data['total'] = $this->collabolator_model->countCountCollaboratorUsers($data);
+		write_file('./log/sql.log', date('d-m-Y H:i:s').": Start query \n", FOPEN_WRITE_CREATE);
         $data['paidlogs'] = $this->collabolator_model->getCountCollaboratorUsers($data);
+		
         foreach ($data['paidlogs'] as $index=>$paidlog)
         {
             $data['paidlogs'][$index]['username']=$this->get_fullname($paidlog['us_id']);
         }
+		write_file('./log/sql.log', date('d-m-Y H:i:s').": Finished query \n", FOPEN_WRITE_CREATE);
         $data['paging_url'] = base_url() . "/admin/thong_ke_cong_tac_vien/trang_ctv/" . $data['id'];
         $data['num_links'] = 2;
@@ -203,4 +208,5 @@
             return $this->load->view('reportAsistant/listview_user', $data);
         }
+		
         return $this->load->view('reportAsistant/listview_user', $data, true);
     }
Index: pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportprovince.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportprovince.php	(revision 883)
+++ pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportprovince.php	(revision 906)
@@ -132,9 +132,10 @@
 		$this->load->model('reportmodel');
 		$data['date'] = 1;
-        $data['month'] = $this->uri->segment(4);
-        $data['year'] = $this->uri->segment(5);
-        $data['to_date'] = date("d");
+        $data['month'] = $this->uri->segment(5);
+        $data['year'] = $this->uri->segment(6);
+        $data['to_date'] = $this->uri->segment(4);
         $data['to_month'] = date("m");
         $data['to_year'] = date("Y");
+		/*
         if ($this->input->post()) {
 			//$data['date'] = $this->input->post('date');
@@ -144,5 +145,5 @@
             $data['to_month'] = $this->input->post('to_month');
             $data['to_year'] = $this->input->post('to_year');
-        }
+        }*/
 		
         $result = $this->reportmodel->getProvinces($data);
Index: pro-violet-viettel/sourcecode/application/modules/admin/controllers/user.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/controllers/user.php	(revision 883)
+++ pro-violet-viettel/sourcecode/application/modules/admin/controllers/user.php	(revision 906)
@@ -81,4 +81,6 @@
 			$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' ) );
@@ -208,67 +210,37 @@
 		);
 		$data ['status'] = $this->uri->segment (7, 0);
-		/*
-		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 ['sorting_order'] = $this->uri->segment (12);
+		$data ['sorting_field'] = $this->uri->segment (13);
+
+		$data ['daterange_start'] = $this->uri->segment (10);
+		$data ['daterange_end'] = $this->uri->segment (11);
+		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 ['start'] = ($data ['current_page'] - 1) * $data ['perpage'];
+		//echo json_encode($data);
 		$data ['total'] = $this->user_model->get_total_users ( $data );
 		$us = $this->user_model->get_list_users ( $data );
 		$users = array ();
+		
 		
 		foreach ( $us as $u ) {
@@ -295,5 +267,5 @@
 			array_push ( $users, $u );
 		}
-	
+		
 		$data ['users'] = $users;
 		$data ['paging_url'] = base_url () . "admin/nguoi_dung/trang/";
