Example #1
0
 function saveChanges()
 {
     global $db;
     $query = 'UPDATE ' . Config::dbSurveyData() . '_lab SET ';
     $query .= 'barcode = aes_encrypt("' . prepareDatabaseString($this->getBarcode()) . '", "' . Config::labKey() . '"), ';
     $query .= 'labbarcode = aes_encrypt("' . prepareDatabaseString($this->getLabBarcode()) . '", "' . Config::labKey() . '"), ';
     $query .= 'consent1 = "' . prepareDatabaseString($this->getConsent1()) . '",';
     $query .= 'consent2 = "' . prepareDatabaseString($this->getConsent2()) . '", ';
     $query .= 'consent3 = "' . prepareDatabaseString($this->getConsent3()) . '", ';
     $query .= 'consent4 = "' . prepareDatabaseString($this->getConsent4()) . '", ';
     $query .= 'consent5 = "' . prepareDatabaseString($this->getConsent5()) . '",  ';
     $query .= 'refusal = "' . prepareDatabaseString($this->getRefusal()) . '",  ';
     $query .= 'refusalreason = "' . prepareDatabaseString($this->getRefusalReason()) . '",  ';
     $query .= 'refusaldate = "' . prepareDatabaseString($this->getRefusalDate()) . '",  ';
     $query .= 'cd4res = "' . prepareDatabaseString($this->getCD4res()) . '", ';
     $query .= 'cd4date = "' . prepareDatabaseString($this->getCD4date()) . '", ';
     $query .= 'survey = "' . prepareDatabaseString($this->getSurvey()) . '", ';
     $query .= 'measures = "' . prepareDatabaseString($this->getMeasures()) . '", ';
     $query .= 'vision = "' . prepareDatabaseString($this->getVision()) . '", ';
     $query .= 'anthropometrics = "' . prepareDatabaseString($this->getAnthropometrics()) . '", ';
     $query .= 'requestform = "' . prepareDatabaseString($this->getRequestForm()) . '", ';
     $query .= 'urid = "' . prepareDatabaseString($this->getUrid()) . '", ';
     $query .= 'labvisitts = "' . prepareDatabaseString($this->getLabVisitTs()) . '", ';
     $query .= 'fielddbsshipmentdate = "' . prepareDatabaseString($this->getFieldDBSShipmentDate()) . '", ';
     $query .= 'fielddbsreceiveddate = "' . prepareDatabaseString($this->getFieldDBSReceivedDate()) . '", ';
     $query .= 'fielddbscollecteddate = "' . prepareDatabaseString($this->getFieldDBSCollectedDate()) . '", ';
     $query .= 'fielddbsshipmentreturneddate = "' . prepareDatabaseString($this->getFieldDBSReceivedDateFromLab()) . '", ';
     $query .= 'fielddbsclinicresultsissueddate = "' . prepareDatabaseString($this->getFieldDBSClinicResultsIssued()) . '", ';
     $query .= 'fielddbsstatus =  "' . prepareDatabaseString($this->getFieldDBSStatus()) . '", ';
     $query .= 'labdbslocation =  "' . prepareDatabaseString($this->getLabDBSLocation()) . '", ';
     $query .= 'labdbsposition =  "' . prepareDatabaseString($this->getLabDBSPosition()) . '", ';
     $query .= 'labbloodstatus =  "' . prepareDatabaseString($this->getLabBloodStatus()) . '", ';
     $query .= 'labbloodshipmentdate =  "' . prepareDatabaseString($this->getLabBloodShipmentDate()) . '", ';
     $query .= 'labbloodshipmentreturneddate =  "' . prepareDatabaseString($this->getLabBloodReceivedDateFromLab()) . '", ';
     $query .= 'labbloodlocation =  "' . prepareDatabaseString($this->getLabBloodLocation()) . '", ';
     $query .= 'labbloodposition =  "' . prepareDatabaseString($this->getLabBloodPosition()) . '", ';
     $query .= 'labbloodsenttolab = "' . prepareDatabaseString($this->getLabBloodSentToLab()) . '", ';
     $query .= 'labbloodnotcollected = "' . prepareDatabaseString($this->getLabBloodNotCollected()) . '", ';
     $query .= 'consenturid = "' . prepareDatabaseString($this->getConsentUrid()) . '", ';
     $query .= 'consentts = "' . prepareDatabaseString($this->getConsentTs()) . '" ';
     $query .= 'WHERE primkey = "' . prepareDatabaseString($this->getPrimkey()) . '"';
     //echo '<br/><br/><br/>' . $query;
     $db->executeQuery($query);
 }
