3 {php}html_header_show();{/php}
5 <link rel=
"stylesheet" href=
"{$CSS_HEADER}" type=
"text/css">
6 <link rel=
"stylesheet" href=
"{$WEBROOT}/interface/themes/jquery.autocomplete.css" type=
"text/css">
7 <link rel=
"stylesheet" href=
"{$WEBROOT}/library/js/jquery-ui.min.css" type=
"text/css" />
9 <style type=
"text/css">
20 <script language=
"Javascript">
23 function my_process () {
25 opener
.document
.prescribe
.drug
.value
= document
.lookup
.drug
.value
;
34 <script type=
"text/javascript" src=
"{$WEBROOT}/library/dialog.js?v={php} echo $v_js_includes; {/php}"></script>
35 <script type=
"text/javascript" src=
"{$WEBROOT}/library/js/jquery.bgiframe.min.js"></script>
36 <script type=
"text/javascript" src=
"{$WEBROOT}/library/js/jquery.dimensions.pack.js"></script>
37 <script type=
"text/javascript" src=
"{$WEBROOT}/library/js/jquery.autocomplete.pack.js"></script>
38 <script type=
"text/javascript" src=
"{php} echo $GLOBALS['assets_static_relative']; {/php}/jquery-min-1-9-1/index.js"></script>
39 <script type=
"text/javascript" src=
"{php} echo $GLOBALS['assets_static_relative']; {/php}/jquery-ui-1-12-1/jquery-ui.js"></script>
42 <script language='JavaScript'
>
44 // This holds all the default drug attributes.
46 var drugopts
= [{$DRUG_ATTRIBUTES
}];
49 // Helper to choose an option from its value.
50 function selchoose(sel
, value
) {
52 for (i
= 0; i
< o
.length
; ++i
) {
53 o
[i
].selected
= (o
[i
].value
== value
);
57 // Fill in default values when a drop-down drug is selected.
58 function drugselected(sel
) {
59 var f
= document
.forms
[0];
60 var i
= f
.drug_id
.selectedIndex
- 1;
64 selchoose(f
.form
, d
[1]);
65 f
.dosage
.value
= d
[2];
67 f
.rxnorm_drugcode
.value
= d
[11];
68 selchoose(f
.unit
, d
[4]);
69 selchoose(f
.route
, d
[5]);
70 selchoose(f
.interval
, d
[6]);
71 selchoose(f
.substitute
, d
[7]);
72 f
.quantity
.value
= d
[8];
73 f
.disp_quantity
.value
= d
[8];
74 selchoose(f
.refills
, d
[9]);
75 f
.per_refill
.value
= d
[10];
79 // Invoke the popup to dispense a drug.
81 var f
= document
.forms
[0];
82 dlgopen('interface/drugs/dispense_drug.php' +
83 {/literal
}'?drug_id={$prescription->get_drug_id()}' +{literal
}
84 '&prescription=' + f
.id
.value
+
85 '&quantity=' + f
.disp_quantity
.value
+
86 '&fee=' + f
.disp_fee
.value
,
90 function quantityChanged() {
91 var f
= document
.forms
[0];
92 f
.per_refill
.value
= f
.quantity
.value
;
93 if (f
.disp_quantity
) {
94 f
.disp_quantity
.value
= f
.quantity
.value
;
101 <body class=
"body_top">
103 <form name=
"prescribe" id=
"prescribe" method=
"post" action=
"{$FORM_ACTION}" >
105 <tr><td class=
"title"><font><b>{xl t='Add'}/{xl t='Edit'}
</b></font> </td>
106 <td><a href=#
onclick=
"submitfun();" class=
"css_button_small"><span>{xl t='Save'}
</span></a>
107 {if $DRUG_ARRAY_VALUES}
108
109 {if $prescription-
>get_refills()
>= $prescription-
>get_dispensation_count()}
110 <input type=
"submit" name=
"disp_button" value=
"{xl t='Save and Dispense'}" />
111 <input type=
"text" name=
"disp_quantity" size=
"2" maxlength=
"10" value=
"{$DISP_QUANTITY}" />
113 <input type=
"text" name=
"disp_fee" size=
"5" maxlength=
"10" value=
"{$DISP_FEE}" />
115 {xl t='prescription has reached its limit of'} {$prescription-
>get_refills()} {xl t='refills'}.
118 <a class='css_button_small'
href=
"controller.php?prescription&list&id={$prescription->patient->id}"><span>{xl t='Back'}
</span></a>
122 {php} if ($GLOBALS['enable_amc_prompting']) { {/php}
123 <div style='float:right;margin-right:
25px;border-style:solid;border-width:
1px;'
>
124 <div style='float:left;margin:
5px
5px
5px
5px;'
>
125 {amcCollect amc_id='e_prescribe_amc' patient_id=$prescription-
>patient-
>id object_category='prescriptions' object_id=$prescription-
>id}
126 {if not $amcCollectReturn}
127 <input type=
"checkbox" id=
"escribe_flag" name=
"escribe_flag">
129 <input type=
"checkbox" id=
"escribe_flag" name=
"escribe_flag" checked
>
131 <span class=
"text">{xl t='E-Prescription?'}
</span><br>
133 {amcCollect amc_id='e_prescribe_chk_formulary_amc' patient_id=$prescription-
>patient-
>id object_category='prescriptions' object_id=$prescription-
>id}
134 {if not $amcCollectReturn}
135 <input type=
"checkbox" id=
"checked_formulary_flag" name=
"checked_formulary_flag">
137 <input type=
"checkbox" id=
"checked_formulary_flag" name=
"checked_formulary_flag" checked
>
139 <span class=
"text">{xl t='Checked Drug Formulary?'}
</span><br>
141 {amcCollect amc_id='e_prescribe_cont_subst_amc' patient_id=$prescription-
>patient-
>id object_category='prescriptions' object_id=$prescription-
>id}
142 {if not $amcCollectReturn}
143 <input type=
"checkbox" id=
"controlled_substance_flag" name=
"controlled_substance_flag">
145 <input type=
"checkbox" id=
"controlled_substance_flag" name=
"controlled_substance_flag" checked
>
147 <span class=
"text">{xl t='Controlled Substance?'}
</span><br>
153 <table CELLSPACING=
"0" CELLPADDING=
"3" BORDER=
"0">
155 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Currently Active'}
</td>
156 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
157 <input type=
"checkbox" name=
"active" value=
"1"{if $prescription-
>get_active()
> 0} checked{/if}
/>
161 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Starting Date'}
</td>
162 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
163 {html_select_date
start_year=
"-10" end_year=
"+5" time=$prescription-
>start_date
prefix=
"start_date_"}
164 <input type=
"hidden" name=
"start_date" value=
"{$prescription->start_date}">
168 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Provider'}
</td>
169 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
170 {html_options
name=
"provider_id" options=$prescription-
>provider-
>utility_provider_array() selected=$prescription-
>provider-
>get_id()}
171 <input type=
"hidden" name=
"patient_id" value=
"{$prescription->patient->id}" />
176 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Drug'}
</td>
177 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
178 <input type=
"input" size=
"20" name=
"drug" id=
"drug" class=
"wDrug" value=
"{$prescription->drug}"/>
179 <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="52" scrolling="no" frameborder="no"></iframe>'">
180 ({xl t='click here to search'})
</a>
181 <div id=hiddendiv
style=
"display:none"> </div>
184 {if $DRUG_ARRAY_VALUES}
186 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" > {xl t='in-house'}
</td>
187 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
188 <select name=
"drug_id" onchange=
"drugselected(this)">
189 {html_options values=$DRUG_ARRAY_VALUES output=$DRUG_ARRAY_OUTPUT selected=$prescription-
>get_drug_id()}
191 <input type=
"hidden" name=
"rxnorm_drugcode" value=
"{$prescription->rxnorm_drugcode}">
196 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Quantity'}
</td>
197 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
198 <input TYPE=
"TEXT" NAME=
"quantity" id=
"quantity" SIZE=
"10" MAXLENGTH=
"31"
199 VALUE=
"{$prescription->quantity}"
200 onchange=
"quantityChanged()" />
203 {if $SIMPLIFIED_PRESCRIPTIONS && !$prescription-
>size}
204 <tr style='display:none;'
>
208 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Medicine Units'}
</td>
209 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
210 <input TYPE=
"TEXT" NAME=
"size" id=
"size" SIZE=
"11" MAXLENGTH=
"10" VALUE=
"{$prescription->size}"/>
211 <select name=
"unit" id=
"unit">{html_options options=$prescription-
>unit_array selected=$prescription-
>unit}
</select>
215 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Directions'}
</td>
216 <td COLSPAN=
"2" class=
"text" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
217 {if $SIMPLIFIED_PRESCRIPTIONS && !$prescription-
>form && !$prescription-
>route && !$prescription-
>interval}
218 <input TYPE=
"text" NAME=
"dosage" id=
"dosage" SIZE=
"30" MAXLENGTH=
"100" VALUE=
"{$prescription->dosage}" />
219 <input type=
"hidden" name=
"form" id=
"form" value=
"0" />
220 <input type=
"hidden" name=
"route" id=
"route" value=
"0" />
221 <input type=
"hidden" name=
"interval" id=
"interval" value=
"0" />
223 <input TYPE=
"TEXT" NAME=
"dosage" id=
"dosage" SIZE=
"2" MAXLENGTH=
"10" VALUE=
"{$prescription->dosage}"/> {xl t='in'}
224 <select name=
"form" id=
"form">{html_options options=$prescription-
>form_array selected=$prescription-
>form}
</select>
225 <select name=
"route" id=
"route">{html_options options=$prescription-
>route_array selected=$prescription-
>route}
</select>
226 <select name=
"interval" id=
"interval">{html_options options=$prescription-
>interval_array selected=$prescription-
>interval}
</select>
231 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Refills'}
</td>
232 <td COLSPAN=
"2" class=
"text" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
233 {html_options
name=
"refills" options=$prescription-
>refills_array selected=$prescription-
>refills}
234 {if $SIMPLIFIED_PRESCRIPTIONS}
235 <input TYPE=
"hidden" ID=
"per_refill" NAME=
"per_refill" VALUE=
"{$prescription->per_refill}" />
237 # {xl t='of tablets'}:
238 <input TYPE=
"TEXT" ID=
"per_refill" NAME=
"per_refill" SIZE=
"2" MAXLENGTH=
"10" VALUE=
"{$prescription->per_refill}" />
243 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Notes'}
</td>
244 <td COLSPAN=
"2" class=
"text" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
245 <textarea name=
"note" cols=
"30" rows=
"2" wrap=
"virtual">{$prescription-
>note}
</textarea>
249 {if $WEIGHT_LOSS_CLINIC}
250 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Substitution'}
</td>
251 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
252 {html_options
name=
"substitute" options=$prescription-
>substitute_array selected=$prescription-
>substitute}
255 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Add to Medication List'}
</td>
256 <td COLSPAN=
"2" class=
"text" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
257 {html_radios
name=
"medication" options=$prescription-
>medication_array selected=$prescription-
>medication}
259 {html_options
name=
"substitute" options=$prescription-
>substitute_array selected=$prescription-
>substitute}
264 <input type=
"hidden" name=
"id" value=
"{$prescription->id}" />
265 <input type=
"hidden" name=
"process" value=
"{$PROCESS}" />
266 <script language='JavaScript'
>
272 <!-- for the fancy jQuery stuff -->
273 <script type=
"text/javascript">
276 //Drug form autocomplete to text box.
277 $(".wDrug").autocomplete({
278 source
: "library/ajax/drug_autocomplete/search.php",
283 function submitfun() {
284 top
.restoreSession();
285 if (CheckForErrors(this)) {
286 document
.forms
["prescribe"].submit();
293 function iframetopardiv(string
){
295 document
.getElementById('drug').value
=name
;
296 $("#hiddendiv").html( " " );
297 $('#hiddendiv').hide();
300 function iframetopardiv(string
){
302 document
.getElementById('pharmacy').value
=name
;
303 $("#hiddendiv").html( " " );
304 $('#hiddendiv').hide();
307 function cancelParlookup () {
308 $('#hiddendiv').hide();
309 $("#hiddendiv").html( " " );
312 $().ready(function() {
313 $("#drug").autocomplete('library/ajax/prescription_drugname_lookup.php',
320 $("#prescribe").submit(function() { return CheckForErrors(this) });
321 $("#druglookup").click(function() { DoDrugLookup(this) });
325 // pop up a drug lookup window with the value of the drug name, if we have one
326 function DoDrugLookup(eObj
) {
328 if ($('#drug').val() != "") { drugname
= $('#drug').val(); }
329 $("#druglist").css('display','block');
330 document
.lookup
.action
='controller.php?prescription&edit&id=&pid={/literal}{$prescription->patient->id}{literal}&drug=sss'+drugname
;
331 drugPopup
= window
.open('controller.php?prescription&lookup&drug='+drugname
, 'drugPopup', 'width=400,height=50,menubar=no,titlebar=no,left = 825,top = 400');
332 drugPopup
.opener
= self
;
337 // check the form for required fields before submitting
338 var CheckForErrors = function(eObj
) {
340 if (CheckRequired('drug') == false) { return false; }
341 if (CheckRequired('quantity') == false) { return false; }
342 //if (CheckRequired('unit') == false) { return false; }
343 //if (CheckRequired('size') == false) { return false; }
344 if (CheckRequired('dosage') == false) { return false; }
345 //if (CheckRequired('form') == false) { return false; }
346 //if (CheckRequired('route') == false) { return false; }
347 //if (CheckRequired('interval') == false) { return false; }
349 return top
.restoreSession();
352 function CheckRequired(objID
) {
355 if ($('#'+objID
).is('input')) {
356 if ($('#'+objID
).val() == "") {
357 alert("{/literal}{xl t='Missing a required field and will be highlighted'}{literal}");
358 $('#'+objID
).css("backgroundColor", "pink");
364 if ($('#'+objID
).is('select')) {
365 if ($('#'+objID
).val() == "0") {
366 alert("{/literal}{xl t='Missing a required field'}{literal}");
367 $('#'+objID
).css("backgroundColor", "pink");