Ignore:
Timestamp:
Nov 11, 2014 4:41:59 PM (11 years ago)
Author:
quyenla
Message:

Thong ke cong tac vien

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/sourcecode/application/modules/admin/models/collabolator_model.php

    r420 r461  
    3434        return $this->db->query($sql . " " . $order . " LIMIT " . $data['start'] . ", " . $data['perpage'] . " ")->result_array();
    3535    }
     36    function getAllCollaboratorUser($from)
     37    {
     38        $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."'";
    3640
     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;
     47    }
     48    function getCountCollaboratorUser($data)
     49    {
     50        $order = "";
     51        if ($data['sorting_order'] != "sorting") {
     52           
     53                $sort = "DESC";
     54                if ($data['sorting_order'] == "sorting_asc")
     55                    $sort = "ASC";
     56                $order = "ORDER BY " . $data['sorting_field'] . " " . $sort;
     57           
     58        }
     59        $where="";
     60        if ($data['keyword']) {
     61            if ($data['search_field'] == "cellphone") {
     62                $where.=" WHERE (tblcollaborator.cellphone LIKE '%" . $data['keyword'] . "%')";
     63            } else {
     64                $where.=" WHERE (full_name LIKE '%" . $data['keyword'] . "%' OR login_name LIKE '%" . $data['keyword'] . "%') ";
     65            }
     66        }
     67       // $from = date("Y-m-d 00:00:00",$from);
     68        $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    }
    3778    function isExist($data) {
    3879        $sql = "SELECT COUNT(id) as total FROM " . $this->table_name . " WHERE " . $data['field'] . " = '" . $data['value'] . "'";
Note: See TracChangeset for help on using the changeset viewer.