Shelter Animals with Warnings
###
Inventories
###
34411/Any rev02
###
Detailed current shelter inventory of animals with warnings.
###
en
###
SELECT a.ID AS AID, a.ShelterCode, 
a.AnimalName, 
a.MostRecentEntryDate,
a.IdentichipNumber,
a.AnimalAge,
a.BreedName,
a.TimeOnShelter,
sx.Sex,
t.AnimalType,
s.SpeciesName,
i.LocationName,
a.PopupWarning
FROM animal a
INNER JOIN animaltype t ON t.ID = a.AnimalTypeID
INNER JOIN species s ON s.ID = a.SpeciesID
INNER JOIN lksex sx ON sx.ID = a.Sex
INNER JOIN internallocation i ON i.ID = a.ShelterLocation
WHERE a.Archived = 0
AND a.PopupWarning Is Not Null AND a.PopupWarning <> ''
ORDER BY i.LocationName, s.SpeciesName, a.AnimalName
###
$$HEADER
HEADER$$

$$GROUP_LocationName
$$HEAD
<h2>$LocationName</h2>
$$FOOT
<p><b>Total $LocationName: {COUNT.LocationName}</b></p>
GROUP$$

$$GROUP_SpeciesName
$$HEAD
<h3>$SpeciesName</h3>
<table border=1>
<thead>
<tr>
<th><b>Code</b></th>
<th><b>Name</b></th>
<th><b>Type</b></th>
<th><b>Microchip</b></th>
<th><b>Age</b></th>
<th><b>Breed</b></th>
<th><b>Sex</b></th>
<th><b>Entered Shelter</b></th>
<th><b>Time On Shelter</b></th>
<th><b>Warning</b></th>
</tr>
</thead>
<tbody>
$$FOOT
</tbody>
</table>
<p>Total $SpeciesName: {COUNT.SpeciesName}</p>
GROUP$$

$$BODY
<tr>
<td>$sheltercode</td>
<td><a target="_blank" href="animal?id=$aid">$animalname</a></td>
<td>$animaltype</td>
<td>$identichipnumber</td>
<td>$animalage</td>
<td>$breedname</td>
<td>$sex</td>
<td>$mostrecententrydate</td>
<td>$timeonshelter</td>
<td>$popupwarning</td>
</tr>
BODY$$

$$FOOTER
FOOTER$$
