From d090caba749b68c1d84235a71392d8fde80194a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=B4=E6=8E=8C?= Date: Tue, 9 Jul 2019 14:05:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=A8=E7=A7=91=E5=8F=8A?= =?UTF-8?q?=E6=A0=BC=E7=8E=87=E7=AE=97=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/chengji/controller/Index.php | 4 ++-- application/chengji/model/Tongji.php | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/application/chengji/controller/Index.php b/application/chengji/controller/Index.php index 79b71c08..2927c189 100644 --- a/application/chengji/controller/Index.php +++ b/application/chengji/controller/Index.php @@ -585,10 +585,10 @@ class Index extends Base $nianji = array(); $chengjiinfo = $tj->srcChengji($list['kaoshi'],$list['banji']); $temp = $tj->tongji($chengjiinfo,$list['kaoshi']); - $colcnt = $colcnt+5; + isset($colcnt) ? $colcnt = $colcnt+5 : $colcnt = 12; // 循环写出统计结果 foreach ($ks->ks_subject as $key => $value) { - $sheet->setCellValue($colname[$colcnt].'3', $temp[$value->subject_name->lieming]['cnt']); + $sheet->setCellValue($colname[$colcnt].'3', $temp[$value->subject_name->lieming]['xkcnt']); $sheet->setCellValue($colname[$colcnt].'4', $temp[$value->subject_name->lieming]['avg']); $sheet->setCellValue($colname[$colcnt].'5', $temp[$value->subject_name->lieming]['youxiu']); $sheet->setCellValue($colname[$colcnt].'6', $temp[$value->subject_name->lieming]['jige']); diff --git a/application/chengji/model/Tongji.php b/application/chengji/model/Tongji.php index d2f40b02..0448e944 100644 --- a/application/chengji/model/Tongji.php +++ b/application/chengji/model/Tongji.php @@ -147,6 +147,7 @@ class Tongji extends Model public function rateAll($cj = array(), $sbj=array()) { $jige = 0; # 总及格人数 + $sbjcnt = count($sbj); // 开始循环每个人的成绩 foreach ($cj as $key => $value) { $temjige = 0; #记录学生及格的学科数 @@ -161,7 +162,7 @@ class Tongji extends Model } } // 如果这个学生及格学科数等于学科总数,那么全科及格总数加1 - $temjige == count($value) && $temjige>0 ? $jige++ : $jige ; + $temjige == $sbjcnt && $temjige>0 ? $jige++ : $jige ; }