Fix CN frequency distribution graph
[contractdashboard.git] / lib / graphs.inc.php
blob:a/lib/graphs.inc.php -> blob:b/lib/graphs.inc.php
--- a/lib/graphs.inc.php
+++ b/lib/graphs.inc.php
@@ -27,7 +27,11 @@
             var d1 = [];
             var d2 = [];
     <?php
-    $query = 'select cnid, count(*) from (select ("CNID" - MOD("CNID",100)) as cnid from contractnotice where "CNID" < 999999 and "parentCN" is null) as a group by cnid order by cnid';
+    $query = 'select cnid, count(*) from 
+        (select ("CNID"::integer - MOD("CNID"::integer,100)) as cnid 
+        from contractnotice where "CNID"::integer < 999999 
+        and "CNID" not like \'%-A%\' 
+        and "parentCN" is null) as a group by cnid order by cnid';
     $query = $conn->prepare($query);
     $query->execute();
     $errors = $conn->errorInfo();
@@ -40,7 +44,9 @@
 
         echo "d1.push([ " . intval($delta['cnid']) . ", " . intval($delta['count']) . "]); \n";
     };
-    $query = 'select cnid, count(*) from (select ("CNID" - MOD("CNID",100)) as cnid from contractnotice where "CNID" < 999999 and "parentCN" is not null) as a group by cnid order by cnid';
+    $query = 'select cnid, count(*) from (select ("CNID"::integer - MOD("CNID"::integer,100)) as cnid
+        from contractnotice where "CNID" not like \'%-A%\' and "parentCN" is not null) 
+        as a group by cnid order by cnid';
     $query = $conn->prepare($query);
     $query->execute();
     $errors = $conn->errorInfo();
@@ -71,7 +77,7 @@
                         points: { show: true }
                     },
                     bars: { show: true }
-                },
+                }]
             ];
             var options = 
                 {