<?php
	require "../commonincludefiles.php";
	$condition="";
	
	$invoice_id= Escape($_POST['invoice_id']);
	if($invoice_id !="") {
		
		$objInvoiceTaxMgmt = new InvoiceTaxMgmt();  
		
			$condition .= " AND invoice_id =".$invoice_id."";
			$result = $objInvoiceTaxMgmt->getAllRecords(0,0,$condition,$order_field,$order_type) ;
		
		
		$num = dbRows($result);
		$i = 0;   
		if(dbRows($result) > 0){
			$temparray = array();
			while($row = dbArray($result)){
				
				$temparray["taxid"]  		  = "Tax";
				$temparray["it"]  		  = $i;
				$temparray["tax_name"]  		  = $row["tax_id"];
				$temparray["tax_percentage"]   	  = $row["tax_percentage"];
				
				$taxgriddata[$i] = $temparray;   
				$i++;
			}		
			echo '{"total":"'.$num.'","taxgriddata":'.json_encode($taxgriddata).'}';				
		} 
	}
?>
