2 // Copyright (C) 2008-2016 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");
12 // Format dollars for display.
14 function bucks($amount) {
15 if (empty($amount)) return '';
16 return oeFormatMoney($amount);
19 $filter = $_REQUEST['filter'] +
0;
20 $where = "c.active = 1";
21 if ($filter) $where .= " AND c.code_type = '$filter'";
22 if (empty($_REQUEST['include_uncat']))
23 $where .= " AND c.superbill != '' AND c.superbill != '0'";
27 <?php
html_header_show(); ?
>
28 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
32 <style type
="text/css">
34 /* specifically include & exclude from printing */
40 #report_parameters_daterange {
44 #report_results table {
49 /* specifically exclude some from the screen */
51 #report_parameters_daterange {
57 table
.mymaintable
, table
.mymaintable td
, table
.mymaintable th
{
58 border
: 1px solid
#aaaaaa;
59 border
-collapse
: collapse
;
61 table
.mymaintable td
, table
.mymaintable th
{
62 padding
: 1pt
4pt
1pt
4pt
;
65 <title
><?php
xl('Services by Category','e'); ?
></title
>
67 <script type
="text/javascript" src
="../../library/overlib_mini.js"></script
>
68 <script type
="text/javascript" src
="../../library/textformat.js"></script
>
69 <script type
="text/javascript" src
="../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
70 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-9-1/index.js"></script
>
71 <script type
="text/javascript" src
="../../library/js/report_helper.js?v=<?php echo $v_js_includes; ?>"></script
>
73 <script language
="JavaScript">
75 $
(document
).ready(function() {
76 oeFixedHeaderSetup(document
.getElementById('mymaintable'));
77 var win
= top
.printLogSetup ? top
: opener
.top
;
78 win
.printLogSetup(document
.getElementById('printbutton'));
85 <body
class="body_top">
87 <span
class='title'><?php
xl('Report','e'); ?
> - <?php
xl('Services by Category','e'); ?
></span
>
89 <form method
='post' action
='services_by_category.php' name
='theform' id
='theform'>
91 <div id
="report_parameters">
93 <input type
='hidden' name
='form_refresh' id
='form_refresh' value
=''/>
98 <div style
='float:left'>
103 <select name
='filter'>
104 <option value
='0'><?php
xl('All','e'); ?
></option
>
106 foreach ($code_types as $key => $value) {
107 echo "<option value='" . $value['id'] . "'";
108 if ($value['id'] == $filter) echo " selected";
109 echo ">$key</option>\n";
115 <input type
='checkbox' name
='include_uncat' value
='1'<?php
if (!empty($_REQUEST['include_uncat'])) echo " checked"; ?
> />
116 <?php
xl('Include Uncategorized','e'); ?
>
124 <td align
='left' valign
='middle' height
="100%">
125 <table style
='border-left:1px solid; width:100%; height:100%' >
128 <div style
='margin-left:15px'>
129 <a href
='#' class='css_button' onclick
='$("#form_refresh").attr("value","true"); $("#theform").submit();'>
131 <?php
xl('Submit','e'); ?
>
135 <?php
if ($_POST['form_refresh']) { ?
>
136 <a href
='#' class='css_button' id
='printbutton'>
138 <?php
xl('Print','e'); ?
>
149 </div
> <!-- end of parameters
-->
152 if ($_POST['form_refresh']) {
155 <div id
="report_results">
158 <table width
='98%' id
='mymaintable' class='mymaintable'>
159 <thead style
='display:table-header-group'>
160 <tr bgcolor
="#dddddd">
161 <th
class='bold'><?php
xl('Category' ,'e'); ?
></th
>
162 <th
class='bold'><?php
xl('Type' ,'e'); ?
></th
>
163 <th
class='bold'><?php
xl('Code' ,'e'); ?
></th
>
164 <th
class='bold'><?php
xl('Mod' ,'e'); ?
></th
>
165 <th
class='bold'><?php
xl('Units' ,'e'); ?
></th
>
166 <th
class='bold'><?php
xl('Description','e'); ?
></th
>
167 <?php
if (related_codes_are_used()) { ?
>
168 <th
class='bold'><?php
xl('Related' ,'e'); ?
></th
>
171 $pres = sqlStatement("SELECT title FROM list_options " .
172 "WHERE list_id = 'pricelevel' AND activity = 1 ORDER BY seq");
173 while ($prow = sqlFetchArray($pres)) {
174 // Added 5-09 by BM - Translate label if applicable
175 echo " <th class='bold' align='right' nowrap>" . xl_list_label($prow['title']) . "</th>\n";
182 $res = sqlStatement("SELECT c.*, lo.title FROM codes AS c " .
183 "LEFT OUTER JOIN list_options AS lo ON lo.list_id = 'superbill' " .
184 "AND lo.option_id = c.superbill AND lo.activity = 1 " .
185 "WHERE $where ORDER BY lo.title, c.code_type, c.code, c.modifier");
189 while ($row = sqlFetchArray($res)) {
190 $category = $row['title'] ?
$row['title'] : 'Uncategorized';
191 $disp_category = ' ';
192 if ($category !== $last_category) {
193 $last_category = $category;
194 $disp_category = $category;
197 foreach ($code_types as $key => $value) {
198 if ($value['id'] == $row['code_type']) {
202 $bgcolor = (($irow & 1) ?
"#ffdddd" : "#ddddff");
203 echo " <tr bgcolor='$bgcolor'>\n";
204 // Added 5-09 by BM - Translate label if applicable
205 echo " <td class='text'>" . xl_list_label($disp_category) . "</td>\n";
206 echo " <td class='text'>$key</td>\n";
207 echo " <td class='text'>" . $row['code'] . "</td>\n";
208 echo " <td class='text'>" . $row['modifier'] . "</td>\n";
209 echo " <td class='text'>" . $row['units'] . "</td>\n";
210 echo " <td class='text'>" . $row['code_text'] . "</td>\n";
212 if (related_codes_are_used()) {
213 // Show related codes.
214 echo " <td class='text'>";
215 $arel = explode(';', $row['related_code']);
216 foreach ($arel as $tmp) {
217 list($reltype, $relcode) = explode(':', $tmp);
218 $reltype = $code_types[$reltype]['id'];
219 $relrow = sqlQuery("SELECT code_text FROM codes WHERE " .
220 "code_type = '$reltype' AND code = '$relcode' LIMIT 1");
221 echo $relcode . ' ' . trim($relrow['code_text']) . '<br />';
226 $pres = sqlStatement("SELECT p.pr_price " .
227 "FROM list_options AS lo LEFT OUTER JOIN prices AS p ON " .
228 "p.pr_id = '" . $row['id'] . "' AND p.pr_selector = '' " .
229 "AND p.pr_level = lo.option_id " .
230 "WHERE lo.list_id = 'pricelevel' AND lo.activity = 1 ORDER BY lo.seq");
231 while ($prow = sqlFetchArray($pres)) {
232 echo " <td class='text' align='right'>" . bucks($prow['pr_price']) . "</td>\n";
240 <?php
} // end of submit logic ?>