| Server IP : 172.67.187.206 / Your IP : 172.71.28.156 Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586 User : SYSTEM ( 0) PHP Version : 5.6.30 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : E:/Inetpub/www/myschool/triamudom/check/webadmin/ |
Upload File : |
<?php
header("Content-Type: application/vnd.ms-excel");
header('Content-Disposition: attachment; filename="report_dayall.xls"');#ชื่อไฟล์
session_start();
$path = "../";
include ($path.'include/config_db.php');
include ($path.'include/class_db.php');
include ($path.'include/class_display.php');
include ($path.'include/function.php');
include ($path.'include/permission_denied.php');
$CLASS['db'] = new db();
$CLASS['db']->connect();
$CLASS['disp'] = new display();
$db = $CLASS['db'];
$disp = $CLASS['disp'];
$date_day = date("Y-m-d");
$date_search = convert_date_insert($_REQUEST['date_start']);
$date_search_end = convert_date_insert($_REQUEST['date_end']);
//----------------------------ค่าพื้นฐานระบบเว็บไซต์-----------------------------//
$fetch_public = $db->fetch_array($db->query("select * from tb_public"));
//----------------------------ค่าพื้นฐานระบบเว็บไซต์-----------------------------//
//--------------------ส่วนบนใช้สำหรับประกาศตัวแปรและ Config เท่านั้น----------------------------//
?>
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<title><?php print $fetch_public['tb_public_title_admin'];?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</HEAD>
<BODY>
<table width="100%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#666666">
<tr >
<td width="15%" align="center" nowrap="nowrap" >ชั้น/ห้อง</td>
<td width="10%" align="center" nowrap="nowrap" >จำนวน นร. </td>
<td width="10%" align="center" nowrap="nowrap" >ขาดเรียน</td>
<td width="10%" align="center" nowrap="nowrap" >ลากิจ</td>
<td width="10%" align="center" nowrap="nowrap" >ลาป่วย</td>
<td width="12%" align="center" nowrap="nowrap" >กิจกรรม</td>
<td width="9%" align="center" nowrap="nowrap" >มาเรียน</td>
<td width="10%" align="center" nowrap="nowrap" >ร้อยละ</td>
<td width="7%" align="center" nowrap="nowrap" >ขาดเรียน</td>
<td width="7%" align="center" nowrap="nowrap" >ร้อยละ</td>
</tr>
<?php
$sql_disroom="select * from tb_rooms where tb_room_status='1' and tb_room_id !='69' and tb_room_id !='70' and tb_room_id !='71' and tb_room_id !='72' and tb_room_id !='73' and tb_room_id !='74' order by tb_room_id asc";
$query_disroom = $db->query($sql_disroom);
$numrows = $db->num_rows($query_disroom);
if($numrows >0){
$i=1;
while($fetch_disroom = $db->fetch_array($query_disroom)){
if($date_search){
$sql_search .= " and tb_time_date >= '".$date_search."' and tb_time_date <= '".$date_search_end."' ";
}else{
$sql_search .= " and tb_time_date ='".$date_day."' ";
}
$fetch_numstu = $db->fetch_array($db->query("select count(tb_student_degree) as num_group from tb_students where tb_student_degree ='".$fetch_disroom['tb_room_id']."' "));
$fetch_numruletype1 = $db->fetch_array($db->query("SELECT COUNT(tb_time_type) AS num_group FROM tb_times WHERE tb_time_type='6' and tb_time_degree ='".$fetch_disroom['tb_room_id']."' $sql_search "));
$fetch_numruletype2 = $db->fetch_array($db->query("SELECT COUNT(tb_time_type) AS num_group FROM tb_times WHERE tb_time_type='2' and tb_time_degree ='".$fetch_disroom['tb_room_id']."' $sql_search"));
$fetch_numruletype3 = $db->fetch_array($db->query("SELECT COUNT(tb_time_type) AS num_group FROM tb_times WHERE tb_time_type='7' and tb_time_degree ='".$fetch_disroom['tb_room_id']."' $sql_search"));
$fetch_numruletype4 = $db->fetch_array($db->query("SELECT COUNT(tb_time_type) AS num_group FROM tb_times WHERE tb_time_type='4' and tb_time_degree ='".$fetch_disroom['tb_room_id']."' $sql_search"));
$fetch_numruletype5 = $db->fetch_array($db->query("SELECT COUNT(tb_time_type) AS num_group FROM tb_times WHERE tb_time_type='5' and tb_time_degree ='".$fetch_disroom['tb_room_id']."' $sql_search"));
// echo "SELECT COUNT(tb_time_type) AS num_group FROM tb_times WHERE tb_time_type='5' and tb_time_degree ='".$fetch_disroom['tb_room_id']."' $sql_search";
$numlateall = $fetch_numruletype1['num_group']+$fetch_numruletype2['num_group']+$fetch_numruletype4['num_group']+$fetch_numruletype5['num_group'];
$numpercen = ($numlateall*100)/$fetch_numstu['num_group'];
$numpercenall = 100-$numpercen;
//แสดงผลในรวมแต่ละคอลัมภ์
$numallcol += $fetch_numstu['num_group'];
$numallcol1 += $fetch_numruletype1['num_group'];
$numallcol2 += $fetch_numruletype2['num_group'];
$numallcol3 += $fetch_numruletype3['num_group'];
$numallcol4 += $fetch_numruletype4['num_group'];
$numallcol5 += $fetch_numruletype5['num_group'];
$numallcol6 += $fetch_numstu['num_group']-$numlateall;
$numpercentotal += ($numpercenall/$numrows);
if($i%2=="1"){
$bg="rowone";
}else{
$bg="rowtwo";
}
$stu_norigis = $fetch_numstu['num_group']-($fetch_numstu['num_group']-$numlateall);
///$numpercenlate = ($stu_norigis*$fetch_numstu['num_group'])/$numpercenall;
$numpercenlate = ($stu_norigis*100)/$fetch_numstu['num_group'];
$numpercentotallate += ($numpercenlate/$numrows);
$numallcol7 += $fetch_numstu['num_group']-($fetch_numstu['num_group']-$numlateall);
?>
<tr >
<td align="center" ><?php print $fetch_disroom['tb_room_name'];?></td>
<td align="center" ><?php print $fetch_numstu['num_group'];?></td>
<td align="center" ><?php print $fetch_numruletype5['num_group'];?></td>
<td align="center" ><?php print $fetch_numruletype1['num_group'];?></td>
<td align="center" ><?php print $fetch_numruletype4['num_group'];?></td>
<td align="center" ><?php print $fetch_numruletype3['num_group'];?></td>
<td align="center" ><?php print $fetch_numstu['num_group']-$numlateall;?></td>
<td align="center" ><?php print number_format($numpercenall,2);?></td>
<td align="center" ><?php print $stu_norigis;?></td>
<td align="center" ><?php print number_format($numpercenlate,2);?></td>
</tr>
<?php
$i++;
}
?>
<tr>
<td align="center" ><strong>รวม</strong></td>
<td align="center" ><strong><?php print number_format($numallcol,0);?></strong></td>
<td align="center" ><strong><?php print number_format($numallcol5,0);?></strong></td>
<td align="center" ><strong><?php print number_format($numallcol1,0);?></strong></td>
<td align="center" ><strong><?php print number_format($numallcol4,0);?></strong></td>
<td align="center" ><strong><?php print number_format($numallcol3,0);?></strong></td>
<td align="center" ><strong><?php print number_format($numallcol6,0);?></strong></td>
<td align="center" ><strong><?php print number_format($numpercentotal,2);?></strong></td>
<td align="center" ><strong><?php print number_format($numallcol7,0);?></strong></td>
<td align="center" ><strong><?php print number_format($numpercentotallate,2);?></strong></td>
</tr>
<?
}else{
?>
<tr>
<td colspan="10" align="center" bgcolor="#FFFFFF" ><span class="style1">ไม่พบข้อมูล</span></td>
</tr>
<?php
}
?>
</table>
</BODY>
</html>