1){ $orderbydesc=""; $descTXT="↓"; }else{ $orderbydesc=" desc"; $descTXT="↑"; } If ($orderby=="") { $orderby="EntourageOA_DepartmentName,EntourageOAid"; $descTXT="↓"; } if ($OrdDateType=="0" and $OrdDateStart=="" and $OrdDateEnd=="") {$OrdDateType=4;} //查询开始 $searchSql=''; $SqlOrdDateType=empty($SqlOrdDateType)!=false ? "" : $SqlOrdDateType; if (!empty($searchTXT)) {$searchSql=" and OA_Name='$searchTXT'";} $sql="select distinct OA_User_ID,OA_Name,userid,checkin_time=convert(char,checkin_time,120),groupname,checkin_type,exception_type,location_title,location_detail from OA_CheckinData,OA_User where OA_weixinUserID=userid and checkin_time ".$SqlOrdDateType.$searchSql." order by checkin_time desc"; //echo $sql;exit; $data = sqlsrv_query($conn,$sql); if($data == true){ $FormArray=array(); //表头 $FormArray[0]=array("员工姓名","规则名称","打卡类型","打卡类型","打卡地点","打卡时间"); $FormArrayX=count($FormArray[0]); if (sqlsrv_rows_affected($data)==0) { $SystemMessageType=2; $SystemMessageTXT="数据库中相关无数据!"; $y=0; } else { $i=1; while($rs = sqlsrv_fetch_array( $data, SQLSRV_FETCH_ASSOC) ) { //读取数据 $OA_User_ID = $rs['OA_User_ID']; $OA_Name = $rs['OA_Name']; $userid = $rs['userid']; $groupname = $rs['groupname']; $checkin_type = $rs['checkin_type']; $exception_type = $rs['exception_type']; $checkin_time = $rs['checkin_time']; $location_title = $rs['location_title']; $location_detail = $rs['location_detail']; if ($location_title=='广东民航医疗快线有限公司'){$location_detail=$location_title;} //读取数据--End //写入数组 $FormArray[$i][0]=$OA_Name; $FormArray[$i][1]=$groupname; $FormArray[$i][2]=$checkin_type; $FormArray[$i][3]=$exception_type; $FormArray[$i][4]=$location_detail; $FormArray[$i][5]=date("Y-m-d H:i",strtotime($checkin_time)); $i++; } } } if ($is_CSV==2) { echo json_encode($FormArray); } //echo print_r($FormArray); //exit; ?>