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="สังกัด"; } if($major_id==""){ $maname =""; }else{ $maname = "สาขาวิชา"; $sbnameori = $sbname; } if($year == ""){ $yearsori=""; }else{ $textori="ประจำปี"; $yearsori=$_GET['printyear']; } 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=" จัดทำโดย...งานบริหารงานทั่วไป (ด้านสารสนเทศ) ข้อมูล ณ วันที ".displaydatethai2($printdate)." เวลา ".$printtime." น."; //$pdf->tp=$tp; $pdf->AliasNbPages('rm'); $pdf->AddPage('P', 'A4'); //$pdf->AddPage('L', 'in',array(50,55)); // พิมพ์ข้อความลงเอกสาร (ส่วนหัวเอกสาร) $pdf->SetFont('angsana','',15); $pdf->Cell( 0 , 5 , utf8_to_tis620( 'สถาบันการอาชีวศึกษาภาคกลาง 2' ) , 0 , 1 , 'C' ); $pdf->SetFont('angsana','',16); $pdf->Cell( 0 ,8 , utf8_to_tis620( 'รายงานข้อมูลการพิมพ์บัตรประจำตัวนักศึกษา '.$scregister.$scName) , 0 , 1 , 'C' ); if($major_id != "" || $year != ""){ $pdf->Cell( 0 ,8 , utf8_to_tis620($maname.$sbnameori.' '.$textori.' '.$yearsori ) , 0 , 1 , 'C' ); } //$pdf->Cell( 0 ,8 , utf8_to_tis620( 'สังกัดวิทยาลัย '.$scName.' '.$textori.' '.$yearsori ) , 0 , 1 , 'C' ); //$HeadTitle="วิทยาลัยเทคนิคลพบุรี";//หัวข้อเรื่อง ///*****************ปีเป็นเงื่อนไข********************* //----------------------เลือกดูแบบทั้งหมด เงื่อนไข 1------------------------------------- //if($year == ""){ //$pdf->Cell( 0,8,utf8_to_tis620( '('.$HeadTitle.')') , 0 , 1 , 'C' ); //--------การตั้งค่าให้กับตาราง------------------- $pdf->SetDrawColor(128, 128, 128); //สีเส้นตาราง $pdf->SetFillColor(255,255,0); $pdf->SetXY(7,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(20,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(20,10,iconv("UTF-8","TIS-620","บัตรหมดอายุ"),1,0,'C'); $pdf->Cell(20,10,iconv("UTF-8","TIS-620","วันที่พิมพ์"),1,0,'C'); $pdf->Cell(20,10,iconv("UTF-8","TIS-620","เวลาที่พิมพ์"),1,0,'C'); $pdf->Ln(); //------------- สิ้นสุดหัวตาราง----------------------------------------------- if($year == '' && $scid == '' && $major_id== ''){//4 $sqlstdall="select * from log_print_card order by student_id,card_no ASC"; }else if($year != NULL && $scid == '' && $major_id== ''){//8 $sqlstdall="select * from log_print_card where printyear='$year' order by student_id,card_no ASC"; }else if($year == '' && $scid != '' && $major_id== ''){//7 $sqlstdall="select * from log_print_card where idschool='$scid' order by student_id,card_no ASC"; }else if($year == '' && $scid == '' && $major_id != ''){//11 $sqlstdall="select * from log_print_card where major_id='$major_id' order by student_id,card_no ASC"; }else if($year != '' && $scid != '' && $major_id == ''){//10 $sqlstdall="select * from log_print_card where printyear='$year' and idschool='$scid' order by student_id,card_no ASC"; }else if($year != '' && $scid == '' && $major_id != ''){//9 $sqlstdall="select * from log_print_card where printyear='$year' and major_id='$major_id' order by student_id,card_no ASC"; }else if($year == '' && $scid != '' && $major_id == ''){ //1 $sqlstdall="select * from log_print_card where idschool='$scid' order by student_id,card_no ASC"; }else if($year == '' && $scid != '' && $major_id != ''){//2 $sqlstdall="select * from log_print_card 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 log_print_card where major_id='$major_id' order by student_id,card_no ASC"; }else if($year != '' && $scid == '' && $major_id != ''){//6 $sqlstdall="select * from log_print_card where printyear='$year' and major_id='$major_id' order by student_id,card_no ASC"; }else if($year != '' && $scid != '' && $major_id != ''){ //3 $sqlstdall="select * from log_print_card where printyear='$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= $rs1['dateprint']; //แปลงวันเดือนปีเป็นแบบไทย ใน function.php $m1 = explode("-",$date1); $d=$m1[2]; $m=$m1[1]; $y=$m1[0]+543; $dateori=$d."/".$m."/".$y; $timeprint=$rs1['timeprint'];//รหัสนักศึกษา $sqlwork="select * from tblstd_idcard where student_id='$student_id'"; $resqlwork=mysql_query($sqlwork); $rswork=mysql_fetch_array($resqlwork); $stu_fname=$rswork['stu_fname']; $stu_lname=$rswork['stu_lname']; $perfix_idori =$rswork['perfix_id']; $date_print=$rswork['date_print']; $date_expire=$rswork['date_expire']; if($perfix_idori=="002") $stdPrefixThaiori="นาย"; elseif($perfix_idori=="003") $stdPrefixThaiori="นางสาว"; elseif($perfix_idori=="009") $stdPrefixThaiori="จ.ส.ท."; else $stdPrefixThaiori=""; $pdf->SetXY(7,$yCon); $pdf->Cell(10, $contentH , utf8_to_tis620(''.$n), 1 , 0 , 'C'); //ที่ $pdf->Cell(20 , $contentH , utf8_to_tis620(''.$card_no), 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(''.$date_print), 1 , 0 , 'C'); //วันออกบัตร $pdf->Cell(20 , $contentH , utf8_to_tis620(''.$date_expire), 1 , 0 , 'C'); //บัตรหมดอายุ $pdf->Cell(20, $contentH , utf8_to_tis620(''.$dateori), 1 , 0 , 'C'); //วันที่พิมพ์ $pdf->Cell( 20 , $contentH , utf8_to_tis620(''.$timeprint." น."), 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','',15); $pdf->Cell( 0 , 5 , utf8_to_tis620( 'สถาบันการอาชีวศึกษาภาคกลาง 2' ) , 0 , 1 , 'C' ); $pdf->SetFont('angsana','',16); $pdf->Cell( 0 ,8 , utf8_to_tis620( 'รายงานข้อมูลการพิมพ์บัตรประจำตัวนักศึกษา '.$scregister.$scName) , 0 , 1 , 'C' ); if($major_id != "" || $year != ""){ $pdf->Cell( 0 ,8 , utf8_to_tis620($maname.$sbnameori.' '.$textori.' '.$yearsori ) , 0 , 1 , 'C' ); } //$HeadTitle="ข้อมูลข่าวสารและกิจกรรม";//หัวข้อเรื่อง $pdf->SetXY(5,34);//ระยะห่างจากขอบซ้าย และ ระยะห่างจากขอบด้านบน ของหัวตาราง //--------การตั้งค่าให้กับตาราง------------------- $pdf->SetDrawColor(128, 128, 128); //สีเส้นตาราง $pdf->SetFillColor(255,255,0); $pdf->SetXY(7,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(20,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(20,10,iconv("UTF-8","TIS-620","บัตรหมดอายุ"),1,0,'C'); $pdf->Cell(20,10,iconv("UTF-8","TIS-620","วันที่พิมพ์"),1,0,'C'); $pdf->Cell(20,10,iconv("UTF-8","TIS-620","เวลาที่พิมพ์"),1,0,'C'); $pdf->Ln(); //------------- สิ้นสุดหัวตาราง----------------------------------------------- }//end if($pNo>39) } //end while $pdf->SetFont('angsana','',16); $pdf->SetXY(7,$yCon); $pdf->Cell(195, 10 , utf8_to_tis620('รวมทั้งหมด '.$num.' รายการ'), 1 , 1 , 'C'); //วันที่ $pdf->SetXY(7,$yCon); $pdf->Cell(195, 35 , utf8_to_tis620('*หมายเหตุ ข้อมูลจัดเรียงตามรหัสประจำตัวนักศึกษาและเลขที่บัตรจากน้อยไปหามาก'), 0, 1 , 'L'); //วันที่ //-------------------------------จบเงื่อนไข 1 เริ่เงื่อนไข 2 ดูแยกตามแผนกทั้งหมด---------------------------------------- /* }else if($years != "") { //$pdf->Cell( 0,8,utf8_to_tis620( '('.$HeadTitle.')') , 0 , 1 , 'C' ); //--------การตั้งค่าให้กับตาราง------------------- $pdf->SetDrawColor(128, 128, 128); //สีเส้นตาราง $pdf->SetFillColor(255,255,0); $pdf->SetXY(7,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(20,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(20,10,iconv("UTF-8","TIS-620","บัตรหมดอายุ"),1,0,'C'); $pdf->Cell(20,10,iconv("UTF-8","TIS-620","วันที่พิมพ์"),1,0,'C'); $pdf->Cell(20,10,iconv("UTF-8","TIS-620","เวลาที่พิมพ์"),1,0,'C'); $pdf->Ln(); //------------- สิ้นสุดหัวตาราง----------------------------------------------- $sql1="select * from log_print_card where printyear='$years' order by student_id,card_no 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= $rs1['dateprint']; //แปลงวันเดือนปีเป็นแบบไทย ใน function.php $m1 = explode("-",$date1); $d=$m1[2]; $m=$m1[1]; $y=$m1[0]+543; $dateori=$d."/".$m."/".$y; $timeprint=$rs1['timeprint'];//รหัสนักศึกษา $sqlwork="select * from tblstd_idcard where student_id='$student_id'"; $resqlwork=mysql_query($sqlwork); $rswork=mysql_fetch_array($resqlwork); $stu_fname=$rswork['stu_fname']; $stu_lname=$rswork['stu_lname']; $perfix_idori =$rswork['perfix_id']; $date_print=$rswork['date_print']; $date_expire=$rswork['date_expire']; if($perfix_idori=="002") $stdPrefixThaiori="นาย"; elseif($perfix_idori=="003") $stdPrefixThaiori="นางสาว"; elseif($perfix_idori=="009") $stdPrefixThaiori="จ.ส.ท."; else $stdPrefixThaiori=""; $pdf->SetXY(7,$yCon); $pdf->Cell(10, $contentH , utf8_to_tis620(''.$n), 1 , 0 , 'C'); //ที่ $pdf->Cell(20 , $contentH , utf8_to_tis620(''.$card_no_show), 1 , 0 , 'C'); //เลขที่บัตร $pdf->Cell(25 , $contentH , utf8_to_tis620($student_id), 1, 0, 'C'); //รหัส นศ. $pdf->Cell(60 , $contentH , utf8_to_tis620(''.$stdPrefixThaiori.$stu_fname.' '.$stu_lname), 1 , 0 , 'L'); //ชื่อ นามสกุล $pdf->Cell(20 , $contentH , utf8_to_tis620(''.$date_print), 1 , 0 , 'C'); //วันออกบัตร $pdf->Cell(20 , $contentH , utf8_to_tis620(''.$date_expire), 1 , 0 , 'C'); //บัตรหมดอายุ $pdf->Cell(20, $contentH , utf8_to_tis620(''.$dateori), 1 , 0 , 'C'); //วันที่พิมพ์ $pdf->Cell( 20 , $contentH , utf8_to_tis620(''.$timeprint." น."), 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(5,34);//ระยะห่างจากขอบซ้าย และ ระยะห่างจากขอบด้านบน ของหัวตาราง //--------การตั้งค่าให้กับตาราง------------------- $pdf->SetDrawColor(128, 128, 128); //สีเส้นตาราง $pdf->SetFillColor(255,255,0); $pdf->SetXY(5,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(20,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(20,10,iconv("UTF-8","TIS-620","บัตรหมดอายุ"),1,0,'C'); $pdf->Cell(20,10,iconv("UTF-8","TIS-620","วันที่พิมพ์"),1,0,'C'); $pdf->Cell(20,10,iconv("UTF-8","TIS-620","เวลาที่พิมพ์"),1,0,'C'); $pdf->Ln(); }//end if($pNo>39) } //end while $pdf->SetFont('angsana','',16); $pdf->SetXY(7,$yCon); $pdf->Cell(195, 10 , utf8_to_tis620('รวมทั้งหมด '.$num.' รายการ'), 1 , 1 , 'C'); //วันที่ $pdf->SetXY(7,$yCon); $pdf->Cell(195, 35 , utf8_to_tis620('*หมายเหตุ ข้อมูลจัดเรียงตามรหัสประจำตัวนักศึกษาและเลขที่บัตรจากน้อยไปหามาก'), 0, 1 , 'L'); //วันที่ }//end if(years) */ $pdf->Output("test1.pdf", I); ?>