2 // Copyright (C) 2008 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 include_once("../globals.php");
10 include_once("../../custom/code_types.inc.php");
11 include_once("$srcdir/sql.inc");
13 // Format dollars for display.
15 function bucks($amount) {
17 $amount = sprintf("%.2f", $amount);
18 if ($amount != 0.00) return $amount;
23 $filter = $_REQUEST['filter'] +
0;
25 if ($filter) $where .= " AND c.code_type = '$filter'";
26 if (empty($_REQUEST['include_uncat']))
27 $where .= " AND c.superbill != '' AND c.superbill != '0'";
31 <?php
html_header_show(); ?
>
32 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
37 <form method
='post' action
='services_by_category.php' name
='theform'>
38 <table border
='0' cellpadding
='5' cellspacing
='0' width
='98%'>
41 <?php
xl('Services by Category','e'); ?
>
43 <td
class='text' align
='right'>
44 <select name
='filter'>
45 <option value
='0'>All
</option
>
47 foreach ($code_types as $key => $value) {
48 echo "<option value='" . $value['id'] . "'";
49 if ($value['id'] == $filter) echo " selected";
50 echo ">$key</option>\n";
55 <input type
='checkbox' name
='include_uncat' value
='1'<?php
if (!empty($_REQUEST['include_uncat'])) echo " checked"; ?
> />
58 <input type
="submit" name
="form_submit" value
="Refresh">
60 <input type
="button" value
="Print" onclick
="window.print()">
66 <?php
if ($_POST['form_submit']) { ?
>
68 <table border
='0' cellpadding
='1' cellspacing
='2' width
='98%'>
69 <thead style
='display:table-header-group'>
70 <tr bgcolor
="#dddddd">
71 <th
class='bold'><?php
xl('Category' ,'e'); ?
></th
>
72 <th
class='bold'><?php
xl('Type' ,'e'); ?
></th
>
73 <th
class='bold'><?php
xl('Code' ,'e'); ?
></th
>
74 <th
class='bold'><?php
xl('Mod' ,'e'); ?
></th
>
75 <th
class='bold'><?php
xl('Units' ,'e'); ?
></th
>
76 <th
class='bold'><?php
xl('Description','e'); ?
></th
>
78 $pres = sqlStatement("SELECT title FROM list_options " .
79 "WHERE list_id = 'pricelevel' ORDER BY seq");
80 while ($prow = sqlFetchArray($pres)) {
81 echo " <th class='bold' align='right' nowrap>" . $prow['title'] . "</th>\n";
88 $res = sqlStatement("SELECT c.*, lo.title FROM codes AS c " .
89 "LEFT OUTER JOIN list_options AS lo ON lo.list_id = 'superbill' " .
90 "AND lo.option_id = c.superbill " .
91 "WHERE $where ORDER BY lo.title, c.code_type, c.code, c.modifier");
95 while ($row = sqlFetchArray($res)) {
96 $category = $row['title'] ?
$row['title'] : 'Uncategorized';
97 $disp_category = ' ';
98 if ($category !== $last_category) {
99 $last_category = $category;
100 $disp_category = $category;
103 foreach ($code_types as $key => $value) {
104 if ($value['id'] == $row['code_type']) {
108 $bgcolor = (($irow & 1) ?
"#ffdddd" : "#ddddff");
109 echo " <tr bgcolor='$bgcolor'>\n";
110 echo " <td class='text'>$disp_category</td>\n";
111 echo " <td class='text'>$key</td>\n";
112 echo " <td class='text'>" . $row['code'] . "</td>\n";
113 echo " <td class='text'>" . $row['modifier'] . "</td>\n";
114 echo " <td class='text'>" . $row['units'] . "</td>\n";
115 echo " <td class='text'>" . $row['code_text'] . "</td>\n";
116 $pres = sqlStatement("SELECT p.pr_price " .
117 "FROM list_options AS lo LEFT OUTER JOIN prices AS p ON " .
118 "p.pr_id = '" . $row['id'] . "' AND p.pr_selector = '' " .
119 "AND p.pr_level = lo.option_id " .
120 "WHERE list_id = 'pricelevel' ORDER BY lo.seq");
121 while ($prow = sqlFetchArray($pres)) {
122 echo " <td class='text' align='right'>" . bucks($prow['pr_price']) . "</td>\n";
130 <?php
} // end of submit logic ?>