[ Index ]
 

Code source de vtiger CRM 5.0.2

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

title

Body

[fermer]

/modules/PurchaseOrder/ -> ListTopPurchaseOrder.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  
  17  /**    function used to get the top 5 purchase 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 getTopPurchaseOrder()
  21  {
  22      require_once ("data/Tracker.php");
  23      require_once ('modules/PurchaseOrder/PurchaseOrder.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, 'PurchaseOrder');
  33  
  34      $log = LoggerManager::getLogger('po_list');
  35  
  36      $url_string = '';
  37      $sorder = '';
  38      $oCustomView = new CustomView("PurchaseOrder");
  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 PurchaseOrder();
  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_purchaseorder.duedate >= \''.$date_var.'\'';
  60      $query = getListQuery("PurchaseOrder",$where);
  61      $query .=" ORDER BY total DESC";
  62  
  63      //<<<<<<<<customview>>>>>>>>>
  64  
  65      $list_result = $adb->limitQuery($query,0,5);
  66  
  67      //Retreiving the no of rows
  68      $noofrows = $adb->num_rows($list_result);
  69  
  70      //Retreiving the start value from request
  71      if(isset($_REQUEST['start']) && $_REQUEST['start'] != '')
  72      {
  73          $start = $_REQUEST['start'];
  74      }
  75      else
  76      {
  77  
  78          $start = 1;
  79      }
  80  
  81      //Retreive the Navigation array
  82      $navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
  83  
  84      if ($navigation_array['start'] == 1)
  85      {
  86          if($noofrows != 0)
  87              $start_rec = $navigation_array['start'];
  88          else
  89              $start_rec = 0;
  90          if($noofrows > $list_max_entries_per_page)
  91          {
  92              $end_rec = $navigation_array['start'] + $list_max_entries_per_page - 1;
  93          }
  94          else
  95          {
  96              $end_rec = $noofrows;
  97          }
  98  
  99      }
 100      else
 101      {
 102          if($navigation_array['next'] > $list_max_entries_per_page)
 103          {
 104              $start_rec = $navigation_array['next'] - $list_max_entries_per_page;
 105              $end_rec = $navigation_array['next'] - 1;
 106          }
 107          else
 108          {
 109              $start_rec = $navigation_array['prev'] + $list_max_entries_per_page;
 110              $end_rec = $noofrows;
 111          }
 112      }
 113  
 114  
 115      //Retreive the List View Table Header
 116      $title=array('myTopPurchaseOrders.gif',$current_module_strings['LBL_MY_TOP_PO'],'home_mytoppo');
 117      $listview_header = getListViewHeader($focus,"PurchaseOrder",$url_string,$sorder,$order_by,"HomePage",$oCustomView);
 118  
 119      $listview_entries = getListViewEntries($focus,"PurchaseOrder",$list_result,$navigation_array,"HomePage","","EditView","Delete",$oCustomView);
 120      $values=Array('Title'=>$title,'Header'=>$listview_header,'Entries'=>$listview_entries);
 121      if ( ($display_empty_home_blocks && $noofrows == 0 ) || ($noofrows>0) )    
 122          return $values;
 123  }
 124  ?>
 125  


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