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) »
  • Apply a commission on Contributions
Pages: [1]

Author Topic: Apply a commission on Contributions  (Read 3787 times)

Lionsharz

  • I post occasionally
  • **
  • Posts: 76
  • Karma: 0
    • www.ulearnschool.com
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7
  • PHP version: 5.3 / 5.4
Apply a commission on Contributions
August 17, 2013, 09:35:24 am
Is there any way that a commission can be charged on Contributions? I came across this post http://forum.civicrm.org/index.php/topic,21533.msg90210.html#msg90210 which discusses applying % to credit card payments and others that account for the % a fund raiser might take. Neither helped me specifically though.

We run a school and there are times when part of a tuition fee is attributed to an Organization (our partners). For example an Organization might have a relationship with a number of Individuals (students in reality) and would be entitled to a commission on their payments.

Is there any way to do this?

Additionally if that can't be done perhaps there is a solution using Views in Drupal, but haven't been able to crack that yet either.

Any help much appreciated!
www.ulearnschool.com

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Apply a commission on Contributions
August 17, 2013, 11:33:55 am
I'm unclear about what you want Civi to do. It sounds like you don't want this commission to be charged to the end-user (like a credit-card surcharge), but it's more of an internal-tracking sort of thing where your accounting department needs to know what percentage of revenues to give to partner organizations.
In that case, why would Civi need to do anything? Civi is not really an accounting tool, and keeping track of internal finances is generally better left to specialty bookkeeping software.
Am I missing something?
Try asking your question on the new CiviCRM help site.

Lionsharz

  • I post occasionally
  • **
  • Posts: 76
  • Karma: 0
    • www.ulearnschool.com
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7
  • PHP version: 5.3 / 5.4
Re: Apply a commission on Contributions
August 17, 2013, 03:15:02 pm
Hey

Thanks for your response. In a sense that's right. Normally the students who attend our educational courses pay directly themselves, but there are other occasions where a partner / agency sends students to the courses. In those cases a certain percentage of the payment needs to be attributed to the Organization that these students have a Relationship to. Currently we enter the net amount as a Contribution in the Individual account.

Now we would like to use these existing data to create an "agent account" where all their students' transactions would be visible. Plus we can easily calculate and view the commissions.

Its also true that this is really financial reporting, in a way. That's why I thought of the Views solution to pull in the data from the students and calculate the commissions from there. So far I have been able to pull in the relevant Contact and Contribution data. I also created a custom field for the commission in the Organization. However I cannot figure out how to bring it all together and calculate the amount of commission.

Is this kind of thing beyond the scope of civi? Do you reckon the Views approach might the best bet?
www.ulearnschool.com

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Apply a commission on Contributions
August 18, 2013, 07:19:17 am
The "soft credit" field might be good for indicating the organization. The "fee amount" field might be good for indicating the commission. Views ought to be able to display both.
Are you wanting the org and percentage to be entered by staff, or somehow calculated automatically?
Try asking your question on the new CiviCRM help site.

Lionsharz

  • I post occasionally
  • **
  • Posts: 76
  • Karma: 0
    • www.ulearnschool.com
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7
  • PHP version: 5.3 / 5.4
Re: Apply a commission on Contributions
August 18, 2013, 08:23:29 am
Calculated automatically. We have a custom field inside the Organization which holds the commission rate as a decimal (30% = 0.3). I've been toying with this for three days now but no joy. Can't find any way to apply this percentage to all the contributions.
www.ulearnschool.com

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Apply a commission on Contributions
August 18, 2013, 09:27:48 am
A better approach might be to forget what I said in the last comment about storing the info inside the contribution. If you already have a view set up that that displays the contribution as well as the related org then you are 90% there. Just show that custom commission rate field in the view, and then you can either use jQuery or views_custom_field to do the math and display it.
Try asking your question on the new CiviCRM help site.

Lionsharz

  • I post occasionally
  • **
  • Posts: 76
  • Karma: 0
    • www.ulearnschool.com
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7
  • PHP version: 5.3 / 5.4
Re: Apply a commission on Contributions
August 18, 2013, 01:40:46 pm
yep - youre absolutely righ. I am 90% the way there but as the commission rate is a custom field (unrelated to the payments) I cannot find a way to apply that commission figure to every row. The only base table I can use is CiviCRM contributions. Then it displays all the payments etc but the commission is null for the rows and just reverts to zero.

