<?php
    include '_connect.php';

    $ct_no = $_GET['ct_no'];
    // $ct_no = "2511630060";

    // $cnsvbarcode = $_GET['cnsvbarcode'];
    // $cnsvrefcode = $_GET['cnsvrefcode'];
    // $cnsvrefno = $_GET['cnsvrefno'];

    $sql = "SELECT ps_name,ct_mobileno,product_name,due_amnt,ct_no,cnsvbarcode,cnsvrefcode,cnsvrefno FROM EHONGDB.dbo.hps_ctmain
    WHERE ct_no = '$ct_no'";
    // echo $sql;
    $select=$dbh->prepare($sql);
    $select->execute();
    $sql_array = array();
    $fetchx=$select->fetch();
    $ct_no = $fetchx['ct_no'];
    $ps_name = $fetchx['ps_name'];
    $ct_mobileno = $fetchx['ct_mobileno'];
    $product_name = $fetchx['product_name'];
    $due_amnt = $fetchx['due_amnt'];

    $sql_array[] = array(
        "ct_no" => $ct_no,
        "ps_name" => $ps_name,
        "ct_mobileno" => $ct_mobileno,
        "product_name" => $product_name,
        "due_amnt" => "<lable style='color:red'>".number_format($due_amnt,2)."<lable>",
        "cnsvbarcode" => $fetchx['cnsvbarcode'],
        "cnsvrefcode" => $fetchx['cnsvrefcode'],
        "cnsvrefno" => $fetchx['cnsvrefno']
        );
    
    echo json_encode($sql_array);
?>