Index: /pro-violet-viettel/sourcecode/application/modules/admin/controllers/report.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/modules/admin/controllers/report.php	(revision 766)
+++ /pro-violet-viettel/sourcecode/application/modules/admin/controllers/report.php	(revision 767)
@@ -59,4 +59,15 @@
             }
         }
+		
+		$data ['paid_types'] = array (
+					0 => "Táº¥t cáº£",
+					1 => "SMS",
+					2 => "Card",
+		);
+		$data ['paid_type'] = 0;
+		if ($this->input->post ( 'paid_type' )) {
+			$data ['paid_type'] = ( int ) $this->input->post ( 'paid_type' );
+		}
+		
 		$data['daterange_start'] = "";
 		$data['daterange_end'] = "";
@@ -76,5 +87,5 @@
             $data['paidlogs'][$index]['username'] = @$this->get_fullname($paidlog['us_id']); 
         }
-
+		
         if ($this->input->is_ajax_request()) {
             return $this->load->view('report/listview', $data);
Index: /pro-violet-viettel/sourcecode/application/modules/admin/controllers/user.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/modules/admin/controllers/user.php	(revision 766)
+++ /pro-violet-viettel/sourcecode/application/modules/admin/controllers/user.php	(revision 767)
@@ -40,5 +40,7 @@
 				0 => "Táº¥t cáº£",
 				1 => "ÄÃ£ ÄÄng kÃœ",
-				2 => "DÃ¹ng thá»­" 
+				2 => "DÃ¹ng thá»­",
+				3=> "DÃ¹ng thá»­ háº¡n cháº¿",
+				4=> "Háº¿t háº¡n"
 		);
 		$data ['status'] = 0;
@@ -80,4 +82,5 @@
 			if ($userinfo) {
 				$u ['username'] = $userinfo ['username'];
+				$u['fullname'] = $userinfo['fullname'];
 			}
 			array_push ( $users, $u );
Index: /pro-violet-viettel/sourcecode/application/modules/admin/models/paidlog_model.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/modules/admin/models/paidlog_model.php	(revision 766)
+++ /pro-violet-viettel/sourcecode/application/modules/admin/models/paidlog_model.php	(revision 767)
@@ -14,4 +14,11 @@
 	function getPaidlogs($data) {
         $sql = "SELECT * FROM " . $this->table_name. " INNER JOIN tbluser ON tbluser.us_id = tblpaidlog.us_id ";
+		if ($data['paid_type'] == 1){
+			$sql.=" WHERE paid_type = 1";
+		}
+		if ($data['paid_type'] == 2){
+			$sql.=" WHERE paid_type = 2";
+		}
+		/*
         if ($data['keyword']) {
             if ($data['search_field'] == "cellphone") {
@@ -19,10 +26,14 @@
             } 
         }else{
-			if(strlen($data['daterange_start'])>0){
-				
+		*/
+		if(strlen($data['daterange_start'])>0){
+			if ($data['paid_type'] ==0){
 				$sql.=" WHERE paid_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."'";
-				write_file('./log/sql.log', date("m/d/Y H:i:s")." ".$sql."\n", FOPEN_WRITE_CREATE);
+				//write_file('./log/sql.log', date("m/d/Y H:i:s")." ".$sql."\n", FOPEN_WRITE_CREATE);
+			}else{
+				$sql.=" AND paid_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."'";
 			}
 		}
+		//}
 
         $order = "";
@@ -36,5 +47,4 @@
         }
         $sql=$sql . " " . $order . " LIMIT " . $data['start'] . ", " . $data['perpage'] . " ";
-      // echo $sql;
         return $this->db->query($sql)->result_array();
     }
