<?php $PageSecurity = 11;
include('includes/session.inc');
include('includes/function_lib.php');
include('includes/SQL_CommonFunctions.inc');
//echo  $s->getField('voucher_master','VoucherType',$_GET['Prefix'],'VPrefix');
 // echo "select count(id) from account_book where Vprefix=".$_GET['Prefix']." group by Vprefix ";
 global $db;
 //$voucher_id=DB_query("select count(id) as ID from account_book where Vprefix='".$_GET['Prefix']."'  group by Vprefix ",$db);
 
 $voucher_id=DB_query("select Voucher_NO as ID from account_book where Vprefix='".$_REQUEST['Prefix']."' and Branch='".$_REQUEST['q']."'  order by id desc limit 0,1",$db);
 if(DB_num_rows($voucher_id)>0){
 $rowCate =DB_fetch_array($voucher_id);
 $brk=substr($rowCate['ID'],-5);
 $l=$brk+1;
 }
 else{$l='01';}
  $location=$s->getField('locations','loccode', $_REQUEST['q'],'prefix');
 $location1=$s->getField('voucher_master','VoucherType',$_GET['Prefix'],'VPrefix');
  $voucher_no=$location.'-'.$location1.'-'.'000'.$l;

  ?>
<input name="voucher_no" type="text" size="27"  value="<?php echo $voucher_no;?>" style="width:98%;"  readonly='true'/>