|
 |
|
รบกวนเรื่อง fpdf หน่อยนะคะ อยากทราบว่า ถ้าต้องการเขียนให้ออกมา 2 หน้า โดยที่เหมือนกันต้องเขียนยังไงอะคะ |
|
 |
|
|
 |
 |
|
อยากทราบว่า ถ้าต้องการเขียนให้ออกมา 2 หน้า โดยที่เหมือนกันต้องเขียนยังไงอะคะ คือที่เขียนออกมาตอนนี้มันออกมาแค่หน้าเดียวอะคะ
โค้ดที่เขียนออกมาได้แค่หน้าเดียว
<?php
$pdf=new PDF();
$pdf->AddFont('angsa','','angsa.php');
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('angsa','',14);
$pdf->Cell(0,5,"ใบกำกับภาษี / ใบเสร็จรับเงิน [สำหรับลูกค้า]",0,1,'C');
$pdf->cell(10);
$pdf->cell(0,5,'เลขที่ '.$code);
$pdf->cell(-40);
$pdf->cell(0,5,'วันที่ ' . $thaidate ,0,1);
$pdf->cell(10);
$pdf->cell(0,5,'รหัสลูกค้า'. ' ' . $customercode,0,1);
$pdf->cell(10);
$pdf->cell(0,5,'ชื่อลูกค้า'.' '.$customername,0,1);
$pdf->cell(10);
$pdf->cell(0,5,'ที่อยู่ ' . ' ' . $address . ' ต.' . $tambol . ' อ.' . $amphur . ' จ.' . $province,0,1);
$pdf->cell(10);
$pdf->cell(115,5,'รายการ',1,0,'C');
$pdf->cell(20,5,'ราคา/หน่วย',1,0,'C');
$pdf->cell(15,5,'จำนวน',1,0,'C');
$pdf->cell(25,5,'ราคารวม',1,1,'C');
$pdf->cell(10);
$pdf->cell(115,125,'',1,0);
$pdf->cell(20,125,'',1,0);
$pdf->cell(15,125,'',1,0);
$pdf->cell(25,125,'',1,0);
$pdf->cell(-185,5,'',0,0);
//*** Insert Text ***//
$NewPage=0;
$sumPrice=number_format(mysql_result($result,0,"Price"),2,'.',',');
$vat=number_format(mysql_result($result,0,"Vat"),2,'.',',');
$sumTotalPrice=mysql_result($result,0,"TotalPrice");
while ($rsdetail=mysql_fetch_array($result_detail)) {
$detailprice=!empty($rsdetail['Price'])?number_format($rsdetail['Price'],2,'.',','):"";
$detailtotal=!empty($rsdetail['Totalprice'])?number_format($rsdetail['Totalprice'],2,'.',','):"";
$pdf->Cell(10);
$pdf->Cell(115,5,$rsdetail['Detail'],0,0);
$pdf->cell(20,5,$detailprice,0,0,'R');
$pdf->cell(15,5,$rsdetail['Unit'],0,0,'C');
$pdf->cell(25,5,$detailtotal,0,1,'R');
$NewPage+=1;
if($NewPage >=24){
$NewPage=1;
$pdf->AddPage();
$pdf->Cell(0,5,"ใบกำกับภาษี / ใบเสร็จรับเงิน [สำหรับลูกค้า]",0,1,'C');
$pdf->cell(10);
$pdf->cell(0,5,'เลขที่ '. $code);
$pdf->cell(-40);
$pdf->cell(0,5,'วันที่ ' . $thaidate ,0,1);
$pdf->cell(10);
$pdf->cell(0,5,'รหัสลูกค้า'. ' ' . $customercode,0,1);
$pdf->cell(10);
$pdf->cell(0,5,'ชื่อลูกค้า'.' '.$customername,0,1);
$pdf->cell(10);
$pdf->cell(0,5,'ที่อยู่ ' . ' ' . $address . ' ต.' . $tambol . ' อ.' . $amphur . ' จ.' . $province,0,1);
$pdf->cell(10);
$pdf->cell(115,5,'รายการ',1,0,'C');
$pdf->cell(20,5,'ราคา/หน่วย',1,0,'C');
$pdf->cell(15,5,'จำนวน',1,0,'C');
$pdf->cell(25,5,'ราคารวม',1,1,'C');
}
}
if ($rsdetail_row<24) {
for ($i=0;$i<25-$rsdetail_row;$i++){
$pdf->cell(10);
$pdf->cell(175,5,'',2,1);
}
}
$pdf->cell(10);
$pdf->cell(150,17,'',1,0);
$pdf->cell(-150);
$pdf->cell(115,7,$salemastercode,0,0,'L');
$pdf->cell(15);
$pdf->cell(20,7,'ราคาสินค้ารวม',0,0,'R');
$pdf->cell(25,7,$sumPrice,1,1,'R');
$pdf->cell(10);
$pdf->cell(115,5,'',0,0);
$pdf->cell(35,5,"ภาษีมูลค่าเพิ่ม",0,0,'R');
$pdf->cell(25,5,$vat,1,1,'R');
$pdf->cell(10);
$pdf->cell(115,5,"( " . bahtText("$sumTotalPrice") . " )",0,0,'C');
$pdf->cell(35,5,"ราคาสินค้ารวมภาษีมูลค่าเพิ่ม",0,0,'R');
$pdf->cell(25,5,number_format($sumTotalPrice,2,'.',','),1,1,'R');
$pdf->cell(10);
$pdf->cell(175,5,'',0,1);
$pdf->cell(10);
$pdf->cell(175,5,'( ) เงินสด',0,1,'L');
$pdf->cell(10);
$pdf->cell(175,5,'( ) เช็ค ธนาคาร.....................................สาขา........................................เลขที่เช็ค........................................ลงวันที่................................',0,0,'L');
$pdf->cell(10);
$pdf->cell(175,20,'',0,1);
$pdf->cell(10);
$pdf->cell(58.33,5,'(........................................)',0,0,'C');
$pdf->cell(58.33,5,'',0,0);
$pdf->cell(58.33,5,'(........................................)',0,1,'C');
$pdf->cell(10);
$pdf->cell(58.33,5,'ผู้จ่ายเงิน',0,0,'C');
$pdf->cell(58.33,5,'',0,0);
$pdf->cell(58.33,5,'ผู้รับเงิน',0,1,'C');
$pdf->cell(10);
$pdf->cell(58.33,5,'( สำหรับลูกค้า )',0,1,'C');
$pdf->cell(10);
$pdf->cell(50,10,'',0,1);
$pdf->cell(30);
$pdf->cell(50,5,'# กรณีชำระด้วยเช็ค กรุณาสั่งจ่ายชื่อ บริษัท ไอ.ที. โกลโบล จำกัด สินค้ามีปัญหากรุณาแจ้งภายใน 3 วัน #',0,1,'L');
$pdf->Output();
?>
Tag : - - - -

|
|
 |
 |
 |
 |
Date :
2009-11-05 15:59:14 |
By :
pon |
View :
1455 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
|
|

|
Load balance : Server 03
|