Changeset 761


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

report

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

Legend:

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

    r756 r761  
    2929
    3030        $this->load->model('reportmodel');
     31        $data['date']=1;
    3132        $data['month'] = date("m");
    3233        $data['year'] = date("Y");
     34        $data['to_date']=31;
     35        $data['to_month'] = date("m");
     36        $data['to_year'] = date("Y");
    3337        if ($this->input->post('month')) {
    3438            $data['month'] = $this->input->post('month');
  • pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportprovince.php

    r757 r761  
    3030
    3131        $this->load->model('reportmodel');
     32        $data['date'] = 1;
    3233        $data['month'] = date("m");
    3334        $data['year'] = date("Y");
     35        $data['to_date'] = 31;
     36        $data['to_month'] = date("m");
     37        $data['to_year'] = date("Y");
    3438        if ($this->input->post('month')) {
    3539            $data['month'] = $this->input->post('month');
     
    6468        $sheet->getColumnDimension('G')->setWidth(15);
    6569        $sheet->getColumnDimension('H')->setWidth(15);
    66         $sheet->getColumnDimension('I')->setWidth(20);
     70        $sheet->getColumnDimension('I')->setWidth(15);
     71        $sheet->getColumnDimension('J')->setWidth(15);
    6772        $sheet->setCellValue('A1', "Báo cáo thuê bao theo tỉnh");
    6873        $sheet->setCellValue('A2', "Tháng: " . $data['month'] . " - " . $data['year']);
    69         $sheet->setCellValue('C2', "Ngày: ".date('d')." - ".date('m')." - ". date('Y')."");
     74        //$sheet->setCellValue('C2', "Ngày: ".date('d')." - ".date('m')." - ". date('Y')."");
    7075        $sheet->setCellValue('A4', "STT");
    71         $sheet->setCellValue('B4', "Mã Tỉnh/Thành Phố");
    72         $sheet->setCellValue('C4', "Tỉnh/Thành phố");
    73         $sheet->setCellValue('D4', "TB Ngày");
    74         $sheet->setCellValue('E4', "LÅ©y kế TB tháng");
    75         $sheet->setCellValue('F4', "Tổng TB Ngày");
    76         $sheet->setCellValue('G4', "DT Ngày");
    77         $sheet->setCellValue('H4', "LÅ©y kế DT tháng");
    78         $sheet->setCellValue('I4', "Tổng DT năm");
     76        $sheet->setCellValue('B4', "Ngày");
     77        $sheet->setCellValue('C4', "Mã Tỉnh/Thành Phố");
     78        $sheet->setCellValue('D4', "Tỉnh/Thành phố");
     79        $sheet->setCellValue('E4', "TB Ngày");
     80        $sheet->setCellValue('F4', "LÅ©y kế TB tháng");
     81        $sheet->setCellValue('G4', "Tổng TB Ngày");
     82        $sheet->setCellValue('H4', "DT Ngày");
     83        $sheet->setCellValue('I4', "LÅ©y kế DT tháng");
     84        $sheet->setCellValue('J4', "Tổng DT năm");
    7985        $dem=0;
    8086        foreach ($data['provinces'] as $index => $provinces) {
    8187            $sheet->setCellValue('A' . ($dem + 5), $provinces['stt']);
    82             $sheet->setCellValue('B' . ($dem + 5), $index);
    83             $sheet->setCellValue('C' . ($dem + 5), $provinces['province']);
    84             $sheet->setCellValue('D' . ($dem + 5), $provinces['tbng']);
    85             $sheet->setCellValue('E' . ($dem + 5), $provinces['tbt']);
    86             $sheet->setCellValue('F' . ($dem + 5), $provinces['tbn']);
    87             $sheet->setCellValue('G' . ($dem + 5), $provinces['dtng']);
    88             $sheet->setCellValue('H' . ($dem + 5), $provinces['dtt']);
    89             $sheet->setCellValue('I' . ($dem + 5), $provinces['dtn']);
     88            $sheet->setCellValue('B' . ($dem + 5), date('d')." - ".date('m')." - ". date('Y'));
     89            $sheet->setCellValue('C' . ($dem + 5), $index);
     90            $sheet->setCellValue('D' . ($dem + 5), $provinces['province']);
     91            $sheet->setCellValue('E' . ($dem + 5), $provinces['tbng']);
     92            $sheet->setCellValue('F' . ($dem + 5), $provinces['tbt']);
     93            $sheet->setCellValue('G' . ($dem + 5), $provinces['tbn']);
     94            $sheet->setCellValue('H' . ($dem + 5), $provinces['dtng']);
     95            $sheet->setCellValue('I' . ($dem + 5), $provinces['dtt']);
     96            $sheet->setCellValue('J' . ($dem + 5), $provinces['dtn']);
    9097            $dem++;
    9198        }
     
    95102        $writer->save('php://output');
    96103    }
     104   
    97105}
  • pro-violet-viettel/sourcecode/application/modules/admin/models/reportmodel.php

    r760 r761  
    1616
    1717    function getProvinces($input) {
    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         }
     18
     19        $from="tblpaidlog.paid_time >'" . $input['year'] . "-" . $input['month'] . "-" . $input['date'] . " 00:00:00'";
     20        $to="tblpaidlog.paid_time <'" . $input['to_year'] . "-" . $input['to_month'] . "-" . $input['to_date'] . " 23:59:59'";
     21       
    2322        $provinces = lang('_PROVINCES_');
    2423        // Tinh doanh thu theo tinh theo nam
     
    2625        $query = $this->db->query($sql);
    2726        $dtns = $query->result_array();
     27       
    2828        // tinh doanh thu theo thang
    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";
     29        $sql = "SELECT *,SUM(amount) as total FROM tblpaidlog LEFT JOIN tbluser ON tbluser.us_id=tblpaidlog.us_id WHERE $from AND $to  GROUP BY tbluser.province";
    3030        $query = $this->db->query($sql);
    3131        $dtts = $query->result_array();
     32       
    3233        // tinh doanh thu trong ngay hien tai
    33         $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";
    3434        if (isset($input['to_month']))
    3535        {
     
    4545
    4646        // tinh thue bao theo thang
    47         $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >'" . $input['year'] . "-" . $input['month'] . "-01'  $ext GROUP BY tbluser.province";
     47        $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE $from AND  $to GROUP BY tbluser.province";
    4848        $query = $this->db->query($sql);
    4949        $tbts = $query->result_array();
    5050       
    5151         // tinh thue bao theo ngay
    52         $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         }
     52        $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";
     53       
    5754        $query = $this->db->query($sql);
    5855        $tbng = $query->result_array();
     
    104101        $provinces = lang('_PROVINCES_');
    105102        // tinh thue bao theo thang
    106         $sql = "SELECT * FROM tbluser LEFT JOIN tblservicepackage ON tbluser.p_id=tblservicepackage.p_id  WHERE tbluser.created_time >'" . $input['year'] . "-" . $input['month'] . "-01' AND tbluser.created_time <'" . $input['year'] . "-" . $input['month'] . "-31' AND tblservicepackage.p_period > 0 ";
     103        $sql = "SELECT * FROM tbluser LEFT JOIN tblservicepackage ON tbluser.p_id=tblservicepackage.p_id  WHERE tbluser.created_time >'" . $input['year'] . "-" . $input['month'] . "-" . $input['date'] . "' AND tbluser.created_time <'" . $input['to_year'] . "-" . $input['to_month'] . "-" . $input['to_date'] . "' AND tblservicepackage.p_period > 0 ";
    107104        $query = $this->db->query($sql);
    108105        $users = $query->result_array();
     
    160157    }
    161158    public function exportProvince($input)
    162     {
     159    {   
     160        //$input['date']=1;
    163161        //$input['month']=1;
    164162        //$input['year']=2014;
     
    183181    public function exportPackage($input)
    184182    {
     183       // $input['date']=1;
    185184        //$input['month']=1;
    186         //$input['year']=2014;
     185      //  $input['year']=2014;
     186      // $input['to_month']=1;
     187       // $input['to_year']=2015;
     188       // $input['to_date']=15;
    187189        if (isset($input['month']))
    188190        {
Note: See TracChangeset for help on using the changeset viewer.