PageRenderTime 59ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/interface/usergroup/facilities_add.php

https://github.com/md-tech/openemr
PHP | 268 lines | 239 code | 23 blank | 6 comment | 42 complexity | 839db1001e4b1f00862194747da2bccd MD5 | raw file
  1. <?php
  2. require_once("../globals.php");
  3. require_once("../../library/acl.inc");
  4. require_once("$srcdir/sql.inc");
  5. require_once("$srcdir/formdata.inc.php");
  6. require_once("$srcdir/classes/POSRef.class.php");
  7. require_once("$srcdir/options.inc.php");
  8. require_once("$srcdir/erx_javascript.inc.php");
  9. $alertmsg = '';
  10. ?>
  11. <html>
  12. <head>
  13. <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
  14. <link rel="stylesheet" type="text/css" href="<?php echo $GLOBALS['webroot'] ?>/library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
  15. <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js"></script>
  16. <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.1.3.2.js"></script>
  17. <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/common.js"></script>
  18. <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
  19. <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery-ui.js"></script>
  20. <script type="text/javascript" src="../main/calendar/modules/PostCalendar/pnincludes/AnchorPosition.js"></script>
  21. <script type="text/javascript" src="../main/calendar/modules/PostCalendar/pnincludes/PopupWindow.js"></script>
  22. <script type="text/javascript" src="../main/calendar/modules/PostCalendar/pnincludes/ColorPicker2.js"></script>
  23. <?php
  24. // Old Browser comp trigger on js
  25. if (isset($_POST["mode"]) && $_POST["mode"] == "facility") {
  26. echo '
  27. <script type="text/javascript">
  28. <!--
  29. parent.$.fn.fancybox.close();
  30. //-->
  31. </script>
  32. ';
  33. }
  34. ?>
  35. <script type="text/javascript">
  36. /// todo, move this to a common library
  37. function submitform() {
  38. <?php if($GLOBALS['erx_enable']){ ?>
  39. alertMsg='';
  40. f=document.forms[0];
  41. for(i=0;i<f.length;i++){
  42. if(f[i].type=='text' && f[i].value)
  43. {
  44. if(f[i].name == 'facility' || f[i].name == 'Washington')
  45. {
  46. alertMsg += checkLength(f[i].name,f[i].value,35);
  47. alertMsg += checkSpecialCharacter(f[i].name,f[i].value);
  48. }
  49. else if(f[i].name == 'street')
  50. {
  51. alertMsg += checkLength(f[i].name,f[i].value,35);
  52. alertMsg += checkAlphaNumeric(f[i].name,f[i].value);
  53. }
  54. else if(f[i].name == 'phone' || f[i].name == 'fax')
  55. {
  56. alertMsg += checkPhone(f[i].name,f[i].value);
  57. }
  58. else if(f[i].name == 'federal_ein')
  59. {
  60. alertMsg += checkLength(f[i].name,f[i].value,10);
  61. alertMsg += checkTaxNpiDea(f[i].name,f[i].value);
  62. }
  63. }
  64. }
  65. if(alertMsg)
  66. {
  67. alert(alertMsg);
  68. return false;
  69. }
  70. <?php } ?>
  71. if (document.forms[0].facility.value.length>0 && document.forms[0].ncolor.value != '') {
  72. top.restoreSession();
  73. document.forms[0].submit();
  74. } else {
  75. if(document.forms[0].facility.value.length<=0){
  76. document.forms[0].facility.style.backgroundColor="red";
  77. document.forms[0].facility.focus();
  78. }
  79. else if(document.forms[0].ncolor.value == ''){
  80. document.forms[0].ncolor.style.backgroundColor="red";
  81. document.forms[0].ncolor.focus();
  82. }
  83. }
  84. }
  85. function toggle( target, div ) {
  86. $mode = $(target).find(".indicator").text();
  87. if ( $mode == "collapse" ) {
  88. $(target).find(".indicator").text( "expand" );
  89. $(div).hide();
  90. } else {
  91. $(target).find(".indicator").text( "collapse" );
  92. $(div).show();
  93. }
  94. }
  95. $(document).ready(function(){
  96. $("#dem_view").click( function() {
  97. toggle( $(this), "#DEM" );
  98. });
  99. // fancy box
  100. enable_modals();
  101. tabbify();
  102. // special size for
  103. $(".large_modal").fancybox( {
  104. 'overlayOpacity' : 0.0,
  105. 'showCloseButton' : true,
  106. 'frameHeight' : 600,
  107. 'frameWidth' : 1000
  108. });
  109. // special size for
  110. $(".medium_modal").fancybox( {
  111. 'overlayOpacity' : 0.0,
  112. 'showCloseButton' : true,
  113. 'frameHeight' : 260,
  114. 'frameWidth' : 510
  115. });
  116. });
  117. $(document).ready(function(){
  118. $("#cancel").click(function() {
  119. parent.$.fn.fancybox.close();
  120. });
  121. });
  122. var cp = new ColorPicker('window');
  123. // Runs when a color is clicked
  124. function pickColor(color) {
  125. document.getElementById('ncolor').value = color;
  126. }
  127. var field;
  128. function pick(anchorname,target) {
  129. var cp = new ColorPicker('window');
  130. field=target;
  131. cp.show(anchorname);
  132. }
  133. function displayAlert()
  134. {
  135. if(document.getElementById('primary_business_entity').checked==false)
  136. alert("<?php echo addslashes(xl('Primary Business Entity tax id is used as account id for NewCrop ePrescription. Changing the facility will affect the working in NewCrop.'));?>");
  137. else if(document.getElementById('primary_business_entity').checked==true)
  138. alert("<?php echo addslashes(xl('Once the Primary Business Facility is set, it should not be changed. Changing the facility will affect the working in NewCrop ePrescription.'));?>");
  139. }
  140. </script>
  141. <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
  142. </head>
  143. <body class="body_top">
  144. <table>
  145. <tr><td>
  146. <span class="title"><?php xl('Add Facility','e'); ?></span>&nbsp;&nbsp;&nbsp;</td>
  147. <td colspan=5 align=center style="padding-left:2px;">
  148. <a onclick="submitform();" class="css_button large_button" name='form_save' id='form_save' href='#'>
  149. <span class='css_button_span large_button_span'><?php xl('Save','e');?></span>
  150. </a>
  151. <a class="css_button large_button" id='cancel' href='#' >
  152. <span class='css_button_span large_button_span'><?php xl('Cancel','e');?></span>
  153. </a>
  154. </td></tr>
  155. </table>
  156. <br>
  157. <form name='facility' method='post' action="facilities.php" target='_parent'>
  158. <input type=hidden name=mode value="facility">
  159. <table border=0 cellpadding=0 cellspacing=0>
  160. <tr>
  161. <td><span class="text"><?php xl('Name','e'); ?>: </span></td><td><input type=entry name=facility size=20 value=""><span class="mandatory">&nbsp;*</span></td>
  162. <td width=20>&nbsp;</td>
  163. <td><span class="text"><?php xl('Phone','e'); ?>: </span></td><td><input type=entry name=phone size=20 value=""></td>
  164. </tr>
  165. <tr>
  166. <td><span class="text"><?php xl('Address','e'); ?>: </span></td><td><input type=entry size=20 name=street value=""></td>
  167. <td>&nbsp;</td>
  168. <td><span class="text"><?php xl('Fax','e'); ?>: </span></td><td><input type=entry name=fax size=20 value=""></td>
  169. </tr>
  170. <tr>
  171. <td><span class="text"><?php xl('City','e'); ?>: </span></td><td><input type=entry size=20 name=city value=""></td>
  172. <td>&nbsp;</td>
  173. <td><span class="text"><?php xl('Zip Code','e'); ?>: </span></td><td><input type=entry size=20 name=postal_code value=""></td>
  174. </tr>
  175. <tr>
  176. <td><span class="text"><?php xl('State','e'); ?>: </span></td><td><input type=entry size=20 name=state value=""></td>
  177. <td>&nbsp;</td>
  178. <td><span class="text"><?php xl('Tax ID','e'); ?>: </span></td><td><select name=tax_id_type><option value="EI"><?php xl('EIN','e'); ?></option><option value="SY"><?php xl('SSN','e'); ?></option></select><input type=entry size=11 name=federal_ein value=""></td>
  179. </tr>
  180. <tr>
  181. <td height="22"><span class="text"><?php xl('Country','e'); ?>: </span></td><td><input type=entry size=20 name=country_code value=""></td>
  182. <td>&nbsp;</td>
  183. <td><span class="text"><?php ($GLOBALS['simplified_demographics'] ? xl('Facility Code','e') : xl('Facility NPI','e')); ?>:
  184. </span></td><td><input type=entry size=20 name=facility_npi value=""></td>
  185. </tr>
  186. <tr>
  187. <td><span class='text'><?php xl('Billing Location','e'); ?>: </span></td><td><input type='checkbox' name='billing_location' value = '1'></td>
  188. <td>&nbsp;</td>
  189. <td><span class='text'><?php xl('Accepts Assignment','e'); ?><br>(<?php xl('only if billing location','e'); ?>): </span></td> <td><input type='checkbox' name='accepts_assignment' value = '1'></td>
  190. </tr>
  191. <tr>
  192. <td><span class='text'><?php xl('Service Location','e'); ?>: </span></td> <td><input type='checkbox' name='service_location' value = '1'></td>
  193. <td>&nbsp;</td>
  194. <td><span class='text'><?php echo htmlspecialchars(xl('Color'),ENT_QUOTES); ?>: </span><span class="mandatory">&nbsp;*</span></td> <td><input type=entry name=ncolor id=ncolor size=20 value="">[<a href="javascript:void(0);" onClick="pick('pick','newcolor');return false;" NAME="pick" ID="pick"><?php echo htmlspecialchars(xl('Pick'),ENT_QUOTES); ?></a>]</td>
  195. </tr>
  196. <?php
  197. $disabled='';
  198. $resPBE=sqlStatement("select * from facility where primary_business_entity='1' and id!='".$my_fid."'");
  199. if(sqlNumRows($resPBE)>0)
  200. $disabled='disabled';
  201. ?>
  202. <tr>
  203. <td><span class='text'><?php xl('Primary Business Entity','e'); ?>: </span></td>
  204. <td><input type='checkbox' name='primary_business_entity' id='primary_business_entity' value='1' <?php if ($facility['primary_business_entity'] == 1) echo 'checked'; ?> <?php if($GLOBALS['erx_enable']){ ?> onchange='return displayAlert()' <?php } ?> <?php echo $disabled;?>></td>
  205. <td>&nbsp;</td>
  206. </tr>
  207. <tr>
  208. <td><span class=text><?php xl('POS Code','e'); ?>: </span></td>
  209. <td colspan="6">
  210. <select name="pos_code">
  211. <?php
  212. $pc = new POSRef();
  213. foreach ($pc->get_pos_ref() as $pos) {
  214. echo "<option value=\"" . $pos["code"] . "\" ";
  215. echo ">" . $pos['code'] . ": ". $pos['title'];
  216. echo "</option>\n";
  217. }
  218. ?>
  219. </select>
  220. </td>
  221. </tr>
  222. <tr>
  223. <td><span class="text"><?php xl('Billing Attn','e'); ?>:</span></td>
  224. <td colspan="4"><input type="text" name="attn" size="45"></td>
  225. </tr>
  226. <tr>
  227. <td><span class="text"><?php xl('CLIA Number','e'); ?>:</span></td>
  228. <td colspan="4"><input type="text" name="domain_identifier" size="45"></td>
  229. </tr>
  230. <tr height="25" style="valign:bottom;">
  231. <td><font class="mandatory">*</font><span class="text"> <?php echo xl('Required','e'); ?></span></td><td>&nbsp;</td><td>&nbsp;</td>
  232. <td>&nbsp;</td><td>&nbsp;</td>
  233. </tr>
  234. </table>
  235. </form>
  236. <script language="JavaScript">
  237. <?php
  238. if ($alertmsg = trim($alertmsg)) {
  239. echo "alert('$alertmsg');\n";
  240. }
  241. ?>
  242. </script>
  243. </body>
  244. </html>