Jump to content
chris23

[CONTRIBUTION] PDF Customer Invoice

Recommended Posts

Hi Chris,

 

 

Thank you for both the invoice & packingslip they have helped me greatly. If I can add a request to the flood of requests you have already received and that is...

 

Can you please have a look at getting the packing slip to email as an attachment the same as the invoice. So for dropshippers like myself the order can be placed with the supplier in real time.

 

It would be very helpful !!

Share this post


Link to post
Share on other sites

I'm getting an extra space before Customer Name in both the Invoice to box and the Deliver to box.

 

It's not in the database and it's not easy to see how to get rid of it.

 

Any ideas?

Share this post


Link to post
Share on other sites

First, I just installed this recently and this is an amazing contribution. thank you for the great contribution.

 

When I access the PDF invoice from the admin panel, it directs me to the customer login page instead of just loading up the invoice. Any fix to this?

 

-Simon

Share this post


Link to post
Share on other sites
I'm getting an extra space before Customer Name in both the Invoice to box and the Deliver to box.

 

It's not in the database and it's not easy to see how to get rid of it.

 

Any ideas?

 

No idea why you should be getting this extra space but the following will get rid of it

 

EDIT pdfinvoice.php

 

FIND both:

 

$pdf->MultiCell(70, 3.3, tep_html_entity_decode(tep_address_format($order->customer['format_id'], $order->customer, '', '', "\n")), 0, 'L'); 

$pdf->MultiCell(70, 3.3, tep_html_entity_decode(tep_address_format($order->delivery['format_id'], $order->delivery, '', '', "\n")), 0, 'L');

 

REPLACE each with

 

 

$pdf->MultiCell(70, 3.3, tep_html_entity_decode(tep_address_format($order->customer['format_id'], ltrim($order->customer), '', '', "\n")), 0, 'L');

$pdf->MultiCell(70, 3.3, tep_html_entity_decode(tep_address_format($order->delivery['format_id'], ltrim($order->delivery), '', '', "\n")), 0, 'L');

 

HTH


Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites
When I access the PDF invoice from the admin panel, it directs me to the customer login page instead of just loading up the invoice. Any fix to this?

 

The most likely cause is not having the passthru hash set the same in admin/orders.php and pdfinvoice.php

 

Try copy and pasting the hash from one to the other again

 

Chris


Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites
Can you please have a look at getting the packing slip to email as an attachment the same as the invoice. So for dropshippers like myself the order can be placed with the supplier in real time.

 

If you mean emailing the packingslip from checkout_process as the order is placed then this won't work. pdfpackingslip resides in admin so can't be accessed.

 

It would be possible to add an "email packingslip" link in admin but I don't suppose you gain much over generating and attaching manually.

 

Chris


Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites
hi, everything working prefectly but the invoice top right gets overlapped

here is the pic:

http://s278.photobucket.com/albums/kk85/ma...ght_invoice.jpg

 

let me know what i am doing wrong

 

thanks in advance

Mankomal Singh

 

 

You've too much text for the available cell space. To fix this, you either need to:

 

1. Increase the size of the cell and move all other cells down the page

2. Reduce the amount of text

3. Reduce the font size

 

The area of pdfinvoice.php you need to modify is:

