<?php
require "../commonincludefiles.php";
error_reporting(1);
$condition = "";

if ($_POST["customerinvoice_id"] != "") {

	$objCustomerInvoiceTaxMgmt = new CustomerInvoiceTaxMgmt();

	$condition .= " AND customerinvoice_id =" . Escape($_POST["customerinvoice_id"]) . "";
	$result = $objCustomerInvoiceTaxMgmt->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) . '}';
	}
}
?>