[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /*+*********************************************************************************** 3 * The contents of this file are subject to the vtiger CRM Public License Version 1.0 4 * ("License"); You may not use this file except in compliance with the License 5 * The Original Code is: vtiger CRM Open Source 6 * The Initial Developer of the Original Code is vtiger. 7 * Portions created by vtiger are Copyright (C) vtiger. 8 * All Rights Reserved. 9 *************************************************************************************/ 10 11 class Potentials_TotalRevenuePerSalesPerson_Dashboard extends Vtiger_IndexAjax_View { 12 13 function getSearchParams($assignedto,$dates) { 14 $listSearchParams = array(); 15 $conditions = array(array('assigned_user_id','e',$assignedto),array("sales_stage","e","Closed Won")); 16 if(!empty($dates)) { 17 array_push($conditions,array('createdtime','bw',$dates['start'].' 00:00:00,'.$dates['end'].' 23:59:59')); 18 } 19 $listSearchParams[] = $conditions; 20 return '&search_params='. json_encode($listSearchParams); 21 } 22 23 public function process(Vtiger_Request $request) { 24 $currentUser = Users_Record_Model::getCurrentUserModel(); 25 $viewer = $this->getViewer($request); 26 $moduleName = $request->getModule(); 27 28 $linkId = $request->get('linkid'); 29 30 $createdTime = $request->get('createdtime'); 31 //Date conversion from user to database format 32 if(!empty($createdTime)) { 33 $dates['start'] = Vtiger_Date_UIType::getDBInsertedValue($createdTime['start']); 34 $dates['end'] = Vtiger_Date_UIType::getDBInsertedValue($createdTime['end']); 35 } 36 37 38 $moduleModel = Vtiger_Module_Model::getInstance($moduleName); 39 $data = $moduleModel->getTotalRevenuePerSalesPerson($dates); 40 $listViewUrl = $moduleModel->getListViewUrl(); 41 for($i = 0;$i<count($data);$i++){ 42 $data[$i]["links"] = $listViewUrl.$this->getSearchParams($data[$i]["last_name"],$dates); 43 } 44 45 $widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId()); 46 47 $viewer->assign('WIDGET', $widget); 48 $viewer->assign('MODULE_NAME', $moduleName); 49 $viewer->assign('DATA', $data); 50 51 //Include special script and css needed for this widget 52 $viewer->assign('STYLES',$this->getHeaderCss($request)); 53 $viewer->assign('CURRENTUSER', $currentUser); 54 55 $content = $request->get('content'); 56 if(!empty($content)) { 57 $viewer->view('dashboards/DashBoardWidgetContents.tpl', $moduleName); 58 } else { 59 $viewer->view('dashboards/TotalRevenuePerSalesPerson.tpl', $moduleName); 60 } 61 } 62 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |