File manager - Edit - /var/www/ams.cmtc.ac.th/pages/export-studentRegis.php
Back
<?php session_start(); $session=session_id(); require("../inc/config.inc.php"); require("../inc/common.php"); echo $_SESSION['login']; if(empty($_SESSION['login'])){ echo"Error"; exit(); } $groupCode=$_GET['groupCode']; //ดึงข้อมูลกลุ่มเรียน $result_std2018=select("std2018_studentgroup","where groupCode='$groupCode'"); $grade=$result_std2018['grade']; $groupCode=$result_std2018['groupCode']; $groupName=$result_std2018['groupName']; $groupAbbr=$result_std2018['groupAbbr']; $teacherFirstname=$result_std2018['teacherFirstname']; $teacherLastname=$result_std2018['teacherLastname']; $num_student=num_record("std2018_student","where groupCode='$groupCode' AND studentStatusCode='03'"); $num_student_all=num_record("std2018_student","where groupCode='$groupCode' "); $num_out=$num_student_all-$num_student; $result_regis_group=select("regis_group","where groupCode='$groupCode' AND academicYear='$academicYear' AND semester='$semester' "); $cost_credit=$result_regis_group['cost_credit']; $cost_value=$result_regis_group['cost_value']; //ยอดเงินที่ต้องลงทะเบียน $total_cost=$cost_credit+$cost_value; $total_cost2=$cost_credit+$cost_value; if($_GET['ex']=='xls'){ $strExcelFileName="รายชื่อนักศึกษาลงทะเบียน ปีการศึกษา $academicYear ภาคเรียน $semester ระดับ $grade $groupName กลุ่ม $groupAbbr.xls"; header("Content-Type: application/x-msexcel; name=\"$strExcelFileName\""); header("Content-Disposition: inline; filename=\"$strExcelFileName\""); header("Pragma:no-cache"); } ?> <?php //echo FCPATH."images/logo_e2e.png"; ?> <html xmlns:o="urn:schemas-microsoft-com:office:office"xmlns:x="urn:schemas-microsoft-com:office:excel"xmlns="http://www.w3.org/TR/REC-html40"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta charset="utf-8"> </head> <body> <!-- <div id="SiXhEaD_Excel" align=center x:publishsource="Excel"> --> <div id="SiXhEaD_Excel" x:publishsource="Excel"> <!-------- เริ่มข้อมูล ------------------------> <h3>สรุปข้อมูลนักศึกษาลงทะเบียน ภาคเรียนที่ <?=$semester?> ปีการศึกษา <?=$academicYear?> </h3> <?php //ตรวจสอบว่ามีการชำระเงินหรือไม่ $num_payment=num_record("regis_payment_log","where academicYear='$academicYear' AND semester='$semester' AND groupCode='$groupCode' "); $sql="Select * From std2018_student,prefix where std2018_student.groupCode='$groupCode' AND std2018_student.studentStatusCode='03' AND std2018_student.prefixID=prefix.prefix_id order by std2018_student.studentCode ASC"; $db_query=mysqli_query($connect,$sql); $num_rows=mysqli_num_rows($db_query); /* นับ Reccord ที่พบ */ //echo "มีจำนวน <b>$num_rows</b> คน"; ?> ระดับ <b><?=$grade?></b> รหัสกลุ่ม <b><?=$groupCode?></b> <b><?=$groupName?></b><br> ครูที่ปรึกษา <b><?php if($teacherFirstname!=""){ echo "ครู$teacherFirstname $teacherLastname"; }?></b><br> จำนวนนักศึกษาทั้งหมด <b><?=$num_student?></b> คน ชำระเงินค่าลงทะเบียน <b><?=$num_payment?></b> คน ยังไม่ได้ชำระเงินค่าลงทะเบียน <b><?php $num_student_lost=$num_student-$num_payment; echo $num_student_lost;?></b> คน <br> ร้อยละของนักศึกษาที่ชำระเงินค่าลงทะเบียน <b><?php $percent=$num_payment/$num_student*100; $percent=number_format($percent,2); echo $percent; ?></b><br> ยอดเงินค่าลงทะเบียน <b><?php echo number_format($total_cost);?></b> บาทต่อคน <?php if($num_rows==0) { echo " ไม่พบข้อมูลนักศึกษา"; }else{ ?> <table width="820" border="1"> <thead> <tr> <th width="48" bgcolor="#E7E7E7"><center> ลำดับ </center></th> <th width="140" bgcolor="#E7E7E7"><center>รหัสประจำตัว<br>นักศึกษา</center></th> <th width="152" bgcolor="#E7E7E7">ชื่อ</th> <th width="127" bgcolor="#E7E7E7">นามสกุล</th> <th width="120" bgcolor="#E7E7E7">เบอร์โทร</th> <th width="120" bgcolor="#E7E7E7">จำนวนเงินที่ต้องชำระ</th> <th width="75" bgcolor="#E7E7E7"><center>จำนวนเงินที่ชำระ</center></th> <th width="95" bgcolor="#E7E7E7"><center>วันที่ชำระเงิน</center></th> <th width="58" bgcolor="#E7E7E7"><center>สถานะ </center></th> </tr> </thead> <tbody> <?php $a=0; $no=1; while($a < $num_rows) { $result = mysqli_fetch_array($db_query); $prefix_name=$result['prefix_name']; $firstname=$result['firstname']; $surname=$result['surname']; $tel=$result['tel']; $tel=" $tel"; $studentCode=$result['studentCode']; $studentStatusCode=$result['studentStatusCode']; $gpax=$result["gpax"]; //------- ดึงข้อมูลค่าหน่วยกิต และค่าธรรมเนียมการศึกษา ------ $result_regis_student_log=select("regis_student_log","where studentCode='$studentCode' AND academicYear='$academicYear' AND semester='$semester' "); $cost_total=$result_regis_student_log["cost_total"]; $cost_total2=$result_regis_student_log["cost_total"]; $confirm=$result_regis_student_log['confirm']; if($cost_total==""){ $cost_total="-"; }else{ $cost_total=number_format($cost_total); } //ตรวจสอบว่ามีการชำระเงินหรือไม่ $num_payment=num_record("regis_payment_log","where academicYear='$academicYear' AND semester='$semester' AND studentCode='$studentCode' "); if($num_payment!=0){ //ดึงยอดการชำระเงิน $result_regis_payment_log=select("regis_payment_log","where academicYear='$academicYear' AND semester='$semester' AND studentCode='$studentCode' "); $PaymentDate=$result_regis_payment_log["PaymentDate"]; $TransactionCode=$result_regis_payment_log["TransactionCode"]; $cost_total3=$result_regis_payment_log["cost_total"]; $cost_totalx=$result_regis_payment_log["cost_total"]; $cost_totalx=number_format($cost_totalx); $comment_pay="/"; }else{ $PaymentDate="-"; $TransactionCode="-"; $comment_pay="x"; $cost_totalx="-"; $cost_total3="0"; } //ตรวจสอบยอดเงินที่ต้องชำระเงิน $num_student_log=num_record("regis_student_log","where academicYear='$academicYear' AND semester='$semester' AND studentCode='$studentCode'"); if($num_student_log!=0){ //ดึงยอดการชำระเงิน $result_student_log=select("regis_student_log","where academicYear='$academicYear' AND semester='$semester' AND studentCode='$studentCode' "); $cost_totalxx=$result_student_log["cost_total"]; $cost_totalxx=number_format($cost_totalxx); } //ทำไฮไล กรณ์ที่ยอดเงินไม่ตรงกันในกลุ่ม คนที่เลือกค่าธรรมเนียมเพิ่มเติม //echo "$cost_total2 $cost_total3<br>"; if($cost_total2!=""){ if($cost_total2==$cost_total3){ $high_ling_bg="#C5FFE8"; }else{ $high_ling_bg="#EEEED6"; } }else{ $high_ling_bg="#FFFFFF"; } //echo "$high_ling_bg<br>"; ?> <tr> <td bgcolor="<?=$high_ling_bg?>"><center> <?php echo $no;?> </center></td> <td bgcolor="<?=$high_ling_bg?>"><center><?=$studentCode?></center></td> <td bgcolor="<?=$high_ling_bg?>"><?php echo "$prefix_name$firstname";?></td> <td bgcolor="<?=$high_ling_bg?>"><?=$surname?></td> <td bgcolor="<?=$high_ling_bg?>"><center><?=$tel?></center></td> <td style="text-align: center" bgcolor="<?=$high_ling_bg?>"><?=$cost_total?> </td> <td style="text-align: center" bgcolor="<?=$high_ling_bg?>"><?=$cost_totalx?> </td> <td style="text-align: center" bgcolor="<?=$high_ling_bg?>"><?=$PaymentDate?> </td> <td style="text-align: center" bgcolor="<?=$high_ling_bg?>"><?=$comment_pay?></td> </tr> <?php $a++; $no++; } ?> </tbody> </table> <?php } $login_name=$_SESSION['login_name']; $Publisher_day=thai3($today); echo"ผู้พิมพ์ $login_name วันที่พิมพ์รายงาน $Publisher_day "; echo"<br>$dev"; ?> <!------ สิ้นสุดข้อมูล ------------------------> </div> </body> </html> <?php /* if($ex2!='xls'){ $html = ob_get_contents(); ob_end_clean(); $pdf = new mPDF('th', 'A4', '0', 'THSaraban'); $pdf->SetAutoFont(); $pdf->SetDisplayMode('fullpage'); $pdf->WriteHTML($html, 2); $pdf->Output(); }*/ ?>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.41 |
proxy
|
phpinfo
|
Settings