<?php
ini_set('display_errors', 1);
error_reporting(E_ERROR);
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');

$zdb = $_SESSION["zdbyear_" . $dbname];
mysqli_select_db($conn, $zdb);

if (isset($_REQUEST['vouchdt'])) {
    $vouchdt = $_REQUEST["vouchdt"];
    $vouchno = $_REQUEST["vouchno"];

    $checkexist = mysqli_query($conn, "SELECT vouchno FROM `stkentmain` WHERE `vouchdt`='$vouchdt' AND vouchno != '$vouchno' ") or die(mysqli_error($conn)); 
    if (mysqli_num_rows($checkexist) > 0) {
        $gcheckexist = mysqli_fetch_object($checkexist);
        echo "$gcheckexist->vouchno";
    }
}

