- Timestamp:
- Apr 7, 2015 1:52:40 PM (10 years ago)
- Location:
- pro-violet-viettel/sourcecode/application/modules/admin/controllers
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pro-violet-viettel/sourcecode/application/modules/admin/controllers/report.php
r818 r883 15 15 public function index() { 16 16 $data = array(); 17 17 18 $admin_info = $this->session->userdata('adminInfo'); 18 19 if ($admin_info) { 19 20 $data['statistics'] = $this->getStatistics(); 20 21 $data['content'] = $this->getPaidlogs(); 21 22 $this->load->view('report/index', $data); … … 30 31 return $this->load->view('report/statistics', $data, true); 31 32 } 32 33 33 34 34 35 public function getPaidlogs($filters = array()) { … … 69 70 $data ['paid_type'] = ( int ) $this->input->post ( 'paid_type' ); 70 71 } 71 72 72 $data['daterange_start'] = ""; 73 73 $data['daterange_end'] = ""; … … 78 78 } 79 79 $data['start'] = ($data['current_page'] - 1) * $data['perpage']; 80 80 81 $data['total'] = $this->paidlog_model->countPaidlog($data); 81 $data['paidlogs'] = $this->paidlog_model->getPaidlogs($data)['paid_logs']; 82 $data['total_amount'] = $this->paidlog_model->getPaidlogs($data)['total_amount']; 82 $result = $this->paidlog_model->getPaidlogs($data); 83 $data['paidlogs'] = $result['paid_logs']; 84 $data['total_amount'] = $result['total_amount']; 83 85 84 86 $data['paging_url'] = base_url() . "/admin/doanh_thu_tong_hop/trang/"; 85 87 $data['num_links'] = 2; 86 88 $data['paging'] = pagging($data); 89 90 87 91 foreach ($data['paidlogs'] as $index => $paidlog) { 88 92 $data['paidlogs'][$index]['username'] = @$this->get_fullname($paidlog['us_id']); … … 93 97 } 94 98 return $this->load->view('report/listview', $data, true); 99 95 100 } 96 101 … … 137 142 } 138 143 } 139 144 140 145 public function export(){ 146 141 147 $this->load->model('paidlog_model'); 142 148 $data ['paid_types'] = array ( … … 157 163 $data['daterange_end'] = date('Y-m-d 23:59:59', strtotime($daterange[1])); 158 164 } 165 159 166 $data['total'] = $this->paidlog_model->countPaidlog($data); 160 $data['paidlogs'] = $this->paidlog_model->getPaidlogs($data)['paid_logs']; 161 $data['total_amount'] = $this->paidlog_model->getPaidlogs($data)['total_amount']; 167 $result = $this->paidlog_model->getPaidlogs($data); 168 $data['paidlogs'] = $result['paid_logs']; 169 $data['total_amount'] = $result['total_amount']; 162 170 163 171 foreach ($data['paidlogs'] as $index => $paidlog) { … … 177 185 178 186 179 187 180 188 $sheet->setCellValue('B1', "TẬP ÄOÃN VIá»N THÃNG QUÃN Äá»I"); 181 189 $style = array( … … 278 286 ) 279 287 ); 280 288 281 289 $dem=0; 282 290 foreach ($data['paidlogs'] as $index => $paidlog) { … … 297 305 $dem++; 298 306 } 307 299 308 $writer = new PHPExcel_Writer_Excel5($this->phpexcel); 300 309 header('Content-Type: application/vnd.ms-excel'); 301 310 header('Content-Disposition: attachment; filename="bao_cao_tong_hop_'.date('d-m-Y').'.xls"'); 302 311 $writer->save('php://output'); 312 303 313 } 304 314 } -
pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportpackage.php
r818 r883 29 29 30 30 $this->load->model('reportmodel'); 31 $data['date']= 1;31 $data['date']=date("d"); 32 32 $data['month'] = date("m"); 33 33 $data['year'] = date("Y"); 34 $data['to_date']= 31;34 $data['to_date']= date("d"); 35 35 $data['to_month'] = date("m"); 36 36 $data['to_year'] = date("Y"); 37 37 if ($this->input->post('month')) { 38 $data['date']= $this->input->post('date'); 38 39 $data['month'] = $this->input->post('month'); 39 40 $data['year'] = $this->input->post('year'); 41 $data['to_date'] = $this->input->post('to_date'); 42 $data['to_month'] = $this->input->post('to_month'); 43 $data['to_year'] = $this->input->post('to_year'); 40 44 } 41 45 $data = $this->getdays($data); … … 70 74 public function export() { 71 75 $this->load->model('reportmodel'); 72 $data['date']=1; 73 $data['month'] = $this->uri->segment(4); 74 $data['year'] = $this->uri->segment(5); 75 $data['to_date']=31; 76 $data['to_month'] = date("m"); 77 $data['to_year'] = date("Y"); 78 $data = $this->getdays($data); 76 //$data['date']=1; 77 $data['date'] = $this->uri->segment(4); 78 $data['month'] = $this->uri->segment(5); 79 $data['year'] = $this->uri->segment(6); 80 $data['to_date'] = $this->uri->segment(8); 81 $data['to_month'] = $this->uri->segment(9); 82 $data['to_year'] = $this->uri->segment(10); 83 //$data = $this->getdays($data); 79 84 $result = $this->reportmodel->getPackages($data); 80 85 $data['provinces'] = $result['provinces']; … … 85 90 $sheet = $this->phpexcel->getActiveSheet(); 86 91 $sheet->setTitle("bao cao thue bao " . $data['month'] . " - " . $data['year']); 87 $sheet->getColumnDimension('A')->setWidth(10);92 $sheet->getColumnDimension('A')->setWidth(10); 88 93 $sheet->getColumnDimension('B')->setWidth(25); 89 $sheet->getColumnDimension('C')->setWidth( 15);94 $sheet->getColumnDimension('C')->setWidth(25); 90 95 $sheet->getColumnDimension('D')->setWidth(15); 91 96 $sheet->getColumnDimension('E')->setWidth(15); 92 97 $sheet->getColumnDimension('F')->setWidth(15); 93 98 $sheet->getColumnDimension('G')->setWidth(15); 94 $sheet->getColumnDimension('H')->setWidth(15); 95 $sheet->setCellValue('A1', "Báo cáo doanh thu theo tá»nh"); 96 $sheet->setCellValue('A2', "Thá»i gian: " . $data['month'] . " - " . $data['year']); 97 $sheet->setCellValue('A4', "STT"); 98 $sheet->setCellValue('B4', "Mã Tá»nh/Thà nh phá»"); 99 $sheet->setCellValue('C4', "Tá»nh/Thà nh phá»"); 99 $sheet->getColumnDimension('H')->setWidth(15); 100 $sheet->getColumnDimension('I')->setWidth(15); 101 $sheet->getColumnDimension('J')->setWidth(15); 102 103 $sheet->setCellValue('B1', "TẬP ÄOÃN VIá»N THÃNG QUÃN Äá»I"); 104 $style = array( 105 'font' => array('bold' => true, 'size' => 12, 'name' =>'Cambria', 'color' => array('rgb' => '0070bf')), 106 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 107 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 108 'wrap' => true ) 109 ); 110 $sheet->mergeCells('B1:K1'); 111 $sheet->getStyle('B1')->applyFromArray($style); 112 113 $sheet->setCellValue('B2', "Tá»NG CÃNG TY VIá»N THÃNG VIETTEL"); 114 115 $style = array( 116 'font' => array('size' => 12, 'name' =>'Cambria', 'color' => array('rgb' => '0070bf')), 117 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 118 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 119 'wrap' => true ) 120 ); 121 $sheet->mergeCells('B2:K2'); 122 $sheet->getStyle('B2')->applyFromArray($style); 123 124 $style = array( 125 'font' => array('bold' => true,'size' => 12, 'name' =>'Cambria'), 126 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 127 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 128 'wrap' => true ) 129 ); 130 $sheet->setCellValue('A4', "BÃO CÃO DOANH THU THEO Tá»NH"); 131 $sheet->mergeCells('A4:L4'); 132 $sheet->getStyle('A4:L4')->applyFromArray($style); 133 134 135 $style = array( 136 'font' => array('size' => 11, 'name' =>'Cambria'), 137 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_LEFT, 138 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 139 'wrap' => true ), 140 'borders' => array( 141 'allborders' => array( 142 'style' => \PHPExcel_Style_Border::BORDER_THIN 143 ) 144 ) 145 ); 146 147 $sheet->setCellValue('B6', "Từ ngà y: ".$data['date']."/".$data['month']."/".$data['year']); 148 $sheet->setCellValue('C6', "Äến ngà y: ".$data['to_date']."/".$data['to_month']."/".$data['to_year']); 149 $sheet->setCellValue('B7', "Ngà y kết xuất: ".date("d")."/".date("m")."/".date("Y")); 150 $sheet->setCellValue('C7', "Nhân viên kết xuất: "); 151 152 $sheet->getStyle('B6:C7')->applyFromArray($style); 153 154 $style = array( 155 'font' => array('bold' => true, 'size' => 11, 'name' =>'Cambria'), 156 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 157 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 158 'wrap' => true ), 159 'borders' => array( 160 'allborders' => array( 161 'style' => \PHPExcel_Style_Border::BORDER_THIN 162 ) 163 ) 164 ); 165 166 $sheet->setCellValue('A9', "STT"); 167 $sheet->setCellValue('B9', "Mã Tá»nh/Thà nh phá»"); 168 $sheet->setCellValue('C9', "Tá»nh/Thà nh phá»"); 169 $sheet->getStyle('A9:C9')->applyFromArray($style); 170 100 171 $chars = array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"); 101 172 $dem = 2; 102 $stt =1;173 $stt = 1; 103 174 foreach ($data['packages'] as $package) { 104 175 $dem++; 105 $sheet->setCellValue($chars[$dem] . " 4", $package['p_name']);176 $sheet->setCellValue($chars[$dem] . "9", $package['p_name']); 106 177 $dem++; 107 $sheet->setCellValue($chars[$dem] . " 4", "Tá» lá» %");178 $sheet->setCellValue($chars[$dem] . "9", "Tá» lá» %"); 108 179 109 180 $stt++; 110 181 } 111 182 $dem++; 112 $sheet->setCellValue($chars[$dem] . ($index + 4), "Tá»ng TB"); 113 114 $stt=1; 183 $sheet->setCellValue($chars[$dem] . ($index + 9), "Tá»ng TB"); 184 $sheet->getStyle('A9:'.$chars[$dem] . ($index + 9))->applyFromArray($style); 185 186 //$sheet->getStyle($chars[$dem].($index + 9))->applyFromArray($style); 187 188 $sheet->setCellValue('A10', "Tá»ng"); 189 $sheet->mergeCells('A10:C10'); 190 $sheet->getStyle('A10:'.$chars[$dem].($index + 10))->applyFromArray($style); 191 192 $dem = 2; 193 194 foreach ($data['totalVip'] as $vipName=>$totalVip){ 195 $dem++; 196 $sheet->setCellValue($chars[$dem] . '10', $totalVip); 197 $sheet->getStyle($chars[$dem] . '10')->applyFromArray($style); 198 $dem++; 199 } 200 201 //$sheet->getStyle('A10:'.$chars[$dem].($index + 10))->applyFromArray($style); 202 203 $styleSTT = array( 204 'font' => array('size' => 11, 'name' =>'Cambria'), 205 'alignment' => array('bold' => true, 206 'horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 207 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 208 'wrap' => true ), 209 'borders' => array( 210 'allborders' => array( 211 'style' => \PHPExcel_Style_Border::BORDER_THIN 212 ) 213 ) 214 ); 215 216 $style = array( 217 'font' => array('size' => 11, 'name' =>'Cambria'), 218 'alignment' => array('bold' => true, 219 'horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_LEFT, 220 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 221 'wrap' => true ), 222 'borders' => array( 223 'allborders' => array( 224 'style' => \PHPExcel_Style_Border::BORDER_THIN 225 ) 226 ) 227 ); 228 229 $stt=1; 115 230 foreach ($data['provinces'] as $index => $provinces) { 116 231 117 $sheet->setCellValue('A' . ($stt + 5), $provinces['stt']); 118 $sheet->setCellValue('B' . ($stt + 5), $index); 119 $sheet->setCellValue('C' . ($stt + 5), $provinces['province']); 232 $sheet->setCellValue('A' . ($stt + 10), $provinces['stt']); 233 $sheet->getStyle('A'.($stt + 10))->applyFromArray($styleSTT); 234 $sheet->setCellValue('B' . ($stt + 10), $index); 235 $sheet->setCellValue('C' . ($stt + 10), $provinces['province']); 236 $sheet->getStyle('B'.($stt + 10).":C".($stt + 10))->applyFromArray($style); 120 237 $dem = 2; 121 238 foreach ($provinces['packages'] as $package) { 122 239 $dem++; 123 $sheet->setCellValue($chars[$dem] . ($stt + 5), $package['total']); 240 $sheet->setCellValue($chars[$dem] . ($stt + 10), $package['total']); 241 $sheet->getStyle($chars[$dem] . ($stt + 10))->applyFromArray($style); 124 242 $dem++; 125 $sheet->setCellValue($chars[$dem] . ($stt + 5), $package['percent']); 243 $sheet->setCellValue($chars[$dem] . ($stt + 10), $package['percent']); 244 $sheet->getStyle($chars[$dem] . ($stt + 10))->applyFromArray($style); 126 245 } 127 246 $dem++; 128 247 129 $sheet->setCellValue($chars[$dem] . ($stt + 5), $provinces['total']); 248 $sheet->setCellValue($chars[$dem] . ($stt + 10), $provinces['total']); 249 $sheet->getStyle($chars[$dem] . ($stt + 10))->applyFromArray($style); 250 130 251 $stt++; 131 252 } 253 254 132 255 $writer = new PHPExcel_Writer_Excel5($this->phpexcel); 133 header('Content-Disposition: attachment; filename="doanh_thu_' . $data['month'] . "_" . $data['year'] . '.xls"');256 header('Content-Disposition: attachment; filename="doanh_thu_'. $data['date'] . "_" . $data['month'] . "_" . $data['year'] .'-'. $data['to_date'] . "_" . $data['to_month'] . "_" . $data['to_year'] . '.xls"'); 134 257 $writer->save('php://output'); 135 258 } -
pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportprovince.php
r818 r883 30 30 31 31 $this->load->model('reportmodel'); 32 $data['date'] = date("d");32 $data['date'] = 1; 33 33 $data['month'] = date("m"); 34 34 $data['year'] = date("Y"); … … 37 37 $data['to_year'] = date("Y"); 38 38 if ($this->input->post()) { 39 $data['date'] = $this->input->post('date'); 40 $data['month'] = $this->input->post('month'); 41 $data['year'] = $this->input->post('year'); 39 //$data['month'] = $this->input->post('month'); 40 //$data['year'] = $this->input->post('year'); 41 $data['month'] = $this->input->post('to_month'); 42 $data['year'] = $this->input->post('to_year'); 42 43 $data['to_date'] = $this->input->post('to_date'); 43 44 $data['to_month'] = $this->input->post('to_month'); … … 130 131 public function exportProvince(){ 131 132 $this->load->model('reportmodel'); 132 $data['date'] = date("d");133 $data['date'] = 1; 133 134 $data['month'] = $this->uri->segment(4); 134 135 $data['year'] = $this->uri->segment(5); … … 137 138 $data['to_year'] = date("Y"); 138 139 if ($this->input->post()) { 139 $data['date'] = $this->input->post('date');140 $data['month'] = $this->input->post(' month');141 $data['year'] = $this->input->post(' year');140 //$data['date'] = $this->input->post('date'); 141 $data['month'] = $this->input->post('to_month'); 142 $data['year'] = $this->input->post('to_year'); 142 143 $data['to_date'] = $this->input->post('to_date'); 143 144 $data['to_month'] = $this->input->post('to_month'); … … 362 363 $writer = new PHPExcel_Writer_Excel5($this->phpexcel); 363 364 header('Content-Type: application/vnd.ms-excel'); 364 header('Content-Disposition: attachment; filename="thue_bao_va_doanh_thu_theo_tinh_' . $data["date"]. $data['month'] . $data['year']."_".$data["to_date"]. $data['to_month']. $data['to_year'] . '.xls"');365 header('Content-Disposition: attachment; filename="thue_bao_va_doanh_thu_theo_tinh_' . $data["to_date"].'_'. $data['to_month'].'_'. $data['to_year'] . '.xls"'); 365 366 $writer->save('php://output'); 366 367 } -
pro-violet-viettel/sourcecode/application/modules/admin/controllers/user.php
r770 r883 27 27 $this->load->helper ( 'pagging' ); 28 28 $this->load->model ( 'user_model' ); 29 29 30 $provinces = lang('_PROVINCES_'); 30 31 error_log(var_export($provinces, TRUE), 3, '/srv/www/sbg/log/provinces.log'); … … 50 51 } 51 52 $data['provinces'] = $provinces; 52 $data['province_code'] = ''; 53 if ($this->input->post ( 'province-code' )) { 54 $data ['province_code'] = $this->input->post ( 'province-code' ); 53 $data['province'] = ''; 54 if ($this->input->post ( 'province' )) { 55 $data ['province'] = $this->input->post ( 'province' ); 56 } 57 if ($data['province']) 58 $data['districts'] = $this->user_model->getDistrictByProvince($data ['province']); 59 if ($this->input->post ( 'district' )) { 60 $data['district'] = $this->input->post ( 'district' ); 55 61 } 56 62 $data ['keyword'] = ""; … … 58 64 $data ['sorting_field'] = "created_time"; 59 65 if ($this->input->post ( 'sorting_order' )) { 60 if ($this->input->post ( 'sorting_ord er' ) != "sorting") {66 if ($this->input->post ( 'sorting_ord er' ) != "sorting") { 61 67 $data ['sorting_order'] = $this->input->post ( 'sorting_order' ); 62 68 $data ['sorting_field'] = $this->input->post ( 'sorting_field' ); … … 84 90 85 91 foreach ( $us as $u ) { 92 $dist = $this->user_model->getDistrictByIdAndProvince($u['district'], $u['province']); 93 $u['district_name'] = $dist['type']." ".$dist['district_name']; 86 94 $u ['province'] = isset($provinces[$u ['province']]) ? $provinces[$u ['province']] : $u ['province']; 95 87 96 $userinfo = $this->get_userinfo ( $u ['us_id'] ); 88 97 if ($userinfo) { … … 171 180 $this->load->model ( 'user_model' ); 172 181 $data = $this->user_model->get_user_info ( $src, $us_id, $token ); 173 // var_dump($data);174 182 $result = array (); 175 183 parse_str ( $data, $result ); 176 184 return $result; 185 } 186 187 public function export(){ 188 189 $this->load->helper ( 'pagging' ); 190 $this->load->model ( 'user_model' ); 191 $provinces = lang('_PROVINCES_'); 192 193 $data ['current_page'] = $this->uri->segment ( 4, 1 ); 194 $data ['itemsoptions'] = array ( 195 10, 196 25, 197 50, 198 100 199 ); 200 201 $data ['perpage'] = $this->uri->segment (5, 10); 202 $data ['statusoptions'] = array ( 203 0 => "Tất cả", 204 1 => "Äã ÄÄng kÜ VIP", 205 2 => "Dùng thá» 7 ngà y", 206 3=> "Dùng thá» hạn chế", 207 4=> "Hết hạn" 208 ); 209 $data ['status'] = $this->uri->segment (7, 0); 177 210 /* 178 * if (strpos($data, '&')){ $arr_users = explode("&", $data); $str_username = $arr_users[1]; $arr_username = explode("=", $str_username); return $arr_username[1]; }else { return ""; } 179 */ 180 } 211 if ($this->input->post ( 'status' )) { 212 $data ['status'] = ( int ) $this->input->post ( 'status' ); 213 } 214 */ 215 $data['provinces'] = $provinces; 216 $data['province'] = $this->uri->segment (8); 217 if ($data['province'] == 'default') $data['province'] = null; 218 if ($this->input->post ( 'province' )) { 219 $data ['province'] = $this->input->post ( 'province' ); 220 } 221 if ($data['province']) 222 $data['districts'] = $this->user_model->getDistrictByProvince($data ['province']); 223 if ($this->input->post ( 'district' )) { 224 $data['district'] = $this->input->post ( 'district' ); 225 } 226 227 $data['district'] = $this->uri->segment (9); 228 if ($data['district'] == 'default') $data['district'] = null; 229 $data ['keyword'] = $this->uri->segment (6); 230 if ($data['keyword'] == 'default') $data['keyword'] = null; 231 $data ['sorting_order'] = "sorting_desc"; 232 $data ['sorting_field'] = "created_time"; 233 $data ['sorting_order'] = $this->uri->segment (11); 234 $data ['sorting_field'] = $this->uri->segment (12); 235 236 if ($this->input->post ( 'sorting_order' )) { 237 if ($this->input->post ( 'sorting_order' ) != "sorting") { 238 $data ['sorting_order'] = $this->input->post ( 'sorting_order' ); 239 $data ['sorting_field'] = $this->input->post ( 'sorting_field' ); 240 } 241 } 242 243 if ($this->input->post ( 'items' )) { 244 $data ['perpage'] = $this->input->post ( 'items' ); 245 } 246 247 if ($this->input->post ( 'keyword' )) { 248 $data ['keyword'] = $this->input->post ( 'keyword' ); 249 } 250 251 $data ['daterange_start'] = ""; 252 $data ['daterange_end'] = ""; 253 $daterange = $this->uri->segment (10); 254 if ($daterange == 'default') $daterange = null; 255 if($daterange){ 256 $daterange = explode ( " - ", $daterange ); 257 $daterange [0] = str_replace ( '/', '-', $daterange [0] ); 258 $daterange [1] = str_replace ( '/', '-', $daterange [1] ); 259 $data ['daterange_start'] = date ( 'Y-m-d H:i:s', strtotime ( $daterange [0] ) ); 260 $data ['daterange_end'] = date ( 'Y-m-d H:is:s', strtotime ( $daterange [1] . ' + 1 day' ) ); 261 } 262 if ($this->input->post ( 'daterange' )) { 263 $daterange = explode ( " - ", $this->input->post ( 'daterange' ) ); 264 $daterange [0] = str_replace ( '/', '-', $daterange [0] ); 265 $daterange [1] = str_replace ( '/', '-', $daterange [1] ); 266 $data ['daterange_start'] = date ( 'Y-m-d H:i:s', strtotime ( $daterange [0] ) ); 267 $data ['daterange_end'] = date ( 'Y-m-d H:is:s', strtotime ( $daterange [1] . ' + 1 day' ) ); 268 } 269 $data ['start'] = ($data ['current_page'] - 1) * $data ['perpage']; 270 $data ['total'] = $this->user_model->get_total_users ( $data ); 271 $us = $this->user_model->get_list_users ( $data ); 272 $users = array (); 273 274 foreach ( $us as $u ) { 275 $dist = $this->user_model->getDistrictByIdAndProvince($u['district'], $u['province']); 276 $u['district_name'] = $dist['type']." ".$dist['district_name']; 277 $u ['province'] = isset($provinces[$u ['province']]) ? $provinces[$u ['province']] : $u ['province']; 278 279 $userinfo = $this->get_userinfo ( $u ['us_id'] ); 280 if ($userinfo) { 281 $u ['username'] = $userinfo ['username']; 282 $u['fullname'] = $userinfo['fullname']; 283 } 284 285 if (strtotime($u['expire_date']) > time() && $u['p_id'] != 5 ){ 286 $u['status'] = 'Äã ÄÄng kÜ VIP'; 287 }elseif(strtotime($u['expire_date']) > time() && $u['p_id'] == 5){ 288 $u['status'] = 'Dùng thá» 7 ngà y'; 289 }elseif(strtotime($u['expire_date']) < time() && $u['p_id'] == 5){ 290 $u['status'] = 'Dùng thá» hạn chế'; 291 }else{ 292 $u['status'] = 'Hết hạn'; 293 } 294 295 array_push ( $users, $u ); 296 } 297 298 $data ['users'] = $users; 299 $data ['paging_url'] = base_url () . "admin/nguoi_dung/trang/"; 300 $data ['num_links'] = 2; 301 $data ['paging'] = pagging ( $data ); 302 303 $this->load->library("PHPExcel"); 304 $sheet = $this->phpexcel->getActiveSheet(); 305 306 $sheet->setTitle("bao cao thue bao " . $data['month'] . " - " . $data['year']); 307 $sheet->getColumnDimension('A')->setWidth(10); 308 $sheet->getColumnDimension('B')->setWidth(25); 309 $sheet->getColumnDimension('C')->setWidth(25); 310 $sheet->getColumnDimension('D')->setWidth(15); 311 $sheet->getColumnDimension('E')->setWidth(15); 312 $sheet->getColumnDimension('F')->setWidth(15); 313 $sheet->getColumnDimension('G')->setWidth(15); 314 $sheet->getColumnDimension('H')->setWidth(25); 315 $sheet->getColumnDimension('I')->setWidth(25); 316 317 318 $sheet->setCellValue('B1', "TẬP ÄOÃN VIá»N THÃNG QUÃN Äá»I"); 319 $style = array( 320 'font' => array('bold' => true, 'size' => 12, 'name' =>'Cambria', 'color' => array('rgb' => '0070bf')), 321 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 322 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 323 'wrap' => true ) 324 ); 325 $sheet->mergeCells('B1:I1'); 326 $sheet->getStyle('B1')->applyFromArray($style); 327 328 $sheet->setCellValue('B2', "Tá»NG CÃNG TY VIá»N THÃNG VIETTEL"); 329 $style = array( 330 'font' => array('size' => 12, 'name' =>'Cambria', 'color' => array('rgb' => '0070bf')), 331 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 332 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 333 'wrap' => true ) 334 ); 335 $sheet->mergeCells('B2:I2'); 336 $sheet->getStyle('B2')->applyFromArray($style); 337 338 339 $sheet->setCellValue('A4', "DANH SÃCH NGƯá»I DÃNG"); 340 $style = array( 341 'font' => array('bold' => true, 'size' => 14, 'name' =>'Cambria'), 342 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 343 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 344 'wrap' => true ) 345 ); 346 $sheet->mergeCells('A4:I4'); 347 $sheet->getStyle('A4')->applyFromArray($style); 348 349 $sheet->setCellValue('A6', 'STT'); 350 $style = array( 351 'font' => array('bold' => true, 'size' => 11, 'name' =>'Cambria'), 352 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 353 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 354 'wrap' => true), 355 'borders' => array( 356 'allborders' => array( 357 'style' => \PHPExcel_Style_Border::BORDER_THIN 358 ) 359 ) 360 ); 361 $sheet->getStyle('A6')->applyFromArray($style); 362 $style = array( 363 'font' => array('bold' => true, 'size' => 11, 'name' =>'Cambria'), 364 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 365 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 366 'wrap' => true), 367 'borders' => array( 368 'allborders' => array( 369 'style' => \PHPExcel_Style_Border::BORDER_THIN 370 ) 371 ) 372 ); 373 374 $sheet->setCellValue('B6', 'Sá» Äiá»n thoại'); 375 $sheet->setCellValue('C6', "Há» tên)"); 376 $sheet->setCellValue('D6', "Tà i khoản SBG"); 377 $sheet->setCellValue('E6', "Ngà y ÄÄng kÜ"); 378 $sheet->setCellValue('F6', "Ngà y hết hạn"); 379 $sheet->setCellValue('G6', "Tá»nh/Thà nh phá»"); 380 $sheet->setCellValue('H6', "Quáºn/Huyá»n"); 381 $sheet->setCellValue('I6', "Tình trạng"); 382 $sheet->getStyle('A6:I6')->applyFromArray($style); 383 384 $styleSTT = array( 385 'font' => array('size' => 11, 'name' =>'Cambria'), 386 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 387 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER), 388 'borders' => array( 389 'allborders' => array( 390 'style' => \PHPExcel_Style_Border::BORDER_THIN 391 ) 392 ) 393 ); 394 $style = array( 395 'font' => array('size' => 11, 'name' =>'Cambria'), 396 'alignment' => array('vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER), 397 'borders' => array( 398 'allborders' => array( 399 'style' => \PHPExcel_Style_Border::BORDER_THIN 400 ) 401 ) 402 ); 403 $dem = 0; 404 foreach ($users as $index => $user): 405 $sheet->setCellValue('A' . ($dem + 7), $index + 1); 406 $sheet->setCellValueExplicit('B' . ($dem + 7), $user['username'], PHPExcel_Cell_DataType::TYPE_STRING); 407 $sheet->setCellValue('C' . ($dem + 7), $user['fullname']); 408 $sheet->setCellValue('D' . ($dem + 7), $user['acc_balanced']); 409 $sheet->setCellValue('E' . ($dem + 7), date('d/m/Y', strtotime($user['created_time']))); 410 $sheet->setCellValue('F' . ($dem + 7), isset($user['expire_date']) && strtotime($user['expire_date']) > 0 ? date('d/m/Y', strtotime($user['expire_date'])) : ''); 411 $sheet->setCellValue('G' . ($dem + 7), $user['province']); 412 $sheet->setCellValue('H' . ($dem + 7), $user['district_name']); 413 $sheet->setCellValue('I' . ($dem + 7), $user['status']); 414 $sheet->getStyle('A' . ($dem + 7))->applyFromArray($styleSTT); 415 $sheet->getStyle('B' . ($dem + 7).':I'.($dem + 7))->applyFromArray($style); 416 417 418 $dem++; 419 endforeach; 420 421 $writer = new PHPExcel_Writer_Excel5($this->phpexcel); 422 header('Content-Type: application/vnd.ms-excel'); 423 header('Content-Disposition: attachment; filename="danhsachnguoidung_trang_'.$data['current_page'].'.xls"'); 424 $writer->save('php://output'); 425 426 } 427 181 428 }
Note: See TracChangeset
for help on using the changeset viewer.