<?
require_once('connectiondb.php');
require_once('calendar/calendar/classes/tc_calendar.php');
$strSQLShow = "SELECT dbo.USERINFO.USERID, dbo.USERINFO.Name, dbo.USERINFO.DEFAULTDEPTID, dbo.DEPARTMENTS.DEPTNAME
FROM dbo.USERINFO INNER JOIN dbo.DEPARTMENTS ON dbo.USERINFO.DEFAULTDEPTID = dbo.DEPARTMENTS.DEPTID
WHERE (dbo.USERINFO.STATE ='$PERSON_TYPE_ID') AND (NOT EXISTS
(SELECT dbo.CHECKINOUT.USERID,dbo.CHECKINOUT.CHECKTIME FROM dbo.CHECKINOUT
dbo.CHECKINOUT INNER JOIN dbo.USERINFO ON dbo.CHECKINOUT.USERID = dbo.USERINFO.USERID
WHERE (USERID = dbo.USERINFO.USERID) AND (CONVERT(CHAR(10),CHECKTIME,23) BETWEEN '$DChk' AND '$DChk1') AND (USERID=dbo.CHECKINOUT.USERID)))
ORDER BY USERINFO.DEFAULTDEPTID,CHECKTIME ASC";
$objQueryShow = mssql_query($strSQLShow) or die ("Error Query [".$strSQLShow."]");
$Num_Rows = mssql_num_rows($objQueryShow);
?>
$strSQLShow="SELECT View_Person_Bydate.*,View_Report_Leave.*
FROM View_Person_Bydate
LEFT JOIN View_Report_Leave ON View_Person_Bydate.USERID = View_Report_Leave.USERID
WHERE (CONVERT(CHAR(10),CHECKTIME,23)between '$DChk' and '$DChk1') AND (CONVERT(CHAR(10),STARTSPECDAY,23)between '$DChk' and '$DChk1') AND (View_Report_Leave.STATE='$PERSON_TYPE_ID') AND (View_Person_Bydate.STATE='$PERSON_TYPE_ID') AND (View_Report_Leave.USERID IS null) AND (View_Report_Leave.USERID IS null )
ORDER BY View_Person_Bydate.DEPTNAME";