Licenses issued between two dates by jurisdiction
###
Animal Control
###
34016/Any rev04
###
Licenses that were issued between the two dates given by jurisdiction
###
en
###
SELECT
ol.LicenceNumber,
lt.LicenceTypeName,
j.JurisdictionName, 
a.AnimalName, a.ID AS AID,
ol.OwnerID, o.OwnerName, o.ID AS OID, o.OwnerAddress, o.OwnerTown, o.OwnerCounty, o.OwnerPostcode,
o.HomeTelephone, o.WorkTelephone, o.MobileTelephone, o.EmailAddress,
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 
LEFT OUTER JOIN jurisdiction j ON j.ID = o.JurisdictionID
WHERE ol.IssueDate >= '$ASK DATE Enter the from date$'
AND ol.IssueDate <= '$ASK DATE Enter the to date$'
ORDER BY j.JurisdictionName, ol.IssueDate
###
$$HEADER
HEADER$$

$$GROUP_JurisdictionName
$$HEAD
<h2>$JurisdictionName</h2>
<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>
$$FOOT
</tbody>
</table>
<p>Total $JurisdictionName: {COUNT.JurisdictionName}</p>
GROUP$$

$$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
FOOTER$$

