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

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

$vouchno = $_REQUEST['vouchno'];
$vouchdt = $_REQUEST['vouchdt'];
$party = $_REQUEST['party'];


$query = mysqli_query($conn, "SELECT  `party`,vouchdt,vouchno FROM `salemain` WHERE party='$party' and vouchdt = '$vouchdt' and vouchno != '$vouchno'")or die(mysqli_error($conn));
$fetnum = mysqli_num_rows($query);
if ($fetnum > 0) {
    $fetdat = mysqli_fetch_array($query);
        echo "Sale Already Exist for this Party and Date on Voucher No." . $fetdat['vouchno'];
}
?>