Order tax details in invoice
-
- Phoca Newbie
- Posts: 2
- Joined: 12 Aug 2009, 14:43
Order tax details in invoice
Hi,
So far I managed to modify the invoice pretty much the way I wanted, except for one detail, I can't get the order tax details in the invoice pdf.
I think it's configured in ps_checkout.php.
In account.order.details.php it's reffered like this: ps_checkout::show_tax_details( $db->f('order_tax_details'), $db->f('order_currency') );
Now the big question: how can I get this in delivery.pdf.php? Just copy-paste doesn't do the job...
Thanks!
Jos
So far I managed to modify the invoice pretty much the way I wanted, except for one detail, I can't get the order tax details in the invoice pdf.
I think it's configured in ps_checkout.php.
In account.order.details.php it's reffered like this: ps_checkout::show_tax_details( $db->f('order_tax_details'), $db->f('order_currency') );
Now the big question: how can I get this in delivery.pdf.php? Just copy-paste doesn't do the job...
Thanks!
Jos
-
- Phoca Newbie
- Posts: 5
- Joined: 13 Aug 2009, 05:56
Re: Order tax details in invoice
I also have this problem. So help us, please.
-
- Phoca Newbie
- Posts: 2
- Joined: 12 Aug 2009, 14:43
Re: Order tax details in invoice
I just got one step closer to the solution:
First you have to include the ps_checkout.php, because there's the calculation of the taxes made:
After that, you can easily tell the pdf to use it:
(Please note the () in which the " ps_checkout::show_tax_details($dbo->f('order_tax_details'), $dbo->f('order_currency')) " should be placed.)
Now, I have one little problem remaining, the output is like this:
<br />De totale belasting (BTW) omvat:<br />€380,00 (19% Belasting (BTW))<br />
I need to remove the ' <br /> ' somehow. Or, better, to tell the pdf to actually put a line break instead.
Can someone help me with this?
Thanks!
First you have to include the ps_checkout.php, because there's the calculation of the taxes made:
Code: Select all
include(CLASSPATH.'ps_checkout.php');
Code: Select all
$pdf->Cell(50,10,(ps_checkout::show_tax_details($dbo->f('order_tax_details'), $dbo->f('order_currency'))),0,0,'L');
Now, I have one little problem remaining, the output is like this:
<br />De totale belasting (BTW) omvat:<br />€380,00 (19% Belasting (BTW))<br />
I need to remove the ' <br /> ' somehow. Or, better, to tell the pdf to actually put a line break instead.
Can someone help me with this?
Thanks!
-
- Phoca Newbie
- Posts: 5
- Joined: 13 Aug 2009, 05:56
Re: Order tax details in invoice
First of all, thank you.
But I have another problem.
How can I get more product information (produkt name AND description) on the PDF-document?
But I have another problem.
How can I get more product information (produkt name AND description) on the PDF-document?
- Jan
- Phoca Hero
- Posts: 48398
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Order tax details in invoice
This needs to be customized in the code (so you will load the data from database and will change the pdf template, so this information will be displayed)
Jan
Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Newbie
- Posts: 5
- Joined: 13 Aug 2009, 05:56
Re: Order tax details in invoice
I changed in delivery.pdf.php the following lines from
to
Now I want to have a linebreak between $db->f('order_item_name') and $db->f('product_attribute').
How to do this?
Code: Select all
$pdf->SetFont($pdfFont,'',7);
$pdf->Cell(70,4,$db->f('order_item_name'),0,0,'L');
Code: Select all
$pdf->SetFont($pdfFont,'',5);
$pdf->Cell(70,4,$db->f('order_item_name')[b]." ".ereg_replace("<br/>"," ",$db->f('product_attribute'))[/b],0,0,'L');
How to do this?
- Jan
- Phoca Hero
- Posts: 48398
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Order tax details in invoice
Hi, see tcpdf site (examples) to see how to add page break to site.
Jan
Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Newbie
- Posts: 5
- Joined: 13 Aug 2009, 05:56
Re: Order tax details in invoice
Thx.
I took this:
But it doesn't work the right way. The break is shown after productnumber:
productnumber
productname product_attribute product_quantity price etc.
I want a break after produktname:
productnumber produktname __________product_quantity price etc.
_____________product_attribute
I took this:
Code: Select all
$pdf->Cell(70,4,$db->f('order_item_name').$pdf->writeHTML('<br>', true, 0, true, 0).ereg_replace("<br/>"," ",$db->f('product_attribute')),0,0,'L');
productnumber
productname product_attribute product_quantity price etc.
I want a break after produktname:
productnumber produktname __________product_quantity price etc.
_____________product_attribute
-
- Phoca Newbie
- Posts: 2
- Joined: 25 Sep 2009, 15:37
Re: Order tax details in invoice
Hi all,
I want to reply to the original post.
You have to add a fonction to phoca.tcpdf.php
It's a copy of the original function show_tax_details.
Modified like this :
function show_tax_details( $details, $currency = '' ) {
global $discount_factor, $CURRENCY_DISPLAY, $VM_LANG;
if( !isset( $discount_factor) || !empty($_REQUEST['discount_factor'])) {
$discount_factor = 1;
}
$auth = $_SESSION['auth'];
if( !is_array( $details )) {
$details = @unserialize( $details );
if( !is_array($details)) {
return false;
}
}
if( sizeof( $details) > 1 ) {
$this->Ln(5);
$this->SetX(110);
$this->SetFont($fD['font'],'B',9);
$this->Cell(40,5,$VM_LANG->_('VM_TAXDETAILS_LABEL'),0,0,'R');
foreach ($details as $rate => $value ) {
if( !$auth['show_price_including_tax']) {
$value /= $discount_factor;
}
$this->Ln(5);
$this->SetFont($pdfFont,'',9);
$this->SetX(130);
$rate = str_replace( '-', $CURRENCY_DISPLAY->decimal, $rate )*100;
$this->Cell(40,5,$CURRENCY_DISPLAY->getFullValue( $value, 5, $currency ).' ('.$rate.'% '.$VM_LANG->_('PHPSHOP_CART_TAX').')',0,0,'R');
}
}
}
You have to call it from delivery.pdf.php
$pdf->Cell(40,5,($pdf->show_tax_details($dbo->f('order_tax_details'), $dbo->f('order_currency'))),0,0,'R');
you can custumize the function to apply to your invoice
Bye
Gilbert
I want to reply to the original post.
You have to add a fonction to phoca.tcpdf.php
It's a copy of the original function show_tax_details.
Modified like this :
function show_tax_details( $details, $currency = '' ) {
global $discount_factor, $CURRENCY_DISPLAY, $VM_LANG;
if( !isset( $discount_factor) || !empty($_REQUEST['discount_factor'])) {
$discount_factor = 1;
}
$auth = $_SESSION['auth'];
if( !is_array( $details )) {
$details = @unserialize( $details );
if( !is_array($details)) {
return false;
}
}
if( sizeof( $details) > 1 ) {
$this->Ln(5);
$this->SetX(110);
$this->SetFont($fD['font'],'B',9);
$this->Cell(40,5,$VM_LANG->_('VM_TAXDETAILS_LABEL'),0,0,'R');
foreach ($details as $rate => $value ) {
if( !$auth['show_price_including_tax']) {
$value /= $discount_factor;
}
$this->Ln(5);
$this->SetFont($pdfFont,'',9);
$this->SetX(130);
$rate = str_replace( '-', $CURRENCY_DISPLAY->decimal, $rate )*100;
$this->Cell(40,5,$CURRENCY_DISPLAY->getFullValue( $value, 5, $currency ).' ('.$rate.'% '.$VM_LANG->_('PHPSHOP_CART_TAX').')',0,0,'R');
}
}
}
You have to call it from delivery.pdf.php
$pdf->Cell(40,5,($pdf->show_tax_details($dbo->f('order_tax_details'), $dbo->f('order_currency'))),0,0,'R');
you can custumize the function to apply to your invoice
Bye
Gilbert
- Jan
- Phoca Hero
- Posts: 48398
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Order tax details in invoice
Ok, thank you for this guide. Jan
If you find Phoca extensions useful, please support the project