<?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['id'] = $row["id"];
			$orgDate = $row["date_one"]; 
        	$newDate = date("d-m-Y", strtotime($orgDate));
        	$date_one=$newDate;
    	    $output['date_one'] = $date_one;
			$output['bill_number'] = $row["bill_number"];
			$orgDate1 = $row["bill_date"]; 
        	$newDate1 = date("d-m-Y", strtotime($orgDate1));
        	$bill_date=$newDate1;
			$output['bill_date'] = $bill_date;
			$output['party_name'] = $row["party_name"];
			$output['party_place'] = $row["party_place"];
			$output['truck_number'] = $row["truck_number"];
			$output['truck_owner_name'] = $row["truck_owner_name"];
			$output['supp_name'] = $row["supp_name"];
			$output['supp_place'] = $row["supp_place"];
			$output['inv_number'] = $row["inv_number"];
			$output['lchno'] = $row["lchno"];
			$output['lrno'] = $row["lrno"];
			$output['placefrom'] = $row["placefrom"];
			$output['destination'] = $row["destination"];
			$output['weight'] = $row["weight"];
			$output['booking_rate'] = $row["booking_rate"];
			$output['lorry_freight'] = $row["lorry_freight"];
			$output['advance'] = $row["advance"];
			$output['cash_advance'] = $row["cash_advance"];
			$output['diesel'] = $row["diesel"];
			$output['neft_amount'] = $row["neft_amount"];
			$output['neft_date'] = $row["neft_date"];
			$output['others'] = $row["others"];
			$output['extra'] = $row["extra"];
			$output['mamul_charges'] = $row["mamul_charges"];
			$output['balance'] = $row["balance"];
			$output['total_paid'] = $row["total_paid"];
			$output['profit'] = $row["profit"];
			$output['payment_amount'] = $row["payment_amount"];
			$output['rupeesinwords'] = $row["rupeesinwords"];
		}
		echo json_encode($output);
	}
}
