Viewing file: repLoadExcelPieis.php (12.44 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
$excel = (! isset($_POST['excel'])? false : true);
if($excel){
header('Content-type: application/xls');
header('Content-Disposition: attachment; filename="workload.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 = $_GET['acadYear'];
//$acadYear = (! isset($_POST['acadYear'])? "" : $_POST['acadYear']);
$semester = (! isset($_POST['semester'])? "" : $_POST['semester']);
$studentYear = (! isset($_POST['studentYear'])? "" : $_POST['studentYear']);
$view = 'tt';//(! isset($_POST['view'])? "" : $_POST['view']);
$off_select = (! isset($_POST['off_select'])? "" : $_POST['off_select']);
$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">
<form name="workload" method="post" action="<?php echo $_SERVER['PHP_SELF']."?acadYear=$acadYear"; ?>" >
<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->qryPrsJoinRG($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 == 'tt'){
?>
<tr>
<td><table width="100%" border="1">
<tr bgcolor="<?php echo $GLOBALS["COLOR_BG_TABLE_2"];?>">
<?php if(!$excel){ ?><td rowspan="2" align="center"></td><?php } ?>
<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();
if($oOf->prsItId == 1 && ((isset($off_select[$oCt1->ctOfId]) && $excel) || !$excel)){
?>
<tr bgcolor="<?php echo $GLOBALS["COLOR_BG_TABLE_1"];?>">
<?php if(!$excel){?><td colspan="1" height="22" align="center">
<input type="checkbox" name="off_select[<?=$oOf->officerId;?>]">
</td><? } ?>
<td colspan="1" height="22"><font size="2" color="<?php echo $GLOBALS['COLOR_FONT_4'];?>">
<?php echo ($i+1).'. '.$oOf->officerName.' '.$oOf->officerSurname;?></font></td>
<?php
$oCl->RSClassByAcYAndStYAndSeAndOfIdGroupCoId($acadYear, $cndStY, $cndSe, $oCt1->ctOfId);
while($oCl->GetRecord()) {
$totalCoUnit = 0;
$oCo->SearchByKey($oCl->courseId);
$oCo->GetRecord();
?>
<?php
$oSt->RSrg_SysStudyType();
while($oSt->GetRecord()) {
$sumCoSstUnit = $oCt2->GetUnitByAcYAndStYAndSeAndCoIdAndOfIdAndSstId($acadYear, $cndStY, $semester, $oCl->courseId, $oCt1->ctOfId, $oSt->sstId);
$totalCoUnit += number_format($sumCoSstUnit, 3);
?>
<?php
}
?>
<?php
}
?>
<?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'];?>">
<?php if($excel){ echo '=T("'; }
echo substr($oCt2->GetHrByAcYAndStYAndSeAndOfIdAndSstId($acadYear, $cndStY, $cndSe, $oCt1->ctOfId, $oSt->sstId), 0, -3);
if($excel){ echo '")'; }?></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 if($excel){ echo '=T("'; }
echo substr($oCt2->GetHrByAcYAndStYAndSeAndOfId($acadYear, $cndStY, $cndSe, $oCt1->ctOfId), 0, -3);
if($excel){ echo '")'; }?></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
$i++;
}// end if prsItId==1
}
?>
<tr bgcolor="<?php echo $GLOBALS["COLOR_BG_TABLE_2"];?>">
<?php if(!$excel){ ?><td align="center"></td><?php } ?>
<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 if($excel){ echo '=T("'; }
echo substr($oCt2->GetHrByAcYAndStYAndSeAndSstId($acadYear, $cndStY, $cndSe, $oSt->sstId), 0, -3);
if($excel){ echo '")'; }?>
</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 if($excel){ echo '=T("'; }
echo substr($oCt2->GetHrByAcYAndStYAndSe($acadYear, $cndStY, $cndSe), 0, -3);
if($excel){ echo '")'; }?>
</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>
<?php if(!$excel){?>
<tr bgcolor="<?php echo $GLOBALS["COLOR_BG_TABLE_1"];?>">
<td colspan="16"><input type="submit" name="excel" id="add" value="ส่งออก excel"/></td>
</tr>
<?php } ?>
</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();
?>
|