Mangled path fax send (#7515)
[openemr.git] / templates / prescription / general_list.html
blob41489ab51dbdd234d14b2f70aba99229c06bfb58
1 {**
2 * Prescription list
4 * @package OpenEMR
5 * @link http://www.open-emr.org
6 * @author Brady Miller <brady.g.miller@gmail.com>
7 * @author Sherwin Gaddis <sherwingaddis@gmail.com>
8 * @copyright Copyright (c) 2017-2018 Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2018 Sherwin Gaddis <sherwingaddis@gmail.com>
10 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
12 <html>
13 <head>
15 {headerTemplate assets='no_textformat|no_dialog'}
18 <script>
20 function changeLinkHref(id,addValue,value) {
21 var myRegExp = new RegExp(":" + value + ":");
22 if (addValue){ //add value to href
23 if(document.getElementById(id) !== null)document.getElementById(id).href += ':' + value + ':';
25 else { //remove value from href
26 if(document.getElementById(id) !== null)document.getElementById(id).href = document.getElementById(id).href.replace(myRegExp,'');
30 function changeLinkHrefAll(addValue, value) {
31 changeLinkHref('multiprint', addValue, value);
32 changeLinkHref('multiprintcss', addValue, value);
33 changeLinkHref('multiprintToFax', addValue, value);
37 function changeLinkHref_All(id,addValue,value) {
38 var myRegExp = new RegExp(":" + value + ":");
39 if (addValue){ //add value to href
40 if(document.getElementById(id) !== null)document.getElementById(id).href += ':' + value + ':';
42 else { //remove value from href
43 if(document.getElementById(id) !== null)document.getElementById(id).href = document.getElementById(id).href.replace(myRegExp,'');
44 // TajEmo Work By CB 2012/06/14 02:17:16 PM remove the target change
45 //document.getElementById(id).target = '';
49 function Check(chk) {
50 var len=chk.length;
51 if (len==undefined) {
52 chk.checked=true;
54 else {
55 //clean the checked id's before check all the list again
56 var multiprint=document.getElementById('multiprint');
57 if(multiprint!==null) {
58 multiprint.href = document.getElementById('multiprint').href.substring(0, document.getElementById('multiprint').href.indexOf('=') + 1);
61 var multiprintcss=document.getElementById('multiprintcss');
62 if(multiprintcss!==null) {
63 multiprintcss.href = document.getElementById('multiprintcss').href.substring(0, document.getElementById('multiprintcss').href.indexOf('=') + 1);
66 var multiprintToFax=document.getElementById('multiprintToFax');
67 if(multiprintToFax!==null) {
68 multiprintToFax.href = document.getElementById('multiprintToFax').href.substring(0, document.getElementById('multiprintToFax').href.indexOf('=') +1);
70 for (let pr = 0; pr < chk.length; pr++){
71 if($(chk[pr]).parents("tr.inactive").length==0)
73 chk[pr].checked=true;
74 changeLinkHref_All('multiprint',true,chk[pr].value);
75 changeLinkHref_All('multiprintcss',true, chk[pr].value);
76 changeLinkHref_All('multiprintToFax',true, chk[pr].value);
82 function deleteDrug(d) {
83 let msg = {xlj t='Do you really want to delete?'};
84 let choice = confirm(msg);
85 if (choice == true) {
86 top.restoreSession();
87 $.ajax({
88 url: "./library/deletedrug.php",
89 type: 'POST',
90 data: {
91 drugid: d,
92 csrf_token_form: {$CSRF_TOKEN_FORM|js_escape}
94 success: function(data) {
95 console.log(data);
96 document.location.href = '{$GLOBALS.webroot}/controller.php?prescription&list&id=' + {$smarty.session.pid|js_url};
98 error: function(error) {
99 console.log(error)
105 function Uncheck(chk) {
106 var len=chk.length;
107 if (len==undefined) {
108 chk.checked=false;
110 else {
111 for (pr = 0; pr < chk.length; pr++){
112 chk[pr].checked=false;
113 changeLinkHref_All('multiprint',false,chk[pr].value);
114 changeLinkHref_All('multiprintcss',false, chk[pr].value);
115 changeLinkHref_All('multiprintToFax',false, chk[pr].value);
120 var CheckForChecks = function(chk) {
121 // Checks for any checked boxes, if none are found than an alert is raised and the link is killed
122 if (Checking(chk) == false) { return false; }
123 return top.restoreSession();
126 function Checking(chk) {
127 var len=chk.length;
128 var foundone=false;
130 if (len==undefined) {
131 if (chk.checked == true){
132 foundone=true;
135 else {
136 for (pr = 0; pr < chk.length; pr++){
137 if (chk[pr].checked == true) {
138 foundone=true;
142 if (foundone) {
143 return true;
144 } else {
145 alert({xlj t='Please select at least one prescription!'});
146 return false;
150 $(function () {
151 $(":checkbox:checked").each(function () {
152 changeLinkHref('multiprint',this.checked, this.value);
153 changeLinkHref('multiprintcss',this.checked, this.value);
154 changeLinkHref('multiprintToFax',this.checked, this.value);
158 </script>
161 </head>
162 <body id="prescription_list">
163 <div class="container-fluid">
164 <div class="row">
165 {if $prescriptions}
166 <div class="col-12">
167 <h3>{xlt t='List'}</h3>
168 </div>
169 <div class="col-12 d-flex justify-content-between">
170 <div class="btn-group">
171 {if $GLOBALS.rx_zend_pdf_template}
172 <a target="_blank" id="multiprint" href="{$GLOBALS.webroot}/{$GLOBALS.baseModDir}{$GLOBALS.zendModDir}/public/prescription-pdf-template/{$GLOBALS.rx_zend_pdf_action}?id={if !empty($printm)}{$printm|attr_url}{/if}" onclick="top.restoreSession()" class="btn btn-primary btn-sm">{xlt t='Download'} ({xlt t='PDF'})</a>
173 {else}
174 <a id="multiprint" href="{$CONTROLLER}prescription&multiprint&id={if !empty($printm)}{$printm|attr_url}{/if}" onclick="top.restoreSession()" class="btn btn-primary btn-sm btn-download">{xlt t='Download'} ({xl t='PDF'})</a>
175 {/if}
176 {if $GLOBALS.rx_zend_html_template}
177 <a target="_blank" id="multiprintcss" href="{$GLOBALS.webroot}/{$GLOBALS.baseModDir}{$GLOBALS.zendModDir}/public/prescription-html-template/{$GLOBALS.rx_zend_html_action}?id={if !empty($printm)}{$printm|attr_url}{/if}" onclick="top.restoreSession()" class="btn btn-primary btn-sm">{xl t='View Printable Version'|text} ({xlt t='HTML'})</a>
178 {else}
179 <!-- TajEmo work by CB 2012/06/14 02:16:32 PM target="_script" opens better -->
180 <a target="_script" id="multiprintcss" href="{$CONTROLLER}prescription&multiprintcss&id={if !empty($printm)}{$printm|attr_url}{/if}" onclick="top.restoreSession()" class="btn btn-primary btn-sm btn-print">{xlt t='View Printable Version'} ({xlt t='HTML'})</a>
181 {/if}
182 {if $GLOBALS.rx_use_fax_template}
183 <a id="multiprintToFax" href="{$CONTROLLER}prescription&multiprintfax&id={if !empty($printm)}{$printm|attr_url}{/if}" onclick="top.restoreSession()" class="btn btn-primary btn-sm btn-download">{xlt t='Download'} ({xlt t='Fax'})</a>
184 {/if}
185 {if $CAMOS_FORM == true}
186 <a id="four_panel_rx" href="{$GLOBALS.webroot}/interface/forms/CAMOS/rx_print.php?sigline=plain" onclick="top.restoreSession()" class="btn btn-primary btn-sm">{xlt t='View Four Panel'}</a>
187 {/if}
188 </div>
189 <div class="btn-group">
190 <a href="#" class="small" onClick="Check(document.presc.check_list);"><span>{xlt t='Check All'}</span></a> |
191 <a href="#" class="small" onClick="Uncheck(document.presc.check_list);"><span>{xlt t='Clear All'}</span></a>
192 </div>
193 </div>
194 <div class="col-12">
195 <div id="prescription_list">
196 <form name="presc">
197 <div class="table-responsive">
198 <table class="table table-hover">
199 <thead>
200 <tr>
201 <!-- TajEmo Changes 2012/06/14 02:01:43 PM by CB added Heading for checkbox column -->
202 <th>&nbsp;</th>
203 <th>&nbsp;</th>
204 <th>{xlt t='Drug'}</th>
205 <th>{xlt t='RxNorm'}</th>
206 <th>{xlt t='Created'}<br />{xlt t='Changed'}</th>
207 <th>{xlt t='Dosage'}</th>
208 <th>{xlt t='Qty'}.</th>
209 <th>{xlt t='Unit'}</th>
210 <th>{xlt t='Refills'}</th>
211 <th>{xlt t='Provider'}</th>
212 <th></th>
213 </tr>
214 </thead>
215 <tbody>
216 {foreach from=$prescriptions item=prescription}
217 <!-- TajEmo Changes 2012/06/14 02:03:17 PM by CB added cursor:pointer for easier user understanding -->
218 <tr id="{$prescription->id|attr}" class="showborder onescript {if $prescription->active <= 0} inactive{/if}">
219 <td class="text-center">
220 <input class="check_list" id="check_list" type="checkbox" value="{$prescription->id|attr}" {if !empty($prescription->encounter) && $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="{xla t='Select for printing'}">
221 </td>
222 {if empty($prescription->erx_source) || $prescription->erx_source==0}
223 <td class="editscript" id="{$prescription->id|attr}">
224 <a class='editscript btn btn-primary btn-sm btn-edit' id='{$prescription->id|attr}' href="{$GLOBALS.webroot}/controller.php?prescription&edit&id={$prescription->id|attr_url}">{xlt t='Edit'}</a>
225 <!-- TajEmo Changes 2012/06/14 02:02:22 PM by CB commented out, to avoid duplicate display of drug name
226 {if $prescription->active > 0}<b>{/if}{$prescription->drug}{if $prescription->active > 0}</b>{/if}&nbsp;
228 </td>
229 <td class="editscript" id="{$prescription->id|attr}">
230 {if $prescription->active > 0}<b>{/if}{$prescription->drug|text}{if $prescription->active > 0}</b>{/if}&nbsp;
231 <br />{$prescription->note|text}
232 </td>
233 {else}
234 <td>&nbsp;</td>
235 <td id="{$prescription->id|attr}">
236 {if $prescription->active > 0}<b>{/if}{$prescription->drug|text}{if $prescription->active > 0}</b>{/if}&nbsp;
237 <br />{$prescription->note|text}
238 </td>
239 {/if}
240 <td id="{$prescription->id|attr}">
241 {$prescription->rxnorm_drugcode|text}&nbsp;
242 </td>
243 <td id="{$prescription->id|attr}">
244 {$prescription->date_added|oeFormatShortDate|text}<br />
245 {$prescription->date_modified|oeFormatShortDate|text}&nbsp;
246 </td>
247 <td id="{$prescription->id|attr}">
248 {$prescription->get_dosage_display()|text} &nbsp;
249 </td>
250 {if empty($prescription->erx_source) || $prescription->erx_source==0}
251 <td class="editscript" id="{$prescription->id|attr}">
252 {$prescription->quantity|text} &nbsp;
253 </td>
254 {else}
255 <td id="{$prescription->id|attr}">
256 {$prescription->quantity|text} &nbsp;
257 </td>
258 {/if}
259 <td id="{$prescription->id|attr}">
260 {$prescription->get_size()|text} {$prescription->get_unit_display()|text}&nbsp;
261 </td>
262 <td id="{$prescription->id|attr}">
263 {$prescription->refills|text} &nbsp;
264 </td>
265 <td id="{$prescription->id|attr}">
266 {$prescription->provider->get_name_display()|text}&nbsp;
267 </td>
268 <td><a href="#" id="deleteDrug" class="btn btn-danger btn-sm btn-delete" onclick="deleteDrug({$prescription->id|attr})">{xlt t='Delete'}</a></td>
269 </tr>
270 {/foreach}
271 </tbody>
272 </table>
273 </div>
274 </form>
275 </div>
276 </div>
277 {if $GLOBALS.rx_show_drug_drug}
278 <div id="drug-drug">
279 <hr>
280 <h3>{xlt t='Drug-Drug Interaction'}</h3>
281 <p title="{xla t='Severity information will be missing if interaction is found'}"><a href="#">*{xlt t='Notice'}</a></p>
282 <div id="return_info">
283 {$INTERACTION}
284 </div>
285 <hr>
286 </div>
287 {/if}
289 {else}
290 <div class="text mt-3">{xlt t='There are currently no prescriptions'}.</div>
291 {/if}
292 </div>
293 </div>
294 </body>
296 <script>
298 $(function () {
299 $("#multiprint").on("click", function() { return CheckForChecks(document.presc.check_list); });
300 $("#multiprintcss").on("click", function() { return CheckForChecks(document.presc.check_list); });
301 $("#multiprintToFax").on("click", function() { return CheckForChecks(document.presc.check_list); });
302 $(".editscript").on("click", function() { ShowScript(this); });
303 $(".onescript").on("mouseover", function() { $(this).children().toggleClass("highlight"); });
304 $(".onescript").on("mouseout", function() { $(this).children().toggleClass("highlight"); });
307 var ShowScript = function(eObj) {
308 top.restoreSession();
309 objID = eObj.id;
310 document.location.href="{$GLOBALS.webroot}/controller.php?prescription&edit&id=" + encodeURIComponent(objID);
311 return true;
314 </script>
316 </html>