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 ; }