- Timestamp:
- Nov 10, 2014 10:10:32 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pro-violet-viettel/sourcecode/application/modules/admin/controllers/report.php
r422 r441 15 15 $admin_info = $this->session->userdata('adminInfo'); 16 16 if ($admin_info) { 17 $data['statistics'] = $this->getStatistics(); 18 $data['content'] = $this->get Smstemplates();17 $data['statistics'] = $this->getStatistics(); 18 $data['content'] = $this->getPaidlogs(); 19 19 $this->load->view('report/index', $data); 20 20 } else { … … 25 25 { 26 26 $data=array(); 27 28 $last_month['start']= strtotime(date("Y-m-d", strtotime("first day of previous month"))." 00:00:00"); 29 $last_month['end']= strtotime(date("Y-m-d", strtotime("last day of previous month"))." 23:59:59"); 30 31 $last_week['start']= strtotime(date("Y-m-d", strtotime("first day of previous week"))." 00:00:00"); 32 $last_week['end']= strtotime(date("Y-m-d", strtotime("last day of previous week"))." 23:59:59"); 33 34 $last_week['end']=strtotime('last sunday')+(24*60*60-1); 35 $last_week['start']=($last_week['end']-7*24*60*60+1); 36 37 $last_year['start']= strtotime((date("Y")-1)."-01-01 00:00:00"); 38 $last_year['end']= strtotime((date("Y")-1)."-12-31 23:59:59"); 39 40 41 42 $last_quarter=$this->getLastquarter(); 43 $last_quarter['start']= $last_quarter['start']; 44 $last_quarter['end']= $last_quarter['end']; 45 46 47 $this->load->model('paidlog_model'); 48 $paidlogs = $this->paidlog_model->getAllPaidlogs($last_year['start']); 49 50 $revenue['last_week']=0; 51 $revenue['last_month']=0; 52 $revenue['last_quarter']=0; 53 $revenue['last_year']=0; 54 foreach ($paidlogs as $paidlog) 55 { 56 57 if (($paidlog['time'] < $last_week['end'])&&($paidlog['time'] > $last_week['start'])) 58 { 59 $revenue['last_week']+=$paidlog['amount']; 60 } 61 if (($paidlog['time'] < $last_month['end'])&&($paidlog['time'] > $last_month['start'])) 62 { 63 $revenue['last_month']+=$paidlog['amount']; 64 } 65 if (($paidlog['time'] < $last_quarter['end'])&&($paidlog['time'] > $last_quarter['start'])) 66 { 67 $revenue['last_quarter']+=$paidlog['amount']; 68 } 69 if (($paidlog['time'] < $last_year['end'])&&($paidlog['time'] > $last_year['start'])) 70 { 71 $revenue['last_year']+=$paidlog['amount']; 72 } 73 } 74 $data['revenue']=$revenue; 27 75 return $this->load->view('report/statistics', $data, true); 28 76 } 29 public function getSmstemplates($filters = array()) { 77 public function getLastquarter() 78 { 79 $current_month = date('m'); 80 $current_year = date('Y'); 81 82 if($current_month>=1 && $current_month<=3) 83 { 84 $start_date = strtotime('1-October-'.($current_year-1)); // timestamp or 1-October Last Year 12:00:00 AM 85 $end_date = strtotime('1-Janauary-'.$current_year); // // timestamp or 1-January 12:00:00 AM means end of 31 December Last year 86 } 87 else if($current_month>=4 && $current_month<=6) 88 { 89 $start_date = strtotime('1-January-'.$current_year); // timestamp or 1-Janauray 12:00:00 AM 90 $end_date = strtotime('1-April-'.$current_year); // timestamp or 1-April 12:00:00 AM means end of 31 March 91 } 92 else if($current_month>=7 && $current_month<=9) 93 { 94 $start_date = strtotime('1-April-'.$current_year); // timestamp or 1-April 12:00:00 AM 95 $end_date = strtotime('1-July-'.$current_year); // timestamp or 1-July 12:00:00 AM means end of 30 June 96 } 97 else if($current_month>=10 && $current_month<=12) 98 { 99 $start_date = strtotime('1-July-'.$current_year); // timestamp or 1-July 12:00:00 AM 100 $end_date = strtotime('1-October-'.$current_year); // timestamp or 1-October 12:00:00 AM means end of 30 September 101 } 102 return array("start"=>$start_date,"end"=>$end_date); 103 } 104 public function getPaidlogs($filters = array()) { 30 105 $this->load->helper('pagging'); 31 106 $this->load->model('paidlog_model'); … … 58 133 } 59 134 60 $data['start'] = ($data['current_page'] - 1) * $data['perpage']; 61 $data['total'] = $this->paidlog_model->countSmstemplate($data); 62 63 $data['paidlogs'] = $this->paidlog_model->getSmstemplates($data); 64 65 $data['paging_url'] = base_url() . "/admin/mau_tin_nhan/trang/"; 135 $data['start'] = ($data['current_page'] - 1) * $data['perpage']; 136 $data['total'] = $this->paidlog_model->countPaidlog($data); 137 $data['paidlogs'] = $this->paidlog_model->getPaidlogs($data); 138 139 $data['paging_url'] = base_url() . "/admin/doanh_thu_tong_hop/trang/"; 66 140 $data['num_links'] = 2; 67 141 $data['paging'] = pagging($data); … … 73 147 } 74 148 75 public function add Smstemplate() {149 public function addPaidlog() { 76 150 $result['success'] = 0; 77 151 $result = array(); … … 124 198 $id=$this->uri->segment(4); 125 199 $this->load->model('paidlog_model'); 126 $data=$this->paidlog_model->get Smstemplate($id);200 $data=$this->paidlog_model->getPaidlog($id); 127 201 $this->load->view('report/viewSms',$data); 128 202 } … … 131 205 $id=$this->uri->segment(4); 132 206 $this->load->model('paidlog_model'); 133 $data=$this->paidlog_model->get Smstemplate($id);207 $data=$this->paidlog_model->getPaidlog($id); 134 208 $this->load->view('report/editSms',$data); 135 209 } … … 147 221 $id=$this->uri->segment(4); 148 222 $this->load->model('paidlog_model'); 149 $data=$this->paidlog_model->get Smstemplate($id);223 $data=$this->paidlog_model->getPaidlog($id); 150 224 $this->load->view('report/deleteSms',$data); 151 225 } … … 198 272 public function test() { 199 273 200 /*201 for ($i = 1; $i <= 1500; $i++) {274 275 for ($i = 1; $i <= 5000; $i++) { 202 276 $input['us_id']=rand(1,100); 203 277 $input['paid_type']=rand(1,2); 204 278 $input['amount']=rand(3,10)*1000; 205 $time=(rand((time()-( 5*30*24*60*60)),time()));279 $time=(rand((time()-(12*30*24*60*60)),time())); 206 280 $input['paid_time']= date("Y-m-d H:i:s",$time); 207 281 $this->load->model('paidlog_model'); 208 282 $this->paidlog_model->insert($input); 209 283 } 210 * 211 */ 284 285 die(); 286 212 287 for ($i = 1; $i <= 100; $i++) { 213 288 $input['us_id']=$i;
Note: See TracChangeset
for help on using the changeset viewer.