function checkFullTrade($shift, $trade)
{
    global $hourSize, $db;
    $totalHours = computeHourTotal($shift['startTime'], $shift['endTime']);
    try {
        $bidsQuery = $db->prepare("SELECT COUNT(`ID`) FROM `scheduleTradeBids` WHERE tradeID = :id AND `deleted`=0");
        $bidsQuery->execute(array(':id' => $trade['ID']));
    } catch (PDOException $e) {
        exit("error in query");
    }
    $result = $bidsQuery->fetch(PDO::FETCH_NUM);
    $numBids = $result[0];
    if ($numBids >= $totalHours / $hourSize) {
        return 1;
    }
    return 0;
}
 $startDate = $shift['startDate'];
 $endDate = $shift['endDate'];
 $employee = $shift['employee'];
 $hourType = $shift['hourType'];
 if (isset($shift['area']) && $shift['area'] != '' && $shift['area'] != 'null') {
     if (isset($area)) {
         $oldArea = $area;
     }
     $area = $shift['area'];
 }
 if (isset($shift['defaultID']) && $shift['defaultID'] != '' && $shift['defaultID'] != 'null') {
     $defaultID = $shift['defaultID'];
 } else {
     $defaultID = NULL;
 }
 $hourTotal = computeHourTotal($startDate . ' ' . $startTime, $endDate . ' ' . $endTime);
 try {
     $scheduleQuery = $db->prepare("SELECT * FROM `scheduleWeekly` WHERE `employee` = :employee AND `deleted`=0 AND \n\t\t(\n\t\t\t( CONCAT(`startDate`, ' ', `startTime`) <=  :time0 AND CONCAT(`endDate`, ' ', `endTime`) > :time1 )\n\t\t\tOR ( CONCAT(`startDate`, ' ', `startTime`) < :time2 AND CONCAT(`endDate`, ' ', `endTime`) >= :time3 )\n\t\t\tOR ( CONCAT(`startDate`, ' ', `startTime`) > :time4 AND CONCAT(`endDate`, ' ', `endTime`) < :time5 )\n\t\t)");
     $scheduleQuery->execute(array(':employee' => $employee, ':time0' => $startDate . ' ' . $startTime . ":00", ':time1' => $startDate . ' ' . $startTime . ":00", ':time2' => $endDate . ' ' . $endTime . ":00", ':time3' => $endDate . ' ' . $endTime . ":00", ':time4' => $startDate . ' ' . $startTime . ":00", ':time5' => $endDate . ' ' . $endTime . ":00"));
 } catch (PDOException $e) {
     exit("2error in query");
 }
 if ($firstShift = $scheduleQuery->fetch(PDO::FETCH_ASSOC)) {
     $failedCheck = 1;
     $failedInserts[] = $firstShift;
     while ($conflictingShift = $scheduleQuery->fetch(PDO::FETCH_ASSOC)) {
         $failedInserts[] = $conflictingShift;
     }
 } else {
     try {
         $defaultQuery = $db->prepare("SELECT `postSchedulesByDefault` FROM `employeeAreas` WHERE `ID` = :area");
function checkHighlight($trade)
{
    //Declare variables
    global $hourSize, $db;
    $totalHours = computeHourTotal($trade['startTime'], $trade['endTime']);
    //Get all tradeBids related to the trade being passed in
    try {
        $bidsQuery = $db->prepare("SELECT COUNT(`ID`) FROM `scheduleTradeBids` WHERE tradeID = :id AND `deleted` = 0");
        $bidsQuery->execute(array(':id' => $trade['ID']));
    } catch (PDOException $e) {
        exit("error in query");
    }
    $result = $bidsQuery->fetch(PDO::FETCH_NUM);
    $numBids = $result[0];
    //If there are >= tradeBids than the amount of time for the trade then the trade should be highlighted
    if ($numBids >= $totalHours / $hourSize) {
        return 1;
    }
    //if
    return 0;
}