|
 |
|
แสดงหัวข้อเฉพาะหน้าแรก ........................................งใน php fpdf |
|
 |
|
|
 |
 |
|

ทำอย่างไรให้ส่วนนี้แสดงเฉพาะหน้าแรก ใน php fpdf
report_po.php
<?php
require('fpdf.php');
define('FPDF_FONTPATH','font/');
class PDF extends FPDF
{
//Load data
function LoadData($file)
{
//Read file lines
$lines=file($file);
$data=array();
foreach($lines as $line)
$data[]=explode(';',chop($line));
return $data;
}
function Header()
{
$this->Image('image/logo.jpg',10,6,30);
$this->AddFont('cordiab','','cordiab.php');
$this->SetFont('cordiab','',18);
$this->Cell(0,10,iconv('UTF-8','TIS-620','บจก. ตั้งใจกลการพัฒนา (ศูนย์ซ่อมบำรุง)'),0,1,'C');
$this->Cell(0,10,iconv('UTF-8','TIS-620','เลขที่ 62/49 ถ.วังตอ ต.ทับเที่ยง อ.เมือง จ.ตรัง 92000'),0,1,'C');
$this->Cell(0,10,iconv('UTF-8','TIS-620','โทรศัพท์ : 081-111-2233'),0,1,'C');
$this->Cell(0,10,iconv('UTF-8','TIS-620','ใบสั่งซื้อรถ'),0,1,'C');
// Line break
$this->Ln(10);
}
function Footer()
{
$this->SetLineWidth(0.5);
include("time.php");
$this->AddFont('angsana','B','angsab.php');
$this->SetFont('angsana','B',11);
$this->SetY(-15);
$this->Cell(0,0,iconv( 'UTF-8','TIS-620',''),1,0,"C");
$this->Ln(5);
$this->Cell(0,0,iconv( 'UTF-8','TIS-620','By... ศูนย์ซ่อมตั้งใจกลการ'),0,0,"L");
$this->Cell(0,0,iconv( 'UTF-8','TIS-620','วันเวลาที่ี่พิมพ์ : '.date("$d-$m-$y $t")),0,1,"R");
}
//Better table
function table1($data)
{
$this->SetMargins(10,60,10 );
$this->AddFont('cordia','B','cordia.php');
$this->SetFont('cordia','B',13);
//$this->Cell(30,10,iconv('UTF-8','TIS-620','บจก. ตั้งใจกลการพัฒนา (ศูนย์ซ่อมบำรุง)'),0,0,'C');
$this->SetFont('');
$this->Ln();
$this->Ln();
//Column widths
$w=array(10,38,38,23,34,25,25);
//Header
/* for($i=0;$i<count($header);$i++)
$this->Cell($w[$i],10,iconv('UTF-8','TIS-620',$header[$i]),1,0,'C');
$this->Ln();
*/
//Data
$rang = 1;
foreach ($data as $eachdata)
{
$this->Cell(10,9,iconv('UTF-8','TIS-620',$rang++.'.'),1,0,'C');
$this->Cell(38,9,iconv('UTF-8','TIS-620',$eachdata["machine_id"]),1,0,'LR');
$this->Cell(38,9,iconv('UTF-8','TIS-620',$eachdata["chassis_id"]),1,0,'LR');
$this->Cell(23,9,iconv('UTF-8','TIS-620',$eachdata["brand_name"]),1,0,'LR');
$this->Cell(34,9,iconv('UTF-8','TIS-620',$eachdata["type_name"]),1,0,'LR');
$this->Cell(25,9,iconv('UTF-8','TIS-620',$eachdata["color_name"]),1,0,'LR');
$this->Cell(25,9,iconv('UTF-8','TIS-620',number_format($eachdata["buy"])),1,0,'LR');
$this->Ln();
}
}
}//end class
$pdf=new PDF();
$pdf->AliasNbPages();//จำนวนหน้าทั้งหมด
//Column titles
$header=array ('ลำดับ','เลขเครื่อง','เลขถัง','ยี่ห้อ','รุ่น','สี','ราคาซื้อ (บาท)');
//Data loading
//*** Load MySQL Data ***//
$strSQL1 = $strSQL;
$objQuery = mysql_query($strSQL1);
$resultData = array();
for ($x=0;$x<mysql_num_rows($objQuery);$x++)
{
$result = mysql_fetch_array($objQuery);
array_push($resultData,$result);
}
$pdf->AddPage();
$pdf->AddFont('cordia','','cordia.php');
$pdf->AddFont('cordia','','cordia.php');
$pdf->SetFont('cordia','',16);
$pdf->SetMargins(10,5,5); // กำหนดระยะข้อมูลห่างจากขอบกระดาษ
$pdf->Ln(35);//ระยะจากบนขอบกระดาษ
$pdf->Cell( 0 , -10 , iconv( 'UTF-8','cp874' , 'รับรถจากสาขา :'.$branch_name ) , 0 , 1 , 'L' );
$pdf->Cell( 0 , -10 , iconv( 'UTF-8','cp874' , 'กำหนดส่งรถ :'.$date_receive ) , 0 , 1 , 'L' );
$pdf->Cell( 0 , -10 , iconv( 'UTF-8','cp874' , 'วันที่สั่งซื้อ :'.$date_receive ) , 0 , 1 , 'L' );
$pdf->Cell( 0 , -10 , iconv( 'UTF-8','cp874' , 'เลขที่ :'.$po_id ) , 0 , 1 , 'L' );
$pdf->Ln(24);//ระยะจากบนขอบกระดาษ
$pdf->AddFont('cordia','','cordia.php');
$pdf->SetFont('cordia','',13);
$pdf->Cell(10,10);
$pdf->table1($resultData);
$pdf->Cell(0,0,iconv( 'UTF-8','TIS-620',''),1,0,"C");
$pdf->Ln(100);
$pdf->Cell(0,10,iconv( 'UTF-8','TIS-620','______________________________ _______________________________ ______________________________'),0,1,"C");
$pdf->Cell(5,10,iconv( 'UTF-8','TIS-620',' ผู้สั่งซื้อ ผู้มีอำนาจอนุมัติ ผู้ขาย '),0,1);
$pdf->Output("report_po.pdf","F");
?>
Tag : PHP

