Shelter animals with positive test result
###
Medical
###
3307/Any rev02
###
Shelter animals who have tested positive for something
###
en
###
SELECT a.ShelterCode, a.AnimalName, a.ID AS AID,
s.SpeciesName, a.BreedName, a.AnimalAge,
a.DisplayLocation,
a.DateBroughtIn,
tt.TestName
FROM animaltest att
INNER JOIN testtype tt ON tt.ID = att.TestTypeID
INNER JOIN animal a ON att.AnimalID = a.ID
INNER JOIN internallocation il ON il.ID = a.ShelterLocation
INNER JOIN species s ON s.ID = a.SpeciesID
LEFT OUTER JOIN lksmovementtype mt ON mt.ID = a.ActiveMovementType
LEFT OUTER JOIN adoption ad ON ad.ID = a.ActiveMovementID
LEFT OUTER JOIN owner fo ON ad.OwnerID = fo.ID
WHERE a.Archived = 0 AND TestResultID = 3 AND DateOfTest Is Not Null 
AND tt.TestName LIKE '%$ASK STRING Enter partial test name (blank for all)$%'
ORDER BY a.AnimalName
###
$$HEADER
<table border="1">
<thead>
<tr>
<th>Code</th>
<th>Name</th>
<th>Species</th>
<th>Breed</th>
<th>Age</th>
<th>Location</th>
<th>Entered Shelter</th>
<th>Positive for</th>
</tr>
</thead>
<tbody>
HEADER$$

$$BODY
<tr>
<td>$SHELTERCODE</td>
<td><a target="_blank" href="animal?id=$AID">$ANIMALNAME</a></td>
<td>$SPECIESNAME</td>
<td>$BREEDNAME</td>
<td>$ANIMALAGE</td>
<td>$DISPLAYLOCATION</td>
<td>$DATEBROUGHTIN</td>
<td>$TESTNAME</td>
</tr>
BODY$$

$$FOOTER
</tbody>
</table>
FOOTER$$
&&&
Animals with positive test result
###
Medical
###
3307/Any rev02
###
All animals who have tested positive for something
###
en
###
SELECT a.ShelterCode, a.AnimalName, a.ID AS AID,
s.SpeciesName, a.BreedName, a.AnimalAge,
a.DisplayLocation,
a.DateBroughtIn,
tt.TestName
FROM animaltest att
INNER JOIN testtype tt ON tt.ID = att.TestTypeID
INNER JOIN animal a ON att.AnimalID = a.ID
INNER JOIN internallocation il ON il.ID = a.ShelterLocation
INNER JOIN species s ON s.ID = a.SpeciesID
LEFT OUTER JOIN lksmovementtype mt ON mt.ID = a.ActiveMovementType
LEFT OUTER JOIN adoption ad ON ad.ID = a.ActiveMovementID
LEFT OUTER JOIN owner fo ON ad.OwnerID = fo.ID
WHERE TestResultID = 3 AND DateOfTest Is Not Null 
AND DateOfTest >= '$ASK DATE Testing positive between$' AND DateOfTest <= '$ASK DATE and$'
AND tt.TestName LIKE '%$ASK STRING Enter partial test name (blank for all)$%'
ORDER BY a.AnimalName
###
$$HEADER
<table border="1">
<thead>
<tr>
<th>Code</th>
<th>Name</th>
<th>Species</th>
<th>Breed</th>
<th>Age</th>
<th>Location</th>
<th>Entered Shelter</th>
<th>Positive for</th>
</tr>
</thead>
<tbody>
HEADER$$

$$BODY
<tr>
<td>$SHELTERCODE</td>
<td><a target="_blank" href="animal?id=$AID">$ANIMALNAME</a></td>
<td>$SPECIESNAME</td>
<td>$BREEDNAME</td>
<td>$ANIMALAGE</td>
<td>$DISPLAYLOCATION</td>
<td>$DATEBROUGHTIN</td>
<td>$TESTNAME</td>
</tr>
BODY$$

$$FOOTER
</tbody>
</table>
FOOTER$$
