Server IP : 202.29.229.35 / Your IP : 18.225.235.148 Web Server : Apache System : Linux aapanel2 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 User : www ( 1001) PHP Version : 5.5.38 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/www.ivecr2.ac.th/stdcard/system_pdffile/ |
Upload File : |
<?php error_reporting(0); //-----------------เรียกไฟล์ของระบบงานเรา----------------------------------- include("connect/connect.php"); include("connect/function.php"); $year=$_GET['printyear']; $major_id=$_GET['major_id']; $scid=$_GET['scid'];//รหัสวิลัย //ดึงชื่อวิลัย $sqlschool="select * from tbl_school where subscID='$scid' "; $reschool=mysql_query($sqlschool); $rsschool=mysql_fetch_array($reschool); $scName=$rsschool['scName']; //ดึงชื่อสาขา $sqlmajor="select * from tbl_dptsubject where sbID='$major_id' "; $remajor=mysql_query($sqlmajor); $rsmajor=mysql_fetch_array($remajor); $sbname=$rsmajor['sbName']; if($scid ==""){ $scregister=""; }else{ $scregister="สังกัด"; $scnameori=$scName; } if($major_id==""){ $maname =""; }else{ $maname = "สาขาวิชา"; $sbnameori = $sbname; } if($year == ""){ $yearsori=""; }else{ $textori="ประจำปีการศึกษา "; $yearsori=$year; } header('Content-type: application/pdf'); date_default_timezone_set('Asia/Bangkok'); //---------------เรียกไฟล์ของระบบ pdf------------------------------------ include ('adodb/adodb.inc.php'); define('FPDF_FONTPATH','fpdf/font/'); require ('fpdf/jpdf.inc.php'); require('fpdf/html_table.php'); //----------------เรียกใช้คลาส PDF_HTML_Table ในไฟล์ html_table--------- $pdf=new JPDF(); $pdf->AddFont('angsana','B','angsanab.php'); $pdf->AddFont('angsana','','angsana.php'); $pdf->Open(); $pdf->SetMargins(5,1,5); // SetMargins(float left, float top [, float right]) $printdate=date("Y-m-d"); $printtime=date("h:i:s"); $pdf->rm=" จัดทำโดย...งานบริหารทั่วไป (ด้านสารสนเทศ) ข้อมูล ณ วันที ".displaydateori($printdate)." เวลา ".$printtime." น."; //$pdf->tp=$tp; $pdf->AliasNbPages('rm'); $pdf->AddPage('P', 'A4'); //$pdf->AddPage('L', 'in',array(50,55)); // พิมพ์ข้อความลงเอกสาร (ส่วนหัวเอกสาร) $pdf->SetFont('angsana','',16); $pdf->Cell( 0 , 5 , utf8_to_tis620( 'แบบ บนศ.3' ) , 0 , 1 , 'C' ); $pdf->Cell( 0 , 6 , utf8_to_tis620( 'บัญชีรายชื่อนักศึกษาหลักสูตรเทคโนโลยีบัณฑิต' ) , 0 , 1 , 'C' ); if($major_id != '' || $year != ''){//4 $pdf->Cell( 0 , 6 , utf8_to_tis620( $maname.$sbnameori.' '.$textori.' '.$yearsori) , 0 , 1 , 'C' ); } $pdf->Cell( 0 ,8 , utf8_to_tis620( $scregister.$scnameori.' สถาบันการอาชีวศึกษาภาคกลาง 2') , 0 , 1 , 'C' ); //$HeadTitle=$scName;//หัวข้อเรื่อง ///*****************ปีเป็นเงื่อนไข********************* //----------------------เลือกดูแบบทั้งหมด เงื่อนไข 1------------------------------------- //if($years != "" and $major_id != "" and $scid !=""){ //$pdf->Cell( 0,8,utf8_to_tis620( '('.$HeadTitle.')') , 0 , 1 , 'C' ); //$pdf->SetXY(28,34);//ระยะห่างจากขอบซ้าย และ ระยะห่างจากขอบด้านบน ของหัวตาราง //$pdf->Cell( 150 ,0 , utf8_to_tis620( '') , 1 , 1 , 'C' );//เส้นขีดใต้ข้อความหัวกระดาษ //--------การตั้งค่าให้กับตาราง------------------- $pdf->SetDrawColor(128, 128, 128); //สีเส้นตาราง $pdf->SetFillColor(255,255,0); $pdf->SetXY(20,37);//ระยะห่างจากขอบซ้าย และ ระยะห่างจากขอบด้านบน ของหัวตาราง //--------ตั้งค่าความกว้าง/ความสูง------------------ $headH=30; $contentH=7; $Line2H=62; $pdf->SetFont('angsana','',15); // พิมพ์ข้อความลงเอกสาร มีกรอบด้วย (หัวตาราง) $pdf->Cell(10,10,iconv("UTF-8","TIS-620","ที่ "),1,0,'C'); $pdf->Cell(25,10,iconv("UTF-8","TIS-620","รหัสนักศึกษา"),1,0,'C'); $pdf->Cell(60,10,iconv("UTF-8","TIS-620","ชื่อ - นามสกุล"),1,0,'C'); $pdf->Cell(20,10,iconv("UTF-8","TIS-620","เลขที่บัตร"),1,0,'C'); $pdf->Cell(35,10,iconv("UTF-8","TIS-620","วันออกบัตร"),1,0,'C'); $pdf->Cell(22,10,iconv("UTF-8","TIS-620","บัตรหมดอายุ"),1,0,'C'); $pdf->Ln(); //------------- สิ้นสุดหัวตาราง----------------------------------------------- if($year == '' && $scid == '' && $major_id== ''){//4 $sqlstdall="select * from tblstd_idcard order by student_id,card_no ASC"; }else if($year != NULL && $scid == '' && $major_id== ''){//8 $sqlstdall="select * from tblstd_idcard where start_year='$year' order by idschool,student_id,card_no ASC"; }else if($year == '' && $scid != '' && $major_id== ''){//7 $sqlstdall="select * from tblstd_idcard where idschool='$scid' order by student_id,card_no ASC"; }else if($year == '' && $scid == '' && $major_id != ''){//11 $sqlstdall="select * from tblstd_idcard where major_id='$major_id' order by student_id,card_no ASC"; }else if($year != '' && $scid != '' && $major_id == ''){//10 $sqlstdall="select * from tblstd_idcard where start_year='$year' and idschool='$scid' order by student_id,card_no ASC"; }else if($year != '' && $scid == '' && $major_id != ''){//9 $sqlstdall="select * from tblstd_idcard where start_year='$year' and major_id='$major_id' order by student_id,card_no ASC"; }else if($year == '' && $scid != '' && $major_id == ''){ //1 $sqlstdall="select * from tblstd_idcard where idschool='$scid' order by student_id,card_no ASC"; }else if($year == '' && $scid != '' && $major_id != ''){//2 $sqlstdall="select * from tblstd_idcard where idschool='$scid' and major_id='$major_id' order by student_id,card_no ASC"; }else if($year == '' && $scid == '' && $major_id != ''){ //5 $sqlstdall="select * from tblstd_idcard where major_id='$major_id' order by student_id,card_no ASC"; }else if($year != '' && $scid == '' && $major_id != ''){//6 $sqlstdall="select * from tblstd_idcard where start_year='$year' and major_id='$major_id' order by student_id,card_no ASC"; }else if($year != '' && $scid != '' && $major_id != ''){ //3 $sqlstdall="select * from tblstd_idcard where start_year='$year' and major_id='$major_id' and idschool='$scid' order by student_id,card_no ASC"; } $result1=mysql_query($sqlstdall); $num=mysql_num_rows($result1); $n=0; $yCon = 47;$pn=0; while($rs1=mysql_fetch_array($result1)){ $Line2H+=$contentH; //เพิ่มตำแหน่งตีเส้นท้ายสุด $n++;//ลำดับที่ $pNo++; //นับจำนวนหน้าไว้เป็นเงื่อนไขการขึ้นหน้าใหม่ $card_no=$rs1['card_no'];//เลขที่บัตร /* if(strlen($card_no)==1) $card_no_show = "000".$card_no; elseif(strlen($card_no)==2) $card_no_show = "00".$card_no; elseif(strlen($card_no)==3) $card_no_show = "0".$card_no; elseif(strlen($card_no)==4) $card_no_show = $card_no; */ $student_id=$rs1['student_id'];//รหัสนักศึกษา $date1= displaydate($rs1['dateprint']); //แปลงวันเดือนปีเป็นแบบไทย ใน function.php $timeprint=$rs1['timeprint'];//รหัสนักศึกษา $stu_fname=$rs1['stu_fname']; $stu_lname=$rs1['stu_lname']; $perfix_idori =$rs1['perfix_id']; $dateprint=$rs1['date_print']; $dateexpire=$rs1['date_expire']; if($perfix_idori=="002") $stdPrefixThaiori="นาย"; elseif($perfix_idori=="003") $stdPrefixThaiori="นางสาว"; elseif($perfix_idori=="009") $stdPrefixThaiori="จ.ส.ท."; else $stdPrefixThaiori=""; $pdf->SetXY(20,$yCon); $pdf->Cell(10, $contentH , utf8_to_tis620(''.$n), 1 , 0 , 'C'); //ที่ $pdf->Cell(25 , $contentH , utf8_to_tis620($student_id), 1, 0, 'C'); //รหัส นศ. $pdf->Cell(30 , $contentH , utf8_to_tis620(''.$stdPrefixThaiori.$stu_fname), 'LB', 0 , 'L'); //ชื่อ นามสกุล $pdf->Cell(30 , $contentH , utf8_to_tis620(''.$stu_lname), 'RB' , 0 , 'L'); //ชื่อ นามสกุล $pdf->Cell(20 , $contentH , utf8_to_tis620(''.$card_no), 1 , 0 , 'C'); //เลขที่บัตร $pdf->Cell(35, $contentH , utf8_to_tis620(' '.$dateprint), 1 , 0 , 'C'); //วันออกบัตร $pdf->Cell( 22 , $contentH , utf8_to_tis620(''.$dateexpire), 1 , 1 , 'C'); //บัตรหมดอายุ //-------------------------------------ขึ้นหน้าใหม่----------------------- $yCon+=$contentH; if($pNo>31){ $pNo=0;$yCon = 47; $pdf->Open(); $pdf->SetMargins(10,1,5); $pdf->tp=$tp; $pdf->AliasNbPages('rm,tp'); $pdf->AddPage('P', 'A4'); // พิมพ์ข้อความลงเอกสาร (ส่วนหัวเอกสาร) $pdf->SetFont('angsana','',16); $pdf->Cell( 0 , 5 , utf8_to_tis620( 'แบบ บนศ.3' ) , 0 , 1 , 'C' ); $pdf->Cell( 0 , 6 , utf8_to_tis620( 'บัญชีรายชื่อนักศึกษาหลักสูตรเทคโนโลยีบัณฑิต' ) , 0 , 1 , 'C' ); if($major_id != '' or $year != ''){//4 $pdf->Cell( 0 , 6 , utf8_to_tis620( $maname.$sbnameori.' '.$textori.' '.$yearsori) , 0 , 1 , 'C' ); } $pdf->Cell( 0 ,8 , utf8_to_tis620( $scregister.$scnameori.' สถาบันการอาชีวศึกษาภาคกลาง 2') , 0 , 1 , 'C' ); //$HeadTitle="ข้อมูลข่าวสารและกิจกรรม";//หัวข้อเรื่อง $pdf->SetXY(28,34);//ระยะห่างจากขอบซ้าย และ ระยะห่างจากขอบด้านบน ของหัวตาราง //--------การตั้งค่าให้กับตาราง------------------- $pdf->SetDrawColor(128, 128, 128); //สีเส้นตาราง $pdf->SetFillColor(255,255,0); $pdf->SetXY(20,37);//ระยะห่างจากขอบซ้าย และ ระยะห่างจากขอบด้านบน ของหัวตาราง //--------ตั้งค่าความกว้าง/ความสูง------------------ $headH=30; $contentH=7; $Line2H=62; $pdf->SetFont('angsana','',15); // พิมพ์ข้อความลงเอกสาร มีกรอบด้วย $pdf->Cell(10,10,iconv("UTF-8","TIS-620","ที่ "),1,0,'C'); $pdf->Cell(25,10,iconv("UTF-8","TIS-620","รหัสนักศึกษา"),1,0,'C'); $pdf->Cell(60,10,iconv("UTF-8","TIS-620","ชื่อ - นามสกุล"),1,0,'C'); $pdf->Cell(20,10,iconv("UTF-8","TIS-620","เลขที่บัตร"),1,0,'C'); $pdf->Cell(35,10,iconv("UTF-8","TIS-620","วันออกบัตร"),1,0,'C'); $pdf->Cell(22,10,iconv("UTF-8","TIS-620","บัตรหมดอายุ"),1,0,'C'); $pdf->Ln(); }//end if($pNo>39) } //end while $pdf->SetFont('angsana','',16); $pdf->SetXY(20,$yCon); $pdf->Cell(172, 10 , utf8_to_tis620('รวมทั้งหมด '.$num.' รายการ'), 1 , 1 , 'C'); //วันที่ $pdf->SetXY(20,$yCon); $pdf->Cell(172, 35 , utf8_to_tis620('*หมายเหตุ ข้อมูลจัดเรียงตามรหัสประจำตัวนักศึกษาและเลขที่บัตรจากน้อยไปหามาก'), 0, 1 , 'L'); //วันที่ //-------------------------------จบเงื่อนไข 1 เริ่เงื่อนไข 2 ดูแยกตามแผนกทั้งหมด---------------------------------------- /* }else if($years == "" and $major_id != "" and $scid !="") { //$pdf->Cell( 0,8,utf8_to_tis620( '('.$HeadTitle.')') , 0 , 1 , 'C' ); //$pdf->SetXY(28,34);//ระยะห่างจากขอบซ้าย และ ระยะห่างจากขอบด้านบน ของหัวตาราง //$pdf->Cell( 150 ,0 , utf8_to_tis620( '') , 1 , 1 , 'C' );//เส้นขีดใต้ข้อความหัวกระดาษ //--------การตั้งค่าให้กับตาราง------------------- $pdf->SetDrawColor(128, 128, 128); //สีเส้นตาราง $pdf->SetFillColor(255,255,0); $pdf->SetXY(20,37);//ระยะห่างจากขอบซ้าย และ ระยะห่างจากขอบด้านบน ของหัวตาราง //--------ตั้งค่าความกว้าง/ความสูง------------------ $headH=30; $contentH=7; $Line2H=62; $pdf->SetFont('angsana','',16); // พิมพ์ข้อความลงเอกสาร มีกรอบด้วย (หัวตาราง) $pdf->Cell(10,10,iconv("UTF-8","TIS-620","ที่ "),1,0,'C'); $pdf->Cell(25,10,iconv("UTF-8","TIS-620","รหัสนักศึกษา"),1,0,'C'); $pdf->Cell(60,10,iconv("UTF-8","TIS-620","ชื่อ - นามสกุล"),1,0,'C'); $pdf->Cell(20,10,iconv("UTF-8","TIS-620","เลขที่บัตร"),1,0,'C'); $pdf->Cell(35,10,iconv("UTF-8","TIS-620","วันออกบัตร"),1,0,'C'); $pdf->Cell(22,10,iconv("UTF-8","TIS-620","บัตรหมดอายุ"),1,0,'C'); $pdf->Ln(); //------------- สิ้นสุดหัวตาราง----------------------------------------------- $sql1="select * from tblstd_idcard where major_id='$major_id' and idschool='$scid' order by card_no,student_id ASC"; $result1=mysql_query($sql1); $num=mysql_num_rows($result1); $n=0; $yCon = 47;$pn=0; while($rs1=mysql_fetch_array($result1)){ $Line2H+=$contentH; //เพิ่มตำแหน่งตีเส้นท้ายสุด $n++;//ลำดับที่ $pNo++; //นับจำนวนหน้าไว้เป็นเงื่อนไขการขึ้นหน้าใหม่ $card_no=$rs1['card_no'];//เลขที่บัตร if(strlen($card_no)==1) $card_no_show = "000".$card_no; elseif(strlen($card_no)==2) $card_no_show = "00".$card_no; elseif(strlen($card_no)==3) $card_no_show = "0".$card_no; elseif(strlen($card_no)==4) $card_no_show = $card_no; $student_id=$rs1['student_id'];//รหัสนักศึกษา $date1= displaydate($rs1['dateprint']); //แปลงวันเดือนปีเป็นแบบไทย ใน function.php $timeprint=$rs1['timeprint'];//รหัสนักศึกษา $stu_fname=$rs1['stu_fname']; $stu_lname=$rs1['stu_lname']; $perfix_idori =$rs1['perfix_id']; $dateprint=$rs1['date_print']; $dateexpire=$rs1['date_expire']; if($perfix_idori=="002") $stdPrefixThaiori="นาย"; elseif($perfix_idori=="003") $stdPrefixThaiori="นางสาว"; elseif($perfix_idori=="009") $stdPrefixThaiori="จ.ส.ท."; else $stdPrefixThaiori=""; $pdf->SetXY(20,$yCon); $pdf->Cell(10, $contentH , utf8_to_tis620(''.$n), 1 , 0 , 'C'); //ที่ $pdf->Cell(25 , $contentH , utf8_to_tis620($student_id), 1, 0, 'C'); //รหัส นศ. $pdf->Cell(30 , $contentH , utf8_to_tis620(''.$stdPrefixThaiori.$stu_fname), 'LB', 0 , 'L'); //ชื่อ นามสกุล $pdf->Cell(30 , $contentH , utf8_to_tis620(''.$stu_lname), 'RB' , 0 , 'L'); //ชื่อ นามสกุล $pdf->Cell(20 , $contentH , utf8_to_tis620(''.$card_no_show), 1 , 0 , 'C'); //เลขที่บัตร $pdf->Cell(35, $contentH , utf8_to_tis620(' '.$dateprint), 1 , 0 , 'C'); //วันออกบัตร $pdf->Cell( 22 , $contentH , utf8_to_tis620(''.$dateexpire), 1 , 1 , 'C'); //บัตรหมดอายุ //-------------------------------------ขึ้นหน้าใหม่----------------------- $yCon+=$contentH; if($pNo>22){ $pNo=0;$yCon = 47; $pdf->Open(); $pdf->SetMargins(10,1,5); $pdf->tp=$tp; $pdf->AliasNbPages('rm,tp'); $pdf->AddPage('L', 'A4'); // พิมพ์ข้อความลงเอกสาร $pdf->SetFont('angsana','',18); $pdf->Cell( 0 , 5 , utf8_to_tis620( 'สถาบันการอาชีวศึกษาภาคกลาง 2' ) , 0 , 1 , 'C' ); $pdf->SetFont('angsana','',16); $pdf->Cell( 0 ,8 , utf8_to_tis620( 'รายงานข้อมูลการพิมพ์บัตรประจำตัวนักศึกษา ประจำปีการศึกษา '.$years ) , 0 , 1 , 'C' ); //$HeadTitle="ข้อมูลข่าวสารและกิจกรรม";//หัวข้อเรื่อง $pdf->SetXY(28,34);//ระยะห่างจากขอบซ้าย และ ระยะห่างจากขอบด้านบน ของหัวตาราง //--------การตั้งค่าให้กับตาราง------------------- $pdf->SetDrawColor(128, 128, 128); //สีเส้นตาราง $pdf->SetFillColor(255,255,0); $pdf->SetXY(20,37);//ระยะห่างจากขอบซ้าย และ ระยะห่างจากขอบด้านบน ของหัวตาราง //--------ตั้งค่าความกว้าง/ความสูง------------------ $headH=30; $contentH=7; $Line2H=62; $pdf->SetFont('angsana','',14); // พิมพ์ข้อความลงเอกสาร มีกรอบด้วย $pdf->Cell(10,10,iconv("UTF-8","TIS-620","ที่ "),1,0,'C'); $pdf->Cell(25,10,iconv("UTF-8","TIS-620","รหัสนักศึกษา"),1,0,'C'); $pdf->Cell(60,10,iconv("UTF-8","TIS-620","ชื่อ - นามสกุล"),1,0,'C'); $pdf->Cell(20,10,iconv("UTF-8","TIS-620","เลขที่บัตร"),1,0,'C'); $pdf->Cell(35,10,iconv("UTF-8","TIS-620","วันออกบัตร"),1,0,'C'); $pdf->Cell(22,10,iconv("UTF-8","TIS-620","บัตรหมดอายุ"),1,0,'C'); $pdf->Ln(); }//end if($pNo>39) } //end while $pdf->SetFont('angsana','',16); $pdf->SetXY(20,$yCon); $pdf->Cell(172, 10 , utf8_to_tis620('รวมทั้งหมด '.$num.' รายการ'), 1 , 1 , 'C'); //วันที่ $pdf->SetXY(20,$yCon); $pdf->Cell(172, 35 , utf8_to_tis620('*หมายเหตุ ข้อมูลจัดเรียงตามรหัสประจำตัวนักศึกษาและเลขที่บัตรจากน้อยไปหามาก'), 0, 1 , 'L'); //วันที่ //---------จบ 2--------------------------- }//end if(years) */ $pdf->Output("test1.pdf", I); ?>