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/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">
34 <style type
="text/css">
36 /* specifically include & exclude from printing */
42 #report_parameters_daterange {
46 #report_results table {
51 /* specifically exclude some from the screen */
53 #report_parameters_daterange {
59 table
.mymaintable
, table
.mymaintable td
, table
.mymaintable th
{
60 border
: 1px solid
#aaaaaa;
61 border
-collapse
: collapse
;
63 table
.mymaintable td
, table
.mymaintable th
{
64 padding
: 1pt
4pt
1pt
4pt
;
67 <title
><?php
xl('Services by Category','e'); ?
></title
>
69 <script type
="text/javascript" src
="../../library/overlib_mini.js"></script
>
70 <script type
="text/javascript" src
="../../library/textformat.js"></script
>
71 <script type
="text/javascript" src
="../../library/dialog.js"></script
>
72 <script type
="text/javascript" src
="../../library/js/jquery-1.9.1.min.js"></script
>
73 <script type
="text/javascript" src
="../../library/js/report_helper.js?v=<?php echo $v_js_includes; ?>"></script
>
75 <script language
="JavaScript">
77 $
(document
).ready(function() {
78 oeFixedHeaderSetup(document
.getElementById('mymaintable'));
79 var win
= top
.printLogSetup ? top
: opener
.top
;
80 win
.printLogSetup(document
.getElementById('printbutton'));
87 <body
class="body_top">
89 <span
class='title'><?php
xl('Report','e'); ?
> - <?php
xl('Services by Category','e'); ?
></span
>
91 <form method
='post' action
='services_by_category.php' name
='theform' id
='theform'>
93 <div id
="report_parameters">
95 <input type
='hidden' name
='form_refresh' id
='form_refresh' value
=''/>
100 <div style
='float:left'>
105 <select name
='filter'>
106 <option value
='0'><?php
xl('All','e'); ?
></option
>
108 foreach ($code_types as $key => $value) {
109 echo "<option value='" . $value['id'] . "'";
110 if ($value['id'] == $filter) echo " selected";
111 echo ">$key</option>\n";
117 <input type
='checkbox' name
='include_uncat' value
='1'<?php
if (!empty($_REQUEST['include_uncat'])) echo " checked"; ?
> />
118 <?php
xl('Include Uncategorized','e'); ?
>
126 <td align
='left' valign
='middle' height
="100%">
127 <table style
='border-left:1px solid; width:100%; height:100%' >
130 <div style
='margin-left:15px'>
131 <a href
='#' class='css_button' onclick
='$("#form_refresh").attr("value","true"); $("#theform").submit();'>
133 <?php
xl('Submit','e'); ?
>
137 <?php
if ($_POST['form_refresh']) { ?
>
138 <a href
='#' class='css_button' id
='printbutton'>
140 <?php
xl('Print','e'); ?
>
151 </div
> <!-- end of parameters
-->
154 if ($_POST['form_refresh']) {
157 <div id
="report_results">
160 <table width
='98%' id
='mymaintable' class='mymaintable'>
161 <thead style
='display:table-header-group'>
162 <tr bgcolor
="#dddddd">
163 <th
class='bold'><?php
xl('Category' ,'e'); ?
></th
>
164 <th
class='bold'><?php
xl('Type' ,'e'); ?
></th
>
165 <th
class='bold'><?php
xl('Code' ,'e'); ?
></th
>
166 <th
class='bold'><?php
xl('Mod' ,'e'); ?
></th
>
167 <th
class='bold'><?php
xl('Units' ,'e'); ?
></th
>
168 <th
class='bold'><?php
xl('Description','e'); ?
></th
>
169 <?php
if (related_codes_are_used()) { ?
>
170 <th
class='bold'><?php
xl('Related' ,'e'); ?
></th
>
173 $pres = sqlStatement("SELECT title FROM list_options " .
174 "WHERE list_id = 'pricelevel' ORDER BY seq");
175 while ($prow = sqlFetchArray($pres)) {
176 // Added 5-09 by BM - Translate label if applicable
177 echo " <th class='bold' align='right' nowrap>" . xl_list_label($prow['title']) . "</th>\n";
184 $res = sqlStatement("SELECT c.*, lo.title FROM codes AS c " .
185 "LEFT OUTER JOIN list_options AS lo ON lo.list_id = 'superbill' " .
186 "AND lo.option_id = c.superbill " .
187 "WHERE $where ORDER BY lo.title, c.code_type, c.code, c.modifier");
191 while ($row = sqlFetchArray($res)) {
192 $category = $row['title'] ?
$row['title'] : 'Uncategorized';
193 $disp_category = ' ';
194 if ($category !== $last_category) {
195 $last_category = $category;
196 $disp_category = $category;
199 foreach ($code_types as $key => $value) {
200 if ($value['id'] == $row['code_type']) {
204 $bgcolor = (($irow & 1) ?
"#ffdddd" : "#ddddff");
205 echo " <tr bgcolor='$bgcolor'>\n";
206 // Added 5-09 by BM - Translate label if applicable
207 echo " <td class='text'>" . xl_list_label($disp_category) . "</td>\n";
208 echo " <td class='text'>$key</td>\n";
209 echo " <td class='text'>" . $row['code'] . "</td>\n";
210 echo " <td class='text'>" . $row['modifier'] . "</td>\n";
211 echo " <td class='text'>" . $row['units'] . "</td>\n";
212 echo " <td class='text'>" . $row['code_text'] . "</td>\n";
214 if (related_codes_are_used()) {
215 // Show related codes.
216 echo " <td class='text'>";
217 $arel = explode(';', $row['related_code']);
218 foreach ($arel as $tmp) {
219 list($reltype, $relcode) = explode(':', $tmp);
220 $reltype = $code_types[$reltype]['id'];
221 $relrow = sqlQuery("SELECT code_text FROM codes WHERE " .
222 "code_type = '$reltype' AND code = '$relcode' LIMIT 1");
223 echo $relcode . ' ' . trim($relrow['code_text']) . '<br />';
228 $pres = sqlStatement("SELECT p.pr_price " .
229 "FROM list_options AS lo LEFT OUTER JOIN prices AS p ON " .
230 "p.pr_id = '" . $row['id'] . "' AND p.pr_selector = '' " .
231 "AND p.pr_level = lo.option_id " .
232 "WHERE list_id = 'pricelevel' ORDER BY lo.seq");
233 while ($prow = sqlFetchArray($pres)) {
234 echo " <td class='text' align='right'>" . bucks($prow['pr_price']) . "</td>\n";
242 <?php
} // end of submit logic ?>