Viewing file: v_ris.php (13.07 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php ini_set("memory_limit", "128M"); header('Content-type: application/xls'); header('Content-Disposition: attachment; filename="ris.xls"');
function checkSst($sst) { if($sst=='1') $sst = 'มีชีวิตอยู่'; else if($sst=='2') $sst = 'หย่าร้าง'; else if($sst=='3') $sst = 'ตาย'; else $sst = '-'; return $sst; } ?> <table width="100%" align="center"> <tr> <td colspan="3" height="22" align="center"><font size="3"><b>รายชื่อสถานะนักศึกษาตามหลักสูตร</b></font></td> </tr> <tr> <td colspan="3" height="22"></td> </tr> <tr> <td colspan="3" height="22"><font size="2"><b>หลักสูตร</b> <?php echo $qu_cur->curName;?></font></td> </tr> <tr> <td colspan="3"><table border="1" cellspacing="0" cellpadding="0" bordercolor="#000000" style="border-collapse: collapse" align="center"> <tr> <td rowspan="2" align="center"><font size="2"><b>ที่</b></font></td> <td rowspan="2" align="center"><font size="2"><b>รหัสนักศึกษา</b></font></td> <td rowspan="2" align="center"><font size="2"><b>คำนำหน้าชื่อ</b></font></td> <td rowspan="2" align="center"><font size="2"><b>ชื่อ</b></font></td> <td rowspan="2" align="center"><font size="2"><b>นามสกุล</b></font></td> <td rowspan="2" align="center"><font size="2"><b>ชั้นปี</b></font></td> <td rowspan="2" align="center"><font size="2"><b>สถานะนักศึกษา</b></font></td> <td rowspan="2" align="center"><font size="2"><b>เจ้าของทุน</b></font></td> <td rowspan="2" align="center"><font size="2"><b>จังหวัด</b></font></td> <td rowspan="2" align="center"><font size="2"><b>สถานะก่อนเข้าเรียน</b></font></td> <td rowspan="2" align="center"><font size="2"><b>ประเภททุน</b></font></td> <?php set_time_limit(0); $fieldNames_settings = array( array ('$row->prefixNameEng', 'คำนำหน้าชื่อ (อังกฤษ)', 1), array ('$row->stdNameE','ชื่อ (อังกฤษ)', 1), array ('$row->stdSurnameE','นามสกุล (อังกฤษ)', 1), array ('$row->stdGPA','GPA', 1), array ('$row->sdtCitizenId','เลขที่บัตรประจำตัวประชาชน', 1), array ('$row->sdtSex','เพศ', 1), array ('$row->nationName','สัญชาติ', 1), array ('$row->religionName','ศาสนา', 1), array ('$row->sdtBirthDate','วันเกิด', 1), array ('age','อายุ', 1), array ('$row->sdtPrvIdBirth','จังหวัดที่เกิด', 1), array ('$row->sdtFatherName','ชื่อ-สกุลบิดา', 1), array ('$row->sdtFatherOccupation','อาชีพบิดา', 1), array ('$row->sdtFatherStatus','สถานภาพบิดา', 1), array ('$row->sdtMotherName','ชื่อ-สกุลมารดา', 1), array ('$row->sdtMotherOccupation','อาชีพมารดา', 1), array ('$row->sdtMotherStatus','สถานภาพมารดา', 1), array ('$row->sdtParentName','ชื่อ-สกุลผู้ปกครอง', 1), array ('$row->sdtParentRelationship','ความสัมพันธ์กับนักศึกษา', 1), array ('$row->sdtParentOccupation','อาชีพผู้ปกครอง', 1), array ('$row->sdtParentIncome','รายได้ผู้ปกครอง', 1), array ('$oSb->sdtContactName','ชื่อ-สกุลผู้ที่สามารถติดต่อได้', 1), array ('$row->edgName','วุฒิการศึกษาก่อนรับเข้า', 1), array ('$row->sdtContactAddr','ที่อยู่ผู้ปกครองที่สามารถติดต่อได้', 6), array ('$row->sdtHomeAddr','ที่อยู่นักศึกษาตามภูมิลำเนา', 6), array ('$row->sdtCurrentAddr','ที่อยู่ปัจจุบันนักศึกษา', 6), array ('$row->sdtWorkAddr','ที่อยู่ที่ทำงาน (ในกรณีที่ทำงานอยู่)', 6), array ('$row->sdtFatherAddr','ที่อยู่บิดา', 6), array ('$row->sdtMotherAddr','ที่อยู่มารดา', 6), array ('$row->sdtGraduateAddr','ที่อยู่หลังเรียนจบ', 6), array ('$row->sdtBloodGroup','หมู่เลือด', 1) );
$k=0; foreach($fieldNames as $val) { if($val) { ?> <td rowspan="<?php echo $fieldNames_settings[$k][2]==1 ? "2" : "1";?>" colspan="<?php echo $fieldNames_settings[$k][2];?>" align="center"><font size="2"><b><?php echo $fieldNames_settings[$k][1];?></b></font></td> <?php } $k++; } ?> <td align="center"><font size="2"><b>หมายเหตุ</b></font></td> </tr>
<tr> <?php $k=0; foreach($fieldNames as $val) { if($val) { if($fieldNames_settings[$k][2]>1) { ?>
<td align="center"><font size="2"><b>ที่อยู่</font></td> <td align="center"><font size="2"><b>ตำบล</font></td> <td align="center"><font size="2"><b>อำเภอ</font></td> <td align="center"><font size="2"><b>จังหวัด</font></td> <td align="center"><font size="2"><b>รหัสไปรษณีย์</font></td> <td align="center"><font size="2"><b>เบอร์โทรศัพท์</font></td> <?php } } $k++; } ?> </tr> <?php $i = 0; if($rs_std->num_rows()) { foreach($rs_std->result() as $row) { ?> <tr> <td align="center"><font size="2"><?php echo $i+1;?></font></td> <td align="center"><font size="2"><?=$row->stdCode;?></font></td> <td><font size="2"><?=$row->prefixName;?></font></td> <td><font size="2"><?=$row->stdName;?></font></td> <td><font size="2"><?=$row->stdSurname;?></font></td> <td align="center"><font size="2"><?=$row->stdSyId;?></font></td> <td align="center"><font size="2"><?=$row->sstName;?></font></td> <td><font size="2"><?=$row->soName;?></font></td> <td><font size="2"><?php echo $row->prvNameSo;?></font></td> <td><font size="2"><?=$row->paName;?></font></td> <td><font size="2"><?php echo $row->etName;?></font></td> <?php foreach($fieldNames as $val) { if($val) { $chkStr = ""; $str = $val; eval("\$str = \"$str\";"); switch($val){ case '$row->stdGPA' : $str = number_format($row->stdGPA, 2); break; case '$row->sdtSex' : $str = ($str=='M') ? 'ชาย' : (($str=='F') ? 'หญิง' : ''); break; case '$row->sdtBirthDate' : if ($str != "0000-00-00"){ $str = abbreDate2($str); }else $str = ""; break; case 'age' : if ($row->sdtBirthDate != "0000-00-00") { list($yy, $mm, $dd) = preg_split('[-]', $row->sdtBirthDate); $str = getNowYear() - $yy; } else $str = ""; break; case '$row->sdtPrvIdBirth' : $prv->provinceId = $row->sdtPrvIdBirth; $qu_prv = $prv->get_by_key(); $str = ($qu_prv->num_rows()) ? $qu_prv->row()->provinceName : ""; break; case '$row->sdtFatherStatus' : $str = checkSst($str); break; case '$row->sdtMotherStatus' : $str = checkSst($str); break; case '$row->sdtFatherName' : $str = $row->sdtFatherName.' '.$row->sdtFatherSurname; break; case '$row->sdtMotherName' : $str = $row->sdtMotherName.' '.$row->sdtMotherSurname; break; case '$row->sdtParentName' : $pf->prefixId = $row->sdtPfIdParent; $qu_pf = $pf->get_by_key(); $str = ($qu_pf->num_rows()) ? $qu_pf->row()->prefixName.$row->sdtParentName.' '.$row->sdtParentSurname : $row->sdtParentName.' '.$row->sdtParentSurname; break; case '$row->sdtContactAddr' : $contactAddr = $sdt->qryAddrOfContactJoinDtApPrv($row->stdId); $chkStr = 1; ?> <td><font size="2">=T("<?php echo $contactAddr->row()->sdtContactAddr;?>")</font></td> <td><font size="2">=T("<?php echo $contactAddr->row()->dtNameContact;?>")</font></td> <td><font size="2">=T("<?php echo $contactAddr->row()->apNameContact;?>")</font></td> <td><font size="2">=T("<?php echo $contactAddr->row()->prvNameContact;?>")</font></td> <td><font size="2">=T("<?php echo $contactAddr->row()->sdtContactPostCode;?>")</font></td> <td><font size="2">=T("<?php echo $contactAddr->row()->sdtContactPhoneNo;?>")</font></td> <?php break; case '$row->sdtHomeAddr' : $homeAddr = $sdt->qryAddrOfHomeJoinDtApPrv($row->stdId); $chkStr = 1; ?> <td><font size="2">=T("<?php echo $homeAddr->row()->sdtHomeAddr;?>")</font></td> <td><font size="2">=T("<?php echo $homeAddr->row()->dtNameHome;?>")</font></td> <td><font size="2">=T("<?php echo $homeAddr->row()->apNameHome;?>")</font></td> <td><font size="2">=T("<?php echo $homeAddr->row()->prvNameHome;?>")</font></td> <td><font size="2">=T("<?php echo $homeAddr->row()->sdtHomePostCode;?>")</font></td> <td><font size="2">=T("<?php echo $homeAddr->row()->sdtHomePhoneNo;?>")</font></td> <?php break; case '$row->sdtCurrentAddr' : $curAddr = $sdt->qryAddrOfCurrentJoinDtApPrv($row->stdId); $chkStr = 1; ?> <td><font size="2">=T("<?php echo $curAddr->row()->sdtCurrentAddr;?>")</font></td> <td><font size="2">=T("<?php echo $curAddr->row()->dtNameCurrent;?>")</font></td> <td><font size="2">=T("<?php echo $curAddr->row()->apNameCurrent;?>")</font></td> <td><font size="2">=T("<?php echo $curAddr->row()->prvNameCurrent;?>")</font></td> <td><font size="2">=T("<?php echo $curAddr->row()->sdtCurrentPostCode;?>")</font></td> <td><font size="2">=T("<?php echo $curAddr->row()->sdtCurrentPhoneNo;?>")</font></td> <?php break; case '$row->sdtWorkAddr' : $workAddr = $sdt->qryAddrOfWorkJoinDtApPrv($row->stdId); $chkStr = 1; ?> <td><font size="2">=T("<?php echo $workAddr->row()->sdtWorkAddr;?>")</font></td> <td><font size="2">=T("<?php echo $workAddr->row()->dtNameWork;?>")</font></td> <td><font size="2">=T("<?php echo $workAddr->row()->apNameWork;?>")</font></td> <td><font size="2">=T("<?php echo $workAddr->row()->prvNameWork;?>")</font></td> <td><font size="2">=T("<?php echo $workAddr->row()->sdtWorkPostCode;?>")</font></td> <td><font size="2">=T("<?php echo $workAddr->row()->sdtWorkPhoneNo;?>")</font></td> <?php break; case '$row->sdtFatherAddr' : $fatherAddr = $sdt->qryAddrOfFatherJoinDtApPrv($row->stdId); $chkStr = 1; ?> <td><font size="2">=T("<?php echo $fatherAddr->row()->sdtFatherAddr;?>")</font></td> <td><font size="2">=T("<?php echo $fatherAddr->row()->dtNameFather;?>")</font></td> <td><font size="2">=T("<?php echo $fatherAddr->row()->apNameFather;?>")</font></td> <td><font size="2">=T("<?php echo $fatherAddr->row()->prvNameFather;?>")</font></td> <td><font size="2">=T("<?php echo $fatherAddr->row()->sdtFatherPostCode;?>")</font></td> <td><font size="2">=T("<?php echo $fatherAddr->row()->sdtFatherPhoneNo;?>")</font></td> <?php break; case '$row->sdtMotherAddr' : $motherAddr = $sdt->qryAddrOfMotherJoinDtApPrv($row->stdId); $chkStr = 1; ?> <td><font size="2">=T("<?php echo $motherAddr->row()->sdtMotherAddr;?>")</font></td> <td><font size="2">=T("<?php echo $motherAddr->row()->dtNameMother;?>")</font></td> <td><font size="2">=T("<?php echo $motherAddr->row()->apNameMother;?>")</font></td> <td><font size="2">=T("<?php echo $motherAddr->row()->prvNameMother;?>")</font></td> <td><font size="2">=T("<?php echo $motherAddr->row()->sdtMotherPostCode;?>")</font></td> <td><font size="2">=T("<?php echo $motherAddr->row()->sdtMotherPhoneNo;?>")</font></td> <?php break; case '$row->sdtGraduateAddr' : $graduateAddr = $sdt->qryAddrOfGraduateJoinDtApPrv($row->stdId); $chkStr = 1; ?> <td><font size="2">=T("<?php echo $graduateAddr->row()->sdtGraduateAddr;?>")</font></td> <td><font size="2">=T("<?php echo $graduateAddr->row()->dtNameGrad;?>")</font></td> <td><font size="2">=T("<?php echo $graduateAddr->row()->apNameGrad;?>")</font></td> <td><font size="2">=T("<?php echo $graduateAddr->row()->prvNameGrad;?>")</font></td> <td><font size="2">=T("<?php echo $graduateAddr->row()->sdtGraduatePostCode;?>")</font></td> <td><font size="2">=T("<?php echo $graduateAddr->row()->sdtGraduatePhoneNo;?>")</font></td> <?php break; }
if($chkStr!=1) { ?> <td><font size="2">=T("<?php echo $str;?>")</font></td> <?php } } } ?> <td></td> </tr> <?php $i++; } } set_time_limit(30); ?> </table></td> </tr> </table>
|