Document module improvements, take 3.
[openemr.git] / templates / prescription / general_edit.html
blob3e969b62181a5e3408e57a3ba715d10884c02524
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="{$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>
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 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.
70 function dispense() {
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,
77 '_blank', 400, 200);
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;
88 </script>
89 {/literal}
90 </head>
91 <body class="body_top">
93 <form name="prescribe" id="prescribe" method="post" action="{$FORM_ACTION}">
94 <table>
95 <tr><td class="title"><font><b>{xl t='Add'}/{xl t='Edit'}</b></font>&nbsp;</td>
96 <td><a href=# onclick="submitfun();" class="css_button_small"><span>{xl t='Save'}</span></a>
97 {if $DRUG_ARRAY_VALUES}
98 &nbsp; &nbsp; &nbsp; &nbsp;
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}" />
102 units, $
103 <input type="text" name="disp_fee" size="5" maxlength="10" value="{$DISP_FEE}" />
104 {else}&nbsp;
105 {xl t='prescription has reached its limit of'} {$prescription->get_refills()} {xl t='refills'}.
106 {/if}
107 {/if}
108 <a class='css_button_small' href="controller.php?prescription&list&id={$prescription->patient->id}"><span>{xl t='Back'}</span></a>
109 </td></tr>
110 </table>
112 {php} if ($GLOBALS['enable_amc_prompting']) { {/php}
113 <div style='float:right;margin-right:25px;border-style:solid;border-width:1px;'>
114 <div style='float:left;margin:5px 5px 5px 5px;'>
115 {amcCollect amc_id='e_prescribe_amc' patient_id=$prescription->patient->id object_category='prescriptions' object_id=$prescription->id}
116 {if not $amcCollectReturn}
117 <input type="checkbox" id="escribe_flag" name="escribe_flag">
118 {else}
119 <input type="checkbox" id="escribe_flag" name="escribe_flag" checked>
120 {/if}
121 <span class="text">{xl t='E-Prescription?'}</span><br>
122 </div>
123 </div>
124 {php} } {/php}
126 <table CELLSPACING="0" CELLPADDING="3" BORDER="0">
127 <tr>
128 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Currently Active'}</td>
129 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
130 <input type="checkbox" name="active" value="1"{if $prescription->get_active() > 0} checked{/if} />
131 </td>
132 </tr>
133 <tr>
134 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Starting Date'}</td>
135 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
136 {html_select_date start_year="-10" end_year="+5" time=$prescription->start_date prefix="start_date_"}
137 </td>
138 </tr>
139 <tr>
140 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Provider'}</td>
141 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
142 {html_options name="provider_id" options=$prescription->provider->utility_provider_array() selected=$prescription->provider->get_id()}
143 <input type="hidden" name="patient_id" value="{$prescription->patient->id}" />
144 </td>
145 </tr>
146 <tr>
147 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Drug'}</td>
148 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
149 <input type="input" size="20" name="drug" id="drug" value="{$prescription->drug}"/>
150 <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;'">
151 ({xl t='click here to search'})</a>
152 <div id=hiddendiv style="display:none">&nbsp;</div>
153 </td>
154 </tr>
155 {if $DRUG_ARRAY_VALUES}
156 <tr>
157 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >&nbsp; {xl t='in-house'}</td>
158 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
159 <select name="drug_id" onchange="drugselected(this)">
160 {html_options values=$DRUG_ARRAY_VALUES output=$DRUG_ARRAY_OUTPUT selected=$prescription->get_drug_id()}
161 </select>
162 </td>
163 </tr>
164 {/if}
165 <tr>
166 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Quantity'}</td>
167 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
168 <input TYPE="TEXT" NAME="quantity" id="quantity" SIZE="10" MAXLENGTH="31"
169 VALUE="{$prescription->quantity}"
170 onchange="quantityChanged()" />
171 </td>
172 </tr>
173 {if $SIMPLIFIED_PRESCRIPTIONS && !$prescription->size}
174 <tr style='display:none;'>
175 {else}
176 <tr>
177 {/if}
178 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Medicine Units'}</td>
179 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
180 <input TYPE="TEXT" NAME="size" id="size" SIZE="11" MAXLENGTH="10" VALUE="{$prescription->size}"/>
181 <select name="unit" id="unit">{html_options options=$prescription->unit_array selected=$prescription->unit}</select>
182 </td>
183 </tr>
184 <tr>
185 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Take'}</td>
186 <td COLSPAN="2" class="text" ALIGN="LEFT" VALIGN="MIDDLE" >
187 {if $SIMPLIFIED_PRESCRIPTIONS && !$prescription->form && !$prescription->route && !$prescription->interval}
188 <input TYPE="text" NAME="dosage" id="dosage" SIZE="30" MAXLENGTH="100" VALUE="{$prescription->dosage}" />
189 <input type="hidden" name="form" id="form" value="0" />
190 <input type="hidden" name="route" id="route" value="0" />
191 <input type="hidden" name="interval" id="interval" value="0" />
192 {else}
193 <input TYPE="TEXT" NAME="dosage" id="dosage" SIZE="2" MAXLENGTH="10" VALUE="{$prescription->dosage}"/> {xl t='in'}
194 <select name="form" id="form">{html_options options=$prescription->form_array selected=$prescription->form}</select>
195 <select name="route" id="route">{html_options options=$prescription->route_array selected=$prescription->route}</select>
196 <select name="interval" id="interval">{html_options options=$prescription->interval_array selected=$prescription->interval}</select>
197 {/if}
198 </td>
199 </tr>
200 <tr>
201 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Refills'}</td>
202 <td COLSPAN="2" class="text" ALIGN="LEFT" VALIGN="MIDDLE" >
203 {html_options name="refills" options=$prescription->refills_array selected=$prescription->refills}
204 {if $SIMPLIFIED_PRESCRIPTIONS}
205 <input TYPE="hidden" ID="per_refill" NAME="per_refill" VALUE="{$prescription->per_refill}" />
206 {else}
207 &nbsp; &nbsp; # {xl t='of tablets'}:
208 <input TYPE="TEXT" ID="per_refill" NAME="per_refill" SIZE="2" MAXLENGTH="10" VALUE="{$prescription->per_refill}" />
209 {/if}
210 </td>
211 </tr>
212 <tr>
213 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Notes'}</td>
214 <td COLSPAN="2" class="text" ALIGN="LEFT" VALIGN="MIDDLE" >
215 <textarea name="note" cols="30" rows="2" wrap="virtual">{$prescription->note}</textarea>
216 </td>
217 </tr>
218 <tr>
219 {if $WEIGHT_LOSS_CLINIC}
220 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Substitution'}</td>
221 <td COLSPAN="2" ALIGN="LEFT" VALIGN="MIDDLE" >
222 {html_options name="substitute" options=$prescription->substitute_array selected=$prescription->substitute}
223 </td>
224 {else}
225 <td COLSPAN="1" class="text" ALIGN="right" VALIGN="MIDDLE" >{xl t='Add to Medication List'}</td>
226 <td COLSPAN="2" class="text" ALIGN="LEFT" VALIGN="MIDDLE" >
227 {html_radios name="medication" options=$prescription->medication_array selected=$prescription->medication}
228 &nbsp; &nbsp;
229 {html_options name="substitute" options=$prescription->substitute_array selected=$prescription->substitute}
230 </td>
231 {/if}
232 </tr>
233 </table>
234 <input type="hidden" name="id" value="{$prescription->id}" />
235 <input type="hidden" name="process" value="{$PROCESS}" />
236 <script language='JavaScript'>
237 {$ENDING_JAVASCRIPT}
238 </script>
239 </form>
240 {literal}
241 <!-- for the fancy jQuery stuff -->
242 <script type="text/javascript">
244 function submitfun() {
245 top.restoreSession();
246 if (CheckForErrors(this)) {
247 document.forms["prescribe"].submit();
249 else {
250 return false;
254 function iframetopardiv(string){
255 var name=string
256 document.getElementById('drug').value=name;
257 $("#hiddendiv").html( "&nbsp;" );
258 $('#hiddendiv').hide();
261 function cancelParlookup () {
262 $('#hiddendiv').hide();
263 $("#hiddendiv").html( "&nbsp;" );
266 $().ready(function() {
267 $("#drug").autocomplete('library/ajax/prescription_drugname_lookup.php',
269 width: 200,
270 scrollHeight: 100,
271 selectFirst: true
273 $("#drug").focus();
274 $("#prescribe").submit(function() { return CheckForErrors(this) });
275 $("#druglookup").click(function() { DoDrugLookup(this) });
279 // pop up a drug lookup window with the value of the drug name, if we have one
280 function DoDrugLookup(eObj) {
281 drugname = "";
282 if ($('#drug').val() != "") { drugname = $('#drug').val(); }
283 $("#druglist").css('display','block');
284 document.lookup.action='controller.php?prescription&edit&id=&pid={/literal}{$prescription->patient->id}{literal}&drug=sss'+drugname;
285 drugPopup = window.open('controller.php?prescription&lookup&drug='+drugname, 'drugPopup', 'width=400,height=50,menubar=no,titlebar=no,left = 825,top = 400');
286 drugPopup.opener = self;
287 return true;
291 // check the form for required fields before submitting
292 var CheckForErrors = function(eObj) {
293 // REQUIRED FIELDS
294 if (CheckRequired('drug') == false) { return false; }
295 //if (CheckRequired('quantity') == false) { return false; }
296 //if (CheckRequired('unit') == false) { return false; }
297 //if (CheckRequired('size') == false) { return false; }
298 //if (CheckRequired('dosage') == false) { return false; }
299 //if (CheckRequired('form') == false) { return false; }
300 //if (CheckRequired('route') == false) { return false; }
301 //if (CheckRequired('interval') == false) { return false; }
303 return top.restoreSession();
306 function CheckRequired(objID) {
308 // for text boxes
309 if ($('#'+objID).is('input')) {
310 if ($('#'+objID).val() == "") {
311 alert("{/literal}{xl t='Missing a required field'}{literal}");
312 $('#'+objID).css("backgroundColor", "pink");
313 return false;
317 // for select boxes
318 if ($('#'+objID).is('select')) {
319 if ($('#'+objID).val() == "0") {
320 alert("{/literal}{xl t='Missing a required field'}{literal}");
321 $('#'+objID).css("backgroundColor", "pink");
322 return false;
326 return true;
329 </script>
330 {/literal}
332 </html>