Changeset 761
- Timestamp:
- Feb 11, 2015 4:08:09 PM (10 years ago)
- 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 29 29 30 30 $this->load->model('reportmodel'); 31 $data['date']=1; 31 32 $data['month'] = date("m"); 32 33 $data['year'] = date("Y"); 34 $data['to_date']=31; 35 $data['to_month'] = date("m"); 36 $data['to_year'] = date("Y"); 33 37 if ($this->input->post('month')) { 34 38 $data['month'] = $this->input->post('month'); -
pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportprovince.php
r757 r761 30 30 31 31 $this->load->model('reportmodel'); 32 $data['date'] = 1; 32 33 $data['month'] = date("m"); 33 34 $data['year'] = date("Y"); 35 $data['to_date'] = 31; 36 $data['to_month'] = date("m"); 37 $data['to_year'] = date("Y"); 34 38 if ($this->input->post('month')) { 35 39 $data['month'] = $this->input->post('month'); … … 64 68 $sheet->getColumnDimension('G')->setWidth(15); 65 69 $sheet->getColumnDimension('H')->setWidth(15); 66 $sheet->getColumnDimension('I')->setWidth(20); 70 $sheet->getColumnDimension('I')->setWidth(15); 71 $sheet->getColumnDimension('J')->setWidth(15); 67 72 $sheet->setCellValue('A1', "Báo cáo thuê bao theo tá»nh"); 68 73 $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').""); 70 75 $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"); 79 85 $dem=0; 80 86 foreach ($data['provinces'] as $index => $provinces) { 81 87 $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']); 90 97 $dem++; 91 98 } … … 95 102 $writer->save('php://output'); 96 103 } 104 97 105 } -
pro-violet-viettel/sourcecode/application/modules/admin/models/reportmodel.php
r760 r761 16 16 17 17 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 23 22 $provinces = lang('_PROVINCES_'); 24 23 // Tinh doanh thu theo tinh theo nam … … 26 25 $query = $this->db->query($sql); 27 26 $dtns = $query->result_array(); 27 28 28 // 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' $extGROUP 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"; 30 30 $query = $this->db->query($sql); 31 31 $dtts = $query->result_array(); 32 32 33 // 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";34 34 if (isset($input['to_month'])) 35 35 { … … 45 45 46 46 // tinh thue bao theo thang 47 $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE tbluser.created_time >'" . $input['year'] . "-" . $input['month'] . "-01' $extGROUP BY tbluser.province";47 $sql = "SELECT *,count(us_id) as total FROM tbluser WHERE $from AND $to GROUP BY tbluser.province"; 48 48 $query = $this->db->query($sql); 49 49 $tbts = $query->result_array(); 50 50 51 51 // 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 57 54 $query = $this->db->query($sql); 58 55 $tbng = $query->result_array(); … … 104 101 $provinces = lang('_PROVINCES_'); 105 102 // 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 "; 107 104 $query = $this->db->query($sql); 108 105 $users = $query->result_array(); … … 160 157 } 161 158 public function exportProvince($input) 162 { 159 { 160 //$input['date']=1; 163 161 //$input['month']=1; 164 162 //$input['year']=2014; … … 183 181 public function exportPackage($input) 184 182 { 183 // $input['date']=1; 185 184 //$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; 187 189 if (isset($input['month'])) 188 190 {
Note: See TracChangeset
for help on using the changeset viewer.