\n"; echo " th, td\n"; echo " { font-size: 11pt;\n"; echo " padding-right: 1em;\n"; echo " }\n"; echo " table\n"; echo " { border-collapse: collapse;\n"; echo " }\n"; echo "\n"; include_once '../../modules/comFunctions.php'; include_once '../../modules/config.php'; include_once '../../modules/sql.php'; function makeTimeSheet($user, $period, $detailed = true) { $str = "Time Sheet"; if (!$detailed) $str .= " Summary"; $str .= " for ".$user['fName']." ".$user['lName']." for ".formatDate($period['cStart'])." to ".formatDate($period['cEnd']); echo "
$str
\n"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; if ($user['access'] & 0x002) echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; $nonAdjTtl = 0; $timeList = sqlSelect("times", "wDate > '".$period['pEnd']."' and wDate < '".$period['cEndFlag']."' and empNo = '".$user['empNo']."'", "", "wDate"); while ($time = mysql_fetch_assoc($timeList['r'])) { if ($detailed) { $dow = getDayOfWeek($time['wDate']); $dTime = processTimeDif($time['wStart'], $time['wEnd']); $nonAdjTtl += $dTime; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; if ($user['access'] & 0x002) echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; $lastDow = $dow; } $dailyAdjTtl += $time['dailyAdj']; $tTimeTtl += $time['tTime']; $oTimeTtl += $time['oTime']; } echo " \n"; echo " \n"; echo " \n"; if ($user['access'] & 0x002) echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; if ($user['access'] & 0x002) { //$old_Ent = sqlSelect("employees", "empNo='".$_REQUEST['empNo']."'"); //$old_Ent = mysql_fetch_assoc($old_Ent['r']); // this block fetches all banking with dates NEWER than the specified period so that it can be allowed for in the reporting $cumAdj = 0; $adjs = sqlSelect("timebank", "tDate>'".$period['cEnd']."' and empNo='".$user['empNo']."'"); // this will fetch all entries NEWER than the selected period while ($adj = mysql_fetch_assoc($adjs['r'])) $cumAdj += ($adj['intAdj'] + $adj['extAdj']); $adjs = sqlSelect("times", "wDate>'".$period['cEnd']."' and empNo='".$user['empNo']."'"); // this will fetch all entries NEWER than the selected period while ($adj = mysql_fetch_assoc($adjs['r'])) $cumAdj += $adj['dailyAdj']; // end of block $intAdj = sqlSelect("timebank", "tDate='".$period['cEnd']."' and empNo='".$user['empNo']."'"); if ($intAdj['n']) { $intAdj = mysql_fetch_assoc($intAdj['r']); $extAdj = $intAdj['extAdj']; $intComment = $intAdj['intComment']; $extComment = $intAdj['extComment']; $intAdj = $intAdj['intAdj']; // this must be LAST because the value is assigned to the container variable } else { $intAdj = 0; $extAdj = 0; $intComment = ""; $extComment = ""; } $openBal = $user['bank'] - $intAdj - $extAdj - $dailyAdjTtl; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; } echo "style=\"text-align:right; font-weight: bold;\">Period Total: \n"; echo " \n"; echo " \n"; echo " \n"; } echo "
"; if ($detailed) echo "Date"; echo ""; if ($detailed) echo "Start"; echo ""; if ($detailed) echo "End"; echo ""; if ($detailed) echo "SubTtl"; echo "Bank"; if ($detailed) echo "Absence"; echo "RegOT
"; if ($lastDow != $dow) echo $dow['l']; echo ""; if ($lastDow != $dow) echo $dow['f']; echo "".$time['wStart']."".formatTime($time['wEnd'])."".sprintf("%01.2f", $dTime)."".$time['dailyAdj']."".$time['excuse']."".$time['tTime']."".$time['oTime']."
Period "; if ($user['access'] & 0x002) echo "Sub"; echo "Total: ".sprintf("%01.2f", $nonAdjTtl)."".sprintf("%01.2f", $dailyAdjTtl)."".sprintf("%01.2f", $tTimeTtl)."".sprintf("%01.2f", $oTimeTtl)."
Timebank Opening Balance: ".sprintf("%01.2f", ($openBal - $cumAdj))."
External Adjustments: ".sprintf("%01.2f", $extAdj)."$extComment
Debits and Credits: "; echo sprintf("%01.2f", $intAdj); echo "$intComment
Timebank Closing Balance: ".sprintf("%01.2f", ($user['bank'] - $cumAdj))."Period Total: ".sprintf("%01.2f", ($tTimeTtl - $intAdj))."".sprintf("%01.2f", $oTimeTtl)."
\n"; } if (empty($_REQUEST['period'])) $period = calcDates(date("Ymd")); else $period = calcDates($_REQUEST['period']); $str = "wDate > '".$period['pEnd']."' and wDate < '".$period['cEndFlag']."'"; if (!empty($_REQUEST['empNo'])) $str .= " and times.empNo = '".$_REQUEST['empNo']."'"; $sheetList = sqlSelect("times, employees", "times.empNo=employees.empNo and $str", "lName, fName"); $_REQUEST['mode'] = "1"; if (array_key_exists("doPrint", $_REQUEST)) { $doPrint = " onLoad=\"window.print();\""; } echo "\n"; while ($sheet = mysql_fetch_assoc($sheetList['r'])) { if ($hasRun) echo "
\n"; $user = getEmployeeData($sheet['empNo']); makeTimeSheet($user, $period, $_REQUEST['mode']); $hasRun = true; } ?>