Special needs animals between two dates
###
Medical
###
Any rev03
###
Animals with special needs who entered the shelter between two dates.
###
en
###
SELECT a.ShelterCode, a.AnimalName, a.ID AS AID, a.DateBroughtIn,
a.TimeOnShelter,
y.AnimalType AS theType,
s.SpeciesName,
a.BreedName,
a.AnimalAge,
x.Sex,
a.HealthProblems
FROM animal a
LEFT OUTER JOIN animaltype y ON y.ID = a.AnimalTypeID
LEFT OUTER JOIN species s ON s.ID = a.SpeciesID
LEFT OUTER JOIN lksex x ON x.ID = a.Sex
WHERE a.HasSpecialNeeds = 1 AND NonShelterAnimal = 0 
AND a.DateBroughtIn >= '$ASK DATE Entered care between$'
AND a.DateBroughtIn <= '$ASK DATE and $'
ORDER BY 
s.SpeciesName, a.DateBroughtIn
###
$$HEADER
HEADER$$

$$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>Sex</b></th>
<th><b>Age</b></th>
<th><b>Breed</b></th>
<th><b>Brought In</b></th>
<th><b>Time On Shelter</b></th>
<th><b>Health Problems</b></th>
</tr>
</thead>
<tbody>
$$FOOT
</tbody>
</table>
<p>Total $SpeciesName: {COUNT.ShelterCode}</p>
GROUP$$

$$BODY
<tr>
<td>$ShelterCode</td>
<td><a target="_blank" href="animal?id=$AID">$animalname</a></td>
<td>$theType</td>
<td>$Sex</td>
<td>$AnimalAge</td>
<td>$BreedName</td>
<td>$DateBroughtIn</td>
<td>$TimeOnShelter</td>
<td>$HealthProblems</td>
</tr>
BODY$$

$$FOOTER
<p>Total: {COUNT.ShelterCode}</p>
FOOTER$$

