summaryrefslogtreecommitdiff
path: root/daily_run_report.php
blob: 8cab7e9d4cdb22b15f64ef9c05ef0fdddc2b7e66 (plain)
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
<?php

echo <<<HTML
<!DOCTYPE html>

<html>
<head>
	<title>Miami-Dade Clerk of Courts: Daily run report</title>
	<link rel='stylesheet' media='all' type='text/css' href='style.css' />
</head>

<body>

<h3>MDCC daily run report</h3>
HTML;

$dbh = new PDO('mysql:host=localhost;dbname=mdcc', 'mdcc', 'Mdcc.');

for ( $i=0; $i<7; $i++ ) {
	$this_day = date("Y-m-d", strtotime("-{$i} days"));
	$pretty_day = date("l, F j, Y", strtotime("-{$i} days"));
	$sql_first_run = "SELECT count(court_case_no) AS cnt FROM cases WHERE DATE(date_entered) = '{$this_day}' AND TIME(date_entered) < '22:00:00'";
	$sql_second_run = "SELECT count(court_case_no) AS cnt FROM cases WHERE DATE(date_entered) = '{$this_day}' AND TIME(date_entered) >= '22:00:00'";

	$st_first_run = $dbh->prepare($sql_first_run);
	if ( $st_first_run->execute() ) {
		$first_run_count = $st_first_run->fetchColumn();
	}
	$st_second_run = $dbh->prepare($sql_second_run);
	if ( $st_second_run->execute() ) {
		$second_run_count = $st_second_run->fetchColumn();
	}

	echo <<<HTML
<div class="pull">
	<div>$pretty_day:</div>
	<div class="pull_count">Noon pull: {$first_run_count}</div>
	<div class="pull_count">6PM pull: {$second_run_count}</div>
</div>
HTML;

}

echo <<<HTML
</body>
</html>
HTML;

?>