ASM SUBREPORT NotebookSheet AnimalDetails

From Wiki
Jump to navigationJump to search

SQL

SELECT
  a.ID,
  a.ShortCode,
  a.AnimalName,
  (SELECT Sex FROM lksex WHERE ID = a.Sex) AS TheSex,
  (SELECT Name FROM lksyesno WHERE ID = a.Neutered) AS Altered,
  (SELECT BaseColour FROM basecolour WHERE ID = a.BaseColourID) AS BaseColour,
  (SELECT CoatType FROM lkcoattype WHERE ID = a.CoatType) AS CoatType,
  (SELECT Size FROM lksize WHERE ID = a.Size) AS Size,
  (SELECT BreedName FROM breed WHERE ID = a.BreedID) AS BreedName,
  (SELECT LocationName FROM internallocation WHERE ID = a.ShelterLocation) AS LocationName,
  DATE (a.DateOfBirth) AS DateOfBirth,
  a.AnimalAge,
  IF (LENGTH (a.AnimalComments), 
              a.AnimalComments, 
              '(None)') AS AnimalComments,
  a.IdentichipNumber AS xIdentichipNumber,
  (SELECT Name FROM lksyesno WHERE ID = a.Tattoo) AS Tattooed,
  (SELECT Name FROM lksyesno WHERE ID = a.HeartwormTested) AS HeartwormTested,
  (SELECT Name FROM lksposneg WHERE ID = a.HeartwormTestResult) AS HeartwormTestResult
FROM 
  animal AS a
WHERE 
  a.ID = $PARENTKEY$

HTML

$$HEADER
<h3>Animal Details</h3>
<img src={IMAGE.$ID} align="right" width="320" height="200" />
<table rules="all" border="1" cellspacing="5" cellpadding="5">
HEADER$$

$$BODY
<tr>
  <td><b>Code:</b></td>
  <td>$ShortCode</td>
  <td><b>Name:</b></td>
  <td>$AnimalName</td>
</tr>
<tr>
  <td><b>Sex:</b></td>
  <td>$TheSex</td>
  <td><b>Altered:</b></td>
  <td>$Altered</td>
</tr>
<tr>
  <td><b>Base Color:</b</td>
  <td>$BaseColour</td>
  <td><b>Coat Type:</b></td>
  <td>$CoatType</td>
</tr>
<tr>
  <td><b>Breed:</b></td>
  <td>$BreedName</td>
  <td><b>Size:</b></td>
  <td>$Size</td>
</tr>
<tr>
  <td><b>Location:</b></td>
  <td>$LocationName</td>
  <td><b>Date Of Birth:</b></td>
  <td>$DateOfBirth ($AnimalAge)</td>
</tr>
<tr>
  <td><b>Comments:</b></td>
  <td colspan="3">$AnimalComments</td>
</tr>
<tr>
  <td><b>Microchipped:</b></td>
  <td>$xIdentichipNumber</td>
  <td><b>Tattooed</b></td>
  <td>$Tattooed</td>
</tr>
<tr>
  <td><b>Heartworm Tested:</b></td>
  <td>$HeartwormTested</td>
  <td><b>Heartworm Result:</b></td>
  <td>$HeartwormTestResult</td>
</tr>
BODY$$

$$FOOTER
</table>
FOOTER$$