PageRenderTime 43ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/examination/isps/main/administrator/print.php

https://github.com/web-gpambrosio/VMC
PHP | 144 lines | 132 code | 7 blank | 5 comment | 8 complexity | 00be3e4debcb5f3cdea147418f53b19f MD5 | raw file
  1. <?php
  2. include('../../includes/conn.php');
  3. $txt1=$_GET['txt1'];
  4. $txt2=$_GET['txt2'];
  5. $txt3=$_GET['txt3'];
  6. if ($txt3=="")
  7. $ex4se = "exam LIKE '%$txt3%'";
  8. else
  9. $ex4se = "exam='$txt3'";
  10. $sr = "SELECT * FROM users WHERE ".$ex4se." and testdate between '$txt1' and '$txt2' ORDER BY exam, fname desc";
  11. $SearchResult=mysql_query($sr) or die(mysql_error());
  12. ?>
  13. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  14. <html xmlns="http://www.w3.org/1999/xhtml">
  15. <head>
  16. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  17. <title>ISPS Online Examination - Report</title>
  18. <style type="text/css">
  19. body {
  20. font-family: Arial;
  21. color:#333333;
  22. font-size:12px;
  23. text-decoration:none;
  24. }
  25. .xtitle { color:#000000; font-family:Verdana; font-size:16px }
  26. </style>
  27. </head>
  28. <body>
  29. <table width="800" height="247" border="0" cellpadding="0" cellspacing="0" align="center" style="margin:5 5 5 5">
  30. <tr>
  31. <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  32. <tr>
  33. <td height="62" valign="top" align="right">
  34. <table width="597" height="48" border="0" cellpadding="0" cellspacing="0">
  35. <tr>
  36. <td colspan="3" height="10"></td>
  37. </tr><tr>
  38. <td width="41" align="left" valign="top"><img src="../../images/tnkc.gif" width="27" height="42" /></td>
  39. <td width="250" align="center" valign="top"><span class="xtitle"><strong>ISPS Online Examination</strong><br />
  40. <img src="../../images/book.gif" width="12" height="12"/> Report</span></td>
  41. <td width="267" valign="bottom" align="right"><span style="color:#666666; font-size:10px">PRINT DATE: <strong><?php echo date("F d, Y"); ?></strong></span>&nbsp;&nbsp;&nbsp;</td>
  42. </tr>
  43. </table></td>
  44. </tr>
  45. </table>
  46. <?php
  47. $num_row=mysql_num_rows($SearchResult);
  48. if ($num_row!='0')
  49. {
  50. ?>
  51. <table width="779" border="0" cellspacing="0" cellpadding="0" align="center">
  52. <tr>
  53. <td colspan="6" height="10"></td>
  54. </tr>
  55. <tr align="left" valign="top" style="font-size:13px; font-weight:bold; text-decoration:underline">
  56. <td width="33"></td>
  57. <td width="97">CREWCODE</td>
  58. <td width="281">NAME</td>
  59. <td width="148">TYPE OF EXAM</td>
  60. <td width="135">TEST DATE</td>
  61. <td width="85">SCORE (%)</td>
  62. </tr><tr>
  63. <td colspan="6" height="5"></td>
  64. </tr>
  65. <tr>
  66. <td colspan="6" height="3" style="border-bottom:double 3px #333333"></td>
  67. </tr>
  68. <tr>
  69. <td colspan="6" height="5"></td>
  70. </tr>
  71. <tr>
  72. <td colspan="6" height="2"></td>
  73. </tr>
  74. <?php
  75. while($row = mysql_fetch_object($SearchResult))
  76. {
  77. $ii = $i+1;
  78. $stypeofexam = mysql_query("select type from type where id='".$row->exam."'") or die(mysql_error());
  79. $rwtypeofexam = mysql_num_rows($stypeofexam);
  80. if ($rwtypeofexam != "0")
  81. {
  82. $rtype = mysql_result($stypeofexam,0,'type');
  83. }
  84. $dtestdate = date("d-M-Y / <b>H:i</b>", strtotime($row->testdate));
  85. //-----------
  86. $qexamtype_ue=mysql_query("select examtype.totalno As totalnoexam from users, examtype, type
  87. where type.id = users.exam and type.type=examtype.examname and users.crewcode='".$row->crewcode."'");
  88. $totalno_que=mysql_result($qexamtype_ue,0,"totalnoexam");
  89. //-----------
  90. $qcorrect_uexam=mysql_query("select count(correct) As correct_answer from users_exam
  91. where crewcode='".$row->crewcode."' and take='".$row->takeno."' and correct ='1'",$conn);
  92. $scorefg=mysql_result($qcorrect_uexam,0,"correct_answer");
  93. //-----------
  94. $percentscfg = (($scorefg / $totalno_que)*100);
  95. $pfg = round($percentscfg,0);
  96. //-----------
  97. $query_result_percentage=mysql_query("select sum(grade) As grade from passing order by id desc limit 1",$conn);
  98. $crewgrade=mysql_result($query_result_percentage,0,"grade");
  99. //-----------
  100. if (($row->testdate != "0000-00-00 00:00:00")&&($pfg == "0"))
  101. {
  102. $pstatus = '<span style="color:#FF0000; font-size:11px"><strong>(0%) FAILED</strong></span>';
  103. }
  104. else
  105. {
  106. if ($pfg >= $crewgrade)
  107. {
  108. $pstatus = '<span style="color:#009900; font-size:11px"><strong>('.$pfg.'%) PASSED</strong></span>';
  109. }
  110. else
  111. {
  112. $pstatus = '<span style="color:#FF0000; font-size:11px"><strong>('.$pfg.'%) FAILED</strong></span>';
  113. }
  114. }
  115. echo '<tr align="left" valign="top" style="font-size:12px; cursor:pointer">
  116. <td>&nbsp;&nbsp;&nbsp;'.$ii.'. </td>
  117. <td>'.$row->crewcode.'</td>
  118. <td>'.$row->fname.', '.$row->gname.' '.substr($row->mname,0,1).'.</td>
  119. <td>'.$rtype.'</td>
  120. <td>'.$dtestdate.'</td>
  121. <td>'.$pstatus.'</td>
  122. </tr>
  123. <tr>
  124. <td colspan="6" height="2"></td>
  125. </tr>';
  126. $i++;
  127. }
  128. ?>
  129. </table>
  130. <?php
  131. }
  132. ?>
  133. </td>
  134. </tr>
  135. </table>
  136. </body>
  137. </html>