<?
	include "inc/functions.php";
	
	
	$res	=	mysql_query("select * from invoices order by id desc")or die(mysql_error());
	$info	=	mysql_fetch_array($res);
	
	if(!$cfg['invoice_no']){
		mysql_query("insert into config(name,value) values('invoice_no','".($info['id']+1)."')")or die(mysql_error());
		mysql_query("ALTER TABLE `invoices` ADD `invoice_no` INT( 11 ) NOT NULL AFTER `id` , ADD `invoice_date` INT( 11 ) NOT NULL AFTER `invoice_no` ;")or die(mysql_error());
	}
?>