<?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['invno'])) {
    $invno = $_REQUEST["invno"];
    $party = $_REQUEST["party"];
    $checkexist = mysqli_query($conn, "SELECT a.vouchno,b.name FROM `purmain` a 
                                                     LEFT JOIN accmast b ON a.party = b.accode
                                                     WHERE a.`invno`='$invno' AND b.name = '$party' ") or die(mysqli_error($conn)); 
    if (mysqli_num_rows($checkexist) > 0) {
        $gcheckexist = mysqli_fetch_object($checkexist);
        echo "$gcheckexist->vouchno";
    }
}

