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");
11 require_once("$srcdir/formatting.inc.php");
13 // Format dollars for display.
15 function bucks($amount) {
16 if (empty($amount)) return '';
17 return oeFormatMoney($amount);
20 $filter = $_REQUEST['filter'] +
0;
21 $where = "c.active = 1";
22 if ($filter) $where .= " AND c.code_type = '$filter'";
23 if (empty($_REQUEST['include_uncat']))
24 $where .= " AND c.superbill != '' AND c.superbill != '0'";
28 <?php
html_header_show(); ?
>
29 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
33 <style type
="text/css">
35 /* specifically include & exclude from printing */
41 #report_parameters_daterange {
45 #report_results table {
50 /* specifically exclude some from the screen */
52 #report_parameters_daterange {
58 table
.mymaintable
, table
.mymaintable td
, table
.mymaintable th
{
59 border
: 1px solid
#aaaaaa;
60 border
-collapse
: collapse
;
62 table
.mymaintable td
, table
.mymaintable th
{
63 padding
: 1pt
4pt
1pt
4pt
;
66 <title
><?php
xl('Services by Category','e'); ?
></title
>
68 <script type
="text/javascript" src
="../../library/overlib_mini.js"></script
>
69 <script type
="text/javascript" src
="../../library/textformat.js"></script
>
70 <script type
="text/javascript" src
="../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
71 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-9-1/index.js"></script
>
72 <script type
="text/javascript" src
="../../library/js/report_helper.js?v=<?php echo $v_js_includes; ?>"></script
>
74 <script language
="JavaScript">
76 $
(document
).ready(function() {
77 oeFixedHeaderSetup(document
.getElementById('mymaintable'));
78 var win
= top
.printLogSetup ? top
: opener
.top
;
79 win
.printLogSetup(document
.getElementById('printbutton'));
86 <body
class="body_top">
88 <span
class='title'><?php
xl('Report','e'); ?
> - <?php
xl('Services by Category','e'); ?
></span
>
90 <form method
='post' action
='services_by_category.php' name
='theform' id
='theform'>
92 <div id
="report_parameters">
94 <input type
='hidden' name
='form_refresh' id
='form_refresh' value
=''/>
99 <div style
='float:left'>
104 <select name
='filter'>
105 <option value
='0'><?php
xl('All','e'); ?
></option
>
107 foreach ($code_types as $key => $value) {
108 echo "<option value='" . $value['id'] . "'";
109 if ($value['id'] == $filter) echo " selected";
110 echo ">$key</option>\n";
116 <input type
='checkbox' name
='include_uncat' value
='1'<?php
if (!empty($_REQUEST['include_uncat'])) echo " checked"; ?
> />
117 <?php
xl('Include Uncategorized','e'); ?
>
125 <td align
='left' valign
='middle' height
="100%">
126 <table style
='border-left:1px solid; width:100%; height:100%' >
129 <div style
='margin-left:15px'>
130 <a href
='#' class='css_button' onclick
='$("#form_refresh").attr("value","true"); $("#theform").submit();'>
132 <?php
xl('Submit','e'); ?
>
136 <?php
if ($_POST['form_refresh']) { ?
>
137 <a href
='#' class='css_button' id
='printbutton'>
139 <?php
xl('Print','e'); ?
>
150 </div
> <!-- end of parameters
-->
153 if ($_POST['form_refresh']) {
156 <div id
="report_results">
159 <table width
='98%' id
='mymaintable' class='mymaintable'>
160 <thead style
='display:table-header-group'>
161 <tr bgcolor
="#dddddd">
162 <th
class='bold'><?php
xl('Category' ,'e'); ?
></th
>
163 <th
class='bold'><?php
xl('Type' ,'e'); ?
></th
>
164 <th
class='bold'><?php
xl('Code' ,'e'); ?
></th
>
165 <th
class='bold'><?php
xl('Mod' ,'e'); ?
></th
>
166 <th
class='bold'><?php
xl('Units' ,'e'); ?
></th
>
167 <th
class='bold'><?php
xl('Description','e'); ?
></th
>
168 <?php
if (related_codes_are_used()) { ?
>
169 <th
class='bold'><?php
xl('Related' ,'e'); ?
></th
>
172 $pres = sqlStatement("SELECT title FROM list_options " .
173 "WHERE list_id = 'pricelevel' AND activity = 1 ORDER BY seq");
174 while ($prow = sqlFetchArray($pres)) {
175 // Added 5-09 by BM - Translate label if applicable
176 echo " <th class='bold' align='right' nowrap>" . xl_list_label($prow['title']) . "</th>\n";
183 $res = sqlStatement("SELECT c.*, lo.title FROM codes AS c " .
184 "LEFT OUTER JOIN list_options AS lo ON lo.list_id = 'superbill' " .
185 "AND lo.option_id = c.superbill AND lo.activity = 1 " .
186 "WHERE $where ORDER BY lo.title, c.code_type, c.code, c.modifier");
190 while ($row = sqlFetchArray($res)) {
191 $category = $row['title'] ?
$row['title'] : 'Uncategorized';
192 $disp_category = ' ';
193 if ($category !== $last_category) {
194 $last_category = $category;
195 $disp_category = $category;
198 foreach ($code_types as $key => $value) {
199 if ($value['id'] == $row['code_type']) {
203 $bgcolor = (($irow & 1) ?
"#ffdddd" : "#ddddff");
204 echo " <tr bgcolor='$bgcolor'>\n";
205 // Added 5-09 by BM - Translate label if applicable
206 echo " <td class='text'>" . xl_list_label($disp_category) . "</td>\n";
207 echo " <td class='text'>$key</td>\n";
208 echo " <td class='text'>" . $row['code'] . "</td>\n";
209 echo " <td class='text'>" . $row['modifier'] . "</td>\n";
210 echo " <td class='text'>" . $row['units'] . "</td>\n";
211 echo " <td class='text'>" . $row['code_text'] . "</td>\n";
213 if (related_codes_are_used()) {
214 // Show related codes.
215 echo " <td class='text'>";
216 $arel = explode(';', $row['related_code']);
217 foreach ($arel as $tmp) {
218 list($reltype, $relcode) = explode(':', $tmp);
219 $reltype = $code_types[$reltype]['id'];
220 $relrow = sqlQuery("SELECT code_text FROM codes WHERE " .
221 "code_type = '$reltype' AND code = '$relcode' LIMIT 1");
222 echo $relcode . ' ' . trim($relrow['code_text']) . '<br />';
227 $pres = sqlStatement("SELECT p.pr_price " .
228 "FROM list_options AS lo LEFT OUTER JOIN prices AS p ON " .
229 "p.pr_id = '" . $row['id'] . "' AND p.pr_selector = '' " .
230 "AND p.pr_level = lo.option_id " .
231 "WHERE lo.list_id = 'pricelevel' AND lo.activity = 1 ORDER BY lo.seq");
232 while ($prow = sqlFetchArray($pres)) {
233 echo " <td class='text' align='right'>" . bucks($prow['pr_price']) . "</td>\n";
241 <?php
} // end of submit logic ?>