PageRenderTime 54ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/templates/prescription/general_edit.html

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