a01d6da3256ffdc91919186b612448bf496f69a0
[openemr.git] / interface / patient_file / encounter / superbill_custom_full.php
bloba01d6da3256ffdc91919186b612448bf496f69a0
1 <?php
2 // This program is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU General Public License
4 // as published by the Free Software Foundation; either version 2
5 // of the License, or (at your option) any later version.
7 $fake_register_globals=false;
8 $sanitize_all_escapes=true;
10 require_once("../../globals.php");
11 require_once("../../../custom/code_types.inc.php");
12 require_once("$srcdir/sql.inc");
13 require_once("$srcdir/options.inc.php");
14 require_once("$srcdir/formatting.inc.php");
15 require_once("$srcdir/formdata.inc.php");
17 // Translation for form fields.
18 function ffescape($field) {
19 $field = add_escape_custom($field);
20 return trim($field);
23 // Format dollars for display.
25 function bucks($amount) {
26 if ($amount) {
27 $amount = oeFormatMoney($amount);
28 return $amount;
30 return '';
33 $alertmsg = '';
34 $pagesize = 100;
35 $mode = $_POST['mode'];
36 $code_id = 0;
37 $related_code = '';
38 $active = 1;
39 $reportable = 0;
40 $financial_reporting = 0;
42 if (isset($mode)) {
43 $code_id = empty($_POST['code_id']) ? '' : $_POST['code_id'] + 0;
44 $code = $_POST['code'];
45 $code_type = $_POST['code_type'];
46 $code_text = $_POST['code_text'];
47 $modifier = $_POST['modifier'];
48 $superbill = $_POST['form_superbill'];
49 $related_code = $_POST['related_code'];
50 $cyp_factor = $_POST['cyp_factor'] + 0;
51 $active = empty($_POST['active']) ? 0 : 1;
52 $reportable = empty($_POST['reportable']) ? 0 : 1; // dx reporting
53 $financial_reporting = empty($_POST['financial_reporting']) ? 0 : 1; // financial service reporting
55 $taxrates = "";
56 if (!empty($_POST['taxrate'])) {
57 foreach ($_POST['taxrate'] as $key => $value) {
58 $taxrates .= "$key:";
62 if ($mode == "delete") {
63 sqlStatement("DELETE FROM codes WHERE id = ?", array($code_id) );
64 $code_id = 0;
66 else if ($mode == "add" || $mode == "modify_complete") { // this covers both adding and modifying
67 $crow = sqlQuery("SELECT COUNT(*) AS count FROM codes WHERE " .
68 "code_type = '" . ffescape($code_type) . "' AND " .
69 "code = '" . ffescape($code) . "' AND " .
70 "modifier = '" . ffescape($modifier) . "' AND " .
71 "id != '" . add_escape_custom($code_id) . "'");
72 if ($crow['count']) {
73 $alertmsg = xl('Cannot add/update this entry because a duplicate already exists!');
75 else {
76 $sql =
77 "code = '" . ffescape($code) . "', " .
78 "code_type = '" . ffescape($code_type) . "', " .
79 "code_text = '" . ffescape($code_text) . "', " .
80 "modifier = '" . ffescape($modifier) . "', " .
81 "superbill = '" . ffescape($superbill) . "', " .
82 "related_code = '" . ffescape($related_code) . "', " .
83 "cyp_factor = '" . ffescape($cyp_factor) . "', " .
84 "taxrates = '" . ffescape($taxrates) . "', " .
85 "active = " . add_escape_custom($active) . ", " .
86 "financial_reporting = " . add_escape_custom($financial_reporting) . ", " .
87 "reportable = " . add_escape_custom($reportable);
88 if ($code_id) {
89 $query = "UPDATE codes SET $sql WHERE id = ?";
90 sqlStatement($query, array($code_id) );
91 sqlStatement("DELETE FROM prices WHERE pr_id = ? AND " .
92 "pr_selector = ''", array($code_id) );
94 else {
95 $code_id = sqlInsert("INSERT INTO codes SET $sql");
97 if (!$alertmsg) {
98 foreach ($_POST['fee'] as $key => $value) {
99 $value = $value + 0;
100 if ($value) {
101 sqlStatement("INSERT INTO prices ( " .
102 "pr_id, pr_selector, pr_level, pr_price ) VALUES ( " .
103 "?, '', ?, ?)", array($code_id,$key,$value) );
106 $code = $code_type = $code_text = $modifier = $superbill = "";
107 $code_id = 0;
108 $related_code = '';
109 $cyp_factor = 0;
110 $taxrates = '';
111 $active = 1;
112 $reportable = 0;
116 else if ($mode == "edit") { // someone clicked [Edit]
117 $sql = "SELECT * FROM codes WHERE id = ?";
118 $results = sqlStatement($sql, array($code_id) );
119 while ($row = sqlFetchArray($results)) {
120 $code = $row['code'];
121 $code_text = $row['code_text'];
122 $code_type = $row['code_type'];
123 $modifier = $row['modifier'];
124 // $units = $row['units'];
125 $superbill = $row['superbill'];
126 $related_code = $row['related_code'];
127 $cyp_factor = $row['cyp_factor'];
128 $taxrates = $row['taxrates'];
129 $active = 0 + $row['active'];
130 $reportable = 0 + $row['reportable'];
131 $financial_reporting = 0 + $row['financial_reporting'];
134 else if ($mode == "modify") { // someone clicked [Modify]
135 // this is to modify external code types, of which the modifications
136 // are stored in the codes table
137 $code_type_name_external = $_POST['code_type_name_external'];
138 $code_external = $_POST['code_external'];
139 $code_id = $_POST['code_id'];
140 $results = code_set_search($code_type_name_external,$code_external,false,false,true); // only will return one item
141 while ($row = sqlFetchArray($results)) {
142 $code = $row['code'];
143 $code_text = $row['code_text'];
144 $code_type = $code_types[$code_type_name_external]['id'];
145 $modifier = $row['modifier'];
146 // $units = $row['units'];
147 $superbill = $row['superbill'];
148 $related_code = $row['related_code'];
149 $cyp_factor = $row['cyp_factor'];
150 $taxrates = $row['taxrates'];
151 $active = $row['active'];
152 $reportable = $row['reportable'];
153 $financial_reporting = $row['financial_reporting'];
158 $related_desc = '';
159 if (!empty($related_code)) {
160 $related_desc = $related_code;
163 $fstart = $_REQUEST['fstart'] + 0;
164 $filter = $_REQUEST['filter'] + 0;
165 if ($filter) {
166 $filter_key = convert_type_id_to_key($filter);
168 $search = $_REQUEST['search'];
169 $search_reportable = $_REQUEST['search_reportable'];
170 $search_financial_reporting = $_REQUEST['search_financial_reporting'];
172 //Build the filter_elements array
173 $filter_elements = array();
174 if (!empty($search_reportable)) {
175 $filter_elements['reportable'] = $search_reportable;
177 if (!empty($search_financial_reporting)) {
178 $filter_elements['financial_reporting'] = $search_financial_reporting;
181 if ($filter) {
182 $count = sequential_code_set_search($filter_key,$search,NULL,NULL,true,false,NULL,NULL,$filter_elements);
184 else {
185 $count = sequential_code_set_search("--ALL--",$search,NULL,NULL,true,false,NULL,NULL,$filter_elements);
187 if ($fstart >= $count) $fstart -= $pagesize;
188 if ($fstart < 0) $fstart = 0;
189 $fend = $fstart + $pagesize;
190 if ($fend > $count) $fend = $count;
193 <html>
194 <head>
195 <?php html_header_show(); ?>
196 <link rel="stylesheet" href="<?php echo attr($css_header);?>" type="text/css">
197 <script type="text/javascript" src="../../../library/dialog.js"></script>
198 <script type="text/javascript" src="../../../library/textformat.js"></script>
200 <script language="JavaScript">
202 // This is for callback by the find-code popup.
203 // Appends to or erases the current list of related codes.
204 function set_related(codetype, code, selector, codedesc) {
205 var f = document.forms[0];
206 var s = f.related_code.value;
207 if (code) {
208 if (s.length > 0) s += ';';
209 s += codetype + ':' + code;
210 } else {
211 s = '';
213 f.related_code.value = s;
214 f.related_desc.value = s;
217 // This invokes the find-code popup.
218 function sel_related() {
219 var f = document.forms[0];
220 var i = f.code_type.selectedIndex;
221 var codetype = '';
222 if (i >= 0) {
223 var myid = f.code_type.options[i].value;
224 <?php
225 foreach ($code_types as $key => $value) {
226 $codeid = $value['id'];
227 $coderel = $value['rel'];
228 if (!$coderel) continue;
229 echo " if (myid == $codeid) codetype = '$coderel';";
233 if (!codetype) {
234 alert('<?php echo addslashes( xl('This code type does not accept relations.') ); ?>');
235 return;
237 dlgopen('find_code_popup.php', '_blank', 500, 400);
240 // Some validation for saving a new code entry.
241 function validEntry(f) {
242 if (!f.code.value) {
243 alert('<?php echo addslashes( xl('No code was specified!') ); ?>');
244 return false;
246 <?php if ($GLOBALS['ippf_specific']) { ?>
247 if (f.code_type.value == 12 && !f.related_code.value) {
248 alert('<?php echo addslashes( xl('A related IPPF code is required!') ); ?>');
249 return false;
251 <?php } ?>
252 return true;
255 function submitAdd() {
256 var f = document.forms[0];
257 if (!validEntry(f)) return;
258 f.mode.value = 'add';
259 f.code_id.value = '';
260 f.submit();
263 function submitUpdate() {
264 var f = document.forms[0];
265 if (! parseInt(f.code_id.value)) {
266 alert('<?php echo addslashes( xl('Cannot update because you are not editing an existing entry!') ); ?>');
267 return;
269 if (!validEntry(f)) return;
270 f.mode.value = 'add';
271 f.submit();
274 function submitModifyComplete() {
275 var f = document.forms[0];
276 f.mode.value = 'modify_complete';
277 f.submit();
280 function submitList(offset) {
281 var f = document.forms[0];
282 var i = parseInt(f.fstart.value) + offset;
283 if (i < 0) i = 0;
284 f.fstart.value = i;
285 f.submit();
288 function submitEdit(id) {
289 var f = document.forms[0];
290 f.mode.value = 'edit';
291 f.code_id.value = id;
292 f.submit();
295 function submitModify(code_type_name,code,id) {
296 var f = document.forms[0];
297 f.mode.value = 'modify';
298 f.code_external.value = code;
299 f.code_id.value = id;
300 f.code_type_name_external.value = code_type_name;
301 f.submit();
306 function submitDelete(id) {
307 var f = document.forms[0];
308 f.mode.value = 'delete';
309 f.code_id.value = id;
310 f.submit();
313 function getCTMask() {
314 var ctid = document.forms[0].code_type.value;
315 <?php
316 foreach ($code_types as $key => $value) {
317 $ctid = attr($value['id']);
318 $ctmask = attr($value['mask']);
319 echo " if (ctid == '$ctid') return '$ctmask';\n";
322 return '';
325 </script>
327 </head>
328 <body class="body_top" >
330 <?php if ($GLOBALS['concurrent_layout']) {
331 } else { ?>
332 <a href='patient_encounter.php?codefrom=superbill' target='Main'>
333 <span class='title'><?php echo xlt('Superbill Codes'); ?></span>
334 <font class='more'><?php echo text($tback);?></font></a>
335 <?php } ?>
337 <form method='post' action='superbill_custom_full.php' name='theform'>
339 <input type='hidden' name='mode' value=''>
341 <br>
343 <center>
344 <table border='0' cellpadding='0' cellspacing='0'>
346 <tr>
347 <td colspan="3"> <?php echo xlt('Not all fields are required for all codes or code types.'); ?><br><br></td>
348 </tr>
350 <tr>
351 <td><?php echo xlt('Type'); ?>:</td>
352 <td width="5">
353 </td>
354 <td>
356 <?php if ($mode != "modify") { ?>
357 <select name="code_type">
358 <?php } ?>
360 <?php $external_sets = array(); ?>
361 <?php foreach ($code_types as $key => $value) { ?>
362 <?php if ( !($value['external']) ) { ?>
363 <?php if ($mode != "modify") { ?>
364 <option value="<?php echo attr($value['id']) ?>"<?php if ($code_type == $value['id']) echo " selected" ?>><?php echo xlt($value['label']) ?></option>
365 <?php } ?>
366 <?php } ?>
367 <?php if ($value['external']) {
368 array_push($external_sets,$key);
369 } ?>
370 <?php } // end foreach ?>
372 <?php if ($mode != "modify") { ?>
373 </select>
374 <?php } ?>
376 <?php if ($mode == "modify") { ?>
377 <input type='text' size='4' name='code_type' readonly='readonly' style='display:none' value='<?php echo attr($code_type) ?>' />
378 <?php echo attr($code_type_name_external) ?>
379 <?php } ?>
381 &nbsp;&nbsp;
382 <?php echo xlt('Code'); ?>:
384 <?php if ($mode == "modify") { ?>
385 <input type='text' size='6' name='code' readonly='readonly' value='<?php echo attr($code) ?>' />
386 <?php } else { ?>
387 <input type='text' size='6' name='code' value='<?php echo attr($code) ?>'
388 onkeyup='maskkeyup(this,getCTMask())'
389 onblur='maskblur(this,getCTMask())'
391 <?php } ?>
393 <?php if (modifiers_are_used()) { ?>
394 &nbsp;&nbsp;<?php echo xlt('Modifier'); ?>:
395 <?php if ($mode == "modify") { ?>
396 <input type='text' size='3' name='modifier' readonly='readonly' value='<?php echo attr($modifier) ?>'>
397 <?php } else { ?>
398 <input type='text' size='3' name='modifier' value='<?php echo attr($modifier) ?>'>
399 <?php } ?>
400 <?php } else { ?>
401 <input type='hidden' name='modifier' value=''>
402 <?php } ?>
404 &nbsp;&nbsp;
405 <input type='checkbox' name='active' value='1'<?php if (!empty($active) || ($mode == 'modify' && $active == NULL) ) echo ' checked'; ?> />
406 <?php echo xlt('Active'); ?>
407 </td>
408 </tr>
410 <tr>
411 <td><?php echo xlt('Description'); ?>:</td>
412 <td></td>
413 <td>
415 <?php if ($mode == "modify") { ?>
416 <input type='text' size='50' name="code_text" readonly="readonly" value='<?php echo attr($code_text) ?>'>
417 <?php } else { ?>
418 <input type='text' size='50' name="code_text" value='<?php echo attr($code_text) ?>'>
419 <?php } ?>
421 </td>
422 </tr>
424 <tr>
425 <td><?php echo xlt('Category'); ?>:</td>
426 <td></td>
427 <td>
428 <?php
429 generate_form_field(array('data_type'=>1,'field_id'=>'superbill','list_id'=>'superbill'), $superbill);
431 &nbsp;&nbsp;
432 <input type='checkbox' title='<?php echo xlt("Syndromic Surveillance Report") ?>' name='reportable' value='1'<?php if (!empty($reportable)) echo ' checked'; ?> />
433 <?php echo xlt('Diagnosis Reporting'); ?>
434 &nbsp;&nbsp;&nbsp;&nbsp;
435 <input type='checkbox' title='<?php echo xlt("Service Code Finance Reporting") ?>' name='financial_reporting' value='1'<?php if (!empty($financial_reporting)) echo ' checked'; ?> />
436 <?php echo xlt('Service Reporting'); ?>
437 </td>
438 </tr>
440 <tr<?php if (empty($GLOBALS['ippf_specific'])) echo " style='display:none'"; ?>>
441 <td><?php echo xlt('CYP Factor'); ?>:</td>
442 <td></td>
443 <td>
444 <input type='text' size='10' maxlength='20' name="cyp_factor" value='<?php echo attr($cyp_factor) ?>'>
445 </td>
446 </tr>
448 <tr<?php if (!related_codes_are_used()) echo " style='display:none'"; ?>>
449 <td><?php echo xlt('Relate To'); ?>:</td>
450 <td></td>
451 <td>
452 <input type='text' size='50' name='related_desc'
453 value='<?php echo attr($related_desc) ?>' onclick="sel_related()"
454 title='<?php echo xla('Click to select related code'); ?>' readonly />
455 <input type='hidden' name='related_code' value='<?php echo attr($related_code) ?>' />
456 </td>
457 </tr>
459 <tr>
460 <td><?php echo xlt('Fees'); ?>:</td>
461 <td></td>
462 <td>
463 <?php
464 $pres = sqlStatement("SELECT lo.option_id, lo.title, p.pr_price " .
465 "FROM list_options AS lo LEFT OUTER JOIN prices AS p ON " .
466 "p.pr_id = ? AND p.pr_selector = '' AND p.pr_level = lo.option_id " .
467 "WHERE list_id = 'pricelevel' ORDER BY lo.seq", array($code_id) );
468 for ($i = 0; $prow = sqlFetchArray($pres); ++$i) {
469 if ($i) echo "&nbsp;&nbsp;";
470 echo text(xl_list_label($prow['title'])) . " ";
471 echo "<input type='text' size='6' name='fee[" . attr($prow['option_id']) . "]' " .
472 "value='" . attr($prow['pr_price']) . "' >\n";
475 </td>
476 </tr>
478 <?php
479 $taxline = '';
480 $pres = sqlStatement("SELECT option_id, title FROM list_options " .
481 "WHERE list_id = 'taxrate' ORDER BY seq");
482 while ($prow = sqlFetchArray($pres)) {
483 if ($taxline) $taxline .= "&nbsp;&nbsp;";
484 $taxline .= "<input type='checkbox' name='taxrate[" . attr($prow['option_id']) . "]' value='1'";
485 if (strpos(":$taxrates", $prow['option_id']) !== false) $taxline .= " checked";
486 $taxline .= " />\n";
487 $taxline .= text(xl_list_label($prow['title'])) . "\n";
489 if ($taxline) {
491 <tr>
492 <td><?php echo xlt('Taxes'); ?>:</td>
493 <td></td>
494 <td>
495 <?php echo $taxline ?>
496 </td>
497 </tr>
498 <?php } ?>
500 <tr>
501 <td colspan="3" align="center">
502 <input type="hidden" name="code_id" value="<?php echo attr($code_id) ?>"><br>
503 <input type="hidden" name="code_type_name_external" value="<?php echo attr($code_type_name_external) ?>">
504 <input type="hidden" name="code_external" value="<?php echo attr($code_external) ?>">
505 <?php if ($mode == "modify") { ?>
506 <a href='javascript:submitModifyComplete();' class='link'>[<?php echo xlt('Update'); ?>]</a>
507 <?php } else { ?>
508 <a href='javascript:submitUpdate();' class='link'>[<?php echo xlt('Update'); ?>]</a>
509 &nbsp;&nbsp;
510 <a href='javascript:submitAdd();' class='link'>[<?php echo xlt('Add as New'); ?>]</a>
511 <?php } ?>
512 </td>
513 </tr>
515 </table>
516 <br>
517 <table border='0' cellpadding='5' cellspacing='0' width='96%'>
518 <tr>
520 <td class='text'>
521 <select name='filter' onchange='submitList(0)'>
522 <option value='0'>
523 <?php $all_string = xlt("All");
524 if ( !(empty($external_sets) )) {
525 // Show the external code sets that will not work with All selection
526 $all_string .= " (" . xlt("Except") . " ";
527 $first_flag = true;
528 foreach ($external_sets as $set) {
529 if ($first_flag) { //deal with the comma
530 $first_flag = false;
532 else {
533 $all_string .= ",";
535 $all_string .= xlt($code_types[$set]['label']);
537 $all_string .= ")";
539 echo $all_string;
541 </option>
542 <?php
543 foreach ($code_types as $key => $value) {
544 echo "<option value='" . attr($value['id']) . "'";
545 if ($value['id'] == $filter) echo " selected";
546 echo ">" . xlt($value['label']) . "</option>\n";
549 </select>
550 &nbsp;&nbsp;&nbsp;&nbsp;
552 <input type="text" name="search" size="5" value="<?php echo attr($search) ?>">&nbsp;
553 <input type="submit" name="go" value='<?php echo xla('Search'); ?>'>&nbsp;&nbsp;
554 <input type='checkbox' title='<?php echo xlt("Only Show Diagnosis Reporting Codes") ?>' name='search_reportable' value='1'<?php if (!empty($search_reportable)) echo ' checked'; ?> />
555 <?php echo xlt('Diagnosis Reporting Only'); ?>
556 &nbsp;&nbsp;&nbsp;&nbsp;
557 <input type='checkbox' title='<?php echo xlt("Only Show Service Code Finance Reporting Codes") ?>' name='search_financial_reporting' value='1'<?php if (!empty($search_financial_reporting)) echo ' checked'; ?> />
558 <?php echo xlt('Service Reporting Only'); ?>
559 <input type='hidden' name='fstart' value='<?php echo attr($fstart) ?>'>
560 </td>
562 <td class='text' align='right'>
563 <?php if ($fstart) { ?>
564 <a href="javascript:submitList(-<?php echo attr($pagesize) ?>)">
565 &lt;&lt;
566 </a>
567 &nbsp;&nbsp;
568 <?php } ?>
569 <?php echo ($fstart + 1) . " - $fend of $count" ?>
570 &nbsp;&nbsp;
571 <a href="javascript:submitList(<?php echo attr($pagesize) ?>)">
572 &gt;&gt;
573 </a>
574 </td>
576 </tr>
577 </table>
579 </form>
581 <table border='0' cellpadding='5' cellspacing='0' width='96%'>
582 <tr>
583 <td><span class='bold'><?php echo xlt('Code'); ?></span></td>
584 <td><span class='bold'><?php echo xlt('Mod'); ?></span></td>
585 <td><span class='bold'><?php echo xlt('Act'); ?></span></td>
586 <td><span class='bold'><?php echo xlt('Dx Rep'); ?></span></td>
587 <td><span class='bold'><?php echo xlt('Serv Rep'); ?></span></td>
588 <td><span class='bold'><?php echo xlt('Type'); ?></span></td>
589 <td><span class='bold'><?php echo xlt('Description'); ?></span></td>
590 <?php if (related_codes_are_used()) { ?>
591 <td><span class='bold'><?php echo xlt('Related'); ?></span></td>
592 <?php } ?>
593 <?php
594 $pres = sqlStatement("SELECT title FROM list_options " .
595 "WHERE list_id = 'pricelevel' ORDER BY seq");
596 while ($prow = sqlFetchArray($pres)) {
597 echo " <td class='bold' align='right' nowrap>" . text(xl_list_label($prow['title'])) . "</td>\n";
600 <td></td>
601 <td></td>
602 </tr>
603 <?php
604 // Flag is this is from an external set
605 $is_external_set=false;
606 if (in_array($filter_key,$external_sets)) {
607 $is_external_set=true;
610 if ($filter) {
611 $res = sequential_code_set_search($filter_key,$search,NULL,NULL,false,false,$fstart,($fend - $fstart),$filter_elements);
613 else {
614 $res = sequential_code_set_search("--ALL--",$search,NULL,NULL,false,false,$fstart,($fend - $fstart),$filter_elements);
617 for ($i = 0; $row = sqlFetchArray($res); $i++) $all[$i] = $row;
619 if (!empty($all)) {
620 $count = 0;
621 foreach($all as $iter) {
622 $count++;
624 $has_fees = false;
625 foreach ($code_types as $key => $value) {
626 if ($value['id'] == $iter['code_type']) {
627 $has_fees = $value['fee'];
628 break;
632 echo " <tr>\n";
633 echo " <td class='text'>" . text($iter["code"]) . "</td>\n";
634 echo " <td class='text'>" . text($iter["modifier"]) . "</td>\n";
635 if ($is_external_set) {
636 // If there is no entry in codes sql table, then default to active
637 // (this is reason for including NULL below)
638 echo " <td class='text'>" . ( ($iter["active"] || $iter["active"]==NULL) ? xlt('Yes') : xlt('No')) . "</td>\n";
640 else {
641 echo " <td class='text'>" . ( ($iter["active"]) ? xlt('Yes') : xlt('No')) . "</td>\n";
643 echo " <td class='text'>" . ($iter["reportable"] ? xlt('Yes') : xlt('No')) . "</td>\n";
644 echo " <td class='text'>" . ($iter["financial_reporting"] ? xlt('Yes') : xlt('No')) . "</td>\n";
645 echo " <td class='text'>" . text($iter['code_type_name']) . "</td>\n";
646 echo " <td class='text'>" . text($iter['code_text']) . "</td>\n";
648 if (related_codes_are_used()) {
649 // Show related codes.
650 echo " <td class='text'>";
651 $arel = explode(';', $iter['related_code']);
652 foreach ($arel as $tmp) {
653 list($reltype, $relcode) = explode(':', $tmp);
654 $code_description = lookup_code_descriptions($reltype.":".$relcode);
655 echo text($relcode) . ' ' . text(trim($code_description)) . '<br />';
657 echo "</td>\n";
660 $pres = sqlStatement("SELECT p.pr_price " .
661 "FROM list_options AS lo LEFT OUTER JOIN prices AS p ON " .
662 "p.pr_id = ? AND p.pr_selector = '' AND p.pr_level = lo.option_id " .
663 "WHERE list_id = 'pricelevel' ORDER BY lo.seq", array($iter['id']) );
664 while ($prow = sqlFetchArray($pres)) {
665 echo "<td class='text' align='right'>" . text(bucks($prow['pr_price'])) . "</td>\n";
668 if ($is_external_set) {
669 echo " <td align='right'><a class='link' href='javascript:submitModify(\"" . attr($iter['code_type_name']) . "\",\"" . attr($iter['code']) . "\",\"" . attr($iter['id']) . "\")'>[" . xlt('Modify') . "]</a></td>\n";
671 else {
672 echo " <td align='right'><a class='link' href='javascript:submitDelete(" . attr($iter['id']) . ")'>[" . xlt('Delete') . "]</a></td>\n";
673 echo " <td align='right'><a class='link' href='javascript:submitEdit(" . attr($iter['id']) . ")'>[" . xlt('Edit') . "]</a></td>\n";
676 echo " </tr>\n";
683 </table>
685 </center>
687 <script language="JavaScript">
688 <?php
689 if ($alertmsg) {
690 echo "alert('" . addslashes($alertmsg) . "');\n";
693 </script>
695 </body>
696 </html>