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) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • PDF Invoice
Pages: [1]

Author Topic: PDF Invoice  (Read 3805 times)

Parvez

  • I post occasionally
  • **
  • Posts: 91
  • Karma: 7
PDF Invoice
November 04, 2009, 09:52:57 am
Hi All

I've been watching the threads with regards to Invoice production and whats required etc. We have a very simple requirement in that all people who register for an event and opt to pay later need to be invoiced.

The approach that we've designed is that the user can search for pending participants and from that screen we would like to add a link to be able to produce an invoice - its not a proper invoice, more like pro forma.

Anyway, this is the first time I'm adding something new to Civi and I wanted to know how I should go about developing this using as much of what exists as possible. We're running 3.0.1 and Drupal 6.x.

So how should I go about developing this?
Also, how does the flow work of the code at present i.e. I was trying to work out what the call stack is when you produce a mailing label but couldn't really get my head around it.

Any help would be appreciated.

Thanks

Parvez

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: PDF Invoice
November 04, 2009, 12:56:29 pm

For contact search, u can inject your own tasks via the task hook:

http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+hook+specification#CiviCRMhookspecification-hookcivicrmsearchTasks

here's a rough guide:

1. Put your code in a task class. Use a class from CRM/Contact/Form/Task/* as an example to model your task.

2. Implement the above hook and include your task in the list of tasks exposed

However, the above hook is not callled in participant search :( We can fix this pretty easily (for 3.0.3?), so let us know if u want to go down this route. Feel free to ping us on IRC if u have questions or want more detailed answers

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

Parvez

  • I post occasionally
  • **
  • Posts: 91
  • Karma: 7
Re: PDF Invoice
November 05, 2009, 01:47:12 am
Hi Lobo

I've run this past the client but they would prefer to be able to run the invoice per participant from the participant view page.

I've created a custom .tpl and amended it, adding a 'Print Invoice' url

What I need to know is how I should go about coding the production of the invoice as a PDF, I'm not after details, just where to place what classes etc.

Thanks in advance.

Parvez

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: PDF Invoice
November 05, 2009, 07:03:53 am

hey parvez:

that requirement makes it a bit easier :)

check: CRM/Contribute/Form/Task/PDF.php

you can model the invoice from that class.

place it in CRM/Event/Page/PDFInvoice.php (or better yet in a custom directory)

that file will take the participantID as a GET parameter and echo a PDF file

add an xml menu hook to invoke that file, check:

http://svn.civicrm.org/sfschool/trunk/SFS/xml/Menu/sfschool.xml
http://svn.civicrm.org/sfschool/trunk/drupal/sfschool/sfschool.module (the sfschool_civicrm_xmlMenu function)

all the files in http://svn.civicrm.org/sfschool/trunk/SFS/Page/* is driven from that menu

lobo


ping us on IRC if u have more question
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: PDF Invoice
February 15, 2010, 02:49:34 pm
Did this ever progress?
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: PDF Invoice
February 15, 2010, 11:40:41 pm
I know it progressed, I saw the invoice in the Brussels developer camp :-) I hope Parvez will be on line to tell you more...
Erik
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Re: PDF Invoice
February 16, 2010, 05:31:45 am
I had a requirement to generate PDF invoices. I wrote a custom token called "pending_payments"  that I use from the existing "Create PDF Letter" action. I will be uploading the code to the thread at http://forum.civicrm.org/index.php/topic,11424.0.html
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: PDF Invoice
February 16, 2010, 05:57:02 am
Great, thanks for sharing!
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Re: PDF Invoice
February 16, 2010, 09:30:43 pm
The token for "pending_payments" can be downloaded from: http://www.pogstone.com/downloads/civicrm_extras.zip.  This has been tested under CiviCRM 2.2.8 and better, with both Joomla and Drupal.  It also contains the tokens for joint greetings that are described at http://civicrm.org/blogs/sgladstone/dealing-joint-greetings-part-2-code-provided
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

grahamgilchrist

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 3
Re: PDF Invoice
July 16, 2010, 07:18:20 am
Quote from: Donald Lobo on November 04, 2009, 12:56:29 pm
However, the above hook is not callled in participant search :( We can fix this pretty easily (for 3.0.3?), so let us know if u want to go down this route. Feel free to ping us on IRC if u have questions or want more detailed answers

Sorry to bring up an old thread slightly off-topic, but did this ever get included (the participants search tasks hook)? It doesn't say so in the wiki docs hook page, but these seem a little out of date.
If not and its as easy as you say, is there a chance of getting it into the 3.2 release?

It would be *really* useful for us. We have a requirement to log activities with the results of a participant search (e.g. all people on one event) which would (I assume) be relatively easy to implement using this hook.

If not, what would you suggest would be a better way? I would happily contribute this code back to civi if I can get it to work :)

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Re: PDF Invoice
July 16, 2010, 12:59:18 pm
You could use the "Advanced Search" and restrict the results based on event. Then my custom mail merge token is available within the "Create PDF Letter" batch action
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: PDF Invoice
July 16, 2010, 01:46:08 pm
Not quite the answer but I did submit a patch for 3.2 which allows you to user html formatting for your contribution receipts (sent from find contributions) and to send as e-mail as well from the same process
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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • PDF Invoice

This forum was archived on 2017-11-26.