Exemplo n.º 1
0
/**
* OPERATIONS STAFF FUNCTIONS
*/

function getSubordinateOperationsStaff($supervisor) {
	$query=0;
	$query=mysqlquery("select id from vl_users where reportsTo='$supervisor'");
	if(mysqlnumrows($query)) {
		$staff=array();
		while($q=mysqlfetcharray($query)) {
			$staff[]=$q["id"];
		}
		return $staff;
	}
}
echo $suspectedTreatmentFailureValue;
?>
" class="search_pre" size="7" maxlength="10" /></td>
                              <td align="right">Sample&nbsp;Type:</td>
                              <td style="padding:0px 0px 0px 5px">
								<select name="suspectedTreatmentFailureSampleTypeID" id="suspectedTreatmentFailureSampleTypeID" class="search">
                                <?
								$query=0;
								$query=mysqlquery("select * from vl_appendix_sampletype order by position");
								if($suspectedTreatmentFailureSampleTypeID) {
									echo "<option value=\"$suspectedTreatmentFailureSampleTypeID\" selected=\"selected\">".getDetailedTableInfo2("vl_appendix_sampletype","id='$suspectedTreatmentFailureSampleTypeID' limit 1","appendix")."</option>";
								} else {
									echo "<option value=\"\" selected=\"selected\">Select Sample Type</option>";
								}
								if(mysqlnumrows($query)) {
									while($q=mysqlfetcharray($query)) {
										echo "<option value=\"$q[id]\">$q[appendix]</option>";
									}
								}
								?>
                                </select>
                              </td>
                            </tr>
						</table>
                        </div>
                </fieldset>
              </td>
            </tr>
            <? //if(!getDetailedTableInfo2("vl_samples_verify","sampleID='$modify'","outcome")) { ?>
            <tr>
              <td style="padding:10px 0px 0px 0px">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
		<title>Viral Load</title>
		<link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">
		<link href="/css/vl2.css" rel="stylesheet" type="text/css">

		<script src="/js/jquery-2.1.3.min.js"></script>
		<script src="/bootstrap/js/bootstrap.min.js"></script>
		<script src="/js/jquery.qrcode.min.js" type="text/javascript"></script>
	</head>
	<body>
		<div id="print-btn-div" style='text-align:center; padding:20px;'><button id="print-btn" class='btn btn-primary' >PRINT</button></div>
	
		<?php 
