Ignore:
Timestamp:
Nov 12, 2014 9:33:44 AM (11 years ago)
Author:
quyenla
Message:

thong ke cong tac vien

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

Legend:

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

    r461 r479  
    66class Report extends MX_Controller {
    77
    8 const TOKENPW = 'violet';
     8    const TOKENPW = 'violet';
    99
    1010    public function __construct() {
     
    193193    }
    194194
    195     public function get_username($us_id) {
     195    private function get_username($us_id) {
    196196        $src = 'violet';
    197197        $token = md5($us_id . self::TOKENPW);
    198198        $this->load->model('user_model');
    199199        $data = $this->user_model->get_user_info($src, $us_id, $token);
    200         if (strlen($data) > 0) {
     200        if (strpos($data, '&')) {
    201201            $arr_users = explode("&", $data);
    202202            $str_username = $arr_users[1];
     
    210210    public function test() {
    211211
    212 /*
    213         for ($i = 1; $i <= 5000; $i++) {
    214             $input['us_id'] = rand(1, 100);
    215             $input['paid_type'] = rand(1, 2);
    216             $input['amount'] = rand(3, 10) * 1000;
    217             $time = (rand((time() - (12 * 30 * 24 * 60 * 60)), time()));
    218             $input['paid_time'] = date("Y-m-d H:i:s", $time);
    219             $this->load->model('paidlog_model');
    220             $this->paidlog_model->insert($input);
    221         }
    222 
    223         die();
    224 */
     212        /*
     213          for ($i = 1; $i <= 5000; $i++) {
     214          $input['us_id'] = rand(1, 100);
     215          $input['paid_type'] = rand(1, 2);
     216          $input['amount'] = rand(3, 10) * 1000;
     217          $time = (rand((time() - (12 * 30 * 24 * 60 * 60)), time()));
     218          $input['paid_time'] = date("Y-m-d H:i:s", $time);
     219          $this->load->model('paidlog_model');
     220          $this->paidlog_model->insert($input);
     221          }
     222
     223          die();
     224         */
    225225        for ($i = 1; $i <= 200; $i++) {
    226226            $input['us_id'] = $i;
  • pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportAsistant.php

    r478 r479  
    66class ReportAsistant extends MX_Controller {
    77
    8 const TOKENPW = 'violet';
     8    const TOKENPW = 'violet';
    99
    1010    public function __construct() {
     
    2424        }
    2525    }
    26     public function viewAsistant()
    27     {
     26
     27    public function viewAsistant() {
    2828        $data = array();
    29        
     29
    3030        $admin_info = $this->session->userdata('adminInfo');
    3131        if ($admin_info) {
    32             $id=$this->uri->segment(3);
    33              $data['id']=$id;
     32            $id = $this->uri->segment(3);
     33            $data['id'] = $id;
    3434            $data['statistics'] = $this->getStatistics($id);
    35             $data['content'] = $this->getCollaboratorsUsers(array(),$id);
     35            $data['content'] = $this->getCollaboratorsUsers(array(), $id);
    3636            $this->load->view('reportAsistant/indexCollaborator', $data);
    3737        } else {
     
    4040    }
    4141
    42     public function getStatistics($id=false) {
     42    public function getStatistics($id = false) {
    4343        $data = array();
    4444
     
    4646
    4747        $this->load->model('collabolator_model');
    48         $collaborators = $this->collabolator_model->getAllCollaboratorUser($this_year['start'],$id);
    49         for ($i=1;$i<=12;$i++)
    50             {
    51             $statistics[$i]=0;
    52             }
    53         $y=date("Y");
     48        $collaborators = $this->collabolator_model->getAllCollaboratorUser($this_year['start'], $id);
     49        for ($i = 1; $i <= 12; $i++) {
     50            $statistics[$i] = 0;
     51        }
     52        $y = date("Y");
    5453        foreach ($collaborators as $collaborator) {
    55             for ($i=1;$i<=12;$i++)
    56             {
    57                 if ($i<12)
    58                 {
    59                 if (($collaborator['time'] > strtotime($y."-".$i."-1 00:00:00")) && (($collaborator['time'] < strtotime($y."-".($i+1)."-1 00:00:00"))))
    60                 {
    61                     $statistics[$i]++;
     54            for ($i = 1; $i <= 12; $i++) {
     55                if ($i < 12) {
     56                    if (($collaborator['time'] > strtotime($y . "-" . $i . "-1 00:00:00")) && (($collaborator['time'] < strtotime($y . "-" . ($i + 1) . "-1 00:00:00")))) {
     57                        $statistics[$i] ++;
     58                    }
     59                } else {
     60                    if (($collaborator['time'] > strtotime($y . "-" . $i . "-1 00:00:00")) && (($collaborator['time'] < strtotime(($y + 1) . "-1-1 00:00:00")))) {
     61                        $statistics[$i] ++;
     62                    }
    6263                }
    63                 }
    64                 else
    65                 {
    66                  if (($collaborator['time'] > strtotime($y."-".$i."-1 00:00:00")) && (($collaborator['time'] < strtotime(($y+1)."-1-1 00:00:00"))))
    67                 {
    68                     $statistics[$i]++;
    69                 }   
    70                 }
    71             }
    72         }
    73        
     64            }
     65        }
     66
    7467        $max = 0;
    7568        foreach ($statistics as $index => $total) {
     
    149142        return $this->load->view('reportAsistant/listview', $data, true);
    150143    }
    151    
    152     public function getCollaboratorsUsers($filters = array(),$id=false) {
    153    
     144
     145    public function getCollaboratorsUsers($filters = array(), $id = false) {
     146
    154147        $this->load->helper('pagging');
    155148        $this->load->model('collabolator_model');
    156149        $data['current_page'] = $this->uri->segment(5, 1);
    157  
     150
    158151        $data['itemsoptions'] = array(10, 25, 50, 100);
    159152        $data['perpage'] = 10;
    160         if (!$id)
    161         {
    162             $data['id']= $this->uri->segment(4, 1);
    163         }
    164         else {
    165         $data['id']=$id;
    166         }
    167              
     153        if (!$id) {
     154            $data['id'] = $this->uri->segment(4, 1);
     155        } else {
     156            $data['id'] = $id;
     157        }
     158
    168159        $data['keyword'] = "";
    169160        $data['sorting_order'] = "sorting_desc";
     
    191182        $data['total'] = $this->collabolator_model->countCountCollaboratorUsers($data);
    192183        $data['paidlogs'] = $this->collabolator_model->getCountCollaboratorUsers($data);
    193 
    194         $data['paging_url'] = base_url() . "/admin/thong_ke_cong_tac_vien/trang_ctv/".$data['id'];
     184        foreach ($data['paidlogs'] as $index=>$paidlog)
     185        {
     186            $data['paidlogs'][$index]['username']=$this->get_username($paidlog['us_id']);
     187        }
     188        $data['paging_url'] = base_url() . "/admin/thong_ke_cong_tac_vien/trang_ctv/" . $data['id'];
    195189        $data['num_links'] = 2;
    196190        $data['paging'] = pagging($data);
     
    202196    }
    203197
    204     public function get_username($us_id) {
     198    private function get_username($us_id) {
    205199        $src = 'violet';
    206200        $token = md5($us_id . self::TOKENPW);
    207201        $this->load->model('user_model');
    208202        $data = $this->user_model->get_user_info($src, $us_id, $token);
    209        
    210         if (strlen($data) > 0) {
     203        if (strpos($data, '&')) {
    211204            $arr_users = explode("&", $data);
    212205            $str_username = $arr_users[1];
  • pro-violet-viettel/sourcecode/application/modules/admin/views/reportAsistant/listview_user.php

    r465 r479  
    5454
    5555                                <td class=" ">
    56 
     56<?php echo $paidlog['username']; ?>
    5757                                   
    5858                                </td>
Note: See TracChangeset for help on using the changeset viewer.