<?php 
require "../commonincludefiles.php";
if($_SESSION["cCompany_id"]!="" && isset($_SESSION["cCompany_id"]))
{
	$objWorkMgmt = new WorkMgmt();
	$limit=0;
	$start=0;
	$condition="";
	
	$sort    = isset($_REQUEST['sort'])   ? $_REQUEST['sort']   : 'work_id';
	$dir     = isset($_REQUEST['dir'])    ? $_REQUEST['dir']    : 'ASC';
	
	$result = $objWorkMgmt->getAllRecords(0,0,$condition,$sort,$dir);
	$total = dbRows($result);
	$i=0;
	$sectionData = array("count" => $total, "rowe" => array());
	if(dbRows($result) > 0){
		$temparray = array();
		while($row = dbArray($result)){
			$temparray["work_id"]  = $row["work_id"];
			$temparray["work_details"]   = $row["work_details"];
			$temparray["hours"]   = $row["hours"];
			$sectionData["rowe"][$i] = $temparray;   
			$i++;
		}										
	}				   		 
 	echo json_encode($sectionData);	
}
?>