Fix for editing current event in a recurring appointment
[openemr.git] / interface / de_identification_forms / re_identification_op_single_patient.php
blob68a755dcf3caf00fec7a8215d68302ede0ec6b3f
1 <?php
2 /********************************************************************************\
3 * Copyright (C) ViCarePlus, Visolve (vicareplus_engg@visolve.com) *
4 * *
5 * This program is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public License *
7 * as published by the Free Software Foundation; either version 2 *
8 * of the License, or (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software *
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
18 \********************************************************************************/
19 require_once("../globals.php");
20 require_once("$srcdir/lists.inc");
21 require_once("$srcdir/patient.inc");
22 require_once("$srcdir/acl.inc");
23 require_once("$srcdir/options.inc.php");
24 include_once("../../library/sql.inc");
25 require_once("$srcdir/formdata.inc.php");
26 $query = "SELECT status FROM re_identification_status";
27 $res = sqlStatement($query);
28 if ($row = sqlFetchArray($res))
30 $status = addslashes($row['status']);
31 /* $Status:
32 * 0 - There is no Re Identification in progress. (start new Re Identification process)
33 * 1 - A Re Identification process is currently in progress.
34 * 2 - The Re Identification process completed and xls file is ready to download
35 */
37 if($status == 0)
39 //0 - There is no Re Identification in progress. (start new Re Identification process)
41 <html>
42 <head>
43 <title><?php xl('Re Identification','e'); ?></title>
44 <link rel="stylesheet" href='<?php echo $css_header ?>' type='text/css'>
45 <link rel="stylesheet"
46 href='<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar.css'
47 type='text/css'>
49 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js"></script>
51 <style type="text/css">
52 .style1 {
53 text-align: center;
55 </style>
56 </head>
57 <body class="body_top">
58 <strong><?php xl('Re Identification','e'); ?></strong>
59 <div id="overDiv"
60 style="position: absolute; visibility: hidden; z-index: 1000;"></div>
62 <form enctype="Re_identification_output" method="POST"><?php
63 if ($_POST["re_id_code"]) { $reIdCode = formData('re_id_code','P',true); }
65 //to store input for re-idenitification
66 $query = "DROP TABLE IF EXISTS temp_re_identification_code_table";
67 $res = sqlStatement($query);
69 $query = "create table temp_re_identification_code_table (re_identification_code varchar(50))";
70 $res = sqlStatement($query);
72 $query = "insert into temp_re_identification_code_table values ('$reIdCode')";
73 $res = sqlStatement($query);
75 $query = "update re_identification_status set status = 1;";
76 $res = sqlStatement($query);
78 //call procedure - execute in background
79 $sh_cmd='./re_identification_procedure.sh '.$sqlconf["host"].' '.$sqlconf["login"].' '.$sqlconf["pass"].' '.$sqlconf["dbase"].' &';
80 system ($sh_cmd);
83 <table>
84 <tr>
85 <td>&nbsp;</td>
86 <td>&nbsp;</td>
87 </tr>
88 <tr>
89 <td>&nbsp;</td>
90 <td>&nbsp;</td>
91 </tr>
92 </table>
93 <table class="de_identification_status_message" align="center">
94 <tr valign="top">
96 <td>&nbsp;</td>
97 <td rowspan="3"><br>
98 <?php echo xl('Re Identification Process is ongoing');
99 echo "</br></br>";
100 echo xl('Please visit Re Identification screen after some time');
101 echo "</br>"; ?> </br>
102 </td>
103 <td>&nbsp;</td>
104 </tr>
105 <tr>
106 <td>&nbsp;</td>
107 <td>&nbsp;</td>
108 </tr>
109 <tr>
110 <td>&nbsp;</td>
111 <td>&nbsp;</td>
112 </tr>
113 </table>
114 <table align="center">
115 <tr>
116 <td>&nbsp;</td>
117 <td>&nbsp;</td>
118 </tr>
119 </table>
120 <?php
123 else if($status == 2)
125 //2 - The Re Identification process completed and xls file is ready to download
126 $query = "update re_identification_status set status = 0";
127 $res = sqlStatement($query);
128 $query = "SELECT count(*) as count FROM re_identified_data";
129 $res = sqlStatement($query);
131 if ($row = sqlFetchArray($res))
133 $no_of_items = addslashes($row['count']);
135 if($no_of_items <= 1)
138 <table>
139 <tr>
140 <td>&nbsp;</td>
141 <td>&nbsp;</td>
142 </tr>
143 <tr>
144 <td>&nbsp;</td>
145 <td>&nbsp;</td>
146 </tr>
147 </table>
148 <table class="de_identification_status_message" align="center">
149 <tr valign="top">
150 <td>&nbsp;</td>
151 <td rowspan="3"><br>
152 <?php echo xl('No match Patient record found for the given Re Idenitification code');
153 echo "</br></br>";
154 echo xl('Please enter correct Re Identification code');
155 echo "</br>"; ?> </br>
156 </td>
157 <td>&nbsp;</td>
158 </tr>
159 <tr>
160 <td>&nbsp;</td>
161 <td>&nbsp;</td>
162 </tr>
163 <tr>
164 <td>&nbsp;</td>
165 <td>&nbsp;</td>
166 </tr>
167 </table>
168 <table align="center">
169 <tr>
170 <td>&nbsp;</td>
171 <td>&nbsp;</td>
172 </tr>
173 </table>
174 <?php
176 else
178 //delete old re_identified_data.xls file
179 $timestamp=0;
180 $query = "select now() as timestamp";
181 $res = sqlStatement($query);
182 if ($row = sqlFetchArray($res))
184 $timestamp = addslashes($row['timestamp']);
186 $timestamp = str_replace(" ","_",$timestamp);
187 $filename = $GLOBALS['temporary_files_dir']."/re_identified_data".$timestamp.".xls";
188 $query = "select * from re_identified_data into outfile '$filename' ";
189 $res = sqlStatement($query);
190 ob_end_clean();
191 //download Re Identification .xls file
192 if (file_exists($filename)) {
193 header('Content-Description: File Transfer');
194 header('Content-Type: application/octet-stream');
195 header('Content-Disposition: attachment; filename='.basename($filename));
196 header('Content-Transfer-Encoding: none');
197 header('Content-Type: application/vnd.ms-excel;'); // This should work for IE & Opera
198 header("Content-type: application/x-msexcel"); // This should work for the rest
199 header('Expires: 0');
200 header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
201 header('Pragma: public');
202 header('Content-Length: ' . filesize($filename));
203 ob_clean();
204 flush();
205 readfile($filename);
207 //xls file downloaded complete
212 ?></form>
213 </body>
214 </html>