Merge branch 'master' of ssh://apples.lambdacomplex.org/git/contractdashboard
[contractdashboard.git] / admin / updateReport.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
<?php
include_once('../lib/common.inc.php');
$query = 'SELECT max(DATE("importDate")) as importday, count(*) as count, min("publishDate") as start, max("publishDate") as end 
FROM contractnotice WHERE "childCN" is null AND "parentCN" is null AND DATE("importDate") in (select * from (SELECT DATE("importDate") 
FROM contractnotice ORDER BY "importDate" DESC limit 1) alias)';
    $result = $conn->query($query);
    $stats = $result->fetch();
echo $stats['count'] . ' new records in period ' . $stats['start'] . '  to ' . $stats['end'] .'<br>';
 
$query = 'SELECT max(DATE("importDate")) as importday, count(*) as count, min("publishDate") as start, max("publishDate") as end 
FROM contractnotice WHERE ("childCN" is not null OR "parentCN" is not null) AND DATE("importDate") in (select * from (SELECT DATE("importDate") 
FROM contractnotice ORDER BY "importDate" DESC limit 1) alias)';
    $result = $conn->query($query);
    $stats = $result->fetch();
echo $stats['count'] . ' updated records in period ' . $stats['start'] . '  to ' . $stats['end'] .'<br>';
 
/*$query = 'SELECT count(*) as count FROM agency WHERE abn = \'0\'';
    $result = $conn->query($query);
    $stats = $result->fetch();
echo $stats['count'] . ' agencies with no ABN<br>';*/
 
echo 'Last updated: '. $stats['importday'].'<br>';
?>