// Company name
		$this->SetX(0);
		$this->SetY(12);
		$this->SetFont(PDF_INV_CORE_FONT, 'B', 12);
		$this->SetTextColor($highlight_color[0], $highlight_color[1], $highlight_color[2]);
		$this->Ln(0);
		$this->Cell(150);
		$this->MultiCell(100, 3.5, tep_html_entity_decode(STORE_NAME), 0, 'L');

		// Company Address
		$this->SetX(0);
		$this->SetY(16);
		$this->SetFont(PDF_INV_CORE_FONT, 'B', 10);
		$this->SetTextColor($highlight_color[0], $highlight_color[1], $highlight_color[2]);
		$this->Ln(0);
		$this->Cell(150);
		$this->MultiCell(100, 3.5, tep_html_entity_decode(STORE_NAME_ADDRESS), 0, 'L');

		//Email
		$this->SetX(0);
		$this->SetY(43);
		$this->SetFont(PDF_INV_CORE_FONT, 'B', 10);
		$this->SetTextColor($highlight_color[0], $highlight_color[1], $highlight_color[2]);
		$this->Ln(0);
		$this->Cell(100);
		$this->MultiCell(100, 6, tep_html_entity_decode(PDF_INV_EMAIL) . STORE_OWNER_EMAIL_ADDRESS, 0, 'R');

		//Website
		$this->SetX(0);
		$this->SetY(48);
		$this->SetFont(PDF_INV_CORE_FONT, 'B', 10);
		$this->SetTextColor($highlight_color[0], $highlight_color[1], $highlight_color[2]);
		$this->Ln(0);
		$this->Cell(100);
		$this->MultiCell(100, 6, tep_html_entity_decode(PDF_INV_WEB) . HTTP_SERVER, 0, 'R');

		// VAT / Tax number (if enabled)
		if (DISPLAY_PDF_TAX_NUMBER == 'true') {
			$this->SetX(0);
			$this->SetY(53);
			$this->SetFont(PDF_INV_CORE_FONT, 'B', 10);
			$this->SetTextColor($highlight_color[0], $highlight_color[1], $highlight_color[2]);
			$this->Ln(0);
			$this->Cell(88);
			$this->MultiCell(100, 6, tep_html_entity_decode(PDF_TAX_NAME) . " " . PDF_TAX_NUMBER, 0, 'R');
		}

 

HTH


Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites
Hi,

 

Thanks for this great distribution chris, you did a great job. But I want to be able to manually enter the invoice-number. I do not only have orders generated by my OScommerce site. The dutch IRS requires us however to have sequential ordernumbers, so if an order is cancelled or if I have an order by phone or email, I need to be able to adjust the invoice-number.

 

a) is that possible?

B) how do I do that?

 

TIA

gina

 

Gina,

You'll need to install a contribution that allows you to generate an invoice number independently of oscommerce, something like:

 

http://addons.oscommerce.com/info/4731

 

Once you've done this, you'll need to make some changes to includes/classes/order.php and pdfinvoice.php to display the new invoice number.

 

Someone else tried this before - have a look on the first couple of pages on this thread - we got it working eventually ...

 

HTH

 

Chris


Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites

UPDATE ON EMAIL ATTACHMENT ISSUE

 

I don't want anyone thinking I've quietly forgotten about the problems some people are having with emailing the PDF as an attachment.

 

From some helpful posts, I've narrowed the problem down to what's probably not causing it:

 

- mail server

- email client

- linefeed settings

 

There are users getting failures using the same server environments as me (where mine are succeeding), the only difference being the PHP version running on the remote linux server - PHP5 being fine, PHP4 failing.

 

I'm going to "retrofit" a linux box with PHP4 and see if I can break things :-"

 

In the meantime, those who are getting failures of the PDF attachment, please post the message source and server environments (or PM them to me).

 

This is being a sod to nail as I don't have a broken configuration to try and fix ...

 

Chris


Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites
No idea why you should be getting this extra space but the following will get rid of it

 

EDIT pdfinvoice.php

 

FIND both:

 

$pdf->MultiCell(70, 3.3, tep_html_entity_decode(tep_address_format($order->customer['format_id'], $order->customer, '', '', "\n")), 0, 'L'); 

$pdf->MultiCell(70, 3.3, tep_html_entity_decode(tep_address_format($order->delivery['format_id'], $order->delivery, '', '', "\n")), 0, 'L');

 

REPLACE each with

$pdf->MultiCell(70, 3.3, tep_html_entity_decode(tep_address_format($order->customer['format_id'], ltrim($order->customer), '', '', "\n")), 0, 'L');

