<?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];

if (isset($_REQUEST[init])) {
    $minit      = $_REQUEST[init];
    $mtype      = $_REQUEST[type];
    $maccode    = $_REQUEST[accode];
    
    if($mtype == 'cash'){
        $getinit = mysqli_query($conn,"SELECT `init` FROM `accmast` WHERE `accode`!='$maccode' AND `grpcode`='002' AND `init`='$minit'")or die(mysqli_error($conn));
    }else{
        $getinit = mysqli_query($conn,"SELECT `init` FROM `accmast` WHERE `accode`!='$maccode' AND `grpcode`='001' AND `init`='$minit'")or die(mysqli_error($conn));
    }
    $init = mysqli_num_rows($getinit);
    
    if($init > "0"){
        $data = "1";
    }else{
        $data = "0";
    }
    Echo $data;
}