2011-05-14 4 views
0

왼쪽 상단에 로고가있는 버스 대행사에 대한 인보이스를 작성하고 싶습니다. 주소는 오른쪽 상단에 있습니다. 그 중간에 자신의 정보 이름, 성, destinatin, 비용 .. 등 다음 하단에 어쩌면 좀 더 많은 정보 .. 그것은 이것을 구축하는 데 많은 시간이 걸릴 것입니다하지만 어딘가에 이미 어딘가에 있다고 생각 이것에 대한 스크립트를 만들었으니 아무도 모른다면 당신의 도움이 필요합니다. 많은 시간을 할애 할 것입니다.php에서 PDF 인보이스

시간을내어 도와 주셔서 감사합니다.

+0

http://net.tutsplus.com/tutorials/other/how-to-generate-pdfs-with-php-new-plus-tutorial/ 9 달러이지만 가장 포괄적 인 튜토리얼입니다. –

+0

http://stackoverflow.com/questions/124959/create-word-document-using-php-in-linux/132054#132054 그런 다음 odt -> doc 대신 OpenOffice 명령을 통해 odt -> pdf 변환을 실행합니다 라인 인터페이스 –

답변

0

필자는 FILE_PDF PHP 라이브러리를 사용하여 비슷한 작업을 수행했습니다. 그것은 dates[] 또는 hours[]의 형태로 POST 데이터를 받아 it.Here의 내 코드의 일부 테이블을 채우고, 완벽은 아니지만 당신에게 시작을 줄 수도

$tasks = array("dates","descriptions","hours","minutes"); 

foreach($tasks as $name) 
{ 
    $$name = explode("\n",$_POST[$name]); 
} 
for ($i=0;$i<count($descriptions);$i++) 
{ 
    $data[]=array("dates"=>$dates[$i],"descriptions"=>$descriptions[$i],"hours"=>$hours[$i],"minutes"=>$minutes[$i]); 
} 


$p = &File_PDF::factory('P','mm','A4'); 

$p->open(); 

$p->setMargins(25, 25); 
$p->addPage('P'); 

$p->setFont('arial', '', 24); 
$p->cell(0, 9, "Invoice", 0, 1, 'C'); 

$p->setFont('arial', '', 14); 
$p->write(6,date("F j, Y")); 
$p->newLine(); 

$p->write(6,"Invoice #DIM-09-10-001"); 
$p->newLine(); 

$p->write(6,"Invoice for X"); 

$p->newLine(); 
$p->newLine(); 
$p->setFont('arial', '', 12); 

$p->write(10, 'Work performed @ hourly rate of $20.00'); 
$p->newLine(); 
$p->newLine(); 

$widths = array(23,90,15,25); 

$header = array("Date","Task","","Time"); 
foreach($header as $num=>$col) 
     $p->Cell($widths[$num],7,$col,"B"); 
$p->newLine(); 
foreach($data as $row) 
{ 
    $i=0; 
    foreach($row as $name=>$col) 
    { 
     $p->Cell($widths[$i],10,$col,0); 
     $i++; 
    } 
    $p->newLine(); 
} 

$table_footer = array(array("","Total Time",'8 hours @ $20/hour'),array("","Total Fees Due",'$160')); 
$widths = array(80,35,40); 
$borders = array(array(0,"T","T")); 

foreach($table_footer as $rownum=>$row) 
{ 
    foreach($row as $num=>$col) 
     $p->Cell($widths[$num],10,$col,$borders[$rownum][$num]); 
    $p->newLine(); 
} 

$p->write(10,"Please make check payable to "); 
$p->setFontStyle("B"); 
$p->write(10,"David Mihal"); 

$p->newLine(); 
$p->newLine(); 

$p->setFontStyle("I"); 
$p->write(4,"All invoices are due and payable within 30 days. Thank you for your prompt attention to this invoice and for your continued business."); 
$p->close(); 

$p->output('invoice.pdf',true); 
관련 문제