<?php
include ('common/connection.php');

$check_tna=mysqli_fetch_array(mysqli_query($con,"Select sum(Number_Of_Working_Hour) as wh from roster_master where TNA_Name='".$Rowtna['SLN']."' and Treatment_Service_Date='".date('Y-m-d',strtotime("-1 days", strtotime($_REQUEST['date5'])))."'"));

if($check_tna['wh']>12 )
{
echo 1;
}

$check_tna_last_six=mysqli_fetch_array(mysqli_query($con,"Select sum(Number_Of_Working_Hour) as wh from roster_master where TNA_Name='".$Rowtna['SLN']."' and Treatment_Service_Date between '".date('Y-m-d',strtotime("-1 days", strtotime($_REQUEST['date5'])))."' and '".date('Y-m-d',strtotime("-6 days", strtotime($_REQUEST['date5'])))."'"));

if($check_tna_last_six['wh']>72 )
{
echo 2;
}

$check_tna_last_day=mysqli_fetch_array(mysqli_query($con,"Select night_shift from roster_master where TNA_Name='".$Rowtna['SLN']."' and Treatment_Service_Date='".date('Y-m-d',strtotime("-1 days", strtotime($_REQUEST['date5'])))."'"));

$check_tna_2ndlast_day=mysqli_fetch_array(mysqli_query($con,"Select night_shift from roster_master where TNA_Name='".$Rowtna['SLN']."' and Treatment_Service_Date='".date('Y-m-d',strtotime("-2 days", strtotime($_REQUEST['date5'])))."'"));

if($check_tna_last_day['night_shift']==1 && $check_tna_2ndlast_day['night_shift']==1)
{
echo 3;
}
?>