2 // Copyright (C) 2008-2015 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("../../custom/code_types.inc.php");
11 require_once("$srcdir/sql.inc");
12 require_once("$srcdir/formatting.inc.php");
14 // Format dollars for display.
16 function bucks($amount) {
17 if (empty($amount)) return '';
18 return oeFormatMoney($amount);
21 $filter = $_REQUEST['filter'] +
0;
22 $where = "c.active = 1";
23 if ($filter) $where .= " AND c.code_type = '$filter'";
24 if (empty($_REQUEST['include_uncat']))
25 $where .= " AND c.superbill != '' AND c.superbill != '0'";
29 <?php
html_header_show(); ?
>
30 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
31 <style type
="text/css">
33 /* specifically include & exclude from printing */
39 #report_parameters_daterange {
43 #report_results table {
48 /* specifically exclude some from the screen */
50 #report_parameters_daterange {
56 <title
><?php
xl('Services by Category','e'); ?
></title
>
58 <script type
="text/javascript" src
="../../library/overlib_mini.js"></script
>
59 <script type
="text/javascript" src
="../../library/textformat.js"></script
>
60 <script type
="text/javascript" src
="../../library/dialog.js"></script
>
61 <script type
="text/javascript" src
="../../library/js/jquery.1.3.2.js"></script
>
63 <script language
="JavaScript">
64 $
(document
).ready(function() {
65 var win
= top
.printLogSetup ? top
: opener
.top
;
66 win
.printLogSetup(document
.getElementById('printbutton'));
72 <body
class="body_top">
74 <span
class='title'><?php
xl('Report','e'); ?
> - <?php
xl('Services by Category','e'); ?
></span
>
76 <form method
='post' action
='services_by_category.php' name
='theform' id
='theform'>
78 <div id
="report_parameters">
80 <input type
='hidden' name
='form_refresh' id
='form_refresh' value
=''/>
85 <div style
='float:left'>
90 <select name
='filter'>
91 <option value
='0'><?php
xl('All','e'); ?
></option
>
93 foreach ($code_types as $key => $value) {
94 echo "<option value='" . $value['id'] . "'";
95 if ($value['id'] == $filter) echo " selected";
96 echo ">$key</option>\n";
102 <input type
='checkbox' name
='include_uncat' value
='1'<?php
if (!empty($_REQUEST['include_uncat'])) echo " checked"; ?
> />
103 <?php
xl('Include Uncategorized','e'); ?
>
111 <td align
='left' valign
='middle' height
="100%">
112 <table style
='border-left:1px solid; width:100%; height:100%' >
115 <div style
='margin-left:15px'>
116 <a href
='#' class='css_button' onclick
='$("#form_refresh").attr("value","true"); $("#theform").submit();'>
118 <?php
xl('Submit','e'); ?
>
122 <?php
if ($_POST['form_refresh']) { ?
>
123 <a href
='#' class='css_button' id
='printbutton'>
125 <?php
xl('Print','e'); ?
>
136 </div
> <!-- end of parameters
-->
139 if ($_POST['form_refresh']) {
142 <div id
="report_results">
145 <table border
='0' cellpadding
='1' cellspacing
='2' width
='98%'>
146 <thead style
='display:table-header-group'>
147 <tr bgcolor
="#dddddd">
148 <th
class='bold'><?php
xl('Category' ,'e'); ?
></th
>
149 <th
class='bold'><?php
xl('Type' ,'e'); ?
></th
>
150 <th
class='bold'><?php
xl('Code' ,'e'); ?
></th
>
151 <th
class='bold'><?php
xl('Mod' ,'e'); ?
></th
>
152 <th
class='bold'><?php
xl('Units' ,'e'); ?
></th
>
153 <th
class='bold'><?php
xl('Description','e'); ?
></th
>
154 <?php
if (related_codes_are_used()) { ?
>
155 <th
class='bold'><?php
xl('Related' ,'e'); ?
></th
>
158 $pres = sqlStatement("SELECT title FROM list_options " .
159 "WHERE list_id = 'pricelevel' ORDER BY seq");
160 while ($prow = sqlFetchArray($pres)) {
161 // Added 5-09 by BM - Translate label if applicable
162 echo " <th class='bold' align='right' nowrap>" . xl_list_label($prow['title']) . "</th>\n";
169 $res = sqlStatement("SELECT c.*, lo.title FROM codes AS c " .
170 "LEFT OUTER JOIN list_options AS lo ON lo.list_id = 'superbill' " .
171 "AND lo.option_id = c.superbill " .
172 "WHERE $where ORDER BY lo.title, c.code_type, c.code, c.modifier");
176 while ($row = sqlFetchArray($res)) {
177 $category = $row['title'] ?
$row['title'] : 'Uncategorized';
178 $disp_category = ' ';
179 if ($category !== $last_category) {
180 $last_category = $category;
181 $disp_category = $category;
184 foreach ($code_types as $key => $value) {
185 if ($value['id'] == $row['code_type']) {
189 $bgcolor = (($irow & 1) ?
"#ffdddd" : "#ddddff");
190 echo " <tr bgcolor='$bgcolor'>\n";
191 // Added 5-09 by BM - Translate label if applicable
192 echo " <td class='text'>" . xl_list_label($disp_category) . "</td>\n";
193 echo " <td class='text'>$key</td>\n";
194 echo " <td class='text'>" . $row['code'] . "</td>\n";
195 echo " <td class='text'>" . $row['modifier'] . "</td>\n";
196 echo " <td class='text'>" . $row['units'] . "</td>\n";
197 echo " <td class='text'>" . $row['code_text'] . "</td>\n";
199 if (related_codes_are_used()) {
200 // Show related codes.
201 echo " <td class='text'>";
202 $arel = explode(';', $row['related_code']);
203 foreach ($arel as $tmp) {
204 list($reltype, $relcode) = explode(':', $tmp);
205 $reltype = $code_types[$reltype]['id'];
206 $relrow = sqlQuery("SELECT code_text FROM codes WHERE " .
207 "code_type = '$reltype' AND code = '$relcode' LIMIT 1");
208 echo $relcode . ' ' . trim($relrow['code_text']) . '<br />';
213 $pres = sqlStatement("SELECT p.pr_price " .
214 "FROM list_options AS lo LEFT OUTER JOIN prices AS p ON " .
215 "p.pr_id = '" . $row['id'] . "' AND p.pr_selector = '' " .
216 "AND p.pr_level = lo.option_id " .
217 "WHERE list_id = 'pricelevel' ORDER BY lo.seq");
218 while ($prow = sqlFetchArray($pres)) {
219 echo " <td class='text' align='right'>" . bucks($prow['pr_price']) . "</td>\n";
227 <?php
} // end of submit logic ?>