Changeset 745


Ignore:
Timestamp:
Feb 6, 2015 11:11:32 AM (10 years ago)
Author:
quyenla
Message:

report

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

    r737 r745  
    7979        $sheet->getColumnDimension('H')->setWidth(15);
    8080        $sheet->setCellValue('A1', "Báo cáo thuê bao theo tỉnh");
    81         $sheet->setCellValue('A2', "Thời gian: " . $data['month'] . " - " . $data['year']);
     81        $sheet->setCellValue('A2', "Tháng: " . $data['month'] . " - " . $data['year']);
     82        $sheet->setCellValue('C2', "Ngày: ".date('d')." - ".date('m')." - ". date('Y')."");
    8283        $sheet->setCellValue('A4', "STT");
    8384        $sheet->setCellValue('B4', "Tỉnh/Thành phố");
  • pro-violet-viettel/sourcecode/application/modules/admin/models/reportmodel.php

    r728 r745  
    2323        $dtns = $query->result_array();
    2424        // 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' AND tblpaidlog.paid_time <'" . $input['year'] . "-" . $input['month'] . "-31' GROUP BY tbluser.province";
     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";
    2626        $query = $this->db->query($sql);
    2727        $dtts = $query->result_array();
    28 
     28        // tinh doanh thu trong ngay hien tai
     29        $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       
     31        $query = $this->db->query($sql);
     32        $dtng = $query->result_array();
    2933
    3034        // Tinh thue bao theo tinh theo nam
     
    3438
    3539        // tinh thue bao theo thang
    36         $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >'" . $input['year'] . "-" . $input['month'] . "-01' AND tbluser.created_time <'" . $input['year'] . "-" . $input['month'] . "-31' GROUP BY tbluser.province";
     40        $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >'" . $input['year'] . "-" . $input['month'] . "-01' GROUP BY tbluser.province";
    3741        $query = $this->db->query($sql);
    3842        $tbts = $query->result_array();
     43       
     44         // tinh thue bao theo ngay
     45        $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";
     46        $query = $this->db->query($sql);
     47        $tbng = $query->result_array();
     48       
    3949
    4050
     
    4555                    $provinces[$index2]['dtn'] = $data['total'];
    4656                }
     57            }
     58            foreach ($dtng as $data) {
     59                if ($province == $data['province']) {
     60                    $provinces[$index2]['dtng'] = $data['total'];
     61                }
    4762            }
    4863            foreach ($dtts as $data) {
    4964                if ($province == $data['province']) {
    5065                    $provinces[$index2]['dtt'] = $data['total'];
    51                     $provinces[$index2]['dtng'] = round($data['total'] / $input['month_days'], 2);
     66                   
    5267                }
    5368            }
     
    6075                }
    6176            }
     77            foreach ($tbng as $data) {
     78                if ($province == $data['province']) {
     79                    $provinces[$index2]['tbng'] = $data['total'];
     80                }
     81            }
    6282            foreach ($tbts as $data) {
    6383                if ($province == $data['province']) {
    6484                    $provinces[$index2]['tbt'] = $data['total'];
    65                     $provinces[$index2]['tbng'] = round($data['total'] / $input['month_days'], 2);
    6685                }
    6786            }
Note: See TracChangeset for help on using the changeset viewer.