It seems like its super simple but I just can't get them to join through any type of relationships. I thought "Group by" the commission rate field might have done it but no luck.

I have Views Calc in there and it has the calculation that I need, but part of that calculation is the feeding in of the commisssion field and that is blank / zero :(
www.ulearnschool.com

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Apply a commission on Contributions
August 18, 2013, 01:43:34 pm
It sounds like the problem you're having is displaying the related org. How is the relationship set up in CiviCRM?
Try asking your question on the new CiviCRM help site.

Lionsharz

  • I post occasionally
  • **
  • Posts: 76
  • Karma: 0
    • www.ulearnschool.com
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7
  • PHP version: 5.3 / 5.4
Re: Apply a commission on Contributions
August 18, 2013, 01:59:13 pm
In CiviCRM the Individual (A) is a "Student of" of the agency Organization (B), and conversely  the Organization (B) is "An Agent of" the Individual (A). Those Relationships are working ok afai can see.

Searching for this type of relationship and entering the Target contact (the name of the agency) returns all the related students. 

The Soft Credit option is promising though as it seems to be the only way to overtly link relevant contributions from the student to the agent. If I could find a way (either in Civi or views) to pull in these Soft Credits per Organization and somehow combine them with the custom field "commission_rate" in a calculated field then I would be there.
« Last Edit: August 18, 2013, 02:06:29 pm by Lionsharz »
www.ulearnschool.com

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Apply a commission on Contributions
August 18, 2013, 02:46:00 pm
Quote
If I could find a way (either in Civi or views) to pull in these Soft Credits per Organization and somehow combine them with the custom field "commission_rate" in a calculated field then I would be there.
Well that part's acutlly easy. In your view (of contributions), add a relationship: soft-credit -> contact id. That let's you pull up the contact record of the soft creditor including any custom fields, plug that into your custom field, and you're done.
The part I'm not sure about is how to get the soft credit to populate in the first place, aside from entering it all manually.
My hesitation about this whole approach is that you are now committing a rather big database sin, which is storing the same data in two places. That is, there is no "real" need to store the relationship info twice - once in the contact's relationships, and once in a soft credit field. The only reason you would actually want this is if the relationship might change over time and you wanted to be able to have some contributions for a contact attributed to different organizations. If that's the case, go ahead with this plan.
If that's not the case, then I think this approach is asking for trouble, for all the reasons you can probably think of (if your staff forgets to add the relationship and then adds it later, it ain't gonna automatically update all the soft credits for the contact).
A better solution would be to use views_custom_field to execute a little bit of php code that uses the civicrm api to pull up the related contact and display that custom field.
Try asking your question on the new CiviCRM help site.

Lionsharz

  • I post occasionally
  • **
  • Posts: 76
  • Karma: 0
    • www.ulearnschool.com
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7
  • PHP version: 5.3 / 5.4
Re: Apply a commission on Contributions
August 18, 2013, 03:08:08 pm
Yes!  ;D Ok I did it as you said and I have now got the view calculating net and commission etc. Thanks a million for your help. I am using the Soft Credit approach, linking all the students contributions to the agent Organization that way.

On that last point about updating the Soft Credit automatically - how is that done? At the moment I have to enter this manually on each contribution. Is there a way to assign it automatically? It looks like you suggest that the Relationship can be the trigger for something like that...(?)

Thanks again!
« Last Edit: August 18, 2013, 03:11:29 pm by Lionsharz »
www.ulearnschool.com

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Apply a commission on Contributions
August 18, 2013, 08:49:41 pm
My point was that, depending on how exactly the soft-credit is being used, it may be straight-up duplication of data in your database.
Basically, if the soft credit always points to the same organization that the student already has a relationship with, then yes it is duplicate data. This should be a red flag for you, since storing the same thing in two places is almost always a terrible idea.
In that case, you should not be using soft credits at all. Change your view to use a custom php field and use the CiviCRM api to look up the related contact and get the custom data that way.
Try asking your question on the new CiviCRM help site.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Apply a commission on Contributions

This forum was archived on 2017-11-26.