Ignore:
Timestamp:
Apr 7, 2015 1:52:40 PM (10 years ago)
Author:
namnd
Message:
 
File:
1 edited

Legend:

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

    r838 r883  
    2828                $provinces = lang ( '_PROVINCES_' );
    2929                // Tinh doanh thu theo tinh theo nam
    30                 $sql = "SELECT *,SUM(amount) as total FROM tblpaidlog LEFT JOIN tbluser ON tbluser.us_id=tblpaidlog.us_id WHERE tblpaidlog.paid_time >= '" . $input ['year'] . "-01-01' AND tblpaidlog.paid_time <= '" . ($input ['year'] + 1) . "-01-01' GROUP BY tbluser.province";
     30                //$sql = "SELECT *,SUM(amount) as total FROM tblpaidlog LEFT JOIN tbluser ON tbluser.us_id=tblpaidlog.us_id WHERE tblpaidlog.paid_time >= '" . $input ['year'] . "-01-01' AND tblpaidlog.paid_time <= '" . ($input ['year'] + 1) . "-01-01' GROUP BY tbluser.province";
     31                $sql = "SELECT *,SUM(amount) as total FROM tblpaidlog LEFT JOIN tbluser ON tbluser.us_id=tblpaidlog.us_id WHERE tblpaidlog.paid_time >= '" . $input ['year'] . "-01-01 00:00:00' AND tblpaidlog.paid_time <= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" .$input['to_date']. " 23:59:59' GROUP BY tbluser.province";
    3132                $query = $this->db->query ( $sql );
    3233                $dtns = $query->result_array ();
     
    4647               
    4748                // Tinh thue bao theo tinh theo nam
    48                 $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >= '" . $input ['year'] . "-01-01 00:00:00' AND tbluser.created_time <= '" . ($input ['year'] + 1) . "-01-01 23:59:59' GROUP BY tbluser.province";
    49                 $query = $this->db->query ( $sql );
    50                 write_file('./log/test.log', date('d-m-Y H:i:s').": ".$sql."\n", FOPEN_WRITE_CREATE);
     49                //$sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >= '" . $input ['year'] . "-01-01 00:00:00' AND tbluser.created_time <= '" . ($input ['year'] + 1) . "-01-01 23:59:59' GROUP BY tbluser.province";
     50                $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >= '" . $input ['year'] . "-01-01 00:00:00' AND tbluser.created_time <= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" .$input['to_date']. " 23:59:59' GROUP BY tbluser.province";
     51                $query = $this->db->query ( $sql );
    5152                $tbns = $query->result_array ();
    5253               
     
    146147                // tinh thue bao theo thang
    147148                //$sql = "SELECT * FROM tbluser LEFT JOIN tblservicepackage ON tbluser.p_id=tblservicepackage.p_id LEFT JOIN tblregisterpackagelog ON tbluser.cellphone = tblregisterpackagelog.username WHERE tbluser.updated_time >= '" . $input ['year'] . "-" . $input ['month'] . "-" . $input ['date'] . "' AND tbluser.updated_time <= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" . $input ['to_date'] . "' AND tblregisterpackagelog.created_time >= '" . $input ['year'] . "-" . $input ['month'] . "-" . $input ['date'] . "' AND tblregisterpackagelog.created_time <= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" . $input ['to_date'] . "' AND tblservicepackage.p_period > 0 ";
    148                 $sql = "SELECT * FROM tbluser LEFT JOIN tblregisterpackagelog ON tbluser.cellphone = tblregisterpackagelog.username WHERE tbluser.updated_time >= '" . $input ['year'] . "-" . $input ['month'] . "-" . $input ['date'] . "' AND tbluser.updated_time <= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" . $input ['to_date'] . "' AND tblregisterpackagelog.created_time >= '" . $input ['year'] . "-" . $input ['month'] . "-" . $input ['date'] . "' AND tblregisterpackagelog.created_time <= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" . $input ['to_date'] . "'";
     149                $sql = "SELECT * FROM tbluser LEFT JOIN tblregisterpackagelog ON tbluser.cellphone = tblregisterpackagelog.username WHERE tbluser.updated_time >= '" . $input ['year'] . "-" . $input ['month'] . "-" . $input ['date'] . " 00:00:00' AND tbluser.updated_time <= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" . $input ['to_date'] . " 23:59:59' AND tblregisterpackagelog.created_time >= '" . $input ['year'] . "-" . $input ['month'] . "-" . $input ['date'] . " 00:00:00' AND tblregisterpackagelog.created_time <= '" . $input ['to_year'] . "-" . $input ['to_month'] . "-" . $input ['to_date'] . " 23:59:59'";
    149150                $query = $this->db->query ( $sql );
    150151                $users = $query->result_array ();
     152                //write_file('./log/sql.log', date("d-m-Y H:i:s").": ".$sql."\n", FOPEN_WRITE_CREATE);
    151153               
    152154                $sql = "SELECT * FROM tblservicepackage WHERE p_period>0";
Note: See TracChangeset for help on using the changeset viewer.