private double getHoursWorked(String pin, boolean getDay){
		java.sql.Statement state = DBConnection.OpenConnection();
		double hoursTotal = 0.00;
		DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
		Calendar c = Calendar.getInstance();
		c.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
		Date date = c.getTime();
		String query = String.format("SELECT C_IN, C_OUT FROM avalenti.Hours WHERE E_PIN = %s AND C_IN >= '%s' AND C_OUT > '%s';", pin, dateFormat.format(date).toString() + " 00:00:00", "0000-00-00 00:00:00");
		if(getDay){
			date = new Date();
			query = String.format("SELECT C_IN, C_OUT FROM avalenti.Hours WHERE E_PIN = %s AND C_IN >= '%s' AND C_OUT > '%s';", pin, dateFormat.format(date).toString() + " 00:00:00", "0000-00-00 00:00:00");
		}
		if(state != null){
			try {
				ResultSet rs = state.executeQuery(query);
				while(rs.next() == true) {
					String clockIn = rs.getString("C_IN");
					String clockOut = rs.getString("C_OUT");
					double hoursWorked = calculateElapsedTime(clockIn, clockOut);
					hoursTotal += hoursWorked;
				}
			} catch (SQLException e) {
				System.out.println(e.getMessage());
				System.err.println("Error in SQL Execution");
			}
		}
		else
			System.err.println("Statement was null.  No connection?");
		
		return hoursTotal;
	}