Highway to PSR2
[openemr.git] / interface / orders / procedure_provider_edit.php
blob796f909ebc4486c95b95a973f6b78f26b67b2f3d
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>
23 require_once("../globals.php");
24 require_once("$srcdir/acl.inc");
25 require_once("$srcdir/options.inc.php");
27 // Collect user id if editing entry
28 $ppid = $_REQUEST['ppid'];
30 $info_msg = "";
32 function invalue($name)
34 $fld = add_escape_custom(trim($_POST[$name]));
35 return "'$fld'";
39 <html>
40 <head>
41 <script type="text/javascript" src="<?php echo $webroot ?>/interface/main/tabs/js/include_opener.js"></script>
42 <title><?php echo $ppid ? xlt('Edit') : xlt('Add New') ?> <?php echo xlt('Procedure Provider'); ?></title>
43 <link rel="stylesheet" href='<?php echo $css_header ?>' type='text/css'>
44 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-3-2/index.js"></script>
46 <style>
47 td { font-size:10pt; }
49 .inputtext {
50 padding-left:2px;
51 padding-right:2px;
54 .button {
55 font-family:sans-serif;
56 font-size:9pt;
57 font-weight:bold;
59 </style>
61 <script language="JavaScript">
62 </script>
64 </head>
66 <body class="body_top">
67 <?php
68 // If we are saving, then save and close the window.
70 if ($_POST['form_save']) {
71 $org_qry = "SELECT organization FROM users WHERE id = ?";
72 $org_res = sqlQuery($org_qry, array($_POST['form_name']));
73 $org_name = $org_res['organization'];
74 $sets =
75 "name = '" .add_escape_custom($org_name). "', " .
76 "lab_director = " . invalue('form_name') . ", " .
77 "npi = " . invalue('form_npi') . ", " .
78 "send_app_id = " . invalue('form_send_app_id') . ", " .
79 "send_fac_id = " . invalue('form_send_fac_id') . ", " .
80 "recv_app_id = " . invalue('form_recv_app_id') . ", " .
81 "recv_fac_id = " . invalue('form_recv_fac_id') . ", " .
82 "DorP = " . invalue('form_DorP') . ", " .
83 "direction = " . invalue('form_direction') . ", " .
84 "protocol = " . invalue('form_protocol') . ", " .
85 "remote_host = " . invalue('form_remote_host') . ", " .
86 "login = " . invalue('form_login') . ", " .
87 "password = " . invalue('form_password') . ", " .
88 "orders_path = " . invalue('form_orders_path') . ", " .
89 "results_path = " . invalue('form_results_path') . ", " .
90 "notes = " . invalue('form_notes');
91 if ($ppid) {
92 $query = "UPDATE procedure_providers SET $sets " .
93 "WHERE ppid = '" . add_escape_custom($ppid) . "'";
94 sqlStatement($query);
95 } else {
96 $ppid = sqlInsert("INSERT INTO procedure_providers SET $sets");
98 } else if ($_POST['form_delete']) {
99 if ($ppid) {
100 sqlStatement("DELETE FROM procedure_providers WHERE ppid = ?", array($ppid));
104 if ($_POST['form_save'] || $_POST['form_delete']) {
105 // Close this window and redisplay the updated list.
106 echo "<script language='JavaScript'>\n";
107 if ($info_msg) {
108 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";
132 $optionsStr .= "<option value='".attr($org_row['id'])."' $selected>". text($lab_org_name)."</option>";
136 <form method='post' name='theform' action='procedure_provider_edit.php?ppid=<?php echo attr($ppid) ?>'>
137 <center>
139 <table border='0' width='100%'>
141 <tr>
142 <td nowrap><b><?php echo xlt('Name'); ?>:</b></td>
143 <td>
144 <select name='form_name' id='form_name' class='inputtext' style='width:150px'>
145 <?php echo $optionsStr; ?>
146 </select>
147 </td>
148 </tr>
150 <tr>
151 <td nowrap><b><?php echo xlt('NPI'); ?>:</b></td>
152 <td>
153 <input type='text' size='10' name='form_npi' maxlength='10'
154 value='<?php echo attr($row['npi']); ?>' class='inputtext' />
155 </td>
156 </tr>
158 <tr>
159 <td nowrap><b><?php echo xlt('Sender IDs'); ?>:</b></td>
160 <td>
161 <?php echo xlt('Application'); ?>:
162 <input type='text' size='10' name='form_send_app_id' maxlength='100'
163 value='<?php echo attr($row['send_app_id']); ?>'
164 title='<?php echo xla('MSH-3.1'); ?>'
165 class='inputtext' />
166 &nbsp;<?php echo xlt('Facility'); ?>:
167 <input type='text' size='10' name='form_send_fac_id' maxlength='100'
168 value='<?php echo attr($row['send_fac_id']); ?>'
169 title='<?php echo xla('MSH-4.1'); ?>'
170 class='inputtext' />
171 </td>
172 </tr>
174 <tr>
175 <td nowrap><b><?php echo xlt('Receiver IDs'); ?>:</b></td>
176 <td>
177 <?php echo xlt('Application'); ?>:
178 <input type='text' size='10' name='form_recv_app_id' maxlength='100'
179 value='<?php echo attr($row['recv_app_id']); ?>'
180 title='<?php echo xla('MSH-5.1'); ?>'
181 class='inputtext' />
182 &nbsp;<?php echo xlt('Facility'); ?>:
183 <input type='text' size='10' name='form_recv_fac_id' maxlength='100'
184 value='<?php echo attr($row['recv_fac_id']); ?>'
185 title='<?php echo xla('MSH-6.1'); ?>'
186 class='inputtext' />
187 </td>
188 </tr>
190 <tr>
191 <td nowrap><b><?php echo xlt('Usage'); ?>:</b></td>
192 <td>
193 <select name='form_DorP' title='<?php echo xla('MSH-11'); ?>'>
194 <?php
195 foreach (array(
196 'D' => xl('Debugging'),
197 'P' => xl('Production'),
198 ) as $key => $value) {
199 echo " <option value='" . attr($key) . "'";
200 if ($key == $row['DorP']) {
201 echo " selected";
204 echo ">" . text($value) . "</option>\n";
207 </select>
208 </td>
209 </tr>
211 <tr>
212 <td nowrap><b><?php echo xlt('Protocol'); ?>:</b></td>
213 <td>
214 <select name='form_protocol'>
215 <?php
216 foreach (array(
217 // Add to this list as more protocols are supported.
218 'DL' => xl('Download'),
219 'SFTP' => xl('SFTP'),
220 'FS' => xl('Local Filesystem'),
221 ) as $key => $value) {
222 echo " <option value='" . attr($key) . "'";
223 if ($key == $row['protocol']) {
224 echo " selected";
227 echo ">" . text($value) . "</option>\n";
230 </select>
231 &nbsp;
232 <select name='form_direction'>
233 <?php
234 foreach (array(
235 'B' => xl('Bidirectional'),
236 'R' => xl('Results Only'),
237 ) as $key => $value) {
238 echo " <option value='" . attr($key) . "'";
239 if ($key == $row['direction']) {
240 echo " selected";
243 echo ">" . text($value) . "</option>\n";
246 </select>
247 </td>
248 </tr>
250 <tr>
251 <td nowrap><b><?php echo xlt('Remote Host'); ?>:</b></td>
252 <td>
253 <input type='text' size='40' name='form_remote_host' maxlength='255'
254 value='<?php echo attr($row['remote_host']); ?>' class='inputtext' />
255 </td>
256 </tr>
258 <tr>
259 <td nowrap><b><?php echo xlt('Login'); ?>:</b></td>
260 <td>
261 <input type='text' size='20' name='form_login' maxlength='255'
262 value='<?php echo attr($row['login']); ?>' class='inputtext' />
263 </td>
264 </tr>
266 <tr>
267 <td nowrap><b><?php echo xlt('Password'); ?>:</b></td>
268 <td>
269 <input type='text' size='20' name='form_password' maxlength='255'
270 value='<?php echo attr($row['password']); ?>' class='inputtext' />
271 </td>
272 </tr>
274 <tr>
275 <td nowrap><b><?php echo xlt('Orders Path'); ?>:</b></td>
276 <td>
277 <input type='text' size='40' name='form_orders_path' maxlength='255'
278 value='<?php echo attr($row['orders_path']); ?>' class='inputtext' />
279 </td>
280 </tr>
282 <tr>
283 <td nowrap><b><?php echo xlt('Results Path'); ?>:</b></td>
284 <td>
285 <input type='text' size='40' name='form_results_path' maxlength='255'
286 value='<?php echo attr($row['results_path']); ?>' class='inputtext' />
287 </td>
288 </tr>
290 <tr>
291 <td nowrap><b><?php echo xlt('Notes'); ?>:</b></td>
292 <td>
293 <textarea rows='3' cols='40' name='form_notes' style='width:100%'
294 wrap='virtual' class='inputtext' /><?php echo text($row['notes']) ?></textarea>
295 </td>
296 </tr>
298 </table>
300 <br />
302 <input type='submit' name='form_save' value='<?php echo xla('Save'); ?>' />
304 <?php if ($ppid) { ?>
305 &nbsp;
306 <input type='submit' name='form_delete' value='<?php echo xla('Delete'); ?>' style='color:red' />
307 <?php } ?>
309 &nbsp;
310 <input type='button' value='<?php echo xla('Cancel'); ?>' onclick='window.close()' />
311 </p>
313 </center>
314 </form>
315 </body>
316 </html>