
 <table width="100%" border="0">
  <tr>
    <td valign="top"> 
   <div id='chart_div'></div>
 <?php
 include_once 'piechart.class.php';
$pc = new Piechart();
global $db;
$details = Array ();
$strQuery = "select count(leadid) as TotOutput , COUNT( * )/  ( SELECT COUNT( * ) FROM crm_leads where  deleted_status='N' and lead_Stage ='Pending'  ) AS percentage  from crm_leads where deleted_status='N'";
$result =DB_query($strQuery,$db);
$ors =DB_fetch_array($result);
$tmp['label'] =round($ors['percentage'],2).'% Pending';
$tmp['count'] = $ors['TotOutput'];
$details[] = $tmp;

 
$strQuery2 = "select count(leadid) as TotOutput , COUNT( * )/  ( SELECT COUNT( * ) FROM crm_leads where  deleted_status='N' and lead_Stage ='Confirm'  ) AS percentage  from crm_leads where deleted_status='N'";
$result2 = DB_query($strQuery2,$db)  ;
$ors = DB_fetch_array($result2);
$tmp['label'] =round($ors['percentage'],2).'% Confirm';
$tmp['count'] = $ors['TotOutput'];
$details[] = $tmp;



$strQuery2 = "select count(leadid) as TotOutput , COUNT( * )/  ( SELECT COUNT( * ) FROM crm_leads where  deleted_status='N' and lead_Priority ='Low'  ) AS percentage  from crm_leads where deleted_status='N'";
$result2 = DB_query($strQuery2,$db)  ;
$ors = DB_fetch_array($result2);
$tmp['label'] =round($ors['percentage'],2).'% Low Priority';
$tmp['count'] = $ors['TotOutput'];
$details[] = $tmp;

$strQuery2 = "select count(leadid) as TotOutput , COUNT( * )/  ( SELECT COUNT( * ) FROM crm_leads where  deleted_status='N' and lead_Priority ='High'  ) AS percentage  from crm_leads where deleted_status='N'";
$result2 = DB_query($strQuery2,$db)  ;
$ors = DB_fetch_array($result2);
$tmp['label'] =round($ors['percentage'],2).'% High Priority';
$tmp['count'] = $ors['TotOutput'];
$details[] = $tmp;

$strQuery2 = "select count(leadid) as TotOutput , COUNT( * )/  ( SELECT COUNT( * ) FROM crm_leads where  deleted_status='N' and lead_Priority ='Highest'  ) AS percentage  from crm_leads where deleted_status='N'";
$result2 = DB_query($strQuery2,$db)  ;
$ors = DB_fetch_array($result2);
$tmp['label'] =round($ors['percentage'],2).'%  Highest Priority';
$tmp['count'] = $ors['TotOutput'];
$details[] = $tmp;
	
$pc->draw_chart($details, '', 'right');
?> </td>
    <td valign="top" align="left"> 

		    <p style="padding-top:5px; padding-bottom:5px; font-weight:bold; background-color:#999999; color:#000000; margin:0px;">To Do Activity</p>
	    <table width="100%" border="0">
  <tr>
    <th><strong>To Do </strong></th>
    <th><strong>Related To </strong></th>
    <th><strong>Due Date </strong></th>
    <th><strong>Status</strong></th>
  </tr>
 <?php $i=0;
$curdate=date('Y-m-d');
 	$getlead_event=DB_query("select * from crm_leadtodo where groupid='".$_SESSION['ACGRoleId']."' and lead_type='Visit' and tododatetime>='$curdate' and todostatus!='Confirm'",$db);
while($rows=DB_fetch_array($getlead_event))
{
?>  <tr><td><?php echo ++$i; ?></td>
   <td>
   <a href="#" onclick="alertfun();"><?php echo $rows['lead_priority'];?></a></td>
	<td><?php echo $rows['tododatetime'];?></td>
	<td><?php echo $rows['todostart_time'];?></td>
	
		<td><?php echo $rows['todostatus'];?></td>
     <td><?php echo $rows['notification_matter'];?></td>
   </tr>
  
  <?php } ?>  

</table>

 </td>
  </tr>
</table>

	


<!-- right div close -->
