<?php
$PageSecurity = 11;
//echo $_SERVER['QUERY_STRING'];exit;
//print_r($_GET['itemcode']);
include('includes/session.inc');
include('includes/function_lib.php');
if(isset($_GET['q']))
{ 
	   $type=$_GET['q'];
	$idx=explode(' ',$type);
	$idata=$idx[0];
	for($i=0;$i<count($idx[0]);$i++)
	{
	     $prefix_type[$i]=substr($idx[$i], 0, 3);
	}	 
	 $prefix_type1=implode("-",$prefix_type);
	
//echo 	 $prefix_type=	 $s->GetFieldValue('stockcategory',"id='".$type."'" ,'item_prefix');
     $SQLMax=DB_query("select * from zone_master order by id desc ",$db);
	 if(DB_num_rows($SQLMax)>0)
	 {
	 $MaxQut=DB_fetch_array($SQLMax);
	 $MXNo=substr($MaxQut['zonecode'],-2);
	 $FinMx=$MXNo+1;
 	 $final_string= str_pad($FinMx,4,"0",STR_PAD_LEFT);
	  }
	  else
	  {
	  $final_string='0001';
	  }
	  
	  
  $vendor_code=$prefix_type1.'-'.$final_string;	  
}
?>
<input type="text" name="zonecode" class="cap" value="<?php echo $vendor_code;?>" size="30">