Changeset 757


Ignore:
Timestamp:
Feb 10, 2015 4:08:39 PM (10 years ago)
Author:
quyenla
Message:

report update

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

Legend:

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

    r756 r757  
    9595        $writer->save('php://output');
    9696    }
    97  
    98 
    9997}
  • pro-violet-viettel/sourcecode/application/modules/admin/models/reportmodel.php

    r755 r757  
    1616
    1717    function getProvinces($input) {
    18 
     18        $ext="";
     19        if (isset($input['to_month']))
     20        {
     21            $ext="AND tblpaidlog.paid_time <'" . $input['to_year'] . "-" . $input['to_month'] . "-01 23:59:59'";
     22        }
    1923        $provinces = lang('_PROVINCES_');
    2024        // Tinh doanh thu theo tinh theo nam
     
    2327        $dtns = $query->result_array();
    2428        // tinh doanh thu theo thang
    25         $sql = "SELECT *,SUM(amount) as total FROM tblpaidlog LEFT JOIN tbluser ON tbluser.us_id=tblpaidlog.us_id WHERE tblpaidlog.paid_time >'" . $input['year'] . "-" . $input['month'] . "-01' GROUP BY tbluser.province";
     29        $sql = "SELECT *,SUM(amount) as total FROM tblpaidlog LEFT JOIN tbluser ON tbluser.us_id=tblpaidlog.us_id WHERE tblpaidlog.paid_time >'" . $input['year'] . "-" . $input['month'] . "-01' $ext GROUP BY tbluser.province";
    2630        $query = $this->db->query($sql);
    2731        $dtts = $query->result_array();
    2832        // tinh doanh thu trong ngay hien tai
    2933        $sql = "SELECT *,SUM(amount) as total FROM tblpaidlog LEFT JOIN tbluser ON tbluser.us_id=tblpaidlog.us_id WHERE tblpaidlog.paid_time > '" . date('Y') . "-" . date('m') . "-".date('d')." 00:00:00' AND  tblpaidlog.paid_time <'" . date('Y') . "-" . date('m') . "-".date('d')." 23:59:59'  GROUP BY tbluser.province";
    30        
     34        if (isset($input['to_month']))
     35        {
     36        $sql = "SELECT *,SUM(amount) as total FROM tblpaidlog LEFT JOIN tbluser ON tbluser.us_id=tblpaidlog.us_id WHERE tblpaidlog.paid_time > '" . $input['to_year'] . "-" . $input['to_month'] . "-".$input['to_date']." 00:00:00' AND  tblpaidlog.paid_time <'" . $input['to_year'] . "-" . $input['to_month'] . "-".$input['to_date']." 23:59:59'  GROUP BY tbluser.province";
     37        }
    3138        $query = $this->db->query($sql);
    3239        $dtng = $query->result_array();
     
    3845
    3946        // tinh thue bao theo thang
    40         $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >'" . $input['year'] . "-" . $input['month'] . "-01'  GROUP BY tbluser.province";
     47        $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >'" . $input['year'] . "-" . $input['month'] . "-01'  $ext GROUP BY tbluser.province";
    4148        $query = $this->db->query($sql);
    4249        $tbts = $query->result_array();
     
    4451         // tinh thue bao theo ngay
    4552        $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >'" . date('Y') . "-" . date('m') . "-".date('d')." 00:00:00' AND tbluser.created_time < '" . date('Y') . "-" . date('m') . "-".date('d')." 23:59:59'  GROUP BY tbluser.province";
     53        if (isset($input['to_month']))
     54        {
     55            $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >'" . $input['to_year'] . "-" . $input['to_month'] . "-".$input['to_date']." 00:00:00' AND tbluser.created_time < '" . $input['to_year'] . "-" . $input['to_month'] . "-".$input['to_date']." 23:59:59'  GROUP BY tbluser.province";
     56        }
    4657        $query = $this->db->query($sql);
    4758        $tbng = $query->result_array();
     
    154165        //$input['month']=1;
    155166        //$input['year']=2014;
     167        //$input['to_month']=1;
     168        //$input['to_year']=2015;
     169        //$input['to_date']=15;
    156170        $data=$this->getProvinces($input);
    157171        return $data;
     
    159173    public function exportPackage($input)
    160174    {
    161        // $input['month']=1;
    162        //svn  $input['year']=2014;
     175        //$input['month']=1;
     176        //svn  $input['year']=2014;
    163177        $data=$this->getPackages($input);
    164178        return $data;
Note: See TracChangeset for help on using the changeset viewer.