[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/modules/Accounts/ -> ListViewTop.php (source)

   1  <?php
   2  /*********************************************************************************
   3   * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
   4   * ("License"); You may not use this file except in compliance with the 
   5   * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
   6   * Software distributed under the License is distributed on an  "AS IS"  basis,
   7   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
   8   * the specific language governing rights and limitations under the License.
   9   * The Original Code is:  SugarCRM Open Source
  10   * The Initial Developer of the Original Code is SugarCRM, Inc.
  11   * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
  12   * All Rights Reserved.
  13   * Contributor(s): ______________________________________.
  14   ********************************************************************************/
  15  /*********************************************************************************
  16   * $Header$
  17   * Description:  TODO: To be written.
  18   * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
  19   * All Rights Reserved.
  20   * Contributor(s): ______________________________________..
  21   ********************************************************************************/
  22  
  23  /**Function to get the top 5 Accounts order by Amount in Descending Order
  24   *return array $values - array with the title, header and entries like  Array('Title'=>$title,'Header'=>$listview_header,'Entries'=>$listview_entries) where as listview_header and listview_entries are arrays of header and entity values which are returned from function getListViewHeader and getListViewEntries
  25  */
  26  function getTopAccounts()
  27  {
  28      $log = LoggerManager::getLogger('top accounts_list');
  29      $log->debug("Entering getTopAccounts() method ...");
  30      require_once ("data/Tracker.php");
  31      require_once ('modules/Potentials/Potentials.php');
  32      require_once ('include/logging.php');
  33      require_once ('include/ListView/ListView.php');
  34      global $app_strings;
  35      global $adb;
  36      global $current_language;
  37      global $current_user;
  38      $current_module_strings = return_module_language($current_language, "Accounts");
  39  
  40      $list_query = "select vtiger_account.accountid, vtiger_account.accountname, vtiger_account.tickersymbol, sum(vtiger_potential.amount) as amount from vtiger_potential inner join vtiger_crmentity on (vtiger_potential.potentialid=vtiger_crmentity.crmid) inner join vtiger_account on (vtiger_potential.accountid=vtiger_account.accountid) where vtiger_crmentity.deleted=0 AND vtiger_crmentity.smownerid='".$current_user->id."' and vtiger_potential.sales_stage <> '".$app_strings['LBL_CLOSE_WON']."' and vtiger_potential.sales_stage <> '".$app_strings['LBL_CLOSE_LOST']."' group by vtiger_account.accountid, vtiger_account.accountname, vtiger_account.tickersymbol order by amount desc;";
  41      $list_result=$adb->query($list_query);
  42      $open_accounts_list = array();
  43      $noofrows = min($adb->num_rows($list_result),5);
  44      if (count($list_result)>0)
  45          for($i=0;$i<$noofrows;$i++) 
  46          {
  47              $open_accounts_list[] = Array('accountid' => $adb->query_result($list_result,$i,'accountid'),
  48                      'accountname' => $adb->query_result($list_result,$i,'accountname'),
  49                      'amount' => $adb->query_result($list_result,$i,'amount'),
  50                      'tickersymbol' => $adb->query_result($list_result,$i,'tickersymbol'),
  51                      );                                 
  52          }
  53  
  54      $title=array();
  55      $title[]='myTopAccounts.gif';
  56      $title[]=$current_module_strings['LBL_TOP_ACCOUNTS'];
  57      $title[]='home_myaccount';
  58      
  59      $header=array();
  60      $header[]=$current_module_strings['LBL_LIST_ACCOUNT_NAME'];
  61      $currencyid=fetchCurrency($current_user->id);
  62      $rate_symbol = getCurrencySymbolandCRate($currencyid);
  63      $rate = $rate_symbol['rate'];
  64      $curr_symbol = $rate_symbol['symbol'];
  65          $header[]=$current_module_strings['LBL_LIST_AMOUNT'].'('.$curr_symbol.')';
  66      
  67      $entries=array();
  68      foreach($open_accounts_list as $account)
  69      {
  70          $value=array();
  71          $account_fields = array(
  72                  'ACCOUNT_ID' => $account['accountid'],
  73                  'ACCOUNT_NAME' => $account['accountname'],
  74                  'AMOUNT' => ($account['amount']),
  75                  );
  76  
  77          $value[]='<a href="index.php?action=DetailView&module=Accounts&record='.$account['accountid'].'">'.$account['accountname'].'</a>';
  78          $value[]=convertFromDollar($account['amount'],$rate);
  79          $entries[$account['accountid']]=$value;    
  80      }
  81      $values=Array('Title'=>$title,'Header'=>$header,'Entries'=>$entries);
  82      $log->debug("Exiting getTopAccounts method ...");
  83      if (($display_empty_home_blocks && count($entries) == 0 ) || (count($entries)>0))
  84          return $values;
  85  }
  86  ?>


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7