Jump to content
chris23

[CONTRIBUTION] PDF Customer Invoice

Recommended Posts

I have a problem with this contribution. I installed everything well but does not work well, provided I get this. I have installed other contributions:

 

http://www.oscommerce.com/community/contributions,4999

http://www.oscommerce.com/community/contributions,5322

http://www.oscommerce.com/community/contributions,1778

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

 

It is possible that these contributions affect pdfinvoice?

 

 

Hi,

 

This is not caused by your contributions.

 

Your first issue PDF_INV_CUSTOMER_REF is because you need to define this in includes/languages/espanol/pdfinvoices.php

 

i.e.

 

define('PDF_INV_CUSTOMER_REF','Referencia de cliente');

 

(Excuse my Spanish!)

 

Your second issue, the messed up order totals, is caused by your payment module returning HTML.

 

This has cropped up before . See post #91 here for the fix. This fix will strip out the HTML, leaving just the numerical totals.

 

Hasta luego

Edited by chris23

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
If I would like to add about more font types. How can I do? Although I try to create about thai font but it can't work. Please help me.

 

Hi,

 

I haven't attempted adding to the base fonts in the fpdf class.

 

Have you had a look at tutorial 7 at fpdf.org?

 

This mentions Thai support.

 

Once you've generated the font, you'll need to alter your configuration value for the available fonts using phpMyAdmin, then select your thai font as the one to use. pdfinvoice.php will pick up the new font and use it.

 

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
Hi,

 

This is not caused by your contributions.

 

Your first issue PDF_INV_CUSTOMER_REF is because you need to define this in includes/languages/espanol/pdfinvoices.php

 

i.e.

 

define('PDF_INV_CUSTOMER_REF','Referencia de cliente');

 

(Excuse my Spanish!)

 

Your second issue, the messed up order totals, is caused by your payment module returning HTML.

 

This has cropped up before . See post #91 here for the fix. This fix will strip out the HTML, leaving just the numerical totals.

 

Hasta luego

 

Hello,

Thank you for your reply.

I have changed as you say but remains error. You can see here. I do not know anything about php but it seems that the error refers to the currency

<span class=currency_simbol></span>

 

I appreciate your help.

 

Best Wishes

Eusebio.

Share this post


Link to post
Share on other sites
Hello,

Thank you for your reply.

I have changed as you say but remains error. You can see here. I do not know anything about php but it seems that the error refers to the currency

<span class=currency_simbol></span>

 

I appreciate your help.

 

Best Wishes

Eusebio.

 

Hello Chris,

Sorry, before I did wrong, I have now corrected and functioning properly.

I am very grateful for your help and for your contribution.

Best Wishes.

Eusebio.

Share this post


Link to post
Share on other sites
Hi Rick,

 

Good idea. I've thought for a long time that the osC packing list is spartan.

 

What features do you think should be on the list (and what shouldn't be)?

 

My thoughts:

 

1. No logo

2. Large font for quantity, product & code to help with picking

3. "Picked By" and "Checked By" areas

4. Total order weight in Kg (?)

5. No prices

 

Cheers

 

Chris

 

Chris,

 

Any more thought on this?

 

Thanks,

Rick

Edited by CatDadRick

Share this post


Link to post
Share on other sites
Hi,

 

I haven't attempted adding to the base fonts in the fpdf class.

 

Have you had a look at tutorial 7 at fpdf.org?

 

This mentions Thai support.

 

Once you've generated the font, you'll need to alter your configuration value for the available fonts using phpMyAdmin, then select your thai font as the one to use. pdfinvoice.php will pick up the new font and use it.

 

HTH

 

Chris

I 've tried to add font follow tutorial 7 at fpdf.org already but I don't know , Where is the mistake again? Because it can't work. For example that I try; add font tahoma in fpdf.php file.

Thank you for your reply.

Share this post


Link to post
Share on other sites
Chris,

 

Any more thought on this?

 

Thanks,

Rick

 

Hi Rick,

Yes more thoughts but not enough time lately :(

When my current workload quietens down, I'll put something together.

Cheers

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

I personally love this contrib, thanks again.

 

I see a wish list starting ;)

 

Well here's one...

Attach (as an attachement) the pdf invoice to customers order confirmation email? (could be trigger-able "as in yes/no" in the osc acp). This to me would be the biggest (by far) add-on this contrib could (can) have to date.

 

yes, it's my my 2.5 cents worth :)

Cheers all!

Edited by Top_Speed

define('PROJECTS', 'Something that goes on forever!');

Share this post


Link to post
Share on other sites
I personally love this contrib, thanks again.

 

I see a wish list starting ;)

 

