Index: pro-violet-viettel/sourcecode/application/modules/frontend/controllers/home.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/frontend/controllers/home.php	(revision 838)
+++ 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 838)
+++ 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 838)
+++ 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 838)
+++ 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>
