<?php class Invoice
	{
	   
		public function Invoice()  
		{
		 
		}
		   function  GetExciseEffect( $efftype,$todate,$fromdate ,$branch_name)
		   { 
		    
					global $db;
					$sql= "SELECT sum(exciseValue) as EXV,sum(ECessValue) as ECV,sum(SAHCessValue) as SCV 
					 FROM `invoice`  where   Excise_Effect  ='".$efftype."' and invoiceDate>'".$fromdate."'
					  and invoiceDate<='".$todate."' and branch_name='".$branch_name."' group by Excise_Effect ";
 				 
				 	$sql_state=DB_query($sql,$db);		
					if(!$sql_state)
					{
					   die('Error.'.DB_error_msg($db));
					}
 					$row_Amount=DB_fetch_array($sql_state);
					return(array($row_Amount['EXV'],$row_Amount['ECV'],$row_Amount['SCV']));
					 
			}
			
			
		 function  Get_PO_ExciseEffect( $efftype,$todate,$fromdate ,$branch_name)
		   { 
		    
					global $db;
				 	$sql= "SELECT sum(excise_amt) as EXV,sum(ecess_amt) as ECV,sum(shecess_amt) as SCV 
				 	 FROM `purchase_billbook` inner join purchase_bill_details 
				 	 on purchase_bill_details.purch_billbookid=purchase_billbook.id  
				 	 where   Excise_Effect  ='".$efftype."' and bill_book_date>'".$fromdate."'
				 	  and bill_book_date<='".$todate."' and site ='".$branch_name."' group by Excise_Effect ";
 				 
				 	$sql_state=DB_query($sql,$db);		
					if(!$sql_state)
					{
					   die('Error.'.DB_error_msg($db));
					}
 					$row_Amount=DB_fetch_array($sql_state);
					return(array($row_Amount['EXV'],$row_Amount['ECV'],$row_Amount['SCV']));
					 
			}
			
			
			
			
//*********************************************************************************

 function  Get_Led_ExciseEffect( $efftype,$todate,$fromdate ,$Branch,$led      )
		   { 
		    
					global $db;
				   	$sql= "SELECT sum(amount) as EXV   FROM `account_book` A ,account_book_details B  where A.id=B.account_bookid  and B.amount_type  ='".$efftype."'  and A.Branch    ='".$Branch."'and B.ledgerid='".$led."'  group by B.ledgerid ";
 				 
				 	$sql_state=DB_query($sql,$db);		
					if(!$sql_state)
					{
					   die('Error.'.DB_error_msg($db));
					}
 					$row_Amount=DB_fetch_array($sql_state);
					return($row_Amount['EXV']);
					 
			}			
	
	}
	
	$ClassINV=new Invoice();
	?>
