Active licenses
###
Animal Control
###
33307/Any rev03
###
Currently active licenses
###
en
###
SELECT
ol.LicenceNumber,
lt.LicenceTypeName,
ol.OwnerID, o.OwnerName, o.ID AS OID, o.OwnerAddress, o.OwnerTown, o.OwnerCounty, o.OwnerPostcode,
o.HomeTelephone, o.WorkTelephone, o.MobileTelephone, o.EmailAddress,
a.AnimalName,a.ID AS AID,
ol.IssueDate, ol.ExpiryDate, ol.Comments
FROM ownerlicence ol
INNER JOIN licencetype lt ON lt.ID = ol.LicenceTypeID
INNER JOIN owner o ON o.ID = ol.OwnerID
LEFT OUTER JOIN animal a ON a.ID = ol.AnimalID 
WHERE ol.IssueDate <= '$CURRENT_DATE$' AND ol.ExpiryDate >= '$CURRENT_DATE$' 
ORDER BY ol.IssueDate
###
$$HEADER
<table border="1">
<thead>
<tr>
<th>Number</th>
<th>Type</th>
<th>Person</th>
<th>Animal</th>
<th>Issued</th>
<th>Expires</th>
<th>Comments</th>
</tr>
</thead>
<tbody>
HEADER$$

$$BODY
<tr>
<td>$LICENCENUMBER</td>
<td>$LICENCETYPENAME</td>
<td><a target="_blank" href="person_licence?id=$OID">$OwnerName</a><br/>
$OwnerAddress<br/>
$OwnerTown<br/>
$OwnerCounty<br/>
$OwnerPostcode<br/>
$EmailAddress<br/>
H: $HOMETELEPHONE, W: $WORKTELEPHONE, C: $MOBILETELEPHONE</td>
<td><a target="_blank" href="animal_licence?id=$AID">$ANIMALNAME</a></td>
<td>$ISSUEDATE</td>
<td>$EXPIRYDATE</td>
<td>$COMMENTS</td>
</tr>
BODY$$

$$FOOTER
</tbody>
</table>
FOOTER$$