<?php
include_once('database_connection.php');
if(isset($_GET['action']))
{

}

if(isset($_GET['view']))
{
$data=array();
	$result=odbc_exec($connection, "select COAName,Attr4,Attr10,Attr11,Attr15  FROM Accounts
  where under=54 and natureid=14");
  while ($row = odbc_fetch_array($result)) {
    $data []=$row;
  }
   echo json_encode($data);
}

if(isset($_GET['viewVisit']))
{
$data=array();
	$result=odbc_exec($connection, "select id,COAName,visitdate,appointdate,salesrepid,(select SalesmanName from salesmaninformation where Salesmanid=salesrepid)  FROM VisitMaster inner join Accounts on VisitMaster.COAID=Accounts.COAID");
  while ($row = odbc_fetch_array($result)) {
//$id=$row[0];
  	         $editdata='<i class="fa fa-pencil fa-lg edit1" style="text-align: left;color: blue;cursor:pointer;" onclick="javascript:editMaster(this,\''.$row["id"].'\');"></i>&nbsp;<i class="fa fa-bin fa-lg" style="text-align: left;color: blue;cursor:pointer;" onclick="javascript:deleteRow(this,\''.$row["id"].'\');"></i>';
    $row['col_Action']=$editdata;         
    $data []=$row;
    
  }
   echo json_encode($data);

}
?>