<?php
require('../config/dbcon.php');
if (isset($_POST["id"])) {
	$output = array();
	$query = "Select * from loading_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));
    		$inv_date=$newDate;
			$output['date_one'] = $inv_date;
            $output['party_name'] = $row["party_name"];
            $output['party_address_one'] = $row["party_address_one"];
            $output['party_address_two'] = $row["party_address_two"];
            $output['party_place'] = $row["party_place"];
            $output['party_contact_person'] = $row["party_contact_person"];
            $output['party_phone_number'] = $row["party_phone_number"];
            $output['party_mobile_number'] = $row["party_mobile_number"];
            $output['party_gst_number'] = $row["party_gst_number"];
            $output['party_pan_number'] = $row["party_pan_number"];
            $output['party_aadhar_number'] = $row["party_aadhar_number"];
            $output['party_payment_terms'] = $row["party_payment_terms"];
            $output['party_goods'] = $row["party_goods"];
            $output['party_remarks'] = $row["party_remarks"];
            $output['inv_number'] = $row["inv_number"];
            $output['lchno'] = $row["lchno"];
            $output['lrno'] = $row["lrno"];
            $output['truck_number'] = $row["truck_number"];
            $output['truck_owner_name'] = $row["truck_owner_name"];
            $output['truck_address_one'] = $row["truck_address_one"];
            $output['truck_address_two'] = $row["truck_address_two"];
            $output['truck_place'] = $row["truck_place"];
            $output['truck_mobile_number'] = $row["truck_mobile_number"];
            $output['truck_pan_number'] = $row["truck_pan_number"];
            $output['truck_bank_name'] = $row["truck_bank_name"];
            $output['truck_bank_acc_number'] = $row["truck_bank_acc_number"];
            $output['truck_bank_branch'] = $row["truck_bank_branch"];
            $output['truck_ifsc_code'] = $row["truck_ifsc_code"];
            $output['truck_aadhar_no'] = $row["truck_aadhar_no"];
            $output['truck_remarks'] = $row["truck_remarks"];
            $output['placefrom'] = $row["placefrom"];
            $output['destination'] = $row["destination"];
            $output['supp_name'] = $row["supp_name"];
            $output['supp_address_one'] = $row["supp_address_one"];
            $output['supp_address_two'] = $row["supp_address_two"];
            $output['supp_place'] = $row["supp_place"];
            $output['supp_contact_person'] = $row["supp_contact_person"];
            $output['supp_mobile_number'] = $row["supp_mobile_number"];
            $output['supp_pan_number'] = $row["supp_pan_number"];
            $output['supp_bank_name'] = $row["supp_bank_name"];
            $output['supp_bank_acc_number'] = $row["supp_bank_acc_number"];
            $output['supp_bank_branch'] = $row["supp_bank_branch"];
            $output['supp_ifsc_code'] = $row["supp_ifsc_code"];
            $output['supp_supp_aadhar_no'] = $row["supp_supp_aadhar_no"];
            $output['supp_remarks'] = $row["supp_remarks"];
            $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['unloading_charges'] = $row["unloading_charges"];
            $output['others'] = $row["others"];
            $output['extra'] = $row["extra"];
            $output['balance'] = $row["balance"];
            $output['total_paid'] = $row["total_paid"];
            $output['bal_paid_date'] = $row["bal_paid_date"];
            $output['delivery_date'] = $row["delivery_date"];
            $output['acc_rec_date'] = $row["acc_rec_date"];
            $output['driver_name'] = $row["driver_name"];
            $output['driver_mob_no'] = $row["driver_mob_no"];
            $output['mamul_charges'] = $row["mamul_charges"];
            $output['profit'] = $row["profit"];
            $output['remarks'] = $row["remarks"];
            $output['status_one'] = $row["status_one"];
            $orgDate1 = $row["bill_date"]; 
    		$newDate1 = date("d-m-Y", strtotime($orgDate1));
    		$inv_date1=$newDate1;
            $output['bill_date'] = $inv_date1;
            $output['rupeesinwords'] = $row["rupeesinwords"];
		}
		echo json_encode($output);
	}
}
