<?php
	require "../commonincludefiles.php";
   	$objdocument = new DocumentMgmt();
	$i=0;
	$order_field=" document_id ";
	$order_type=" ASC ";
	$limit="";
	$start="";
	$where="";
	// Determine the branch_id condition

	$rs = $objdocument->getAllRecords($limit,$start,$where,$order_field,$order_type);

	$total = dbRows($rs);
	$objdocument = array("count" => $total, "data" => array());
	if(dbRows($rs) > 0){
		while($row = dbArray($rs)){
			$temparray["document_id"]  = $row["document_id"];
			$temparray["document_name"]  = $row["document_name"];
			$temparray["branch_name"] = $row["branch_name"] !== null ? $row["branch_name"] : "ALL";
			//$temparray["branch_name"]  = $row["branch_name"];
	
			
			$objdocument["data"][$i] = $temparray;   
			$i++;
		}
	}
	
	echo json_encode($objdocument);	
?>