12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- namespace Home\Controller;
- use Think\Controller;
- include '../Common/function.php';
- class MonthlyReportController extends ComController {
- public function index(){
- $data =I();
- $company_code=$data['companyid'];
- $sql="select * from yt_t_month_report where company_code='".$company_code."' GROUP BY event_time";
- $res=add66($sql);
- $this->assign('res',$res);
- $this->assign('company_code',$company_code);
- $this->display('Index/monthly_report_list');
- }
- public function monthly_details(){
- $data =I();
- $company_code=$data['companyid'];
- $id=$data['id'];
- $sql="select * from yt_t_month_report where id=".$id;
- $res=add66($sql);
- if (!empty($res)){
- $project_info=json_decode($res[0]['project_info'], true);
- $instal_device_info=json_decode($res[0]['instal_device_info'], true);
- $this->assign('zs',$instal_device_info['total']);
- unset($instal_device_info['total']);
- foreach ($instal_device_info as $key => $value){
- $instal_device_info[$key]['xh']=$key;
- }
- // print_r($res[0]['monitor_point_info']);
- $monitor_point_info=json_decode($res[0]['monitor_point_info'],true);
- // print_r($monitor_point_info);
- $this->assign('zs1',$monitor_point_info['total']);
- unset($monitor_point_info['total']);
- foreach ($monitor_point_info as $key => $value){
- $monitor_point_info[$key]['xh']=$key;
- }
- $count_time=json_decode($res[0]['count_time'],true);
- $count_report=json_decode($res[0]['count_report'],true);
- foreach ($count_report as $key => $value){
- $count_report[$key]['xh']=$key;
- }
- $alarm_total=json_decode($res[0]['alarm_total'],true);
- $fire_data=json_decode($res[0]['fire_data'],true);
- $fire_data['process_rate']=$fire_data['process_rate']*1000;
- $fire_data['unprocess']=$fire_data['unprocess']*1000;
- $water_data=json_decode($res[0]['water_data'],true);
- $rtu_data=json_decode($res[0]['rtu_data'],true);
- $conclusion=json_decode($res[0]['conclusion'],true);
- $other=$conclusion['other'];
- $propose_data=$conclusion['propose'];
- $propose=array();
- $a=0;
- foreach ($propose_data as $key => $value){
- if (!empty($propose_data[$key]['data1'])){
- $propose[$a]['data1']=$propose_data[$key]['data1'];
- $a+=1;
- }
- }
- //
- // print_r($propose);
- // print_r($other);
- }
- $this->assign('company_code',$company_code);
- $this->assign('company_name',$res[0]['company_name']);
- $this->assign('event_time',$res[0]['event_time']);
- $this->assign('project_info',$project_info);
- $this->assign('instal_device_info',$instal_device_info);
- $this->assign('monitor_point_info',$monitor_point_info);
- $this->assign('count_time',$count_time);
- $this->assign('count_time',$count_time);
- $this->assign('count_report',$count_report);
- $this->assign('alarm_total',$alarm_total);
- $this->assign('fire_data',$fire_data);
- $this->assign('water_data',$water_data);
- $this->assign('rtu_data',$rtu_data);
- $this->assign('propose',$propose);
- $this->assign('other',$other);
- $this->display('Index/monthly_report_details');
- }
- }
|