Well here's one...

Attach (as an attachement) the pdf invoice to customers order confirmation email? (could be trigger-able "as in yes/no" in the osc acp). This to me would be the biggest (by far) add-on this contrib could (can) have to date.

 

yes, it's my my 2.5 cents worth :)

Cheers all!

 

Hi KJ,

 

Thanks for your post. This request has cropped up before and in truth I was intending to put this feature in the original release but shelved it:

 

i) Wasn't sure if it would really be wanted

 

ii) The oscommerce tep_mail function doesn't support attachments per se. It is essentially a wrapper around the email class which does appear to support the sending of attachments. What would be needed is a modified tep_mail function to handle attachments. This wouldn't be too difficult.

 

I've looked on the contrib area for a contribution that sends attachments with a view to 'borrowing' its code but can't find any. If I'm going to add this feature, I'll probably write a new function for includes/functions/general.php so that it could be used in other areas of osc e.g. emailing a pdf catalog, not just for sending the pdf.

 

iii) Couldn't decide when to send the invoice. Would you want it sent at the time the order is placed or when the invoice is raised? Is there an accounting issue sending an invoice for an order that's subsequently cancelled?

 

I suppose the solution is, as you suggested, to have a config option to send or not, then put the email code in checkout_success.php and let the store owner decide.

 

If you think this rounds off the contribution, then I'm happy to add this in. I'm very backed up with work at the moment (see earlier post re packing list) so I can't give you a timeframe, but I'll get on to this as soon as I can. I'm 50% done on the packing list add-on.

 

Many thanks for your feedback,

 

Cheers

 

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 Christian

Your much welcome for the compliment, you deserve it for a contrib that (should & hopefully will) get added to an upcoming new osc ver. I think the (customer side) invoicing is poor in the default osc.

 

So said....

Me personally would like the pdf to go out on the initial 'order confirmation email'. When I order something from a high end shop I'm always presented with a proper invoice as such right after I order and would think others would like it as well.

 

Some sides to the story may be asked and answered as such:

Q? Should the customer get (deserve) an invoice for an order that maybe the shop-owner must approve/review first? (aka: pending invoice)

If yes... then I hope the webmaster has put the "order status"on the invoice (look at my example invoice below). If a customer views and prints the invoice in a "pending" mode it means just that... he/she has printed a "pending order", no big deal & holds no legalities to the shop owner as an actual processed or delivered sale.

 

If no (the shopowner) doesn't want the customer to have the pdf invoice upon completing checkout, in the ACP he/she selects the "no attach invoice" radio button.

 

Now to further take the above step (I have a Credit Card cleaner contrib) that asks you what status would you like to clean cards on (delivered, declined etc.) basically it's the pull down box of your defined order status' ........so the shop-owner can maybe chose what status to send the attachment out whether he/she chooses "pending" which would get them the pdf attached to the confirmation email (as stated in 1st paragraph) or another order status attribute.

 

Well this would take some more programming......... maybe a nix but surely would be nice as a basic attachment anyway.

I also hear you clearly on the tep_mail abilities to use/have an attachment, that as you said would have to be answered before this contrib advancement can continue.

 

Many Thanks for your consideration and time on this Chris!!

Cheers :)

KJ.gif

 

 

My invoice with the current order status defined and shown at customers view/print time. (this basically tells whether the invoice hold water or not ;)

test_invoice.jpg


define('PROJECTS', 'Something that goes on forever!');

Share this post


Link to post
Share on other sites
I 've tried to add font follow tutorial 7 at fpdf.org already but I don't know , Where is the mistake again? Because it can't work. For example that I try; add font tahoma in fpdf.php file.

Thank you for your reply.

 

I'm out of my depth with font generation but I did see this thread on the fpdf forum:

 

http://www.fpdf.org/phorum/read.php?f=1&am...amp;t=4996#5090

 

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

The email attachment add-on is done and uploaded to the contribution area:

 

 

Email PDF as Attachment

 

About

-----

This contribution is an ADD-ON to PDF Customer Invoice to allow the generated PDF invoice to be attached to the customer order confirmation e-mail

 

Pre-requisites

--------------

As this is an ADD-ON to PDF Customer Invoice and not a standalone contribution, you MUST have a fully working version of PDF Customer Invoice installed

 

The packinglist mod is almost done - has been more work than I thought ....!

 

Enjoy

 

Chris

Edited by chris23

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 Christian,

 

First I'd like to thank you for this very nice contribution. well done :thumbsup:

