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
14 {headerTemplate assets='jquery-ui'}
15 <link rel=
"stylesheet" href=
"{$GLOBALS.assets_static_relative}/jquery-ui-1-12-1/themes/base/jquery-ui.min.css" type=
"text/css" />
18 <style type=
"text/css">
29 <script language=
"Javascript">
32 function my_process () {
34 opener
.document
.prescribe
.drug
.value
= document
.lookup
.drug
.value
;
42 <script language='JavaScript'
>
44 // This holds all the default drug attributes.
45 // This was html escaped previously
47 var drugopts
= [{$DRUG_ATTRIBUTES
}];
50 // Helper to choose an option from its value.
51 function selchoose(sel
, value
) {
53 for (i
= 0; i
< o
.length
; ++i
) {
54 o
[i
].selected
= (o
[i
].value
== value
);
58 // Fill in default values when a drop-down drug is selected.
59 function drugselected(sel
) {
60 var f
= document
.forms
[0];
61 var i
= f
.drug_id
.selectedIndex
- 1;
65 selchoose(f
.form
, d
[1]);
66 f
.dosage
.value
= d
[2];
68 f
.rxnorm_drugcode
.value
= d
[11];
69 selchoose(f
.unit
, d
[4]);
70 selchoose(f
.route
, d
[5]);
71 selchoose(f
.interval
, d
[6]);
72 selchoose(f
.substitute
, d
[7]);
73 f
.quantity
.value
= d
[8];
74 f
.disp_quantity
.value
= d
[8];
75 selchoose(f
.refills
, d
[9]);
76 f
.per_refill
.value
= d
[10];
80 // Invoke the popup to dispense a drug.
82 var f
= document
.forms
[0];
83 dlgopen('interface/drugs/dispense_drug.php' +
84 {/literal
}'?drug_id={$prescription->get_drug_id()}' +{literal
}
85 '&prescription=' + f
.id
.value
+
86 '&quantity=' + f
.disp_quantity
.value
+
87 '&fee=' + f
.disp_fee
.value
,
91 function quantityChanged() {
92 var f
= document
.forms
[0];
93 f
.per_refill
.value
= f
.quantity
.value
;
94 if (f
.disp_quantity
) {
95 f
.disp_quantity
.value
= f
.quantity
.value
;
102 <body class=
"body_top">
104 <form name=
"prescribe" id=
"prescribe" method=
"post" action=
"{$FORM_ACTION}" >
106 <tr><td class=
"title"><font><b>{xl t='Add'|escape:'html'}/{xl t='Edit'|escape:'html'}
</b></font> </td>
107 <td><a href=#
onclick=
"submitfun();" class=
"css_button_small"><span>{xl t='Save'|escape:'html'}
</span></a>
108 {if $DRUG_ARRAY_VALUES}
109
110 {if $prescription-
>get_refills()
>= $prescription-
>get_dispensation_count()}
111 <input type=
"submit" name=
"disp_button"class='css_button_small'
style=
"margin:0 5px 0 2px;" value=
"{xl t='Save and Dispense'|escape:'html'}" />
112 <input class=
"input-sm" type=
"text" name=
"disp_quantity" size=
"2" maxlength=
"10" value=
"{$DISP_QUANTITY|escape:'html'}" />
114 <input class=
"input-sm" type=
"text" name=
"disp_fee" size=
"5" maxlength=
"10" value=
"{$DISP_FEE|escape:'html'}" />
116 {xl t='prescription has reached its limit of'|escape:'html'} {$prescription-
>get_refills()|escape:'html'} {xl t='refills'|escape:'html'}.
119 <a class='css_button_small'
href=
"controller.php?prescription&list&id={$prescription->patient->id|escape:'html'}"><span>{xl t='Back'|escape:'html'}
</span></a>
123 {if $GLOBALS.enable_amc_prompting}
124 <div style='float:right;margin-right:
25px;border-style:solid;border-width:
1px;'
>
125 <div style='float:left;margin:
5px
5px
5px
5px;'
>
126 {amcCollect amc_id='e_prescribe_amc' patient_id=$prescription-
>patient-
>id object_category='prescriptions' object_id=$prescription-
>id}
127 {if not $amcCollectReturn}
128 <input type=
"checkbox" id=
"escribe_flag" name=
"escribe_flag">
130 <input type=
"checkbox" id=
"escribe_flag" name=
"escribe_flag" checked
>
132 <span class=
"text">{xl t='E-Prescription?'|escape:'html'}
</span><br>
134 {amcCollect amc_id='e_prescribe_chk_formulary_amc' patient_id=$prescription-
>patient-
>id object_category='prescriptions' object_id=$prescription-
>id}
135 {if not $amcCollectReturn}
136 <input type=
"checkbox" id=
"checked_formulary_flag" name=
"checked_formulary_flag">
138 <input type=
"checkbox" id=
"checked_formulary_flag" name=
"checked_formulary_flag" checked
>
140 <span class=
"text">{xl t='Checked Drug Formulary?'|escape:'html'}
</span><br>
142 {amcCollect amc_id='e_prescribe_cont_subst_amc' patient_id=$prescription-
>patient-
>id object_category='prescriptions' object_id=$prescription-
>id}
143 {if not $amcCollectReturn}
144 <input type=
"checkbox" id=
"controlled_substance_flag" name=
"controlled_substance_flag">
146 <input type=
"checkbox" id=
"controlled_substance_flag" name=
"controlled_substance_flag" checked
>
148 <span class=
"text">{xl t='Controlled Substance?'|escape:'html'}
</span><br>
154 <table CELLSPACING=
"0" CELLPADDING=
"3" BORDER=
"0">
156 <td COLSPAN=
"1" class=
"text input-sm" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Currently Active'|escape:'html'}
</td>
157 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
158 <input class=
"input-sm"type=
"checkbox" name=
"active" value=
"1"{if $prescription-
>get_active()
> 0} checked{/if}
/>
162 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Starting Date'|escape:'html'}
</td>
163 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
164 {html_select_date
class=
"input-sm" start_year=
"-10" end_year=
"+5" time=$prescription-
>start_date
prefix=
"start_date_"}
165 <input type=
"hidden" name=
"start_date" value=
"{$prescription->start_date|escape:'html'}">
169 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Provider'|escape:'html'}
</td>
170 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
171 {html_options
class=
"input-sm" name=
"provider_id" options=$prescription-
>provider-
>utility_provider_array() selected=$prescription-
>provider-
>get_id()}
172 <input type=
"hidden" name=
"patient_id" value=
"{$prescription->patient->id|escape:'html'}" />
177 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Drug'|escape:'html'}
</td>
178 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
179 <input class=
"input-sm" type=
"input" size=
"35" name=
"drug" id=
"drug" value=
"{$prescription->drug|escape:'html'}"/>
180 <a href=
"javascript:;" id=
"druglookup" class=
"small" name=
"B4" onclick=
"$('#hiddendiv').show(); document.getElementById('hiddendiv').innerHTML='<iframe src="controller.php?prescription&lookup&drug=" width="100%"height="75" scrolling="no" frameborder="no"></iframe>'">
181 ({xl t='click here to search'|escape:'html'})
</a>
182 <div class=
"well well-sm" id=
"hiddendiv" style=
"display:none"> </div>
185 {if $DRUG_ARRAY_VALUES}
187 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" > {xl t='in-house'|escape:'html'}
</td>
188 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
189 <select class=
"input-sm" name=
"drug_id" onchange=
"drugselected(this)">
190 {html_options values=$DRUG_ARRAY_VALUES output=$DRUG_ARRAY_OUTPUT selected=$prescription-
>get_drug_id()}
192 <input type=
"hidden" name=
"rxnorm_drugcode" value=
"{$prescription->rxnorm_drugcode|escape:'html'}">
197 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Quantity'|escape:'html'}
</td>
198 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
199 <input class=
"input-sm" TYPE=
"TEXT" NAME=
"quantity" id=
"quantity" SIZE=
"10" MAXLENGTH=
"31"
200 VALUE=
"{$prescription->quantity|escape:'html'}"
201 onchange=
"quantityChanged()" />
204 {if $SIMPLIFIED_PRESCRIPTIONS && !$prescription-
>size}
205 <tr style='display:none;'
>
209 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Medicine Units'|escape:'html'}
</td>
210 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
211 <input class=
"input-sm" TYPE=
"TEXT" NAME=
"size" id=
"size" SIZE=
"11" MAXLENGTH=
"10" VALUE=
"{$prescription->size|escape:'html'}"/>
212 <select class=
"input-sm" name=
"unit" id=
"unit">{html_options options=$prescription-
>unit_array selected=$prescription-
>unit}
</select>
216 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Directions'|escape:'html'}
</td>
217 <td COLSPAN=
"2" class=
"text" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
218 {if $SIMPLIFIED_PRESCRIPTIONS && !$prescription-
>form && !$prescription-
>route && !$prescription-
>interval}
219 <input class=
"input-sm" TYPE=
"text" NAME=
"dosage" id=
"dosage" SIZE=
"30" MAXLENGTH=
"100" VALUE=
"{$prescription->dosage|escape:'html'}" />
220 <input type=
"hidden" name=
"form" id=
"form" value=
"0" />
221 <input type=
"hidden" name=
"route" id=
"route" value=
"0" />
222 <input type=
"hidden" name=
"interval" id=
"interval" value=
"0" />
224 <input class=
"input-sm" TYPE=
"TEXT" NAME=
"dosage" id=
"dosage" SIZE=
"2" MAXLENGTH=
"10" VALUE=
"{$prescription->dosage|escape:'html'}"/> {xl t='in'|escape:'html'}
225 <select class=
"input-sm" name=
"form" id=
"form">{html_options options=$prescription-
>form_array selected=$prescription-
>form}
</select>
226 <select class=
"input-sm" name=
"route" id=
"route">{html_options options=$prescription-
>route_array selected=$prescription-
>route}
</select>
227 <select class=
"input-sm" name=
"interval" id=
"interval">{html_options options=$prescription-
>interval_array selected=$prescription-
>interval}
</select>
232 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Refills'|escape:'html'}
</td>
233 <td COLSPAN=
"2" class=
"text" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
234 {html_options
name=
"refills" options=$prescription-
>refills_array selected=$prescription-
>refills}
235 {if $SIMPLIFIED_PRESCRIPTIONS}
236 <input TYPE=
"hidden" ID=
"per_refill" NAME=
"per_refill" VALUE=
"{$prescription->per_refill|escape:'html'}" />
238 # {xl t='of tablets'}:
239 <input class=
"input-sm" TYPE=
"TEXT" ID=
"per_refill" NAME=
"per_refill" SIZE=
"2" MAXLENGTH=
"10" VALUE=
"{$prescription->per_refill|escape:'html'}" />
244 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Notes'|escape:'html'}
</td>
245 <td COLSPAN=
"2" class=
"text" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
246 <textarea class=
"form-control" name=
"note" cols=
"30" rows=
"1" wrap=
"virtual">{$prescription-
>note|escape:'html'}
</textarea>
250 {if $WEIGHT_LOSS_CLINIC}
251 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Substitution'|escape:'html'}
</td>
252 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
253 {html_options
name=
"substitute" options=$prescription-
>substitute_array selected=$prescription-
>substitute}
256 <td COLSPAN=
"1" class=
"text input-sm" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Add to Medication List'|escape:'html'}
</td>
257 <td COLSPAN=
"2" class=
"text input-sm" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
258 {html_radios
class=
"input-sm" name=
"medication" options=$prescription-
>medication_array selected=$prescription-
>medication}
260 {html_options
class=
"input-sm" name=
"substitute" options=$prescription-
>substitute_array selected=$prescription-
>substitute}
265 <input type=
"hidden" name=
"id" value=
"{$prescription->id|escape:'html'}" />
266 <input type=
"hidden" name=
"process" value=
"{$PROCESS|escape:'html'}" />
267 <script language='JavaScript'
>
273 <!-- for the fancy jQuery stuff -->
274 <script type=
"text/javascript">
276 function submitfun() {
277 top
.restoreSession();
278 if (CheckForErrors(this)) {
279 document
.forms
["prescribe"].submit();
286 function iframetopardiv(string
){
288 document
.getElementById('drug').value
=name
;
289 $("#hiddendiv").html( " " );
290 $('#hiddendiv').hide();
293 function cancelParlookup () {
294 $('#hiddendiv').hide();
295 $("#hiddendiv").html( " " );
298 $().ready(function() {
301 {if $GLOBALS
.weno_rx_enable
}
303 $('#drug').autocomplete({
304 source
: 'library/ajax/drug_autocomplete/search.php',
310 $('#drug').autocomplete({
311 source
: 'library/ajax/prescription_drugname_lookup.php',
319 $("#prescribe").submit(function() { return CheckForErrors(this) });
322 // check the form for required fields before submitting
323 var CheckForErrors = function(eObj
) {
325 if (CheckRequired('drug') == false) { return false; }
326 if (CheckRequired('quantity') == false) { return false; }
327 //if (CheckRequired('unit') == false) { return false; }
328 //if (CheckRequired('size') == false) { return false; }
329 if (CheckRequired('dosage') == false) { return false; }
330 //if (CheckRequired('form') == false) { return false; }
331 //if (CheckRequired('route') == false) { return false; }
332 //if (CheckRequired('interval') == false) { return false; }
334 return top
.restoreSession();
337 function CheckRequired(objID
) {
340 if ($('#'+objID
).is('input')) {
341 if ($('#'+objID
).val() == "") {
342 alert("{/literal}{xl t='Missing a required field and will be highlighted'}{literal}");
343 $('#'+objID
).css("backgroundColor", "pink");
349 if ($('#'+objID
).is('select')) {
350 if ($('#'+objID
).val() == "0") {
351 alert("{/literal}{xl t='Missing a required field'}{literal}");
352 $('#'+objID
).css("backgroundColor", "pink");