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) »
  • Cash balance for contact
Pages: [1]

Author Topic: Cash balance for contact  (Read 493 times)

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
Cash balance for contact
July 02, 2013, 05:41:16 am
Hi,

We have a requirement to maintain a cash balance for contacts, visible on contact summary. Initial balances will be imported from a legacy system; these may be positive (in credit) or negative (owing money). When a contact e.g. creates a membership worth £50 with a pay later contribution, their cash balance will be reduced by £50, showing that they owe money. When this contribution is completed, their cash balance will be increased by £50, restoring their balance to what it was initially. Staff should be able to see why the balance is as it is.
They would also like 3 mailing tokens for the cash balance now, on a fixed date last year & on a fixed date the previous year.

One approach:
(A) A custom field & hook. Import the initial balances, then have the hook add/subtract subsequent contribution amounts.

Another approach:
(B) Import the initial balances as pending contributions and implement the balance as the sum of a contact's pending contributions.

Approach (B) is maybe better for the "see why the balance is as it is" requirement, in cases where there was a non-zero imported balance and there have been subsequent contributions: the initial balance is there in the list of a contact's contributions, along with subsequent ones.

Questions...
- In approach (B), how to represent a positive imported balance, i.e. the contact being in credit? In theory a pending contribution with a negative amount might work, if that doesn't throw Civi into a spin, but that seems an odd creature. Or perhaps a completed contribution of a special type that we reserve for this purpose, say "Credit", and which we include in the balance calculation?
- Is there a better approach making use of the CiviAccount work?

Any other thoughts welcome.

Cheers,

Dave J

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: Cash balance for contact
July 10, 2013, 08:22:16 pm
What system are you importing from? What is the data structure for credit balances in the old system? 

This may impact your choice, as you mentioned a requirement of being able to explain how the system calculated the balance.
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
Re: Cash balance for contact
July 12, 2013, 09:23:07 am
Quote from: epg on July 10, 2013, 08:22:16 pm
What system are you importing from? What is the data structure for credit balances in the old system? 

This may impact your choice, as you mentioned a requirement of being able to explain how the system calculated the balance.

Thanks for the response. It's a custom Access db. It has 3 fields for the cash balance now, on a fixed date last year & on a fixed date the previous year.

These fields are set by an annual update which:
- migrates balance now -> last year -> previous year;
- adjusts balance now to reflect the new year's subscriptions.

Cheers,

Dave

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Cash balance for contact

This forum was archived on 2017-11-26.