function updateSuppressionStatus() { global $db; $date_cond = "UNIX_TIMESTAMP(r.created)<=1459457999"; //$date_cond is quivalent to 2016-03-01 23:59:59 $spprssn_cond = validCases() . " AND " . suppressedCases(1); $unspprssn_cond = validCases() . " AND " . unSuppressedCases(1); $sql_spprssd = "UPDATE vl_results_merged AS r,vl_samples AS s SET suppressed='YES' \n\t\t \t\t WHERE r.vlSampleID=s.vlSampleID AND {$date_cond} AND {$spprssn_cond};"; $sql_unspprssd = "UPDATE vl_results_merged AS r,vl_samples AS s SET suppressed='NO' \n\t\t \t\t WHERE r.vlSampleID=s.vlSampleID AND {$date_cond} AND {$unspprssn_cond};"; //echo $sql_spprssd."\n"; mysqli_query($db, $sql_spprssd) or die(mysqli_error($db)) . "\n"; mysqli_query($db, $sql_unspprssd) or die(mysqli_error($db)) . "\n"; }
$facilities = facilities(); file_put_contents("../public/json/districts.json", json_encode($districts)); file_put_contents("../public/json/hubs.json", json_encode($hubs)); file_put_contents("../public/json/facilities.json", json_encode($facilities)); $year = 2013; $current_year = date('Y'); $results = []; while ($year <= $current_year) { $samples = getSamples($year); $dbs_samples = getSamples($year, " sampleTypeID=1 "); $trmt_indctn = getTrmtIndctn($year); $rjctn_rsns = getRejects($year); $rjctn_rsns2 = getRejects2($year); $t_rslts = getResults($year); $v_rslts = getResults($year, validCases()); $sprsd_cond = validCases() . " AND " . suppressedCases(); $sprsd = getResults($year, $sprsd_cond); /*echo $t_rslts."\n"; echo $v_rslts."\n"; echo $sprsd."\n"; break;*/ foreach ($samples as $mth => $age_groups) { foreach ($age_groups as $age_group_id => $facilities) { foreach ($facilities as $facility_id => $num) { $data = []; $data["year"] = $year; $data["month"] = $mth; $data["age_group_id"] = $age_group_id; $data["facility_id"] = $facility_id; $data["samples_received"] = $num; $data["dbs_samples"] = isset($dbs_samples[$mth][$age_group_id][$facility_id]) ? $dbs_samples[$mth][$age_group_id][$facility_id] : 0;