<?php
include("../../db.php");
header("Access-Control-Allow-Origin: * ");
header('Content-Type: application/json');

date_default_timezone_set("Asia/Kolkata");

$class = $_REQUEST['class'];
$section = trim($_REQUEST['section']);

$uid = $_REQUEST['uid'];
$session = $_REQUEST['session'];


$monthsList1 = array(
    1   =>  'April',
    2   =>  'May',
    3   =>  'June',
    4   =>  'July ',
    5   =>  'August',
    6   =>  'September',
    7   =>  'October',
    8   =>  'November',
    9   =>  'December',
    10  =>  'January',
    11  =>  'February',
    12  =>  'March'
);

$conv = array(1=>10,2=>11,3=>12,4=>1,5=>2,6=>3,7=>4,8=>5,9=>6,10=>7,11=>8,12=>9);

$due_mon_raw = $db->getVal("select due_month from tbl_info where id = '1'");

$duemonth = $conv[$due_mon_raw];

$_REQUEST['due_month'] = $conv[$due_mon_raw];

$total_comp = include('fee_calculate.php');

$status = 0;
$msg = '';

// echo $total_comp;
if($total_comp > 0) {
    $status = 1;
    $msg = "Please clear your Dues till ".$monthsList1[$duemonth]." to participate in test.";
} else {
    $msg = "You can take test.";
}


$stu_flag = $db->getVal("select view_result from student where idno = '$uid'");
if ($stu_flag == 1 || $due_mon_raw == 0){
    $total_comp = 0;
    $status = 0;
}

$array['status'] = $status;
$array['due'] = $total_comp;
$array['msg'] = $msg;

echo json_encode($array);