CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Custom pdf receipts and invoices
Pages: [1]

Author Topic: Custom pdf receipts and invoices  (Read 4541 times)

michaellenahan

  • I post occasionally
  • **
  • Posts: 30
  • Karma: 0
    • mick.appspot.com
Custom pdf receipts and invoices
November 09, 2011, 09:56:34 am
Hello, everyone.

I'm working on a project which needs custom invoices and receipts to be sent in pdf format when a user signs up for membership. Any tips on how to approach this?

I've had a look at some ways to take this further but haven't settled on a way forward yet. I'd be interested to hear from the rest of you, as this is likely to be a fairly common requirement, I think.

My first thought was to utilize the "print pdf letter" functionality but am not sure if this can be used for automatic emails triggered by membership signups.

I also found this which looks promising. http://drupal.org/sandbox/peaceworks/1094974 CiviCRM custom receipts for the Canadian Revenue Service.

One thing I would also like is the ability to search through invoice data and export it to csv for an accounting package.

If I create a pdf format civicrm/admin/pdfFormats and attach it to a message template civicrm/admin/messageTemplates can I automate the outgoing pdf that way?

I'm struggling a little with this, so any pointers would be much appreciated. Thanks!

Michael

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Custom pdf receipts and invoices
November 10, 2011, 04:38:13 am
I don't know about your other ideas, but looking at the code of the CiviCRM custom receipts for the Canadian Revenue Service module would be a good place to start.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Custom pdf receipts and invoices
November 10, 2011, 01:46:56 pm
If you do a contribution search & choose print pdf receipts from there (I think it's print or email) it will use the OnlineContribution Workflow template. This does include contribution & membership data

(Ideally we would allow different templates here )
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Rajesh

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 10
  • CiviCRM version: 4.2.x, 4.3.x, 4.4.x
  • CMS version: Drupal 7.xx, Wordpress 3.5.x - 3.6.x, Joomla 3.1
  • MySQL version: 5.5.20
  • PHP version: 5.3.10
Re: Custom pdf receipts and invoices
November 17, 2011, 09:42:25 am
Hello everyone

I have done something similar, where we have a module to create PDF invoices for any types of contributions, which can be viewed in 'View Contribution' page. Also i have written a cron job, which looks for new membership sign-ups and sends an email to them with the PDF Invoice as attachment. This currently works fine with Civicrm 3.x versions.

I can share the code, but not sure what is the best way to do. May be upload it to sourceforge or a blog post or a wiki page?

Thanks

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Custom pdf receipts and invoices
November 17, 2011, 09:50:42 am

Your best bet is probably to:

1. Create an account on github.com

2. upload your code there

Alternatively you can also create it as a sandbox project on drupal.org

Please remember to add an open source license and copyright notices to your files :)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

michaellenahan

  • I post occasionally
  • **
  • Posts: 30
  • Karma: 0
    • mick.appspot.com
Re: Custom pdf receipts and invoices
November 17, 2011, 10:06:01 am
Firstly, thank you Ramesh. I have followed up with a PM.

I've been proceeding using the CiviCRM PDF Receipts module from peaceworks.

The peaceworks civicrm_pdf_receipts module does its main work in hook_civicrm_alterMailParams

I'm encountering a problem because hook_civicrm_alterMailParams is not called when I make online payments.

As mentioned by Eileen, if I do a search using the Find Contributions page

/civicrm/contribute/search?reset=1

I can then choose "Print or Email contribution receipts", then on the next page "Email receipts" and click "Process Receipts".

hook_civicrm_alterMailParams is invoked in the civicrm_pdf_receipts module.

However, this hook does not get called when I make a payment via my payment provider.

How can I determine when the hook is called?

Thanks everyone for all your help

Michael

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Custom pdf receipts and invoices
November 18, 2011, 01:59:20 am
Quote
How can I determine when the hook is called?

hey michael, try $ grep -rn 'CRM_Utils_Hook::alterMailParams' drupal/sites/all/modules/civicrm/CRM
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Rajesh

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 10
  • CiviCRM version: 4.2.x, 4.3.x, 4.4.x
  • CMS version: Drupal 7.xx, Wordpress 3.5.x - 3.6.x, Joomla 3.1
  • MySQL version: 5.5.20
  • PHP version: 5.3.10
Re: Custom pdf receipts and invoices
November 18, 2011, 08:40:02 am
Hi michael

You can find the files in github: https://github.com/rajeshrhino/Civicrm-PDF-Invoice

michaellenahan

  • I post occasionally
  • **
  • Posts: 30
  • Karma: 0
    • mick.appspot.com
Re: Custom pdf receipts and invoices
November 23, 2011, 02:59:06 am
Happy Wednesday, everyone.

This post is an update of my experiences with pdf invoices and receipts so far.

To enable PDF attachments, do this:
Global Settings > Miscellaneous Settings
Attach PDF copy to receipts (by default this is No, we need to set it to yes).

When a new or renewed membership is made online this template is used to generate the pdf attachment:
CiviCRM > Administer > Configure > Message Templates > System Workflow Messages tab > Memberships - Receipt (on-line)

The HTML Format entered on this page creates the HTML email but also the content of the attached PDF file emailed to the member.

I have been amending the HTML template to include the company logo and conform to the company layout so that the PDF conforms to company standards.

To test drive, go to CiviCRM > Contributions > Manage Contribution Pages, find the Contribution Page you want to test, and click Link > Test Drive (or Live Page of you are using your payment provider's test server).

You should receive an email with the pdf attached.

I found that the pdf was off-centre - the text was falling off the right-hand-side of the pdf document. Don't know why. It could be that as a proud European I use an A4 paper template.

Anyway, getting back on topic, and the thing that Lobo asked me to post about. The fix I found for the text falling off the right-side of the page was to change the two <table> tags in the System Workflow Messages > Memberships - Receipt (on-line) HTML like this:

here:

 <!-- table width="500" border="0" cellpadding="0" cellspacing="0" id="crm-event_receipt" style="font-family: Arial, Verdana, sans-serif; text-align: left;" -->
 <table width="100%" border="0" cellpadding="0" cellspacing="0" id="crm-event_receipt" style="font-family: Arial, Verdana, sans-serif; text-align: left;">

and here:

  <!-- table width="500" style="border: 1px solid #999; margin: 1em 0em 1em; border-collapse: collapse;" -->
  <table width="100%" style="border: 1px solid #999; margin: 1em 0em 1em; border-collapse: collapse;">

In summary, I'm wondering how far I can go in customizing the HTML in the interface. It could be that I don't need any module code to achieve what I want. Somehow, I think some code will come in handy, so thanks to peaceworks and Rajesh for your code contributions!

I'll keep this thread updated with how I get on.

Michael

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Custom pdf receipts and invoices

This forum was archived on 2017-11-26.