<table width="100%" border="1" cellspacing="0" cellpadding="0">

   <tr class="row1">

   <td class="tabledata"><strong>SNo.</strong></td>

   <td class="tabledata"><strong>Area</strong></td>

   <td class="tabledata"><strong>Unit</strong></td> 

   <td class="tabledata"><strong>Company Name</strong></td> 

   <td class="tabledata"><strong>Sub Area</strong></td> 

   <td class="tabledata"><strong>Sub Area Code</strong></td> 

   <td class="tabledata"><strong>Status</strong></td>

   <td class="tabledata"><strong>Edit</strong></td>

   <td class="tabledata"><strong>Delete</strong></td>

   </tr>

   <?php 

      // LIMIT $startpoint,$perpage

  $GetRecord = "Select * from $table where CompanyId='".$_SESSION['ACGCompanyId']."' order by id";

   $ResultData = DB_query($GetRecord,$db);

   $i=1;

   if(DB_num_rows($ResultData)==0)

   echo "<td>--No Record--</td>";

   

   while($RowData = DB_fetch_array($ResultData))

   {

        $customer=$s->GetTotalRecordsTalbes('clientmaster',"subzone='".$RowData['id']."'");

		$enqiry=$s->GetTotalRecordsTalbes('dbl_enquiry_form',"subzone='".$RowData['id']."'");

		$salsorder=$s->GetTotalRecordsTalbes('dbl_process_sale_order',"subzone='".$RowData['id']."'");

		$dispatch=$s->GetTotalRecordsTalbes('dbl_dealer_dispatch',"subzone='".$RowData['id']."'");

		$Engineer=$s->GetTotalRecordsTalbes('dbl_engineer_dealer_maste',"subzone='".$RowData['id']."'");

		$DealerEngineer=$s->GetTotalRecordsTalbes('dbl_engineer_master',"subzone='".$RowData['id']."'");

		$associate=$s->GetTotalRecordsTalbes('dbl_dealer',"subarea_code='".$RowData['id']."'");

		

		if($enqiry<=0 && $salesorder<=0 && $dispatch<=0 && $customer<=0 && $Engineer<=0 && $DealerEngineer<=0 && $associate<=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['CompanyId'],'CompanyName'); ?></td>

	<td ><?php echo $RowData['subzone']; ?> </td>	

	<td ><?php echo $RowData['subzonecode']; ?> </td>	

	<td ><?php echo ($RowData['status']=='Y'?'Active':'Inactive'); ?> </td>	

	

	<td ><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></div></td>

	<td><div align="center">

	 <?php if($status==0) { ?>	

	<a href="<?php echo $targetpage?>&amp;action=Delete&amp;id=<?php echo $RowData['id']; ?>" 

	onclick="return confirm('This  Sub Area will be deleted. Are you sure?')">

	<img src="images/delete.Gif"  width="10" height="10"/></a>

	<?php } else { ?>

	<img src="images/delete.Gif"  width="10" height="10" onclick="abc()"/>

	

	<?php } ?>

	

	

	</div>  </td>

</tr>

<?php $i++;} ?> 

</table>



  