<?php 
//include('includes/function_lib.php');
 $AccStatus=$s->GetFieldValue('crm_leads',"leadid='".$_REQUEST['leadid']."'",'Convert_IntoAccountStatus');
 $clientname1234=$s->GetFieldValue('crm_leads',"leadid='".$_REQUEST['leadid']."'",'company_name');
?>
<div>
<table border="0" width="60%">
<td><?php if(!empty($leadfile)) { ?>	
	<a href= "CRM/Doc/<?php  echo $leadfile;?>" target="_blank">
	<?php } else { ?> <a href="#"  title="No Attachments" ><?php } ?>
<input type="button" name="Create" value="View Attachment"  class="search" /></a>
</td>
<!--<?php if($AccStatus!='Y') {?>
<?php if(is_numeric($clientname1234)){ ?>
    <td>		<a href="index.php?route=CRM/ViewAccounts&leadid=<?php  echo $_REQUEST['leadid'].$rurl;?>"><input type="button" name="Create" value="Convert into Account" class="search" onclick="return confirm('Do You Want To Convert Into Account');" /></a>
</td>
<?php }else{ ?>
<td>
<input type="button" name="Create" value="Convert into Account" class="search" onclick="open_items()" />
</td>
<?php } ?>
<?php } ?>-->
     <td>		<a href="index.php?route=CRM/CrmLeadEvent&leadid=<?php  echo $_REQUEST['leadid'].$rurl;?>"><input type="button" name="Create" value="Add Event" class="search" /></a>
</td>
    <td>		<a href="index.php?route=CRM/CrmLeadTODO&leadid=<?php  echo $_REQUEST['leadid'].$rurl;?>"><input type="button" name="Create" value="Add to Do" class="search" /></a>
</td>
    <td>		<a href="index.php?route=CRM/AddLeadNote&leadid=<?php  echo $_REQUEST['leadid'].$rurl;?>"><input type="button" name="Create" value="Add Note" class="search" /></a>
</td>
 <td>
 <?php
 	$query="select leadid from crm_leads where created_by='".$_SESSION['UserID']."'";
	$getitem= DB_query($query, $db);
	$n1= DB_num_rows($getitem);
	$query1="select id from crm_lead_groups_users where parent_id='".$_REQUEST['leadid']."' and user_id='".$_SESSION['UserID']."'";
	$getitem1= DB_query($query1, $db);
	$n2= DB_num_rows($getitem1);
	if($n1>0 || $n2>0)
	{ ?>
	<a href="index.php?route=CRM/CrmFollowUp&leadid=<?php  echo $_REQUEST['leadid'].$rurl;?>"><input type="button" name="Create" value="Follow Up" class="search" /></a>
	<?php } else { ?>
	<input type="button" name="Create" value="Follow Up" title="No Permission" class="search" />
	<?php } ?>
 		
</td>

    <td><a href="CRMSendMail.php"><input type="button" name="sendmail" value="Send Email" class="search" /></a>
</td>
</table>
</div> 
