<?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["customer"]) {
if ($_REQUEST["aadhar"]) {
    $aadhar = $_REQUEST["aadhar"];
    $accode = $_REQUEST["accode"];
    
    $getjobg = mysqli_query($conn, "SELECT custcode  FROM `accmast`  WHERE aadhar = '$aadhar'
                            AND accode !='$accode' ") or die(mysqli_error($conn));

    if (!empty($getjobg)) {
        $fjob = mysqli_num_rows($getjobg);
    } else {
        $fjob = 0;
    }
    $fjobg = mysqli_fetch_array($getjobg);
    $gvouc = $fjobg['custcode'];

    if ($fjob > 0) {
        echo "$gvouc";
    } else {
        echo "";
    }
}

if ($_REQUEST["pancard"]) {
    $pancard = $_REQUEST["pancard"];
    $accode = $_REQUEST["accode"];
    
    $getjobg = mysqli_query($conn, "SELECT custcode  FROM `accmast`  WHERE pancard = '$pancard'
                            AND accode !='$accode' ") or die(mysqli_error($conn));

    if (!empty($getjobg)) {
        $fjob = mysqli_num_rows($getjobg);
    } else {
        $fjob = 0;
    }
    $fjobg = mysqli_fetch_array($getjobg);
    $gvouc = $fjobg['custcode'];

    if ($fjob > 0) {
        echo "$gvouc";
    } else {
        echo "";
    }
}
?>