Committed football_injury_report.php for bug where Warning message is displayed when...
[openemr.git] / interface / usergroup / facilities_add.php
blobccf430bfd9d4fe095a1eb6ad28a692d9770b4e5c
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");
10 $alertmsg = '';
12 <html>
13 <head>
14 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
15 <link rel="stylesheet" type="text/css" href="<?php echo $GLOBALS['webroot'] ?>/library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
16 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js"></script>
17 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.1.3.2.js"></script>
18 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/common.js"></script>
19 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
20 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery-ui.js"></script>
21 <script type="text/javascript" src="../main/calendar/modules/PostCalendar/pnincludes/AnchorPosition.js"></script>
22 <script type="text/javascript" src="../main/calendar/modules/PostCalendar/pnincludes/PopupWindow.js"></script>
23 <script type="text/javascript" src="../main/calendar/modules/PostCalendar/pnincludes/ColorPicker2.js"></script>
24 <?php
25 // Old Browser comp trigger on js
27 if (isset($_POST["mode"]) && $_POST["mode"] == "facility") {
28 echo '
29 <script type="text/javascript">
30 <!--
31 parent.$.fn.fancybox.close();
32 //-->
33 </script>
38 <script type="text/javascript">
39 /// todo, move this to a common library
41 function submitform() {
42 <?php if($GLOBALS['erx_enable']){ ?>
43 alertMsg='';
44 f=document.forms[0];
45 for(i=0;i<f.length;i++){
46 if(f[i].type=='text' && f[i].value)
48 if(f[i].name == 'facility' || f[i].name == 'Washington')
50 alertMsg += checkLength(f[i].name,f[i].value,35);
51 alertMsg += checkSpecialCharacter(f[i].name,f[i].value);
53 else if(f[i].name == 'street')
55 alertMsg += checkLength(f[i].name,f[i].value,35);
56 alertMsg += checkAlphaNumeric(f[i].name,f[i].value);
58 else if(f[i].name == 'phone' || f[i].name == 'fax')
60 alertMsg += checkPhone(f[i].name,f[i].value);
62 else if(f[i].name == 'federal_ein')
64 alertMsg += checkLength(f[i].name,f[i].value,10);
65 alertMsg += checkTaxNpiDea(f[i].name,f[i].value);
69 if(alertMsg)
71 alert(alertMsg);
72 return false;
74 <?php } ?>
75 if (document.forms[0].facility.value.length>0 && document.forms[0].ncolor.value != '') {
76 top.restoreSession();
77 document.forms[0].submit();
78 } else {
79 if(document.forms[0].facility.value.length<=0){
80 document.forms[0].facility.style.backgroundColor="red";
81 document.forms[0].facility.focus();
83 else if(document.forms[0].ncolor.value == ''){
84 document.forms[0].ncolor.style.backgroundColor="red";
85 document.forms[0].ncolor.focus();
90 function toggle( target, div ) {
92 $mode = $(target).find(".indicator").text();
93 if ( $mode == "collapse" ) {
94 $(target).find(".indicator").text( "expand" );
95 $(div).hide();
96 } else {
97 $(target).find(".indicator").text( "collapse" );
98 $(div).show();
103 $(document).ready(function(){
105 $("#dem_view").click( function() {
106 toggle( $(this), "#DEM" );
109 // fancy box
110 enable_modals();
112 tabbify();
114 // special size for
115 $(".large_modal").fancybox( {
116 'overlayOpacity' : 0.0,
117 'showCloseButton' : true,
118 'frameHeight' : 600,
119 'frameWidth' : 1000
122 // special size for
123 $(".medium_modal").fancybox( {
124 'overlayOpacity' : 0.0,
125 'showCloseButton' : true,
126 'frameHeight' : 260,
127 'frameWidth' : 510
132 $(document).ready(function(){
133 $("#cancel").click(function() {
134 parent.$.fn.fancybox.close();
137 var cp = new ColorPicker('window');
138 // Runs when a color is clicked
139 function pickColor(color) {
140 document.getElementById('ncolor').value = color;
142 var field;
143 function pick(anchorname,target) {
144 var cp = new ColorPicker('window');
145 field=target;
146 cp.show(anchorname);
148 function displayAlert()
150 if(document.getElementById('primary_business_entity').checked==false)
151 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.'));?>");
152 else if(document.getElementById('primary_business_entity').checked==true)
153 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.'));?>");
155 </script>
156 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
158 </head>
159 <body class="body_top">
160 <table>
161 <tr><td>
162 <span class="title"><?php xl('Add Facility','e'); ?></span>&nbsp;&nbsp;&nbsp;</td>
163 <td colspan=5 align=center style="padding-left:2px;">
164 <a onclick="submitform();" class="css_button large_button" name='form_save' id='form_save' href='#'>
165 <span class='css_button_span large_button_span'><?php xl('Save','e');?></span>
166 </a>
167 <a class="css_button large_button" id='cancel' href='#' >
168 <span class='css_button_span large_button_span'><?php xl('Cancel','e');?></span>
169 </a>
170 </td></tr>
171 </table>
173 <br>
175 <form name='facility' method='post' action="facilities.php" target='_parent'>
176 <input type=hidden name=mode value="facility">
177 <table border=0 cellpadding=0 cellspacing=0>
178 <tr>
179 <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>
180 <td width=20>&nbsp;</td>
181 <td><span class="text"><?php xl('Phone','e'); ?>: </span></td><td><input type=entry name=phone size=20 value=""></td>
182 </tr>
183 <tr>
184 <td><span class="text"><?php xl('Address','e'); ?>: </span></td><td><input type=entry size=20 name=street value=""></td>
185 <td>&nbsp;</td>
186 <td><span class="text"><?php xl('Fax','e'); ?>: </span></td><td><input type=entry name=fax size=20 value=""></td>
187 </tr>
188 <tr>
189 <td><span class="text"><?php xl('City','e'); ?>: </span></td><td><input type=entry size=20 name=city value=""></td>
190 <td>&nbsp;</td>
191 <td><span class="text"><?php xl('Zip Code','e'); ?>: </span></td><td><input type=entry size=20 name=postal_code value=""></td>
192 </tr>
193 <tr>
194 <td><span class="text"><?php xl('State','e'); ?>: </span></td><td><input type=entry size=20 name=state value=""></td>
195 <td>&nbsp;</td>
196 <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>
197 </tr>
198 <tr>
199 <td height="22"><span class="text"><?php xl('Country','e'); ?>: </span></td><td><input type=entry size=20 name=country_code value=""></td>
200 <td>&nbsp;</td>
201 <td><span class="text"><?php ($GLOBALS['simplified_demographics'] ? xl('Facility Code','e') : xl('Facility NPI','e')); ?>:
202 </span></td><td><input type=entry size=20 name=facility_npi value=""></td>
203 </tr>
205 <tr>
206 <td><span class='text'><?php xl('Billing Location','e'); ?>: </span></td><td><input type='checkbox' name='billing_location' value = '1'></td>
207 <td>&nbsp;</td>
208 <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>
209 </tr>
210 <tr>
211 <td><span class='text'><?php xl('Service Location','e'); ?>: </span></td> <td><input type='checkbox' name='service_location' value = '1'></td>
212 <td>&nbsp;</td>
213 <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>
214 </tr>
215 <?php
216 $disabled='';
217 $resPBE=sqlStatement("select * from facility where primary_business_entity='1' and id!='".$my_fid."'");
218 if(sqlNumRows($resPBE)>0)
219 $disabled='disabled';
221 <tr>
222 <td><span class='text'><?php xl('Primary Business Entity','e'); ?>: </span></td>
223 <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>
224 <td>&nbsp;</td>
225 </tr>
226 <tr>
227 <td><span class=text><?php xl('POS Code','e'); ?>: </span></td>
228 <td colspan="6">
229 <select name="pos_code">
230 <?php
231 $pc = new POSRef();
233 foreach ($pc->get_pos_ref() as $pos) {
234 echo "<option value=\"" . $pos["code"] . "\" ";
235 echo ">" . $pos['code'] . ": ". $pos['title'];
236 echo "</option>\n";
240 </select>
241 </td>
242 </tr>
243 <tr>
244 <td><span class="text"><?php xl('Billing Attn','e'); ?>:</span></td>
245 <td colspan="4"><input type="text" name="attn" size="45"></td>
246 </tr>
247 <tr>
248 <td><span class="text"><?php xl('CLIA Number','e'); ?>:</span></td>
249 <td colspan="4"><input type="text" name="domain_identifier" size="45"></td>
250 </tr>
252 <tr height="25" style="valign:bottom;">
253 <td><font class="mandatory">*</font><span class="text"> <?php echo xl('Required','e'); ?></span></td><td>&nbsp;</td><td>&nbsp;</td>
254 <td>&nbsp;</td><td>&nbsp;</td>
255 </tr>
256 </table>
257 </form>
259 <script language="JavaScript">
260 <?php
261 if ($alertmsg = trim($alertmsg)) {
262 echo "alert('$alertmsg');\n";
265 </script>
267 </body>
268 </html>