added id so can select element (#1769)
[openemr.git] / templates / prescription / general_edit.html
blobd5b181bc1a6d696aad60f5e8d1cc18346e93ff9d
1 {**
2 * Prescription edit
4 * @package OpenEMR
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
9 *}
10 <!DOCTYPE html>
11 <html>
12 <head>
14 {headerTemplate assets='jquery-ui|jquery-ui-base'}
16 {literal}
17 <style type="text/css">
20 input{
21 margin: 5px;
23 select{
24 margin: 5px;
26 </style>
27 {/literal}
28 <script language="Javascript">
30 {literal}
31 function my_process () {
32 // Pass the variable
33 opener.document.prescribe.drug.value = document.lookup.drug.value;
34 // Close the window
35 window.self.close();
37 {/literal}
38 </script>
39 <!---Gen Look up-->
40 {literal}
41 <script language='JavaScript'>
43 // This holds all the default drug attributes.
44 // This was html escaped previously
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 id="prescription_edit" 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'|escape:'html'}/{xl t='Edit'|escape:'html'}</b></font>&nbsp;</td>
106 <td><a href=# onclick="submitfun();" class="css_button_small"><span>{xl t='Save'|escape:'html'}</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"class='css_button_small' style="margin:0 5px 0 2px;" value="{xl t='Save and Dispense'|escape:'html'}" />
111 <input class="input-sm" type="text" name="disp_quantity" size="2" maxlength="10" value="{$DISP_QUANTITY|escape:'html'}" />
112 units, $
113 <input class="input-sm" type="text" name="disp_fee" size="5" maxlength="10" value="{$DISP_FEE|escape:'html'}" />
114 {else}&nbsp;
115 {xl t='prescription has reached its limit of'|escape:'html'} {$prescription->get_refills()|escape:'html'} {xl t='refills'|escape:'html'}.
116 {/if}
117 {/if}
118 <a class='css_button_small' href="controller.php?prescription&list&id={$prescription->patient->id|escape:'html'}"><span>{xl t='Back'|escape:'html'}</span></a>
119 </td></tr>
120 </table>
122 {if $GLOBALS.enable_amc_prompting}
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?'|escape:'html'}</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?'|escape:'html'}</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?'|escape:'html'}</span><br>
149 </div>
150 </div>
151 {/if}
153 <table CELLSPACING="0" CELLPADDING="3" BORDER="0">
154 <tr>
155 <td COLSPAN="1" class="text input-sm" ALIGN="right" VALIGN="MIDDLE" >{xl t='Currently Active'|escape:'html'}</td>
156 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
157 <input class="input-sm"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'|escape:'html'}</td>
162 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
163 {html_select_date class="input-sm" start_year="-10" end_year="+5" time=$prescription->start_date prefix="start_date_"}
164 <input type="hidden" name="start_date" value="{$prescription->start_date|escape:'html'}">
165 </td>
166 </tr>
167 <tr>
168 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Provider'|escape:'html'}</td>
169 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
170 {html_options class="input-sm" 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|escape:'html'}" />
172 </td>
173 </tr>
175 <tr>
176 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Drug'|escape:'html'}</td>
177 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
178 <input class="input-sm" type="input" size="35" name="drug" id="drug" value="{$prescription->drug|escape:'html'}"/>
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;75&quot; scrolling=&quot;no&quot; frameborder=&quot;no&quot;&gt;&lt;/iframe&gt;'">
180 ({xl t='click here to search'|escape:'html'})</a>
181 <div class="well well-sm" 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'|escape:'html'}</td>
187 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
188 <select class="input-sm" 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|escape:'html'}">
192 </td>
193 </tr>
194 {/if}
195 <tr>
196 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Quantity'|escape:'html'}</td>
197 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
198 <input class="input-sm" TYPE="TEXT" NAME="quantity" id="quantity" SIZE="10" MAXLENGTH="31"
199 VALUE="{$prescription->quantity|escape:'html'}"
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'|escape:'html'}</td>
209 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
210 <input class="input-sm" TYPE="TEXT" NAME="size" id="size" SIZE="11" MAXLENGTH="10" VALUE="{$prescription->size|escape:'html'}"/>
211 <select class="input-sm" 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'|escape:'html'}</td>
216 <td COLSPAN="2" class="text" ALIGN="LEFT" VALIGN="MIDDLE" >
217 {if $SIMPLIFIED_PRESCRIPTIONS && !$prescription->form && !$prescription->route && !$prescription->interval}
218 <input class="input-sm" TYPE="text" NAME="dosage" id="dosage" SIZE="30" MAXLENGTH="100" VALUE="{$prescription->dosage|escape:'html'}" />
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 class="input-sm" TYPE="TEXT" NAME="dosage" id="dosage" SIZE="2" MAXLENGTH="10" VALUE="{$prescription->dosage|escape:'html'}"/> {xl t='in'|escape:'html'}
224 <select class="input-sm" name="form" id="form">{html_options options=$prescription->form_array selected=$prescription->form}</select>
225 <select class="input-sm" name="route" id="route">{html_options options=$prescription->route_array selected=$prescription->route}</select>
226 <select class="input-sm" 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'|escape:'html'}</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|escape:'html'}" />
236 {else}
237 &nbsp; &nbsp; # {xl t='of tablets'}:
238 <input class="input-sm" TYPE="TEXT" ID="per_refill" NAME="per_refill" SIZE="2" MAXLENGTH="10" VALUE="{$prescription->per_refill|escape:'html'}" />
239 {/if}
240 </td>
241 </tr>
242 <tr>
243 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Notes'|escape:'html'}</td>
244 <td COLSPAN="2" class="text" ALIGN="LEFT" VALIGN="MIDDLE" >
245 <textarea class="form-control" name="note" cols="30" rows="1" wrap="virtual">{$prescription->note|escape:'html'}</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'|escape:'html'}</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 input-sm" ALIGN="right" VALIGN="MIDDLE" >{xl t='Add to Medication List'|escape:'html'}</td>
256 <td COLSPAN="2" class="text input-sm" ALIGN="LEFT" VALIGN="MIDDLE" >
257 {html_radios class="input-sm" name="medication" options=$prescription->medication_array selected=$prescription->medication}
258 &nbsp; &nbsp;
259 {html_options class="input-sm" 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|escape:'html'}" />
265 <input type="hidden" name="process" value="{$PROCESS|escape:'html'}" />
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 submitfun() {
276 top.restoreSession();
277 if (CheckForErrors(this)) {
278 document.forms["prescribe"].submit();
280 else {
281 return false;
285 function iframetopardiv(string){
286 var name=string
287 document.getElementById('drug').value=name;
288 $("#hiddendiv").html( "&nbsp;" );
289 $('#hiddendiv').hide();
292 function cancelParlookup () {
293 $('#hiddendiv').hide();
294 $("#hiddendiv").html( "&nbsp;" );
297 $().ready(function() {
299 {/literal}
300 {if $GLOBALS.weno_rx_enable}
301 {literal}
302 $('#drug').autocomplete({
303 source: 'library/ajax/drug_autocomplete/search.php',
304 minLength: 3
306 {/literal}
307 {else}
308 {literal}
309 $('#drug').autocomplete({
310 source: 'library/ajax/prescription_drugname_lookup.php',
311 minLength: 1
313 {/literal}
314 {/if}
315 {literal}
317 $("#drug").focus();
318 $("#prescribe").submit(function() { return CheckForErrors(this) });
321 // check the form for required fields before submitting
322 var CheckForErrors = function(eObj) {
323 // REQUIRED FIELDS
324 if (CheckRequired('drug') == false) { return false; }
325 if (CheckRequired('quantity') == false) { return false; }
326 //if (CheckRequired('unit') == false) { return false; }
327 //if (CheckRequired('size') == false) { return false; }
328 if (CheckRequired('dosage') == false) { return false; }
329 //if (CheckRequired('form') == false) { return false; }
330 //if (CheckRequired('route') == false) { return false; }
331 //if (CheckRequired('interval') == false) { return false; }
333 return top.restoreSession();
336 function CheckRequired(objID) {
338 // for text boxes
339 if ($('#'+objID).is('input')) {
340 if ($('#'+objID).val() == "") {
341 alert("{/literal}{xl t='Missing a required field and will be highlighted'}{literal}");
342 $('#'+objID).css("backgroundColor", "pink");
343 return false;
347 // for select boxes
348 if ($('#'+objID).is('select')) {
349 if ($('#'+objID).val() == "0") {
350 alert("{/literal}{xl t='Missing a required field'}{literal}");
351 $('#'+objID).css("backgroundColor", "pink");
352 return false;
356 return true;
359 </script>
360 {/literal}
362 </html>