Ignore:
Timestamp:
Nov 19, 2014 2:08:05 PM (10 years ago)
Author:
namnd
Message:
 
Location:
pro-violet-viettel/sourcecode/application/modules/frontend
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/sourcecode/application/modules/frontend/controllers/user.php

    r568 r574  
    2727            $data['packages'] = $this->servicepackage_model->getAllPackages();
    2828            $data['is_viettel'] = $user_info['is_viettel'];
    29                         $paidlogs = $this->user_model->getPaidlog($us_id);
     29                        //$paidlogs = $this->user_model->getPaidlog($us_id);
    3030                       
    31                         $data['paidlogs'] = $paidlogs;
     31                        //$data['paidlogs'] = $paidlogs;
    3232            parse_str($user, $info);
    3333            $data = array_merge($data, $u);
     
    287287        }
    288288    }
     289       
     290        public function trade_history()
     291        {
     292                $this->load->helper('pagging');
     293                $us_id = $this->uri->segment(4);
     294        $user_info = $this->session->userdata('userInfo');
     295        if ($user_info)
     296                {
     297                       
     298                        $data['us_id'] = $us_id;
     299                        $data['perpage'] = 10;
     300                        $data['current_page'] = $this->uri->segment(6, 1);
     301                        $data['start'] = ($data['current_page'] - 1) * $data['perpage'];
     302                        $this->load->model('user_model');
     303                        $result = $this->user_model->getPaidlog($data);
     304                        $data['total'] = $this->user_model->countPaiglogs($us_id);
     305                        $data['num_links'] = 2;
     306                        $data['paging_url'] = base_url() . "frontend/user/trade_history/".$us_id."/page/";
     307                        $data['paging'] = pagging($data);
     308                        $paidlogs = array();
     309                        foreach ($result as $paidlog):
     310                                $paidlog['amount'] = number_format($paidlog['amount'], 0);
     311                                $paidlog['paid_time'] = date('d-m-Y H:i:s', strtotime($paidlog['paid_time']));
     312                                array_push($paidlogs, $paidlog);
     313                        endforeach;
     314                        $data['paidlogs'] = $paidlogs;
     315                        echo json_encode($data);
     316                }else {
     317            redirect('frontend/home');
     318        }
     319        }
    289320
    290321}
  • pro-violet-viettel/sourcecode/application/modules/frontend/models/user_model.php

    r561 r574  
    482482        }
    483483       
    484         public function getPaidlog($us_id)
     484        public function getPaidlog($data)
    485485        {
    486                 $this->db->query ( 'UNLOCK TABLES' );
    487                 $sql = 'SELECT * FROM tblpaidlog where us_id = ?';
     486                $us_id = $data['us_id'];
     487                $this->db->query ( 'UNLOCK TABLES' );
     488                $sql = "SELECT * FROM tblpaidlog where us_id = ? ORDER BY paid_time DESC LIMIT ".$data['start'].", ".$data['perpage']." ";
    488489                $query = $this->db->query ( $sql, array (
    489490                                $us_id
     
    492493                return $row;
    493494        }
     495       
     496        public function countPaiglogs($us_id)
     497        {
     498                $this->db->query ( 'UNLOCK TABLES' );
     499                $sql="SELECT COUNT(paid_id) AS total FROM tblpaidlog WHERE us_id = ?";
     500                $query = $this->db->query ( $sql, array (
     501                                $us_id
     502                ) );
     503                $result = $query->row_array();
     504                return $result['total'];
     505        }
    494506}
  • pro-violet-viettel/sourcecode/application/modules/frontend/views/user_profile.php

    r570 r574  
    229229                                                                                        <label id="charging" style="display: none;"><span class="icon-refresh icon-refresh-animate"></span> Xin chờ...</label>
    230230                                            <div class="space-4"></div>
    231                                             <a href="#" data-toggle="modal" data-target="#trade-history"><i class="icon-archive"></i> Lịch sá»­ giao dịch</a>
     231                                            <a onclick="tradeHistory(<?php echo $us_id; ?>, 1);" data-toggle="modal"><i class="icon-archive"></i> Lịch sá»­ giao dịch</a>
    232232                                        </div>
    233233                                        <div class="clearfix">
     
    331331                                </th>
    332332                                <th class="center">Số tiền (VNĐ)</th>
    333 
    334333                                <th>
    335334                                    <i class="icon-time bigger-110 hidden-480"></i>
     
    338337                            </tr>
    339338                        </thead>
    340 
    341                         <tbody>
    342                                                         <?php if (isset($paidlogs)) {?>
    343                                                         <?php foreach($paidlogs as $paidlog): ?>
    344                             <tr>
    345                                 <td class="center">
    346                                                                 <?php echo $paidlog['source']; ?>
    347                                 </td>
    348                                 <td class="center"><?php echo number_format($paidlog['amount'], 0); ?></td>
    349                                 <td><?php echo date('d-m-Y H:i:s', strtotime($paidlog['paid_time']));?></td>
    350                             </tr>
    351                                                         <?php endforeach; ?>
    352                                                         <?php }else{ ?>
    353                                                         <tr>
    354                                 <td class="center" colspan=3>Quí vị chưa có giao dịch nào!</td>
    355                                                         </tr>
    356                                                         <?php } ?>
     339                        <tbody id="content-trade-histoty">
    357340                        </tbody>
    358341                    </table>
     342                                        <div>
     343                                                <div class="dataTables_paginate paging_bootstrap">
     344                                                        <ul class="pagination">
     345                                                        </ul>
     346                                                </div>
     347                                        </div>
    359348                </div><!-- /.table-responsive -->
    360349            </div>
     
    498487        var url="<?php echo base_url();?>";
    499488        var current_tab="<?php echo $current_tab;?>";
     489
    500490</script>
    501491<?php
Note: See TracChangeset for help on using the changeset viewer.