fixes to patient name escaping
[openemr.git] / templates / prescription / general_edit.html
blob351b0b2b4c41b61e5cc63d7b0c9f37cf0765be6e
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 {literal}
8 <style type="text/css">
9 .text {
10 font-size: 9pt;
12 </style>
13 {/literal}
14 <script language="Javascript">
15 {literal}
16 function my_process () {
17 // Pass the variable
18 opener.document.prescribe.drug.value = document.lookup.drug.value;
19 // Close the window
20 window.self.close();
22 {/literal}
23 </script>
24 {literal}
25 {/literal}
26 <!---Gen Look up-->
27 <script type="text/javascript" src="{$WEBROOT}/library/dialog.js"></script>
28 <script type="text/javascript" src="{php} echo $GLOBALS['assets_static_relative']; {/php}/jquery-min-1-2-2/index.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>
32 {literal}
33 <script language='JavaScript'>
35 // This holds all the default drug attributes.
36 {/literal}
37 var drugopts = [{$DRUG_ATTRIBUTES}];
38 {literal}
40 // Helper to choose an option from its value.
41 function selchoose(sel, value) {
42 var o = sel.options;
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;
52 if (i >= 0) {
53 var d = drugopts[i];
54 f.drug.value = d[0];
55 selchoose(f.form, d[1]);
56 f.dosage.value = d[2];
57 f.size.value = d[3];
58 f.rxnorm_drugcode.value = d[11];
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 class="body_top">
94 <form name="prescribe" id="prescribe" method="post" action="{$FORM_ACTION}">
95 <table>
96 <tr><td class="title"><font><b>{xl t='Add'}/{xl t='Edit'}</b></font>&nbsp;</td>
97 <td><a href=# onclick="submitfun();" class="css_button_small"><span>{xl t='Save'}</span></a>
98 {if $DRUG_ARRAY_VALUES}
99 &nbsp; &nbsp; &nbsp; &nbsp;
100 {if $prescription->get_refills() >= $prescription->get_dispensation_count()}
101 <input type="submit" name="disp_button" value="{xl t='Save and Dispense'}" />
102 <input type="text" name="disp_quantity" size="2" maxlength="10" value="{$DISP_QUANTITY}" />
103 units, $
104 <input type="text" name="disp_fee" size="5" maxlength="10" value="{$DISP_FEE}" />
105 {else}&nbsp;
106 {xl t='prescription has reached its limit of'} {$prescription->get_refills()} {xl t='refills'}.
107 {/if}
108 {/if}
109 <a class='css_button_small' href="controller.php?prescription&list&id={$prescription->patient->id}"><span>{xl t='Back'}</span></a>
110 </td></tr>
111 </table>
113 {php} if ($GLOBALS['enable_amc_prompting']) { {/php}
114 <div style='float:right;margin-right:25px;border-style:solid;border-width:1px;'>
115 <div style='float:left;margin:5px 5px 5px 5px;'>
116 {amcCollect amc_id='e_prescribe_amc' patient_id=$prescription->patient->id object_category='prescriptions' object_id=$prescription->id}
117 {if not $amcCollectReturn}
118 <input type="checkbox" id="escribe_flag" name="escribe_flag">
119 {else}
120 <input type="checkbox" id="escribe_flag" name="escribe_flag" checked>
121 {/if}
122 <span class="text">{xl t='E-Prescription?'}</span><br>
124 {amcCollect amc_id='e_prescribe_chk_formulary_amc' patient_id=$prescription->patient->id object_category='prescriptions' object_id=$prescription->id}
125 {if not $amcCollectReturn}
126 <input type="checkbox" id="checked_formulary_flag" name="checked_formulary_flag">
127 {else}
128 <input type="checkbox" id="checked_formulary_flag" name="checked_formulary_flag" checked>
129 {/if}
130 <span class="text">{xl t='Checked Drug Formulary?'}</span><br>
132 {amcCollect amc_id='e_prescribe_cont_subst_amc' patient_id=$prescription->patient->id object_category='prescriptions' object_id=$prescription->id}
133 {if not $amcCollectReturn}
134 <input type="checkbox" id="controlled_substance_flag" name="controlled_substance_flag">
135 {else}
136 <input type="checkbox" id="controlled_substance_flag" name="controlled_substance_flag" checked>
137 {/if}
138 <span class="text">{xl t='Controlled Substance?'}</span><br>
140 </div>
141 </div>
142 {php} } {/php}
144 <table CELLSPACING="0" CELLPADDING="3" BORDER="0">
145 <tr>
146 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Currently Active'}</td>
147 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
148 <input type="checkbox" name="active" value="1"{if $prescription->get_active() > 0} checked{/if} />
149 </td>
150 </tr>
151 <tr>
152 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Starting Date'}</td>
153 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
154 {html_select_date start_year="-10" end_year="+5" time=$prescription->start_date prefix="start_date_"}
155 </td>
156 </tr>
157 <tr>
158 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Provider'}</td>
159 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
160 {html_options name="provider_id" options=$prescription->provider->utility_provider_array() selected=$prescription->provider->get_id()}
161 <input type="hidden" name="patient_id" value="{$prescription->patient->id}" />
162 </td>
163 </tr>
164 <tr>
165 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Drug'}</td>
166 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
167 <input type="input" size="20" name="drug" id="drug" value="{$prescription->drug}"/>
168 <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;'">
169 ({xl t='click here to search'})</a>
170 <div id=hiddendiv style="display:none">&nbsp;</div>
171 </td>
172 </tr>
173 {if $DRUG_ARRAY_VALUES}
174 <tr>
175 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >&nbsp; {xl t='in-house'}</td>
176 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
177 <select name="drug_id" onchange="drugselected(this)">
178 {html_options values=$DRUG_ARRAY_VALUES output=$DRUG_ARRAY_OUTPUT selected=$prescription->get_drug_id()}
179 </select>
180 <input type="hidden" name="rxnorm_drugcode" value="{$prescription->rxnorm_drugcode}">
181 </td>
182 </tr>
183 {/if}
184 <tr>
185 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Quantity'}</td>
186 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
187 <input TYPE="TEXT" NAME="quantity" id="quantity" SIZE="10" MAXLENGTH="31"
188 VALUE="{$prescription->quantity}"
189 onchange="quantityChanged()" />
190 </td>
191 </tr>
192 {if $SIMPLIFIED_PRESCRIPTIONS && !$prescription->size}
193 <tr style='display:none;'>
194 {else}
195 <tr>
196 {/if}
197 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Medicine Units'}</td>
198 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
199 <input TYPE="TEXT" NAME="size" id="size" SIZE="20" MAXLENGTH="25" VALUE="{$prescription->size}"/>
200 <select name="unit" id="unit">{html_options options=$prescription->unit_array selected=$prescription->unit}</select>
201 </td>
202 </tr>
203 <tr>
204 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Take'}</td>
205 <td COLSPAN="2" class="text" ALIGN="LEFT" VALIGN="MIDDLE" >
206 {if $SIMPLIFIED_PRESCRIPTIONS && !$prescription->form && !$prescription->route && !$prescription->interval}
207 <input TYPE="text" NAME="dosage" id="dosage" SIZE="30" MAXLENGTH="100" VALUE="{$prescription->dosage}" />
208 <input type="hidden" name="form" id="form" value="0" />
209 <input type="hidden" name="route" id="route" value="0" />
210 <input type="hidden" name="interval" id="interval" value="0" />
211 {else}
212 <input TYPE="TEXT" NAME="dosage" id="dosage" SIZE="2" MAXLENGTH="10" VALUE="{$prescription->dosage}"/> {xl t='in'}
213 <select name="form" id="form">{html_options options=$prescription->form_array selected=$prescription->form}</select>
214 <select name="route" id="route">{html_options options=$prescription->route_array selected=$prescription->route}</select>
215 <select name="interval" id="interval">{html_options options=$prescription->interval_array selected=$prescription->interval}</select>
216 {/if}
217 </td>
218 </tr>
219 <tr>
220 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Refills'}</td>
221 <td COLSPAN="2" class="text" ALIGN="LEFT" VALIGN="MIDDLE" >
222 {html_options name="refills" options=$prescription->refills_array selected=$prescription->refills}
223 {if $SIMPLIFIED_PRESCRIPTIONS}
224 <input TYPE="hidden" ID="per_refill" NAME="per_refill" VALUE="{$prescription->per_refill}" />
225 {else}
226 &nbsp; &nbsp; # {xl t='of tablets'}:
227 <input TYPE="TEXT" ID="per_refill" NAME="per_refill" SIZE="2" MAXLENGTH="10" VALUE="{$prescription->per_refill}" />
228 {/if}
229 </td>
230 </tr>
231 <tr>
232 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Notes'}</td>
233 <td COLSPAN="2" class="text" ALIGN="LEFT" VALIGN="MIDDLE" >
234 <textarea name="note" cols="30" rows="2" wrap="virtual">{$prescription->note}</textarea>
235 </td>
236 </tr>
237 <tr>
238 {if $WEIGHT_LOSS_CLINIC}
239 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Substitution'}</td>
240 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
241 {html_options name="substitute" options=$prescription->substitute_array selected=$prescription->substitute}
242 </td>
243 {else}
244 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Add to Medication List'}</td>
245 <td COLSPAN="2" class="text" ALIGN="LEFT" VALIGN="MIDDLE" >
246 {html_radios name="medication" options=$prescription->medication_array selected=$prescription->medication}
247 &nbsp; &nbsp;
248 {html_options name="substitute" options=$prescription->substitute_array selected=$prescription->substitute}
249 </td>
250 {/if}
251 </tr>
252 </table>
253 <input type="hidden" name="id" value="{$prescription->id}" />
254 <input type="hidden" name="process" value="{$PROCESS}" />
255 <script language='JavaScript'>
256 {$ENDING_JAVASCRIPT}
257 </script>
258 </form>
259 {literal}
260 <!-- for the fancy jQuery stuff -->
261 <script type="text/javascript">
263 function submitfun() {
264 top.restoreSession();
265 if (CheckForErrors(this)) {
266 document.forms["prescribe"].submit();
268 else {
269 return false;
273 function iframetopardiv(string){
274 var name=string
275 document.getElementById('drug').value=name;
276 $("#hiddendiv").html( "&nbsp;" );
277 $('#hiddendiv').hide();
280 function cancelParlookup () {
281 $('#hiddendiv').hide();
282 $("#hiddendiv").html( "&nbsp;" );
285 $().ready(function() {
286 $("#drug").autocomplete('library/ajax/prescription_drugname_lookup.php',
288 width: 200,
289 scrollHeight: 100,
290 selectFirst: true
292 $("#drug").focus();
293 $("#prescribe").submit(function() { return CheckForErrors(this) });
294 $("#druglookup").click(function() { DoDrugLookup(this) });
298 // pop up a drug lookup window with the value of the drug name, if we have one
299 function DoDrugLookup(eObj) {
300 drugname = "";
301 if ($('#drug').val() != "") { drugname = $('#drug').val(); }
302 $("#druglist").css('display','block');
303 document.lookup.action='controller.php?prescription&edit&id=&pid={/literal}{$prescription->patient->id}{literal}&drug=sss'+drugname;
304 drugPopup = window.open('controller.php?prescription&lookup&drug='+drugname, 'drugPopup', 'width=400,height=50,menubar=no,titlebar=no,left = 825,top = 400');
305 drugPopup.opener = self;
306 return true;
310 // check the form for required fields before submitting
311 var CheckForErrors = function(eObj) {
312 // REQUIRED FIELDS
313 if (CheckRequired('drug') == false) { return false; }
314 //if (CheckRequired('quantity') == false) { return false; }
315 //if (CheckRequired('unit') == false) { return false; }
316 //if (CheckRequired('size') == false) { return false; }
317 //if (CheckRequired('dosage') == false) { return false; }
318 //if (CheckRequired('form') == false) { return false; }
319 //if (CheckRequired('route') == false) { return false; }
320 //if (CheckRequired('interval') == false) { return false; }
322 return top.restoreSession();
325 function CheckRequired(objID) {
327 // for text boxes
328 if ($('#'+objID).is('input')) {
329 if ($('#'+objID).val() == "") {
330 alert("{/literal}{xl t='Missing a required field'}{literal}");
331 $('#'+objID).css("backgroundColor", "pink");
332 return false;
336 // for select boxes
337 if ($('#'+objID).is('select')) {
338 if ($('#'+objID).val() == "0") {
339 alert("{/literal}{xl t='Missing a required field'}{literal}");
340 $('#'+objID).css("backgroundColor", "pink");
341 return false;
345 return true;
348 </script>
349 {/literal}
351 </html>