Changeset 741
- Timestamp:
- Feb 3, 2015 6:14:25 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/reportAsistant.php
r736 r741 73 73 } 74 74 75 $data['max'] = 50000;75 $data['max'] = $max; 76 76 $chard[] = array("color" => "#e67e22", "label" => "Lượng ngưá»i dùng giá»i thiá»u bá»i cá»ng tác viên theo từng tháng", "data" => $chart); 77 77 $data['chard'] = $chard; 78 78 79 79 return $this->load->view('reportAsistant/statistics', $data, true); 80 80 } -
pro-violet-viettel/sourcecode/application/modules/admin/models/collabolator_model.php
r737 r741 56 56 } 57 57 //$sql="SELECT *,tblcollaborator.created_time as collaborator_created_time, tbluser.created_time as user_created_time FROM ".$this->table_name." INNER JOIN tbluser ON tbluser.collaborator = tblcollaborator.id WHERE tbluser.created_time > '".$from."'".$where.""; 58 59 58 $sql="SELECT *,tblcollaborator.created_time as collaborator_created_time, tbluser.created_time as user_created_time FROM ".$this->table_name." INNER JOIN tbluser ON tbluser.collaborator = tblcollaborator.cellphone WHERE tbluser.created_time > '".$from."'".$where.""; 60 59 … … 64 63 $result[$index]['time']= strtotime($paidlog['user_created_time']); 65 64 } 65 66 66 return $result; 67 67 } … … 238 238 function getStatistics() 239 239 { 240 241 $day = date('w'); 240 242 $data = array(); 241 $last_month['start'] = strtotime(date("Y-m-d", strtotime( "first day of previous month")) . " 00:00:00");242 $last_month['end'] = strtotime(date("Y-m-d", strtotime( "last day of previous month")) . " 23:59:59");243 244 $last_week['start'] = strtotime(date("Y-m-d", strtotime( "first day of previous week")) . " 00:00:00");245 $last_week['end'] = strtotime(date("Y-m-d", strtotime( "last day of previous week")) . " 23:59:59");243 $last_month['start'] = strtotime(date("Y-m-d", strtotime(date("Y-m-d", mktime(0, 0, 0, date("m")-1, 1, date("Y"))))) . " 00:00:00"); 244 $last_month['end'] = strtotime(date("Y-m-d", strtotime(date("Y-m-d", mktime(0, 0, 0, date("m"), 0, date("Y"))))) . " 23:59:59"); 245 246 $last_week['start'] = strtotime(date("Y-m-d", strtotime(date('m-d-Y', strtotime('-'.$day.' days')))) . " 00:00:00"); 247 $last_week['end'] = strtotime(date("Y-m-d", strtotime(date('m-d-Y', strtotime('+'.(6-$day).' days')))) . " 23:59:59"); 246 248 247 249 $last_week['end'] = strtotime('last sunday') + (24 * 60 * 60 - 1); … … 266 268 $revenue['last_year'] = 0; 267 269 268 $lastmonth = strtotime( "first day of previous month");269 $thismonth = strtotime( "first day of this month");270 $lastmonth = strtotime(date("Y-m-d", mktime(0, 0, 0, date("m")-1, 1, date("Y")))); 271 $thismonth = strtotime(date('Y-m-01')); 270 272 $charts['last_month'] = array(0 => 0, 1 => 0, 2 => 0, 3 => 0, 4 => 0); 271 273 $charts['this_month'] = array(0 => 0, 1 => 0, 2 => 0, 3 => 0, 4 => 0); … … 279 281 $top['this_month']['card']=0; 280 282 $top['this_month']['collaborator']=0; 283 281 284 foreach ($paidlogs as $paidlog) { 282 285 283 286 284 287 if (($paidlog['time'] < $last_week['end']) && ($paidlog['time'] > $last_week['start'])) { 288 285 289 $revenue['last_week']+=$paidlog['amount']; 286 290 } 287 291 if (($paidlog['time'] < $last_month['end']) && ($paidlog['time'] > $last_month['start'])) { 292 288 293 $revenue['last_month']+=$paidlog['amount']; 289 294 } 290 295 if (($paidlog['time'] < $last_quarter['end']) && ($paidlog['time'] > $last_quarter['start'])) { 296 291 297 $revenue['last_quarter']+=$paidlog['amount']; 292 298 } 293 299 if (($paidlog['time'] < $last_year['end']) && ($paidlog['time'] > $last_year['start'])) { 300 294 301 $revenue['last_year']+=$paidlog['amount']; 295 302 } … … 331 338 332 339 if (($paidlog['time'] < $thismonth + (7 * 24 * 60 * 60)) && ($paidlog['time'] > $thismonth)) { 333 $charts['this_month'][0]+=$paidlog['amount']; 340 341 $charts['this_month'][0] += $paidlog['amount']; 334 342 } 335 343 if (($paidlog['time'] < $thismonth + (14 * 24 * 60 * 60)) && ($paidlog['time'] > $thismonth + (7 * 24 * 60 * 60))) { 344 336 345 $charts['this_month'][1]+=$paidlog['amount']; 337 346 } 338 347 if (($paidlog['time'] < $thismonth + (21 * 24 * 60 * 60)) && ($paidlog['time'] > $thismonth + (14 * 24 * 60 * 60))) { 348 339 349 $charts['this_month'][2]+=$paidlog['amount']; 340 350 } 341 351 if (($paidlog['time'] < $thismonth + (28 * 24 * 60 * 60)) && ($paidlog['time'] > $thismonth + (21 * 24 * 60 * 60))) { 352 342 353 $charts['this_month'][3]+=$paidlog['amount']; 343 354 } 344 355 if (($paidlog['time'] < $thismonth + (31 * 24 * 60 * 60)) && ($paidlog['time'] > $thismonth + (28 * 24 * 60 * 60))) { 356 345 357 $charts['this_month'][4]+=$paidlog['amount']; 346 358 } … … 361 373 } 362 374 } 375 363 376 $percent=array(); 364 377 foreach ($top['this_month'] as $index=>$value) … … 394 407 395 408 $data['revenue'] = $revenue; 396 $data['max'] = 50000;409 $data['max'] = $max; 397 410 $chard[] = array("color" => "#e67e22", "label" => "Tháng hiện tại", "data" => $chart_this_month); 398 411 $chard[] = array("color" => "#1abc9c", "label" => "Tháng trước", "data" => $chart_last_month); 399 412 400 413 $data['chard'] = $chard; 414 401 415 return $data; 402 416 } -
pro-violet-viettel/sourcecode/application/modules/admin/models/paidlog_model.php
r740 r741 76 76 $result[$index]['time']= strtotime($paidlog['paid_time']); 77 77 } 78 $file = fopen("/srv/www/sbg/log/dump.log","w"); 79 fwrite($file, serialize($result)); 80 fclose($file); 78 81 79 return $result; 82 80 }
Note: See TracChangeset
for help on using the changeset viewer.