Server : Apache/2 System : Linux server1.tkcorporation.co.th 2.6.32-042stab145.3 #1 SMP Thu Jun 11 14:05:04 MSK 2020 i686 User : ifixit ( 537) PHP Version : 5.3.29 Disable Function : exec,system,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,dl,popen,show_source Directory : /home/ifixit/domains/ifixit.co.th/public_html/assets/pdf/ |
<?php ob_start();session_start(); function get_quotation($order_id){ include '../lib.php';conf(); $s="select * from order_list inner join acc_list on order_list.acc_id = acc_list.acc_id inner join g_br on order_list.br_id = g_br.br_id where order_list.order_id = '".$order_id."'"; $q=mysql_query($s); if($f=mysql_fetch_array($q)){ $s1="select sum(pay_total) as total_pay from order_pay where order_id = '".$order_id."'"; $q1=mysql_query($s1); if($f1=mysql_fetch_array($q1)){ $pay_remain = $f['p3']-$f1['total_pay']; $total_pay = $f1['total_pay']; } require('fpdf.php'); define('FPDF_FONTPATH','font/'); $pdf=new FPDF(); $pdf->AddPage(); $pdf->SetAutoPageBreak(1); $pdf->SetDrawColor(200,200,200); $pdf->SetTextColor(80,80,80,1); $pdf->AddFont('rsu_reg','','rsu_reg.php'); $pdf->AddFont('rsu_reg','b','rsu_bold.php'); $pdf->SetFont('rsu_reg','',20); $pdf->SetFont('rsu_reg','b',12); $pdf->SetDrawColor(80,80,80); $pdf->SetFillColor(200,200,200); $pdf->Cell(30,00,'',0,0,"L"); $pdf->Cell(125,5,iconv( 'UTF-8','TIS-620','TMAX DESIGN'),0,1,"L"); $pdf->SetFont('rsu_reg','',10); $pdf->Cell(30,00,'',0,0,"L"); $pdf->Cell(125,4,iconv( 'UTF-8','TIS-620',$_SESSION['br_add']),0,1,"L"); $pdf->Cell(30,00,'',0,0,"L"); $pdf->Cell(95,4,iconv( 'UTF-8','TIS-620',$_SESSION['br_tel']),0,0,"L"); $pdf->SetFont('rsu_reg','b',14); $pdf->Cell(65,4,'RECEIPT',0,1,"C"); $pdf->SetFont('rsu_reg','',10); $pdf->SetTextColor(80,80,80,1); $pdf->Cell(30,00,'',0,0,"L"); $pdf->Cell(95,4,'www.tmaxdesign.com',0,0,"L"); $pdf->SetFont('rsu_reg','b',12); $pdf->Cell(65,4,iconv( 'UTF-8','TIS-620','ใบเสร็จรับเงิน'),0,1,"C"); $pdf->SetFont('rsu_reg','',10); $pdf->Cell(30,00,'',0,0,"L"); $pdf->Cell(95,4,iconv( 'UTF-8','TIS-620',''),0,0,"L"); $pdf->SetFont('rsu_reg','b',14); $pdf->SetTextColor(255,0,0,255); $pdf->Cell(65,4,iconv( 'UTF-8','TIS-620','Original/Copy'),0,1,"C"); $pdf->Cell(100,4,iconv( 'UTF-8','TIS-620','RCP_'.substr($order_id,0,7)."-".substr($order_id,7,5)),0,1,"C"); $pdf->SetFont('rsu_reg','',11); $pdf->SetTextColor(80,80,80,1); $pdf->Ln(5); $pdf->Cell(190,4,iconv( 'UTF-8','TIS-620',''),0,1,"L"); $pdf->Ln(2); $pdf->Cell(30,5,iconv( 'UTF-8','TIS-620','ชื่อ / Attn :'),0,0,"L"); $pdf->Cell(130,5,iconv( 'UTF-8','TIS-620',$f['acc_name']),0,0,"L"); $pdf->Cell(30,5,iconv( 'UTF-8','TIS-620','วันที่ / Date:'),0,1,"C"); $pdf->Cell(30,5,iconv( 'UTF-8','TIS-620','บริษัท / Company :'),0,0,"L"); $pdf->Cell(130,5,iconv( 'UTF-8','TIS-620',''),0,0,"L"); $pdf->Cell(30,5,iconv( 'UTF-8','TIS-620',substr($f['order_date'],0,10)),0,1,"C"); $pdf->Cell(30,5,iconv( 'UTF-8','TIS-620','ที่อยู่ / Address :'),0,0,"L"); $pdf->Cell(130,5,iconv( 'UTF-8','TIS-620',$f['acc_add_deliver']),0,1,"L"); $pdf->Cell(30,5,iconv( 'UTF-8','TIS-620','โทร / Tel :'),0,0,"L"); $pdf->Cell(50,5,iconv( 'UTF-8','TIS-620',$f['acc_tel']),0,0,"L"); $pdf->Cell(30,5,iconv( 'UTF-8','TIS-620','Email :'),0,0,"L"); $pdf->Cell(50,5,iconv( 'UTF-8','TIS-620',$f['acc_email']),0,1,"L"); $pdf->Ln(5); $pdf->Line(10,46,200,46); $pdf->Line(10,68,200,68); $pdf->Line(10,46,10,68); $pdf->Line(200,46,200,68); $pdf->Line(40,51,170,51); $pdf->Line(40,56,200,56); $pdf->Line(40,61,200,61); $pdf->Line(170,46,170,56); $pdf->Cell(40,4,iconv( 'UTF-8','TIS-620','รหัสลูกค้า'),0,0,"C"); $pdf->Cell(35,4,iconv( 'UTF-8','TIS-620','รหัสสาขา'),0,0,"C"); $pdf->Cell(75,4,iconv( 'UTF-8','TIS-620','สาขาที่ทำเอกสาร'),0,0,"C"); $pdf->Cell(40,4,iconv( 'UTF-8','TIS-620','นัดรับ'),0,1,"C"); $pdf->Cell(40,4,iconv( 'UTF-8','TIS-620','CUSTOMER CODE'),0,0,"C"); $pdf->Cell(35,4,iconv( 'UTF-8','TIS-620','BRANCH CODE'),0,0,"C"); $pdf->Cell(75,4,iconv( 'UTF-8','TIS-620','REFERENCE BRANCH'),0,0,"C"); $pdf->SetTextColor(255,0,0,255); $pdf->Cell(40,4,iconv( 'UTF-8','TIS-620',substr($f['order_dlv'],0,10)),0,1,"C"); $pdf->SetTextColor(80,80,80,1); $pdf->Cell(40,4,iconv( 'UTF-8','TIS-620',$f['acc_id']),0,0,"C"); $pdf->Cell(35,4,iconv( 'UTF-8','TIS-620',substr("000".$f['br_id'],strlen("000".$f['br_id'])-3,3)),0,0,"C"); $pdf->Cell(75,4,iconv( 'UTF-8','TIS-620',$f['br_name']),0,0,"C"); $pdf->SetTextColor(255,0,0,255); $pdf->Cell(40,4,iconv( 'UTF-8','TIS-620',substr($f['order_dlv'],11,8)),0,1,"C"); $pdf->SetTextColor(80,80,80,1); $pdf->Ln(7); $pdf->Line(10,70,200,70); $pdf->Line(10,87,200,87); $pdf->Line(10,70,10,87); $pdf->Line(200,70,200,87); $pdf->Line(50,70,50,87); $pdf->Line(85,70,85,87); $pdf->Line(160,70,160,87); $pdf->Cell(10,6,iconv( 'UTF-8','TIS-620','ลำดับ'),0,0,"C",true); $pdf->Cell(60,6,iconv( 'UTF-8','TIS-620','รายการ'),0,0,"C",true); $pdf->Cell(50,6,iconv( 'UTF-8','TIS-620','CODE'),0,0,"C",true); $pdf->Cell(15,6,iconv( 'UTF-8','TIS-620','ตรม'),0,0,"C",true); $pdf->Cell(15,6,iconv( 'UTF-8','TIS-620','จำนวน'),0,0,"C",true); $pdf->Cell(20,6,iconv( 'UTF-8','TIS-620','ราคา/หน่วย'),0,0,"C",true); $pdf->Cell(20,6,iconv( 'UTF-8','TIS-620','จำนวนเงิน'),0,1,"C",true); $pdf->Cell(10,6,iconv( 'UTF-8','TIS-620','ITEM'),0,0,"C",true); $pdf->Cell(60,6,iconv( 'UTF-8','TIS-620','DESCRIPTION'),0,0,"C",true); $pdf->Cell(50,6,iconv( 'UTF-8','TIS-620',''),0,0,"C",true); $pdf->Cell(15,6,iconv( 'UTF-8','TIS-620','AREA'),0,0,"C",true); $pdf->Cell(15,6,iconv( 'UTF-8','TIS-620','QTY'),0,0,"C",true); $pdf->Cell(20,6,iconv( 'UTF-8','TIS-620','UNIT PRICE'),0,0,"C",true); $pdf->Cell(20,6,iconv( 'UTF-8','TIS-620','AMOUNT'),0,1,"C",true); $pdf->Ln(2); $pdf->Line(10,90,200,90); $pdf->Line(10,102,200,102); $pdf->Line(10,90,10,102); $pdf->Line(200,90,200,102); $pdf->Line(20,90,20,102); $pdf->Line(80,90,80,102); $pdf->Line(130,90,130,102); $pdf->Line(145,90,145,102); $pdf->Line(160,90,160,102); $pdf->Line(180,90,180,102); $pdf->Line(10,102,10,104); $pdf->Line(20,102,20,104); $pdf->Line(80,102,80,104); $pdf->Line(130,102,130,104); $pdf->Line(145,102,145,104); $pdf->Line(160,102,160,104); $pdf->Line(180,102,180,104); $pdf->Line(200,102,200,104); $top = 104; $bot = 104; $task = array(); $task_temp = ""; $area_all=0; $i=0; $j=0; $s1="select * from order_temp inner join acc_list on order_temp.acc_id = acc_list.acc_id inner join acc_type on acc_list.acc_type_id = acc_type.acc_type_id inner join job_main on order_temp.job_id = job_main.job_id where order_id = '".$order_id."'"; $q1=mysql_query($s1); while($f1=mysql_fetch_array($q1)){ $detail =""; $task_temp = ""; if(strlen($f1['files'])>0){ $detail .= "(มีไฟล์) "; } if($f1['job_cal']==0){ $s2="select * from job_mat where job_mat_id = ".$f1['job_mat_id']; $q2=mysql_query($s2); if($f2=mysql_fetch_array($q2)){ $detail .= $f2['job_mat_name']; $task_temp .= $f2['job_mat_code']; } $task_temp .= "-".$f1['qty']; }else if($f1['job_cal']==1){ $s2="select * from job_mat where job_mat_id = ".$f1['job_mat_id']; $q2=mysql_query($s2); if($f2=mysql_fetch_array($q2)){ $detail .= $f2['job_mat_name']; $task_temp .= $f2['job_mat_code']; } $detail .= " ".$f1['w']."x".$f1['h']; $area = $f1['w']*$f1['h']*$f1['qty']; $area_all += $area; $task_temp .= "-".$f1['w']."-".$f1['h']."-".$f1['qty']; }else if($f1['job_cal']==2){ $s2="select * from job_mat where job_mat_id = ".$f1['job_mat_id']; $q2=mysql_query($s2); if($f2=mysql_fetch_array($q2)){ $detail .= $f1['job_name']." "."S:".$f2['job_mat_name']; //$task_temp .= $f1['job_name']." ".$f2['job_mat_name']; } $s2="select * from job_size where job_size_id = ".$f1['job_size_id']; $q2=mysql_query($s2); if($f2=mysql_fetch_array($q2)){ $detail .= " S:".$f2['job_size_name']; //$task_temp .= " ".$f2['job_size_name']; } //$task_temp .= "-".$f1['qty']; }else if($f1['job_cal']==3){ $detail .= $f1['rmark']; $task_temp .= $f1['rmark']; $task_temp .= "-".$f1['qty']; } if(strlen($f1['xyzp'])>=1){ $detail .=" ".$f1['xyzp']; $task_temp .= "-".$f1['xyzp']; } $j++; if($f1['order_type_id']==1){ $i++; $task[$j]=$task_temp; $pdf->Cell(10,6," ".$i,0,"C"); $pdf->Cell(60,6,iconv( 'UTF-8','TIS-620',$detail),0,0,"L"); $pdf->Cell(50,6,iconv( 'UTF-8','TIS-620',$task_temp),0,0,"L"); $pdf->Cell(15,6,iconv( 'UTF-8','TIS-620',number_format($area,2)),0,0,"C"); $pdf->Cell(15,6,iconv( 'UTF-8','TIS-620',number_format($f1['qty'])),0,0,"C"); $pdf->Cell(20,6,iconv( 'UTF-8','TIS-620',number_format($f1['price_unit'],2)),0,0,"C"); $pdf->Cell(20,6,iconv( 'UTF-8','TIS-620',number_format($f1['price_total'],2)),0,1,"C"); $pdf->Cell(10,6," ",0,"C"); $pdf->Cell(60,6,iconv( 'UTF-8','TIS-620',": ".$f1['rmark']),0,1,"L"); $pdf->Line(10,$top,10,$bot+12); $pdf->Line(20,$top,20,$bot+12); $pdf->Line(80,$top,80,$bot+12); $pdf->Line(130,$top,130,$bot+12); $pdf->Line(145,$top,145,$bot+12); $pdf->Line(160,$top,160,$bot+12); $pdf->Line(180,$top,180,$bot+12); $pdf->Line(200,$top,200,$bot+12); //$pdf->Line(10,$bot,200,$bot+12); $top += 12; $bot += 12; }else{ $task[$j]="(EDIT)::".$task_temp; } } $pdf->Line(10,$bot,200,$bot); $pdf->Ln(0); $remain = $f['p3'] - $f['rev_pay']; $pdf->Cell(70,6,iconv( 'UTF-8','TIS-620','หมายเหตุ - สินค้าไม่รับเปลี่ยน/คืน'),0,0,"L"); $pdf->Cell(50,6,iconv( 'UTF-8','TIS-620','ตรม. รวม'),0,0,"R"); $pdf->Cell(15,6,iconv( 'UTF-8','TIS-620',number_format($area_all,2)),1,0,"C"); $pdf->Cell(35,6,iconv( 'UTF-8','TIS-620','มูลค่าสินค้า / Amount'),0,0,"L"); $pdf->Cell(20,6,iconv( 'UTF-8','TIS-620',number_format($f['p1'],2)),0,1,"R"); $pdf->Cell(135,6,iconv( 'UTF-8','TIS-620',''),0,0,"L"); $pdf->SetTextColor(255,0,0); $pdf->Cell(35,6,iconv( 'UTF-8','TIS-620','มัดจำ / Pay'),0,0,"L"); $pdf->Cell(20,6,iconv( 'UTF-8','TIS-620',number_format($total_pay,2)),0,1,"R"); $pdf->Cell(135,6,iconv( 'UTF-8','TIS-620',''),0,0,"L"); $pdf->SetTextColor(80,80,80); $pdf->Cell(35,6,iconv( 'UTF-8','TIS-620','ภาษีมูลค่าเพิ่ม / VAT'),0,0,"L"); $pdf->Cell(20,6,iconv( 'UTF-8','TIS-620',number_format($f['c2'],2)),0,1,"R"); $pdf->Cell(135,6,iconv( 'UTF-8','TIS-620',''),0,0,"C"); $pdf->SetTextColor(255,0,0); $pdf->Cell(35,6,iconv( 'UTF-8','TIS-620','คงเหลือ / Remain'),0,0,"L"); $pdf->Cell(20,6,iconv( 'UTF-8','TIS-620',number_format($pay_remain,2)),0,1,"R"); $pdf->SetTextColor(80,80,80); $pdf->Line(10,$top,10,$bot+24); $pdf->Line(145,$top,145,$bot+24); $pdf->Line(180,$top,180,$bot+24); $pdf->Line(200,$top,200,$bot+24); $pdf->Line(180,$bot+6,200,$bot+6); $pdf->Line(180,$bot+12,200,$bot+12); $pdf->Line(180,$bot+18,200,$bot+18); $pdf->Cell(190,7,iconv( 'UTF-8','TIS-620',"(".num2wordsThai($pay_remain)."บาทถ้วน)"),1,1,"C",true); $pdf->Line(0,240,210,240); $pdf->Line(150,240,150,297); $pdf->SetY(240); $pdf->Ln(2); $pdf->SetFont('rsu_reg','b',14); $pdf->Cell(30,8,'',0,0,"L"); $pdf->Cell(125,6,iconv( 'UTF-8','TIS-620','ศูนย์พิมพ์ป้าย TMAX DESIGN'),0,1,"L"); $pdf->SetFont('rsu_reg','',10); $pdf->Cell(30,4,'',0,0,"L"); $pdf->Cell(125,4,iconv( 'UTF-8','TIS-620',$_SESSION['br_add']),0,1,"L"); $pdf->Cell(30,4,'',0,0,"L"); $pdf->Cell(95,4,iconv( 'UTF-8','TIS-620',$_SESSION['br_tel']),0,1,"L"); $pdf->SetFont('rsu_reg','b',12); $pdf->Cell(30,5,'',0,0,"L"); $pdf->Cell(170,5,iconv( 'UTF-8','TIS-620','รับออกแบบ และพิมพ์อิงค์เจ็ทคุณภาพสูง (ราคาโรงงาน)'),0,1,"L"); $pdf->Cell(30,5,'',0,0,"L"); $pdf->Cell(170,5,iconv( 'UTF-8','TIS-620','เรากล้าประกันสี ทนนาน (สินค้าไม่รับเปลี่ยนคืน)'),0,1,"L"); $pdf->Ln(2); $pdf->SetFont('rsu_reg','',10); $pdf->Cell(15,7,iconv( 'UTF-8','TIS-620','เลขที่งาน'),1,0,"L"); $pdf->Cell(25,7,iconv( 'UTF-8','TIS-620',$f['order_id']),1,0,"L"); $pdf->Cell(20,7,iconv( 'UTF-8','TIS-620','ชื่อลูกค้า'),1,0,"L"); $pdf->Cell(30,7,iconv( 'UTF-8','TIS-620',$f['acc_name']),1,0,"L"); $pdf->Cell(15,7,iconv( 'UTF-8','TIS-620','พนักงาน'),1,0,"L"); $pdf->Cell(30,7,iconv( 'UTF-8','TIS-620',''),1,1,"L"); $pdf->Cell(15,7,iconv( 'UTF-8','TIS-620','ราคารวม'),1,0,"L"); $pdf->Cell(25,7,iconv( 'UTF-8','TIS-620',number_format($f['p3'],2)),1,0,"L"); $pdf->Cell(20,7,iconv( 'UTF-8','TIS-620','ชำระแล้ว'),1,0,"L"); $pdf->Cell(30,7,iconv( 'UTF-8','TIS-620',number_format($total_pay,2)),1,0,"L"); $pdf->Cell(15,7,iconv( 'UTF-8','TIS-620','คงเหลือ'),1,0,"L"); $pdf->Cell(30,7,iconv( 'UTF-8','TIS-620',number_format($pay_remain,2)),1,1,"L"); $pdf->SetFont('rsu_reg','b',12); $pdf->Cell(20,7,iconv( 'UTF-8','TIS-620','วันสั่งสินค้า'),1,0,"L",true); $pdf->Cell(45,7,iconv( 'UTF-8','TIS-620',$f['order_date']),1,0,"L"); $pdf->Cell(25,7,iconv( 'UTF-8','TIS-620','วันนัดรับสินค้า'),1,0,"L",true); $pdf->Cell(45,7,iconv( 'UTF-8','TIS-620',$f['order_dlv']),1,1,"L"); $pdf->SetY(250); $pdf->SetX(150); $pdf->SetFont('rsu_reg','b',16); $pdf->Cell(60,7,iconv( 'UTF-8','TIS-620',$f['acc_name']),0,1,"C"); $pdf->SetX(150); $pdf->SetFont('rsu_reg','b',20); $pdf->Cell(60,7,substr($order_id,0,7)."-".substr($order_id,7,5),0,1,"C"); $pdf->Line(150,265,210,265); $pdf->Ln(3); $pdf->SetFont('rsu_reg','',12); $pdf->SetX(150); $pdf->Cell(60,4,iconv( 'UTF-8','TIS-620','นัดรับ '.$f['order_dlv']),0,1,"C"); $pdf->SetX(150); $pdf->Cell(60,4,iconv( 'UTF-8','TIS-620','Total = '.number_format($f['p3'],2)),0,1,"C"); $pdf->SetX(150); $pdf->Cell(60,4,iconv( 'UTF-8','TIS-620','ชำระแล้ว = '.number_format($total_pay,2)),0,1,"C"); $pdf->SetX(150); $pdf->Cell(60,4,iconv( 'UTF-8','TIS-620','รอชำระ = '.number_format($pay_remain,2)),0,1,"C"); $pdf->Image('../img/logo.jpg',10,10,-300); $pdf->Image('../img/logo.jpg',10,242,-300); $pdf->Image('../img/report/'.$f['acc_type_id'].'.jpg',185,242,-200); $pdf->Image('../img/report/'.$f['acc_type_id'].'.jpg',170,35,-144); //$pdf->Line(10,75,200,75); //$pdf->SetFillColor(229,28,35); //$pdf->SetTextColor(255,255,255,255); $pdf->Output("output/RCP_".$order_id.".pdf","F"); ob_end_clean(); header('Location: output/RCP_'.$order_id.".pdf"); } } function num2wordsThai($num){ $num=str_replace(",","",$num); $num_decimal=explode(".",$num); $num=$num_decimal[0]; $returnNumWord; $lenNumber=strlen($num); $lenNumber2=$lenNumber-1; $kaGroup=array("","สิบ","ร้อย","พัน","หมื่น","แสน","ล้าน","สิบ","ร้อย","พัน","หมื่น","แสน","ล้าน"); $kaDigit=array("","หนึ่ง","สอง","สาม","สี่","ห้า","หก","เจ็ด","แปด","เก้า"); $kaDigitDecimal=array("ศูนย์","หนึ่ง","สอง","สาม","สี่","ห้า","หก","เจ็ด","แปด","เก้า"); $ii=0; for($i=$lenNumber2;$i>=0;$i--){ $kaNumWord[$i]=substr($num,$ii,1); $ii++; } $ii=0; for($i=$lenNumber2;$i>=0;$i--){ if(($kaNumWord[$i]==2 && $i==1) || ($kaNumWord[$i]==2 && $i==7)){ $kaDigit[$kaNumWord[$i]]="ยี่"; }else{ if($kaNumWord[$i]==2){ $kaDigit[$kaNumWord[$i]]="สอง"; } if(($kaNumWord[$i]==1 && $i<=2 && $i==0) || ($kaNumWord[$i]==1 && $lenNumber>6 && $i==6)){ if($kaNumWord[$i+1]==0){ $kaDigit[$kaNumWord[$i]]="หนึ่ง"; }else{ $kaDigit[$kaNumWord[$i]]="เอ็ด"; } }elseif(($kaNumWord[$i]==1 && $i<=2 && $i==1) || ($kaNumWord[$i]==1 && $lenNumber>6 && $i==7)){ $kaDigit[$kaNumWord[$i]]=""; }else{ if($kaNumWord[$i]==1){ $kaDigit[$kaNumWord[$i]]="หนึ่ง"; } } } if($kaNumWord[$i]==0){ if($i!=6){ $kaGroup[$i]=""; } } $kaNumWord[$i]=substr($num,$ii,1); $ii++; $returnNumWord.=$kaDigit[$kaNumWord[$i]].$kaGroup[$i]; } if(isset($num_decimal[1])){ $returnNumWord.="จุด"; for($i=0;$i<strlen($num_decimal[1]);$i++){ $returnNumWord.=$kaDigitDecimal[substr($num_decimal[1],$i,1)]; } } return $returnNumWord; } function line_break($text){ $n = str_replace('แขวง','\nแขวง',$text); if(strpos("\n",$n)>0){ return $n; }else{ $n = str_replace('ตำบล','\nตำบล',$text); if(strpos("\n",$n)>0){ return $n; } } } get_quotation($_REQUEST['order']); ?>