$row = mysqlfetcharray($results);
extract($row, EXTR_PREFIX_ALL, "row");
$machine_type = $row_machineType;
$factor = $row_factor;
$signature_path = $row_signaturePATH;
include "_sample_print.php";
if ($row_verify_outcome == "Rejected") {
    mysqlquery("insert into vl_logs_printedrejectedresults \n\t\t\t\t\t    (sampleID, created, createdby ) \n\t\t\t\t\t    values ('{$row_id}', '{$datetime}', '{$trailSessionUser}') ");
} elseif (!empty($row_worksheetID)) {
    mysqlquery("insert into vl_logs_printedresults \n\t\t\t\t\t\t(sampleID,worksheetID,created,createdby) \n\t\t\t\t\t\tvalues ('{$row_id}','{$row_worksheetID}','{$datetime}','{$trailSessionUser}');");
}
?>

		<script type="text/javascript">
		jQuery(function(){
			jQuery('.qrcode-output').each(function (index){
<?php

$GLOBALS['vlDC'] = true;
include "conf.php";
$sql = " SELECT s.id AS s_id, lrCategory, lrEnvelopeNumber, lrNumericID, vlSampleID, formNumber  \n\t   FROM vl_samples AS s\n\t   WHERE (formNumber LIKE '%{$q}%') \n\t   LIMIT 10";
$res = mysqlquery($sql);
$str = "<table width=100%>";
$str .= "<tr><th>VL Testing #</th><th> Form Number</th><th>Location ID</th></tr>";
while ($row = mysqlfetcharray($res)) {
    extract($row);
    $link = "href=\"javascript:windPop('/sample_results/print/{$s_id}/')\"";
    $l_smpl_id = "<a {$link}>{$vlSampleID}</a>";
    $l_form = "<a {$link}>{$formNumber}</a>";
    $l_locator = "<a {$link}>{$lrCategory}{$lrEnvelopeNumber}{$lrNumericID}</a>";
    $str .= "<tr><td>{$l_smpl_id}</td><td>{$l_form}</td><td>{$l_locator}</td></tr>";
}
$str .= "</table>";
echo $str;
Exemplo n.º 5
0
/**
* function to fix repeated samples in the VL database
*/
function fixDuplicateSampleIDs() {
	global $datetime,$trailSessionUser;
	//get any duplicate sample IDs
	$query=0;
	$query=mysqlquery("select vlSampleID,count(id) num from vl_samples group by vlSampleID having num>1 order by num desc");
	if(mysqlnumrows($query)) {
		while($q=mysqlfetcharray($query)) {
			//query where vlSampleID=$q[vlSampleID]
			$queryS=0;
			$queryS=mysqlquery("select * from vl_samples where vlSampleID='$q[vlSampleID]' order by created");
			$count=0;
			while($qS=mysqlfetcharray($queryS)) {
				$count+=1;
				//only change the 2nd vlSampleID onwards
				if($count>1) {
					$vlSampleArray=0;
					$vlSampleArray=explode("/",trim($q["vlSampleID"]));
					
					$sampleLength1=0;
					$sampleLength1=strlen($vlSampleArray[0]);
					$sampleLength2=0;
					$sampleLength2=strlen(($vlSampleArray[0]/1)+($count-1));
					$sampleLengthFinal=0;
					$sampleLengthFinal=abs($sampleLength1-$sampleLength2);
					
					$vlSample1=0;
					$vlSample1=($vlSampleArray[0]/1)+($count-1);
					switch($sampleLengthFinal) {
						case "5":
							$vlSample1="00000".$vlSample1;
						break;
						case "4":
							$vlSample1="0000".$vlSample1;
						break;
						case "3":
							$vlSample1="000".$vlSample1;
						break;
						case "2":
							$vlSample1="00".$vlSample1;
						break;
						case "1":
							$vlSample1="0".$vlSample1;
						break;
					}
					
					$vlSampleID=0;
					$vlSampleID=$vlSample1."/".$vlSampleArray[1];
					//update vl_samples
					mysqlquery("update vl_samples set vlSampleID='$vlSampleID' where id='$qS[id]'");
				}
			}
		}
	}
}
Exemplo n.º 6
0
/**
* function to get specific countries from a region
* @param: $region e.g. africa, south america etc
*/
function loadCountriesFromRegion($region,$companyID) {
	if($region) {
		global $user;
	
		$theUserID=0;
		//ensure $user is not a visitor
		if(substr($user,0,7)!="visitor") {
			$theUserID=getUserID($user);
		}
	
		//get the towns first
		$query=0;
		$query=mysqlquery("select distinct countryID,country from vl_countries where region='$region' order by country");
		if(mysqlnumrows($query)) {
			$return=0;
			$return="
				<table width=\"100%\" border=\"0\">
				  <tr>
					<td colspan=\"2\">Select the markets covered:</td>
				  </tr>";
			$q=array();
			while($q=mysqlfetcharray($query)) {
				$return.="
						<tr>
							<td width=\"1%\"><input type=\"checkbox\" name=\"marketscoveredUnique[]\" value=\"$q[countryID]\" ".(checkMarketAgainstProvider($theUserID,$q["countryID"],$companyID)?"checked":"")."></td>
							<td width=\"99%\">$q[country]</td>
						</tr>";
			}
			$return.="</table>";
	
			return $return;
		} else {
			$return=0;
			$return="No countries found in database!";
	
			return $return;
		}
	}
}
Exemplo n.º 7
0
/**
* get data for removal
* @param: $query
*/
function getRemovedData($query) {
	//removed data
	$removedData="";
	
	//get the table name, usually the 3rd word in the query
	$wordInQuery=array();
	$wordInQuery=explode(" ",$query);
	$tableName=0;
	$tableName=$wordInQuery[2];
	
	//get fields in table
	$tableQuery=0;
	$tableQuery=mysqlquery("desc $tableName");
	if(mysqlnumrows($tableQuery)) {
		$fieldsInTable=array();
		while($row=mysqlfetcharray($tableQuery)) {
			$fieldsInTable[]=$row["Field"];
		}
	}
	
	//switch statement from "delete from" to "select * from"
	$newQuery=0;
	$newQuery=preg_replace("/delete from/is","select * from",$query);
	
	//ran the select query
	$selectQuery=0;
	$selectQuery=mysqlquery($newQuery);
	if(mysqlnumrows($selectQuery) && count($fieldsInTable)) {
		for($i=0;$i<count($fieldsInTable);$i++) {
			$removedData.="$fieldsInTable[$i]::".mysqlresult($selectQuery,0,"$fieldsInTable[$i]").($i<(count($fieldsInTable)-1)?"|":"");
		}
	}
	
	//return
	return $removedData;
}
Exemplo n.º 8
0
function sendPlainEmail2Admins($from,$fromName,$subject,$title,$message) {
	global $home_url;
	global $mail;
	global $user;

	//query admins
	$query=0;
	$query=mysqlquery("select email from vl_admins");
	$q=array();
	while($q=mysqlfetcharray($query)) {
		queMail($fromName,$from,$q["email"],$subject,$message,0);
	}
}
Exemplo n.º 9
0
//should we send the password to an email?
if($remindEmail) {
	resetPassword($remindEmail);
	go("/sentreminder/$remindEmail/");
}

if($login && $email && $pass) {
	//validate
	$email=validate($email);
	
	//authenticate
	$u=0;
	$u=mysqlquery("select * from vl_users where lower(email)='".strtolower($email)."'");
	if(mysqlnumrows($u)) {
		while($un=mysqlfetcharray($u)) {
			if(strtolower($email)==strtolower($un["email"])) {
				//email authentic
				if(vlSimpleDecrypt($un["xp"])==hash("sha256",$pass)) {
					//has this account been de-activated?
					if(!$un["active"]) {
						go("/login/in/");
					} else {
						//register session variables
						$_SESSION["VLEMAIL"]=$email;
						//log
						mysqlquery("update vl_users set lastLogin='******' where email='$_SESSION[VLEMAIL]'");
						//redirect
						go("/dashboard/welcome/");
					}
				} else {
Exemplo n.º 10
0
/**
* function to check the client number
* @param: $clientnumber
* @param: $formname
* @param: $id
* @param: $customertype
* @param: $version
*/
function getUserInfoByClientNumber($clientNumber,$column) {
	global $datetime,$trailSessionUser;
	
	//flag
	$datafound=0;
    
    //prepare all relevant variables
    $data=0;
    
	//start by searching clientNumber in vl_profile_customers
	$query=0;
	$query=mysqlquery("select $column from vl_profiles_customers where clientNumber='$clientNumber' order by created desc");
	if(mysqlnumrows($query)) {
		//flag
		$datafound=1;
        //get data
        $q=array();
        while($q=mysqlfetcharray($query)) {
            $data=($data?$data:$q["$column"]);
        }
	}
    
	//then search ClientNumber in vl_datacap111
	if($column!="ClientAdviceNoticeFlag") {
		$query=0;
		$query=mysqlquery("select $column from vl_datacap111 where ClientNumber='$clientNumber' order by created desc");
		if(mysqlnumrows($query)) {
			//flag
			$datafound=1;
			//get data
			$q=array();
			while($q=mysqlfetcharray($query)) {
				$data=($data?$data:$q["$column"]);
			}
		}
	}
    
	//then search ClientNumber in vl_datacba111
	$query=0;
	$query=mysqlquery("select $column from vl_datacba111 where ClientNumber='$clientNumber' order by created desc");
	if(mysqlnumrows($query)) {
		//flag
		$datafound=1;
        //get data
        $q=array();
        while($q=mysqlfetcharray($query)) {
            $data=($data?$data:$q["$column"]);
        }
	}
    
	//then search ClientNumber in vl_databc111
	if($column!="ClientAdviceNoticeFlag" && $column!="ClientConsentFlag") {
		$query=0;
		$query=mysqlquery("select $column from vl_databc111 where ClientNumber='$clientNumber' order by created desc");
		if(mysqlnumrows($query)) {
			//flag
			$datafound=1;
			//get data
			$q=array();
			while($q=mysqlfetcharray($query)) {
				$data=($data?$data:$q["$column"]);
			}
		}
	}
    
	if($column!="ClientAdviceNoticeFlag") {
		//then search ClientNumber in vl_datacap109
		$query=0;
		$query=mysqlquery("select $column from vl_datacap109 where ClientNumber='$clientNumber' order by created desc");
		if(mysqlnumrows($query)) {
			//flag
			$datafound=1;
			//get data
			$q=array();
			while($q=mysqlfetcharray($query)) {
				$data=($data?$data:$q["$column"]);
			}
		}
	}
    
	//then search ClientNumber in vl_datacba109
	$query=0;
	$query=mysqlquery("select $column from vl_datacba109 where ClientNumber='$clientNumber' order by created desc");
	if(mysqlnumrows($query)) {
		//flag
		$datafound=1;
        //get data
        $q=array();
        while($q=mysqlfetcharray($query)) {
            $data=($data?$data:$q["$column"]);
        }
	}
    
	//then search ClientNumber in vl_databc109
	if($column!="ClientAdviceNoticeFlag" && $column!="ClientConsentFlag") {
		$query=0;
		$query=mysqlquery("select $column from vl_databc109 where ClientNumber='$clientNumber' order by created desc");
		if(mysqlnumrows($query)) {
			//flag
			$datafound=1;
			//get data
			$q=array();
			while($q=mysqlfetcharray($query)) {
				$data=($data?$data:$q["$column"]);
			}
		}
	}
    
	//then search ClientNumber in vl_datacap106
	/*
	$query=0;
	$query=mysqlquery("select $column from vl_datacap106 where ClientNumber='$clientNumber' order by created desc");
	if(mysqlnumrows($query)) {
		//flag
		$datafound=1;
        //get data
        $q=array();
        while($q=mysqlfetcharray($query)) {
            $data=($data?$data:$q["$column"]);
        }
	}
    
	//then search ClientNumber in vl_datacba106
	$query=0;
	$query=mysqlquery("select $column from vl_datacba106 where ClientNumber='$clientNumber' order by created desc");
	if(mysqlnumrows($query)) {
		//flag
		$datafound=1;
        //get data
        $q=array();
        while($q=mysqlfetcharray($query)) {
            $data=($data?$data:$q["$column"]);
        }
	}

	//then search ClientNumber in vl_databc106
	$query=0;
	$query=mysqlquery("select $column from vl_databc106 where ClientNumber='$clientNumber' order by created desc");
	if(mysqlnumrows($query)) {
		//flag
		$datafound=1;
        //get data
        $q=array();
        while($q=mysqlfetcharray($query)) {
            $data=($data?$data:$q["$column"]);
        }
	}
	*/
	return $data;
}
Exemplo n.º 11
0
/**
* remove user images
*/

function removeUserImages($email) {
	$query=0;
	$query=mysqlquery("select * from vl_filenames where createdby='$email'");
	if(mysqlnumrows($query)) {
		$q=array();
		while($q=mysqlfetcharray($query)) {
			if(file_exists($q["filepath"])) {
				unlink($q["filepath"]);
			}
		}
	}
	logDataRemoval("delete from vl_filenames where createdby='$email'");
	mysqlquery("delete from vl_filenames where createdby='$email'");
}
Exemplo n.º 12
0
/**
* function to query a table using the standard $query=mysqlquery("select statement")
* @param: $q
* @param: $field - which field should we return
*/
function queryTableInfo($q,$field) {
	global $trailSessionUser,$p,$a;
	$query=0;
	$query=mysqlquery("$q");
	if(!mysqlerror()) {
		if(mysqlnumrows($query)) {
			$q=array();
			$return=array();
			while($q=mysqlfetcharray($query)) {
				$return[]=$q["$field"];
			}
			return $return;
		}
	} else {
		//log this error
		$errorName=0;
		$errorName="Database Error!";
		$errorDescription=0;
		$errorDescription="<strong>Database error:</strong> ".mysqlerror();
		$errorDescription.="<br><strong>URL:</strong> ".getThisURL();
		$errorDescription.="<br><strong>Page:</strong> $p";
		$errorDescription.="<br><strong>Action:</strong> $a";
		logError($errorName,$errorDescription,"",getUserID($trailSessionUser));
	}
}
Exemplo n.º 13
0
/**
* update application number
*/
function XloadFacilityFromFormName($formnumber,$formName,$fieldID,$facilityIDField) {
	//validate
	$formnumber=validate($formnumber);
	$formName=validate($formName);
	$fieldID=validate($fieldID);
	$facilityIDField=validate($facilityIDField);
	$objResponse = new vlDCResponse();
	//reference number
	$refNumber=0;
	$refNumber=getDetailedTableInfo2("vl_forms_clinicalrequest","formNumber='$formnumber' limit 1","refNumber");
	//facility ID
	$facilityID=0;
	$facilityID=getDetailedTableInfo2("vl_forms_clinicalrequest_dispatch","refNumber='$refNumber' limit 1","facilityID");
	if($facilityID) {
		//load facilities
		$facilities=0;
		$facilities="<select name=\"$fieldID\" id=\"$fieldID\" class=\"search\" onchange=\"getHubDistrict(),checkForHubDistrict(), loadArtHistory(document.$formName.artNumber,document.$formName.facilityID.value)\">";
		$query=0;
		$query=mysqlquery("select * from vl_facilities where facility!='' order by facility");
		$facilities.="<option value=\"$facilityID\" selected=\"selected\">".getDetailedTableInfo2("vl_facilities","id='$facilityID' limit 1","facility")."</option>";
		if(mysqlnumrows($query)) {
			while($q=mysqlfetcharray($query)) {
				$facilities.="<option value=\"$q[id]\">$q[facility]</option>";
			}
		}
		$facilities.="</select>";
		//load responses
		$objResponse->addAssign("$facilityIDField","innerHTML",$facilities);
		$objResponse->addScript("checkForHubDistrict()");
		$objResponse->addScript("loadArtHistory(document.$formName.artNumber,'$facilityID')");
	}
	return $objResponse->getXML();
}
Exemplo n.º 14
0
/**
* function to query a table using the standard $query=mysqlquery("select statement")
* @param: $q
* @param: $field - which field should we return
*/
function queryTableInfo($q,$field) {
	$query=0;
	$query=mysqlquery("$q");
	if(!mysqlerror()) {
		if(mysqlnumrows($query)) {
			$q=array();
			$return=array();
			while($q=mysqlfetcharray($query)) {
				$return[]=$q["$field"];
			}
			return $return;
		}
	}
}