|
|
 |
 |
 |
 |
Date :
2013-05-09 08:39:08 |
By :
lookpla26 |
View :
1068 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

|
 |
 |
 |
 |
Date :
2013-05-09 09:29:24 |
By :
lookpla26 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เอาส่วนนี้ออก
Code (PHP)
function Header()
{
$this->Image('image/logo.jpg',10,6,30);
$this->AddFont('cordiab','','cordiab.php');
$this->SetFont('cordiab','',18);
$this->Cell(0,10,iconv('UTF-8','TIS-620','บจก. ตั้งใจกลการพัฒนา (ศูนย์ซ่อมบำรุง)'),0,1,'C');
$this->Cell(0,10,iconv('UTF-8','TIS-620','เลขที่ 62/49 ถ.วังตอ ต.ทับเที่ยง อ.เมือง จ.ตรัง 92000'),0,1,'C');
$this->Cell(0,10,iconv('UTF-8','TIS-620','โทรศัพท์ : 081-111-2233'),0,1,'C');
$this->Cell(0,10,iconv('UTF-8','TIS-620','ใบสั่งซื้อรถ'),0,1,'C');
// Line break
$this->Ln(10);
}
แล้วเปลี่ยนมาเป็น (แสดงเฉพาะหน้าแรก)
Code (PHP)
$pdf=new PDF();
$pdf->AliasNbPages();//จำนวนหน้าทั้งหมด
$pdf->Image('image/logo.jpg',10,6,30);
$pdf->AddFont('cordiab','','cordiab.php');
$pdf->SetFont('cordiab','',18);
$pdf->Cell(0,10,iconv('UTF-8','TIS-620','บจก. ตั้งใจกลการพัฒนา (ศูนย์ซ่อมบำรุง)'),0,1,'C');
$pdf->Cell(0,10,iconv('UTF-8','TIS-620','เลขที่ 62/49 ถ.วังตอ ต.ทับเที่ยง อ.เมือง จ.ตรัง 92000'),0,1,'C');
$pdf->Cell(0,10,iconv('UTF-8','TIS-620','โทรศัพท์ : 081-111-2233'),0,1,'C');
$pdf->Cell(0,10,iconv('UTF-8','TIS-620','ใบสั่งซื้อรถ'),0,1,'C');
// Line break
$pdf->Ln(10);
|
ประวัติการแก้ไข 2013-05-09 09:39:58
 |
 |
 |
 |
Date :
2013-05-09 09:39:28 |
By :
nattkhanesha |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|