fixed display of non-calendar providers in the Billing Report page
[openemr.git] / interface / usergroup / addrbook_edit.php
blobc1ad74be540990efd400f7a6e684e33c2b91efdb
1 <?php
2 // Copyright (C) 2006-2007 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 include_once("../globals.php");
10 include_once("$srcdir/acl.inc");
11 require_once("$srcdir/options.inc.php");
12 require_once("$srcdir/formdata.inc.php");
14 $userid = $_REQUEST['userid'];
16 $info_msg = "";
18 function QuotedOrNull($fld) {
19 $fld = formDataCore($fld,true);
20 if ($fld) return "'$fld'";
21 return "NULL";
24 function invalue($name) {
25 $fld = formData($name,"P",true);
26 return "'$fld'";
29 function rbinput($name, $value, $desc, $colname) {
30 global $row;
31 $ret = "<input type='radio' name='$name' value='$value'";
32 if ($row[$colname] == $value) $ret .= " checked";
33 $ret .= " />$desc";
34 return $ret;
37 function rbvalue($rbname) {
38 $tmp = $_POST[$rbname];
39 if (! $tmp) $tmp = '0';
40 return "'$tmp'";
44 <html>
45 <head>
46 <title><?php echo $userid ? xl('Edit') : xl('Add New') ?> <?php xl('Person','e'); ?></title>
47 <link rel="stylesheet" href='<?php echo $css_header ?>' type='text/css'>
49 <style>
50 td { font-size:10pt; }
52 .inputtext {
54 font-family:monospace;
55 font-size:10pt;
56 font-weight:normal;
57 border-style:solid;
58 border-width:1px;
59 border-color: #000000;
60 background-color:transparent;
62 padding-left:2px;
63 padding-right:2px;
66 .button {
67 font-family:sans-serif;
68 font-size:9pt;
69 font-weight:bold;
71 </style>
73 <script language="JavaScript">
74 </script>
76 </head>
78 <body class="body_top">
79 <?php
80 // If we are saving, then save and close the window.
82 if ($_POST['form_save']) {
84 if ($userid) {
86 $query = "UPDATE users SET " .
87 "title = " . invalue('form_title') . ", " .
88 "fname = " . invalue('form_fname') . ", " .
89 "lname = " . invalue('form_lname') . ", " .
90 "mname = " . invalue('form_mname') . ", " .
91 "specialty = " . invalue('form_specialty') . ", " .
92 "organization = " . invalue('form_organization') . ", " .
93 "valedictory = " . invalue('form_valedictory') . ", " .
94 "assistant = " . invalue('form_assistant') . ", " .
95 "federaltaxid = " . invalue('form_federaltaxid') . ", " .
96 "upin = " . invalue('form_upin') . ", " .
97 "npi = " . invalue('form_npi') . ", " .
98 "taxonomy = " . invalue('form_taxonomy') . ", " .
99 "email = " . invalue('form_email') . ", " .
100 "url = " . invalue('form_url') . ", " .
101 "street = " . invalue('form_street') . ", " .
102 "streetb = " . invalue('form_streetb') . ", " .
103 "city = " . invalue('form_city') . ", " .
104 "state = " . invalue('form_state') . ", " .
105 "zip = " . invalue('form_zip') . ", " .
106 "street2 = " . invalue('form_street2') . ", " .
107 "streetb2 = " . invalue('form_streetb2') . ", " .
108 "city2 = " . invalue('form_city2') . ", " .
109 "state2 = " . invalue('form_state2') . ", " .
110 "zip2 = " . invalue('form_zip2') . ", " .
111 "phone = " . invalue('form_phone') . ", " .
112 "phonew1 = " . invalue('form_phonew1') . ", " .
113 "phonew2 = " . invalue('form_phonew2') . ", " .
114 "phonecell = " . invalue('form_phonecell') . ", " .
115 "fax = " . invalue('form_fax') . ", " .
116 "notes = " . invalue('form_notes') . " " .
117 "WHERE id = '$userid'";
118 sqlStatement($query);
120 } else {
122 $userid = sqlInsert("INSERT INTO users ( " .
123 "username, password, authorized, info, source, " .
124 "title, fname, lname, mname, " .
125 "federaltaxid, federaldrugid, upin, facility, see_auth, active, npi, taxonomy, " .
126 "specialty, organization, valedictory, assistant, billname, email, url, " .
127 "street, streetb, city, state, zip, " .
128 "street2, streetb2, city2, state2, zip2, " .
129 "phone, phonew1, phonew2, phonecell, fax, notes " .
130 ") VALUES ( " .
131 "'', " . // username
132 "'', " . // password
133 "0, " . // authorized
134 "'', " . // info
135 "NULL, " . // source
136 invalue('form_title') . ", " .
137 invalue('form_fname') . ", " .
138 invalue('form_lname') . ", " .
139 invalue('form_mname') . ", " .
140 invalue('form_federaltaxid') . ", " .
141 "'', " . // federaldrugid
142 invalue('form_upin') . ", " .
143 "'', " . // facility
144 "0, " . // see_auth
145 "1, " . // active
146 invalue('form_npi') . ", " .
147 invalue('form_taxonomy') . ", " .
148 invalue('form_specialty') . ", " .
149 invalue('form_organization') . ", " .
150 invalue('form_valedictory') . ", " .
151 invalue('form_assistant') . ", " .
152 "'', " . // billname
153 invalue('form_email') . ", " .
154 invalue('form_url') . ", " .
155 invalue('form_street') . ", " .
156 invalue('form_streetb') . ", " .
157 invalue('form_city') . ", " .
158 invalue('form_state') . ", " .
159 invalue('form_zip') . ", " .
160 invalue('form_street2') . ", " .
161 invalue('form_streetb2') . ", " .
162 invalue('form_city2') . ", " .
163 invalue('form_state2') . ", " .
164 invalue('form_zip2') . ", " .
165 invalue('form_phone') . ", " .
166 invalue('form_phonew1') . ", " .
167 invalue('form_phonew2') . ", " .
168 invalue('form_phonecell') . ", " .
169 invalue('form_fax') . ", " .
170 invalue('form_notes') . " " .
171 ")");
176 else if ($_POST['form_delete']) {
178 if ($userid) {
179 // Be careful not to delete internal users.
180 sqlStatement("DELETE FROM users WHERE id = '$userid' AND username = ''");
185 if ($_POST['form_save'] || $_POST['form_delete']) {
186 // Close this window and redisplay the updated list.
187 echo "<script language='JavaScript'>\n";
188 if ($info_msg) echo " alert('$info_msg');\n";
189 echo " window.close();\n";
190 echo " if (opener.refreshme) opener.refreshme();\n";
191 echo "</script></body></html>\n";
192 exit();
195 if ($userid) {
196 $row = sqlQuery("SELECT * FROM users WHERE id = '$userid'");
199 <form method='post' name='theform' action='addrbook_edit.php?userid=<?php echo $userid ?>'>
200 <center>
202 <table border='0' width='100%'>
204 <tr>
205 <td width='1%' nowrap><b><?php xl('Name','e'); ?>:</b></td>
206 <td>
207 <?php
208 generate_form_field(array('data_type'=>1,'field_id'=>'title','list_id'=>'titles','empty_title'=>''), $row['title']);
210 </select>
211 <b><?php xl('Last','e'); ?>:</b><input type='text' size='10' name='form_lname' class='inputtext'
212 maxlength='50' value='<?php echo htmlspecialchars($row['lname'], ENT_QUOTES); ?>'/>&nbsp;
213 <b><?php xl('First','e'); ?>:</b> <input type='text' size='10' name='form_fname' class='inputtext'
214 maxlength='50' value='<?php echo htmlspecialchars($row['fname'], ENT_QUOTES); ?>' />&nbsp;
215 <b><?php xl('Middle','e'); ?>:</b> <input type='text' size='4' name='form_mname' class='inputtext'
216 maxlength='50' value='<?php echo htmlspecialchars($row['mname'], ENT_QUOTES); ?>' />
217 </td>
218 </tr>
220 <tr>
221 <td nowrap><b><?php xl('Specialty','e'); ?>:</b></td>
222 <td>
223 <input type='text' size='40' name='form_specialty' maxlength='250'
224 value='<?php echo htmlspecialchars($row['specialty'], ENT_QUOTES); ?>'
225 style='width:100%' class='inputtext' />
226 </td>
227 </tr>
229 <tr>
230 <td nowrap><b><?php xl('Organization','e'); ?>:</b></td>
231 <td>
232 <input type='text' size='40' name='form_organization' maxlength='250'
233 value='<?php echo htmlspecialchars($row['organization'], ENT_QUOTES); ?>'
234 style='width:100%' class='inputtext' />
235 </td>
236 </tr>
238 <tr>
239 <td nowrap><b><?php xl('Valedictory','e'); ?>:</b></td>
240 <td>
241 <input type='text' size='40' name='form_valedictory' maxlength='250'
242 value='<?php echo htmlspecialchars($row['valedictory'], ENT_QUOTES); ?>'
243 style='width:100%' class='inputtext' />
244 </td>
245 </tr>
247 <tr>
248 <td nowrap><b><?php xl('Home Phone','e'); ?>:</b></td>
249 <td>
250 <input type='text' size='11' name='form_phone' value='<?php echo htmlspecialchars($row['phone'], ENT_QUOTES); ?>'
251 maxlength='30' class='inputtext' />&nbsp;
252 <b><?php xl('Mobile','e'); ?>:</b><input type='text' size='11' name='form_phonecell'
253 maxlength='30' value='<?php echo htmlspecialchars($row['phonecell'], ENT_QUOTES); ?>' class='inputtext' />
254 </td>
255 </tr>
257 <tr>
258 <td nowrap><b><?php xl('Work Phone','e'); ?>:</b></td>
259 <td>
260 <input type='text' size='11' name='form_phonew1' value='<?php echo htmlspecialchars($row['phonew1'], ENT_QUOTES); ?>'
261 maxlength='30' class='inputtext' />&nbsp;
262 <b><?php xl('2nd','e'); ?>:</b><input type='text' size='11' name='form_phonew2' value='<?php echo htmlspecialchars($row['phonew2'], ENT_QUOTES); ?>'
263 maxlength='30' class='inputtext' />&nbsp;
264 <b><?php xl('Fax','e'); ?>:</b> <input type='text' size='11' name='form_fax' value='<?php echo htmlspecialchars($row['fax'], ENT_QUOTES); ?>'
265 maxlength='30' class='inputtext' />
266 </td>
267 </tr>
269 <tr>
270 <td nowrap><b><?php xl('Assistant','e'); ?>:</b></td>
271 <td>
272 <input type='text' size='40' name='form_assistant' maxlength='250'
273 value='<?php echo htmlspecialchars($row['assistant'], ENT_QUOTES); ?>'
274 style='width:100%' class='inputtext' />
275 </td>
276 </tr>
278 <tr>
279 <td nowrap><b><?php xl('Email','e'); ?>:</b></td>
280 <td>
281 <input type='text' size='40' name='form_email' maxlength='250'
282 value='<?php echo htmlspecialchars($row['email'], ENT_QUOTES); ?>'
283 style='width:100%' class='inputtext' />
284 </td>
285 </tr>
287 <tr>
288 <td nowrap><b><?php xl('Website','e'); ?>:</b></td>
289 <td>
290 <input type='text' size='40' name='form_url' maxlength='250'
291 value='<?php echo htmlspecialchars($row['url'], ENT_QUOTES); ?>'
292 style='width:100%' class='inputtext' />
293 </td>
294 </tr>
296 <tr>
297 <td nowrap><b><?php xl('Main Address','e'); ?>:</b></td>
298 <td>
299 <input type='text' size='40' name='form_street' maxlength='60'
300 value='<?php echo htmlspecialchars($row['street'], ENT_QUOTES); ?>'
301 style='width:100%' class='inputtext' />
302 </td>
303 </tr>
305 <tr>
306 <td nowrap>&nbsp;</td>
307 <td>
308 <input type='text' size='40' name='form_streetb' maxlength='60'
309 value='<?php echo htmlspecialchars($row['streetb'], ENT_QUOTES); ?>'
310 style='width:100%' class='inputtext' />
311 </td>
312 </tr>
314 <tr>
315 <td nowrap><b><?php xl('City','e'); ?>:</b></td>
316 <td>
317 <input type='text' size='10' name='form_city' maxlength='30'
318 value='<?php echo htmlspecialchars($row['city'], ENT_QUOTES); ?>' class='inputtext' />&nbsp;
319 <b><?php echo xl('State')."/".xl('county'); ?>:</b> <input type='text' size='10' name='form_state' maxlength='30'
320 value='<?php echo htmlspecialchars($row['state'], ENT_QUOTES); ?>' class='inputtext' />&nbsp;
321 <b><?php xl('Postal code','e'); ?>:</b> <input type='text' size='10' name='form_zip' maxlength='20'
322 value='<?php echo htmlspecialchars($row['zip'], ENT_QUOTES); ?>' class='inputtext' />
323 </td>
324 </tr>
326 <tr>
327 <td nowrap><b><?php xl('Alt Address','e'); ?>:</b></td>
328 <td>
329 <input type='text' size='40' name='form_street2' maxlength='60'
330 value='<?php echo htmlspecialchars($row['street2'], ENT_QUOTES); ?>'
331 style='width:100%' class='inputtext' />
332 </td>
333 </tr>
335 <tr>
336 <td nowrap>&nbsp;</td>
337 <td>
338 <input type='text' size='40' name='form_streetb2' maxlength='60'
339 value='<?php echo htmlspecialchars($row['streetb2'], ENT_QUOTES); ?>'
340 style='width:100%' class='inputtext' />
341 </td>
342 </tr>
344 <tr>
345 <td nowrap><b><?php xl('City','e'); ?>:</b></td>
346 <td>
347 <input type='text' size='10' name='form_city2' maxlength='30'
348 value='<?php echo htmlspecialchars($row['city2'], ENT_QUOTES); ?>' class='inputtext' />&nbsp;
349 <b><?php echo xl('State')."/".xl('county'); ?>:</b> <input type='text' size='10' name='form_state2' maxlength='30'
350 value='<?php echo htmlspecialchars($row['state2'], ENT_QUOTES); ?>' class='inputtext' />&nbsp;
351 <b><?php xl('Postal code','e'); ?>:</b> <input type='text' size='10' name='form_zip2' maxlength='20'
352 value='<?php echo htmlspecialchars($row['zip2'], ENT_QUOTES); ?>' class='inputtext' />
353 </td>
354 </tr>
356 <tr>
357 <td nowrap><b><?php xl('UPIN','e'); ?>:</b></td>
358 <td>
359 <input type='text' size='6' name='form_upin' maxlength='6'
360 value='<?php echo htmlspecialchars($row['upin'], ENT_QUOTES); ?>' class='inputtext' />&nbsp;
361 <b><?php xl('NPI','e'); ?>:</b> <input type='text' size='10' name='form_npi' maxlength='10'
362 value='<?php echo htmlspecialchars($row['npi'], ENT_QUOTES); ?>' class='inputtext' />&nbsp;
363 <b><?php xl('TIN','e'); ?>:</b> <input type='text' size='10' name='form_federaltaxid' maxlength='10'
364 value='<?php echo htmlspecialchars($row['federaltaxid'], ENT_QUOTES); ?>' class='inputtext' />&nbsp;
365 <b><?php xl('Taxonomy','e'); ?>:</b> <input type='text' size='10' name='form_taxonomy' maxlength='10'
366 value='<?php echo htmlspecialchars($row['taxonomy'], ENT_QUOTES); ?>' class='inputtext' />
367 </td>
368 </tr>
370 <tr>
371 <td nowrap><b><?php xl('Notes','e'); ?>:</b></td>
372 <td>
373 <textarea rows='3' cols='40' name='form_notes' style='width:100%'
374 wrap='virtual' class='inputtext' /><?php echo $row['notes'] ?></textarea>
375 </td>
376 </tr>
378 </table>
380 <br />
382 <input type='submit' name='form_save' value=<?php xl('Save','e','\'','\''); ?> />
384 <?php if ($userid && !$row['username']) { ?>
385 &nbsp;
386 <input type='submit' name='form_delete' value=<?php xl('Delete','e','\'','\''); ?> style='color:red' />
387 <?php } ?>
389 &nbsp;
390 <input type='button' value=<?php xl('Cancel','e','\'','\''); ?> onclick='window.close()' />
391 </p>
393 </center>
394 </form>
395 </body>
396 </html>