<?php
 
include 'dbconfig.php';
 
// Create connection
$nopos=$_POST['nopos'];
//$kodecab=$_POST['kodecab'];
 
$conn = mysqli_connect($servername, $username, $password, $dbname);
 
// Check connection
 
if (!$conn) {
 
    die("Connection failed: " . mysqli_connect_error());
 
}
 
//$result["errorcode"]="0";

//echo $cari."<br>";



 
 

 
$sql = "SELECT idno,item_code,item_desc,harga_jual,qty,disc_val,custid,custname,(harga_jual*qty)-IFNULL(disc_val,0) as subtotal FROM Trans1ret where return_no like '%$nopos%'  order by idno desc";
 
$res = mysqli_query($conn, $sql);

 
 
$items = array();
 
if (mysqli_num_rows($res) > 0) {
 
    while($row = mysqli_fetch_object($res)){
 
        array_push($items, $row);
 
$result["errorcode"] = "1";
 
    $result["data"] = $items;
 
}}
else
{
 
       $result["data"] = "failed";
 
}
 
echo json_encode($result);
 
 
 
mysqli_close($conn);
 
?>
