ASM SUBREPORT NotebookSheet Vaccinations

From Wiki
Jump to: navigation, search

SQL

(SELECT 
   vt.VaccinationType,
   DATE (av.DateRequired) AS DateRequired,
   DATE (av.DateOfVaccination) AS DateOfVaccination
 FROM  
   animalvaccination AS av
 INNER JOIN 
   vaccinationtype vt ON 
     vt.ID = av.VaccinationID
 WHERE 
   av.AnimalID = $PARENTKEY$
 ORDER BY 
   av.DateRequired     
) 
UNION 
(
 SELECT 
   '(none)',
   '(none)',
   '(none)'
 FROM  
   dual
 WHERE 
   NOT EXISTS 
   (
     SELECT 
       'X'
     FROM 
       animalvaccination
     WHERE 
       AnimalID = $PARENTKEY$
   )
)

HTML

$$HEADER
<h3>Vaccination Record</h3>
<table rules="all" border="1" cellspacing="5" cellpadding="5">
  <tr>
    <th>Vaccination</th>
    <th>Date Required:</th>
    <th>Date Given:</th>
  </tr>
HEADER$$

$$BODY
<tr>
  <td>$VaccinationType</td>
  <td>$DateRequired</td>
  <td>$DateOfVaccination</td>
</tr>
BODY$$

$$FOOTER
</table>
FOOTER$$