Initialize drug list correctly for weno.
[openemr.git] / templates / prescription / general_list.html
blob1170c0f8ae584970a301b3ca7a83dcc2a2012206
1 {**
2 * Prescription list
4 * @package OpenEMR
5 * @link http://www.open-emr.org
6 * @author Brady Miller <brady.g.miller@gmail.com>
7 * @copyright Copyright (c) 2017 Brady Miller <brady.g.miller@gmail.com>
8 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
9 *}
10 <html>
11 <head>
13 {headerShow}
15 <link rel="stylesheet" href="{$GLOBALS.css_header}" type="text/css">
16 <script type="text/javascript" src="{$GLOBALS.assets_static_relative}/jquery-min-1-2-2/index.js"></script>
18 {literal}
19 <style type="text/css" title="mystyles" media="all">
20 .inactive {
21 color:#777777;
23 </style>
25 <script language="javascript">
27 function changeLinkHref(id,addValue,value) {
28 var myRegExp = new RegExp(":" + value + ":");
29 if (addValue){ //add value to href
30 document.getElementById(id).href += ':' + value + ':';
32 else { //remove value from href
33 document.getElementById(id).href = document.getElementById(id).href.replace(myRegExp,'');
37 function changeLinkHrefAll(addValue, value) {
38 changeLinkHref('multiprint', addValue, value);
39 changeLinkHref('multiprintcss', addValue, value);
40 changeLinkHref('multiprintToFax', addValue, value);
43 //uses jquery to update database table
44 function markTx(oThis,id){
45 var isChecked = oThis.checked ? 1 : 0; // @TODO this is better served if checkboxs are all checked on submit with one call to markTx
46 $.get('./interface/weno/markTx.php?rx='+id+'&state='+isChecked);
47 return false;
50 function changeLinkHref_All(id,addValue,value) {
51 var myRegExp = new RegExp(":" + value + ":");
52 if (addValue){ //add value to href
53 document.getElementById(id).href += ':' + value + ':';
55 else { //remove value from href
56 document.getElementById(id).href = document.getElementById(id).href.replace(myRegExp,'');
57 // TajEmo Work By CB 2012/06/14 02:17:16 PM remove the target change
58 //document.getElementById(id).target = '';
62 function Check(chk) {
63 var len=chk.length;
64 if (len==undefined) {chk.checked=true;}
65 else {
66 for (pr = 0; pr < chk.length; pr++){
67 if($(chk[pr]).parents("tr.inactive").length==0)
69 chk[pr].checked=true;
70 changeLinkHref_All('multiprint',true,chk[pr].value);
71 changeLinkHref_All('multiprintcss',true, chk[pr].value);
72 changeLinkHref_All('multiprintToFax',true, chk[pr].value);
78 function Uncheck(chk) {
79 var len=chk.length;
80 if (len==undefined) {chk.checked=false;}
81 else {
82 for (pr = 0; pr < chk.length; pr++){
83 chk[pr].checked=false;
84 changeLinkHref_All('multiprint',false,chk[pr].value);
85 changeLinkHref_All('multiprintcss',false, chk[pr].value);
86 changeLinkHref_All('multiprintToFax',false, chk[pr].value);
91 var CheckForChecks = function(chk) {
92 // Checks for any checked boxes, if none are found than an alert is raised and the link is killed
93 if (Checking(chk) == false) { return false; }
94 return top.restoreSession();
97 function Checking(chk) {
98 var len=chk.length;
99 var foundone=false;
101 if (len==undefined) {
102 if (chk.checked == true){
103 foundone=true;
106 else {
107 for (pr = 0; pr < chk.length; pr++){
108 if (chk[pr].checked == true) {
109 foundone=true;
113 if (foundone) {
114 return true;
115 } else {
116 alert("{/literal}{xl t='Please select at least one prescription!'}{literal}");
117 return false;
121 $(document).ready(function(){
122 $(":checkbox:checked").each(function () {
123 changeLinkHref('multiprint',this.checked, this.value);
124 changeLinkHref('multiprintcss',this.checked, this.value);
125 changeLinkHref('multiprintToFax',this.checked, this.value);
129 </script>
131 {/literal}
132 </head>
133 <body class="body_top">
135 {if $prescriptions}
136 <span class="title"><b>{xl t='List'|escape:'html'}</b></span>
138 <div id="prescription_list">
140 <form name="presc">
142 <div id="print_links">
143 <table width="100%">
144 <tr>
145 <td align="left">
146 <table>
147 <tr>
148 <td>
149 <a id="multiprint" href="{$CONTROLLER}prescription&multiprint&id={$printm}" onclick="top.restoreSession()" class="css_button"><span>{xl t='Download'|escape:'html'} ({xl t='PDF'|escape:'html'})</span></a>
150 </td>
151 <td>
152 <!-- TajEmo work by CB 2012/06/14 02:16:32 PM target="_script" opens better -->
153 <a target="_script" id="multiprintcss" href="{$CONTROLLER}prescription&multiprintcss&id={$printm}" onclick="top.restoreSession()" class="css_button"><span>{xl t='View Printable Version'|escape:'html'} ({xl t='HTML'|escape:'html'})</span></a>
154 </td>
155 <td style="border-style:none;">
156 <a id="multiprintToFax" href="{$CONTROLLER}prescription&multiprintfax&id={$printm}" onclick="top.restoreSession()" class="css_button"><span>{xl t='Download'|escape:'html'} ({xl t='Fax'|escape:'html'})</span></a>
157 </td>
159 {if $GLOBALS.weno_rx_enable}
160 <td style="border-style:none;">
161 <a id="multiprintToFax" href="{$GLOBALS.webroot}/interface/weno/validate.php" onclick="top.restoreSession()" class="css_button"><span>{xl t='Transmit'|escape:'html'} {xl t='Rx'|escape:'html'}</span></a>
162 </td>
163 {/if}
164 {if $CAMOS_FORM == true}
165 <td>
166 <a id="four_panel_rx" href="{$GLOBALS.webroot}/interface/forms/CAMOS/rx_print.php?sigline=plain" onclick="top.restoreSession()" class="css_button"><span>{xl t='View Four Panel'|escape:'html'}</span></a>
167 </td>
168 {/if}
169 </tr>
170 </table>
171 </td>
172 <td align="right">
173 <table>
174 <tr>
175 <td>
176 <a href="#" class="small" onClick="Check(document.presc.check_list);"><span>{xl t='Check All'|escape:'html'}</span></a> |
177 <a href="#" class="small" onClick="Uncheck(document.presc.check_list);"><span>{xl t='Clear All'|escape:'html'}</span></a>
178 </td>
179 </tr>
180 </table>
181 </td>
182 </tr>
183 </table>
184 </div>
187 <table width="100%" class="showborder_head" cellspacing="0px" cellpadding="2px">
188 <tr>
189 <!-- TajEmo Changes 2012/06/14 02:01:43 PM by CB added Heading for checkbox column -->
190 <th width="8px">&nbsp;</th>
191 <th width="8px">&nbsp;</th>
193 <th width="70px">{xl t='Drug'|escape:'html'}</th>
194 <th width="70px">{xl t='RxNorm'|escape:'html'}</th>
195 <th width="70px">{xl t='Created'|escape:'html'}<br />{xl t='Changed'|escape:'html'}</th>
196 <th width="20px">{xl t='Dosage'|escape:'html'}</th>
197 <th width="20px">{xl t='Qty'|escape:'html'}.</th>
198 <th>{xl t='Unit'|escape:'html'}</th>
199 <th width="20px">{xl t='Refills'|escape:'html'}</th>
200 <th>{xl t='Provider'|escape:'html'}</th>
201 {if $GLOBALS.weno_rx_enable}
202 <th>{xl t='Send'|escape:'html'}<br>{xl t='NewRx'|escape:'html'}</th>
203 <th>{xl t='Refill'|escape:'html'}<br>{xl t='Rx'|escape:'html'}</th>
204 <th>{xl t='Last'|escape:'html'}<br>{xl t='Tx Date'|escape:'html'}</th>
205 {/if}
206 </tr>
208 {foreach from=$prescriptions item=prescription}
209 <!-- TajEmo Changes 2012/06/14 02:03:17 PM by CB added cursor:pointer for easier user understanding -->
210 <tr style="cursor:pointer" id="{$prescription->id|escape:'html'}" class="showborder onescript {if $prescription->active <= 0} inactive{/if}" title="{xl t='Click to view/edit'|escape:'html'}">
211 <td align="center">
212 <input class="check_list" id="check_list" type="checkbox" value="{$prescription->id|escape:'html'}" {if $prescription->encounter == $prescription->get_encounter() && $prescription->active > 0}checked="checked" {/if}onclick="changeLinkHref('multiprint',this.checked, this.value);changeLinkHref('multiprintcss',this.checked, this.value);changeLinkHref('multiprintToFax',this.checked, this.value)" title="{xl t='Select for printing'|escape:'html'}">
213 </td>
214 {if $prescription->erx_source==0}
215 <td class="editscript" id="{$prescription->id}">
216 <a class='editscript css_button_small' id='{$prescription->id}' href="controller.php?prescription&edit&id={$prescription->id}" style="margin-top:-2px"><span>{xl t='Edit'|escape:'html'}</span></a>
217 <!-- TajEmo Changes 2012/06/14 02:02:22 PM by CB commented out, to avoid duplicate display of drug name
218 {if $prescription->active > 0}<b>{/if}{$prescription->drug}{if $prescription->active > 0}</b>{/if}&nbsp;
220 </td>
221 <td class="editscript" id="{$prescription->id}">
222 {if $prescription->active > 0}<b>{/if}{$prescription->drug|escape:'html'}{if $prescription->active > 0}</b>{/if}&nbsp;
223 <br />{$prescription->note|escape:'html'}
224 </td>
225 {else}
226 <td>&nbsp;</td>
227 <td id="{$prescription->id}">
228 {if $prescription->active > 0}<b>{/if}{$prescription->drug|escape:'html'}{if $prescription->active > 0}</b>{/if}&nbsp;
229 <br />{$prescription->note|escape:'html'}
230 </td>
231 {/if}
232 <td id="{$prescription->id}">
233 {$prescription->rxnorm_drugcode|escape:'html'}&nbsp;
234 </td>
235 <td id="{$prescription->id}">
236 {$prescription->date_added|escape:'html'}<br />
237 {$prescription->date_modified|escape:'html'}&nbsp;
238 </td>
239 <td id="{$prescription->id}">
240 {$prescription->get_dosage_display()|escape:'html'} &nbsp;
241 </td>
242 {if $prescription->erx_source==0}
243 <td class="editscript" id="{$prescription->id}">
244 {$prescription->quantity|escape:'html'} &nbsp;
245 </td>
246 {else}
247 <td id="{$prescription->id}">
248 {$prescription->quantity|escape:'html'} &nbsp;
249 </td>
250 {/if}
251 <td id="{$prescription->id}">
252 {$prescription->get_size()|escape:'html'} {$prescription->get_unit_display()|escape:'html'}&nbsp;
253 </td>
254 <td id="{$prescription->id}">
255 {$prescription->refills|escape:'html'} &nbsp;
256 </td>
257 <td id="{$prescription->id}">
258 {$prescription->provider->get_name_display()|escape:'html'}&nbsp;
259 </td>
260 {if $GLOBALS.weno_rx_enable}
261 <td align="center">
262 {if $prescription->ntx == 0}
263 <input class="check_list" id="NewRx-{$smarty.foreach.rx.index|escape:'html'}" type="checkbox" {if $prescription->active < 1}disabled="disabled" {/if} value="{$prescription->id|escape:'html'}" {if $prescription->ntx > 0 && $prescription->active > 0}checked="checked" {/if} onClick="markTx(this,'NewRx-{$prescription->id|escape:'html'}'); changeLinkHrefAll(this.checked, this.value);" title={xl t="Select to transmit"|escape:'html'}>
264 {/if}
265 </td>
266 <td align="center">
267 {if $prescription->ntx == 1}
268 <input class="check_list" id="RefillRx-{$smarty.foreach.rx.index|escape:'html'}" type="checkbox" {if $prescription->active < 1}disabled="disabled" {/if} value="{$prescription->id|escape:'html'}" {if $prescription->ntx > 0 && $prescription->active > 0}checked="checked" {/if} onClick="markTx(this,'RefillRx-{$prescription->id|escape:'html'}'); changeLinkHrefAll(this.checked, this.value);" title={xl t="Select to transmit"|escape:'html'}>
269 {/if}
270 </td>
271 <td id="{$prescription->id|escape:'html'}" align="center">
272 {$prescription->txDate|escape:'html'}
273 </td>
274 {/if}
275 </tr>
276 {/foreach}
278 </table>
280 </form>
281 </div>
283 {else}
284 <div class="text" style="margin-top:10px">{xl t='There are currently no prescriptions'|escape:'html'}.</div>
285 {/if}
287 </body>
288 {literal}
289 <script language='JavaScript'>
291 $(document).ready(function(){
292 $("#multiprint").click(function() { return CheckForChecks(document.presc.check_list); });
293 $("#multiprintcss").click(function() { return CheckForChecks(document.presc.check_list); });
294 $("#multiprintToFax").click(function() { return CheckForChecks(document.presc.check_list); });
295 $(".editscript").click(function() { ShowScript(this); });
296 $(".onescript").mouseover(function() { $(this).children().toggleClass("highlight"); });
297 $(".onescript").mouseout(function() { $(this).children().toggleClass("highlight"); });
300 var ShowScript = function(eObj) {
301 top.restoreSession();
302 objID = eObj.id;
303 document.location.href="{/literal}{$GLOBALS.webroot}{literal}/controller.php?prescription&edit&id="+objID;
304 return true;
307 </script>
308 {/literal}
309 </html>