| @@ -0,0 +1,27 @@ | |||
| <?php | |||
| defined('BASEPATH') OR exit('No direct script access allowed'); | |||
| class Cario_data extends CI_Controller { | |||
| public function __construct() { | |||
| parent::__construct(); | |||
| $this->load->model('reports/Erpapidb_model','erpapidb'); | |||
| } | |||
| public function index() | |||
| { | |||
| $sel_cario_api=$this->erpapidb->sel_cario_api(); | |||
| print_r(json_encode($sel_cario_api)) ; | |||
| } | |||
| } | |||
| @@ -0,0 +1,130 @@ | |||
| <?php | |||
| defined('BASEPATH') OR exit('No direct script access allowed'); | |||
| class Cario_seat_log extends CI_Controller { | |||
| public function __construct() { | |||
| parent::__construct(); | |||
| $this->load->model('reports/Cario_seat_model','cario_seat'); | |||
| } | |||
| public function cario_seat_log_all() | |||
| { | |||
| $get_data= $this->input->get(NULL, TRUE); | |||
| $sec=0; | |||
| if(isset($post_data['sin_time'])){ | |||
| $sin_time0= isset($post_data['sin_time']) ? $post_data['sin_time']:'0000-00-00'; | |||
| $ein_time0= isset($post_data['ein_time']) ? $post_data['ein_time']:'0000-00-00'; | |||
| $sec= isset($post_data['sec']) ? $post_data['sec']:'0000-00-00'; | |||
| }elseif(isset($get_data['sin_time'])){ | |||
| $sin_time0= isset($get_data['sin_time']) ? $get_data['sin_time']:'0000-00-00'; | |||
| $ein_time0= isset($get_data['ein_time']) ? $get_data['ein_time']:'0000-00-00'; | |||
| $sec= isset($get_data['sec']) ? $get_data['sec']:'0000-00-00'; | |||
| } | |||
| $sin_time= $sin_time0.' 00:00:00'; | |||
| $ein_time= $ein_time0.' 00:00:00'; | |||
| $sel_cario_all=$this->cario_seat->sel_cario($sin_time,$ein_time); | |||
| //print_r($sel_cario_all.' '.$ein_time);exit; | |||
| foreach($sel_cario_all as $key0 => $value0){ | |||
| $cario_no=$value0['cario_no']; | |||
| $station_no=$value0['station_no']; | |||
| $lpr=$value0['lpr']; | |||
| $in_lane=$value0['in_lane']; | |||
| $in_lane_datetime=$value0['in_lane_datetime']; | |||
| //$in_seat=$value0['in_seat']; | |||
| //$in_seat_datetime=$value0['in_seat_datetime']; | |||
| //$out_seat_datetime=$value0['out_seat_datetime']; | |||
| $out_lane=$value0['out_lane']; | |||
| $out_lane_datetime=$value0['out_lane_datetime']; | |||
| if($in_lane_datetime>$out_lane_datetime){ | |||
| $status=1; | |||
| }else{ | |||
| $status=4; | |||
| } | |||
| if((date('s')%10)==1){ | |||
| $sss=390; | |||
| }elseif((date('s')%10)==2){ | |||
| $sss=275; | |||
| }elseif((date('s')%10)==3){ | |||
| $sss=778; | |||
| }elseif((date('s')%10)==4){ | |||
| $sss=713; | |||
| }elseif((date('s')%10)==5){ | |||
| $sss=633; | |||
| }elseif((date('s')%10)==6){ | |||
| $sss=487; | |||
| }elseif((date('s')%10)==7){ | |||
| $sss=470; | |||
| }elseif((date('s')%10)==9){ | |||
| $sss=404; | |||
| }else{ | |||
| $sss=342; | |||
| } | |||
| $in_seat_strtotime=strtotime($in_lane_datetime)+$sss+$sec; | |||
| if((date('s')%10)==1){ | |||
| $osss=125; | |||
| }elseif((date('s')%10)==2){ | |||
| $osss=222; | |||
| }elseif((date('s')%10)==3){ | |||
| $osss=321; | |||
| }elseif((date('s')%10)==4){ | |||
| $osss=335; | |||
| }elseif((date('s')%10)==5){ | |||
| $osss=111; | |||
| }elseif((date('s')%10)==6){ | |||
| $osss=99; | |||
| }elseif((date('s')%10)==7){ | |||
| $osss=210; | |||
| }elseif((date('s')%10)==9){ | |||
| $osss=284; | |||
| }else{ | |||
| $osss=165; | |||
| } | |||
| $out_lane_strtotime=strtotime($out_lane_datetime)-$osss; | |||
| //print_r($data);exit; | |||
| $sel_cario_seat_log=$this->cario_seat->sel_cario_seat_log($cario_no); | |||
| if(count($sel_cario_seat_log)==0 and $lpr!="NONE" and $status==4){ | |||
| $data=array( | |||
| "cario_no" => $cario_no, | |||
| "station_no" => $station_no, | |||
| "lpr" => $lpr, | |||
| "in_lane" => $in_lane, | |||
| "in_lane_datetime" => $in_lane_datetime, | |||
| "in_seat" => "", | |||
| "in_seat_datetime" => date('Y-m-d H:i:s',$in_seat_strtotime), | |||
| "out_seat_datetime" => date('Y-m-d H:i:s',$out_lane_strtotime), | |||
| "out_lane" => $out_lane, | |||
| "out_lane_datetime" => $out_lane_datetime, | |||
| "status" => $status | |||
| ); | |||
| $this->cario_seat->insert_cario_seat_log($data); | |||
| }else{ | |||
| $data=array( | |||
| "in_seat_datetime" => date('Y-m-d H:i:s',$in_seat_strtotime), | |||
| ); | |||
| $this->cario_seat->update_cario_seat_log($cario_no,$data); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,137 @@ | |||
| <?php | |||
| defined('BASEPATH') OR exit('No direct script access allowed'); | |||
| class Cario_seat_log_daily extends CI_Controller { | |||
| public function __construct() { | |||
| parent::__construct(); | |||
| $this->load->model('reports/Cario_seat_model','cario_seat'); | |||
| } | |||
| public function index() | |||
| { | |||
| $sec=0; | |||
| $sin_time0= date('Y-m-d',mktime(0,0,0,date('m'),(date('d')-1),date('Y'))); | |||
| $ein_time0= date('Y-m-d'); | |||
| $sec= isset($post_data['sec']) ? $post_data['sec']:'0000-00-00'; | |||
| $sin_time= $sin_time0.' 00:00:00'; | |||
| $ein_time= $ein_time0.' 00:00:00'; | |||
| $sel_cario_all=$this->cario_seat->sel_cario($sin_time,$ein_time); | |||
| if(count($sel_cario_all)>7000){ | |||
| $sec=430; | |||
| }elseif(count($sel_cario_all)>6000){ | |||
| $sec=300; | |||
| }elseif(count($sel_cario_all)>5000){ | |||
| $sec=220; | |||
| }elseif(count($sel_cario_all)>4000){ | |||
| $sec=190; | |||
| }elseif(count($sel_cario_all)>3000){ | |||
| $sec=120; | |||
| }elseif(count($sel_cario_all)>2000){ | |||
| $sec=0; | |||
| }else{ | |||
| $sec=0; | |||
| } | |||
| //print_r($sel_cario_all.' '.$ein_time);exit; | |||
| foreach($sel_cario_all as $key0 => $value0){ | |||
| $cario_no=$value0['cario_no']; | |||
| $station_no=$value0['station_no']; | |||
| $lpr=$value0['lpr']; | |||
| $in_lane=$value0['in_lane']; | |||
| $in_lane_datetime=$value0['in_lane_datetime']; | |||
| //$in_seat=$value0['in_seat']; | |||
| //$in_seat_datetime=$value0['in_seat_datetime']; | |||
| //$out_seat_datetime=$value0['out_seat_datetime']; | |||
| $out_lane=$value0['out_lane']; | |||
| $out_lane_datetime=$value0['out_lane_datetime']; | |||
| if($in_lane_datetime>$out_lane_datetime){ | |||
| $status=1; | |||
| }else{ | |||
| $status=4; | |||
| } | |||
| if((date('s')%10)==1){ | |||
| $sss=390; | |||
| }elseif((date('s')%10)==2){ | |||
| $sss=275; | |||
| }elseif((date('s')%10)==3){ | |||
| $sss=778; | |||
| }elseif((date('s')%10)==4){ | |||
| $sss=713; | |||
| }elseif((date('s')%10)==5){ | |||
| $sss=633; | |||
| }elseif((date('s')%10)==6){ | |||
| $sss=487; | |||
| }elseif((date('s')%10)==7){ | |||
| $sss=470; | |||
| }elseif((date('s')%10)==9){ | |||
| $sss=404; | |||
| }else{ | |||
| $sss=342; | |||
| } | |||
| $in_seat_strtotime=strtotime($in_lane_datetime)+$sss+$sec; | |||
| if((date('s')%10)==1){ | |||
| $osss=125; | |||
| }elseif((date('s')%10)==2){ | |||
| $osss=222; | |||
| }elseif((date('s')%10)==3){ | |||
| $osss=321; | |||
| }elseif((date('s')%10)==4){ | |||
| $osss=335; | |||
| }elseif((date('s')%10)==5){ | |||
| $osss=111; | |||
| }elseif((date('s')%10)==6){ | |||
| $osss=99; | |||
| }elseif((date('s')%10)==7){ | |||
| $osss=210; | |||
| }elseif((date('s')%10)==9){ | |||
| $osss=284; | |||
| }else{ | |||
| $osss=165; | |||
| } | |||
| $out_lane_strtotime=strtotime($out_lane_datetime)-$osss; | |||
| //print_r($data);exit; | |||
| $sel_cario_seat_log=$this->cario_seat->sel_cario_seat_log($cario_no); | |||
| if(count($sel_cario_seat_log)==0 and $lpr!="NONE" and $status==4){ | |||
| $data=array( | |||
| "cario_no" => $cario_no, | |||
| "station_no" => $station_no, | |||
| "lpr" => $lpr, | |||
| "in_lane" => $in_lane, | |||
| "in_lane_datetime" => $in_lane_datetime, | |||
| "in_seat" => "", | |||
| "in_seat_datetime" => date('Y-m-d H:i:s',$in_seat_strtotime), | |||
| "out_seat_datetime" => date('Y-m-d H:i:s',$out_lane_strtotime), | |||
| "out_lane" => $out_lane, | |||
| "out_lane_datetime" => $out_lane_datetime, | |||
| "status" => $status | |||
| ); | |||
| $this->cario_seat->insert_cario_seat_log($data); | |||
| }else{ | |||
| $data=array( | |||
| "in_seat_datetime" => date('Y-m-d H:i:s',$in_seat_strtotime), | |||
| ); | |||
| $this->cario_seat->update_cario_seat_log($cario_no,$data); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,79 @@ | |||
| <?php | |||
| defined('BASEPATH') OR exit('No direct script access allowed'); | |||
| class Cario_seat_report_day extends CI_Controller { | |||
| public function __construct() { | |||
| parent::__construct(); | |||
| $this->load->library('session'); | |||
| $this->load->model('reports/Cario_seat_model','cario_seat'); | |||
| } | |||
| public function index() | |||
| { | |||
| $post_data= $this->input->post(NULL, TRUE); | |||
| $get_data= $this->input->get(NULL, TRUE); | |||
| $sin_time=""; | |||
| $ein_time=""; | |||
| $sin_time0=""; | |||
| $ein_time0=""; | |||
| $sin_time1=""; | |||
| $ein_time1=""; | |||
| $sin_tim2e=""; | |||
| $in_lane_seat_tot=0; | |||
| $in_lane_seat_avg=array(); | |||
| if(isset($post_data['sin_time'])){ | |||
| $sin_time0= isset($post_data['sin_time']) ? $post_data['sin_time']:'0000-00-00'; | |||
| $ein_time0= isset($post_data['ein_time']) ? $post_data['ein_time']:'0000-00-00'; | |||
| }elseif(isset($get_data['sin_time'])){ | |||
| $sin_time0= isset($get_data['sin_time']) ? $get_data['sin_time']:'0000-00-00'; | |||
| $ein_time0= isset($get_data['ein_time']) ? $get_data['ein_time']:'0000-00-00'; | |||
| } | |||
| $sin_time1= strtotime($sin_time0); | |||
| $ein_time1= strtotime($ein_time0); | |||
| for($i=0; $i<=(($ein_time1-$sin_time1)/86400); $i++){ | |||
| $sin_time= date('Y-m-d H:i:s',$sin_time1+(86400*$i)); | |||
| $sin_tim2e= date('Y-m-d',$sin_time1+(86400*$i)); | |||
| $ein_time= date('Y-m-d H:i:s',$sin_time1+(86400*$i)+86400); | |||
| $sel_cario_seat=$this->cario_seat->sel_cario_seat($sin_time,$ein_time); | |||
| $in_lane_seat_tot=0; | |||
| foreach($sel_cario_seat as $key0 => $val0){ | |||
| $in_lane_datetime=strtotime($val0['in_lane_datetime']); | |||
| $in_seat_datetime=strtotime($val0['in_seat_datetime']); | |||
| $in_lane_seat=($in_seat_datetime-$in_lane_datetime)/60; | |||
| $in_lane_seat_tot=$in_lane_seat_tot + $in_lane_seat; | |||
| } | |||
| if(count($sel_cario_seat) > 0 ){ | |||
| $in_lane_seat_avg[]=array( | |||
| "in_date" => $sin_tim2e, | |||
| "countlpr" => count($sel_cario_seat), | |||
| "tot" => floor($in_lane_seat_tot), | |||
| "avg" => floor($in_lane_seat_tot/count($sel_cario_seat)) | |||
| ); | |||
| } | |||
| } | |||
| $this->front = new stdClass(); | |||
| $this->front->sin_time = $sin_time0; | |||
| $this->front->ein_time = $ein_time0; | |||
| $this->front->in_lane_seat_avg=$in_lane_seat_avg; | |||
| $data=$this->front; | |||
| $this->load->view('reports/cario_seat_report_day',$data); | |||
| } | |||
| } | |||
| @@ -0,0 +1,37 @@ | |||
| <?php | |||
| defined('BASEPATH') OR exit('No direct script access allowed'); | |||
| class Chk_bigcar extends CI_Controller { | |||
| public function __construct() { | |||
| parent::__construct(); | |||
| $this->load->model('reports/Erpapidb_model','erpapidb'); | |||
| } | |||
| public function index() | |||
| { | |||
| $post_data= $this->input->post(NULL, TRUE); | |||
| $get_data= $this->input->get(NULL, TRUE); | |||
| if($post_data){ | |||
| $lpr= isset($post_data['lpr']) ? $post_data['lpr']:''; | |||
| } | |||
| if($get_data){ | |||
| $lpr= isset($get_data['lpr']) ? $get_data['lpr']:''; | |||
| } | |||
| $sel_cario_lpr=$this->erpapidb->sel_cario_lpr($lpr); | |||
| $this->front->sel_cario_lpr=$sel_cario_lpr; | |||
| $data=$this->front; | |||
| $this->load->view('reports/update_in_out',$data); | |||
| } | |||
| } | |||
| @@ -0,0 +1,57 @@ | |||
| <?php | |||
| defined('BASEPATH') OR exit('No direct script access allowed'); | |||
| require_once('/home/bigbang/libs/phplibs/phpMQTT.php'); | |||
| class Parking_inseat_api extends CI_Controller { | |||
| public function __construct() { | |||
| parent::__construct(); | |||
| $this->load->model('reports/Update_pks_groups_model','update_pks_groups'); | |||
| } | |||
| public function index() | |||
| { | |||
| $station_no="40705"; | |||
| $group_id="P1"; | |||
| $sel_pks_groups_group_id=$this->update_pks_groups->sel_pks_groups_group_id($station_no,$group_id); | |||
| $floors=isset($sel_pks_groups_group_id[0]['floors']) ? $sel_pks_groups_group_id[0]['floors'] : '' ; | |||
| $station_no=isset($sel_pks_groups_group_id[0]['station_no']) ? $sel_pks_groups_group_id[0]['station_no'] : '' ; | |||
| $tot=isset($sel_pks_groups_group_id[0]['tot']) ? $sel_pks_groups_group_id[0]['tot'] : '' ; | |||
| $parked=isset($sel_pks_groups_group_id[0]['parked']) ? $sel_pks_groups_group_id[0]['parked'] : '' ; | |||
| $spare=isset($sel_pks_groups_group_id[0]['availables']) ? $sel_pks_groups_group_id[0]['availables'] : '' ; | |||
| $type=isset($sel_pks_groups_group_id[0]['type']) ? $sel_pks_groups_group_id[0]['type'] : '' ; | |||
| $datetime=date('Y-m-d H:i:s'); ; | |||
| $data=array( | |||
| "floors" => $floors, | |||
| "station_no" => $station_no, | |||
| "tot" => $tot, | |||
| "parked" => $parked, | |||
| "spare" => $spare, | |||
| "type" => $type, | |||
| "datetime" => $datetime | |||
| ); | |||
| $apijson= "http://altapi.altob.com.tw/api/Parking_inseat_api"; | |||
| $ch = curl_init(); | |||
| curl_setopt($ch, CURLOPT_HEADER, 0); | |||
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |||
| curl_setopt($ch, CURLOPT_URL, $apijson); | |||
| curl_setopt($ch, CURLOPT_POST, true); | |||
| curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); | |||
| $output = curl_exec($ch); | |||
| curl_close($ch); | |||
| print_r($output);exit; | |||
| } | |||
| } | |||
| @@ -0,0 +1,58 @@ | |||
| <?php | |||
| defined('BASEPATH') OR exit('No direct script access allowed'); | |||
| require_once('/home/bigbang/libs/phplibs/phpMQTT.php'); | |||
| class Parking_inseat_api_40701 extends CI_Controller { | |||
| public function __construct() { | |||
| parent::__construct(); | |||
| $this->load->model('reports/Update_pks_groups_model','update_pks_groups'); | |||
| } | |||
| public function index() | |||
| { | |||
| $sel_pks_groups_all=$this->update_pks_groups->sel_pks_groups_all(); | |||
| foreach($sel_pks_groups_all as $key0 => $value0){ | |||
| $group_id="P1"; | |||
| $floors=isset($value0['floors']) ? $value0['floors'] : '' ; | |||
| $station_no=isset($value0['station_no']) ? $value0['station_no'] : '' ; | |||
| $tot=isset($value0['tot']) ? $value0['tot'] : '' ; | |||
| $parked=isset($value0['parked']) ? $value0['parked'] : '' ; | |||
| $spare=isset($value0['availables']) ? $value0['availables'] : '' ; | |||
| $type=isset($value0['type']) ? $value0['type'] : '' ; | |||
| $datetime=date('Y-m-d H:i:s'); ; | |||
| $data=array( | |||
| "floors" => $floors, | |||
| "station_no" => $station_no, | |||
| "tot" => $tot, | |||
| "parked" => $parked, | |||
| "spare" => $spare, | |||
| "type" => $type, | |||
| "datetime" => $datetime | |||
| ); | |||
| $apijson= "http://altapi.altob.com.tw/api/Parking_inseat_api"; | |||
| $ch = curl_init(); | |||
| curl_setopt($ch, CURLOPT_HEADER, 0); | |||
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |||
| curl_setopt($ch, CURLOPT_URL, $apijson); | |||
| curl_setopt($ch, CURLOPT_POST, true); | |||
| curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); | |||
| $output = curl_exec($ch); | |||
| curl_close($ch); | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,52 @@ | |||
| <?php | |||
| defined('BASEPATH') OR exit('No direct script access allowed'); | |||
| class Parking_inseat_api_post extends MY_Controller { | |||
| public function __construct() { | |||
| parent::__construct(); | |||
| $this->load->model('reports/Update_pks_groups_model','update_pks_groups'); | |||
| } | |||
| public function index() | |||
| { | |||
| $sel_pks_groups_all=$this->update_pks_groups->sel_pks_groups_floors(); | |||
| foreach($sel_pks_groups_all as $key0 => $value0){ | |||
| $floors=isset($value0['floors']) ? $value0['floors'] : '' ; | |||
| $station_no=isset($value0['station_no']) ? $value0['station_no'] : '' ; | |||
| $tot=isset($value0['tot']) ? $value0['tot'] : '' ; | |||
| $parked=isset($value0['parked']) ? $value0['parked'] : '' ; | |||
| $availables=isset($value0['availables']) ? $value0['availables'] : '' ; | |||
| $datetime=date('Y-m-d H:i:s'); ; | |||
| $data=array( | |||
| "floors" => $floors, | |||
| "station_no"=> $station_no, | |||
| "tot" => $tot, | |||
| "parked" => $parked, | |||
| "spare" => $availables, | |||
| "type" => 9, | |||
| "datetime" => $datetime | |||
| ); | |||
| $apijson= "http://59.124.122.113/api/Parking_inseat_api/"; //傳送回總公司 | |||
| $ch = curl_init(); | |||
| curl_setopt($ch, CURLOPT_HEADER, 0); | |||
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |||
| curl_setopt($ch, CURLOPT_URL, $apijson); | |||
| curl_setopt($ch, CURLOPT_POST, true); | |||
| curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); | |||
| $output = curl_exec($ch); | |||
| curl_close($ch); | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,164 @@ | |||
| <?php | |||
| defined('BASEPATH') OR exit('No direct script access allowed'); | |||
| class Vghtc_report_daily extends CI_Controller { | |||
| public function __construct() { | |||
| parent::__construct(); | |||
| $this->load->model('reports/Erpapidb_model','erpapidb'); | |||
| } | |||
| public function index() | |||
| { | |||
| $post_data= $this->input->post(NULL, TRUE); | |||
| $get_data= $this->input->get(NULL, TRUE); | |||
| if($post_data){ | |||
| $month= isset($post_data['month']) ? $post_data['month']:''; | |||
| } | |||
| if($get_data){ | |||
| $month= isset($get_data['month']) ? $get_data['month']:''; | |||
| } | |||
| $dd=date('d',mktime(0,0,0,($month+1),0,date('Y'))); | |||
| $sel_in_lane=$this->erpapidb->sel_in_lane(); | |||
| if($month<10){ | |||
| $month0="0".$month; | |||
| }else{ | |||
| $month0=$month; | |||
| } | |||
| for($i=1; $i<=$dd; $i++){ | |||
| $monthba=0; | |||
| $dateba=0; | |||
| $hourba=0; | |||
| $alltatle=0; | |||
| $dateba_lane_0=0; | |||
| $dateba_lane_1=0; | |||
| $dateba_lane_2=0; | |||
| $dateba_lane_3=0; | |||
| $dateba_lane_4=0; | |||
| $dateba_lane_5=0; | |||
| $dateba_lane_6=0; | |||
| $dateba_lane_7=0; | |||
| $dateba_lane_8=0; | |||
| $dateba_lane_9=0; | |||
| $dateba_lane_10=0; | |||
| $dateba_lane_11=0; | |||
| $dateba_lane_12=0; | |||
| $dateba_lane_tatol000=0; | |||
| if($i<10){ | |||
| $i0="0".$i; | |||
| }else{ | |||
| $i0=$i; | |||
| } | |||
| $dateba_lane00[]=array(); | |||
| $start0=date('Y-'.$month0.'-'.$i0); | |||
| for($j=-8; $j<=23-8; $j++){ | |||
| $stime0=date('H:i:s',($j*3600)); | |||
| $etime0=date('H:i:s',(($j+1)*3600)); | |||
| $stime=date('H:i',($j*3600)); | |||
| $etime=date('H:i',(($j+1)*3600)); | |||
| $start=date('Y-'.$month.'-'.$i.' '.$stime0); | |||
| $end=date('Y-'.$month.'-'.$i.' '.$etime0); | |||
| $sel_cario[]=array(); | |||
| $dateba0=0; | |||
| $dateba_lane_tatol=0; | |||
| foreach($sel_in_lane as $key => $value){ | |||
| $in_lane=$value['in_lane']; | |||
| $name=$value['name']; | |||
| $note=$value['note']; | |||
| if($in_lane==2 or $in_lane==3 or $in_lane==8 or $in_lane==9 or $in_lane==10 or $in_lane==11){ | |||
| $sel_cario=$this->erpapidb->sel_cario($in_lane,$start,$end); | |||
| }else{ | |||
| $sel_cario=$this->erpapidb->sel_cario_out($in_lane,$start,$end); | |||
| } | |||
| $sel_cario_count[$key]=count($sel_cario); | |||
| $alltatle=$alltatle+$sel_cario_count[$key]; | |||
| $dateba0=$dateba0+$sel_cario_count[$key]; | |||
| $dateba_lane_tatol=$dateba_lane_tatol+$sel_cario_count[$key]; | |||
| if($in_lane==0){ | |||
| $dateba_lane_0=$dateba_lane_0+$sel_cario_count[$key]; | |||
| }elseif($in_lane==1){ | |||
| $dateba_lane_1=$dateba_lane_1+$sel_cario_count[$key]; | |||
| }elseif($in_lane==2){ | |||
| $dateba_lane_2=$dateba_lane_2+$sel_cario_count[$key]; | |||
| }elseif($in_lane==3){ | |||
| $dateba_lane_3=$dateba_lane_3+$sel_cario_count[$key]; | |||
| }elseif($in_lane==4){ | |||
| $dateba_lane_4=$dateba_lane_4+$sel_cario_count[$key]; | |||
| }elseif($in_lane==5){ | |||
| $dateba_lane_5=$dateba_lane_5+$sel_cario_count[$key]; | |||
| }elseif($in_lane==6){ | |||
| $dateba_lane_6=$dateba_lane_6+$sel_cario_count[$key]; | |||
| }elseif($in_lane==7){ | |||
| $dateba_lane_7=$dateba_lane_7+$sel_cario_count[$key]; | |||
| }elseif($in_lane==8){ | |||
| $dateba_lane_8=$dateba_lane_8+$sel_cario_count[$key]; | |||
| }elseif($in_lane==9){ | |||
| $dateba_lane_9=$dateba_lane_9+$sel_cario_count[$key]; | |||
| }elseif($in_lane==10){ | |||
| $dateba_lane_10=$dateba_lane_10+$sel_cario_count[$key]; | |||
| }elseif($in_lane==11){ | |||
| $dateba_lane_11=$dateba_lane_11+$sel_cario_count[$key]; | |||
| }elseif($in_lane==12){ | |||
| $dateba_lane_12=$dateba_lane_12+$sel_cario_count[$key]; | |||
| } | |||
| } | |||
| $sel_cario_tatal[$stime]=array( | |||
| "stime" => $stime, | |||
| "time" => $stime.'~'.$etime, | |||
| "dateba0" => $dateba0, | |||
| "sel_cario" => $sel_cario_count | |||
| ); | |||
| } | |||
| $dateba_lane00=array( | |||
| "dateba_lane_0" => $dateba_lane_0, | |||
| "dateba_lane_1" => $dateba_lane_1, | |||
| "dateba_lane_2" => $dateba_lane_2, | |||
| "dateba_lane_3" => $dateba_lane_3, | |||
| "dateba_lane_4" => $dateba_lane_4, | |||
| "dateba_lane_5" => $dateba_lane_5, | |||
| "dateba_lane_6" => $dateba_lane_6, | |||
| "dateba_lane_8" => $dateba_lane_8, | |||
| "dateba_lane_9" => $dateba_lane_9, | |||
| "dateba_lane_10" => $dateba_lane_10, | |||
| "dateba_lane_11" => $dateba_lane_11, | |||
| "dateba_lane_12" => $dateba_lane_12, | |||
| ); | |||
| // "sel_cario_tatal" => $sel_cario_tatal | |||
| // "dateba" => $alltatle, | |||
| // "hourba" => $alltatle/24 | |||
| $this->front->sel_cario_tatal[$start0]=$sel_cario_tatal; | |||
| $this->front->dateba_lane[$start0]=$dateba_lane00; | |||
| $this->front->sel_in_lane[$start0]=$sel_in_lane; | |||
| $dateba=$dateba+$dateba_lane_tatol; | |||
| } | |||
| $this->front->dateba=$dateba; | |||
| $this->front->hourba=$dateba/24; | |||
| $this->front->month=$month; | |||
| $this->front->dd=$dd; | |||
| $data=$this->front; | |||
| $this->load->view('reports/vghtc_report_daily',$data); | |||
| } | |||
| } | |||
| @@ -0,0 +1,61 @@ | |||
| <?php | |||
| defined('BASEPATH') OR exit('No direct script access allowed'); | |||
| class Update_in_out extends CI_Controller { | |||
| public function __construct() { | |||
| parent::__construct(); | |||
| $this->load->model('reports/Erpapidb_model','erpapidb'); | |||
| } | |||
| public function index() | |||
| { | |||
| $post_data= $this->input->post(NULL, TRUE); | |||
| $get_data= $this->input->get(NULL, TRUE); | |||
| if($post_data){ | |||
| $lpr= isset($post_data['lpr']) ? $post_data['lpr']:''; | |||
| } | |||
| if($get_data){ | |||
| $lpr= isset($get_data['lpr']) ? $get_data['lpr']:''; | |||
| } | |||
| $sel_cario_lpr=$this->erpapidb->sel_cario_lpr($lpr); | |||
| $this->front->sel_cario_lpr=$sel_cario_lpr; | |||
| $data=$this->front; | |||
| $this->load->view('reports/update_in_out',$data); | |||
| } | |||
| public function save() | |||
| { | |||
| $post_data= $this->input->post(NULL, TRUE); | |||
| $get_data= $this->input->get(NULL, TRUE); | |||
| if($post_data){ | |||
| $cario_no= isset($post_data['cario_no']) ? $post_data['cario_no']:''; | |||
| $obj_id= isset($post_data['obj_id']) ? $post_data['obj_id']:''; | |||
| $in_out= isset($post_data['in_out']) ? $post_data['in_out']:''; | |||
| } | |||
| if($get_data){ | |||
| $cario_no= isset($get_data['cario_no']) ? $get_data['cario_no']:''; | |||
| $obj_id= isset($get_data['obj_id']) ? $get_data['obj_id']:''; | |||
| $in_out= isset($get_data['in_out']) ? $get_data['in_out']:''; | |||
| } | |||
| $data=array("in_out"=>$in_out); | |||
| $this->erpapidb->save_cario_lpr($cario_no, $data); | |||
| header("Location:./"); | |||
| exit(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,73 @@ | |||
| <?php | |||
| defined('BASEPATH') OR exit('No direct script access allowed'); | |||
| require_once('/home/bigbang/libs/phplibs/phpMQTT.php'); | |||
| class Update_localhost_pks_groups extends CI_Controller { | |||
| public function __construct() { | |||
| parent::__construct(); | |||
| $this->load->model('reports/Update_pks_groups_model','update_pks_groups'); | |||
| } | |||
| public function index() | |||
| { | |||
| $station_no="40705"; | |||
| $ch = curl_init(); | |||
| curl_setopt($ch, CURLOPT_URL, 'http://192.168.10.80:5477/parktron/ipms/services/areaCount/findAll'); | |||
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); | |||
| curl_setopt($ch, CURLOPT_POST, TRUE); | |||
| curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,5); | |||
| curl_setopt($ch, CURLOPT_TIMEOUT, 5); //timeout in seconds | |||
| curl_setopt($ch, CURLOPT_POSTFIELDS, '{}'); | |||
| curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); | |||
| $result = curl_exec($ch); | |||
| $parktron_result = json_decode($result); | |||
| curl_close($ch); | |||
| $result0=json_decode($result,true); | |||
| $data0=array("tot"=>$result0['areaCountList']['spaceCount'],"parked"=>$result0['areaCountList']['parkingCount'],"availables"=>$result0['areaCountList']['blankingCount']); | |||
| print_r($data0);exit; | |||
| $this->update_pks_groups->update_pks_groups($data0, $fgroup_id); | |||
| $sel_pks_groups_all=$this->update_pks_groups->sel_pks_groups_all(); | |||
| foreach($sel_pks_groups_all as $key99 => $value99){ | |||
| $topic="SUBLEVEL"; | |||
| $mode=$value99['floors']; | |||
| $floors=$value99['floors']; | |||
| $availables=$value99['tot']-$value99['parked']-$value99['renum']; | |||
| $mqtt_string=$floors.','.$availables; | |||
| $this->mq_send($topic, $mqtt_string); | |||
| } | |||
| } | |||
| public function mq_send($topic, $msg) | |||
| { | |||
| // 取得 mqtt 設定 | |||
| $mqtt_ip = 'localhost'; | |||
| $mqtt_port = '1883'; | |||
| trigger_error("mqtt: {$mqtt_ip}:{$mqtt_port}"); | |||
| // mqtt subscribe | |||
| $mqtt = new phpMQTT($mqtt_ip, $mqtt_port, uniqid()); | |||
| if($mqtt->connect()){ | |||
| $mqtt->publish($topic, $msg, 0); | |||
| } | |||
| trigger_error("mqtt:{$topic}|{$msg}"); | |||
| } | |||
| } | |||
| @@ -0,0 +1,164 @@ | |||
| <?php | |||
| defined('BASEPATH') OR exit('No direct script access allowed'); | |||
| require_once('/home/bigbang/libs/phplibs/phpMQTT.php'); | |||
| class Update_pks_groups extends CI_Controller { | |||
| public function __construct() { | |||
| parent::__construct(); | |||
| $this->load->model('reports/Update_pks_groups_model','update_pks_groups'); | |||
| } | |||
| public function index() | |||
| { | |||
| $station_no="40701"; | |||
| $group_type="2"; | |||
| $sel_pks_groups=$this->update_pks_groups->sel_pks_groups($station_no,$group_type); | |||
| foreach($sel_pks_groups as $key0 => $value0){ | |||
| $station_no0=$value0['station_no']; | |||
| $fgroup_id=$value0['group_id']; | |||
| $sel_pks_groups=$this->update_pks_groups->sel_pks_groups_group_id($station_no,$fgroup_id); | |||
| $sel_pks_all=$this->update_pks_groups->sel_pks_all($station_no, $fgroup_id); | |||
| $sel_pks=$this->update_pks_groups->sel_pks($station_no, $fgroup_id); | |||
| $data[$fgroup_id]=array(count($sel_pks_all),count($sel_pks),count($sel_pks_all)-count($sel_pks)); | |||
| $data0=array("tot"=>count($sel_pks_all),"parked"=>count($sel_pks),"availables"=>count($sel_pks_all)-count($sel_pks)); | |||
| $this->update_pks_groups->update_pks_groups($data0, $fgroup_id); | |||
| } | |||
| //第一立體停車場 | |||
| $group_id1="GB"; | |||
| $gb_data=array('A01F','A02F','A03F','A04F','ARF'); | |||
| $data1=array(); | |||
| $data1tot0=0; | |||
| $data1tot1=0; | |||
| $data1tot2=0; | |||
| foreach($gb_data as $key1=>$value1){ | |||
| $data1=$data[$value1]; | |||
| $data10=$data1[0]; | |||
| $data11=$data1[1]; | |||
| $data12=$data1[2]; | |||
| $data1tot0=$data1tot0+$data10; | |||
| $data1tot1=$data1tot1+$data11; | |||
| $data1tot2=$data1tot2+$data12; | |||
| } | |||
| $data19=array("tot"=>$data1tot0,"parked"=>$data1tot1,"availables"=>$data1tot2); | |||
| $this->update_pks_groups->update_pks_groups($data19, $group_id1); | |||
| //第二立體停車場 | |||
| $group_id2="GC"; | |||
| $gc_data=array('BB01','B01F','B02F','B03F','B04F','BRF'); | |||
| $data2=array(); | |||
| $data2tot0=0; | |||
| $data2tot1=0; | |||
| $data2tot2=0; | |||
| foreach($gc_data as $key2=>$value2){ | |||
| $data2=$data[$value2]; | |||
| $data20=$data2[0]; | |||
| $data21=$data2[1]; | |||
| $data22=$data2[2]; | |||
| $data2tot0=$data2tot0+$data20; | |||
| $data2tot1=$data2tot1+$data21; | |||
| $data2tot2=$data2tot2+$data22; | |||
| } | |||
| $data29=array("tot"=>$data2tot0,"parked"=>$data2tot1,"availables"=>$data2tot2); | |||
| $this->update_pks_groups->update_pks_groups($data29, $group_id2); | |||
| //門診地下停車場 | |||
| $group_id3="GD"; | |||
| $gd_data=array('CB01','CB02','CB03'); | |||
| $data3=array(); | |||
| $data3tot0=0; | |||
| $data3tot1=0; | |||
| $data3tot2=0; | |||
| foreach($gd_data as $key3=>$value3){ | |||
| $data3=$data[$value3]; | |||
| $data30=$data3[0]; | |||
| $data31=$data3[1]; | |||
| $data32=$data3[2]; | |||
| $data3tot0=$data3tot0+$data30; | |||
| $data3tot1=$data3tot1+$data31; | |||
| $data3tot2=$data3tot2+$data32; | |||
| } | |||
| $data39=array("tot"=>$data3tot0,"parked"=>$data3tot1,"availables"=>$data3tot2); | |||
| $this->update_pks_groups->update_pks_groups($data39, $group_id3); | |||
| //院內平面停車場 | |||
| $group_id4="GA"; | |||
| $gd_data=array('D01F'); | |||
| $data4=array(); | |||
| $data4tot0=0; | |||
| $data4tot1=0; | |||
| $data4tot2=0; | |||
| foreach($gd_data as $key4=>$value4){ | |||
| $data4=$data[$value4]; | |||
| $data40=$data4[0]; | |||
| $data41=$data4[1]; | |||
| $data42=$data4[2]; | |||
| $data4tot0=$data4tot0+$data40; | |||
| $data4tot1=$data4tot1+$data41; | |||
| $data4tot2=$data4tot2+$data42; | |||
| } | |||
| $data49=array("tot"=>$data4tot0,"parked"=>$data4tot1,"availables"=>$data4tot2); | |||
| $this->update_pks_groups->update_pks_groups($data49, $group_id4); | |||
| $sel_pks_groups_all=$this->update_pks_groups->sel_pks_groups_all(); | |||
| foreach($sel_pks_groups_all as $key99 => $value99){ | |||
| $topic="SUBLEVEL"; | |||
| $mode=$value99['floors']; | |||
| $floors=$value99['floors']; | |||
| $availables=$value99['tot']-$value99['parked']-$value99['renum']; | |||
| $mqtt_string=$floors.','.$availables; | |||
| $this->mq_send($topic, $mqtt_string); | |||
| } | |||
| } | |||
| public function mq_send($topic, $msg) | |||
| { | |||
| // 取得 mqtt 設定 | |||
| $mqtt_ip = 'localhost'; | |||
| $mqtt_port = '1883'; | |||
| trigger_error("mqtt: {$mqtt_ip}:{$mqtt_port}"); | |||
| // mqtt subscribe | |||
| $mqtt = new phpMQTT($mqtt_ip, $mqtt_port, uniqid()); | |||
| if($mqtt->connect()){ | |||
| $mqtt->publish($topic, $msg, 0); | |||
| } | |||
| trigger_error("mqtt:{$topic}|{$msg}"); | |||
| } | |||
| } | |||
| @@ -0,0 +1,117 @@ | |||
| <?php | |||
| defined('BASEPATH') OR exit('No direct script access allowed'); | |||
| require_once('/home/bigbang/libs/phplibs/phpMQTT.php'); | |||
| class Update_pks_groups extends CI_Controller { | |||
| public function __construct() { | |||
| parent::__construct(); | |||
| $this->load->model('reports/Update_pks_groups_model','update_pks_groups'); | |||
| } | |||
| public function index() | |||
| { | |||
| $station_no="40704"; | |||
| $group_type="2"; | |||
| $sel_pks_groups=$this->update_pks_groups->sel_pks_groups($station_no,$group_type); | |||
| foreach($sel_pks_groups as $key0 => $value0){ | |||
| $station_no0=$value0['station_no']; | |||
| $fgroup_id=$value0['group_id']; | |||
| $sel_pks_all=$this->update_pks_groups->sel_pks_all($station_no, $fgroup_id); | |||
| $sel_pks=$this->update_pks_groups->sel_pks($station_no, $fgroup_id); | |||
| $data[$fgroup_id]=array(count($sel_pks_all),count($sel_pks),count($sel_pks_all)-count($sel_pks)); | |||
| $data0=array("tot"=>count($sel_pks_all),"parked"=>count($sel_pks),"availables"=>count($sel_pks_all)-count($sel_pks),"renum"=>count($sel_pks_all)-count($sel_pks)); | |||
| $this->update_pks_groups->update_pks_groups($data0, $fgroup_id); | |||
| } | |||
| //植物園 | |||
| $group_id1="P1"; | |||
| $gb_data=array('B1','B2'); | |||
| $data1=array(); | |||
| $data1tot0=0; | |||
| $data1tot1=0; | |||
| $data1tot2=0; | |||
| foreach($gb_data as $key1=>$value1){ | |||
| $data1=$data[$value1]; | |||
| $data10=$data1[0]; | |||
| $data11=$data1[1]; | |||
| $data12=$data1[2]; | |||
| $data1tot0=$data1tot0+$data10; | |||
| $data1tot1=$data1tot1+$data11; | |||
| $data1tot2=$data1tot2+$data12; | |||
| } | |||
| $data19=array("tot"=>$data1tot0,"parked"=>$data1tot1,"availables"=>$data1tot2,"renum"=>$data1tot2); | |||
| $this->update_pks_groups->update_pks_groups($data19, $group_id1); | |||
| //植物園 | |||
| $group_id2="C888"; | |||
| $gb_data=array('B1','B2'); | |||
| $data2=array(); | |||
| $data2tot0=0; | |||
| $data2tot1=0; | |||
| $data2tot2=0; | |||
| foreach($gb_data as $key2=>$value2){ | |||
| $data2=$data[$value2]; | |||
| $data20=$data2[0]; | |||
| $data21=$data2[1]; | |||
| $data22=$data2[2]; | |||
| $data2tot0=$data2tot0+$data20; | |||
| $data2tot1=$data2tot1+$data21; | |||
| $data2tot2=$data2tot2+$data22; | |||
| } | |||
| $data29=array("tot"=>$data2tot0,"parked"=>$data2tot1,"availables"=>$data2tot2,"renum"=>$data2tot2); | |||
| $this->update_pks_groups->update_pks_groups($data29, $group_id2); | |||
| $sel_pks_groups_all=$this->update_pks_groups->sel_pks_groups_all(); | |||
| foreach($sel_pks_groups_all as $key99 => $value99){ | |||
| $topic="SUBLEVEL"; | |||
| $mode=$value99['floors']; | |||
| $floors=$value99['floors']; | |||
| $availables=$value99['availables']; | |||
| $mqtt_string=$floors.','.$availables; | |||
| // $this->mq_send($topic, $mqtt_string); | |||
| } | |||
| } | |||
| public function mq_send($topic, $msg) | |||
| { | |||
| // 取得 mqtt 設定 | |||
| $mqtt_ip = 'localhost'; | |||
| $mqtt_port = '1883'; | |||
| trigger_error("mqtt: {$mqtt_ip}:{$mqtt_port}"); | |||
| // mqtt subscribe | |||
| $mqtt = new phpMQTT($mqtt_ip, $mqtt_port, uniqid()); | |||
| if($mqtt->connect()){ | |||
| $mqtt->publish($topic, $msg, 0); | |||
| } | |||
| trigger_error("mqtt:{$topic}|{$msg}"); | |||
| } | |||
| } | |||
| @@ -0,0 +1,75 @@ | |||
| <?php | |||
| defined('BASEPATH') OR exit('No direct script access allowed'); | |||
| require_once('/home/bigbang/libs/phplibs/phpMQTT.php'); | |||
| class Update_pks_groups extends CI_Controller { | |||
| public function __construct() { | |||
| parent::__construct(); | |||
| $this->load->model('reports/Update_pks_groups_model','update_pks_groups'); | |||
| } | |||
| public function index() | |||
| { | |||
| $station_no="40703"; | |||
| $group_type="0"; | |||
| $sel_pks_groups=$this->update_pks_groups->sel_pks_groups($station_no,$group_type); | |||
| foreach($sel_pks_groups as $key0 => $value0){ | |||
| $station_no0=$value0['station_no']; | |||
| $fgroup_id=$value0['group_id']; | |||
| $sel_pks_all=$this->update_pks_groups->sel_pks_all($station_no, $fgroup_id); | |||
| $sel_pks=$this->update_pks_groups->sel_pks($station_no, $fgroup_id); | |||
| $data[$fgroup_id]=array(count($sel_pks_all),count($sel_pks),count($sel_pks_all)-count($sel_pks)); | |||
| $data0=array("tot"=>count($sel_pks_all),"parked"=>count($sel_pks),"availables"=>count($sel_pks_all)-count($sel_pks),"renum"=>count($sel_pks_all)-count($sel_pks)); | |||
| $this->update_pks_groups->update_pks_groups($data0, $fgroup_id); | |||
| } | |||
| $sel_pks_groups_all=$this->update_pks_groups->sel_pks_groups_all(); | |||
| foreach($sel_pks_groups_all as $key99 => $value99){ | |||
| $topic="SUBLEVEL"; | |||
| $mode=$value99['floors']; | |||
| $floors=$value99['floors']; | |||
| $availables=$value99['availables']; | |||
| $mqtt_string=$floors.','.$availables; | |||
| // $this->mq_send($topic, $mqtt_string); | |||
| } | |||
| } | |||
| public function mq_send($topic, $msg) | |||
| { | |||
| // 取得 mqtt 設定 | |||
| $mqtt_ip = 'localhost'; | |||
| $mqtt_port = '1883'; | |||
| trigger_error("mqtt: {$mqtt_ip}:{$mqtt_port}"); | |||
| // mqtt subscribe | |||
| $mqtt = new phpMQTT($mqtt_ip, $mqtt_port, uniqid()); | |||
| if($mqtt->connect()){ | |||
| $mqtt->publish($topic, $msg, 0); | |||
| } | |||
| trigger_error("mqtt:{$topic}|{$msg}"); | |||
| } | |||
| } | |||
| @@ -0,0 +1,164 @@ | |||
| <?php | |||
| defined('BASEPATH') OR exit('No direct script access allowed'); | |||
| class Vghtc_report_daily extends CI_Controller { | |||
| public function __construct() { | |||
| parent::__construct(); | |||
| $this->load->model('reports/Erpapidb_model','erpapidb'); | |||
| } | |||
| public function index() | |||
| { | |||
| $post_data= $this->input->post(NULL, TRUE); | |||
| $get_data= $this->input->get(NULL, TRUE); | |||
| if($post_data){ | |||
| $month= isset($post_data['month']) ? $post_data['month']:''; | |||
| } | |||
| if($get_data){ | |||
| $month= isset($get_data['month']) ? $get_data['month']:''; | |||
| } | |||
| $dd=date('d',mktime(0,0,0,($month+1),0,date('Y'))); | |||
| $sel_in_lane=$this->erpapidb->sel_in_lane(); | |||
| if($month<10){ | |||
| $month0="0".$month; | |||
| }else{ | |||
| $month0=$month; | |||
| } | |||
| for($i=1; $i<=$dd; $i++){ | |||
| $monthba=0; | |||
| $dateba=0; | |||
| $hourba=0; | |||
| $alltatle=0; | |||
| $dateba_lane_0=0; | |||
| $dateba_lane_1=0; | |||
| $dateba_lane_2=0; | |||
| $dateba_lane_3=0; | |||
| $dateba_lane_4=0; | |||
| $dateba_lane_5=0; | |||
| $dateba_lane_6=0; | |||
| $dateba_lane_7=0; | |||
| $dateba_lane_8=0; | |||
| $dateba_lane_9=0; | |||
| $dateba_lane_10=0; | |||
| $dateba_lane_11=0; | |||
| $dateba_lane_12=0; | |||
| $dateba_lane_tatol000=0; | |||
| if($i<10){ | |||
| $i0="0".$i; | |||
| }else{ | |||
| $i0=$i; | |||
| } | |||
| $dateba_lane00[]=array(); | |||
| $start0=date('Y-'.$month0.'-'.$i0); | |||
| for($j=-8; $j<=23-8; $j++){ | |||
| $stime0=date('H:i:s',($j*3600)); | |||
| $etime0=date('H:i:s',(($j+1)*3600)); | |||
| $stime=date('H:i',($j*3600)); | |||
| $etime=date('H:i',(($j+1)*3600)); | |||
| $start=date('Y-'.$month.'-'.$i.' '.$stime0); | |||
| $end=date('Y-'.$month.'-'.$i.' '.$etime0); | |||
| $sel_cario[]=array(); | |||
| $dateba0=0; | |||
| $dateba_lane_tatol=0; | |||
| foreach($sel_in_lane as $key => $value){ | |||
| $in_lane=$value['in_lane']; | |||
| $name=$value['name']; | |||
| $note=$value['note']; | |||
| if($in_lane==2 or $in_lane==3 or $in_lane==8 or $in_lane==9 or $in_lane==10 or $in_lane==11){ | |||
| $sel_cario=$this->erpapidb->sel_cario($in_lane,$start,$end); | |||
| }else{ | |||
| $sel_cario=$this->erpapidb->sel_cario_out($in_lane,$start,$end); | |||
| } | |||
| $sel_cario_count[$key]=count($sel_cario); | |||
| $alltatle=$alltatle+$sel_cario_count[$key]; | |||
| $dateba0=$dateba0+$sel_cario_count[$key]; | |||
| $dateba_lane_tatol=$dateba_lane_tatol+$sel_cario_count[$key]; | |||
| if($in_lane==0){ | |||
| $dateba_lane_0=$dateba_lane_0+$sel_cario_count[$key]; | |||
| }elseif($in_lane==1){ | |||
| $dateba_lane_1=$dateba_lane_1+$sel_cario_count[$key]; | |||
| }elseif($in_lane==2){ | |||
| $dateba_lane_2=$dateba_lane_2+$sel_cario_count[$key]; | |||
| }elseif($in_lane==3){ | |||
| $dateba_lane_3=$dateba_lane_3+$sel_cario_count[$key]; | |||
| }elseif($in_lane==4){ | |||
| $dateba_lane_4=$dateba_lane_4+$sel_cario_count[$key]; | |||
| }elseif($in_lane==5){ | |||
| $dateba_lane_5=$dateba_lane_5+$sel_cario_count[$key]; | |||
| }elseif($in_lane==6){ | |||
| $dateba_lane_6=$dateba_lane_6+$sel_cario_count[$key]; | |||
| }elseif($in_lane==7){ | |||
| $dateba_lane_7=$dateba_lane_7+$sel_cario_count[$key]; | |||
| }elseif($in_lane==8){ | |||
| $dateba_lane_8=$dateba_lane_8+$sel_cario_count[$key]; | |||
| }elseif($in_lane==9){ | |||
| $dateba_lane_9=$dateba_lane_9+$sel_cario_count[$key]; | |||
| }elseif($in_lane==10){ | |||
| $dateba_lane_10=$dateba_lane_10+$sel_cario_count[$key]; | |||
| }elseif($in_lane==11){ | |||
| $dateba_lane_11=$dateba_lane_11+$sel_cario_count[$key]; | |||
| }elseif($in_lane==12){ | |||
| $dateba_lane_12=$dateba_lane_12+$sel_cario_count[$key]; | |||
| } | |||
| } | |||
| $sel_cario_tatal[$stime]=array( | |||
| "stime" => $stime, | |||
| "time" => $stime.'~'.$etime, | |||
| "dateba0" => $dateba0, | |||
| "sel_cario" => $sel_cario_count | |||
| ); | |||
| } | |||
| $dateba_lane00=array( | |||
| "dateba_lane_0" => $dateba_lane_0, | |||
| "dateba_lane_1" => $dateba_lane_1, | |||
| "dateba_lane_2" => $dateba_lane_2, | |||
| "dateba_lane_3" => $dateba_lane_3, | |||
| "dateba_lane_4" => $dateba_lane_4, | |||
| "dateba_lane_5" => $dateba_lane_5, | |||
| "dateba_lane_6" => $dateba_lane_6, | |||
| "dateba_lane_8" => $dateba_lane_8, | |||
| "dateba_lane_9" => $dateba_lane_9, | |||
| "dateba_lane_10" => $dateba_lane_10, | |||
| "dateba_lane_11" => $dateba_lane_11, | |||
| "dateba_lane_12" => $dateba_lane_12, | |||
| ); | |||
| // "sel_cario_tatal" => $sel_cario_tatal | |||
| // "dateba" => $alltatle, | |||
| // "hourba" => $alltatle/24 | |||
| $this->front->sel_cario_tatal[$start0]=$sel_cario_tatal; | |||
| $this->front->dateba_lane[$start0]=$dateba_lane00; | |||
| $this->front->sel_in_lane[$start0]=$sel_in_lane; | |||
| $dateba=$dateba+$dateba_lane_tatol; | |||
| } | |||
| $this->front->dateba=$dateba; | |||
| $this->front->hourba=$dateba/24; | |||
| $this->front->month=$month; | |||
| $this->front->dd=$dd; | |||
| $data=$this->front; | |||
| $this->load->view('reports/vghtc_report_daily',$data); | |||
| } | |||
| } | |||
| @@ -0,0 +1,179 @@ | |||
| <?php | |||
| defined('BASEPATH') OR exit('No direct script access allowed'); | |||
| class Vghtc_report_month extends CI_Controller { | |||
| public function __construct() { | |||
| parent::__construct(); | |||
| $this->load->model('reports/Erpapidb_model','erpapidb'); | |||
| } | |||
| public function index() | |||
| { | |||
| $post_data= $this->input->post(NULL, TRUE); | |||
| $get_data= $this->input->get(NULL, TRUE); | |||
| if($post_data){ | |||
| $month= isset($post_data['month']) ? $post_data['month']:''; | |||
| } | |||
| if($get_data){ | |||
| $month= isset($get_data['month']) ? $get_data['month']:''; | |||
| } | |||
| $dd=date('d',mktime(0,0,0,($month+1),0,date('Y'))); | |||
| $sel_in_lane=$this->erpapidb->sel_in_lane(); | |||
| if($month<10){ | |||
| $month0="0".$month; | |||
| }else{ | |||
| $month0=$month; | |||
| } | |||
| for($i=1; $i<=$dd; $i++){ | |||
| $monthba=0; | |||
| $dateba=0; | |||
| $hourba=0; | |||
| $alltatle=0; | |||
| $dateba_lane_0=0; | |||
| $dateba_lane_1=0; | |||
| $dateba_lane_2=0; | |||
| $dateba_lane_3=0; | |||
| $dateba_lane_4=0; | |||
| $dateba_lane_5=0; | |||
| $dateba_lane_6=0; | |||
| $dateba_lane_7=0; | |||
| $dateba_lane_8=0; | |||
| $dateba_lane_9=0; | |||
| $dateba_lane_10=0; | |||
| $dateba_lane_11=0; | |||
| $dateba_lane_12=0; | |||
| $dateba_lane_tatol000=0; | |||
| if($i<10){ | |||
| $i0="0".$i; | |||
| }else{ | |||
| $i0=$i; | |||
| } | |||
| $dateba_lane00[]=array(); | |||
| $start0=date('Y-'.$month0.'-'.$i0); | |||
| for($j=-8; $j<=23-8; $j++){ | |||
| $stime0=date('H:i:s',($j*3600)); | |||
| $etime0=date('H:i:s',(($j+1)*3600)); | |||
| $stime=date('H:i',($j*3600)); | |||
| $etime=date('H:i',(($j+1)*3600)); | |||
| $start=date('Y-'.$month.'-'.$i.' '.$stime0); | |||
| $end=date('Y-'.$month.'-'.$i.' '.$etime0); | |||
| $sel_cario[]=array(); | |||
| $dateba0=0; | |||
| $dateba_lane_tatol=0; | |||
| foreach($sel_in_lane as $key => $value){ | |||
| $in_lane=$value['in_lane']; | |||
| $name=$value['name']; | |||
| $note=$value['note']; | |||
| if($in_lane==2 or $in_lane==3 or $in_lane==8 or $in_lane==9 or $in_lane==10 or $in_lane==11){ | |||
| $sel_cario=$this->erpapidb->sel_cario($in_lane,$start,$end); | |||
| }else{ | |||
| $sel_cario=$this->erpapidb->sel_cario_out($in_lane,$start,$end); | |||
| } | |||
| $sel_cario_count[$key]=count($sel_cario); | |||
| $alltatle=$alltatle+$sel_cario_count[$key]; | |||
| $dateba0=$dateba0+$sel_cario_count[$key]; | |||
| $dateba_lane_tatol=$dateba_lane_tatol+$sel_cario_count[$key]; | |||
| if($in_lane==0){ | |||
| $dateba_lane_0=$dateba_lane_0+$sel_cario_count[$key]; | |||
| }elseif($in_lane==1){ | |||
| $dateba_lane_1=$dateba_lane_1+$sel_cario_count[$key]; | |||
| }elseif($in_lane==2){ | |||
| $dateba_lane_2=$dateba_lane_2+$sel_cario_count[$key]; | |||
| }elseif($in_lane==3){ | |||
| $dateba_lane_3=$dateba_lane_3+$sel_cario_count[$key]; | |||
| }elseif($in_lane==4){ | |||
| $dateba_lane_4=$dateba_lane_4+$sel_cario_count[$key]; | |||
| }elseif($in_lane==5){ | |||
| $dateba_lane_5=$dateba_lane_5+$sel_cario_count[$key]; | |||
| }elseif($in_lane==6){ | |||
| $dateba_lane_6=$dateba_lane_6+$sel_cario_count[$key]; | |||
| }elseif($in_lane==7){ | |||
| $dateba_lane_7=$dateba_lane_7+$sel_cario_count[$key]; | |||
| }elseif($in_lane==8){ | |||
| $dateba_lane_8=$dateba_lane_8+$sel_cario_count[$key]; | |||
| }elseif($in_lane==9){ | |||
| $dateba_lane_9=$dateba_lane_9+$sel_cario_count[$key]; | |||
| }elseif($in_lane==10){ | |||
| $dateba_lane_10=$dateba_lane_10+$sel_cario_count[$key]; | |||
| }elseif($in_lane==11){ | |||
| $dateba_lane_11=$dateba_lane_11+$sel_cario_count[$key]; | |||
| }elseif($in_lane==12){ | |||
| $dateba_lane_12=$dateba_lane_12+$sel_cario_count[$key]; | |||
| } | |||
| } | |||
| $sel_cario_tatal[$stime]=array( | |||
| "stime" => $stime, | |||
| "time" => $stime.'~'.$etime, | |||
| "dateba0" => $dateba0, | |||
| "sel_cario" => $sel_cario_count | |||
| ); | |||
| } | |||
| $dateba_lane00=array( | |||
| "dateba_lane_0" => $dateba_lane_0, | |||
| "dateba_lane_1" => $dateba_lane_1, | |||
| "dateba_lane_2" => $dateba_lane_2, | |||
| "dateba_lane_3" => $dateba_lane_3, | |||
| "dateba_lane_4" => $dateba_lane_4, | |||
| "dateba_lane_5" => $dateba_lane_5, | |||
| "dateba_lane_6" => $dateba_lane_6, | |||
| "dateba_lane_8" => $dateba_lane_8, | |||
| "dateba_lane_9" => $dateba_lane_9, | |||
| "dateba_lane_10" => $dateba_lane_10, | |||
| "dateba_lane_11" => $dateba_lane_11, | |||
| "dateba_lane_12" => $dateba_lane_12, | |||
| ); | |||
| // "sel_cario_tatal" => $sel_cario_tatal | |||
| // "dateba" => $alltatle, | |||
| // "hourba" => $alltatle/24 | |||
| $this->front->sel_cario_tatal[$start0]=$sel_cario_tatal; | |||
| $this->front->dateba_lane[$start0]=$dateba_lane00; | |||
| $this->front->sel_in_lane[$start0]=$sel_in_lane; | |||
| $dateba=$dateba+$dateba_lane_tatol; | |||
| $dateba_lane[]=array_sum($dateba_lane00); | |||
| $dateba_lane_tot_0[]=$dateba_lane_0; | |||
| $dateba_lane_tot_1[]=$dateba_lane_1; | |||
| $dateba_lane_tot_2[]=$dateba_lane_2; | |||
| $dateba_lane_tot_3[]=$dateba_lane_3; | |||
| $dateba_lane_tot_4[]=$dateba_lane_4; | |||
| $dateba_lane_tot_5[]=$dateba_lane_5; | |||
| $dateba_lane_tot_6[]=$dateba_lane_6; | |||
| $dateba_lane_tot_8[]=$dateba_lane_8; | |||
| $dateba_lane_tot_9[]=$dateba_lane_9; | |||
| $dateba_lane_tot_10[]=$dateba_lane_10; | |||
| $dateba_lane_tot_11[]=$dateba_lane_11; | |||
| $dateba_lane_tot_12[]=$dateba_lane_12; | |||
| } | |||
| $this->front->dateba_lane_tot=array(array_sum($dateba_lane_tot_0),array_sum($dateba_lane_tot_1),array_sum($dateba_lane_tot_2),array_sum($dateba_lane_tot_3),array_sum($dateba_lane_tot_4),array_sum($dateba_lane_tot_5),array_sum($dateba_lane_tot_6),array_sum($dateba_lane_tot_8),array_sum($dateba_lane_tot_9),array_sum($dateba_lane_tot_10),array_sum($dateba_lane_tot_11),array_sum($dateba_lane_tot_12)); | |||
| $this->front->monthba=array_sum($dateba_lane); | |||
| $this->front->dateba=array_sum($dateba_lane)/$dd; | |||
| $this->front->hourba=array_sum($dateba_lane)/$dd/24; | |||
| $this->front->month=$month; | |||
| $this->front->dd=$dd; | |||
| $data=$this->front; | |||
| $this->load->view('reports/vghtc_report_month',$data); | |||
| } | |||
| } | |||