Page 1 of 1

Placing invoice details correct in PDF

Posted: 14 Sep 2009, 22:56
by mivm
Hi all

I have a problem placing the invoice details correctly in the pdf document, it seems like there is no offset from the top, all the order lines including totalt are placed in top of the shipping adress and the invoice adress, and I can't figure out where to change this, I have looked in the delivery.pdf.php and in the phoca.tcpdf.php files with no luck so far, could anyone please help my to at lest search in the correct direction :roll:

Please take a look at the axample

Image

By the way, what a nice addon!!

Re: Placing invoice details correct in PDF

Posted: 15 Sep 2009, 16:50
by Jan
Hi, maybe you should try to reinstall it (copy the files again) :idea:

Re: Placing invoice details correct in PDF

Posted: 15 Sep 2009, 21:17
by drunkmaster
I have the exact same problem. Have tried reinstalling about 7 times now. No go!

Re: Placing invoice details correct in PDF

Posted: 15 Sep 2009, 22:12
by mivm
I think it must be something with an offset for the orderdetails to be set somewhere, but I can't figure out where. I hope someone who really knows how the pdf generation works can answer this.

Someone must have made changes to the default template, or does every body use the default template?

I tryed to reinstall but with no luck :cry:

Re: Placing invoice details correct in PDF

Posted: 17 Sep 2009, 00:44
by drunkmaster
Any answers out there? Stuck in a rut right now. Any other ideas would be great!

Re: Placing invoice details correct in PDF

Posted: 17 Sep 2009, 07:17
by mivm
If just anyone could say what file to look in, it would be a great help. I have made small changes to the logo and other small adjustments to the shipping details, but I can't find the values for placing the invoice details. :!:

Re: Placing invoice details correct in PDF

Posted: 17 Sep 2009, 15:01
by Jan
the files you can see here:
administrator\components\com_virtuemart\pdf\ (folder)

Jan

Re: Placing invoice details correct in PDF

Posted: 17 Sep 2009, 23:40
by mivm
I found the solution :twisted: :lol: :P

In the file: administrator/component/com_virtuemart/pdf/delivery.pdf.php

You need to change the following lines:

// PDF
// SKU
$pdf->SetFont($pdfFont,'',7);
$pdf->Cell(15,5,$db->f('order_item_sku'),0,0,'L');

if($d['gen'] == 'bill') {

$pdf->Cell(70,5,$db->f('order_item_name'),0,0,'L');
$pdf->Cell(7,5,$db->f('product_quantity'),0,0,'C');
// $pdf->Cell(8,5,$db->f('product_quantity_delivered'),0,0,'C');
// $pdf->Cell(10,5,$remaining,0,0,'C');
$pdf->Cell(18,5,$pdf->unhtmlentities($CURRENCY_DISPLAY->getFullValue($price_without_tax['item'])),0,0,'R');

$pdf->Cell(19,5,$pdf->unhtmlentities($CURRENCY_DISPLAY->getFullValue($price_without_tax['sum'])),0,0,'R');

$pdf->Cell(12,5,$pdf->unhtmlentities($CURRENCY_DISPLAY->getFullValue($price_tax['sum'])),0,0,'R');

$pdf->Cell(19,5,$pdf->unhtmlentities($CURRENCY_DISPLAY->getFullValue($price_with_tax['sum'])),0,0,'R');
} else {
$pdf->Cell(70,5,$db->f('order_item_name'),0,0,'L');
$pdf->Cell(10,5,$db->f('product_quantity'),0,0,'C');
$pdf->Cell(10,5,$db->f('product_quantity_delivered'),0,0,'C');
$pdf->Cell(20,5,$remaining,0,0,'C');
}

With This:

// PDF
// This is where the order details are placed in the PDF the second number Y in rows: Cell(X,Y,$............. is the
// position of the order details.
// SKU
$pdf->SetFont($pdfFont,'',7);
$pdf->Cell(15,200,$db->f('order_item_sku'),0,0,'L');

if($d['gen'] == 'bill') {

$pdf->Cell(70,200,$db->f('order_item_name'),0,0,'L');
$pdf->Cell(7,200,$db->f('product_quantity'),0,0,'C');
// $pdf->Cell(8,200,$db->f('product_quantity_delivered'),0,0,'C');
// $pdf->Cell(10,200,$remaining,0,0,'C');
$pdf->Cell(18,200,$pdf->unhtmlentities($CURRENCY_DISPLAY->getFullValue($price_without_tax['item'])),0,0,'R');

$pdf->Cell(19,200,$pdf->unhtmlentities($CURRENCY_DISPLAY->getFullValue($price_without_tax['sum'])),0,0,'R');

$pdf->Cell(12,200,$pdf->unhtmlentities($CURRENCY_DISPLAY->getFullValue($price_tax['sum'])),0,0,'R');

$pdf->Cell(19,200,$pdf->unhtmlentities($CURRENCY_DISPLAY->getFullValue($price_with_tax['sum'])),0,0,'R');
} else {
$pdf->Cell(70,200,$db->f('order_item_name'),0,0,'L');
$pdf->Cell(10,200,$db->f('product_quantity'),0,0,'C');
$pdf->Cell(10,200,$db->f('product_quantity_delivered'),0,0,'C');
$pdf->Cell(20,200,$remaining,0,0,'C');
}



And this:

$pdf->Ln(5);
$pdf->SetX(110);
$pdf->SetFont($pdfFont,'B',9);
$pdf->Cell(40,5,$VM_LANG->_('VM_DELIVERY_PRINT_SUBTOTAL_LBL').' :',0,0,'R');
$pdf->SetFont($pdfFont,'',9);
$pdf->Cell(30,5,$pdf->unhtmlentities($CURRENCY_DISPLAY->getFullValue($without_tax['item_total'])),0,0,'R');


with this:

// This is the posistion of the Total values $pdf->Ln(190)
$pdf->Ln(110);
$pdf->SetX(110);
$pdf->SetFont($pdfFont,'B',9);
$pdf->Cell(40,5,$VM_LANG->_('VM_DELIVERY_PRINT_SUBTOTAL_LBL').' :',0,0,'R');
$pdf->SetFont($pdfFont,'',9);
$pdf->Cell(30,5,$pdf->unhtmlentities($CURRENCY_DISPLAY->getFullValue($without_tax['item_total'])),0,0,'R');


Please pay attention to the comments I have made, maybe you will need to adjust these settings a little to fit your report correctly

Re: Placing invoice details correct in PDF

Posted: 24 Sep 2009, 13:38
by Jan
Great, thank you for this guide.

Jan