<?php
	require "../commonincludefiles.php";
   $objlms_customerbillMgmt= new lms_customerbillMgmt();
	$i=0;
	$order_field=" invoice_id";
	$order_type=" ASC ";
	$where = " ";
	
	$invoice_no		= Escape($_REQUEST['invoice_no']);
	if($invoice_no != "")
	{
		$where .= " and invoice_no = ".$invoice_no;

	}
	
	$rs = $objlms_customerbillMgmt->getAllRecords($limit,$start,$where,$order_field,$order_type);
	$total = dbRows($rs);
	$CustomerbillData = array("count" => $total, "data" => array());
	if(dbRows($rs) > 0){
		while($row = dbArray($rs)){
			
			$temparray["invoice_id"]  	= $row["invoice_id"];
			
			$temparray["product_name"]  			= $row["product_name"];
			$temparray["qty"]  			= $row["qty"];
			/*$temparray["measurement_id"]  			= $row["measurement_id"];*/
			$temparray["rate"]  		= $row["rate"];
			$temparray["vat"]  		= $row["vat"];
    		$temparray["discount"]  		= $row["discount"];
			
			$temparray["tamount"]  		= $row["tamount"];
			$temparray["grouptype"]  		= 'Invoice';
			
			  /* if($row["nro_status"]=="revised")
			       {
					$temparray["revised"]  	= 1;
					 $temparray["canceled"]  = 0;
				   }
			    else if($row["nro_status"]=="canceled")
				 {
				    $temparray["revised"]  	= 0;
					 $temparray["canceled"]  = 1;
				 }
				 else
				 {
					 $temparray["revised"]  	= 0;
					 $temparray["canceled"]  = 0;
				 }*/
				 $temparray["invoice_no"]  			= $row["invoice_no"];
			
			$CustomerbillData["data"][$i] = $temparray;   
			$i++;
		}
	}
	echo json_encode($CustomerbillData);	
?>