[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
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: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Potentials/ListViewTop.php,v 1.18 2005/04/20 20:24:30 ray Exp $ 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 Potentials 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 getTopPotentials() 27 { 28 $log = LoggerManager::getLogger('top opportunity_list'); 29 $log->debug("Entering getTopPotentials() 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 35 global $app_strings; 36 global $adb; 37 global $current_language; 38 global $current_user; 39 $current_module_strings = return_module_language($current_language, "Potentials"); 40 41 $title=array(); 42 $title[]='myTopOpenPotentials.gif'; 43 $title[]=$current_module_strings['LBL_TOP_OPPORTUNITIES']; 44 $title[]='home_mypot'; 45 $where = "AND vtiger_potential.sales_stage <> 'Closed Won' AND vtiger_potential.sales_stage <> 'Closed Lost' AND vtiger_crmentity.smownerid='".$current_user->id."'"; 46 $header=array(); 47 $header[]=$current_module_strings['LBL_LIST_OPPORTUNITY_NAME']; 48 $header[]=$current_module_strings['LBL_LIST_ACCOUNT_NAME']; 49 $currencyid=fetchCurrency($current_user->id); 50 $rate_symbol = getCurrencySymbolandCRate($currencyid); 51 $rate = $rate_symbol['rate']; 52 $curr_symbol = $rate_symbol['symbol']; 53 $header[]=$current_module_strings['LBL_LIST_AMOUNT'].'('.$curr_symbol.')'; 54 $header[]=$current_module_strings['LBL_LIST_DATE_CLOSED']; 55 $list_query = getListQuery("Potentials",$where); 56 $list_query .=" ORDER BY amount DESC"; 57 $list_result = $adb->limitQuery($list_query,0,5); 58 $open_potentials_list = array(); 59 $noofrows = $adb->num_rows($list_result); 60 $entries=array(); 61 if (count($list_result)>0) 62 for($i=0;$i<$noofrows;$i++) 63 { 64 $open_potentials_list[] = Array('name' => $adb->query_result($list_result,$i,'potentialname'), 65 'id' => $adb->query_result($list_result,$i,'potentialid'), 66 'accountid' => $adb->query_result($list_result,$i,'accountid'), 67 'accountname' => $adb->query_result($list_result,$i,'accountname'), 68 'amount' => $adb->query_result($list_result,$i,'amount'), 69 'closingdate' => getDisplayDate($adb->query_result($list_result,$i,'closingdate')), 70 ); 71 $potentialid=$adb->query_result($list_result,$i,'potentialid'); 72 $value=array(); 73 $value[]='<a href="index.php?action=DetailView&module=Potentials&record='.$adb->query_result($list_result,$i,"potentialid").'">'.$adb->query_result($list_result,$i,"potentialname").'</a>'; 74 $value[]='<a href="index.php?action=DetailView&module=Accounts&record='.$adb->query_result($list_result,$i,'accountid').'">'.$adb->query_result($list_result,$i,"accountname").'</a>'; 75 $value[]=convertFromDollar($adb->query_result($list_result,$i,'amount'),$rate); 76 $value[]=getDisplayDate($adb->query_result($list_result,$i,'closingdate')); 77 $entries[$potentialid]=$value; 78 } 79 $values=Array('Title'=>$title,'Header'=>$header,'Entries'=>$entries); 80 81 if ( ($display_empty_home_blocks && count($open_potentials_list) == 0 ) || (count($open_potentials_list)>0) ) 82 { 83 $log->debug("Exiting getTopPotentials method ..."); 84 return $values; 85 } 86 } 87 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |