ongoing new datepicker project
[openemr.git] / interface / orders / procedure_provider_edit.php
blob06bae07d8edfec5014fd8b69980c8f9b21c7d8f1
1 <?php
2 /**
3 * Maintenance for the list of procedure providers.
5 * Copyright (C) 2012-2014 Rod Roark <rod@sunsetsystems.com>
7 * LICENSE: This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * 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, see <http://opensource.org/licenses/gpl-license.php>.
18 * @package OpenEMR
19 * @author Rod Roark <rod@sunsetsystems.com>
22 $sanitize_all_escapes = true;
23 $fake_register_globals =false;
25 require_once("../globals.php");
26 require_once("$srcdir/acl.inc");
27 require_once("$srcdir/options.inc.php");
29 // Collect user id if editing entry
30 $ppid = $_REQUEST['ppid'];
32 $info_msg = "";
34 function invalue($name) {
35 $fld = add_escape_custom(trim($_POST[$name]));
36 return "'$fld'";
40 <html>
41 <head>
42 <script type="text/javascript" src="<?php echo $webroot ?>/interface/main/tabs/js/include_opener.js"></script>
43 <title><?php echo $ppid ? xlt('Edit') : xlt('Add New') ?> <?php echo xlt('Procedure Provider'); ?></title>
44 <link rel="stylesheet" href='<?php echo $css_header ?>' type='text/css'>
45 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-3-2/index.js"></script>
47 <style>
48 td { font-size:10pt; }
50 .inputtext {
51 padding-left:2px;
52 padding-right:2px;
55 .button {
56 font-family:sans-serif;
57 font-size:9pt;
58 font-weight:bold;
60 </style>
62 <script language="JavaScript">
63 </script>
65 </head>
67 <body class="body_top">
68 <?php
69 // If we are saving, then save and close the window.
71 if ($_POST['form_save']) {
72 $org_qry = "SELECT organization FROM users WHERE id = ?";
73 $org_res = sqlQuery($org_qry, array($_POST['form_name']));
74 $org_name = $org_res['organization'];
75 $sets =
76 "name = '" .add_escape_custom($org_name). "', " .
77 "lab_director = " . invalue('form_name') . ", " .
78 "npi = " . invalue('form_npi') . ", " .
79 "send_app_id = " . invalue('form_send_app_id') . ", " .
80 "send_fac_id = " . invalue('form_send_fac_id') . ", " .
81 "recv_app_id = " . invalue('form_recv_app_id') . ", " .
82 "recv_fac_id = " . invalue('form_recv_fac_id') . ", " .
83 "DorP = " . invalue('form_DorP') . ", " .
84 "direction = " . invalue('form_direction') . ", " .
85 "protocol = " . invalue('form_protocol') . ", " .
86 "remote_host = " . invalue('form_remote_host') . ", " .
87 "login = " . invalue('form_login') . ", " .
88 "password = " . invalue('form_password') . ", " .
89 "orders_path = " . invalue('form_orders_path') . ", " .
90 "results_path = " . invalue('form_results_path') . ", " .
91 "notes = " . invalue('form_notes');
92 if ($ppid) {
93 $query = "UPDATE procedure_providers SET $sets " .
94 "WHERE ppid = '" . add_escape_custom($ppid) . "'";
95 sqlStatement($query);
97 else {
98 $ppid = sqlInsert("INSERT INTO procedure_providers SET $sets");
101 else if ($_POST['form_delete']) {
102 if ($ppid) {
103 sqlStatement("DELETE FROM procedure_providers WHERE ppid = ?", array($ppid));
107 if ($_POST['form_save'] || $_POST['form_delete']) {
108 // Close this window and redisplay the updated list.
109 echo "<script language='JavaScript'>\n";
110 if ($info_msg) echo " alert('" . addslashes($info_msg) . "');\n";
111 echo " window.close();\n";
112 echo " if (opener.refreshme) opener.refreshme();\n";
113 echo "</script></body></html>\n";
114 exit();
117 if ($ppid) {
118 $row = sqlQuery("SELECT * FROM procedure_providers WHERE ppid = ?", array($ppid));
121 $lab_org_query = "SELECT id, organization FROM users WHERE abook_type = 'ord_lab'";
122 $org_res = sqlStatement($lab_org_query);
123 while ($org_row = sqlFetchArray($org_res)) {
124 $lab_org_name = $org_row['organization'];
125 $selected = '';
126 if ($ppid) {
127 if($row['lab_director'] == $org_row['id']){
128 $selected = "SELECTED";
131 $optionsStr .= "<option value='".attr($org_row['id'])."' $selected>". text($lab_org_name)."</option>";
135 <form method='post' name='theform' action='procedure_provider_edit.php?ppid=<?php echo attr($ppid) ?>'>
136 <center>
138 <table border='0' width='100%'>
140 <tr>
141 <td nowrap><b><?php echo xlt('Name'); ?>:</b></td>
142 <td>
143 <select name='form_name' id='form_name' class='inputtext' style='width:150px'>
144 <?php echo $optionsStr; ?>
145 </select>
146 </td>
147 </tr>
149 <tr>
150 <td nowrap><b><?php echo xlt('NPI'); ?>:</b></td>
151 <td>
152 <input type='text' size='10' name='form_npi' maxlength='10'
153 value='<?php echo attr($row['npi']); ?>' class='inputtext' />
154 </td>
155 </tr>
157 <tr>
158 <td nowrap><b><?php echo xlt('Sender IDs'); ?>:</b></td>
159 <td>
160 <?php echo xlt('Application'); ?>:
161 <input type='text' size='10' name='form_send_app_id' maxlength='100'
162 value='<?php echo attr($row['send_app_id']); ?>'
163 title='<?php echo xla('MSH-3.1'); ?>'
164 class='inputtext' />
165 &nbsp;<?php echo xlt('Facility'); ?>:
166 <input type='text' size='10' name='form_send_fac_id' maxlength='100'
167 value='<?php echo attr($row['send_fac_id']); ?>'
168 title='<?php echo xla('MSH-4.1'); ?>'
169 class='inputtext' />
170 </td>
171 </tr>
173 <tr>
174 <td nowrap><b><?php echo xlt('Receiver IDs'); ?>:</b></td>
175 <td>
176 <?php echo xlt('Application'); ?>:
177 <input type='text' size='10' name='form_recv_app_id' maxlength='100'
178 value='<?php echo attr($row['recv_app_id']); ?>'
179 title='<?php echo xla('MSH-5.1'); ?>'
180 class='inputtext' />
181 &nbsp;<?php echo xlt('Facility'); ?>:
182 <input type='text' size='10' name='form_recv_fac_id' maxlength='100'
183 value='<?php echo attr($row['recv_fac_id']); ?>'
184 title='<?php echo xla('MSH-6.1'); ?>'
185 class='inputtext' />
186 </td>
187 </tr>
189 <tr>
190 <td nowrap><b><?php echo xlt('Usage'); ?>:</b></td>
191 <td>
192 <select name='form_DorP' title='<?php echo xla('MSH-11'); ?>'>
193 <?php
194 foreach(array(
195 'D' => xl('Debugging'),
196 'P' => xl('Production'),
197 ) as $key => $value)
199 echo " <option value='" . attr($key) . "'";
200 if ($key == $row['DorP']) echo " selected";
201 echo ">" . text($value) . "</option>\n";
204 </select>
205 </td>
206 </tr>
208 <tr>
209 <td nowrap><b><?php echo xlt('Protocol'); ?>:</b></td>
210 <td>
211 <select name='form_protocol'>
212 <?php
213 foreach(array(
214 // Add to this list as more protocols are supported.
215 'DL' => xl('Download'),
216 'SFTP' => xl('SFTP'),
217 'FS' => xl('Local Filesystem'),
218 ) as $key => $value)
220 echo " <option value='" . attr($key) . "'";
221 if ($key == $row['protocol']) echo " selected";
222 echo ">" . text($value) . "</option>\n";
225 </select>
226 &nbsp;
227 <select name='form_direction'>
228 <?php
229 foreach(array(
230 'B' => xl('Bidirectional'),
231 'R' => xl('Results Only'),
232 ) as $key => $value)
234 echo " <option value='" . attr($key) . "'";
235 if ($key == $row['direction']) echo " selected";
236 echo ">" . text($value) . "</option>\n";
239 </select>
240 </td>
241 </tr>
243 <tr>
244 <td nowrap><b><?php echo xlt('Remote Host'); ?>:</b></td>
245 <td>
246 <input type='text' size='40' name='form_remote_host' maxlength='255'
247 value='<?php echo attr($row['remote_host']); ?>' class='inputtext' />
248 </td>
249 </tr>
251 <tr>
252 <td nowrap><b><?php echo xlt('Login'); ?>:</b></td>
253 <td>
254 <input type='text' size='20' name='form_login' maxlength='255'
255 value='<?php echo attr($row['login']); ?>' class='inputtext' />
256 </td>
257 </tr>
259 <tr>
260 <td nowrap><b><?php echo xlt('Password'); ?>:</b></td>
261 <td>
262 <input type='text' size='20' name='form_password' maxlength='255'
263 value='<?php echo attr($row['password']); ?>' class='inputtext' />
264 </td>
265 </tr>
267 <tr>
268 <td nowrap><b><?php echo xlt('Orders Path'); ?>:</b></td>
269 <td>
270 <input type='text' size='40' name='form_orders_path' maxlength='255'
271 value='<?php echo attr($row['orders_path']); ?>' class='inputtext' />
272 </td>
273 </tr>
275 <tr>
276 <td nowrap><b><?php echo xlt('Results Path'); ?>:</b></td>
277 <td>
278 <input type='text' size='40' name='form_results_path' maxlength='255'
279 value='<?php echo attr($row['results_path']); ?>' class='inputtext' />
280 </td>
281 </tr>
283 <tr>
284 <td nowrap><b><?php echo xlt('Notes'); ?>:</b></td>
285 <td>
286 <textarea rows='3' cols='40' name='form_notes' style='width:100%'
287 wrap='virtual' class='inputtext' /><?php echo text($row['notes']) ?></textarea>
288 </td>
289 </tr>
291 </table>
293 <br />
295 <input type='submit' name='form_save' value='<?php echo xla('Save'); ?>' />
297 <?php if ($ppid) { ?>
298 &nbsp;
299 <input type='submit' name='form_delete' value='<?php echo xla('Delete'); ?>' style='color:red' />
300 <?php } ?>
302 &nbsp;
303 <input type='button' value='<?php echo xla('Cancel'); ?>' onclick='window.close()' />
304 </p>
306 </center>
307 </form>
308 </body>
309 </html>