<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

include("../leadsnew/branch_connection.php");
   $sujpath="./";
$id = $_POST['customer_id'];

$q = mysqli_query($conn,"
    SELECT *
    FROM marketing_order
    WHERE id='$id'
    LIMIT 1
");

$data = mysqli_fetch_assoc($q);

// Branch (location used as branch)
$branch_html = '<option value="'.$data['location'].'">'.$data['location'].'</option>';

echo json_encode([
    "company"   => $data['company_name'],
    "branch"    => $branch_html,
    "amount"    => $data['order_amt'],
    "discount"  => $data['discount_amount'],
    "net"       => $data['total_amount'],
    "tax"       => $data['or_tax'],
    "total"     => $data['total_amnt'],
    "ordate"    => $data['order_date'],
    "deldate"   => $data['delivery_date'],
    "bdo"       => $data['bdo'],
    "billhead"  => $data['company_name']
]);