And as "KJ Miller" also mentioned we would like to send a simple/osc standard order confirmation when order is made at "checkout_process.php" and send the PDF invoice after updating the order status to deleverd.

This way there won't be any extra delay at "checkout_process.php" and no legal issue about sending the invoice before the order confirmation

And one more request/question. How to add an invoice date that should be = "order status date"

 

Thanks

 

Adam

Edited by shaytaan

?,???`???,?? God must love stupid people, he made so many ??,???`???,?

Share this post


Link to post
Share on other sites

Hello Chris,

 

I am happy to use your contribution, but one thing for me is very important.

It is possible to make the invoice date same with the date of the order delivered?

 

Many thanks for your help,

 

Eusebio.

Share this post


Link to post
Share on other sites

Hello all,

 

I am just setting up my shop with osCommerce and am new to php programming (although experinced programmer in general). I do have the following problem with pdf_invoice:

Installed is:

pdf_customer_invoice_1.1, pdf_customer_invoice_admin_access, I double checked all installation steps.

 

The module works fine from the admin side, I can look at a customers order history and generate the invoices.

However, it does not work on the customer side. Looking at the order history page and selecting an order (with status "delivered"), the page does show the PDF logo and to the right of it the text "PDF_DOWNLOAD_LINK". There is no link to click on,just this text.

 

Any idea what I may have done wrong?

 

I also have a question/suggestion:

For bookkeeping and tax purposes I think it would be great if invoices would be generated and stored in some folder (only accessible to the admin). Somehow I feel somewhat uneasy about the invoices being generated freshly every time a user or the admin needs them. Could this be an issue fortax authorities?

 

Thanks for your help and for osCommerce and your contribution!

 

Reiner

Edited by Pipeloops

Share this post


Link to post
Share on other sites
Looking at the order history page and selecting an order (with status "delivered"), the page does show the PDF logo and to the right of it the text "PDF_DOWNLOAD_LINK". There is no link to click on,just this text.

Any idea what I may have done wrong?

 

Hi Reiner,

 

Looks like you've forgotten the language entries :

 

// added customer pdf invoice
define ('PDF_INVOICE','PDF Invoice');
define ('PDF_DOWNLOAD_LINK','If you would like to view / print a pdf version of this invoice, click <a title="Click here to view / print a pdf version of this invoice" href="%s">here</a>');
// end added customer pdf invoice

 

 

 

in includes/languages/your language/account_history_info.php

 

I also have a question/suggestion:

For bookkeeping and tax purposes I think it would be great if invoices would be generated and stored in some folder (only accessible to the admin). Somehow I feel somewhat uneasy about the invoices being generated freshly every time a user or the admin needs them. Could this be an issue fortax authorities?

 

I'm not an accountant so the following is only an opinion! My own opinion is that if the customer is only offered a download link for a delivered order and the invoice is marked as "Copy Invoice" or similar, then there is no more accounting issue than a customer phoning up to say they didn't receive an invoice in the post. In these cases, it is normal to issue a "Copy Invoice" or "Reprint". The invoice will always contain the same invoice number / date combination.

 

It is possible to get FPDF to write the PDF to the local filesystem, though as soon as you do this you have the problem of keeping them safe.

 

If you give the customer a url to view the invoice, they can start tampering with the query string to get at other invoices stored locally, especially with the current PDF naming system. There are ways around this for sure but I personally want as little sensitive data on the filesystem as possible. This belongs in the DB.

 

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

Hi Adam,

 

And as "KJ Miller" also mentioned we would like to send a simple/osc standard order confirmation when order is made at "checkout_process.php" and send the PDF invoice after updating the order status to deleverd.

This way there won't be any extra delay at "checkout_process.php" and no legal issue about sending the invoice before the order confirmation

 

The add-on I cobbled together is a first step - sending the invoice on order processing. The main issue was getting the attachment to work.

 

If there's a call for an auto-email when the order status is set to "Delivered", then this is something that could be added as a configurable option.

 

Incidentally, as you've obviously downloaded the e-mail add-on - have you got it installed and if so, are you finding the generation time an issue or not? Just interested to know how different environments cope with the extra processing.

 

And one more request/question. How to add an invoice date that should be = "order status date"

 

I'll put something together for this when I get a mo.

 

Cheers

 

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
It is possible to make the invoice date same with the date of the order delivered?

 

Yes - I'll post something here when I have it working.

 

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
// added customer pdf invoice
define ('PDF_INVOICE','PDF Invoice');
define ('PDF_DOWNLOAD_LINK','If you would like to view / print a pdf version of this invoice, click <a title="Click here to view / print a pdf version of this invoice" href="%s">here</a>');
// end added customer pdf invoice

