Vaccination Diary (Off Shelter by Species)
###
Diary
###
Any rev03
###
Vaccinations required to date for animals not on the shelter broken down by species.
###
en
###
SELECT
a.ID AS AID, a.ShelterCode, a.AnimalName, t.AnimalType, sp.SpeciesName, 
v.VaccinationType, av.DateRequired, av.Comments,
o.ID AS OID, o.OwnerName, o.OwnerAddress, o.OwnerTown, o.OwnerCounty,
o.OwnerPostcode, o.HomeTelephone, o.WorkTelephone, o.MobileTelephone
FROM animal a
INNER JOIN animaltype t ON t.ID = a.AnimalTypeID
INNER JOIN animalvaccination av ON a.ID = av.AnimalID
INNER JOIN vaccinationtype v ON av.VaccinationID = v.ID
INNER JOIN internallocation il ON il.ID = a.ShelterLocation
INNER JOIN adoption ad ON ad.ID = a.ActiveMovementID
INNER JOIN owner o ON ad.OwnerID = o.ID
INNER JOIN species sp ON sp.ID = a.SpeciesID
WHERE av.DateOfVaccination Is Null
AND av.DateRequired <= '$CURRENT_DATE$'
AND a.Archived = 1
ORDER BY sp.SpeciesName, av.DateRequired
###
$$HEADER
HEADER$$

$$GROUP_SpeciesName
$$HEAD
<h2>$SPECIESNAME</h2>
<table border=1>
<thead>
<tr>
<th><b>Code</b></th>
<th><b>Name</b></th>
<th><b>Type</b></th>
<th><b>Location</b></th>
<th><b>Vaccination Type</b></th>
<th><b>Required</b></th>
<th><b>Comments</b></th>
</tr>
</thead>
<tbody>
$$FOOT
</tbody>
</table>
GROUP$$

$$BODY<tr>
<td>$SHELTERCODE</td>
<td><a target="_blank" href="animal?id=$AID">$ANIMALNAME</a></td>
<td>$ANIMALTYPE</td>
<td>
<b><a target="_blank" href="person?id=$OID">$OWNERNAME</a></b><br/>
$OWNERADDRESS<br/>
$OWNERTOWN<br/>
$OWNERCOUNTY<br/>
$OWNERPOSTCODE<br/>
$HOMETELEPHONE<br/>
$WORKTELEPHONE<br/>
$MOBILETELEPHONE
</td>
<td>$VACCINATIONTYPE</td>
<td>$DATEREQUIRED</td>
<td>$COMMENTS</td>
</tr>
BODY$$

$$FOOTER
FOOTER$$
