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
15 {headerTemplate assets='no_textformat|no_dialog'}
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
);
36 //uses jquery to update database table
37 function markTx(oThis
,id
){{/literal
}
38 var isChecked
= oThis
.checked
? 1 : 0; // @TODO this is better served if checkboxs are all checked on submit with one call to markTx
39 $.get('./interface/weno/markTx.php?rx=' + encodeURIComponent(id
) + '&state=' + encodeURIComponent(isChecked
) + '&csrf_token_form=' + {$CSRF_TOKEN_FORM
|js_url
});
43 function changeLinkHref_All(id
,addValue
,value
) {
44 var myRegExp
= new RegExp(":" + value
+ ":");
45 if (addValue
){ //add value to href
46 if(document
.getElementById(id
) !== null)document
.getElementById(id
).href
+= ':' + value
+ ':';
48 else { //remove value from href
49 if(document
.getElementById(id
) !== null)document
.getElementById(id
).href
= document
.getElementById(id
).href
.replace(myRegExp
,'');
50 // TajEmo Work By CB 2012/06/14 02:17:16 PM remove the target change
51 //document.getElementById(id).target = '';
57 if (len
==undefined) {chk
.checked
=true;}
59 //clean the checked id's before check all the list again
60 var multiprint
=document
.getElementById('multiprint');
61 if(multiprint
!==null) {
62 multiprint
.href
= document
.getElementById('multiprint').href
.substring(0, document
.getElementById('multiprint').href
.indexOf('=') + 1);
65 var multiprintcss
=document
.getElementById('multiprintcss');
66 if(multiprintcss
!==null) {
67 multiprintcss
.href
= document
.getElementById('multiprintcss').href
.substring(0, document
.getElementById('multiprintcss').href
.indexOf('=') + 1);
70 var multiprintToFax
=document
.getElementById('multiprintToFax');
71 if(multiprintToFax
!==null) {
72 multiprintToFax
.href
= document
.getElementById('multiprintToFax').href
.substring(0, document
.getElementById('multiprintToFax').href
.indexOf('=') +1);
74 for (let pr
= 0; pr
< chk
.length
; pr
++){
75 if($(chk
[pr
]).parents("tr.inactive").length
==0)
78 changeLinkHref_All('multiprint',true,chk
[pr
].value
);
79 changeLinkHref_All('multiprintcss',true, chk
[pr
].value
);
80 changeLinkHref_All('multiprintToFax',true, chk
[pr
].value
);
86 function deleteDrug(d
) {
87 let msg
= {/literal
}{xlj t
='Do you really want to delete?'}{literal
};
88 let choice
= confirm(msg
+ d
);
92 url
: "./library/deleteDrug.php",
96 csrf_token_form
: {$CSRF_TOKEN_FORM
|js_escape
}
98 success: function(data
) {
102 error: function(error
) {
109 function Uncheck(chk
) {
111 if (len
==undefined) {chk
.checked
=false;}
113 for (pr
= 0; pr
< chk
.length
; pr
++){
114 chk
[pr
].checked
=false;
115 changeLinkHref_All('multiprint',false,chk
[pr
].value
);
116 changeLinkHref_All('multiprintcss',false, chk
[pr
].value
);
117 changeLinkHref_All('multiprintToFax',false, chk
[pr
].value
);
122 var CheckForChecks = function(chk
) {
123 // Checks for any checked boxes, if none are found than an alert is raised and the link is killed
124 if (Checking(chk
) == false) { return false; }
125 return top
.restoreSession();
128 function Checking(chk
) {
132 if (len
==undefined) {
133 if (chk
.checked
== true){
138 for (pr
= 0; pr
< chk
.length
; pr
++){
139 if (chk
[pr
].checked
== true) {
147 alert({/literal
}{xlj t
='Please select at least one prescription!'}{literal
});
153 $(":checkbox:checked").each(function () {
154 changeLinkHref('multiprint',this.checked
, this.value
);
155 changeLinkHref('multiprintcss',this.checked
, this.value
);
156 changeLinkHref('multiprintToFax',this.checked
, this.value
);
164 <body id=
"prescription_list">
165 <div class=
"container-fluid">
169 <h3>{xlt t='List'}
</h3>
171 <div class=
"col-12 d-flex justify-content-between">
172 <div class=
"btn-group">
173 {if $GLOBALS.rx_zend_pdf_template}
174 <a target=
"_blank" id=
"multiprint" href=
"{$GLOBALS.webroot}/{$GLOBALS.baseModDir}{$GLOBALS.zendModDir}/public/prescription-pdf-template/{$GLOBALS.rx_zend_pdf_action}?id={$printm|attr_url}" onclick=
"top.restoreSession()" class=
"btn btn-primary btn-sm">{xlt t='Download'} ({xlt t='PDF'})
</a>
176 <a id=
"multiprint" href=
"{$CONTROLLER}prescription&multiprint&id={$printm|attr_url}" onclick=
"top.restoreSession()" class=
"btn btn-primary btn-sm btn-download">{xlt t='Download'} ({xl t='PDF'})
</a>
178 {if $GLOBALS.rx_zend_html_template}
179 <a target=
"_blank" id=
"multiprintcss" href=
"{$GLOBALS.webroot}/{$GLOBALS.baseModDir}{$GLOBALS.zendModDir}/public/prescription-html-template/{$GLOBALS.rx_zend_html_action}?id={$printm|attr_url}" onclick=
"top.restoreSession()" class=
"btn btn-primary btn-sm">{xl t='View Printable Version'|text} ({xlt t='HTML'})
</a>
181 <!-- TajEmo work by CB 2012/06/14 02:16:32 PM target="_script" opens better -->
182 <a target=
"_script" id=
"multiprintcss" href=
"{$CONTROLLER}prescription&multiprintcss&id={$printm|attr_url}" onclick=
"top.restoreSession()" class=
"btn btn-primary btn-sm btn-print">{xlt t='View Printable Version'} ({xlt t='HTML'})
</a>
184 {if $GLOBALS.rx_use_fax_template}
185 <a id=
"multiprintToFax" href=
"{$CONTROLLER}prescription&multiprintfax&id={$printm|attr_url}" onclick=
"top.restoreSession()" class=
"btn btn-primary btn-sm btn-download">{xlt t='Download'} ({xlt t='Fax'})
</a>
187 {if $GLOBALS.weno_rx_enable}
188 <a id=
"multiprintToFax" href=
"{$GLOBALS.webroot}/interface/weno/validate.php?csrf_token_form={$CSRF_TOKEN_FORM|attr_url}" onclick=
"top.restoreSession()" class=
"btn btn-primary btn-sm btn-transmit">{xlt t='Transmit'} {xlt t='Rx'}
</a>
190 {if $CAMOS_FORM == true}
191 <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>
194 <div class=
"btn-group">
195 <a href=
"#" class=
"small" onClick=
"Check(document.presc.check_list);"><span>{xlt t='Check All'}
</span></a> |
196 <a href=
"#" class=
"small" onClick=
"Uncheck(document.presc.check_list);"><span>{xlt t='Clear All'}
</span></a>
200 <div id=
"prescription_list">
202 <div class=
"table-responsive">
203 <table class=
"table table-hover">
206 <!-- TajEmo Changes 2012/06/14 02:01:43 PM by CB added Heading for checkbox column -->
209 <th>{xlt t='Drug'}
</th>
210 <th>{xlt t='RxNorm'}
</th>
211 <th>{xlt t='Created'}
<br />{xlt t='Changed'}
</th>
212 <th>{xlt t='Dosage'}
</th>
213 <th>{xlt t='Qty'}.
</th>
214 <th>{xlt t='Unit'}
</th>
215 <th>{xlt t='Refills'}
</th>
216 <th>{xlt t='Provider'}
</th>
217 {if $GLOBALS.weno_rx_enable}
218 <th>{xlt t='Send NewRx'}
</th>
219 <th>{xlt t='Refill Rx'}
</th>
220 <th>{xlt t='Last Tx Date'}
</th>
226 {foreach from=$prescriptions item=prescription}
227 <!-- TajEmo Changes 2012/06/14 02:03:17 PM by CB added cursor:pointer for easier user understanding -->
228 <tr id=
"{$prescription->id|attr}" class=
"showborder onescript {if $prescription->active <= 0} inactive{/if}">
229 <td class=
"text-center">
230 <input class=
"check_list" id=
"check_list" type=
"checkbox" value=
"{$prescription->id|attr}" {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=
"{xla t='Select for printing'}">
232 {if $prescription-
>erx_source==
0}
233 <td class=
"editscript" id=
"{$prescription->id|attr}">
234 <a class='editscript btn btn-primary btn-sm btn-edit' id='{$prescription-
>id|attr}'
href=
"controller.php?prescription&edit&id={$prescription->id|attr_url}">{xlt t='Edit'}
</a>
235 <!-- TajEmo Changes 2012/06/14 02:02:22 PM by CB commented out, to avoid duplicate display of drug name
236 {if $prescription->active > 0}<b>{/if}{$prescription->drug}{if $prescription->active > 0}</b>{/if}
239 <td class=
"editscript" id=
"{$prescription->id|attr}">
240 {if $prescription-
>active
> 0}
<b>{/if}{$prescription-
>drug|text}{if $prescription-
>active
> 0}
</b>{/if}
241 <br />{$prescription-
>note|text}
245 <td id=
"{$prescription->id|attr}">
246 {if $prescription-
>active
> 0}
<b>{/if}{$prescription-
>drug|text}{if $prescription-
>active
> 0}
</b>{/if}
247 <br />{$prescription-
>note|text}
250 <td id=
"{$prescription->id|attr}">
251 {$prescription-
>rxnorm_drugcode|text}
253 <td id=
"{$prescription->id|attr}">
254 {$prescription-
>date_added|oeFormatShortDate|text}
<br />
255 {$prescription-
>date_modified|oeFormatShortDate|text}
257 <td id=
"{$prescription->id|attr}">
258 {$prescription-
>get_dosage_display()|text}
260 {if $prescription-
>erx_source==
0}
261 <td class=
"editscript" id=
"{$prescription->id|attr}">
262 {$prescription-
>quantity|text}
265 <td id=
"{$prescription->id|attr}">
266 {$prescription-
>quantity|text}
269 <td id=
"{$prescription->id|attr}">
270 {$prescription-
>get_size()|text} {$prescription-
>get_unit_display()|text}
272 <td id=
"{$prescription->id|attr}">
273 {$prescription-
>refills|escape:'html'}
275 <td id=
"{$prescription->id|attr}">
276 {$prescription-
>provider-
>get_name_display()|text}
278 {if $GLOBALS.weno_rx_enable}
279 <td class=
"text-center">
280 {if $prescription-
>ntx ==
0}
281 <input class=
"check_list" id=
"NewRx-{$smarty.foreach.rx.index|attr}" type=
"checkbox" {if $prescription-
>active <
1}
disabled=
"disabled" {/if}
value=
"{$prescription->id|attr}" {if $prescription-
>ntx
> 0 && $prescription-
>active
> 0}
checked=
"checked" {/if}
onClick=
"markTx(this,'NewRx-{$prescription->id|attr}'); changeLinkHrefAll(this.checked, this.value);" title=
"{xla t="Select to transmit
"}">
284 <td class=
"text-center">
285 {if $prescription-
>ntx ==
1}
286 <input class=
"check_list" id=
"RefillRx-{$smarty.foreach.rx.index|attr}" type=
"checkbox" {if $prescription-
>active <
1}
disabled=
"disabled" {/if}
value=
"{$prescription->id|attr}" {if $prescription-
>ntx
> 0 && $prescription-
>active
> 0}
checked=
"checked" {/if}
onClick=
"markTx(this,'RefillRx-{$prescription->id|attr}'); changeLinkHrefAll(this.checked, this.value);" title=
"{xla t="Select to transmit
"}">
289 <td id=
"{$prescription->id|attr}" class=
"text-center">
290 {$prescription-
>txDate|text}
293 <td><a href=
"#" id=
"deleteDrug" class=
"btn btn-danger btn-sm btn-delete" onclick=
"deleteDrug({$prescription->id|attr})">{xlt t='Delete'}
</a></td>
302 {if $GLOBALS.rx_show_drug_drug}
305 <h3>{xlt t='Drug-Drug Interaction'}
</h3>
306 <p title=
"{xla t='Severity information will be missing if interaction is found'}"><a href=
"#">*{xlt t='Notice'}
</a></p>
307 <div id=
"return_info">
315 <div class=
"text mt-3">{xlt t='There are currently no prescriptions'}.
</div>
324 $("#multiprint").on("click", function() { return CheckForChecks(document
.presc
.check_list
); });
325 $("#multiprintcss").on("click", function() { return CheckForChecks(document
.presc
.check_list
); });
326 $("#multiprintToFax").on("click", function() { return CheckForChecks(document
.presc
.check_list
); });
327 $(".editscript").on("click", function() { ShowScript(this); });
328 $(".onescript").on("mouseover", function() { $(this).children().toggleClass("highlight"); });
329 $(".onescript").on("mouseout", function() { $(this).children().toggleClass("highlight"); });
332 var ShowScript = function(eObj
) {
333 top
.restoreSession();
335 document
.location
.href
="{/literal}{$GLOBALS.webroot}{literal}/controller.php?prescription&edit&id=" + encodeURIComponent(objID
);