Ignore:
Timestamp:
Nov 11, 2014 5:22:15 PM (11 years ago)
Author:
quyenla
Message:

Thong ke cong tac vien

Location:
pro-violet-viettel/sourcecode/application/modules/admin
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportAsistant.php

    r462 r464  
    2727    {
    2828        $data = array();
     29        $id=$this->uri->segment(3);
    2930        $admin_info = $this->session->userdata('adminInfo');
    3031        if ($admin_info) {
    31             $data['statistics'] = $this->getStatistics();
    32             $data['content'] = $this->getPaidlogs();
     32            $data['statistics'] = $this->getStatistics($id);
     33            $data['content'] = $this->getCollaboratorsUsers(array(),$id);
    3334            $this->load->view('reportAsistant/index', $data);
    3435        } else {
     
    3738    }
    3839
    39     public function getStatistics() {
     40    public function getStatistics($id=false) {
    4041        $data = array();
    4142
     
    4344
    4445        $this->load->model('collabolator_model');
    45         $collaborators = $this->collabolator_model->getAllCollaboratorUser($this_year['start']);
     46        $collaborators = $this->collabolator_model->getAllCollaboratorUser($this_year['start'],$id);
    4647        for ($i=1;$i<=12;$i++)
    4748            {
     
    134135
    135136        $data['start'] = ($data['current_page'] - 1) * $data['perpage'];
    136         $data['total'] = 100; //$this->collabolator_model->countPaidlog($data);
     137        $data['total'] = $this->collabolator_model->countCountCollaboratorUser($data);
    137138        $data['paidlogs'] = $this->collabolator_model->getCountCollaboratorUser($data);
    138139
     
    145146        }
    146147        return $this->load->view('reportAsistant/listview', $data, true);
     148    }
     149   
     150    public function getCollaboratorsUsers($filters = array(),$id=false) {
     151
     152        $this->load->helper('pagging');
     153        $this->load->model('collabolator_model');
     154        $data['current_page'] = $this->uri->segment(4, 1);
     155        $data['itemsoptions'] = array(10, 25, 50, 100);
     156        $data['perpage'] = 10;
     157        $data['id']=$id;
     158        $data['keyword'] = "";
     159        $data['sorting_order'] = "sorting_desc";
     160        $data['sorting_field'] = "id";
     161
     162        if ($this->input->post('sorting_order')) {
     163            if ($this->input->post('sorting_order') != "sorting") {
     164                $data['sorting_order'] = $this->input->post('sorting_order');
     165                $data['sorting_field'] = $this->input->post('sorting_field');
     166            }
     167        }
     168        if ($this->input->post('items')) {
     169            $data['perpage'] = $this->input->post('items');
     170        }
     171        if ($this->input->post('keyword')) {
     172            $data['search_field'] = "";
     173            $data['keyword'] = $this->input->post('keyword');
     174
     175            if (preg_match("/[0-9]/", $data['keyword'])) {
     176                $data['search_field'] = "cellphone";
     177            }
     178        }
     179
     180        $data['start'] = ($data['current_page'] - 1) * $data['perpage'];
     181        $data['total'] = $this->collabolator_model->countCountCollaboratorUsers($data);
     182        $data['paidlogs'] = $this->collabolator_model->getCountCollaboratorUsers($data);
     183
     184        $data['paging_url'] = base_url() . "/admin/thong_ke_cong_tac_vien/trang/";
     185        $data['num_links'] = 2;
     186        $data['paging'] = pagging($data);
     187
     188        if ($this->input->is_ajax_request()) {
     189            return $this->load->view('reportAsistant/listview_user', $data);
     190        }
     191        return $this->load->view('reportAsistant/listview_user', $data, true);
    147192    }
    148193
  • pro-violet-viettel/sourcecode/application/modules/admin/models/collabolator_model.php

    r461 r464  
    3434        return $this->db->query($sql . " " . $order . " LIMIT " . $data['start'] . ", " . $data['perpage'] . " ")->result_array();
    3535    }
    36     function getAllCollaboratorUser($from)
     36    function getAllCollaboratorUser($from,$id=false)
    3737    {
    3838        $from = date("Y-m-d 00:00:00",$from);
    39         $sql="SELECT *,tblcollaborator.created_time as collaborator_created_time, tbluser.created_time as user_created_time  FROM ".$this->table_name." INNER JOIN tbluser ON tbluser.collaborator = tblcollaborator.id WHERE tbluser.created_time > '".$from."'";
    40 
    41         $result = $this->db->query($sql)->result_array();
    42         foreach ($result as $index=>$paidlog)
    43         {
    44             $result[$index]['time']=  strtotime($paidlog['user_created_time']);
    45         }
    46         return $result;
     39        $where="";
     40        if ($id)
     41        {
     42            $where = " AND tbluser.collaborator = $id ";
     43        }
     44        $sql="SELECT *,tblcollaborator.created_time as collaborator_created_time, tbluser.created_time as user_created_time  FROM ".$this->table_name." INNER JOIN tbluser ON tbluser.collaborator = tblcollaborator.id WHERE tbluser.created_time > '".$from."'".$where."";
     45
     46        $result = $this->db->query($sql)->result_array();
     47        foreach ($result as $index=>$paidlog)
     48        {
     49            $result[$index]['time']=  strtotime($paidlog['user_created_time']);
     50        }
     51        return $result;
     52    }
     53    function countCountCollaboratorUser($data)
     54    {
     55        $order = "";
     56        if ($data['sorting_order'] != "sorting") {
     57           
     58                $sort = "DESC";
     59                if ($data['sorting_order'] == "sorting_asc")
     60                    $sort = "ASC";
     61                $order = "ORDER BY " . $data['sorting_field'] . " " . $sort;
     62           
     63        }
     64        $where="";
     65        if ($data['keyword']) {
     66            if ($data['search_field'] == "cellphone") {
     67                $where.=" WHERE (tblcollaborator.cellphone LIKE '%" . $data['keyword'] . "%')";
     68            } else {
     69                $where.=" WHERE (full_name LIKE '%" . $data['keyword'] . "%' OR login_name LIKE '%" . $data['keyword'] . "%') ";
     70            }
     71        }
     72       // $from = date("Y-m-d 00:00:00",$from);
     73        $sql="SELECT *,tblcollaborator.created_time as collaborator_created_time,tblcollaborator.cellphone as collaborator_cellphone, tbluser.created_time as user_created_time, COUNT(tbluser.collaborator) as total_user  FROM ".$this->table_name." INNER JOIN tbluser ON tbluser.collaborator = tblcollaborator.id ".$where." GROUP BY tblcollaborator.id ".$order." ";
     74       
     75        $result = $this->db->query($sql)->result_array();
     76       
     77
     78        return count($result);
    4779    }
    4880    function getCountCollaboratorUser($data)
     
    6799       // $from = date("Y-m-d 00:00:00",$from);
    68100        $sql="SELECT *,tblcollaborator.created_time as collaborator_created_time,tblcollaborator.cellphone as collaborator_cellphone, tbluser.created_time as user_created_time, COUNT(tbluser.collaborator) as total_user  FROM ".$this->table_name." INNER JOIN tbluser ON tbluser.collaborator = tblcollaborator.id ".$where." GROUP BY tblcollaborator.id ".$order." LIMIT " . $data['start'] . ", " . $data['perpage'] . " ";
    69         echo $sql;
    70         $result = $this->db->query($sql)->result_array();
    71         foreach ($result as $index=>$paidlog)
    72         {
    73             $result[$index]['time']=  strtotime($paidlog['user_created_time']);
    74         }
    75 
    76         return $result;
    77     }
     101       
     102        $result = $this->db->query($sql)->result_array();
     103        foreach ($result as $index=>$paidlog)
     104        {
     105            $result[$index]['time']=  strtotime($paidlog['user_created_time']);
     106        }
     107
     108        return $result;
     109    }
     110   
     111        function countCountCollaboratorUsers($data)
     112    {
     113        $order = "";
     114        if ($data['sorting_order'] != "sorting") {
     115           
     116                $sort = "DESC";
     117                if ($data['sorting_order'] == "sorting_asc")
     118                    $sort = "ASC";
     119                $order = "ORDER BY " . $data['sorting_field'] . " " . $sort;
     120           
     121        }
     122        $where="";
     123        if ($data['keyword']) {
     124            if ($data['search_field'] == "cellphone") {
     125                $where.=" WHERE (tblcollaborator.cellphone LIKE '%" . $data['keyword'] . "%')";
     126            } else {
     127                $where.=" WHERE (full_name LIKE '%" . $data['keyword'] . "%' OR login_name LIKE '%" . $data['keyword'] . "%') ";
     128            }
     129        }
     130       // $from = date("Y-m-d 00:00:00",$from);
     131        $sql="SELECT *,tblcollaborator.created_time as collaborator_created_time,tbluser.cellphone as user_cellphone,tblcollaborator.cellphone as collaborator_cellphone, tbluser.created_time as user_created_time  FROM ".$this->table_name." INNER JOIN tbluser ON tbluser.collaborator = tblcollaborator.id ".$where." AND tbluser.collaborator = ".$data['id']." ".$order."";
     132   
     133        $result = $this->db->query($sql)->result_array();
     134        foreach ($result as $index=>$paidlog)
     135        {
     136            $result[$index]['time']=  strtotime($paidlog['user_created_time']);
     137        }
     138
     139        return count($result);
     140    }
     141        function getCountCollaboratorUsers($data)
     142    {
     143        $order = "";
     144        if ($data['sorting_order'] != "sorting") {
     145           
     146                $sort = "DESC";
     147                if ($data['sorting_order'] == "sorting_asc")
     148                    $sort = "ASC";
     149                $order = "ORDER BY " . $data['sorting_field'] . " " . $sort;
     150           
     151        }
     152        $where="";
     153        if ($data['keyword']) {
     154            if ($data['search_field'] == "cellphone") {
     155                $where.=" WHERE (tblcollaborator.cellphone LIKE '%" . $data['keyword'] . "%')";
     156            } else {
     157                $where.=" WHERE (full_name LIKE '%" . $data['keyword'] . "%' OR login_name LIKE '%" . $data['keyword'] . "%') ";
     158            }
     159        }
     160       // $from = date("Y-m-d 00:00:00",$from);
     161        $sql="SELECT *,tblcollaborator.created_time as collaborator_created_time,tbluser.cellphone as user_cellphone,tblcollaborator.cellphone as collaborator_cellphone, tbluser.created_time as user_created_time  FROM ".$this->table_name." INNER JOIN tbluser ON tbluser.collaborator = tblcollaborator.id ".$where." AND tbluser.collaborator = ".$data['id']." ".$order." LIMIT " . $data['start'] . ", " . $data['perpage'] . " ";
     162   
     163        $result = $this->db->query($sql)->result_array();
     164        foreach ($result as $index=>$paidlog)
     165        {
     166            $result[$index]['time']=  strtotime($paidlog['user_created_time']);
     167        }
     168
     169        return $result;
     170    }
     171   
    78172    function isExist($data) {
    79173        $sql = "SELECT COUNT(id) as total FROM " . $this->table_name . " WHERE " . $data['field'] . " = '" . $data['value'] . "'";
  • pro-violet-viettel/sourcecode/application/modules/admin/views/collaborator/listview.php

    r461 r464  
    7777                        <thead>
    7878                            <tr role="row">
    79                                 <th class="center sorting_disabled" role="columnheader" rowspan="1" colspan="1" style="width: 44px;" aria-label="">
    80                                     <label>
    81                                         <input type="checkbox" class="ace">
    82                                         <span class="lbl"></span>
    83                                     </label>
    84                                 </th>
     79                               
    8580                             
    8681                                <th class="<?php if ($sorting_field == 'full_name') {echo $sorting_order;} else {echo "sorting";}?>" id="full_name" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 183px;" aria-label="Họ tên: activate to sort column ascending">Họ tên</th>
     
    10297                                ?>
    10398                            <tr class="odd">
    104                                 <td class="center  sorting_1">
    105                                     <label>
    106                                         <input type="checkbox" class="ace">
    107                                         <span class="lbl"></span>
    108                                     </label>
    109                                 </td>
     99                               
    110100
    111101                               
  • pro-violet-viettel/sourcecode/application/modules/admin/views/report/listview.php

    r446 r464  
    3636                        <thead>
    3737                            <tr role="row">
    38                                 <th class="center sorting_disabled" role="columnheader" rowspan="1" colspan="1" style="width: 44px;" aria-label="">
    39                                     <label>
    40                                         <input type="checkbox" class="ace">
    41                                         <span class="lbl"></span>
    42                                     </label>
    43                                 </th>
     38                               
    4439                                <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>
    4540                                <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>
     
    5752                                ?>
    5853                            <tr class="odd">
    59                                 <td class="center  sorting_1">
    60                                     <label>
    61                                         <input type="checkbox" class="ace">
    62                                         <span class="lbl"></span>
    63                                     </label>
    64                                 </td>
     54                               
    6555
    6656                                <td class=" ">
  • pro-violet-viettel/sourcecode/application/modules/admin/views/reportAsistant/listview.php

    r462 r464  
    3636                        <thead>
    3737                            <tr role="row">
    38                                 <th class="center sorting_disabled" role="columnheader" rowspan="1" colspan="1" style="width: 44px;" aria-label="">
    39                                     <label>
    40                                         <input type="checkbox" class="ace">
    41                                         <span class="lbl"></span>
    42                                     </label>
    43                                 </th>
     38                               
    4439                                <th class="<?php if ($sorting_field == 'full_name') {echo $sorting_order;} else {echo "sorting";}?>" 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 cộng tác viên</th>
    4540                                <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ố điện thoại</th>
     
    5651                                ?>
    5752                            <tr class="odd">
    58                                 <td class="center  sorting_1">
    59                                     <label>
    60                                         <input type="checkbox" class="ace">
    61                                         <span class="lbl"></span>
    62                                     </label>
    63                                 </td>
     53                               
    6454
    6555                                <td class=" ">
  • pro-violet-viettel/sourcecode/application/modules/admin/views/smstemplate/listview.php

    r461 r464  
    7474                        <thead>
    7575                            <tr role="row">
    76                                 <th class="center sorting_disabled" role="columnheader" rowspan="1" colspan="1" style="width: 44px;" aria-label="">
    77                                     <label>
    78                                         <input type="checkbox" class="ace">
    79                                         <span class="lbl"></span>
    80                                     </label>
    81                                 </th>
     76                               
    8277                             
    8378                                <th class="<?php if ($sorting_field == 'sms_content') {echo $sorting_order;} else {echo "sorting";}?>" id="sms_content" 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">Mẫu tin nhắn</th>
     
    9893                                ?>
    9994                            <tr class="odd">
    100                                 <td class="center  sorting_1">
    101                                     <label>
    102                                         <input type="checkbox" class="ace">
    103                                         <span class="lbl"></span>
    104                                     </label>
    105                                 </td>
    106 
     95                               
    10796                               
    10897                                <td class=" "><?php echo $smstemplate['sms_content']?></td>
Note: See TracChangeset for help on using the changeset viewer.