<?php 

include_once 'db_functions.php';
include_once './db_connect.php';    
$db = new DB_Functions();  

$ei = $_REQUEST['entry_by'];    
$users = $db->DirectInvList($ei);    
$a = array();     
$b = array();  
 //$link1=db->connect();
   
 if ($users != false){ 
   while($row = mysqli_fetch_array($users)) {
	   
	$b["invoice_no"] = $row["challan_no"];
  	$b["from_location"] = $row["from_location"];
	  $b["from"]=$db->getAnyDetails( $row["from_location"],"locationname","location_code","location_master");


	$b["to_location"] = $row["to_location"];
$b["to"] = $db->getAnyDetails( $row["to_location"],"locationname","location_code","location_master");
	
  	$b["entry_date"] = $row["sale_date"];
	 $b["invoice_value"]=$row["total_cost"]; 
  
	$b["status"] =$db->getdispatchstatus($row['status']);
		
	array_push($a,$b);
   }	
	echo json_encode($a);
 }

?>