2 /********************************************************************************\
3 * Copyright (C) ViCarePlus, Visolve (vicareplus_engg@visolve.com) *
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. *
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. *
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']);
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
39 //0 - There is no Re Identification in progress. (start new Re Identification process)
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'
49 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js"></script
>
51 <style type
="text/css">
57 <body
class="body_top">
58 <strong
><?php
xl('Re Identification','e'); ?
></strong
>
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"].' &';
93 <table
class="de_identification_status_message" align
="center">
98 <?php
echo xl('Re Identification Process is ongoing');
100 echo xl('Please visit Re Identification screen after some time');
101 echo "</br>"; ?
> </br
>
114 <table align
="center">
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)
148 <table
class="de_identification_status_message" align
="center">
152 <?php
echo xl('No match Patient record found for the given Re Idenitification code');
154 echo xl('Please enter correct Re Identification code');
155 echo "</br>"; ?
> </br
>
168 <table align
="center">
178 //delete old re_identified_data.xls file
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);
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));
207 //xls file downloaded complete