@@ -44,15 +54,24 @@
     function countPaidlog($data) {
         $sql = "SELECT COUNT(".$this->id_name.") as total FROM " . $this->table_name." INNER JOIN tbluser ON tbluser.us_id = tblpaidlog.us_id";
-        if ($data['keyword']) {
+        /*if ($data['keyword']) {
             if ($data['search_field'] == "cellphone") {
                 $sql.=" WHERE (cellphone LIKE '%" . $data['keyword'] . "%')";
             } 
         }else{
-			if(strlen($data['daterange_start'])>0){
-				
+		*/
+		if ($data['paid_type'] == 1){
+			$sql.=" WHERE paid_type = 1";
+		}
+		if ($data['paid_type'] == 2){
+			$sql.=" WHERE paid_type = 2";
+		}
+		if(strlen($data['daterange_start'])>0){
+			if ($data['paid_type'] ==0){
 				$sql.=" WHERE paid_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."'";
-				//write_file('./log/sql.log', date("m/d/Y H:i:s")." ".$sql."\n", FOPEN_WRITE_CREATE);
+			}else{
+				$sql.=" AND paid_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."'";
 			}
 		}
+		//}
 		
         
Index: /pro-violet-viettel/sourcecode/application/modules/admin/models/user_model.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/modules/admin/models/user_model.php	(revision 766)
+++ /pro-violet-viettel/sourcecode/application/modules/admin/models/user_model.php	(revision 767)
@@ -25,8 +25,14 @@
 		$sql="SELECT * FROM ".$this->table_name;
 		if ($data['status'] == 1){
-			$sql.=" WHERE expire_date > NOW()";
+			$sql.=" WHERE expire_date > NOW() AND p_id <> 5";
 		}
 		if ($data['status'] == 2){
-			$sql.=" WHERE expire_date < NOW()";
+			$sql.=" WHERE expire_date > NOW() AND p_id = 5";
+		}
+		if ($data['status'] == 3){
+			$sql.=" WHERE expire_date < NOW() AND p_id = 5";
+		}
+		if ($data['status'] == 4){
+			$sql.=" WHERE expire_date < NOW() AND p_id <> 5";
 		}
 		if (isset($data['keyword']))
@@ -76,8 +82,14 @@
 		
 		if ($data['status'] == 1){
-			$sql.=" WHERE expire_date > NOW()";
+			$sql.=" WHERE expire_date > NOW() AND p_id <> 5";
 		}
 		if ($data['status'] == 2){
-			$sql.=" WHERE expire_date < NOW()";
+			$sql.=" WHERE expire_date > NOW() AND p_id = 5";
+		}
+		if ($data['status'] == 3){
+			$sql.=" WHERE expire_date < NOW() AND p_id = 5";
+		}
+		if ($data['status'] == 4){
+			$sql.=" WHERE expire_date < NOW() AND p_id <> 5";
 		}
 		
Index: /pro-violet-viettel/sourcecode/application/modules/admin/views/report/listview.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/modules/admin/views/report/listview.php	(revision 766)
+++ /pro-violet-viettel/sourcecode/application/modules/admin/views/report/listview.php	(revision 767)
@@ -1,78 +1,82 @@
-﻿
+﻿<div class="col-xs-12">
+		<!-- PAGE CONTENT BEGINS -->
+		<div style="padding-bottom:4px" class="table-header">
+			Doanh thu
+		</div>
 
-   
-        <div class="col-xs-12">
-            <!-- PAGE CONTENT BEGINS -->
-            <div style="padding-bottom:4px" class="table-header">
-                Doanh thu
-            </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 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>
-                            </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 id="daterangepicker" class="selectbox pull-right">
-									<i class="icon-calendar"></i>
-									<input id="daterange" type="text" name="daterange" class="daterangepicker" style="background: #ffffff; width: 176px; height: 28px; position: inherit;">
-										
-									</span>
-								</div>
-								</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 == '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">Họ tên</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">Số điện thoại</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>
+						<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 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): ?>
+										<option <?php if ($key == $paid_type) echo "selected"; ?> value="<?php echo $key; ?>"><?php echo $type; ?></option>
+									<?php endforeach; ?>
+								</select>
+							</div>
+							<div id="daterangepicker" class="selectbox pull-right">
+								<i class="icon-calendar"></i>
+								<input id="daterange" type="text" name="daterange" class="daterangepicker" style="background: #ffffff; width: 176px; height: 28px; position: inherit;">
+									
+								</span>
+							</div>
+							</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 == '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">Họ tên</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">Số điện thoại</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>
 
 
-                        <tbody role="alert" aria-live="polite" aria-relevant="all">
-                            
-                            <?php
-                            foreach ($paidlogs as $paidlog) {
-                                ?>
-                            <tr class="odd">
-                                
+					<tbody role="alert" aria-live="polite" aria-relevant="all">
+						
+						<?php
+						foreach ($paidlogs as $paidlog) {
+							?>
+						<tr class="odd">
+							
 
-                                <td class=" ">
-                                    <a href="#"><?php echo $paidlog['username'];?></a>
-                                </td>
-                                <td class=" "><?php echo $paidlog['cellphone']?></td>
-                                
-                                <td class="hidden-480 "><?php echo number_format($paidlog['amount'],0);?></td>
-                                <td class="hidden-480 "><?php if ($paidlog['paid_type']==1) {echo "SMS";} else { echo "Card";}?></td>
-                                <td class=" "><?php echo $paidlog['paid_time']?></td>
+							<td class=" ">
+								<a href="#"><?php echo $paidlog['username'];?></a>
+							</td>
+							<td class=" "><?php echo $paidlog['cellphone']?></td>
+							
+							<td class="hidden-480 "><?php echo number_format($paidlog['amount'],0);?></td>
+							<td class="hidden-480 "><?php if ($paidlog['paid_type']==1) {echo "SMS";} else { echo "Card";}?></td>
+							<td class=" "><?php echo $paidlog['paid_time']?></td>
 
-                               
+						   
 
-                                
-                            </tr>
-                            <?php } ?>
+							
+						</tr>
+						<?php } ?>
 
 
@@ -82,29 +86,29 @@
 
 
-                        </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>
+					</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>
+		</div>
 
-            
-        </div>
+		
+	</div>
 
 
 <script type="text/javascript">
-    window.onload = function ()
-    {
-        init_page();
-    }
+window.onload = function ()
+{
+	init_page();
+}
 
 
Index: /pro-violet-viettel/sourcecode/application/modules/admin/views/user/listview.php
===================================================================
--- /pro-violet-viettel/sourcecode/application/modules/admin/views/user/listview.php	(revision 766)
+++ /pro-violet-viettel/sourcecode/application/modules/admin/views/user/listview.php	(revision 767)
@@ -106,5 +106,5 @@
                                     echo "sorting";
                                 }
