<?php
session_name('CAKEPHP'); session_start();
$PageSecurity = 11;
//echo $_SERVER['QUERY_STRING'];exit;
include('includes/SQL_CommonFunctions.inc');
include('includes/function_lib.php');
include('includes/Class_www_users.php');
include('includes/Class_Emp.php');
include('includes/session.inc');
$q=$_GET['company'];
	 
	

$area_code=$s->getField('dbl_dealer','id',$_REQUEST['country'],'area_code');
$assing_branch1=explode(",",$s->getField('dbl_dealer','id',$_REQUEST['country'],'merge_excise_sites'));
$assing_branch2=explode(",",$s->getField('dbl_dealer','id',$_REQUEST['country'],'merge_nonexcise_sites'));
$a1=array_merge($assing_branch1,$assing_branch2);
$a2=array_unique($a1);
$assign_sites3=implode("','",$a2);
  ?>
  
  <table border="0" width="100%">
		<tr>
		<th width="50%"><strong>Dealer Branch</strong></th>
		<td width="50%" colspan="2">
		<div style="overflow:auto; height:150px; width:100%; border:1px solid; background-color:#FFFFFF"  >
	    <?php 
		
		?>
  		<?php $c3=0;
	      $query=DB_query("select * from locations where mst_companyid='".$q."' and loccode in('".$assign_sites3."')",$db);
		  while($row=DB_Fetch_array($query))
		  {
 		 ?>
		 <input type="checkbox" name="mst_site[<?php echo $c3;?>]" id="mst_site_<?php echo $c3;?>" value="<?php echo $row['loccode'];?>" 
	  /><!--ShowDiv(this.value,'hid-zone-div','ZonePrefix.php?type=Companyusers')-->
	<?php echo $row['loccode']." - ".$row['locationname'];?><br />

	 
		<?php
		$c3++; } ?>
		<input type="hidden" name="" id="cnt" value="<?php echo $c3;?>" />
	

  	

	</div>
		
		
		
	   </td></tr>
		
		
		
		<tr>
		<th width="50%"><strong>Area</strong></th>
		<td width="50%" colspan="2"> 
		<div style="overflow:auto; height:150px; width:100%; border:1px solid; background-color:#FFFFFF" >
 	<?php  
	  $query=DB_query("select * from zone_master where id='".$area_code."' and  status='Y'",$db);
 	 ?>
	
  <?php 
 
		  while($row=DB_fetch_array($query))
		  {
		  	
				if($sites!='0')
				{
						$c='';
						for($s=0;$s<count($sites);$s++)
						{
							if($sites[$s]==$row['id'])
							$c="checked";
						}
				}
	?>
	 
	<?php 
?>
 		 <input type="checkbox" name="assigned_sites[]" id="assigned_sites_<?php echo $c3;?>" <?php echo $c;?> value="<?php echo $row['id'];?>" 
	   />
	<?php echo $row['ZoneTitle'];?><br />

 <?php  $c3++; $j++;} ?>

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