This repository has been archived by the owner on Aug 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
report.php
103 lines (89 loc) · 3.35 KB
/
report.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
/*
* report.php
* Contains the main reporting page of the EG
*
* Copyright 2011-2015 Community Legal Services
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**************************************************/
require_once("config.php");
require_once("Arrest.php");
require_once("ArrestSummary.php");
require_once("Person.php");
require_once("Attorney.php");
require_once("utils.php");
require_once("Case.php");
include('head.php');
include('header.php');
?>
<div class="main">
<div class="content-left"> </div>
<div class="content-center">
<?php
// if the user isn't logged in, then don't display this page. Tell them they need to log in.
if (!isLoggedIn())
include("displayNotLoggedIn.php");
else
{
$attorney = new Attorney($_SESSION["loginUserID"], $db);
if($GLOBALS['debug'])
$attorney->printAttorneyInfo();
// only certain users can see this page
if ($attorney->getUserLevel() != 1)
print "You must have permission to view this page.";
else
{
// first, do a query of all expungements
$query = "SELECT expungement.*, userinfo.*, arrest.*, defendant.firstName as dFirst, defendant.lastName as dLast from expungement LEFT JOIN userinfo on (expungement.userid = userinfo.userid) LEFT JOIN arrest on (expungement.arrestID = arrest.arrestID) LEFT JOIN defendant on (arrest.defendantID = defendant.defendantID)";
$result = $db->query($query);
if (!$result)
{
if ($GLOBALS['debug'])
die('Could not get the Expungement Information from the DB:' . $db->error);
else
die('Could not get the Expungement Information from the DB');
}
print <<<END
<table>
<th>Docket Number</th><th>PDF</th><th>Defendant Name</th><th>Attorney Name</th><th>Date Prepared</th><th>Charges Redacted</th><th>Type</th><th>Costs Owed</th><th>Bail Owed</th>
END;
while ($row = $result->fetch_assoc())
{
$redactionType = getRedactionType($row['isExpungement'],$row['isRedaction'],$row['isSummaryExpungement']);
print "<tr>";
print "<td><a href='showCase.php?id={$row['expungementID']}'>{$row['docketNumRelated']}</a></td>";
// only show the pdf link if one exists
if (doesPDFExistForCaseId($row['expungementID']))
print "<td><a href='displayPDF.php?id={$row['expungementID']}'><img src='images/pdf_icon.png'></a></td>";
else
print "<td> </td>";
print "<td>{$row['dFirst']} {$row['dLast']} </td>";
print "<td>{$row['firstName']} {$row['lastName']} </td>";
print "<td>{$row['timestamp']}</td>";
print "<td>{$row['numRedactableCharges']}</td>";
print "<td>$redactionType</td>";
print "<td>$" . number_format($row['costsTotal'] - $row['bailTotal'],2) . "</td>";
print "<td>$" . number_format($row['bailTotalToal'],2) . "</td>";
print "</tr>";
}
$result->close();
}
}
?>
</div> <!-- content-center -->
<div class="content-right"><?php // include right column? ?></div>
</div>
<?php
include ('foot.php');
?>