acknowledgments update
[openemr.git] / interface / fax / fax_dispatch_newpid.php
blob1091d9e30d4c5d7a052e4fe8c8238766a6166d3d
1 <?php
2 // Copyright (C) 2008, 2010 Rod Roark <rod@sunsetsystems.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 // This is invoked via a jQuery getScript() from fax_dispatch.php.
10 // Its purpose is to return JavaScript that will set up patient-
11 // specific data when a patient is selected. Currently this data
12 // is just the caller's selection list of recent encounters.
14 require_once("../globals.php");
15 require_once("$srcdir/sql.inc");
17 $res = sqlStatement("SELECT date, encounter, reason FROM form_encounter " .
18 "WHERE pid = '" . $_GET['p'] . "' " .
19 "ORDER BY date DESC, encounter DESC LIMIT 10");
21 echo "var s = document.forms[0].form_copy_sn_visit;\n";
22 echo "s.options.length = 0;\n";
24 while ($row = sqlFetchArray($res)) {
25 echo "s.options[s.options.length] = new Option(" .
26 "'" . substr($row['date'], 0, 10) . " " .
27 addslashes(strtr(substr($row['reason'], 0, 40), "\r\n", " ")) . "', " .
28 "'" . $row['encounter'] . "'" .
29 ");\n";