<table width="100%" border="1" cellspacing="0" cellpadding="0">
   <tr class="row1">
   <td class="tabledata">SNo.</td>
   <td class="tabledata">Area Title</td>
   <td class="tabledata">Branch</td> 
   <td class="tabledata">Company Name</td> 
   <td class="tabledata">Sub Area </td> 
   <td class="tabledata">Engineer Code</td>
   <td class="tabledata">Engineer Name</td>
   <td colspan="2" class="tabledata">Action</td>
   </tr>
<?php // LIMIT $startpoint,$perpage
$GetRecord = "Select * from dbl_engineer_dealer_maste ORDER BY ID";
$ResultData = DB_query($GetRecord,$db);
$i=1;
 $num=DB_num_rows($ResultData);
if($num==0)
echo "<td>--No Record--</td>";
while($RowData = DB_fetch_array($ResultData))
{

$complaint=$s->GetTotalRecordsTalbes('clientmaster',"ENGINEER='".$RowData['ID']."'");
		
		if($complaint<=0)
		{
		$status=0;
		}
		else
		{
		$status=1;
		}



?>
<tr class="row1"> <td ><div align="center"><?php echo $i; ?></div></td>
	<td><?php echo $s->getField('zone_master','ID',$RowData['zone'],'zonetitle');  ?>	  </td>
	<td><?php  if($RowData['Site']=='0')
	{
	echo 'All';
	}
	else
	{
	echo   $Sitename= $s->getField('locations','loccode',$RowData['Site'],'locationname');
	}
	?></td>
	<td >  <?php 	echo   $Companyname= $s->getField('companies','companyid',$RowData['company'],'companyname'); ?></td>
	<td><?php echo $s->getField('subzone_master','id',$RowData['subzone'],'subzone'); ?> </td>	
	<td ><?php echo $RowData['engineer_code']; ?> </td>	
	<td ><?php echo $RowData['engineer_name']; ?> </td>	
	
	<td width="6%" ><div align="center"><a href="<?php echo $targetpage?>&amp;action=Edit&amp;id=<?php echo $RowData['id']; ?>"><img src="images/icon-edit.png"  width="10" height="10" /></a>&nbsp;&nbsp;
	<?php if($status==0) { ?>	
	<a href="<?php echo $targetpage?>&amp;action=Delete&amp;id=<?php echo $RowData['ID']; ?>" onclick="return confirm('This Associate Engineer  will be deleted. Are you sure?')"><img src="images/delete1.gif"  width="10" height="10" /></a>
<?php } else { ?>
<img src="images/delete1.gif"  width="10" height="10" onclick="abc()"/>
<?php } ?>
	</div>  </td>
</tr>
<?php $i++;}?> 
   </table>
   <script>
function abc()
{
window.alert("Associate Dealer Engineer Used You Can Not Delete");
}
</script>