Index: trunk/WEB-INF/src/com/showcase/sql/PerRepReportDAOImpl.java =================================================================== diff -u -r237 -r238 --- trunk/WEB-INF/src/com/showcase/sql/PerRepReportDAOImpl.java (.../PerRepReportDAOImpl.java) (revision 237) +++ trunk/WEB-INF/src/com/showcase/sql/PerRepReportDAOImpl.java (.../PerRepReportDAOImpl.java) (revision 238) @@ -24,7 +24,7 @@ "DECLARE @eventId INT = ?\n" + "DECLARE @salesman VARCHAR(10) = ?\n" + "SELECT\n" + - " DISTINCT 'attended',\n" + + " DISTINCT 'attended' AS indication,\n" + " d.salesman,\n" + " d.dealer_id,\n" + " d.given_dealer_name,\n" + @@ -47,7 +47,7 @@ "UNION ALL \n" + "\n" + "SELECT\n" + - " DISTINCT 'noshow',\n" + + " DISTINCT 'noshow' AS indication,\n" + " d.salesman,\n" + " d.dealer_id,\n" + " d.given_dealer_name,\n" + @@ -79,6 +79,43 @@ " AND d.salesman=@salesman \n" + " AND a.status != 'D'\n" + " \tAND (a.checked_in = 'y' OR a.checked_in_2nd_day = 'y' OR a.checked_in_hosp_day1 = 'y' OR a.checked_in_hosp_day2 = 'y') \n" + + " ) " + + " \n" + + "UNION ALL \n" + + "\n" + + "SELECT\n" + + " DISTINCT 'dealersPartiallyUnattended' AS indication,\n" + + " d.salesman,\n" + + " d.dealer_id,\n" + + " d.given_dealer_name,\n" + + " a.attendee_name,\n" + + " a.checked_in,\n" + + " a.checked_in_2nd_day,\n" + + " a.checked_in_hosp_day1,\n" + + " a.checked_in_hosp_day2 \n" + + "FROM\n" + + " dealers d \n" + + "JOIN\n" + + " attendees a \n" + + " on a.dealer_id=d.dealer_id \n" + + "WHERE\n" + + " a.event_id=@eventId \n" + + " AND d.salesman=@salesman \n" + + " AND (((checked_in = 'n') OR (checked_in IS NULL)) AND ((checked_in_2nd_day = 'n') OR (checked_in_2nd_day IS NULL)) AND ((a.checked_in_hosp_day1 = 'n') OR (a.checked_in_hosp_day1 IS NULL)) AND ((a.checked_in_hosp_day2 = 'n') OR (checked_in IS NULL))) \n" + + " AND a.status != 'D'\n" + + " AND d.dealer_id IN (\n" + + " SELECT\n" + + " DISTINCT d.dealer_id \n" + + " FROM\n" + + " dealers d \n" + + " JOIN\n" + + " attendees a \n" + + " ON a.dealer_id=d.dealer_id \n" + + " WHERE\n" + + " a.event_id=@eventId \n" + + " AND d.salesman=@salesman \n" + + " AND a.status != 'D'\n" + + " \tAND (a.checked_in = 'y' OR a.checked_in_2nd_day = 'y' OR a.checked_in_hosp_day1 = 'y' OR a.checked_in_hosp_day2 = 'y') \n" + " ) "; @@ -190,34 +227,36 @@ report.setGivenDealerName(rs.getString("given_dealer_name")); report.setAttendeeName(rs.getString("attendee_name")); - - - if (rs.getString("checked_in").equals("Y")) { - report.setAttended(true); + if (rs.getString("indication").equalsIgnoreCase("dealersPartiallyUnattended")) { report.setShowedUp(true); - } else if (rs.getString("checked_in").equals("N")) { - report.setAttended(false); - } - - if (rs.getString("checked_in_2nd_day") != null && rs.getString("checked_in_2nd_day").equals("Y")) { - report.setAttendedSecondDay(true); - report.setShowedUp(true); } else { - report.setAttendedSecondDay(false); - } + if (rs.getString("checked_in").equals("Y")) { + report.setAttended(true); + report.setShowedUp(true); + } else if (rs.getString("checked_in").equals("N")) { + report.setAttended(false); + } - if (rs.getString("checked_in_hosp_day1").equals("Y")) { - report.setAttendedHospFirstDay(true); - report.setShowedUp(true); - } else if (rs.getString("checked_in_hosp_day1").equals("N")) { - report.setAttendedHospFirstDay(false); - } + if (rs.getString("checked_in_2nd_day") != null && rs.getString("checked_in_2nd_day").equals("Y")) { + report.setAttendedSecondDay(true); + report.setShowedUp(true); + } else { + report.setAttendedSecondDay(false); + } - if (rs.getString("checked_in_hosp_day2") != null && rs.getString("checked_in_hosp_day2").equals("Y")) { - report.setAttendedHospSecondDay(true); - report.setShowedUp(true); - } else { - report.setAttendedHospSecondDay(false); + if (rs.getString("checked_in_hosp_day1").equals("Y")) { + report.setAttendedHospFirstDay(true); + report.setShowedUp(true); + } else if (rs.getString("checked_in_hosp_day1").equals("N")) { + report.setAttendedHospFirstDay(false); + } + + if (rs.getString("checked_in_hosp_day2") != null && rs.getString("checked_in_hosp_day2").equals("Y")) { + report.setAttendedHospSecondDay(true); + report.setShowedUp(true); + } else { + report.setAttendedHospSecondDay(false); + } } return report;