]> Softwares of Agnibho - simpleipd.git/blob - www/report.php
Bugfix
[simpleipd.git] / www / report.php
1 <?php
2 require(dirname(__DIR__)."/require.php");
3 if(checkAccess("report")!="all"){
4 header("Location: error.php");
5 exit();
6 }
7 if(!empty($_GET["pid"]) && !empty($_GET["form"])){
8 $pid=$_GET["pid"];
9 if(!empty($_POST["date"])){
10 if(!empty($_GET["id"])){
11 $db->editReport($_POST, $pid, $_GET["id"], $_POST["form"]);
12 }
13 else{
14 $db->addReport($_POST, $pid, $_POST["form"]);
15 }
16 if(!empty($_GET["req"])){
17 $db->omitRequisition($_GET["req"]);
18 }
19 if(!empty($_GET["src"]) && $_GET["src"]=="index"){
20 header("Location: index.php");
21 exit();
22 }
23 else{
24 header("Location: view.php?pid=".$_GET["pid"]);
25 exit();
26 }
27 }
28 if(!empty($_GET["time"])){
29 $time=$_GET["time"];
30 }
31 else{
32 $time=null;
33 }
34 if(isSet($_GET["id"])){
35 $form=schema2form("forms/".$_GET["form"].".schema.json", $pid, $_GET["id"], "reports", null, $time);
36 }
37 else{
38 $form=schema2form("forms/".$_GET["form"].".schema.json", null, null, null, null, $time);
39 }
40 }
41 ?>
42 <!DOCTYPE html>
43 <html>
44 <head>
45 <?php include(CONFIG_LIB."head.php");?>
46 <title>Reports</title>
47 </head>
48 <body>
49 <div class="container">
50 <?php include(CONFIG_LIB."top.php");?>
51 <div class="card">
52 <div class="card-body">
53 <h4 class="card-title">Add New Report</h4>
54 <?php echo $form;?>
55 <p id='get-sample' style='display:none'><?php if(!empty($_GET["sample"])) echo $_GET["sample"];?></p>
56 <?php if(!empty($_GET["req"])){echo "<p class='text-right'><a href='attachments.php?pid=".$pid."&req=".$_GET["req"]."'>Upload PDF instead</a></p>";}?>
57 </div>
58 </div>
59 </div>
60 <?php include(CONFIG_LIB."foot.php");?>
61 </body>
62 </html>