more bug fixes
[openemr.git] / interface / fax / fax_dispatch_newpid.php
blob397ebea5b12f899cbc2b92e5a7c6f199a8a6bcf3
1 <?php
2 // Copyright (C) 2008 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 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 "'" . $row['encounter'] . "'" .
28 ");\n";