$pdf->MultiCell(70, 3.3, tep_html_entity_decode(tep_address_format($order->delivery['format_id'], ltrim($order->delivery), '', '', "\n")), 0, 'L');

 

HTH

 

Chris

 

Thanks for the reply. In fact, that fix didn't work (though it looks like it should), However, it forced me to debug further and I found that it was something I'd done - though it highlighted something which surprised me: function tep_address_format is called when the full name is already in 'firstname'.

 

Alan

Share this post


Link to post
Share on other sites

Hello

 

I just installed this contribe.

 

It looks to work well.

 

The problem is that now when I try to go to /account_history_info.php

 

I get the error :

 

Fatal error: Cannot redeclare tep_db_connect() (previously declared in /home/html/includes/functions/database.php:13) in /home/html/includes/functions/database.php on line 25

 

I try to uninstall the contribe but the problem is still there.

 

I have no idea of what happens....

 

Any help will be welcome.

 

Thanks

 

Florent

Share this post


Link to post
Share on other sites
Hello

 

I just installed this contribe.

 

It looks to work well.

 

The problem is that now when I try to go to /account_history_info.php

 

I get the error :

 

Fatal error: Cannot redeclare tep_db_connect() (previously declared in /home/html/includes/functions/database.php:13) in /home/html/includes/functions/database.php on line 25

 

I try to uninstall the contribe but the problem is still there.

 

I have no idea of what happens....

 

Any help will be welcome.

 

Thanks

 

Florent

 

 

