| Server IP : 61.19.30.66 / Your IP : 216.73.216.59 Web Server : Apache/2.2.22 (Ubuntu) System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 User : www-data ( 33) PHP Version : 5.3.10-1ubuntu3.48 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /var/www/gpa/ |
Upload File : |
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=tis-620">
<title>grad</title>
</head>
<body>
<?
require_once "head.php";
require_once "config/connectdb.php";
$strSQL = "SELECT * FROM transcripts LEFT JOIN klw ON transcripts.IDstudent=klw.Username where code = '$_GET[id]' and xyy='$_GET[xyy]' and activity<1 order by room+1 ASC, total desc";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<br>
<br>
<?
$sql2="SELECT namesc,tumbolsc,amps,dissc,years FROM config";
mysql_query("SET character_set_results=tis620");//ตั้งค่าการดึงข้อมูลออกมาให้เป็น tis620
mysql_query("SET character_set_client=tis620");//ตั้งค่าการส่งข้อมุลลงฐานข้อมูลออกมาให้ เป็น tis620
mysql_query("SET character_set_connection=tis620");//ตั้งค่าการติดต่อฐานข้อมูลให้เป็น ti
$result2 = mysql_query($sql2);
while (list($namesc,$tumbolsc,$amps,$dissc,$years) = mysql_fetch_row($result2)) {
$xsc_Name = $namesc;
$xsc_tumbolsc = $tumbolsc;
$xsc_disc = $dissc;
$xsc_amps = $amps;
$xsc_years = $years;
}
?>
<br>
<center><font size="5">ผลการเรียนรายวิชาโรงเรียน <? echo $xsc_Name; ?> รหัสวิชา <? echo $_GET[id];?> </font> </center>
<br>
<tr>
</tr>
<table width="100%" border="0" bgcolor="000000">
<tr bgcolor="FFFFFF">
<th width="5%"> <div align="left">#</div></th>
<th width="5%"> <div align="left">เลขประจำตัว</div></th>
<th width="5%"> <div align="left">ห้อง</div></th>
<th width="20%"> <div align="center">ชื่อ</div></th>
<th width="10%"> <div align="center">ปี</div></th>
<th width="2%"> <div align="center">คะแนน</div></th>
<th width="2%"> <div align="center">เกรด</div></th>
<th width="2%"> <div align="center">ประเมิน</div></th>
<th width="2%"> <div align="center"></div></th>
<th width="2%"> <div align="center"></div></th>
<th width="10%"> <div align="center">หมายเหตุุ</div></th>
</tr>
<?
$i =0;
while($objResult = mysql_fetch_array($objQuery))
{
$i = $i + 1;
$room =$objResult["room"];
$total =$objResult["total"];
$scor1k =$objResult["scor1k"];
$scor1p =$objResult["scor1p"];
$scor1a =$objResult["scor1a"];
$scor1 =$scor1k+$scor1p+$scor1a;
$scor2k =$objResult["scor2k"];
$scor2p =$objResult["scor2p"];
$scor2a =$objResult["scor2a"];
$scor2 =$scor2k+$scor2p+$scor2a;
$scor3k =$objResult["scor3k"];
$scor3p =$objResult["scor3p"];
$scor3a =$objResult["scor3a"];
$scor3 =$scor3k+$scor3p+$scor3a;
$scor4k =$objResult["scor4k"];
$scor4p =$objResult["scor4p"];
$scor4a =$objResult["scor4a"];
$scor4 =$scor4k+$scor4p+$scor4a;
$scor5k =$objResult["scor5k"];
$scor5p =$objResult["scor5p"];
$scor5a =$objResult["scor5a"];
$scor5 =$scor5k+$scor5p+$scor5a;
$scor6k =$objResult["scor6k"];
$scor6p =$objResult["scor6p"];
$scor6a =$objResult["scor6a"];
$scor6 =$scor6k+$scor6p+$scor6a;
$mid =$objResult["mid"];
$final1 =$objResult["final1"];
$total22 =$scor1+$scor2+$scor3+$scor4+$scor5+$scor6+$mid+$final1;
?>
<tr bgcolor="FFFFFF">
<td><? echo "$i"; ?></td>
<td><?=$objResult["IDstudent"];?></td>
<td><div align="left">
<a href="gradestudent.php?id=<?=$objResult["code"];?>&&teach=<?=$objResult["teach"];?>&&xyy=<?=$objResult["xyy"];?>&&room=<?=$objResult["room"];?>
" style="text-decoration: none;">
<input type="hidden" name="hdnIDstudent<?=$i;?>" size="2" value="<?=$objResult["code"];?>">
<?=$objResult["room"];?>
</div></a></td>
<td><?=$objResult["prefix"];?><?=$objResult["Name"];?> <?=$objResult["surname"];?></td>
<td> <?=$objResult["xyy"];?>/<?=$objResult["xterm"];?></td>
<td><? echo "$total22"; ?></td>
<td><?=$objResult["grad"];?></td>
<td align="right">
<? if($total22 == -1)
{
echo "ร";
}
else if($total22 == -2)
{
echo "มส";
}
else if($total22 < 50)
{
echo "อ่อน";
}
else if($total22 < 55)
{
echo "อ่อน";
}
else if($total22 < 60)
{
echo "ปานกลาง";
}
else if($total22 < 65)
{
echo "ปานกลาง";
}
else if($total22 < 70)
{
echo "ปานกลาง";
}
else if($total22 < 75)
{
echo "เก่ง";
}
else if($total22 < 80)
{
echo "เก่ง";
}
else
{
echo "เก่ง";
}
?>
</td>
<td align="right"></td>
<td align="right"></td>
<td align="right"><?=$objResult["teach"];?></td>
</tr>
<?
}
?>
</table>
<br>
<br>
<?
//////////////
$crsql="SELECT count( grad ) FROM `transcripts`
JOIN klw ON transcripts.IDstudent=klw.Username
WHERE grad LIKE '%0%' and code = '$_GET[id]' and xyy='$_GET[xyy]'";
$slr=mysql_query($crsql) or die(mysql_error()."<br>".$crsql);
$dcrd = mysql_fetch_array($slr);
$slipnum_0=$dcrd[0];
$crsql="SELECT count( grad ) FROM `transcripts`
JOIN klw ON transcripts.IDstudent=klw.Username
WHERE grad =1 and code = '$_GET[id]' and xyy='$_GET[xyy]'";
$slr=mysql_query($crsql) or die(mysql_error()."<br>".$crsql);
$dcrd = mysql_fetch_array($slr);
$slipnum_1=$dcrd[0];
$crsql="SELECT count( grad ) FROM `transcripts`
JOIN klw ON transcripts.IDstudent=klw.Username
WHERE grad =1.5 and code = '$_GET[id]' and xyy='$_GET[xyy]' ";
$slr=mysql_query($crsql) or die(mysql_error()."<br>".$crsql);
$dcrd = mysql_fetch_array($slr);
$slipnum_15=$dcrd[0];
$crsql="SELECT count( grad ) FROM `transcripts`
JOIN klw ON transcripts.IDstudent=klw.Username
WHERE grad =2 and code = '$_GET[id]' and xyy='$_GET[xyy]' ";
$slr=mysql_query($crsql) or die(mysql_error()."<br>".$crsql);
$dcrd = mysql_fetch_array($slr);
$slipnum_2=$dcrd[0];
$crsql="SELECT count( grad ) FROM `transcripts`
JOIN klw ON transcripts.IDstudent=klw.Username
WHERE grad =2.5 and code = '$_GET[id]' and xyy='$_GET[xyy]' ";
$slr=mysql_query($crsql) or die(mysql_error()."<br>".$crsql);
$dcrd = mysql_fetch_array($slr);
$slipnum_25=$dcrd[0];
$crsql="SELECT count( grad ) FROM `transcripts`
JOIN klw ON transcripts.IDstudent=klw.Username
WHERE grad =3 and code = '$_GET[id]' and xyy='$_GET[xyy]' ";
$slr=mysql_query($crsql) or die(mysql_error()."<br>".$crsql);
$dcrd = mysql_fetch_array($slr);
$slipnum_3=$dcrd[0];
$crsql="SELECT count( grad ) FROM `transcripts`
JOIN klw ON transcripts.IDstudent=klw.Username
WHERE grad =3.5 and code = '$_GET[id]' and xyy='$_GET[xyy]'";
$slr=mysql_query($crsql) or die(mysql_error()."<br>".$crsql);
$dcrd = mysql_fetch_array($slr);
$slipnum_35=$dcrd[0];
$crsql="SELECT count( grad ) FROM `transcripts`
JOIN klw ON transcripts.IDstudent=klw.Username
WHERE grad =4 and code = '$_GET[id]' and xyy='$_GET[xyy]'";
$slr=mysql_query($crsql) or die(mysql_error()."<br>".$crsql);
$dcrd = mysql_fetch_array($slr);
$slipnum_4=$dcrd[0];
$crsql="SELECT count( grad ) FROM `transcripts`
JOIN klw ON transcripts.IDstudent=klw.Username
WHERE total LIKE '%-1%' and code = '$_GET[id]' and xyy='$_GET[xyy]'";
$slr=mysql_query($crsql) or die(mysql_error()."<br>".$crsql);
$dcrd = mysql_fetch_array($slr);
$slipnum_i=$dcrd[0];
$crsql="SELECT count( IDstudent ) FROM `transcripts`
JOIN klw ON transcripts.IDstudent=klw.Username
WHERE code = '$_GET[id]' and xyy='$_GET[xyy]' ";
$slr=mysql_query($crsql) or die(mysql_error()."<br>".$crsql);
$dcrd = mysql_fetch_array($slr);
$slipnum_total=$dcrd[0];
$slipnum_total1=$slipnum_0+$slipnum_1+$slipnum_15+$slipnum_2+$slipnum_25+$slipnum_3+$slipnum_35+$slipnum_4+$slipnum_i;
///////MAX
$crsql="SELECT max( total ) FROM `transcripts`
JOIN klw ON transcripts.IDstudent=klw.Username
WHERE code = '$_GET[id]' and teach='$_GET[teach]' and xyy='$_GET[xyy]' and room='$_GET[room]'";
$slr=mysql_query($crsql) or die(mysql_error()."<br>".$crsql);
$dcrd = mysql_fetch_array($slr);
$slipnum_MAX=$dcrd[0];
///////MIN
$crsql="SELECT min( total ) FROM `transcripts`
JOIN klw ON transcripts.IDstudent=klw.Username
WHERE code = '$_GET[id]' and teach='$_GET[teach]' and xyy='$_GET[xyy]' and room='$_GET[room]'";
$slr=mysql_query($crsql) or die(mysql_error()."<br>".$crsql);
$dcrd = mysql_fetch_array($slr);
$slipnum_MIN=$dcrd[0];
//////////รihvp]t//รih
$slipnum_p0=($slipnum_0/$slipnum_total)*100;
$slipnum_p1=($slipnum_1/$slipnum_total)*100;
$slipnum_p15=($slipnum_15/$slipnum_total)*100;
$slipnum_p2=($slipnum_2/$slipnum_total)*100;
$slipnum_p25=($slipnum_25/$slipnum_total)*100;
$slipnum_p3=($slipnum_3/$slipnum_total)*100;
$slipnum_p35=($slipnum_35/$slipnum_total)*100;
$slipnum_p4=($slipnum_4/$slipnum_total)*100;
$slipnum_pi=($slipnum_i/$slipnum_total)*100;
$slipnum_ptotal=($slipnum_total/$slipnum_total)*100;
$slipnum_gpa=($slipnum_1*1+$slipnum_15*1.5+$slipnum_2*2+$slipnum_25*2.5+$slipnum_3*3+$slipnum_35*3.5+$slipnum_4*4)/$slipnum_total;
?>
<table width="100%" border="0" bgcolor="#BDBDBD">
<tr bgcolor="FFFFFF">
<th width="10%"> <div align="left">ผลการเรียน</div></th>
<th width="10%"> <div align="left">0</div></th>
<th width="10%"> <div align="center">1</div></th>
<th width="10%"> <div align="center">1.5</div></th>
<th width="10%"> <div align="center">2</div></th>
<th width="10%"> <div align="center">2.5</div></th>
<th width="10%"> <div align="center">3</div></th>
<th width="10%"> <div align="center">3.5</div></th>
<th width="10%"> <div align="center">4</div></th>
<th width="10%"> <div align="center">ร</div></th>
<th width="10%"> <div align="center">รวม</div></th>
</tr>
<tr bgcolor="FFFFFF">
<th width="10%"> <div align="left">จำนวนนักเรียน</div></th>
<th width="10%"> <div align="left"><? echo number_format($slipnum_0); ?></div></th>
<th width="10%"> <div align="left"><? echo number_format($slipnum_1); ?></div></th>
<th width="10%"> <div align="left"><? echo number_format($slipnum_15); ?></div></th>
<th width="10%"> <div align="left"><? echo number_format($slipnum_2); ?></div></th>
<th width="10%"> <div align="left"><? echo number_format($slipnum_25); ?></div></th>
<th width="10%"> <div align="left"><? echo number_format($slipnum_3); ?></div></th>
<th width="10%"> <div align="left"><? echo number_format($slipnum_35); ?></div></th>
<th width="10%"> <div align="left"><? echo number_format($slipnum_4); ?></div></th>
<th width="10%"> <div align="left"><? echo number_format($slipnum_i); ?></div></th>
<th width="10%"> <div align="left"><? echo number_format($slipnum_total); ?></div></th>
</tr>
<tr bgcolor="FFFFFF">
<th width="10%"> <div align="left">ร้อยละ</div></th>
<th width="10%"> <div align="left"><? echo number_format($slipnum_p0,2); ?></div></th>
<th width="10%"> <div align="left"><? echo number_format($slipnum_p1,2); ?></div></th>
<th width="10%"> <div align="left"><? echo number_format($slipnum_p15,2); ?></div></th>
<th width="10%"> <div align="left"><? echo number_format($slipnum_p2,2); ?></div></th>
<th width="10%"> <div align="left"><? echo number_format($slipnum_p25,2); ?></div></th>
<th width="10%"> <div align="left"><? echo number_format($slipnum_p3,2); ?></div></th>
<th width="10%"> <div align="left"><? echo number_format($slipnum_p35,2); ?></div></th>
<th width="10%"> <div align="left"><? echo number_format($slipnum_p4,2); ?></div></th>
<th width="10%"> <div align="left"><? echo number_format($slipnum_pi,2); ?></div></th>
<th width="10%"> <div align="left"><? echo number_format($slipnum_ptotal,2); ?></div></th>
</tr>
<tr bgcolor="FFFFFF">
<th width="10%"> <div align="left">gpa</div></th>
<th width="10%"> <div align="left"><? echo number_format($slipnum_gpa,2); ?></div></th>
</tr>
<tr bgcolor="FFFFFF">
</tr>
</table>
<?php
// ข้อมูล
$datas[] = array('0',$slipnum_0);
$datas[] = array('1',$slipnum_1);
$datas[] = array('1.5',$slipnum_15);
$datas[] = array('2',$slipnum_2);
$datas[] = array('2.5',$slipnum_25);
$datas[] = array('3',$slipnum_3);
$datas[] = array('3.5',$slipnum_35);
$datas[] = array('4',$slipnum_4);
$datas[] = array('ร',$slipnum_i);
// ค่าสูงสุด
$max_value = $slipnum_total;
// ความสูงของกราฟแท่ง (แต่ละแท่ง)
$bar_height = 16;
// ความกว้างรวมของกราฟ
$graph_width = 500;
// ระยะห่างของแต่ละกราฟและ padding ของกรอบ
$padding_width = 10;
// ความกว้างของ label ด้านซ้าย
$label_width = 30;
// จำนวนคอลัมน์ของ grid
$grid_cols = 5;
// จำนวนแถวของ grid
$grid_rows = floor(count($datas) / 2);
// ความสูงของกราฟ
$graph_height = (($bar_height + $padding_width) * count($datas)) + (3 * $padding_width);
// ความกว้างของกราฟ
$gw = $graph_width - $label_width - (2 * $padding_width);
$_v = $max_value / $grid_cols;
?>
<input type="button" value="Print this page" onclick="window.print()">
</body>
</html>
<?
$strSQL = "SELECT * FROM mainsubject LEFT JOIN transcripts ON
mainsubject.Codesub=transcripts.code JOIN klw ON transcripts.IDstudent=klw.Username JOIN teacher ON teacher.teachcode=transcripts.teach where code = '$_GET[id]' and xyy='$_GET[xyy]' and activity<1 group by room order by room+1 ASC, total desc";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<br>
<br>
<br>
<center><font size="5">สรุปรายห้อง</font> </center>
<br>
<tr>
</tr>
<table width="100%" border="0" bgcolor="000000">
<tr bgcolor="FFFFFF">
<th width="5%"> <div align="left">#</div></th>
<th width="5%"> <div align="left">ห้อง</div></th>
<th width="5%"> <div align="left">นร.</div></th>
<th width="20%"> <div align="center">อ่อน</div></th>
<th width="20%"> <div align="center">ปานกลาง</div></th>
<th width="20%"> <div align="center">เก่ง</div></th>
<th width="2%"> <div align="center"></div></th>
<th width="2%"> <div align="center"></div></th>
<th width="2%"> <div align="center"></div></th>
<th width="2%"> <div align="center"></div></th>
<th width="10%"> <div align="center">หมายเหตุุ</div></th>
</tr>
<?
$i =0;
while($objResult = mysql_fetch_array($objQuery))
{
$i = $i + 1;
$room1 =$objResult["room"];
$total =$objResult["total"];
?>
<tr bgcolor="FFFFFF">
<td><? echo "$i"; ?></td>
<td><? echo "$room1"; ?></td>
<td><? echo "$totalroom"; ?><div align="left">
</td>
<td>
<?
$crsql="SELECT count( IDstudent ) FROM `transcripts`
JOIN klw ON transcripts.IDstudent=klw.Username
WHERE code = '$_GET[id]' and xyy='$_GET[xyy]' and $total22<50 and room='$room1' ";
$slr=mysql_query($crsql) or die(mysql_error()."<br>".$crsql);
$dcrd = mysql_fetch_array($slr);
$good=$dcrd[0];
$crsql="SELECT count( IDstudent ) FROM `transcripts`
JOIN klw ON transcripts.IDstudent=klw.Username
WHERE code = '$_GET[id]' and xyy='$_GET[xyy]' and $total22<69 and room='$room1' ";
$slr=mysql_query($crsql) or die(mysql_error()."<br>".$crsql);
$dcrd = mysql_fetch_array($slr);
$good2=$dcrd[0];
$crsql="SELECT count( IDstudent ) FROM `transcripts`
JOIN klw ON transcripts.IDstudent=klw.Username
WHERE code = '$_GET[id]' and xyy='$_GET[xyy]' and $total22>69 and room='$room1' ";
$slr=mysql_query($crsql) or die(mysql_error()."<br>".$crsql);
$dcrd = mysql_fetch_array($slr);
$good3=$dcrd[0];
?>
<? echo "$good"; ?>
</td>
<td><? echo "$good2"; ?></td>
<td><? echo "$good3"; ?></td>
<td></td>
<td align="right">
</td>
<td align="right"></td>
<td align="right"></td>
<td align="right"></td>
</tr>
<?
}
?>
</table>
<?php
// css
$graphs[] = '<style type="text/css">';
$graphs[] = 'div#demo{border:2px solid #666;background-color:#EFEFEF;width:'.$graph_width.'px;height:'.$graph_height.'px;position:relative;}';
$graphs[] = 'div#demo *{margin:0;padding:0;font-family:Helvetica,Geneva,sans-serif;font-size:9px;}';
$graphs[] = 'div#demo > dl.graph-grid{margin-left:'.($label_width + $padding_width).'px;}';
$graphs[] = 'div#demo > dl.graph-grid > dd{border-bottom:1px solid #C4C4C4;float:left;height:'.($graph_height / $grid_rows).'px;width:'.$gw.'px;}';
$graphs[] = 'div#demo > dl.graph-grid > dt{position:absolute;height:'.$graph_height.'px;top:0;border-left:1px solid #C4C4C4;}';
$graphs[] = 'div#demo > dl.graph-grid > dt > span{border-right:1px dotted #C4C4C4;float:left;width:'.(($gw - $grid_cols) / $grid_cols).'px;height:'.($graph_height - $padding_width).'px;position:relative;}';
$graphs[] = 'div#demo > dl.graph-grid > dt > span > span{position:absolute;bottom:0;left:0;margin-bottom:-1.2em;margin-left:'.($gw / $grid_cols / 2).'px;width:'.($gw / $grid_cols).'px;text-align:center;}';
$graphs[] = 'div#demo > dl.graph-data{position:absolute;top:0;margin:'.$padding_width.'px;}';
$graphs[] = 'div#demo > dl.graph-data > dd{display:table;margin-bottom:10px;clear:both;}';
$graphs[] = 'div#demo span.label-row{float:left;width:'.$label_width.'px;line-height:'.$bar_height.'px;}';
$graphs[] = 'div#demo span.bar-graph{border-color:#E96AE8 #9A2B99 #000000 #E96AE8;border-width:1px;border-style:solid;float:left;}';
$graphs[] = 'div#demo span.value-graph{float:right;margin-right:5px;height:'.$bar_height.'px;line-height:'.$bar_height.'px;}';
$graphs[] = '</style>';
// วาดกราฟ
$graphs[] = '<div id="demo">';
$graphs[] = '<dl class="graph-grid">';
for ($i = 1; $i < $grid_rows; $i++) {
$graphs[] = '<dd></dd>';
}
$graphs[] = '<dt>';
for ($i = 0; $i < $grid_cols; $i++) {
$graphs[] = '<span><span>'.((1 + $i) * $_v).'</span></span>';
}
$graphs[] = '</dt>';
$graphs[] = '</dl>';
$graphs[] = '<dl class="graph-data">';
foreach ($datas AS $items) {
$w = (($gw - 2) * $items[1]) / $max_value;
$graphs[] = '<dd><span class="label-row">'.$items[0].'</span><span><span class="bar-graph" style="width:'.$w.'px;background-color:#D438D2;"><span class="value-graph">'.$items[1].'</span></span></span></dd>';
}
$graphs[] = '</dl>';
$graphs[] = '</div>';
echo implode("\n", $graphs);
?>