| Viewing file:  repLoad.php (15.78 KB)      -rw-r--r-- Select action/file-type:
 
  (+) |  (+) |  (+) | Code (+) | Session (+) |  (+) | SDB (+) |  (+) |  (+) |  (+) |  (+) |  (+) | 
 
<?php
include_once "template.php";
 showHeader();
 include_once "../class/clsClass.php";
 include_once "../class/clsSysStudentYearDes.php";
 include_once "../class/clsrg_SysStudyType.php";
 include_once "../class/clsrg_CopyTimeTable.php";
 include_once "../class/clsOfficer.php";
 include_once "../class/clsCourse.php";
 include_once "../class/clsrg_HrPerUnit.php";
 
 $acadYear = (! isset($_POST['acadYear'])? $GLOBALS["ACADYEAR"] : $_POST['acadYear']);
 $semester = (! isset($_POST['semester'])? $GLOBALS["SEMESTER"] : $_POST['semester']);
 $studentYear = (! isset($_POST['studentYear'])? "" : $_POST['studentYear']);
 $view = (! isset($_POST['view'])? "" : $_POST['view']);
 
 $conn = new Connection();
 
 $oCl = new Class1();
 $oSy = new SysStudentYearDes();
 $oSt = new rg_SysStudyType();
 $oCt1 = new rg_CopyTimeTable();
 $oCt2 = new rg_CopyTimeTable();
 $oOf = new Officer();
 $oCo = new Course();
 $oHu = new rg_HrPerUnit();
 
 set_time_limit(0);
 ?>
 <meta http-equiv="Content-Type" content="text/html; charset=tis-620">
 <table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
 <tr>
 <td><br><fieldset>
 <legend><font size="2" color="<?php echo $GLOBALS["COLOR_FONT_3"]; ?>"><a href="adminIndex.php?mm=1">ภาระงานสอน</a> <img src="../picture/ico3.gif" align="absmiddle" border="0"> รายงานภาระงานสอน</font></legend>
 <div align="center"><br><form name="pc" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"><table width="100%" align="center">
 <tr>
 <td align="right"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_3'];?>">ส่งออกเป็น</font>
 <a onClick="document.printReport.submit();"><img src="../picture/excel.gif" border="0"></a></td>
 </tr>
 <tr>
 <td align="center"><font size="3" color="<?php echo $GLOBALS['COLOR_FONT_3'];?>"><b>รายงานภาระงานสอน</b></font><br><br></td>
 </tr>
 <tr>
 <td><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b>ภาค/ปีการศึกษา</b></font>
 <select name="semester">
 <option value="" <?php echo ($semester=='') ? 'selected' : '';?>>ทุกภาคการศึกษา</option>
 <?php
 $oCl->RSClassByCTGroupSe();
 while($oCl->GetRecord()) {
 ?>
 <option value="<?php echo $oCl->semester;?>" <?php echo ($oCl->semester==$semester) ? 'selected' : '';?>><?php echo $oCl->semester;?></option>
 <?php
 }
 ?>
 </select>
 /
 <select name="acadYear">
 <option value="">--เลือก--</option>
 <?php
 $oCl->RSClassByCTGroupAcY();
 while($oCl->GetRecord()) {
 ?>
 <option value="<?php echo $oCl->acadYear;?>" <?php echo ($oCl->acadYear==$acadYear) ? 'selected' : '';?>><?php echo $oCl->acadYear;?></option>
 <?php
 }
 ?>
 </select>
 <font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b>ชั้นปี</b></font>
 <select name="studentYear">
 <option value="" <?php echo ($studentYear=='') ? 'selected' : '';?>>ทุกชั้นปี</option>
 <?php
 $oSy->RSSysStudentYearDes();
 while($oSy->GetRecord()) {
 ?>
 <option value="<?php echo $oSy->studentYear;?>" <?php echo ($oSy->studentYear==$studentYear) ? 'selected' : '';?>><?php echo $oSy->studentYear;?></option>
 <?php
 }
 ?>
 </select>
 <font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b>ดูตาม</b></font>
 <select name="view">
 <option value="">--เลือก--</option>
 <option value="t" <?php echo ($view=='t') ? 'selected' : '';?>>อาจารย์ผู้สอน</option>
 <option value="s" <?php echo ($view=='s') ? 'selected' : '';?>>รายวิชา</option>
 </select>
 <input type="submit" id="btnSubmit" name="btnSubmit" value="ค้นหา" />
 </td>
 </tr>
 <?php
 $cndStY = ($studentYear) ? " and coSyId='$studentYear'" : "";
 $cndSe = ($semester) ? " and coTmId='$semester'" : "";
 
 if($view == 't') {
 ?>
 <tr>
 <td><table width="100%">
 <tr bgcolor="<?php echo $GLOBALS["COLOR_BG_TABLE_2"];?>">
 <td rowspan="2" align="center"><font color="<?php echo $GLOBALS["COLOR_FONT_1"];?>" size="2"><b>อาจารย์ผู้สอน</b></font></td>
 <?php
 $oSt->RSrg_SysStudyType();
 while($oSt->GetRecord()) {
 ?>
 <td colspan="2" align="center"><font color="<?php echo $GLOBALS["COLOR_FONT_1"];?>" size="2"><b><?php echo $oSt->sstName;?></b></font></td>
 <?php
 }
 ?>
 <td colspan="2" align="center"><font color="<?php echo $GLOBALS["COLOR_FONT_1"];?>" size="2"><b>รวม</b></font></td>
 </tr>
 <tr bgcolor="<?php echo $GLOBALS["COLOR_BG_TABLE_2"];?>">
 <?php
 for($i=0; $i<=$oSt->NumRow(); $i++) {
 ?>
 <td width="4%" align="center"><font color="<?php echo $GLOBALS["COLOR_FONT_1"];?>" size="2"><b>ชม.</b></font></td>
 <td width="6%" align="center"><font color="<?php echo $GLOBALS["COLOR_FONT_1"];?>" size="2"><b>ภาระ</b></font></td>
 <?php
 }
 ?>
 </tr>
 <?php
 $i = 0;
 $oCt1->RSrg_CopyTimeTableByAcYAndStYAndSeGroupOfId($acadYear, $cndStY, $cndSe);
 while($oCt1->GetRecord()) {
 $totalOfUnit = 0;
 
 //$oOf->SearchByKey($oCt1->ctOfId);
 $oOf->qryPrsJoinRG($oCt1->ctOfId);
 $oOf->GetRecord();
 $oOf->GetRecord();
 ?>
 <tr bgcolor="<?php echo $GLOBALS["COLOR_BG_TABLE_1"];?>">
 <td colspan="15" height="22"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b><?php echo $oOf->officerName.' '.$oOf->officerSurname;?></b></font></td>
 </tr>
 <?php
 $oCl->RSClassByAcYAndStYAndSeAndOfIdGroupCoId($acadYear, $cndStY, $cndSe, $oCt1->ctOfId);
 while($oCl->GetRecord()) {
 $totalCoUnit = 0;
 
 $oCo->SearchByKey($oCl->courseId);
 $oCo->GetRecord();
 ?>
 <tr>
 <td><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><?php echo $oCo->courseCode.' '.$oCo->courseName.' '.$oCo->courseUnit;?></font></td>
 <?php
 $oSt->RSrg_SysStudyType();
 while($oSt->GetRecord()) {
 $sumCoSstUnit = $oCt2->GetUnitByAcYAndStYAndSeAndCoIdAndOfIdAndSstId($acadYear, $cndStY, $semester, $oCl->courseId, $oCt1->ctOfId, $oSt->sstId);
 $totalCoUnit += number_format($sumCoSstUnit, 3);
 ?>
 <td align="right"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><?php echo substr($oCt2->GetHrByAcYAndStYAndSeAndCoIdAndOfIdAndSstId($acadYear, $cndStY, $cndSe, $oCl->courseId, $oCt1->ctOfId, $oSt->sstId), 0, -3);?></font></td>
 <td align="right"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><?php echo number_format($sumCoSstUnit, 3);?></font></td>
 <?php
 }
 ?>
 <td align="right"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><?php echo substr($oCt2->GetHrByAcYAndStYAndSeAndCoIdAndOfId($acadYear, $cndStY, $cndSe, $oCl->courseId, $oCt1->ctOfId), 0, -3);?></font></td>
 <td align="right"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><?php echo number_format($totalCoUnit, 3);?></font></td>
 </tr>
 <?php
 }
 ?>
 <tr bgcolor="<?php echo $GLOBALS["COLOR_BG_TABLE_5"];?>">
 <td height="22" align="center"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b>รวม</b></font></td>
 <?php
 $oSt->RSrg_SysStudyType();
 while($oSt->GetRecord()) {
 $sumOfSstUnit = $oCt2->GetUnitByAcYAndStYAndSeAndOfIdAndSstId($acadYear, $cndStY, $semester, $oCt1->ctOfId, $oSt->sstId);
 $totalOfUnit += number_format($sumOfSstUnit, 3);
 ?>
 <td align="right"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b><?php echo substr($oCt2->GetHrByAcYAndStYAndSeAndOfIdAndSstId($acadYear, $cndStY, $cndSe, $oCt1->ctOfId, $oSt->sstId), 0, -3);?></b></font></td>
 <td align="right"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b><?php echo number_format($sumOfSstUnit, 3);?></b></font></td>
 <?php
 }
 ?>
 <td align="right"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b><?php echo substr($oCt2->GetHrByAcYAndStYAndSeAndOfId($acadYear, $cndStY, $cndSe, $oCt1->ctOfId), 0, -3);?></b></font></td>
 <td align="right"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b><?php echo number_format($totalOfUnit, 3);?></b></font></td>
 </tr>
 <?php
 $i++;
 }
 ?>
 <tr bgcolor="<?php echo $GLOBALS["COLOR_BG_TABLE_2"];?>">
 <td height="22" align="center"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_1'];?>"><b>รวม</b></font></td>
 <?php
 $oSt->RSrg_SysStudyType();
 while($oSt->GetRecord()) {
 $sumSstUnit = $oCt2->GetUnitByAcYAndStYAndSeAndSstId($acadYear, $cndStY, $semester, $oSt->sstId);
 $totalUnit += number_format($sumSstUnit, 3);
 ?>
 <td align="right"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_1'];?>"><b><?php echo substr($oCt2->GetHrByAcYAndStYAndSeAndSstId($acadYear, $cndStY, $cndSe, $oSt->sstId), 0, -3);?></b></font></td>
 <td align="right"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_1'];?>"><b><?php echo number_format($sumSstUnit, 3);?></b></font></td>
 <?php
 }
 ?>
 <td align="right"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_1'];?>"><b><?php echo substr($oCt2->GetHrByAcYAndStYAndSe($acadYear, $cndStY, $cndSe), 0, -3);?></b></font></td>
 <td align="right"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_1'];?>"><b><?php echo number_format($totalUnit, 3);?></b></font></td>
 </tr>
 </table></td>
 </tr>
 <?php
 }
 else if($view == 's') {
 ?>
 <tr>
 <td><table width="100%">
 <tr bgcolor="<?php echo $GLOBALS["COLOR_BG_TABLE_2"];?>">
 <td rowspan="2" align="center"><font color="<?php echo $GLOBALS["COLOR_FONT_1"];?>" size="2"><b>รายวิชา</b></font></td>
 <?php
 $oSt->RSrg_SysStudyType();
 while($oSt->GetRecord()) {
 ?>
 <td colspan="2" align="center"><font color="<?php echo $GLOBALS["COLOR_FONT_1"];?>" size="2"><b><?php echo $oSt->sstName;?></b></font></td>
 <?php
 }
 ?>
 <td colspan="2" align="center"><font color="<?php echo $GLOBALS["COLOR_FONT_1"];?>" size="2"><b>รวม</b></font></td>
 </tr>
 <tr bgcolor="<?php echo $GLOBALS["COLOR_BG_TABLE_2"];?>">
 <?php
 for($i=0; $i<=$oSt->NumRow(); $i++) {
 ?>
 <td width="4%" align="center"><font color="<?php echo $GLOBALS["COLOR_FONT_1"];?>" size="2"><b>ชม.</b></font></td>
 <td width="6%" align="center"><font color="<?php echo $GLOBALS["COLOR_FONT_1"];?>" size="2"><b>ภาระ</b></font></td>
 <?php
 }
 ?>
 </tr>
 <?php
 $i = 0;
 $oCl->RSClassByAcYAndStYAndSeGroupCoId($acadYear, $cndStY, $cndSe);
 while($oCl->GetRecord()) {
 $totalCoUnit = 0;
 
 $oCo->SearchByKey($oCl->courseId);
 $oCo->GetRecord();
 ?>
 <tr bgcolor="<?php echo $GLOBALS["COLOR_BG_TABLE_1"];?>">
 <td colspan="15" height="22"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b><?php echo $oCo->courseCode.' '.$oCo->courseName.' '.$oCo->courseUnit;?></b></font></td>
 </tr>
 <?php
 $oCt1->RSrg_CopyTimeTableByAcYAndStYAndSeAndCoIdGroupOfId($acadYear, $cndStY, $cndSe, $oCl->courseId);
 //echo $oCt1->lastSql.'<BR>';
 while($oCt1->GetRecord()) {
 $totalOfUnit = 0;
 //$oOf->SearchByKey($oCt1->ctOfId);
 $oOf->qryPrsJoinRG($oCt1->ctOfId);
 $oOf->GetRecord();
 /*                                if($oCl->courseId == '2854'){
 echo $oCt1->ctOfId.' ,<BR> ';
 echo 'Query:: '.$oOf->lastSql.'<BR>';
 }   */
 
 ?>
 <tr>
 <td><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><?php echo $oOf->officerName.' '.$oOf->officerSurname.' '.$oOf->fName;?></font></td>
 <?php
 $oSt->RSrg_SysStudyType();
 while($oSt->GetRecord()) {
 $sumOfSstUnit = $oCt2->GetUnitByAcYAndStYAndSeAndCoIdAndOfIdAndSstId($acadYear, $cndStY, $semester, $oCl->courseId, $oCt1->ctOfId, $oSt->sstId);
 $totalOfUnit += number_format($sumOfSstUnit, 3);
 ?>
 <td align="right"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><?php echo substr($oCt2->GetHrByAcYAndStYAndSeAndCoIdAndOfIdAndSstId($acadYear, $cndStY, $cndSe, $oCl->courseId, $oCt1->ctOfId, $oSt->sstId), 0, -3);?></font></td>
 <td align="right"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><?php echo number_format($sumOfSstUnit, 3);?></font></td>
 <?php
 }
 ?>
 <td align="right"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><?php echo substr($oCt2->GetHrByAcYAndStYAndSeAndCoIdAndOfId($acadYear, $cndStY, $cndSe, $oCl->courseId, $oCt1->ctOfId), 0, -3);?></font></td>
 <td align="right"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><?php echo number_format($totalOfUnit, 3);?></font></td>
 </tr>
 <?php
 }
 ?>
 <tr bgcolor="<?php echo $GLOBALS["COLOR_BG_TABLE_5"];?>">
 <td height="22" align="center"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b>รวม</b></font></td>
 <?php
 $oSt->RSrg_SysStudyType();
 while($oSt->GetRecord()) {
 $sumCoSstUnit = $oCt2->GetUnitByAcYAndStYAndSeAndCoIdAndSstId($acadYear, $cndStY, $semester, $oCl->courseId, $oSt->sstId);
 $totalCoUnit += number_format($sumCoSstUnit, 3);
 ?>
 <td align="right"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b><?php echo substr($oCt2->GetHrByAcYAndStYAndSeAndCoIdAndSstId($acadYear, $cndStY, $cndSe, $oCl->courseId, $oSt->sstId), 0, -3);?></b></font></td>
 <td align="right"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b><?php echo number_format($sumCoSstUnit, 3);?></b></font></td>
 <?php
 }
 ?>
 <td align="right"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b><?php echo substr($oCt2->GetHrByAcYAndStYAndSeAndCoId($acadYear, $cndStY, $cndSe, $oCl->courseId), 0, -3);?></b></font></td>
 <td align="right"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><b><?php echo number_format($totalCoUnit, 3);?></b></font></td>
 </tr>
 <?php
 $i++;
 }
 ?>
 <tr bgcolor="<?php echo $GLOBALS["COLOR_BG_TABLE_2"];?>">
 <td height="22" align="center"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_1'];?>"><b>รวม</b></font></td>
 <?php
 $oSt->RSrg_SysStudyType();
 while($oSt->GetRecord()) {
 $sumSstUnit = $oCt2->GetUnitByAcYAndStYAndSeAndSstId($acadYear, $cndStY, $semester, $oSt->sstId);
 $totalUnit += number_format($sumSstUnit, 3);
 ?>
 <td align="right"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_1'];?>"><b><?php echo substr($oCt2->GetHrByAcYAndStYAndSeAndSstId($acadYear, $cndStY, $cndSe, $oSt->sstId), 0, -3);?></b></font></td>
 <td align="right"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_1'];?>"><b><?php echo number_format($sumSstUnit, 3);?></b></font></td>
 <?php
 }
 ?>
 <td align="right"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_1'];?>"><b><?php echo substr($oCt2->GetHrByAcYAndStYAndSe($acadYear, $cndStY, $cndSe), 0, -3);?></b></font></td>
 <td align="right"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_1'];?>"><b><?php echo number_format($totalUnit, 3);?></b></font></td>
 </tr>
 </table></td>
 </tr>
 <?php
 }
 ?>
 </table></form>
 <form name="printReport" method="post" action="repLoadExcel.php">
 <input type="hidden" name="acadYear" value="<?php echo $acadYear;?>">
 <input type="hidden" name="semester" value="<?php echo $semester;?>">
 <input type="hidden" name="studentYear" value="<?php echo $studentYear;?>">
 <input type="hidden" name="view" value="<?php echo $view;?>">
 </form></div>
 </fieldset><br></td>
 </tr>
 </table>
 <?php
 set_time_limit(30);
 
 $oCl->Destroy();
 $oSy->Destroy();
 $oSt->Destroy();
 $oCt1->Destroy();
 $oCt2->Destroy();
 $oOf->Destroy();
 $oCo->Destroy();
 $conn->Disconnect();
 showFooter();
 ?>
 |