in fact most of my website pages have this error now..... my site is down :(

 

What could I did wrong !?!?

 

Florent

Share this post


Link to post
Share on other sites
in fact most of my website pages have this error now..... my site is down :(

 

What could I did wrong !?!?

 

Florent

 

FIXED - SORRY

Share this post


Link to post
Share on other sites

Trying to design the pdf file to meet my store's needs, but ran into a problem.

I have a   character set in my currency, so that the price of the product would be displayed as 200 EUR instead of 200EUR.

 

Now, the problem is that when e-mailing the order or creating a pdf of it, the   is displayed (as it's not HTML) like this: 200 EUR. The way I got it fixed with emails was with the following code in checkout_process.php:

$email_order = str_replace(" EUR"," EUR",$email_order);

I guess something similar should be added to the fpdf.php file (or some other file), but I just don't seem to manage to fully understand the code...

 

Any suggestions?

Edited by indre1

Share this post


Link to post
Share on other sites
Now, the problem is that when e-mailing the order or creating a pdf of it, the   is displayed (as it's not HTML) like this: 200 EUR. The way I got it fixed with emails was with the following code in checkout_process.php:

$email_order = str_replace(" EUR"," EUR",$email_order);

I guess something similar should be added to the fpdf.php file (or some other file), but I just don't seem to manage to fully understand the code...

 

There's a function (tep_html_entitity_decode) built-in to pdfinvoice.php to convert html entities to their literal equivalent.

 

Try wrapping each

$currencies->format(..)

instance in this function e.g.

 

tep_html_entitity_decode($currencies->format(..))

 

HTH


Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites

Thanks a lot, works now. Btw, you typoed... tep_html_entity_decode

 

Though strangely in pdfinvoice.php I seem be having Line Feed problems (with v1.1). For example the same tep_html_entity_decode was commented for some reason into one line and so were some other functions, had to convert the file to some PC format and now works fine. Running Windows XP, tried with notepad and edit plus 2, but both were displaying Line Feeds incorrectly (but only for a few functions).

 

Even with the strange Line Feeds under Windows, the file ran ok on the server (as it's probably an UNIX system) and it is displayed correctly under linux, but was a bit confusing for me when I searched for the function under Windows.

Share this post


Link to post
Share on other sites

OK, problem for the totals section being overlapped.. I assume that the cell is not big enough.

 

It's like this... but its pasted together and the total is not viewable.

 

Sub-Total: $10.00

Canada Post [1 box(es) to be shipped]<br>Box - 3.2(kg)

(Regular, <acronym title='Estimated Delivery

Date'>EDD</acronym>: June 09, 2008): $4.36

5.0% GST#13087 7517 + 7% PST (BC): $1.72

Total: $16.08

 

What area should I modify?

You guys rock.

Share this post


Link to post
Share on other sites

I have the same overlapping issue as cwm3 but can't figure what needs to be changed, please see image for the problem.

 

customerpdfsr0.th.gif

Share this post


Link to post
Share on other sites
I have the same overlapping issue as cwm3 but can't figure what needs to be changed, please see image for the problem.

 

customerpdfsr0.th.gif

 

This issue was answered in post #396 of this thread.

 

HTH


Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored.

Google Site Search is your friend

My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes

Share this post


Link to post
Share on other sites

Chris thanks for replying, before posting I did try suggested workaround mentioned in post #396 it didn't work for me or I did it wrong (not a coder).

 

I wanted to remove the following '(1 x 2.2lbs) (2lbs, 3.2001oz) (Priority Mail: Estimated 1 - 3 Days)' so I used str_replace no go finally instead of removing the line I increased the cell.

 

changed line 637

$pdf->SetX(102);

to

$pdf->SetX(30);

 

and changed line 645

$pdf->MultiCell(94,6,$order->totals[$i]['title'] . ' ' . $order->totals[$i]['text'],0,'R');

to

$pdf->MultiCell(166,6,$order->totals[$i]['title'] . ' ' . $order->totals[$i]['text'],0,'R');

 

 

However if you can help me to remove '(1 x 2.2lbs) (2lbs, 3.2001oz) (Priority Mail: Estimated 1 - 3 Days)' I would be much obliged.

 

Instead of this

Sub-Total: $32.00

United States Postal Service (1 x 2.2lbs) (2lbs, 3.2001oz) (Priority Mail: Estimated 1 - 3 Days): $5.20

CA TAX 8.25%: $2.64

Total: $39.84

 

would like this

Sub-Total: $32.00

United States Postal Service: $5.20

CA TAX 8.25%: $2.64

Total: $39.84

Share this post


Link to post
Share on other sites

Hi!

I've got a big problem with this contribution, because I have'nt polish characters in pdf's. How can I change the coding of pdf?

Please for reply :rolleyes:

Share this post


Link to post
Share on other sites

Hi

 

Thanks for a nice contrib.

 

I've been struggeling to get the pdf attached with outgooing emails.

When i changed EMAIL_USE_HTML from true to false it worked...

 

Any idea why it doesn't work with EMAIL_USE_HTML set to true ?

 

I've

hacked this contrib some more, i've set it up so the attachment can be sent true the administration when you update an order.

Share this post


Link to post
Share on other sites

Simpe fix for my attachment problem

 

edit includes/functions/general.php

 

Find:

 

function tep_mail_string_attachment($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address, $string, $filename) {

if (SEND_EMAILS != 'true') return false;

 

// Instantiate a new mail object

$message = new email(array('X-Mailer: osCommerce'));

 

// Build the text version

$text = strip_tags($email_text);

if (EMAIL_USE_HTML == 'true') {

$message->add_html($email_text, $text);

} else {

 

 

Replace with:

 

function tep_mail_string_attachment($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address, $string, $filename) {

if (SEND_EMAILS != 'true') return false;

 

// Instantiate a new mail object

$message = new email(array('X-Mailer: osCommerce'));

 

// Build the text version

$text = strip_tags($email_text);

if (EMAIL_USE_HTML == 'true') {

// HTML won't be used in this mail $message->add_html($email_text, $text);

$message->add_text($text);

 

} else {

Share this post


Link to post
Share on other sites

I have installed PDF invoice v 1.1 with the invoice admin module. After installing the invoice admin module I get the following error on my site:

 

Fatal error: Call to a member function add_current_page() on a non-object in /home/inkround/public_html/includes/application_top.php on line 324

 

Any solution for this problem?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×