in includes/languages/your language/account_history_info.php

 

Thanks! That fixed it. I put them into the wrong file (account_history.php), silly me.

 

I'm not an accountant so the following is only an opinion! My own opinion is that if the customer is only offered a download link for a delivered order and the invoice is marked as "Copy Invoice" or similar, then there is no more accounting issue than a customer phoning up to say they didn't receive an invoice in the post. In these cases, it is normal to issue a "Copy Invoice" or "Reprint". The invoice will always contain the same invoice number / date combination.

 

It is possible to get FPDF to write the PDF to the local filesystem, though as soon as you do this you have the problem of keeping them safe.

 

If you give the customer a url to view the invoice, they can start tampering with the query string to get at other invoices stored locally, especially with the current PDF naming system. There are ways around this for sure but I personally want as little sensitive data on the filesystem as possible. This belongs in the DB.

 

Sounds reasonable!

 

Thanks for your help

Reiner

Share this post


Link to post
Share on other sites

Hi Chris, thanks for the attachment addition and your PM on it. I didn't expect it so soon :)

 

but.... I can't get it working (yet), here's my troubleshooting so far:

Triggered to "on" in the ACP.....

On Test orders, instead of seeing the "success page" when completing an order I see "my order history page" then No email w/ attachment is sent, not even the normal order confirmation email.

 

Switching back in the ACP to attach=false the basic email is again sent, order seems normal.

Went over the install 3 times. Any ideas????

 

 

osCommerce 2.2-MS2

PHP Version 4.3.9


define('PROJECTS', 'Something that goes on forever!');

Share this post


Link to post
Share on other sites
Hi Chris, thanks for the attachment addition and your PM on it. I didn't expect it so soon :)

 

but.... I can't get it working (yet), here's my troubleshooting so far:

Triggered to "on" in the ACP.....

On Test orders, instead of seeing the "success page" when completing an order I see "my order history page" then No email w/ attachment is sent, not even the normal order confirmation email.

 

Switching back in the ACP to attach=false the basic email is again sent, order seems normal.

Went over the install 3 times. Any ideas????

osCommerce 2.2-MS2

PHP Version 4.3.9

 

Hi KJ,

If I PM you my e-mail address, are you happy to send over your copy of checkout_success.php and pdfinvoice.php so I can see what's happening?

Cheers

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

Sounds good, anything that helps!

 

S/B in your mailbox shortly.


define('PROJECTS', 'Something that goes on forever!');

Share this post


Link to post
Share on other sites

If you want to be able to date your PDF Invoice with the date the order status is set to "Delivered", this is for you:

 

1. Backup, Backup, Backup - including your MySQL

 

2. Run the following via phpMyAdmin:

 

update configuration set configuration_description='Do you want the invoice date to be today''s date, the date of order or the date order is updated to status "Delivered"? [ Default = today ]', set_function='tep_cfg_select_option(array(''today'', ''order'', ''delivered''),' where configuration_key='PDF_INV_DATE_TODAY';

3. EDIT pdfinvoice.php

 

 

FIND:

 

// set invoice date - today or day ordered. set in config
$date = (PDF_INV_DATE_TODAY == 'today') ? strftime(DATE_FORMAT_LONG) :
tep_date_long($order->info['date_purchased']);

 

 

REPLACE WITH:

 

// set invoice date - today, date ordered or date order status set to "Delivered". Set in config
switch (PDF_INV_DATE_TODAY){
case 'today':
	$date = strftime(DATE_FORMAT_LONG);
	break;
case 'order':
	$date = tep_date_long($order->info['date_purchased']);
	break;
case 'delivered':
	$delivered_query = tep_db_query("select last_modified from " . TABLE_ORDERS . " where orders_id='" . (int)$_GET['order_id'] . "' and orders_status='3'");
	$delivered_status = tep_db_fetch_array($delivered_query);
	if (!tep_db_num_rows($delivered_query)){
		$date = strftime(DATE_FORMAT_LONG);
	} else {
		$date = tep_date_long($delivered_status['last_modified']);
	}
	break;
}

 

 

You'll now have an extra option, 'delivered', under Admin -> PDF Invoices -> Choose invoice date

 

 

Notes

-------

 

If you generate an invoice admin side and the order status is set to any status but "Delivered", the PDF falls back to today's date.

 

On the customer side, this won't be an issue if you set 'Only display invoice for delivered orders?' to true.

 

This mod assumes your orders_status_id for 'Delivered' is the default value of 3

 

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

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

×