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">
8 <style type=
"text/css">
14 <script language=
"Javascript">
16 function my_process () {
18 opener
.document
.prescribe
.drug
.value
= document
.lookup
.drug
.value
;
27 <script type=
"text/javascript" src=
"{$WEBROOT}/library/dialog.js"></script>
28 <script type=
"text/javascript" src=
"{$WEBROOT}/library/js/jquery-1.2.2.min.js"></script>
29 <script type=
"text/javascript" src=
"{$WEBROOT}/library/js/jquery.bgiframe.min.js"></script>
30 <script type=
"text/javascript" src=
"{$WEBROOT}/library/js/jquery.dimensions.pack.js"></script>
31 <script type=
"text/javascript" src=
"{$WEBROOT}/library/js/jquery.autocomplete.pack.js"></script>
33 <script language='JavaScript'
>
35 // This holds all the default drug attributes.
37 var drugopts
= [{$DRUG_ATTRIBUTES
}];
40 // Helper to choose an option from its value.
41 function selchoose(sel
, value
) {
43 for (i
= 0; i
< o
.length
; ++i
) {
44 o
[i
].selected
= (o
[i
].value
== value
);
48 // Fill in default values when a drop-down drug is selected.
49 function drugselected(sel
) {
50 var f
= document
.forms
[0];
51 var i
= f
.drug_id
.selectedIndex
- 1;
55 selchoose(f
.form
, d
[1]);
56 f
.dosage
.value
= d
[2];
58 selchoose(f
.unit
, d
[4]);
59 selchoose(f
.route
, d
[5]);
60 selchoose(f
.interval
, d
[6]);
61 selchoose(f
.substitute
, d
[7]);
62 f
.quantity
.value
= d
[8];
63 f
.disp_quantity
.value
= d
[8];
64 selchoose(f
.refills
, d
[9]);
65 f
.per_refill
.value
= d
[10];
69 // Invoke the popup to dispense a drug.
71 var f
= document
.forms
[0];
72 dlgopen('interface/drugs/dispense_drug.php' +
73 {/literal
}'?drug_id={$prescription->get_drug_id()}' +{literal
}
74 '&prescription=' + f
.id
.value
+
75 '&quantity=' + f
.disp_quantity
.value
+
76 '&fee=' + f
.disp_fee
.value
,
80 function quantityChanged() {
81 var f
= document
.forms
[0];
82 f
.per_refill
.value
= f
.quantity
.value
;
83 if (f
.disp_quantity
) {
84 f
.disp_quantity
.value
= f
.quantity
.value
;
91 <body class=
"body_top">
93 <form name=
"prescribe" id=
"prescribe" method=
"post" action=
"{$FORM_ACTION}">
95 <tr><td class=
"title"><font><b>{xl t='Add'}/{xl t='Edit'}
</b></font> </td>
96 <td><a href=#
onclick=
"submitfun();" class=
"css_button_small"><span>{xl t='Save'}
</span></a>
97 {if $DRUG_ARRAY_VALUES}
98
99 {if $prescription-
>get_refills()
>= $prescription-
>get_dispensation_count()}
100 <input type=
"submit" name=
"disp_button" value=
"{xl t='Save and Dispense'}" />
101 <input type=
"text" name=
"disp_quantity" size=
"2" maxlength=
"10" value=
"{$DISP_QUANTITY}" />
103 <input type=
"text" name=
"disp_fee" size=
"5" maxlength=
"10" value=
"{$DISP_FEE}" />
105 {xl t='prescription has reached its limit of'} {$prescription-
>get_refills()} {xl t='refills'}.
108 <a class='css_button_small'
href=
"controller.php?prescription&list&id={$prescription->patient->id}"><span>{xl t='Back'}
</span></a>
112 <table CELLSPACING=
"0" CELLPADDING=
"3" BORDER=
"0">
114 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Currently Active'}
</td>
115 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
116 <input type=
"checkbox" name=
"active" value=
"1"{if $prescription-
>get_active()
> 0} checked{/if}
/>
120 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Starting Date'}
</td>
121 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
122 {html_select_date
start_year=
"-10" end_year=
"+5" time=$prescription-
>start_date
prefix=
"start_date_"}
126 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Provider'}
</td>
127 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
128 {html_options
name=
"provider_id" options=$prescription-
>provider-
>utility_provider_array() selected=$prescription-
>provider-
>get_id()}
129 <input type=
"hidden" name=
"patient_id" value=
"{$prescription->patient->id}" />
133 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Drug'}
</td>
134 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
135 <input type=
"input" size=
"20" name=
"drug" id=
"drug" value=
"{$prescription->drug}"/>
136 <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>'">
137 ({xl t='click here to search'})
</a>
138 <div id=hiddendiv
style=
"display:none"> </div>
141 {if $DRUG_ARRAY_VALUES}
143 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" > {xl t='in-house'}
</td>
144 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
145 <select name=
"drug_id" onchange=
"drugselected(this)">
146 {html_options values=$DRUG_ARRAY_VALUES output=$DRUG_ARRAY_OUTPUT}
152 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Quantity'}
</td>
153 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
154 <input TYPE=
"TEXT" NAME=
"quantity" id=
"quantity" SIZE=
"10" MAXLENGTH=
"31"
155 VALUE=
"{$prescription->quantity}"
156 onchange=
"quantityChanged()" />
159 {if $SIMPLIFIED_PRESCRIPTIONS && !$prescription-
>size}
160 <tr style='display:none;'
>
164 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Medicine Units'}
</td>
165 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
166 <input TYPE=
"TEXT" NAME=
"size" id=
"size" SIZE=
"11" MAXLENGTH=
"10" VALUE=
"{$prescription->size}"/>
167 <select name=
"unit" id=
"unit">{html_options options=$prescription-
>unit_array selected=$prescription-
>unit}
</select>
171 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Take'}
</td>
172 <td COLSPAN=
"2" class=
"text" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
173 {if $SIMPLIFIED_PRESCRIPTIONS && !$prescription-
>form && !$prescription-
>route && !$prescription-
>interval}
174 <input TYPE=
"text" NAME=
"dosage" id=
"dosage" SIZE=
"30" MAXLENGTH=
"100" VALUE=
"{$prescription->dosage}" />
175 <input type=
"hidden" name=
"form" id=
"form" value=
"0" />
176 <input type=
"hidden" name=
"route" id=
"route" value=
"0" />
177 <input type=
"hidden" name=
"interval" id=
"interval" value=
"0" />
179 <input TYPE=
"TEXT" NAME=
"dosage" id=
"dosage" SIZE=
"2" MAXLENGTH=
"10" VALUE=
"{$prescription->dosage}"/> {xl t='in'}
180 <select name=
"form" id=
"form">{html_options options=$prescription-
>form_array selected=$prescription-
>form}
</select>
181 <select name=
"route" id=
"route">{html_options options=$prescription-
>route_array selected=$prescription-
>route}
</select>
182 <select name=
"interval" id=
"interval">{html_options options=$prescription-
>interval_array selected=$prescription-
>interval}
</select>
187 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Refills'}
</td>
188 <td COLSPAN=
"2" class=
"text" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
189 {html_options
name=
"refills" options=$prescription-
>refills_array selected=$prescription-
>refills}
190 {if $SIMPLIFIED_PRESCRIPTIONS}
191 <input TYPE=
"hidden" ID=
"per_refill" NAME=
"per_refill" VALUE=
"{$prescription->per_refill}" />
193 # {xl t='of tablets'}:
194 <input TYPE=
"TEXT" ID=
"per_refill" NAME=
"per_refill" SIZE=
"2" MAXLENGTH=
"10" VALUE=
"{$prescription->per_refill}" />
199 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Notes'}
</td>
200 <td COLSPAN=
"2" class=
"text" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
201 <textarea name=
"note" cols=
"30" rows=
"2" wrap=
"virtual">{$prescription-
>note}
</textarea>
205 {if $WEIGHT_LOSS_CLINIC}
206 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Substitution'}
</td>
207 <td COLSPAN=
"2" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
208 {html_options
name=
"substitute" options=$prescription-
>substitute_array selected=$prescription-
>substitute}
211 <td COLSPAN=
"1" class=
"text" ALIGN=
"right" VALIGN=
"MIDDLE" >{xl t='Add to Medication List'}
</td>
212 <td COLSPAN=
"2" class=
"text" ALIGN=
"LEFT" VALIGN=
"MIDDLE" >
213 {html_radios
name=
"medication" options=$prescription-
>medication_array selected=$prescription-
>medication}
215 {html_options
name=
"substitute" options=$prescription-
>substitute_array selected=$prescription-
>substitute}
220 <input type=
"hidden" name=
"id" value=
"{$prescription->id}" />
221 <input type=
"hidden" name=
"process" value=
"{$PROCESS}" />
222 <script language='JavaScript'
>
227 <!-- for the fancy jQuery stuff -->
228 <script type=
"text/javascript">
230 function submitfun() {
231 top
.restoreSession();
232 if (CheckForErrors(this)) {
233 document
.forms
["prescribe"].submit();
240 function iframetopardiv(string
){
242 document
.getElementById('drug').value
=name
;
243 $("#hiddendiv").html( " " );
244 $('#hiddendiv').hide();
247 function cancelParlookup () {
248 $('#hiddendiv').hide();
249 $("#hiddendiv").html( " " );
252 $().ready(function() {
253 $("#drug").autocomplete('library/ajax/prescription_drugname_lookup.php',
260 $("#prescribe").submit(function() { return CheckForErrors(this) });
261 $("#druglookup").click(function() { DoDrugLookup(this) });
265 // pop up a drug lookup window with the value of the drug name, if we have one
266 function DoDrugLookup(eObj
) {
268 if ($('#drug').val() != "") { drugname
= $('#drug').val(); }
269 $("#druglist").css('display','block');
270 document
.lookup
.action
='controller.php?prescription&edit&id=&pid={/literal}{$prescription->patient->id}{literal}&drug=sss'+drugname
;
271 drugPopup
= window
.open('controller.php?prescription&lookup&drug='+drugname
, 'drugPopup', 'width=400,height=50,menubar=no,titlebar=no,left = 825,top = 400');
272 drugPopup
.opener
= self
;
277 // check the form for required fields before submitting
278 var CheckForErrors = function(eObj
) {
280 if (CheckRequired('drug') == false) { return false; }
281 //if (CheckRequired('quantity') == false) { return false; }
282 //if (CheckRequired('unit') == false) { return false; }
283 //if (CheckRequired('size') == false) { return false; }
284 //if (CheckRequired('dosage') == false) { return false; }
285 //if (CheckRequired('form') == false) { return false; }
286 //if (CheckRequired('route') == false) { return false; }
287 //if (CheckRequired('interval') == false) { return false; }
289 return top
.restoreSession();
292 function CheckRequired(objID
) {
295 if ($('#'+objID
).is('input')) {
296 if ($('#'+objID
).val() == "") {
297 alert("{/literal}{xl t='Missing a required field'}{literal}");
298 $('#'+objID
).css("backgroundColor", "pink");
304 if ($('#'+objID
).is('select')) {
305 if ($('#'+objID
).val() == "0") {
306 alert("{/literal}{xl t='Missing a required field'}{literal}");
307 $('#'+objID
).css("backgroundColor", "pink");