Add netbeans project
Add netbeans project

file:b/.gitignore (new)
--- /dev/null
+++ b/.gitignore
@@ -1,1 +1,3 @@
-
+/admin/neo4jimporter/target/
+/admin/neo4jimporter/.settings/
+/nbproject/private/

--- a/heuristics/dateHeuristics.php
+++ b/heuristics/dateHeuristics.php
@@ -40,10 +40,12 @@
 }
 
 function getStddevAverageContractPeriod() {
-    global $averageContractPeriod, $stddevContractPeriod;
-    $query = "select AVG(dateDiff(contractEnd,contractStart)),stddev(dateDiff(contractEnd,contractStart)) from contractnotice";
+    global $averageContractPeriod, $stddevContractPeriod,$conn;
+    $query = 'select AVG("contractEnd"-"contractStart"),stddev("contractEnd"-"contractStart") from contractnotice';
     $result = $conn->query($query);
+             databaseError($conn->errorInfo());
     $r = $result->fetch(PDO::FETCH_BOTH);
+
     $averageContractPeriod = $r[0];
     $stddevContractPeriod = $r[1];
 }
@@ -94,11 +96,13 @@
 
 function getDaysLate() {
 
-    global $averageDaysLate, $stddevDaysLate;
+    global $averageDaysLate, $stddevDaysLate,$conn;
 
-    $query = "select AVG(dateDiff(publishDate,contractStart)), STDDEV(dateDiff(publishDate,contractStart)) from contractnotice";
+    $query = 'select AVG(extract (day from "publishDate"-"contractStart")), STDDEV(extract (day from "publishDate"-"contractStart")) from contractnotice';
     $result = $conn->query($query);
+          databaseError($conn->errorInfo());
     $r = $result->fetch(PDO::FETCH_BOTH);
+
     $averageDaysLate = $r[0];
     $stddevDaysLate = $r[1];
 }

--- a/heuristics/heuristics.inc.php
+++ b/heuristics/heuristics.inc.php
@@ -8,9 +8,11 @@
 //include ("valueHeuristics.php");
 function runHeuristic($heuristicName, $cn)
 {
+    global $conn;
 	// check  if already ran
-	$query = "select count(*) from heuristic_results where heuristic_name = '$heuristicName' and CNID = '{$cn['CNID']}'";
+	$query = "select count(*) from heuristic_results where heuristic_name = '$heuristicName' and \"CNID\" = '{$cn['CNID']}'";
 	    $result = $conn->query($query);
+             databaseError($conn->errorInfo());
     $r = $result->fetch(PDO::FETCH_BOTH);
 	if ($r[0] == 0) {
 		// if not, run now

--- a/heuristics/runHeuristics.php
+++ b/heuristics/runHeuristics.php
@@ -1,12 +1,10 @@
 <?php
 include_once("heuristics.inc.php");
-$query = "SELECT *, agency.abn as agencyABN, IF(supplierABN != '',supplierABN,supplierName) as supplierID
-FROM contractnotice JOIN agency ON contractnotice.agencyName=agency.agencyName";
 
-$query = "SELECT *, agency.abn as agencyABN, IF(supplierABN != '',supplierABN,supplierName) as supplierID
-FROM contractnotice JOIN agency ON contractnotice.agencyName=agency.agencyName
-WHERE  DATE(importDate) = (select * from (SELECT DATE(importDate) 
-FROM contractnotice ORDER BY importDate DESC limit 1) alias)";
+$query = 'SELECT *, agency.abn as "agencyABN", case when "supplierABN" != 0 then "supplierABN"::text else "supplierName" end as "supplierID"
+FROM contractnotice JOIN agency ON contractnotice."agencyName"=agency."agencyName"
+WHERE  DATE("importDate") = (select * from (SELECT DATE("importDate") 
+FROM contractnotice ORDER BY "importDate" DESC limit 1) alias) limit 10';
     $query = $conn->prepare($query);
     $query->execute();
     databaseError($conn->errorInfo());

--- /dev/null
+++ b/nbproject/project.properties
@@ -1,1 +1,8 @@
+include.path=${php.global.include.path}
+php.version=PHP_5
+source.encoding=UTF-8
+src.dir=.
+tags.asp=false
+tags.short=true
+web.root=.
 

--- /dev/null
+++ b/nbproject/project.xml
@@ -1,1 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.php.project</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/php-project/1">
+            <name>contractdashboard</name>
+        </data>
+    </configuration>
+</project>