<?php class AccountBook
	{
	   
		public function AccountBook()  
		{
		 
		}
		   function  GetAccountBookAmount($VPrefix,$amount_type,$date )
		   { 
		    
					global $db;
					echo "SELECT id  ,sum(B.amount) as Amount  FROM `account_book` A, account_book_details B where  A.VPrefix  ='".$VPrefix."' and A.Dates='".$Dates."' and A.id=B.account_bookid  and B.amount_type ='".$amount_type."' group by B.ledgerid ";
					
					$sql_state=DB_query("SELECT id  ,sum(B.amount) as Amount  FROM `account_book` A, account_book_details B where  A.VPrefix  ='".$VPrefix."' and A.Dates='".$Dates."' and A.id=B.account_bookid  and B.amount_type ='".$amount_type."' group by B.ledgerid ",$db);		
					if(!$sql_state)
					{
					   die('Error.'.DB_error_msg($db));
					}
 					 $row_BookAmount=DB_fetch_array($sql_state);
					 return($row_BookAmount['Amount']);
					 
			}
	
	}
	
	$ClassAccountBook=new AccountBook();
	?>