Example #2
0
 function showLabBloodOverviewRes()
 {
     ob_clean();
     $box = loadvar('stb');
     $rack = loadvar('str');
     $shelf = loadvar('sts');
     $freezer = loadvar('stf');
     $atPosition = array();
     $lab = new Lab(null);
     $tests = $lab->getBloodTests();
     global $db;
     $query = 'select labbloodposition, labbloodsenttolab, labbloodnotcollected, labvisitts, aes_decrypt(labbarcode, "' . Config::labKey() . '") as labbarcode from ' . Config::dbSurveyData() . '_lab where labbloodlocation = "' . $box . '~' . $rack . '~' . $shelf . '~' . $freezer . '"';
     $result = $db->selectQuery($query);
     if ($result != null) {
         while ($row = $db->getRow($result)) {
             $start = $row['labbloodposition'];
             $senttolab = explode('~', $row['labbloodsenttolab']);
             $notcollected = explode('~', $row['labbloodnotcollected']);
             foreach ($tests as $key => $test) {
                 $atPosition[$start][0] = $row['labbarcode'];
                 $atPosition[$start][1] = $row['labbarcode'] . ':' . sprintf("%0" . 2 . "d", $key);
                 $atPosition[$start][2] = substr($row['labvisitts'], 0, 10);
                 //date
                 $atPosition[$start][3] = $test[1];
                 //ML
                 $atPosition[$start][4] = $test[0];
                 //ML
                 $atPosition[$start][5] = '';
                 //sent to lab
                 $atPosition[$start][6] = '';
                 //not collected
                 if ($senttolab[$key] != '') {
                     $atPosition[$start][5] = $senttolab[$key];
                     //'aaaa'; //sent to lab
                 }
                 if ($notcollected[$key] != '') {
                     $atPosition[$start][6] = $notcollected[$key];
                     //'aaaa'; //sent to lab
                 }
                 $start++;
             }
         }
     }
     echo '<html><body>';
     echo '<table border=0 width=900px ><tr><td valign=top>';
     echo '<table>';
     echo '<tr><td width=550px><b>HAALSI Container Report</b></td><td width=140px>10 X 10 Box</td><td align=right>Legend</td></tr>';
     echo '<tr><td><b>FREEZER ' . $freezer . '/SHELF ' . $shelf . '/RACK ' . $rack . '/BOX' . $box . '</td><td align=right colspan=2><nobr>Created on ' . date('Y-m-d H:i:s') . '</td></tr>';
     echo '</table>';
     echo '</td><td align=right width=120px>';
     echo '<table style="height:55px;" width=100% border=1 cellspacing=0 cellpadding=0><tr><td><table border=0 width=100%>';
     echo '<tr><td><font style="font-size:9px">barcode</font></td><td align=right><font style="font-size:9px">spec barcode</font></td></tr>';
     echo '<tr><td><font style="font-size:9px">type</font></td><td align=right><font style="font-size:9px">&nbsp;</font></td></tr>';
     echo '<tr><td><font style="font-size:9px">harv date</font></td><td align=right><font style="font-size:9px">&nbsp;</font></td></tr>';
     echo '<tr><td><font style="font-size:9px">volume</font></td><td align=right><font style="font-size:9px">coord</font></td></tr>';
     echo '</table></td></tr></table>';
     echo '</td></tr>';
     echo '</table>';
     $i = 1;
     echo '<table width=900px border=1 cellspacing=5 cellpadding=0>';
     for ($row = 1; $row <= 10; $row++) {
         echo '<tr>';
         for ($col = 1; $col <= 10; $col++) {
             echo '<td width=10% style="height:55px">';
             echo '<table style="height:55px" width=100% border=0 cellspacing=0 cellpadding=0>';
             if ($atPosition[$i][6] != '') {
                 //not collected
                 echo '<tr><td align=center valign=center><font style="font-weight: bold; font-size:32px; color:blue">N</font></td></tr><tr><td><font style="font-size:9px">' . $atPosition[$i][5] . '</font></td></tr>';
             } elseif ($atPosition[$i][5] != '') {
                 //send to lap
                 echo '<tr><td align=center valign=center><font style="font-weight: bold; font-size:32px; color:red">X</font></td></tr><tr><td><font style="font-size:9px">' . $atPosition[$i][5] . '</font></td></tr>';
             } else {
                 echo '<tr style="height:12px"><td><font style="font-size:9px">';
                 if (isset($atPosition[$i])) {
                     echo $atPosition[$i][0];
                 }
                 echo '</td><td align=right><font style="font-size:9px">';
                 if (isset($atPosition[$i])) {
                     echo $atPosition[$i][1];
                 }
                 echo '</font></td></tr>';
                 echo '<tr style="height:12px"><td colspan=2><font style="font-size:9px">';
                 if (isset($atPosition[$i])) {
                     echo $atPosition[$i][4];
                 }
                 echo '</font></td></tr>';
                 echo '<tr style="height:12px"><td colspan=2><font style="font-size:9px"><nobr>';
                 if (isset($atPosition[$i])) {
                     echo $atPosition[$i][2];
                 }
                 echo '</font></td></tr>';
                 echo '<tr style="height:12px"><td><font style="font-size:9px">';
                 if (isset($atPosition[$i])) {
                     echo $atPosition[$i][3];
                 }
                 echo '</font></td><td align=right><font style="font-size:9px">' . sprintf("%0" . 3 . "d", $i) . '</font></td></tr>';
             }
             echo '</table>';
             echo '</td>';
             $i++;
         }
         echo '</tr>';
     }
     echo '</table>';
     echo '</body></html>';
     exit;
 }