<?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['billing_by']; 
$users=$db->bill_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["billing_id"] = $row["billing_id"];
	
  	$b["billing_amt"] = $row["billing_amt"];
  	$b["billing_date"] = $row["billing_date"];
  	$b["billing_by"] = $row["billing_by"];

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