<?php
require('../config/dbcon.php');
if (isset($_POST["id"])) {
	$output = array();
	$query = "Select * from bill_mst where id =" . $_POST["id"] . "";
	if (mysqli_query($connect, $query)) {
		$result = mysqli_query($connect, $query);
		while ($row = mysqli_fetch_array($result)) {
			$output['srno'] = $row["id"];
			$output['supp_name'] = $row["supp_name"];
			$output['supp_place'] = $row["supp_place"];
			$output['bill_number'] = $row["bill_number"];
			
			$orgDate = $row["bill_date"]; 
    	    $newDate = date("d-m-Y", strtotime($orgDate));
    	    $inv_date=$newDate;
			$output['bill_date'] = $inv_date;
			$output['placefrom'] = $row["placefrom"];
			$output['destination'] = $row["destination"];
			$output['inv_number'] = $row["inv_number"];
			$output['lrno'] = $row["lrno"];
			$output['lchno'] = $row["lchno"];
			$output['weight'] = $row["weight"];
			$output['extra'] = $row["extra"];
			$output['balance'] = $row["balance"];
			$total = $row["extra"] + $row["balance"];
			$output['total_paid'] = $total;
			$output['payment_amount'] = $total;
			$output['truck_number'] = $row["truck_number"];
			$output['truck_owner_name'] = $row["truck_owner_name"];
			$output['truck_pan_number'] = $row["truck_pan_number"];
			$output['rupeesinwords'] = $row["rupeesinwords"];
			$orgDate1 = $row["date_one"]; 
    	    $newDate1 = date("d-m-Y", strtotime($orgDate1));
    	    $inv_date1=$newDate1;
			$output['loading_date'] = $inv_date1;
		}
		echo json_encode($output);
	}
}
