<?php
include("../../db.php");
header('Content-Type: application/json');

/*
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
error_reporting(-1);
*/

$idno    = $_REQUEST['idno'];
$session = $_REQUEST['session'];

$status = 0;
$data   = array();

if ($idno != '' && $session != ''){

    $result = $db->getRows("SELECT t1.id, t1.rid, t1.total_amount, DATE_FORMAT(t1.issue_date, '%d-%m-%Y') AS issue_date,t1.rec_status, t2.name FROM inventory_receipt t1 LEFT JOIN inventory t2 ON t1.inventory_id = t2.id WHERE t1.idno = '$idno' AND t1.session = '$session' ORDER BY t1.id ASC");

    if (count($result) > 0) {
        $status = 1;
        $data = $result;
    }

}

echo json_encode(array("status" => $status, "data" => $data));