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 CiviReport (Moderator: Dave Greenberg) »
  • Complex Activity Report - revolving around 'duration'
Pages: [1]

Author Topic: Complex Activity Report - revolving around 'duration'  (Read 842 times)

haydo

  • I’m new here
  • *
  • Posts: 26
  • Karma: 0
Complex Activity Report - revolving around 'duration'
August 15, 2011, 10:02:06 pm
Hi all,

Trying to achieve something that maybe better served in the too hard basket and probably something no one has done before.  To cut a long story short, I'm attempting to make a report (pretty much just the activity report with a few mods) which outlines the total duration of all activities of a certain activity type for a 'source contact'. 

Many, many months ago I quite easily created a similar report heavily made off the activity report.  This report's purpose was to calculate the total duration of a certain activity type for a 'target contact'.  This worked great - all was needed was a few extra lines in the select() function and adding the duration field to the construct function along with a bit of grouping - pretty standard stuff.

Unfortunately it's not quite as easy to switch from the 'target contact' to the 'source contact' with this approach in regards to the duration calculation when it comes to activities which are shared with multiple contacts.  What happens is if you have a 3 hour activity shared between 3 different contacts.  It picks up 3 lots of 3 hours ... rather than just 3 hours so I end up with 6 extra hours which isn't ideal and makes the report irrelevant. 

Does anybody have any thoughts, suggestions or ideas on how to work around the above problem before I try and tackle this again tomorrow?

Cheers Hayden

matthewboh

  • I post occasionally
  • **
  • Posts: 89
  • Karma: 2
Re: Complex Activity Report - revolving around 'duration'
August 16, 2011, 09:22:35 am
I need this type of functionality as well - I can look into this sometime this weekend, but swamped the rest of the time.  If you succeed - please let me know!

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Complex Activity Report - revolving around 'duration'
August 16, 2011, 10:42:58 am
Are you doing this in CiviReport? Or are you writing custom code ?
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.

haydo

  • I’m new here
  • *
  • Posts: 26
  • Karma: 0
Re: Complex Activity Report - revolving around 'duration'
August 16, 2011, 01:19:21 pm
Matthew - Cool mate, we shall keep in touch with each other then with our progress.  Perhaps we should report back here, so other members can see it should they ever need something similar.  I'll be looking at it again soon and will post back today if I find a solution.

Hershel - I'm using CiviReport.  All i'm really doing is making a duplicate of the activity report template and modding it.  The activity report almost does everything I need minus the duration functionality i'm trying to achieve. 

matthewboh

  • I post occasionally
  • **
  • Posts: 89
  • Karma: 2
Re: Complex Activity Report - revolving around 'duration'
August 20, 2011, 10:47:18 am
Okay - I updated the ActivitySummary.php and Activity.php so that Duration is an option.  I'll attach the two here but change the file type to .php from .txt

First off, make a directory for the custom code - I used my-CiviCRMhome-directory/sites/all/civicrm_custom

You're also going to have to create some subdirectories as well - You'll need to create

my-CiviCRMhome-directory/sites/all/civicrm_custom/CRM/Report/Form and you'll copy these two file into that directory.

Then, I went into Administer | Configure | Global Settings | Directories and changed the Custom PHP Path Directory    to my-CiviCRMhome-directory/sites/all/civicrm_custom

However, I wanted to figure out how to get the field to align right instead of the default align left behavior.  I found where there's a test for the $header.type - but for the life of me, couldn't find out where or how it was set.  Instead I did the sledgehammer version and added the class to my-CiviCRMhome-directory/sites/all/modules/civicrm/css/civicrm.css like this
Code: [Select]
#crm-container td.crm-report-civicrm_activity_duration_sum {
    text-align: right;
}

If anyone can clue me in on how the alignment is set - would appreciate it.



haydo

  • I’m new here
  • *
  • Posts: 26
  • Karma: 0
Re: Complex Activity Report - revolving around 'duration'
August 21, 2011, 09:29:13 pm
Thanks for posting back Matthew.

I already had achieved what you had posted, i am basically trying to manipulate the total of the durations for source contact.  Going to leave it for now :).

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • Complex Activity Report - revolving around 'duration'

This forum was archived on 2017-11-26.