2 // Copyright (C) 2007-2011 Rod Roark <rod@sunsetsystems.com>
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 require_once("../globals.php");
10 require_once("$srcdir/acl.inc");
11 require_once("$srcdir/formdata.inc.php");
12 require_once("../../custom/code_types.inc.php");
14 $list_id = empty($_REQUEST['list_id']) ?
'language' : $_REQUEST['list_id'];
16 // Check authorization.
17 $thisauth = acl_check('admin', 'super');
18 if (!$thisauth) die(xl('Not authorized'));
20 // If we are saving, then save.
22 if ($_POST['formaction']=='save' && $list_id) {
24 if ($list_id == 'feesheet') {
25 // special case for the feesheet list
26 sqlStatement("DELETE FROM fee_sheet_options");
27 for ($lino = 1; isset($opt["$lino"]['category']); ++
$lino) {
28 $iter = $opt["$lino"];
29 $category = formTrim($iter['category']);
30 $option = formTrim($iter['option']);
31 $codes = formTrim($iter['codes']);
32 if (strlen($category) > 0 && strlen($option) > 0) {
33 sqlInsert("INSERT INTO fee_sheet_options ( " .
34 "fs_category, fs_option, fs_codes " .
43 else if ($list_id == 'code_types') {
44 // special case for code types
45 sqlStatement("DELETE FROM code_types");
46 for ($lino = 1; isset($opt["$lino"]['ct_key']); ++
$lino) {
47 $iter = $opt["$lino"];
48 $ct_key = formTrim($iter['ct_key']);
49 $ct_id = formTrim($iter['ct_id']) +
0;
50 $ct_seq = formTrim($iter['ct_seq']) +
0;
51 $ct_mod = formTrim($iter['ct_mod']) +
0;
52 $ct_just = formTrim($iter['ct_just']);
53 $ct_mask = formTrim($iter['ct_mask']);
54 $ct_fee = empty($iter['ct_fee' ]) ?
0 : 1;
55 $ct_rel = empty($iter['ct_rel' ]) ?
0 : 1;
56 $ct_nofs = empty($iter['ct_nofs']) ?
0 : 1;
57 $ct_diag = empty($iter['ct_diag']) ?
0 : 1;
58 $ct_active = empty($iter['ct_active' ]) ?
0 : 1;
59 $ct_label = formTrim($iter['ct_label']);
60 $ct_external = formTrim($iter['ct_external']) +
0;
61 $ct_claim = empty($iter['ct_claim']) ?
0 : 1;
62 $ct_proc = empty($iter['ct_proc']) ?
0 : 1;
63 $ct_term = empty($iter['ct_term']) ?
0 : 1;
64 if (strlen($ct_key) > 0 && $ct_id > 0) {
65 sqlInsert("INSERT INTO code_types ( " .
66 "ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_mask, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term " .
91 // erase lists options and recreate them from the submitted form data
92 sqlStatement("DELETE FROM list_options WHERE list_id = '$list_id'");
93 for ($lino = 1; isset($opt["$lino"]['id']); ++
$lino) {
94 $iter = $opt["$lino"];
95 $value = empty($iter['value']) ?
0 : (formTrim($iter['value']) +
0);
96 $id = formTrim($iter['id']);
97 if (strlen($id) > 0) {
99 // Special processing for the immunizations list
100 // Map the entered cvx codes into the immunizations table cvx_code
101 sqlStatement ("UPDATE `immunizations` " .
102 "SET `cvx_code`='".$value."' " .
103 "WHERE `immunization_id`='".$id."'");
105 // Force List Based Form names to start with LBF.
106 if ($list_id == 'lbfnames' && substr($id,0,3) != 'LBF')
108 sqlInsert("INSERT INTO list_options ( " .
109 "list_id, option_id, title, seq, is_default, option_value, mapping, notes, codes " .
113 "'" . formTrim($iter['title']) . "', " .
114 "'" . formTrim($iter['seq']) . "', " .
115 "'" . formTrim($iter['default']) . "', " .
116 "'" . $value . "', " .
117 "'" . formTrim($iter['mapping']) . "', " .
118 "'" . formTrim($iter['notes']) . "', " .
119 "'" . formTrim($iter['codes']) . "' " .
125 else if ($_POST['formaction']=='addlist') {
126 // make a new list ID from the new list name
127 $newlistID = $_POST['newlistname'];
128 $newlistID = preg_replace("/\W/", "_", $newlistID);
130 // determine the position of this new list
131 $row = sqlQuery("SELECT max(seq) as maxseq FROM list_options WHERE list_id= 'lists'");
133 // add the new list to the list-of-lists
134 sqlInsert("INSERT INTO list_options ( " .
135 "list_id, option_id, title, seq, is_default, option_value " .
137 "'lists',". // the master list-of-lists
139 "'".$_POST['newlistname']."', ".
140 "'".($row['maxseq']+
1)."',".
144 else if ($_POST['formaction']=='deletelist') {
145 // delete the lists options
146 sqlStatement("DELETE FROM list_options WHERE list_id = '".$_POST['list_id']."'");
147 // delete the list from the master list-of-lists
148 sqlStatement("DELETE FROM list_options WHERE list_id = 'lists' and option_id='".$_POST['list_id']."'");
153 // Given a string of multiple instances of code_type|code|selector,
154 // make a description for each.
155 // @TODO Instead should use a function from custom/code_types.inc.php and need to remove casing functions
156 function getCodeDescriptions($codes) {
158 $arrcodes = explode('~', $codes);
160 foreach ($arrcodes as $codestring) {
161 if ($codestring === '') continue;
162 $arrcode = explode('|', $codestring);
163 $code_type = $arrcode[0];
165 $selector = $arrcode[2];
167 if ($code_type == 'PROD') {
168 $row = sqlQuery("SELECT name FROM drugs WHERE drug_id = '$code' ");
169 $desc = "$code:$selector " . $row['name'];
172 $row = sqlQuery("SELECT code_text FROM codes WHERE " .
173 "code_type = '" . $code_types[$code_type]['id'] . "' AND " .
174 "code = '$code' ORDER BY modifier LIMIT 1");
175 $desc = "$code_type:$code " . ucfirst(strtolower($row['code_text']));
177 $desc = str_replace('~', ' ', $desc);
184 // Write one option line to the form.
186 function writeOptionLine($option_id, $title, $seq, $default, $value, $mapping='', $notes='', $codes='') {
187 global $opt_line_no, $list_id;
189 $bgcolor = "#" . (($opt_line_no & 1) ?
"ddddff" : "ffdddd");
190 $checked = $default ?
" checked" : "";
192 echo " <tr bgcolor='$bgcolor'>\n";
194 echo " <td align='center' class='optcell'>";
195 echo "<input type='text' name='opt[$opt_line_no][id]' value='" .
196 htmlspecialchars($option_id, ENT_QUOTES
) . "' size='12' maxlength='63' class='optin' />";
199 echo " <td align='center' class='optcell'>";
200 echo "<input type='text' name='opt[$opt_line_no][title]' value='" .
201 htmlspecialchars($title, ENT_QUOTES
) . "' size='20' maxlength='63' class='optin' />";
204 // if not english and translating lists then show the translation
205 if ($GLOBALS['translate_lists'] && $_SESSION['language_choice'] > 1) {
206 echo " <td align='center' class='translation'>" . (htmlspecialchars( xl($title), ENT_QUOTES
)) . "</td>\n";
209 echo " <td align='center' class='optcell'>";
210 echo "<input type='text' name='opt[$opt_line_no][seq]' value='" .
211 htmlspecialchars($seq, ENT_QUOTES
) . "' size='4' maxlength='10' class='optin' />";
214 echo " <td align='center' class='optcell'>";
215 echo "<input type='checkbox' name='opt[$opt_line_no][default]' value='1' " .
216 "onclick='defClicked($opt_line_no)' class='optin'$checked />";
219 // Tax rates, contraceptive methods and LBF names have an additional attribute.
221 if ($list_id == 'taxrate' ||
$list_id == 'contrameth' ||
$list_id == 'lbfnames') {
222 echo " <td align='center' class='optcell'>";
223 echo "<input type='text' name='opt[$opt_line_no][value]' value='" .
224 htmlspecialchars($value, ENT_QUOTES
) . "' size='8' maxlength='15' class='optin' />";
228 // Adjustment reasons use option_value as a reason category. This is
229 // needed to distinguish between adjustments that change the invoice
230 // balance and those that just shift responsibility of payment or
231 // are used as comments.
233 else if ($list_id == 'adjreason') {
234 echo " <td align='center' class='optcell'>";
235 echo "<select name='opt[$opt_line_no][value]' class='optin'>";
237 1 => xl('Charge adjustment'),
238 2 => xl('Coinsurance'),
239 3 => xl('Deductible'),
240 4 => xl('Other pt resp'),
242 ) as $key => $desc) {
243 echo "<option value='$key'";
244 if ($key == $value) echo " selected";
245 echo ">" . htmlspecialchars($desc) . "</option>";
251 // Address book categories use option_value to flag category as a
252 // person-centric vs company-centric vs indifferent.
254 else if ($list_id == 'abook_type') {
255 echo " <td align='center' class='optcell'>";
256 echo "<select name='opt[$opt_line_no][value]' class='optin'>";
258 1 => xl('Unassigned'),
261 ) as $key => $desc) {
262 echo "<option value='$key'";
263 if ($key == $value) echo " selected";
264 echo ">" . htmlspecialchars($desc) . "</option>";
270 // Immunization categories use option_value to map list items
273 else if ($list_id == 'immunizations') {
274 echo " <td align='center' class='optcell'>";
275 echo "<input type='text' size='10' name='opt[$opt_line_no][value]' " .
276 "value='" . htmlspecialchars($value,ENT_QUOTES
) . "' onclick='sel_cvxcode(this)' " .
277 "title='" . htmlspecialchars( xl('Click to select or change CVX code'), ENT_QUOTES
) . "'/>";
281 // IPPF includes the ability to map each list item to a "master" identifier.
282 // Sports teams use this for some extra info for fitness levels.
284 if ($GLOBALS['ippf_specific'] ||
$list_id == 'fitness') {
285 echo " <td align='center' class='optcell'>";
286 echo "<input type='text' name='opt[$opt_line_no][mapping]' value='" .
287 htmlspecialchars($mapping, ENT_QUOTES
) . "' size='12' maxlength='15' class='optin' />";
291 echo " <td align='center' class='optcell'>";
292 echo "<input type='text' name='opt[$opt_line_no][notes]' value='" .
293 htmlspecialchars($notes, ENT_QUOTES
) . "' size='25' maxlength='255' class='optin' />";
296 echo " <td align='center' class='optcell'>";
297 echo "<input type='text' name='opt[$opt_line_no][codes]' title='" .
298 xla('Clinical Term Code(s)') ."' value='" .
299 htmlspecialchars($codes, ENT_QUOTES
) . "' onclick='select_clin_term_code(this)' size='25' maxlength='255' class='optin' />";
305 // Write a form line as above but for the special case of the Fee Sheet.
307 function writeFSLine($category, $option, $codes) {
311 $bgcolor = "#" . (($opt_line_no & 1) ?
"ddddff" : "ffdddd");
313 $descs = getCodeDescriptions($codes);
315 echo " <tr bgcolor='$bgcolor'>\n";
317 echo " <td align='center' class='optcell'>";
318 echo "<input type='text' name='opt[$opt_line_no][category]' value='" .
319 htmlspecialchars($category, ENT_QUOTES
) . "' size='20' maxlength='63' class='optin' />";
322 echo " <td align='center' class='optcell'>";
323 echo "<input type='text' name='opt[$opt_line_no][option]' value='" .
324 htmlspecialchars($option, ENT_QUOTES
) . "' size='20' maxlength='63' class='optin' />";
327 echo " <td align='left' class='optcell'>";
328 echo " <div id='codelist_$opt_line_no'>";
329 if (strlen($descs)) {
330 $arrdescs = explode('~', $descs);
332 foreach ($arrdescs as $desc) {
333 echo "<a href='' onclick='return delete_code($opt_line_no,$i)' title='" . xl('Delete') . "'>";
334 echo "[x] </a>$desc<br />";
339 echo "<a href='' onclick='return select_code($opt_line_no)'>";
340 echo "[" . xl('Add') . "]</a>";
342 echo "<input type='hidden' name='opt[$opt_line_no][codes]' value='" .
343 htmlspecialchars($codes, ENT_QUOTES
) . "' />";
344 echo "<input type='hidden' name='opt[$opt_line_no][descs]' value='" .
345 htmlspecialchars($descs, ENT_QUOTES
) . "' />";
351 // Helper functions for writeCTLine():
353 function ctGenCell($opt_line_no, $ct_array, $name, $size, $maxlength, $title='') {
354 $value = isset($ct_array[$name]) ?
$ct_array[$name] : '';
355 $s = " <td align='center' class='optcell'";
356 if ($title) $s .= " title='" . addslashes($title) . "'";
358 $s .= "<input type='text' name='opt[$opt_line_no][$name]' value='";
359 $s .= htmlspecialchars($value, ENT_QUOTES
);
360 $s .= "' size='$size' maxlength='$maxlength' class='optin' />";
365 function ctGenCbox($opt_line_no, $ct_array, $name, $title='') {
366 $checked = empty($ct_array[$name]) ?
'' : 'checked ';
367 $s = " <td align='center' class='optcell'";
368 if ($title) $s .= " title='" . addslashes($title) . "'";
370 $s .= "<input type='checkbox' name='opt[$opt_line_no][$name]' value='1' ";
376 // Write a form line as above but for the special case of Code Types.
378 function writeCTLine($ct_array) {
379 global $opt_line_no,$cd_external_options;
382 $bgcolor = "#" . (($opt_line_no & 1) ?
"ddddff" : "ffdddd");
384 echo " <tr bgcolor='$bgcolor'>\n";
386 echo ctGenCBox($opt_line_no, $ct_array, 'ct_active',
387 xl('Is this code type active?'));
388 echo ctGenCell($opt_line_no, $ct_array, 'ct_key' , 6, 15,
389 xl('Unique human-readable identifier for this type'));
390 echo ctGenCell($opt_line_no, $ct_array, 'ct_id' , 2, 11,
391 xl('Unique numeric identifier for this type'));
392 echo ctGenCell($opt_line_no, $ct_array, 'ct_label' , 6, 30,
393 xl('Label for this type'));
394 echo ctGenCell($opt_line_no, $ct_array, 'ct_seq' , 2, 3,
395 xl('Numeric display order'));
396 echo ctGenCell($opt_line_no, $ct_array, 'ct_mod' , 1, 2,
397 xl('Length of modifier, 0 if none'));
398 echo ctGenCell($opt_line_no, $ct_array, 'ct_just', 4, 15,
399 xl('If billing justification is used enter the name of the diagnosis code type.'));
400 echo ctGenCell($opt_line_no, $ct_array, 'ct_mask', 6, 9,
401 xl('Specifies formatting for codes. # = digit, @ = alpha, * = any character. Empty if not used.'));
402 echo ctGenCBox($opt_line_no, $ct_array, 'ct_claim',
403 xl('Is this code type used in claims?'));
404 echo ctGenCBox($opt_line_no, $ct_array, 'ct_fee',
405 xl('Are fees charged for this type?'));
406 echo ctGenCBox($opt_line_no, $ct_array, 'ct_rel',
407 xl('Does this type allow related codes?'));
408 echo ctGenCBox($opt_line_no, $ct_array, 'ct_nofs',
409 xl('Is this type hidden in the fee sheet?'));
410 echo ctGenCBox($opt_line_no, $ct_array, 'ct_proc',
411 xl('Is this a procedure/service type?'));
412 echo ctGenCBox($opt_line_no, $ct_array, 'ct_diag',
413 xl('Is this a diagnosis type?'));
414 echo ctGenCBox($opt_line_no, $ct_array, 'ct_term',
415 xl('Is this a Clinical Term code type?'));
416 // Show the external code types selector
417 $value_ct_external = isset($ct_array['ct_external']) ?
$ct_array['ct_external'] : '';
418 echo " <td title='" . xla('Is this using external sql tables? If it is, then choose the format.') . "' align='center' class='optcell'>";
419 echo "<select name='opt[$opt_line_no][ct_external]' class='optin'>";
420 foreach ( $cd_external_options as $key => $desc) {
421 echo "<option value='" . attr($key) . "'";
422 if ($key == $value_ct_external) echo " selected";
423 echo ">" . text($desc) . "</option>";
433 <?php
html_header_show();?
>
435 <!-- supporting javascript code
-->
436 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.js"></script
>
438 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
439 <title
><?php
xl('List Editor','e'); ?
></title
>
442 tr
.head
{ font
-size
:10pt
; background
-color
:#cccccc; text-align:center; }
443 tr
.detail
{ font
-size
:10pt
; }
444 td
{ font
-size
:10pt
; }
445 input
{ font
-size
:10pt
; }
446 a
, a
:visited
, a
:hover
{ color
:#0000cc; }
448 .optin
{ background
-color
:transparent
; }
449 .help
{ cursor
:help
; }
450 .translation
{ color
:green
; }
453 <script type
="text/javascript" src
="../../library/dialog.js"></script
>
455 <script language
="JavaScript">
457 var current_lino
= 0;
459 // Helper function to set the contents of a div.
460 // This is for Fee Sheet administration.
461 function setDivContent(id
, content
) {
462 if (document
.getElementById
) {
463 var x
= document
.getElementById(id
);
465 x
.innerHTML
= content
;
467 else if (document
.all
) {
468 var x
= document
.all
[id
];
469 x
.innerHTML
= content
;
473 // Given a line number, redisplay its descriptive list of codes.
474 // This is for Fee Sheet administration.
475 function displayCodes(lino
) {
476 var f
= document
.forms
[0];
478 var descs
= f
['opt[' + lino +
'][descs]'].value
;
480 var arrdescs
= descs
.split('~');
481 for (var i
= 0; i
< arrdescs
.length
; ++i
) {
482 s +
= "<a href='' onclick='return delete_code(" + lino +
"," + i +
")' title='<?php xl('Delete','e'); ?>'>";
483 s +
= "[x] </a>" + arrdescs
[i
] +
"<br />";
486 setDivContent('codelist_' + lino
, s
);
489 // Helper function to remove a Fee Sheet code.
490 function dc_substring(s
, i
) {
492 var j
= s
.indexOf('~', i
);
493 if (j
< 0) { // deleting last segment
494 if (i
> 0) r
= s
.substring(0, i
-1); // omits trailing ~
496 else { // not last segment
497 r
= s
.substring(0, i
) + s
.substring(j +
1);
502 // Remove a generated Fee Sheet code.
503 function delete_code(lino
, seqno
) {
504 var f
= document
.forms
[0];
505 var celem
= f
['opt[' + lino +
'][codes]'];
506 var delem
= f
['opt[' + lino +
'][descs]'];
509 for (var i
= 0; i
< seqno
; ++i
) {
510 ci
= celem
.value
.indexOf('~', ci
) +
1;
511 di
= delem
.value
.indexOf('~', di
) +
1;
513 celem
.value
= dc_substring(celem
.value
, ci
);
514 delem
.value
= dc_substring(delem
.value
, di
);
519 // This invokes the find-code popup.
520 // For Fee Sheet administration.
521 function select_code(lino
) {
523 dlgopen('../patient_file/encounter/find_code_popup.php', '_blank', 700, 400);
527 // This invokes the find-code popup.
528 // For CVX/immunization code administration.
529 function sel_cvxcode(e
) {
530 current_sel_name
= e
.name
;
531 dlgopen('../patient_file/encounter/find_code_popup.php?codetype=CVX', '_blank', 500, 400);
534 // This invokes the find-code popup.
535 // For CVX/immunization code administration.
536 function select_clin_term_code(e
) {
537 current_sel_clin_term
= e
.name
;
538 dlgopen('../patient_file/encounter/find_code_popup.php?codetype=<?php echo attr(collect_codetypes("clinical_term","csv")) ?>', '_blank', 500, 400);
541 // This is for callback by the find-code popup.
542 function set_related(codetype
, code
, selector
, codedesc
) {
543 if (typeof(current_sel_name
) == 'undefined' && typeof(current_sel_clin_term
) == 'undefined')
545 // Coming from Fee Sheet edit
546 var f
= document
.forms
[0];
547 var celem
= f
['opt[' + current_lino +
'][codes]'];
548 var delem
= f
['opt[' + current_lino +
'][descs]'];
550 while ((i
= codedesc
.indexOf('~')) >= 0) {
551 codedesc
= codedesc
.substring(0, i
) +
' ' + codedesc
.substring(i+
1);
558 celem
.value +
= codetype +
'|' + code +
'|' + selector
;
559 if (codetype
== 'PROD') delem
.value +
= code +
':' + selector +
' ' + codedesc
;
560 else delem
.value +
= codetype +
':' + code +
' ' + codedesc
;
565 displayCodes(current_lino
);
567 else if (typeof(current_sel_name
) == 'undefined') {
568 // Coming from the Clinical Terms Code(s) edit
569 var f
= document
.forms
[0][current_sel_clin_term
];
572 if (s
.length
> 0) s +
= ';';
573 s +
= codetype +
':' + code
;
581 // Coming from Immunizations edit
582 var f
= document
.forms
[0][current_sel_name
];
594 // Called when a "default" checkbox is clicked. Clears all the others.
595 function defClicked(lino
) {
596 var f
= document
.forms
[0];
597 for (var i
= 1; f
['opt[' + i +
'][default]']; ++i
) {
598 if (i
!= lino
) f
['opt[' + i +
'][default]'].checked
= false;
602 // Form validation and submission.
603 // This needs more validation.
604 function mysubmit() {
605 var f
= document
.forms
[0];
606 if (f
.list_id
.value
== 'code_types') {
607 for (var i
= 1; f
['opt[' + i +
'][ct_key]'].value
; ++i
) {
608 var ikey
= 'opt[' + i +
']';
609 for (var j
= i+
1; f
['opt[' + j +
'][ct_key]'].value
; ++j
) {
610 var jkey
= 'opt[' + j +
']';
611 if (f
[ikey+
'[ct_key]'].value
== f
[jkey+
'[ct_key]'].value
) {
612 alert('<?php echo xl('Error
: duplicated name on line
') ?>' +
' ' + j
);
615 if (parseInt(f
[ikey+
'[ct_id]'].value
) == parseInt(f
[jkey+
'[ct_id]'].value
)) {
616 alert('<?php echo xl('Error
: duplicated ID on line
') ?>' +
' ' + j
);
629 <body
class="body_top">
631 <form method
='post' name
='theform' id
='theform' action
='edit_list.php'>
632 <input type
="hidden" name
="formaction" id
="formaction">
634 <p
><b
><?php
xl('Edit list','e'); ?
>:</b
> 
;
635 <select name
='list_id' id
="list_id">
638 // List order depends on language translation options.
639 $lang_id = empty($_SESSION['language_choice']) ?
'1' : $_SESSION['language_choice'];
641 if (($lang_id == '1' && !empty($GLOBALS['skip_english_translation'])) ||
642 !$GLOBALS['translate_lists'])
644 $res = sqlStatement("SELECT option_id, title FROM list_options WHERE " .
645 "list_id = 'lists' ORDER BY title, seq");
648 // Use and sort by the translated list name.
649 $res = sqlStatement("SELECT lo.option_id, " .
650 "IF(LENGTH(ld.definition),ld.definition,lo.title) AS title " .
651 "FROM list_options AS lo " .
652 "LEFT JOIN lang_constants AS lc ON lc.constant_name = lo.title " .
653 "LEFT JOIN lang_definitions AS ld ON ld.cons_id = lc.cons_id AND " .
654 "ld.lang_id = '$lang_id' " .
655 "WHERE lo.list_id = 'lists' " .
656 "ORDER BY IF(LENGTH(ld.definition),ld.definition,lo.title), lo.seq");
659 while ($row = sqlFetchArray($res)) {
660 $key = $row['option_id'];
661 echo "<option value='$key'";
662 if ($key == $list_id) echo " selected";
663 echo ">" . $row['title'] . "</option>\n";
668 <input type
="button" id
="<?php echo $list_id; ?>" class="deletelist" value
=<?php
xl('Delete List','e','\'','\''); ?
>>
669 <input type
="button" id
="newlist" class="newlist" value
=<?php
xl('New List','e','\'','\''); ?
>>
674 <table cellpadding
='2' cellspacing
='0'>
676 <?php
if ($list_id == 'feesheet') { ?
>
677 <td
><b
><?php
xl('Group' ,'e'); ?
></b
></td
>
678 <td
><b
><?php
xl('Option' ,'e'); ?
></b
></td
>
679 <td
><b
><?php
xl('Generates','e'); ?
></b
></td
>
680 <?php
} else if ($list_id == 'code_types') { ?
>
681 <td
><b
><?php
xl('Active' ,'e'); ?
></b
></td
>
682 <td
><b
><?php
xl('Key' ,'e'); ?
></b
></td
>
683 <td
><b
><?php
xl('ID' ,'e'); ?
></b
></td
>
684 <td
><b
><?php
xl('Label' ,'e'); ?
></b
></td
>
685 <td
><b
><?php
xl('Seq' ,'e'); ?
></b
></td
>
686 <td
><b
><?php
xl('ModLength' ,'e'); ?
></b
></td
>
687 <td
><b
><?php
xl('Justify' ,'e'); ?
></b
></td
>
688 <td
><b
><?php
xl('Mask' ,'e'); ?
></b
></td
>
689 <td
><b
><?php
xl('Claims' ,'e'); ?
></b
></td
>
690 <td
><b
><?php
xl('Fees' ,'e'); ?
></b
></td
>
691 <td
><b
><?php
xl('Relations' ,'e'); ?
></b
></td
>
692 <td
><b
><?php
xl('Hide' ,'e'); ?
></b
></td
>
693 <td
><b
><?php
xl('Procedure' ,'e'); ?
></b
></td
>
694 <td
><b
><?php
xl('Diagnosis' ,'e'); ?
></b
></td
>
695 <td
><b
><?php
xl('Clinical Term','e'); ?
></b
></td
>
696 <td
><b
><?php
xl('External' ,'e'); ?
></b
></td
>
698 <td title
=<?php
xl('Click to edit','e','\'','\''); ?
>><b
><?php
xl('ID','e'); ?
></b
></td
>
699 <td
><b
><?php
xl('Title' ,'e'); ?
></b
></td
>
700 <?php
//show translation column if not english and the translation lists flag is set
701 if ($GLOBALS['translate_lists'] && $_SESSION['language_choice'] > 1) {
702 echo "<td><b>".xl('Translation')."</b><span class='help' title='".xl('The translated Title that will appear in current language')."'> (?)</span></td>";
704 <td
><b
><?php
xl('Order' ,'e'); ?
></b
></td
>
705 <td
><b
><?php
xl('Default','e'); ?
></b
></td
>
706 <?php
if ($list_id == 'taxrate') { ?
>
707 <td
><b
><?php
xl('Rate' ,'e'); ?
></b
></td
>
708 <?php
} else if ($list_id == 'contrameth') { ?
>
709 <td
><b
><?php
xl('Effectiveness','e'); ?
></b
></td
>
710 <?php
} else if ($list_id == 'lbfnames') { ?
>
711 <td title
='<?php xl('Number of past history columns
','e
'); ?>'><b
><?php
xl('Repeats','e'); ?
></b
></td
>
712 <?php
} else if ($list_id == 'fitness') { ?
>
713 <td
><b
><?php
xl('Color:Abbr','e'); ?
></b
></td
>
714 <?php
} else if ($list_id == 'adjreason' ||
$list_id == 'abook_type') { ?
>
715 <td
><b
><?php
xl('Type','e'); ?
></b
></td
>
716 <?php
} else if ($list_id == 'immunizations') { ?
>
717 <td
><b
> 
; 
; 
; 
;<?php
xl('CVX Code Mapping','e'); ?
></b
></td
>
718 <?php
} if ($GLOBALS['ippf_specific']) { ?
>
719 <td
><b
><?php
xl('Global ID','e'); ?
></b
></td
>
721 <td
><b
><?php
xl('Notes','e'); ?
></b
></td
>
722 <td
><b
><?php
xl('Code(s)','e'); ?
></b
></td
>
723 <?php
} // end not fee sheet ?>
727 // Get the selected list's elements.
729 if ($list_id == 'feesheet') {
730 $res = sqlStatement("SELECT * FROM fee_sheet_options " .
731 "ORDER BY fs_category, fs_option");
732 while ($row = sqlFetchArray($res)) {
733 writeFSLine($row['fs_category'], $row['fs_option'], $row['fs_codes']);
735 for ($i = 0; $i < 3; ++
$i) {
736 writeFSLine('', '', '');
739 else if ($list_id == 'code_types') {
740 $res = sqlStatement("SELECT * FROM code_types " .
741 "ORDER BY ct_seq, ct_key");
742 while ($row = sqlFetchArray($res)) {
745 for ($i = 0; $i < 3; ++
$i) {
746 writeCTLine(array());
750 $res = sqlStatement("SELECT * FROM list_options WHERE " .
751 "list_id = '$list_id' ORDER BY seq,title");
752 while ($row = sqlFetchArray($res)) {
753 writeOptionLine($row['option_id'], $row['title'], $row['seq'],
754 $row['is_default'], $row['option_value'], $row['mapping'],
755 $row['notes'],$row['codes']);
757 for ($i = 0; $i < 3; ++
$i) {
758 writeOptionLine('', '', '', '', 0);
767 <input type
='button' name
='form_save' id
='form_save' value
='<?php xl('Save
','e
'); ?>' />
773 <!-- template DIV that appears when user chooses to make a
new list -->
774 <div id
="newlistdetail" style
="border: 1px solid black; padding: 3px; display: none; visibility: hidden; background-color: lightgrey;">
775 <?php
xl('List Name','e'); ?
>: <input type
="textbox" size
="20" maxlength
="30" name
="newlistname" id
="newlistname">
777 <input type
="button" class="savenewlist" value
=<?php
xl('Save New List','e','\'','\''); ?
>>
778 <input type
="button" class="cancelnewlist" value
=<?php
xl('Cancel','e','\'','\''); ?
>>
781 <script language
="javascript">
782 // jQuery stuff to make the page a little easier to use
784 $
(document
).ready(function(){
785 $
("#form_save").click(function() { SaveChanges(); });
786 $
("#list_id").change(function() { $
('#theform').submit(); });
788 $
(".newlist").click(function() { NewList(this
); });
789 $
(".savenewlist").click(function() { SaveNewList(this
); });
790 $
(".deletelist").click(function() { DeleteList(this
); });
791 $
(".cancelnewlist").click(function() { CancelNewList(this
); });
793 var SaveChanges
= function() {
794 $
("#formaction").val("save");
795 // $('#theform').submit();
799 // show the DIV to create a new list
800 var NewList
= function(btnObj
) {
801 // show the field details DIV
802 $
('#newlistdetail').css('visibility', 'visible');
803 $
('#newlistdetail').css('display', 'block');
804 $
(btnObj
).parent().append($
("#newlistdetail"));
805 $
('#newlistdetail > #newlistname').focus();
808 var SaveNewList
= function() {
809 // the list name can only have letters, numbers, spaces and underscores
810 // AND it cannot start with a number
811 if ($
("#newlistname").val().match(/^\d+
/)) {
812 alert("<?php xl('List names cannot start with numbers.','e'); ?>");
815 var validname
= $
("#newlistname").val().replace(/[^A
-za
-z0
-9 -]/g
, "_"); // match any non-word characters and replace them
816 if (validname
!= $
("#newlistname").val()) {
817 if (! confirm("<?php xl('Your list name has been changed to meet naming requirements.','e','','\n') . xl('Please compare the new name','e','',', \''); ?>"+validname+
"<?php xl('with the old name','e','\' ',', \''); ?>"+$
("#newlistname").val()+
"<?php xl('Do you wish to continue with the new name?','e','\'.\n',''); ?>"))
822 $
("#newlistname").val(validname
);
824 // submit the form to add a new field to a specific group
825 $
("#formaction").val("addlist");
826 $
("#theform").submit();
828 // actually delete an entire list from the database
829 var DeleteList
= function(btnObj
) {
830 var listid
= $
(btnObj
).attr("id");
831 if (confirm("<?php xl('WARNING','e','',' - ') . xl('This action cannot be undone.','e','','\n') . xl('Are you sure you wish to delete the entire list','e',' ','('); ?>"+listid+
")?")) {
832 // submit the form to add a new field to a specific group
833 $
("#formaction").val("deletelist");
834 $
("#deletelistname").val(listid
);
835 $
("#theform").submit();
839 // just hide the new list DIV
840 var CancelNewList
= function(btnObj
) {
841 // hide the list details DIV
842 $
('#newlistdetail').css('visibility', 'hidden');
843 $
('#newlistdetail').css('display', 'none');
844 // reset the new group values to a default
845 $
('#newlistdetail > #newlistname').val("");