pvanleeu
Posts: 5
|
| Posted: 02/02/2009, 10:01 AM |
|
Hello,
I wish to generate an invoice based on items in the database. Instead of generating the entire code myself I was wondering if I could someone get CCS to do it for me. ie. I wish to generate an html page and then send that entire page through email... any Ideas?
|
 |
 |
datadoit
|
| Posted: 02/02/2009, 10:24 AM |
|
There's a recent post on 'how to save php output to static file'. You
can do a similar thing, except you'll take that $main_block and put it
in an email message.
Secondly, I suggest you use a third party emailer such as PHPMailer so
that your encoding and mime-type info will be less of a headache to deal
with. (don't ask me what that means, I just know it sounds good :) )
Finally, I suggest NOT doing HTML email invoices, since many folks now
don't accept HTML email for security reasons. Do them in plain text.
If you're feeling brave, toss your output into a PDF (see posts on
creating PDF's with PHP) and email that as an attachment. That will
allow your pretty formatting of invoices, logos n' all.
|
|
|
 |
damian
Posts: 838
|
| Posted: 02/02/2009, 1:26 PM |
|
create your invoice in ccs - pull relevant data from database etc
use the custom code here (replacing my details and my url with yours):
http://forums.codecharge.com/posts.php?post_id=72179
see last post.
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
maxhugen
Posts: 272
|
| Posted: 02/02/2009, 6:34 PM |
|
How about using Multipart MIME emails? That way you send both text and html, and the email client decides which to display.
I've just set up an 'email template' system. I use a table for the templates with fields for id, subject, html version, text version, and database query SQL.
Both html and text versions use 'tokens', eg {first_name}, which match the fields in my query. A bit of code gets the query result, and replaces the tokens with the db field values. Lastly, I set the appropriate headers for the email, and concatenate the 'message' using 'boundaries' etc.
Although it took some time to set up, I can now add more email templates quite easily.
_________________
Max
www.gardenloco.com | www.eipdna.com | www.chrisarminson.com |
 |
 |
jjrjr1
Posts: 942
|
| Posted: 02/03/2009, 8:39 AM |
|
Hi
It has been a while since I did this for a client but basically I used report builder.
By setting up the groupings etc.. you can cause report builder to paginate and total by customer, assuming your invoices all have a customer id field.
Then by using the proper event in the report builder form, you can call PDF generating code and or send the invoice by e-mail or as a PDF attachement to an e-mail. The method also required modification to standard CCS generated code for reports. Up to you if you still want to explore this idea.
Report builder routines are really convoluted and you might have to study the CCS generated code for it to see where all the events are called.
As I said, It has been a while since I have had to do this. So, if you need me to dust off the code and look for what I did let me know.
Have fun
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
|