<?php

require_once("connectioni.php");
session_start();

if ($_SESSION['company'] == "") { 
    exit("Please Login");
}
if ($_SESSION['CURRENT_USER'] == "") { 
    exit("Please Login");
}


$sql = "select * from s_crec where   CANCELL!='1' and FLAG!='RET'";
$result = mysqli_query($GLOBALS['dbinv'], $sql);
while ($row = mysqli_fetch_array($result)) {
    $sql1 = "select * from s_sttr where ST_REFNO='" . $row["CA_REFNO"] . "'";
    $result1 = mysqli_query($GLOBALS['dbinv'], $sql1);
    if ($row1 = mysqli_fetch_array($result1)) {
        
    } else {
        echo $row["CA_REFNO"] . "-" . $row["CA_DATE"] . "-" . $row["CA_CODE"] . "</br>";
    }
}
?>