| Viewing file:  repLoadExcel.php (12.4 KB)      -rwxr-xr-x Select action/file-type:
 
  (+) |  (+) |  (+) | Code (+) | Session (+) |  (+) | SDB (+) |  (+) |  (+) |  (+) |  (+) |  (+) | 
 
<?php
header('Content-type: application/xls');
 header('Content-Disposition: attachment; filename="testing.xls"');
 
 include_once "../global0.php";
 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'])? "" : $_POST['acadYear']);
 $semester = (! isset($_POST['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);
 
 if ($view) {
 ?>
 <meta http-equiv="Content-Type" content="text/html; charset=tis-620">
 <table width="100%" align="center">
 <tr>
 <td align="center"><font color="<?php echo $GLOBALS["COLOR_FONT_4"];?>" size="2"><b>รายงานภาระงานสอน
 <?php echo ($semester) ? "ภาคการศึกษา ".$semester : "";?>
 ปีการศึกษา <?php echo $acadYear;?>
 <?php echo ($studentYear) ? "ชั้นปี ".$studentYear : "ทุกชั้นปี";?></b></font></td>
 </tr>
 <tr>
 <td height="22"></td>
 </tr>
 <?php
 $cndStY = ($studentYear) ? " and coSyId='$studentYear'" : "";
 $cndSe = ($semester) ? " and coTmId='$semester'" : "";
 
 if($view == 't') {
 ?>
 <tr>
 <td><table width="100%" border="1">
 <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->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'];?>">=T("<?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'];?>">=T("<?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>=T("<?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>=T("<?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>=T("<?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>=T("<?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%" border="1">
 <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);
 while($oCt1->GetRecord()) {
 $totalOfUnit = 0;
 
 $oOf->SearchByKey($oCt1->ctOfId);
 $oOf->GetRecord();
 ?>
 <tr>
 <td><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>"><?php echo $oOf->officerName.' '.$oOf->officerSurname;?></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'];?>">=T("<?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'];?>">=T("<?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>=T("<?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>=T("<?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>=T("<?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>=T("<?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>
 <?php
 }
 
 set_time_limit(30);
 
 $oCl->Destroy();
 $oSy->Destroy();
 $oSt->Destroy();
 $oCt1->Destroy();
 $oCt2->Destroy();
 $oOf->Destroy();
 $oCo->Destroy();
 $conn->Disconnect();
 ?>
 |