<?php

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
include("db_connect.php");
include("db_functions.php");
$db=new DB_Functions();
$dc = new DB_Connect();         
$link1 = $dc->connect();
$ei = $_REQUEST['collect_by']; 
$users=$db->collection_list($ei);
$a=array();
$b=array();
   if($users!=false){
   while($row = mysqli_fetch_array($users)) {
	$b["retailer_id"] = $row["retailer_code"]; 
	$name=mysqli_fetch_assoc(mysqli_query($link1,"select locationname from location_master where location_code='".$row['retailer_code']."'"));
	$b["retailer_name"]=$name['locationname'];
	$b["collect_id"] = $row["collect_id"];
	
  	$b["collect_amt"] = $row["collect_amt"];
  	$b["collect_date"] = $row["collect_date"];
  	$b["collect_by"] = $row["collect_by"];

	array_push($a,$b);
   }}
   echo json_encode($a);
?>