2 require(dirname(__DIR__
)."/require.php");
3 if(checkAccess("report")!="all"){
4 header("Location: error.php");
7 if(!empty($_GET["pid"]) && !empty($_GET["form"])){
9 if(!empty($_POST["date"])){
10 if(!empty($_GET["id"])){
11 $db->editReport($_POST, $pid, $_GET["id"], $_POST["form"]);
14 $db->addReport($_POST, $pid, $_POST["form"]);
16 if(!empty($_GET["req"])){
17 $db->omitRequisition($_GET["req"]);
19 if(!empty($_GET["src"]) && $_GET["src"]=="index"){
20 header("Location: index.php");
24 header("Location: view.php?pid=".$_GET["pid"]);
28 if(isSet($_GET["id"])){
29 $data=$db->getData($pid, $_GET["id"], "reports");
30 $data=json_decode($data->fetchArray()["data"]);
32 $abx=json_decode(file_get_contents(CONFIG_WWW
."autocomplete/vitek.json"));
33 if($_GET["form"]=="report-as-grampos"){
34 $list=$abx->gram_positive
;
36 elseif($_GET["form"]=="report-as-gramneg"){
37 $list=$abx->gram_negative
;
39 elseif($_GET["form"]=="report-as-fungal"){
42 $form="<form method='post' id='antibiogram'><input type='hidden' name='form' value='".$_GET["form"]."'></form>";
43 $form=$form."<table class='table'>";
45 $date="value='".$data->date
."'";
46 $sample="value='".$data->sample
."'";
47 $labid="value='".$data->labid
."'";
48 $organism="value='".$data->organism
."'";
50 elseif(!empty($_GET["time"]) ||
!empty($_GET["sample"])){
51 if(!empty($_GET["time"])){
52 $date="value='".date("Y-m-d", $_GET["time"])."'";
54 if(!empty($_GET["sample"])){
55 $sample="value='".$_GET["sample"]."'";
66 $form=$form."<tr><td>Sample Date</td><td colspan='3'><input type='date' class='form-control' name='date' ".$date." form='antibiogram'></td></tr>";
67 $form=$form."<tr><td>Report Date</td><td colspan='3'><input type='date' class='form-control' name='rdate' form='antibiogram'></td></tr>";
68 $form=$form."<tr><td>Sample</td><td colspan='3'><input type='text' class='form-control' name='sample' ".$sample." form='antibiogram' required></td></tr>";
69 $form=$form."<tr><td>Lab ID</td><td colspan='3'><input type='text' class='form-control' name='labid' ".$labid." form='antibiogram'></td></tr>";
70 $form=$form."<tr><td>Organism</td><td colspan='3'><input type='text' class='form-control' name='organism' ".$organism." form='antibiogram' required></td></tr>";
71 $form=$form."<tr><th>Antibiotic</th><th>MIC</th><th>Interpretation</th>";
72 foreach($list as $k=>$v){
74 $mic="value='".$data->$k->mic
."'";
75 $interpretation="value='".$data->$k->interpretation
."'";
81 $form=$form."<tr><td><input type='hidden' name='".$k."[name]' value='".$v."' form='antibiogram'><input type='text' form='antibiogram' class='form-control' name='' value='".$v."' title='".$v."' data-toggle='popover' readonly></td><td><input type='text' form='antibiogram' class='form-control' name='".$k."[mic]' ".$mic."></td><td><input type='text' form='antibiogram' class='form-control abinter' name='".$k."[interpretation]' ".$interpretation." step='any'></td></tr>";
84 $name="value='".$data->other
->name
."'";
85 $mic="value='".$data->other
->mic
."'";
86 $interpretation="value='".$data->other
->interpretation
."'";
93 $form=$form."<tr><td><input type='text' form='antibiogram' class='form-control' placeholder='Any other' name='other[name]' ".$name."></td><td><input type='text' form='antibiogram' class='form-control' name='other[mic]' ".$mic."></td><td><input type='text' form='antibiogram' class='form-control abinter' step='any' name='other[interpretation]' ".$interpretation."></td></tr>";
100 $form=$form."<tr><td colspan='3'><textarea class='w-100' name='note' form='antibiogram' placeholder='Notes' ".$note."></textarea></td></tr>";
101 $form=$form."<tr><td colspan='3'><button type='submit' form='antibiogram' class='btn btn-primary btn-lg'>Save</button></td></tr>";
102 $form=$form."</table>";
108 <?php
include(CONFIG_LIB
."head.php");?
>
109 <title
>Antibiogram
</title
>
112 <div
class="container">
113 <?php
include(CONFIG_LIB
."top.php");?
>
115 <div
class="card-body">
116 <h4
class="card-title">Add
New Report
</h4
>
118 <a href
="attachments.php?pid=<?php echo $pid;?>&name=vitek" target
="_blank">Attach a PDF copy of report
</a
>
122 <?php
include(CONFIG_LIB
."foot.php");?
>