/** * function to get current date */ function getCurrentDate() { global $c,$default_GMTtimezone; //return gmdate("Y-m-d"); return getRawFormattedDateLessDay(getDualInfoWithAlias("now()","datetime")); }
/** * log credit account status */ function logCreditAccountStatus($tableName,$clientNumber,$creditAccount,$creditAccountStatus,$creditApprovalDate) { global $datetime,$user,$curTime; /* * avoid duplicates * ensure new entry is different from last known entry */ if(!isQuery("select * from vl_logs_creditaccountstatus where tableName='$tableName' and clientNumber='$clientNumber' and creditAccount='$creditAccount' and creditAccountStatus='$creditAccountStatus'")) { //insert mysqlquery("insert into vl_logs_creditaccountstatus (tableName,clientNumber,creditAccount,creditAccountStatus,created,createdby) values ('$tableName','$clientNumber','$creditAccount','$creditAccountStatus','".getRawFormattedDateLessDay($creditApprovalDate)." ".$curTime."','$user')"); } else { if(getDetailedTableInfo2("vl_logs_creditaccountstatus","tableName='$tableName' and clientNumber='$clientNumber' and creditAccount='$creditAccount' order by created desc limit 1","creditAccountStatus")!=$creditAccountStatus) { //insert mysqlquery("insert into vl_logs_creditaccountstatus (tableName,clientNumber,creditAccount,creditAccountStatus,created,createdby) values ('$tableName','$clientNumber','$creditAccount','$creditAccountStatus','$datetime','$user')"); } } }
if($_SESSION["VLADMIN"]) { $serverAddress=0; $serverAddress=$_SESSION["VLADMIN"]; } //who's the user? $user=0; $user=($_SESSION["VLADMIN"]?"admin: ".$_SESSION["VLADMIN"]:"visitor: $ipAddress $serverAddress"); $c=0; $c=$default_country; /** * date/time defaults * at 11:00hrs hostmonster mysql time == 20:00hrs Ug time * 20:00hrs Ug time (+3 GMT) == 17:00hrs GMT * hostmonster == -6 GMT */ $datetime=0; $datetime=getDualInfoWithAlias("now()","datetime"); //$curDate=0; //$curDate=gmdate("d-M-Y"); $icurDate=0; $icurDate=getRawFormattedDateLessDay($datetime); $curTime=0; $curTime=getFormattedTime($datetime); //free memory clearstatcache(); ?>
$refNumber=0; $refNumber=$q["refNumber"]; $facilityID=0; $facilityID=getDetailedTableInfo2("vl_forms_clinicalrequest_dispatch","refNumber='$q[refNumber]' limit 1","facilityID"); $facility=0; $facility=($facilityID?getDetailedTableInfo2("vl_facilities","id='$facilityID' limit 1","facility"):"N/A"); $dateDispatched=0; $dateDispatched=($facilityID?getRawFormattedDateLessDay(getDetailedTableInfo2("vl_forms_clinicalrequest_dispatch","refNumber='$q[refNumber]' limit 1","dispatchDate")):"N/A"); $receivedFacilityID=0; $receivedFacilityID=getDetailedTableInfo2("vl_samples","formNumber='$formNumber' limit 1","facilityID"); $receivedFacility=0; $receivedFacility=($receivedFacilityID?getDetailedTableInfo2("vl_facilities","id='$receivedFacilityID' limit 1","facility"):"N/A"); $dateReceived=0; $dateReceived=($receivedFacilityID?getRawFormattedDateLessDay(getDetailedTableInfo2("vl_samples","formNumber='$formNumber' limit 1","receiptDate")):"N/A"); $dateCreated=0; $dateCreated=getRawFormattedDateLessDay($q["created"]); //add rows $row=array(); //form number $row[]=$formNumber; //reference number $row[]=$refNumber; //facility $row[]=$facility; //date dispatched $row[]=$dateDispatched; //Received from Facility $row[]=$receivedFacility; //Date Received $row[]=$dateReceived;
$hubID=logNewHub(trim($excelData->sheets[0]['cells'][$i][6]),$facilityID); //Date of Collection; deduct by 1 date for reasons I'm yet to figure out $collectionDate=0; $collectionDate=subtractFromDate(getFormattedDateCRBExcel(trim($excelData->sheets[0]['cells'][$i][7])),1); if(!$collectionDate) { $collectionDate=getRawFormattedDateLessDay(trim($excelData->sheets[0]['cells'][$i][7])); } //Sample Type $sampleTypeID=0; $sampleTypeID=getDetailedTableInfo2("vl_appendix_sampletype","lower(appendix)='".strtolower(trim($excelData->sheets[0]['cells'][$i][8]))."' limit 1","id"); //Date of Treatment Initiation $treatmentInitiationDate=0; $treatmentInitiationDate=getRawFormattedDateLessDay(trim($excelData->sheets[0]['cells'][$i][15])); //Current Regimen $currentRegimenID=0; $currentRegimenID=logNewCurrentRegimen(trim($excelData->sheets[0]['cells'][$i][16])); //Which Treatment Line is Patient on $treatmentStatusID=0; $treatmentStatusID=logNewTreatmentStatus(trim($excelData->sheets[0]['cells'][$i][18])); //manage duplicates if($formNumber && $vlSampleID) { //get the sample ID $sampleID=0; $sampleID=getDetailedTableInfo2("vl_samples","vlSampleID='$vlSampleID' limit 1","id");
<? //register a globals variable for security $GLOBALS['vlDC']=true; include "conf.php"; //the date $theDate=0; $theDate=getRawFormattedDateLessDay(getDetailedTableInfo2("vl_logs_removals","id='$id'","created")); //createdby $createdby=0; $createdby=getDetailedTableInfo2("vl_logs_removals","id='$id'","createdby"); //removedData $removedData=0; $removedData=getDetailedTableInfo2("vl_logs_removals","id='$id'","removedData"); ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" cellspacing="0" cellpadding="0" class="trailanalytics"> <tr> <td class="tab_active">Removals by <?php echo $createdby; ?> in <?php echo getFormattedDate($theDate); ?> </td> </tr> </table></td> </tr>
$row[]=$q[routineMonitoringValue]; $row[]=getDetailedTableInfo2("vl_appendix_sampletype","id='$q[routineMonitoringSampleTypeID]' limit 1","appendix"); $row[]=($q["vlTestingRepeatTesting"]?"Yes":"No"); $row[]=getRawFormattedDateLessDay($q["repeatVLTestLastVLDate"]); $row[]=$q[repeatVLTestValue]; $row[]=getDetailedTableInfo2("vl_appendix_sampletype","id='$q[repeatVLTestSampleTypeID]' limit 1","appendix"); $row[]=($q["vlTestingSuspectedTreatmentFailure"]?"Yes":"No"); $row[]=getRawFormattedDateLessDay($q["suspectedTreatmentFailureLastVLDate"]); $row[]=$q[suspectedTreatmentFailureValue]; $row[]=getDetailedTableInfo2("vl_appendix_sampletype","id='$q[suspectedTreatmentFailureSampleTypeID]' limit 1","appendix"); $row[]=$sampleTested; $row[]=$lastWorksheetName; $row[]=$machineType; $row[]=preg_replace("/</is","<",$result); $row[]=(getDetailedTableInfo2("vl_samples_verify","sampleID='$q[id]' and outcome='Accepted' and created!='' limit 1","id")?getRawFormattedDateLessDay(getDetailedTableInfo2("vl_samples_verify","sampleID='$q[id]' and outcome='Accepted' limit 1","created")):""); $row[]=(getDetailedTableInfo2("vl_samples_verify","sampleID='$q[id]' and outcome='Rejected' and created!='' limit 1","id")?getRawFormattedDateLessDay(getDetailedTableInfo2("vl_samples_verify","sampleID='$q[id]' and outcome='Rejected' limit 1","created")):""); $row[]=getDetailedTableInfo2("vl_appendix_samplerejectionreason","id='".getDetailedTableInfo2("vl_samples_verify","sampleID='$q[id]' and outcome='Rejected' limit 1","outcomeReasonsID")."' limit 1","appendix"); $row[]=(getDetailedTableInfo2("vl_samples_worksheet","sampleID='$q[id]' and created!='' limit 1","id")?getRawFormattedDateLessDay(getDetailedTableInfo2("vl_samples_worksheet","sampleID='$q[id]' order by created desc limit 1","created")):""); $row[]=($dateLatestResultsUploaded?getRawFormattedDateLessDay($dateLatestResultsUploaded):""); $row[]=($dateLatestResultsPrinted?getRawFormattedDateLessDay($dateLatestResultsPrinted):""); $row[]=getRawFormattedDateLessDay($q["receiptDate"]); $row[]=($dateFirstPrinted?getRawFormattedDateLessDay($dateFirstPrinted):""); $xls->addRow($row); } //output to browser $xls->sendFile(); } break; } ?>
} } } } if(!empty($abbott_insert_values)) insertVLResults("abbott", $abbott_insert_values, $log_repeat_values, $merged_values); fclose($file); //log the $runStartTime and $runCompletionTime if(!getDetailedTableInfo2("vl_results_abbott_runtimes","worksheetID='$worksheetID' limit 1","id")) { mysqlquery("insert into vl_results_abbott_runtimes (worksheetID,runStartTime,runCompletionTime, created,createdby) values ('$worksheetID','".getRawFormattedDateLessDay($runStartTime)." ".getFormattedTime($runStartTime)."','".getRawFormattedDateLessDay($runCompletionTime)." ".getFormattedTime($runCompletionTime)."', '$datetime','$trailSessionUser')"); } } } } else { $error.="<br>File could not be uploaded. Consider contacting your Systems Administrator."; } //redirect go("/worksheets/success/".($added?$added:0)."/".($modified?$modified:0)."/"); } } ?> <script Language="JavaScript" Type="text/javascript"> <!--