-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
168 lines (114 loc) · 7.05 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<?php
// This page is for DTS2
session_start();
require_once("fxns.php");
require_once("db.php");
check_usersignin();
$id = $_SESSION['id'];
$firstname = $_SESSION['firstname'];
?>
<!DOCTYPE html>
<html>
<head>
<title>Document Tracking System v. 2.0 </title>
</head>
<body>
<?php
display_header();
echo "<h1 align='center'>Document Tracking System</h1>";
display_main();
$checkrmsstaffactive = "select office.acronym from employeeoffice, office where office.id = employeeoffice.officeid and employeeoffice.employeeid = $id and employeeoffice.status = 'Active' and office.acronym = 'RMS'";
$processcheckrms = $db->query($checkrmsstaffactive);
if($processcheckrms->num_rows > 0) {
$_SESSION['rmsstaff'] = 'Yes';
}
if(isset($_SESSION['rmsstaff'])){
display_rms();
}
echo "<p align='center'><font color='red'><b>Notice: You are accessing "
. "privileged information. Please ensure you are accessing this system securely. "
. "You are responsible for activities done with your login.</b> </font></p>";
echo "<p align='center'>Please make sure to log out before you leave your computer.<br /></p>";
$selectoffice = "select id from employeeoffice where employeeid = '$id' and status = 'Active'";
$resultselectofficeitem = $db->query($selectoffice);
//$dbprocess = $resultselectoffice->fetch_assoc();
if($resultselectofficeitem->num_rows > 0) {
// This sequence creates a table
// The first table will show summary of documents accessible to the offices/committees of the user.
// The next table will show summary of documents accessible to the individual.
echo "<h2 align='center'>Summary of Open Documents Requiring Office Action or Monitoring</h1>";
echo "<table border='1' style='width:100%'>";
echo "<tr>";
cell_blue_hdr_ctr("Office or Committee");
cell_blue_hdr_ctr("My Membership Type");
cell_blue_hdr_ctr("Open Documents Created by the Office");
cell_blue_hdr_ctr("Received Documents Requiring Action");
echo "</tr>";
foreach ($resultselectofficeitem as $row)
{
// This sequence gets the name of the office and membership of the user
$getofficenameandmember = "select office.id as 'OfficeID', office.name as 'OfficeName', office.acronym, membership.membership as 'Membership' from employeeoffice, membership, office where employeeoffice.membership = membership.id and employeeoffice.officeid = office.id and employeeoffice.id = '".$row['id']."' and employeeoffice.status = 'Active'";
$resultgetofficenameandmember = $db->query($getofficenameandmember);
foreach($resultgetofficenameandmember as $key => $resultofficename){
echo "<tr><td> ".$resultofficename['OfficeName']." </td>";
echo "<td align='center'> ".$resultofficename['Membership']." </td>";
// This sequence will count the documents created by the office and still open
// PENDING
$countopendocumentofficecreatedopen = "select count(id) as 'Count' from document where creatoroffice = ".$resultofficename['OfficeID']." and status = 'Open'" ;
$processcountopendocumentofficecreated = $db->query($countopendocumentofficecreatedopen);
$resultprocesscountopendocumentofficecreated = $processcountopendocumentofficecreated->fetch_assoc();
//$documentofficecreatednumber = $resultprocesscountopendocumentofficecreated['Count'];
echo "<td align='center'><a href='viewopencreateddocumentsoffice.php?officeid=".$resultofficename['OfficeID']."'>".$resultprocesscountopendocumentofficecreated['Count']." </a></td>";
// This should be limited to Open documents when clicked
// This sequence will count the documents received by the office and still open
// PENDING
$countopendocumentofficereceived = "select count(DocumentID) as 'Count' from openreceiveddocumentsoffice where TrackRecipientOffice = ".$resultofficename['OfficeID']; // opendocumentofficereceivedtrack
$processcountopendocumentofficereceived = $db->query($countopendocumentofficereceived);
$resultprocesscountopendocumentofficereceived = $processcountopendocumentofficereceived->fetch_assoc();
//$documentofficereceivednumber = $resultprocesscountopendocumentofficereceived['Count'];
echo "<td align='center'><a href='viewopenreceiveddocumentsoffice.php?officeid=".$resultofficename['OfficeID']."'> ".$resultprocesscountopendocumentofficereceived['Count']."</a></td></tr>";
// This should be limited to Open documents when clicked
}
}
echo "</table>";
} else {
echo "Looks like there is no document routed to your office requiring action nor is there any open document created by your office requiring monitoring.<br /><br />";
echo "<a href=''>Sign out.</a>";
return;
}
// This will list documents created by the user or documents routed to the specific individual
echo "<h2 align='center'>Open Individual-level Documents</h2>";
// Check if there is an open document that has a track that is linked to the user and the status is not "Acted Upon"
$checkindividualdocumentcreated = "select id from document where creator = $id and status = 'Open'";
$processcheckindividualdocumentcreated = $db->query($checkindividualdocumentcreated);
if($processcheckindividualdocumentcreated->num_rows == 0){
// This sequence checks if there is a document which has been sent to the user via the TrackStatus column
$checkindividualdocumentrouted = "select TrackID from trackdocumentindividual where RecipientPerson = $id and TrackStatus = 'Sent' or 'Read'";
$processcheckindividualdocumentrouted = $db->query($checkindividualdocumentrouted);
if($processcheckindividualdocumentrouted->num_rows == 0){
echo "Congratulations. You do not have individually created or routed documents currently requiring your action";
return;
}
}
echo "<a href=''></a><br />";
start_table();
cell_blue_hdr_ctr("Document Name");
cell_blue_hdr_ctr("Document Creation Date");
cell_blue_hdr_ctr("Action");
$getindividualcreateddocumentnos10 = "select distinct DocumentID, DocumentName, DocCreationDate from trackdocumentindividual3 where SourcePerson = $id or RecipientPerson = $id and TrackStatus != 'Acted upon' order by DocCreationDate desc";
$processgetindividualcreateddocumentnos10 = $db->query($getindividualcreateddocumentnos10);
$i = 1;
while ($row1 = $processgetindividualcreateddocumentnos10->fetch_assoc()){
echo "<tr>";
cell_lft($i.". ".$row1['DocumentName']);
cell_ctr($row1['DocCreationDate']);
cell_ctr_link('View Document Record', "documentactionb.php?did=".$row1['DocumentID']);
echo "</tr>";
$i++;
}
end_table();
echo "<br />";
echo "<a href=''>View more individual documents.</a>";
?>
</body>
</html>