-                                ?>" 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">Username</th>
+                                ?>" 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') {
@@ -113,5 +113,6 @@
                                     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">Sá» Äiá»n thoáº¡i</th>
+                                ?>" 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 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>
                                 <th class="<?php
                                 if ($sorting_field == 'acc_balanced') {
@@ -121,6 +122,5 @@
                                 }
                                 ?>" id="acc_balanced" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 156px;" aria-label="Tiá»n: activate to sort column ascending">TÃ i khoáº£n (VNÄ)</th>
-                                <th style="width: 140px;">Tá»nh/TP</th>
-                                <th class="<?php
+								<th class="<?php
                                 if ($sorting_field == 'created_time') {
                                     echo $sorting_order;
@@ -142,5 +142,6 @@
                                     NgÃ y háº¿t háº¡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>
+                                <th style="width: 140px;">Tá»nh/TP</th>
+                                
                             </tr>
                         </thead>
@@ -148,7 +149,7 @@
                         <tbody role="alert" aria-live="polite" aria-relevant="all">
 
-<?php
-foreach ($users as $user) {
-?>
+							<?php
+							foreach ($users as $user):
+							?>
                                 <tr class="odd">
                                     <td class="center  sorting_1">
@@ -163,21 +164,24 @@
                                     </td>
                                     <td class=" ">
-                                        <?php echo $user['cellphone']; ?>
+                                        <?php echo $user['fullname']; ?>
+                                    </td>
+									<td class=" ">
+									<?php if (strtotime($user['expire_date']) > time() && $user['p_id'] != 5 ): ?>
+										<span class="label label-sm label-success">ÄÃ£ ÄÄng kÃœ</span>
+									<?php elseif(strtotime($user['expire_date']) > time() && $user['p_id'] == 5): ?>
+										<span class="label label-sm label-info">DÃ¹ng thá»­</span>
+									<?php elseif(strtotime($user['expire_date']) < time() && $user['p_id'] == 5): ?>
+										<span class="label label-sm label-warning">DÃ¹ng thá»­ háº¡n cháº¿</span>
+									<?php else: ?>
+										<span class="label label-sm label-danger">Háº¿t háº¡n</span>
+									<?php endif; ?>
                                     </td>
                                     <td class="hidden-480 "><?php echo number_format($user['acc_balanced'], 0); ?></td>
+									<td class=" "><?php echo $user['created_time']; ?></td>
+                                    <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 class=" "><?php echo $user['created_time']; ?></td>
-                                    <td class=" "><?php echo isset($user['expire_date']) && strtotime($user['expire_date']) > 0 ? date('d/m/Y', strtotime($user['expire_date'])) : ''; ?></td>
-
-                                    <td class=" ">
-    <?php if (strtotime($user['expire_date']) > time()) { ?>
-                                            <span class="label label-sm label-success">ÄÃ£ ÄÄng kÃœ</span>
-    <?php } else { ?>
-                                            <span class="label label-sm label-warning">DÃ¹ng thá»­</span>
-    <?php } ?>
-                                    </td>
 
                                 </tr>
-                                    <?php } ?>
+							<?php endforeach; ?>
 
                         </tbody></table>
