]>
Softwares of Agnibho - simpleipd.git/blob - www/requisition.php
2 require(dirname(__DIR__
)."/require.php");
3 if(isSet($_GET["pid"])){
5 if(!empty($_POST["del"])){
6 $db->omitRequisition($_POST["del"]);
8 if(!empty($_POST["test"])){
9 if(file_exists($_POST["test"])){
10 $form=str_replace(["forms/",".schema.json"], "", $_POST["test"]);
11 $test=json_decode(file_get_contents("forms/".$form.".schema.json"))->description
;
17 $db->addRequisition($pid, $test, $_POST["sample"], $_POST["date"], $_POST["time"], $_POST["room"], $form, $_POST["addl"]);
19 $inv=json_decode(file_get_contents("autocomplete/investigation.json"));
21 foreach(glob("forms/report-*.json") as $file){
22 $form=json_decode(file_get_contents($file));
23 if(!in_array($form->title
, ["disk_diffusion","serology"])){
24 $testList=$testList."<option value='".$file."'>".$form->description
."</option>";
27 foreach($inv->tests
as $t){
28 $testList=$testList."<option>".$t."</option>";
31 $roomList=$roomList."<option hidden disabled selected value=''>--- Select Room ---</option>";
32 foreach($inv->rooms
as $r){
33 $roomList=$roomList."<option>".$r."</option>";
35 $roomList=$roomList."<option>other</option>";
36 $reqList=$db->getRequisitions($pid);
38 while($req=$reqList->fetchArray()){
39 $list=$list."<tr><td>".$req["test"]."</td><td>".$req["sample"]."</td><td>".$req["room"]."</td><td>".date("M j", $req["time"])."</td><td>".$req["addl"]."</td><td><button type='submit' class='btn btn-secondary confirm' name='del' value='".$req["rowid"]."' form='delete' ".checkAccess("requisition","form").">Delete</button></td></tr>";
46 <?php
include(CONFIG_LIB
."head.php");?
>
47 <title
>Requisitions
</title
>
50 <div
class="container">
51 <?php
include(CONFIG_LIB
."top.php");?
>
52 <?php
echo getInfo($pid);?
>
54 <div
class="card-body">
55 <h4
class="card-title">List of Requisitions
</h4
>
56 <form method
="post" <?php
echo checkAccess("requisition", "form");?
>>
59 <select name
="test" required
>
60 <?php
echo $testList;?
>
64 <input type
="text" class="form-control" name
="sample" placeholder
="Sample">
67 <select name
="room" required
>
68 <?php
echo $roomList;?
>
72 <input type
="date" name
="date" class="form-control">
73 <input type
="time" name
="time" class="form-control">
76 <textarea type
="text" class="form-control" name
="addl" placeholder
="Extra note"></textarea
>
77 <button
class="btn btn-primary" type
="submit">Submit Requisition
</button
>
80 <form method
='post' id
='delete'></form
>
82 <tr
><th
>Test Name
</th
><th
>Sample
</th
><th
>Destination
</th
><th
>Date
</th
><th
>Extra note
</th
><th
></th
></tr
>
88 <?php
include(CONFIG_LIB
."foot.php");?
>