[ 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 17 /** function used to get the top 5 sales orders from Listview query 18 * @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 19 */ 20 function getTopSalesOrder() 21 { 22 require_once ("data/Tracker.php"); 23 require_once ('modules/SalesOrder/SalesOrder.php'); 24 require_once ('include/logging.php'); 25 require_once ('include/ListView/ListView.php'); 26 require_once ('include/database/PearDatabase.php'); 27 require_once ('include/ComboUtil.php'); 28 require_once ('include/utils/utils.php'); 29 require_once ('modules/CustomView/CustomView.php'); 30 31 global $current_language,$current_user,$list_max_entries_per_page,$theme,$adb; 32 $current_module_strings = return_module_language($current_language, 'SalesOrder'); 33 34 $log = LoggerManager::getLogger('so_list'); 35 36 $url_string = ''; 37 $sorder = ''; 38 $oCustomView = new CustomView("SalesOrder"); 39 $customviewcombo_html = $oCustomView->getCustomViewCombo(); 40 if(isset($_REQUEST['viewname']) == false || $_REQUEST['viewname']=='') 41 { 42 if($oCustomView->setdefaultviewid != "") 43 { 44 $viewid = $oCustomView->setdefaultviewid; 45 }else 46 { 47 $viewid = "0"; 48 } 49 } 50 $focus = new SalesOrder(); 51 52 $theme_path="themes/".$theme."/"; 53 $image_path=$theme_path."images/"; 54 55 //Retreive the list from Database 56 //<<<<<<<<<customview>>>>>>>>> 57 $date_var = date('Y-m-d'); 58 59 $where = ' and vtiger_crmentity.smownerid='.$current_user->id.' and vtiger_salesorder.duedate >= \''.$date_var.'\''; 60 $query = getListQuery("SalesOrder",$where); 61 $query .=" ORDER BY total DESC"; 62 //<<<<<<<<customview>>>>>>>>> 63 64 $list_result = $adb->limitQuery($query,0,5); 65 66 //Retreiving the no of rows 67 $noofrows = $adb->num_rows($list_result); 68 69 //Retreiving the start value from request 70 if(isset($_REQUEST['start']) && $_REQUEST['start'] != '') 71 { 72 $start = $_REQUEST['start']; 73 } 74 else 75 { 76 77 $start = 1; 78 } 79 80 //Retreive the Navigation array 81 $navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page); 82 83 if ($navigation_array['start'] == 1) 84 { 85 if($noofrows != 0) 86 $start_rec = $navigation_array['start']; 87 else 88 $start_rec = 0; 89 if($noofrows > $list_max_entries_per_page) 90 { 91 $end_rec = $navigation_array['start'] + $list_max_entries_per_page - 1; 92 } 93 else 94 { 95 $end_rec = $noofrows; 96 } 97 98 } 99 else 100 { 101 if($navigation_array['next'] > $list_max_entries_per_page) 102 { 103 $start_rec = $navigation_array['next'] - $list_max_entries_per_page; 104 $end_rec = $navigation_array['next'] - 1; 105 } 106 else 107 { 108 $start_rec = $navigation_array['prev'] + $list_max_entries_per_page; 109 $end_rec = $noofrows; 110 } 111 } 112 113 114 //Retreive the List View Table Header 115 $title=array('myTopSalesOrders.gif',$current_module_strings['LBL_MY_TOP_SO'],'home_mytopso'); 116 $listview_header = getListViewHeader($focus,"SalesOrder",$url_string,$sorder,$order_by,"HomePage",$oCustomView); 117 118 $listview_entries = getListViewEntries($focus,"SalesOrder",$list_result,$navigation_array,"HomePage","","EditView","Delete",$oCustomView); 119 $values=Array('Title'=>$title,'Header'=>$listview_header,'Entries'=>$listview_entries); 120 if ( ($display_empty_home_blocks && $noofrows == 0 ) || ($noofrows>0) ) 121 return $values; 122 } 123 ?>
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 |