<?php
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include ('includes/function.php');

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

if ($_REQUEST["invno"]) {
    $invno = $_REQUEST["invno"];
    $vouchno = $_REQUEST["vouchno"];
    $party = $_REQUEST["party"];

    $chkinvno = mysqli_query($conn, "SELECT `invno`,`vouchno` FROM `outmain` WHERE  `vouchno` != '$vouchno' and `invno`= '$invno' and `party`='$party' ")or die(mysqli_error($conn));
    $row = mysqli_num_rows($chkinvno);
    if ($row > 0) {
        $fetch = mysqli_fetch_array($chkinvno);
        $vouchno = $fetch['vouchno'];
        echo $vouchno;
    }
}
?>
