some assorted updates
[openemr.git] / templates / prescription / general_edit.html
blob411b9a76764e526768bd197c993701934b4fc5d7
1 <html>
2 <head>
3 {php}html_header_show();{/php}
5 <link rel="stylesheet" href="{php}echo $GLOBALS['css_header']; {/php}" type="text/css">
6 <link rel="stylesheet" href="{$WEBROOT}/interface/themes/jquery.autocomplete.css" type="text/css">
8 <script type="text/javascript" src="{$WEBROOT}/library/dialog.js"></script>
9 <script type="text/javascript" src="{$WEBROOT}/library/js/jquery-1.2.2.min.js"></script>
10 <script type="text/javascript" src="{$WEBROOT}/library/js/jquery.bgiframe.min.js"></script>
11 <script type="text/javascript" src="{$WEBROOT}/library/js/jquery.dimensions.pack.js"></script>
12 <script type="text/javascript" src="{$WEBROOT}/library/js/jquery.autocomplete.pack.js"></script>
13 {literal}
14 <style type="text/css" title="mystyles" media="all">
15 <!--
16 td {
17 font-size:8pt;
18 font-family:helvetica;
20 input {
21 font-size:8pt;
22 font-family:helvetica;
24 select {
25 font-size:8pt;
26 font-family:helvetica;
28 textarea {
29 font-size:8pt;
30 font-family:helvetica;
32 -->
33 </style>
34 <script language='JavaScript'>
36 // This holds all the default drug attributes.
37 {/literal}
38 var drugopts = [{$DRUG_ATTRIBUTES}];
39 {literal}
41 // Helper to choose an option from its value.
42 function selchoose(sel, value) {
43 var o = sel.options;
44 for (i = 0; i < o.length; ++i) {
45 o[i].selected = (o[i].value == value);
49 // Fill in default values when a drop-down drug is selected.
50 function drugselected(sel) {
51 var f = document.forms[0];
52 var i = f.drug_id.selectedIndex - 1;
53 if (i >= 0) {
54 var d = drugopts[i];
55 f.drug.value = d[0];
56 selchoose(f.form, d[1]);
57 f.dosage.value = d[2];
58 f.size.value = d[3];
59 selchoose(f.unit, d[4]);
60 selchoose(f.route, d[5]);
61 selchoose(f.interval, d[6]);
62 selchoose(f.substitute, d[7]);
63 f.quantity.value = d[8];
64 f.disp_quantity.value = d[8];
65 selchoose(f.refills, d[9]);
66 f.per_refill.value = d[10];
70 // Invoke the popup to dispense a drug.
71 function dispense() {
72 var f = document.forms[0];
73 dlgopen('interface/drugs/dispense_drug.php' +
74 {/literal}'?drug_id={$prescription->get_drug_id()}' +{literal}
75 '&prescription=' + f.id.value +
76 '&quantity=' + f.disp_quantity.value +
77 '&fee=' + f.disp_fee.value,
78 '_blank', 400, 200);
81 function quantityChanged() {
82 var f = document.forms[0];
83 f.per_refill.value = f.quantity.value;
84 if (f.disp_quantity) {
85 f.disp_quantity.value = f.quantity.value;
89 </script>
90 {/literal}
91 </head>
92 <body {$STYLE.BOTTOM_BG_LINE}>
93 <form name="prescribe" id="prescribe" method="post" action="{$FORM_ACTION}">
94 <table CELLSPACING="0" CELLPADDING="3">
95 <tr>
96 <td COLSPAN="1" ALIGN="LEFT" VALIGN="MIDDLE" >{xl t='Currently Active'}</td>
97 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
98 <input type="checkbox" name="active" value="1"{if $prescription->get_active() > 0} checked{/if} />
99 </td>
100 </tr>
101 <tr>
102 <td COLSPAN="1" ALIGN="LEFT" VALIGN="MIDDLE" >{xl t='Starting Date'}</td>
103 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
104 {html_select_date start_year="-10" end_year="+5" time=$prescription->start_date prefix="start_date_"}
105 </td>
106 </tr>
107 <tr>
108 <td COLSPAN="1" ALIGN="LEFT" VALIGN="MIDDLE" >{xl t='Provider'}</td>
109 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
110 {html_options name="provider_id" options=$prescription->provider->utility_provider_array() selected=$prescription->provider->get_id()}
111 <input type="hidden" name="patient_id" value="{$prescription->patient->id}" />
112 </td>
113 </tr>
114 <!--
115 <tr>
116 <td COLSPAN="1" ALIGN="LEFT" VALIGN="MIDDLE" >Patient Name</td>
117 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >{$prescription->patient->get_name_display()}</td>
118 </tr>
120 <tr>
121 <td COLSPAN="1" ALIGN="LEFT" VALIGN="MIDDLE" >{xl t='Drug'}</td>
122 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
123 <input type="input" size="20" name="drug" id="drug" value="{$prescription->drug}"/>
124 <input id="druglookup" class="button" type="BUTTON" value="Drug Lookup"/>
125 </td>
126 </tr>
128 {if $DRUG_ARRAY_VALUES}
129 <tr>
130 <td COLSPAN="1" ALIGN="LEFT" VALIGN="MIDDLE" >&nbsp; {xl t='in-house'}</td>
131 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
132 <select name="drug_id" onchange="drugselected(this)">
133 {html_options values=$DRUG_ARRAY_VALUES output=$DRUG_ARRAY_OUTPUT}
134 </select>
135 </td>
136 </tr>
137 {/if}
139 <tr>
140 <td COLSPAN="1" ALIGN="LEFT" VALIGN="MIDDLE" >{xl t='Quantity'}</td>
141 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
142 <input TYPE="TEXT" NAME="quantity" id="quantity" SIZE="10" MAXLENGTH="31"
143 VALUE="{$prescription->quantity}"
144 onchange="quantityChanged()" />
145 </td>
146 </tr>
147 {if $SIMPLIFIED_PRESCRIPTIONS && !$prescription->size}
148 <tr style='display:none;'>
149 {else}
150 <tr>
151 {/if}
152 <td COLSPAN="1" ALIGN="LEFT" VALIGN="MIDDLE" >{xl t='Medicine Units'}</td>
153 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
154 <input TYPE="TEXT" NAME="size" id="size" SIZE="11" MAXLENGTH="10" VALUE="{$prescription->size}"/>
155 <select name="unit" id="unit">{html_options options=$prescription->unit_array selected=$prescription->unit}</select>
156 </td>
157 </tr>
158 <tr>
159 <td COLSPAN="1" ALIGN="LEFT" VALIGN="MIDDLE" >{xl t='Take'}</td>
160 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
161 {if $SIMPLIFIED_PRESCRIPTIONS && !$prescription->form && !$prescription->route && !$prescription->interval}
162 <input TYPE="text" NAME="dosage" id="dosage" SIZE="30" MAXLENGTH="100" VALUE="{$prescription->dosage}" />
163 <input type="hidden" name="form" id="form" value="0" />
164 <input type="hidden" name="route" id="route" value="0" />
165 <input type="hidden" name="interval" id="interval" value="0" />
166 {else}
167 <input TYPE="TEXT" NAME="dosage" id="dosage" SIZE="2" MAXLENGTH="10" VALUE="{$prescription->dosage}"/> {xl t='in'}
168 <select name="form" id="form">{html_options options=$prescription->form_array selected=$prescription->form}</select>
169 <select name="route" id="route">{html_options options=$prescription->route_array selected=$prescription->route}</select>
170 <select name="interval" id="interval">{html_options options=$prescription->interval_array selected=$prescription->interval}</select>
171 {/if}
172 </td>
173 </tr>
174 <tr>
175 <td COLSPAN="1" ALIGN="LEFT" VALIGN="MIDDLE" >{xl t='Refills'}</td>
176 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
177 {html_options name="refills" options=$prescription->refills_array selected=$prescription->refills}
178 {if $SIMPLIFIED_PRESCRIPTIONS}
179 <input TYPE="hidden" ID="per_refill" NAME="per_refill" VALUE="{$prescription->per_refill}" />
180 {else}
181 &nbsp; &nbsp; # {xl t='of tablets'}:
182 <input TYPE="TEXT" ID="per_refill" NAME="per_refill" SIZE="2" MAXLENGTH="10" VALUE="{$prescription->per_refill}" />
183 {/if}
184 </td>
185 </tr>
186 <!--
187 <tr>
188 <td COLSPAN="1" ALIGN="LEFT" VALIGN="MIDDLE" >{xl t='Substitution'}</td>
189 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
190 {html_options name="substitute" options=$prescription->substitute_array selected=$prescription->substitute}
191 </td>
192 </tr>
194 <tr>
195 <td COLSPAN="1" ALIGN="LEFT" VALIGN="MIDDLE" >{xl t='Notes'}</td>
196 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
197 <textarea name="note" cols="30" rows="2" wrap="virtual">{$prescription->note}</textarea>
198 </td>
199 </tr>
200 <tr>
201 {if $WEIGHT_LOSS_CLINIC}
202 <td COLSPAN="1" ALIGN="LEFT" VALIGN="MIDDLE" >{xl t='Substitution'}</td>
203 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
204 {html_options name="substitute" options=$prescription->substitute_array selected=$prescription->substitute}
205 </td>
206 {else}
207 <td COLSPAN="1" ALIGN="LEFT" VALIGN="MIDDLE" >{xl t='Add to Medication List'}</td>
208 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
209 {html_radios name="medication" options=$prescription->medication_array selected=$prescription->medication}
210 &nbsp; &nbsp;
211 {html_options name="substitute" options=$prescription->substitute_array selected=$prescription->substitute}
212 </td>
213 {/if}
214 </tr>
215 <tr>
216 <td colspan="3">
217 <input type="submit" value="{xl t='Save'}" />
218 {if $DRUG_ARRAY_VALUES}
219 &nbsp; &nbsp; &nbsp; &nbsp;
220 {if $prescription->get_refills() >= $prescription->get_dispensation_count()}
221 <input type="submit" name="disp_button" value="{xl t='Save and Dispense'}" />
222 <input type="text" name="disp_quantity" size="2" maxlength="10" value="{$DISP_QUANTITY}" />
223 units, $
224 <input type="text" name="disp_fee" size="5" maxlength="10" value="{$DISP_FEE}" />
225 {else}
226 {xl t=' prescription has reached its limit of'} {$prescription->get_refills()} {xl t='refills'}.
227 {/if}
228 {/if}
229 </td>
230 </tr>
231 </table>
232 <input type="hidden" name="id" value="{$prescription->id}" />
233 <input type="hidden" name="process" value="{$PROCESS}" />
234 <script language='JavaScript'>
235 {$ENDING_JAVASCRIPT}
236 </script>
237 </form>
238 </body>
240 {literal}
241 <!-- for the fancy jQuery stuff -->
242 <script type="text/javascript">
243 $().ready(function() {
244 $("#drug").autocomplete('library/ajax/prescription_drugname_lookup.php',
246 width: 200,
247 scrollHeight: 100,
248 selectFirst: true
250 $("#drug").focus();
251 $("#prescribe").submit(function() { return CheckForErrors(this) });
252 $("#druglookup").click(function() { DoDrugLookup(this) });
256 // pop up a drug lookup window with the value of the drug name, if we have one
257 function DoDrugLookup(eObj) {
258 drugname = "";
259 if ($('#drug').val() != "") { drugname = $('#drug').val(); }
260 drugPopup = window.open('controller.php?prescription&lookup&drug='+drugname, 'drugPopup', 'width=400,height=50,menubar=no,titlebar=no,left = 825,top = 400');
261 drugPopup.opener = self;
262 return true;
266 // check the form for required fields before submitting
267 var CheckForErrors = function(eObj) {
268 // REQUIRED FIELDS
269 if (CheckRequired('drug') == false) { return false; }
270 //if (CheckRequired('quantity') == false) { return false; }
271 //if (CheckRequired('unit') == false) { return false; }
272 //if (CheckRequired('size') == false) { return false; }
273 //if (CheckRequired('dosage') == false) { return false; }
274 //if (CheckRequired('form') == false) { return false; }
275 //if (CheckRequired('route') == false) { return false; }
276 //if (CheckRequired('interval') == false) { return false; }
278 return top.restoreSession();
281 function CheckRequired(objID) {
283 // for text boxes
284 if ($('#'+objID).is('text')) {
285 if ($('#'+objID).val() == "") {
286 alert("Missing a required field");
287 $('#'+objID).css("backgroundColor", "pink");
288 return false;
292 // for select boxes
293 if ($('#'+objID).is('select')) {
294 if ($('#'+objID).val() == "0") {
295 alert("Missing a required field");
296 $('#'+objID).css("backgroundColor", "pink");
297 return false;
301 return true;
304 </script>
305 {/literal}
307 </html>