Weno eRx feature build, take 5.
[openemr.git] / templates / prescription / general_edit.html
blobd6065a879bad0265be50a4b6b3b6174c9bad5067
1 <html>
2 <head>
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" />
8 {literal}
9 <style type="text/css">
12 input{
13 margin: 5px;
15 select{
16 margin: 5px;
18 </style>
19 {/literal}
20 <script language="Javascript">
22 {literal}
23 function my_process () {
24 // Pass the variable
25 opener.document.prescribe.drug.value = document.lookup.drug.value;
26 // Close the window
27 window.self.close();
29 {/literal}
30 </script>
31 {literal}
32 {/literal}
33 <!---Gen Look up-->
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>
41 {literal}
42 <script language='JavaScript'>
44 // This holds all the default drug attributes.
45 {/literal}
46 var drugopts = [{$DRUG_ATTRIBUTES}];
47 {literal}
49 // Helper to choose an option from its value.
50 function selchoose(sel, value) {
51 var o = sel.options;
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;
61 if (i >= 0) {
62 var d = drugopts[i];
63 f.drug.value = d[0];
64 selchoose(f.form, d[1]);
65 f.dosage.value = d[2];
66 f.size.value = d[3];
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.
80 function dispense() {
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,
87 '_blank', 400, 200);
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;
98 </script>
99 {/literal}
100 </head>
101 <body class="body_top">
103 <form name="prescribe" id="prescribe" method="post" action="{$FORM_ACTION}" >
104 <table>
105 <tr><td class="title"><font><b>{xl t='Add'}/{xl t='Edit'}</b></font>&nbsp;</td>
106 <td><a href=# onclick="submitfun();" class="css_button_small"><span>{xl t='Save'}</span></a>
107 {if $DRUG_ARRAY_VALUES}
108 &nbsp; &nbsp; &nbsp; &nbsp;
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}" />
112 units, $
113 <input type="text" name="disp_fee" size="5" maxlength="10" value="{$DISP_FEE}" />
114 {else}&nbsp;
115 {xl t='prescription has reached its limit of'} {$prescription->get_refills()} {xl t='refills'}.
116 {/if}
117 {/if}
118 <a class='css_button_small' href="controller.php?prescription&list&id={$prescription->patient->id}"><span>{xl t='Back'}</span></a>
119 </td></tr>
120 </table>
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">
128 {else}
129 <input type="checkbox" id="escribe_flag" name="escribe_flag" checked>
130 {/if}
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">
136 {else}
137 <input type="checkbox" id="checked_formulary_flag" name="checked_formulary_flag" checked>
138 {/if}
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">
144 {else}
145 <input type="checkbox" id="controlled_substance_flag" name="controlled_substance_flag" checked>
146 {/if}
147 <span class="text">{xl t='Controlled Substance?'}</span><br>
149 </div>
150 </div>
151 {php} } {/php}
153 <table CELLSPACING="0" CELLPADDING="3" BORDER="0">
154 <tr>
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} />
158 </td>
159 </tr>
160 <tr>
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}">
165 </td>
166 </tr>
167 <tr>
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}" />
172 </td>
173 </tr>
175 <tr>
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='&lt;iframe src=&quot;controller.php?prescription&amp;lookup&amp;drug=&quot; width=&quot;100%&quot;height=&quot;52&quot; scrolling=&quot;no&quot; frameborder=&quot;no&quot;&gt;&lt;/iframe&gt;'">
180 ({xl t='click here to search'})</a>
181 <div id=hiddendiv style="display:none">&nbsp;</div>
182 </td>
183 </tr>
184 {if $DRUG_ARRAY_VALUES}
185 <tr>
186 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >&nbsp; {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()}
190 </select>
191 <input type="hidden" name="rxnorm_drugcode" value="{$prescription->rxnorm_drugcode}">
192 </td>
193 </tr>
194 {/if}
195 <tr>
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()" />
201 </td>
202 </tr>
203 {if $SIMPLIFIED_PRESCRIPTIONS && !$prescription->size}
204 <tr style='display:none;'>
205 {else}
206 <tr>
207 {/if}
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>
212 </td>
213 </tr>
214 <tr>
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" />
222 {else}
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>
227 {/if}
228 </td>
229 </tr>
230 <tr>
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}" />
236 {else}
237 &nbsp; &nbsp; # {xl t='of tablets'}:
238 <input TYPE="TEXT" ID="per_refill" NAME="per_refill" SIZE="2" MAXLENGTH="10" VALUE="{$prescription->per_refill}" />
239 {/if}
240 </td>
241 </tr>
242 <tr>
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>
246 </td>
247 </tr>
248 <tr>
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}
253 </td>
254 {else}
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}
258 &nbsp; &nbsp;
259 {html_options name="substitute" options=$prescription->substitute_array selected=$prescription->substitute}
260 </td>
261 {/if}
262 </tr>
263 </table>
264 <input type="hidden" name="id" value="{$prescription->id}" />
265 <input type="hidden" name="process" value="{$PROCESS}" />
266 <script language='JavaScript'>
267 {$ENDING_JAVASCRIPT}
268 </script>
269 </form>
271 {literal}
272 <!-- for the fancy jQuery stuff -->
273 <script type="text/javascript">
275 $(function() {
276 //Drug form autocomplete to text box.
277 $(".wDrug").autocomplete({
278 source: "library/ajax/drug_autocomplete/search.php",
279 minLength: 3
283 function submitfun() {
284 top.restoreSession();
285 if (CheckForErrors(this)) {
286 document.forms["prescribe"].submit();
288 else {
289 return false;
293 function iframetopardiv(string){
294 var name=string
295 document.getElementById('drug').value=name;
296 $("#hiddendiv").html( "&nbsp;" );
297 $('#hiddendiv').hide();
300 function iframetopardiv(string){
301 var name=string
302 document.getElementById('pharmacy').value=name;
303 $("#hiddendiv").html( "&nbsp;" );
304 $('#hiddendiv').hide();
307 function cancelParlookup () {
308 $('#hiddendiv').hide();
309 $("#hiddendiv").html( "&nbsp;" );
312 $().ready(function() {
313 $("#drug").autocomplete('library/ajax/prescription_drugname_lookup.php',
315 width: 200,
316 scrollHeight: 100,
317 selectFirst: true
319 $("#drug").focus();
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) {
327 drugname = "";
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;
333 return true;
337 // check the form for required fields before submitting
338 var CheckForErrors = function(eObj) {
339 // REQUIRED FIELDS
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) {
354 // for text boxes
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");
359 return false;
363 // for select boxes
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");
368 return false;
372 return true;
375 </script>
376 {/literal}
378 </html>