Results 1 to 2 of 2

Thread: Filtering Opportunities by Probability on Forecast Module

  1. #1
    ianmaciel is offline Member
    Join Date
    Aug 2010
    Posts
    14

    Default Filtering Opportunities by Probability on Forecast Module

    Hey there,


    I'm trying to make a filter on Forecast modules:


    By default, Sugar show all opportunities open for the user, and calculate Probability * Value.


    Different from Sugar default our company want to sum only opportunities with more than 65% and use the real value.
    Trying to make it work, I found the file "/modules/Forecasts/ForecastOpportunities.php", and edited the code:


    I changed a couple parts of the code, changing code like this:
    //$query .= " opportunities.id, opportunities.name , amount_usdollar as revenue, ((amount_usdollar * probability)/100) as weighted_value, probability";

    to this:
    $query .= " opportunities.id, opportunities.name , amount_usdollar as revenue, amount_usdollar as weighted_value, probability";

    I also looked for the "where" entries, and ADD, here:
    $ret_array['where'] = " INNER JOIN timeperiods on 1=1 LEFT JOIN worksheet on opportunities.id = worksheet.related_id and worksheet.user_id='{$this->fo_user_id}' and worksheet.timeperiod_id='{$this->fo_timeperiod_id}' and worksheet.forecast_type='{$this->fo_forecast_type}' AND opportunities.probability >= 65";

    and here:
    $query1 .= " WHERE date_closed >= timeperiods.start_date";
    $query1 .= " AND opportunities.probability >= 65";



    The first custom worked fine: the sugar doesn't calculate the value automatically, it gets the full value of the opportunity.

    But the second one, is not work. The forecast page keep showing all the opportunities, including the ones which have less than 65% of probability.

    Does anybody know what I am doing wrong?

    Ian Maciel

  2. #2
    ianmaciel is offline Member
    Join Date
    Aug 2010
    Posts
    14

    Default Solved: Filtering Opportunities by Probability on Forecast Module

    Solved!

    including the customs above and these other changes below...
    If you are using SugarPRO 6.0.0 and want to do this, just change the original files for this file attached.


    I've changed this:
    $ret_array['where'] = " INNER JOIN timeperiods on 1=1 LEFT JOIN worksheet on opportunities.id = worksheet.related_id and worksheet.user_id='{$this->fo_user_id}' and worksheet.timeperiod_id='{$this->fo_timeperiod_id}' and worksheet.forecast_type='{$this->fo_forecast_type}' AND opportunities.probability >= 65";

    to:
    $ret_array['where'] = " INNER JOIN timeperiods on 1=1 LEFT JOIN worksheet on opportunities.id = worksheet.related_id and worksheet.user_id='{$this->fo_user_id}' and worksheet.timeperiod_id='{$this->fo_timeperiod_id}' and worksheet.forecast_type='{$this->fo_forecast_type}'";


    and than, changed:
    $ret_array['where'] .= ' WHERE '. $where;

    to:
    $ret_array['where'] .= ' WHERE '. $where .' AND opportunities.probability>=65';
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Forecast Module -- How To?
    By moonliver in forum Developer Help
    Replies: 4
    Last Post: 2009-05-13, 08:34 PM
  2. Repeating/Recurring deal opportunities, orders to forecast sales
    By daftpeach in forum General Discussion
    Replies: 0
    Last Post: 2009-01-08, 10:25 AM
  3. Opportunity Module appears to lack GP and Forecast over time features
    By margaret beach in forum Feature Requests
    Replies: 0
    Last Post: 2007-04-18, 04:53 AM
  4. Opportunities - filtering closed ones
    By kcjorge in forum Help
    Replies: 1
    Last Post: 2007-04-10, 08:52 PM
  5. Currency conversion problem in forecast module
    By oda in forum Developer Help
    Replies: 0
    Last Post: 2005-10-28, 08:01 AM

Tags for this Thread

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
  •