$list_max_entries_per_page) { $end = $start + $starttoendvaluecounter; if($end > $noofrows) { $end = $noofrows; } $startvalue = 1; $remainder = $noofrows % $list_max_entries_per_page; if($remainder > 0) { $endval = $noofrows - $remainder + 1; } elseif($remainder == 0) { $endval = $noofrows - $starttoendvaluecounter; } } else { $end = $noofrows; } //Setting the next and previous value if(isset($_REQUEST['start']) && $_REQUEST['start'] != '') { $tempnextstartvalue = $_REQUEST['start'] + $list_max_entries_per_page; if($tempnextstartvalue <= $noofrows) { $nextstartvalue = $tempnextstartvalue; } $tempprevvalue = $_REQUEST['start'] - $list_max_entries_per_page; if($tempprevvalue > 0) { $prevstartvalue = $tempprevvalue; } } else { if($noofrows > $list_max_entries_per_page) { $nextstartvalue = $list_max_entries_per_page + 1; } } */ //$search_query="select troubletickets.ticketid,contact_id,priority,troubletickets.status,category,troubletickets.title,troubletickets.description,update_log,version_id,crmentity.createdtime,crmentity.modifiedtime, contactdetails.firstname,contactdetails.lastname,users.user_name from troubletickets inner join users on users.id=crmentity.smownerid left join contactdetails on troubletickets.contact_id=contactdetails.contactid left join seticketsrel on seticketsrel.ticketid=troubletickets.ticketid inner join crmentity on crmentity.crmid=troubletickets.ticketid and crmentity.smownerid=".$current_user->id." and crmentity.deleted=0"; $search_query="select troubletickets.ticketid,parent_id,priority,troubletickets.status,category,troubletickets.title,troubletickets.description,update_log,version_id,crmentity.createdtime,crmentity.modifiedtime, contactdetails.firstname,contactdetails.lastname, account.accountid, account.accountname, users.user_name from troubletickets inner join crmentity on crmentity.crmid= troubletickets.ticketid inner join users on users.id=crmentity.smownerid left join contactdetails on troubletickets.parent_id=contactdetails.contactid left join account on account.accountid=troubletickets.parent_id left join seticketsrel on seticketsrel.ticketid=troubletickets.ticketid where crmentity.smownerid=".$current_user->id." and crmentity.deleted=0 and troubletickets.status <> 'Closed' ORDER BY createdtime DESC"; $resultcount = $adb->num_rows($adb->query($search_query)); $tktresult = $adb->limitquery($search_query,0,5); $ticketListheader = get_form_header($current_module_strings['LBL_MY_TICKETS'], "", false ); echo "
"; $list.=$ticketListheader; $list.=''; //$list.=''; //$list.=''; //$list.=''; $list.=' '; $list.=''; $list.=''; $list.=''; $list.=''; $list.=''; $list.=''; $list.=''; $list.=''; $list.=''; $list.=''; $list.=''; $list.=''; $list.=''; $list.=''; for ($i=0; $i<$adb->num_rows($tktresult); $i++) { if (($i%2)==0) $list .= ''; else $list .= ''; $list .= ''; $ticketid = $adb->query_result($tktresult,$i,"ticketid"); $list .= ''; $list .= ''; $subject = ''.$adb->query_result($tktresult,$i,"title").''; $list .= ''; $list .= ''; $parent_id = $adb->query_result($tktresult,$i,"parent_id"); $parent_name = ''; if($parent_id != '' && $parent_id != NULL) { $parent_name = getParentLink($parent_id); } $list .= ''; $list .= ''; $list .= ''; $list .= ''; $list .= ''; $list .= ''; $list .= ''; $list .= ''; $list .= ''; } if($resultcount > 5) $list .= ''; $list.='
'.$current_module_strings['LBL_TICKET_ID'].''.$current_module_strings['LBL_SUBJECT'].''.$current_module_strings['Related To'].''.$current_module_strings['LBL_STATUS'].''.$current_module_strings['LBL_CREATED_DATE'].''.$current_module_strings['LBL_ASSIGNED_TO'].'
'.$ticketid.''.$subject.''.$parent_name.''.$adb->query_result($tktresult,$i,"status").''.getDisplayDate($adb->query_result($tktresult,$i,"createdtime")).''.$adb->query_result($tktresult,$i,"user_name").'
 '.$current_module_strings['LBL_MORE'].'...  
'; echo $list; function getParentLink($parent_id) { global $adb; $sql = "select setype from crmentity where crmid=".$parent_id; $parent_module = $adb->query_result($adb->query($sql),0,'setype'); if($parent_module == 'Contacts') { $sql = "select firstname,lastname from contactdetails where contactid=".$parent_id; $parentname = $adb->query_result($adb->query($sql),0,'firstname'); $parentname .= ' '.$adb->query_result($adb->query($sql),0,'lastname'); $parent_name = ''.$parentname.''; } if($parent_module == 'Accounts') { $sql = "select accountname from account where accountid=".$parent_id; $parentname = $adb->query_result($adb->query($sql),0,'accountname'); $parent_name = ''.$parentname.''; } return $parent_name; } ?>