Medical treatments between two dates
###
Medical
###
34004/Any rev05
###
List of medical treatments given between two dates
###
en
###
$VAR from DATE Enter from date$
$VAR to DATE Enter to date$

SELECT a.id as aid, a.animalname, a.sheltercode, o.ownername, o.membershipnumber, am.treatmentname, v.dategiven, 
am.comments as regimencomments, v.comments, am.cost, a.breedname, a.displaylocation, s.speciesname
FROM animalmedicaltreatment v
INNER JOIN animal a ON a.id=v.animalid
LEFT JOIN owner o ON o.id=v.administeringvetid
INNER JOIN species s ON a.speciesid=s. id
INNER JOIN animalmedical am ON am.id= v.animalmedicalid
WHERE dategiven >= '$@from$' AND dategiven <= '$@to$'
ORDER BY treatmentname, dategiven
###
$$HEADER
HEADER$$

$$GROUP_TreatmentName
$$HEAD
<h2>$TreatmentName</h2>
<table border="1">
<thead>
<tr>
<th>Animal</th>
<th>Species</th>
<th>Breed</th>
<th>Location</th>
<th>Vet Name</th>
<th>License Number</th>
<th>Treatment Name</th>
<th>Comments</th>
<th>DateGiven</th>
<th>Cost</th>
</tr>
</thead>
<tbody>
$$FOOT
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td><b> {SUM.Cost}</b></td>
</tr>
</tbody>
</table>
GROUP$$
HEADER$$

$$BODY
<tr>
<td><a target="_blank" href="animal?id=$AID">$SHELTERCODE - $ANIMALNAME</a></td>
<td>$SPECIESNAME</td>
<td>$BREEDNAME</td>
<td>$DISPLAYLOCATION</td>
<td>$OWNERNAME</td>
<td>$MEMBERSHIPNUMBER</td>
<td>$TREATMENTNAME</td>
<td>$REGIMENCOMMENTS $COMMENTS</td>
<td>$DATEGIVEN</td>
<td>$COST</td>
</tr>
BODY$$

$$FOOTER
<h3>Total: {SUM.Cost}</h3>
FOOTER$$
