<?php 
require "../commonincludefiles.php";

if($_SESSION["cCompany_id"]!="" && isset($_SESSION["cCompany_id"]))
{	

	
	$objProductMgmt = new ProductMgmt();
	
	$limit=0;
	$start=0;
	$condition=" and `product_active` = 1 And company_id= '".$_SESSION["cCompany_id"]."'";
	$order_field="product_name";
	$order_type="ASC";
	
	$result = $objProductMgmt->getAllRecords(0,0,$condition,$order_field,$order_type) ;
	$total = dbRows($result);
	$i=0;
	$distictData = array("count" => $total, "rows" => array());
	if	(dbRows($result) > 0) 
		   {
				$temparray = array();
				while($row = dbArray($result)){
					
					$temparray["product_id"]  = $row["product_id"];
					$temparray["product_name"]   = $row["product_name"];
					$distictData["rows"][$i] = $temparray;   
				$i++;
			}										
	}				   		 
 	echo json_encode($distictData);	
}
?>