Results 1 to 3 of 3

Thread: Displaying totals from Project in Contact Detail View

  1. #1
    manish.joshi is offline Sugar Community Member
    Join Date
    Mar 2007
    Posts
    33

    Default Displaying totals from Project in Contact Detail View

    Linux 2.6.19.2-grsec-sg5
    Sugar OpenSource Version 4.5.1e (Build 1049)
    MySQL Server version: 5.0.27-standard-log
    Apache 1.3.37 (Unix)
    PHP 5.0.5

    Dear team,

    I have a requirement where for every contact, in contact detail view:
    1. I need to display the sum of 'Total Actual Effort (hrs)' for all the projects he is linked to.
    2. I need to display the sum of a numeric custom field in Projects for all the projects he is linked to.


    Please let me know if:
    1. the right kind of relationship exists between Contact and Project, and Project Custom fields table to achieve both 1 & 2
    2. If its achievable please give an insight into the approach to be taken to achieve 1 & 2
    3. Would both 1 & 2 be possible with ZuckerReports as well?


    Thanks in advance
    Manish
    ________
    Zoloft lawsuit settlements
    Last edited by manish.joshi; 2011-04-30 at 11:12 PM.

  2. #2
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Displaying totals from Project in Contact Detail View

    Hi, Manish

    The Total Actual Effort" fields of Project is a calculated field based on its ProjectTasks, then it can't be defined only into vardefs field. You must:

    Option 1: Create a sql joinning Contacts, Project and ProjectTasks to calculate the total effort of Project
    Option 2: Modify the retrieve function into Contact.php to fill into a field the value of total effort and the custom field from project

    If you don't worry about modifying the Contact.php bean then:

    PHP Code:
    require_once('modules/Project/Project.php');
    $project = new Project();
    $this->load_relationship('project');
    $project_ids $this->project->get();
    foreach(
    $project_ids as $project_id) {
        
    $project->retrieve($project_id);
        
    $this->total_actual_effort+= $project->total_actual_effort;

    Doing a sql query could be faster to retrieve informations.

    Cheers.

    André Lopes
    Lâmpada Global Services
    Av. Angelica, 1814 cj. 1502
    São Paulo, SP 01228-200
    tel1. 55 11 3668-6776
    tel2. 55 11 3822-2581
    cel. 55 11 7636-5859
    messenger: andopes@yahoo.com.br
    skype: andopes
    e-mail: andre@lampadacrm.com.br

  3. #3
    manish.joshi is offline Sugar Community Member
    Join Date
    Mar 2007
    Posts
    33

    Default Re: Displaying totals from Project in Contact Detail View

    Dear Andre',

    Thankyou very much. This is very helpful.

    Regards,
    Manish
    ________
    Lovely Wendie
    Last edited by manish.joshi; 2011-04-30 at 11:13 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 2007-02-20, 09:50 PM
  2. Replies: 2
    Last Post: 2006-08-18, 07:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •