Test Diary (On Shelter)
###
Diary
###
33012/Any rev05
###
Tests required to date for shelter animals.
###
en
###
SELECT
a.ShelterCode, a.ID AS AID, a.AnimalName, t.AnimalType, a.DisplayLocation, 
tt.TestName, at.DateRequired, at.Comments
FROM animal a
INNER JOIN animaltype t ON t.ID = a.AnimalTypeID
INNER JOIN animaltest at ON a.ID = at.AnimalID
INNER JOIN testtype tt ON at.TestTypeID = tt.ID
WHERE at.DateOfTest Is Null
AND at.DateRequired <= '$CURRENT_DATE$'
AND a.Archived = 0
ORDER BY at.DateRequired
###
$$HEADER
<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>Test Type</b></th>
<th><b>Required</b></th>
<th><b>Comments</b></th>
</tr>
</thead>
<tbody>
HEADER$$

$$BODY<tr>
<td>$SHELTERCODE</td>
<td><a target="_blank" href="animal?id=$AID">$ANIMALNAME</a></td>
<td>$ANIMALTYPE</td>
<td>$DISPLAYLOCATION</td>
<td>$TESTNAME</td>
<td>$DATEREQUIRED</td>
<td>$COMMENTS</td>
</tr>
BODY$$

$$FOOTER
</tbody>
</table>
FOOTER$$
&&&
Test Diary (On Shelter, Date Range)
###
Diary
###
3309/Any rev04
###
Tests required between two dates for shelter animals.
###
en
###
SELECT
a.ShelterCode, a.AnimalName, a.ID AS AID, t.AnimalType, a.DisplayLocation, 
tt.TestName, at.DateRequired, at.Comments
FROM animal a
INNER JOIN animaltype t ON t.ID = a.AnimalTypeID
INNER JOIN animaltest at ON a.ID = at.AnimalID
INNER JOIN testtype tt ON at.TestTypeID = tt.ID
WHERE at.DateOfTest Is Null
AND at.DateRequired >= '$ASK DATE Enter the from date$'
AND at.DateRequired <= '$ASK DATE Enter the to date$'
AND a.Archived = 0
ORDER BY at.DateRequired
###
$$HEADER
<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>Test Type</b></th>
<th><b>Required</b></th>
<th><b>Comments</b></th>
</tr>
</thead>
<tbody>
HEADER$$

$$BODY<tr>
<td>$SHELTERCODE</td>
<td><a target="_blank" href="animal?id=$AID">$ANIMALNAME</a></td>
<td>$ANIMALTYPE</td>
<td>$DISPLAYLOCATION</td>
<td>$TESTNAME</td>
<td>$DATEREQUIRED</td>
<td>$COMMENTS</td>
</tr>
BODY$$

$$FOOTER
</tbody>
</table>
FOOTER$$
&&&
Test Diary (On Shelter by Location)
###
Diary
###
33012/Any rev03
###
Tests required to date for shelter animals, grouped by location.
###
en
###
SELECT
a.ShelterCode, a.AnimalName, a.ID AS AID, t.AnimalType, a.DisplayLocation, 
tt.TestName, at.DateRequired, at.Comments
FROM animal a
INNER JOIN animaltype t ON t.ID = a.AnimalTypeID
INNER JOIN animaltest at ON a.ID = at.AnimalID
INNER JOIN testtype tt ON at.TestTypeID = tt.ID
WHERE at.DateOfTest Is Null
AND at.DateRequired <= '$CURRENT_DATE$'
AND a.Archived = 0
ORDER BY a.DisplayLocation, at.DateRequired
###
$$HEADER
HEADER$$

$$GROUP_DisplayLocation
$$HEAD
<h2>$DisplayLocation</h2>
<table border=1>
<thead>
<tr>
<th><b>Code</b></th>
<th><b>Name</b></th>
<th><b>Type</b></th>
<th><b>Test Type</b></th>
<th><b>Required</b></th>
<th><b>Comments</b></th>
</tr>
</thead>
<tbody>
$$FOOT
</tbody>
</table>
<p>Total $DisplayLocation: {COUNT.SHELTERCODE}</p>
GROUP$$

$$BODY<tr>
<td>$SHELTERCODE</td>
<td><a target="_blank" href="animal?id=$AID">$ANIMALNAME</a></td>
<td>$ANIMALTYPE</td>
<td>$TESTNAME</td>
<td>$DATEREQUIRED</td>
<td>$COMMENTS</td>
</tr>
BODY$$

$$FOOTER
FOOTER$$

