Unreturned equipment due between two dates
###
Animal Control
###
33307/Any rev03
###
Unreturned loaned equipment due back between two dates
###
en
###
SELECT
ot.LoanDate, tt.TrapTypeName, ot.TrapNumber, o.OwnerName, o.ID AS OID, ot.DepositAmount, 
ot.ReturnDueDate, ot.Comments
FROM ownertraploan ot
INNER JOIN traptype tt ON tt.ID = ot.TrapTypeID
INNER JOIN owner o ON o.ID = ot.OwnerID
WHERE ot.ReturnDueDate >= '$ASK DATE Enter the from date$'
AND ot.ReturnDueDate <= '$ASK DATE Enter the to date$'
AND ot.ReturnDate Is Null
ORDER BY ot.LoanDate, tt.TrapTypeName, ot.TrapNumber
###
$$HEADER
<table border="1">
<thead>
<tr>
<th>Loaned</th>
<th>Type</th>
<th>Number</th>
<th>Person</th>
<th>Deposit</th>
<th>Due Back</th>
<th>Comments</th>
</tr>
</thead>
<tbody>
HEADER$$

$$BODY
<tr>
<td>$LOANDATE</td>
<td>$TRAPTYPENAME</td>
<td>$TRAPNUMBER</td>
<td><a target="_blank" href="person_traploan?id=$OID">$OWNERNAME</a></td>
<td>$DEPOSITAMOUNT</td>
<td>$RETURNDUEDATE</td>
<td>$COMMENTS</td>
</tr>
BODY$$

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