Unpaid fines
###
Animal Control
###
33307/Any rev03
###
All unpaid fines with totals
###
en
###
SELECT
oc.CitationDate, ct.CitationName, o.OwnerName, o.ID AS OID,
oc.FineDueDate, oc.FinePaidDate, oc.FineAmount
FROM ownercitation oc
INNER JOIN citationtype ct ON ct.ID = oc.CitationTypeID
INNER JOIN owner o ON o.ID = oc.OwnerID 
WHERE oc.FinePaidDate Is Null
ORDER BY ct.CitationName, oc.CitationDate
###
$$HEADER
HEADER$$

$$GROUP_CitationName
$$HEAD
<h2>$CITATIONNAME</h2>
<table border="1">
<thead>
<tr>
<th>Date</th>
<th>Person</th>
<th>Fine</th>
<th>Due</th>
<th>Paid</th>
</tr>
</thead>
<tbody>
$$FOOT
<tr>
<td></td>
<td></td>
<td><b>{SUM.FINEAMOUNT.2}</b></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<h2>Total $CITATIONNAME: {COUNT.CITATIONNAME}</h2>
GROUP$$

$$BODY
<tr>
<td>$CITATIONDATE</td>
<td><a target="_blank" href="person_citations?id=$OID">$OWNERNAME</a></td>
<td>$FINEAMOUNT</td>
<td>$FINEDUEDATE</td>
<td>$FINEPAIDDATE</td>
</tr>
BODY$$

$$FOOTER
<h2>Total fines: {SUM.FINEAMOUNT.2}</h2>
FOOTER$$