added cache clearing support for dialog.js (#411)
[openemr.git] / interface / usergroup / facilities_add.php
blob96014f518644fbe328194e6d2115da49f743b56c
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?v=<?php echo $v_js_includes; ?>"></script>
17 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative'] ?>/jquery-min-1-9-1/index.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>
25 <!-- validation library -->
26 <!--//Not lbf forms use the new validation, please make sure you have the corresponding values in the list Page validation-->
27 <?php $use_validate_js = 1;?>
28 <?php require_once($GLOBALS['srcdir'] . "/validation/validation_script.js.php"); ?>
29 <?php require_once($GLOBALS['srcdir'] . "/validation/validate_core.php"); ?>
30 <?php
31 //Gets validation rules from Page Validation list.
32 //Note that for technical reasons, we are bypassing the standard validateUsingPageRules() call.
33 $collectthis = collectValidationPageRules("/interface/usergroup/facilities_add.php");
34 if (empty($collectthis)) {
35 $collectthis = "undefined";
37 else {
38 $collectthis = $collectthis["facility-add"]["rules"];
41 // Old Browser comp trigger on js
43 if (isset($_POST["mode"]) && $_POST["mode"] == "facility") {
44 echo '
45 <script type="text/javascript">
46 <!--
47 parent.$.fn.fancybox.close();
48 //-->
49 </script>
54 <script type="text/javascript">
55 /// todo, move this to a common library
57 var collectvalidation = <?php echo($collectthis); ?>;
59 function submitform() {
61 var valid = submitme(1, undefined, 'facility-add', collectvalidation);
62 if (!valid) return;
64 <?php if($GLOBALS['erx_enable']){ ?>
65 alertMsg='';
66 f=document.forms[0];
67 for(i=0;i<f.length;i++){
68 if(f[i].type=='text' && f[i].value)
70 if(f[i].name == 'facility' || f[i].name == 'Washington')
72 alertMsg += checkLength(f[i].name,f[i].value,35);
73 alertMsg += checkFacilityName(f[i].name,f[i].value);
75 else if(f[i].name == 'street')
77 alertMsg += checkLength(f[i].name,f[i].value,35);
78 alertMsg += checkAlphaNumeric(f[i].name,f[i].value);
80 else if(f[i].name == 'phone' || f[i].name == 'fax')
82 alertMsg += checkPhone(f[i].name,f[i].value);
84 else if(f[i].name == 'federal_ein')
86 alertMsg += checkLength(f[i].name,f[i].value,10);
87 alertMsg += checkFederalEin(f[i].name,f[i].value);
91 if(alertMsg)
93 alert(alertMsg);
94 return false;
96 <?php } ?>
98 document.forms[0].submit();
99 top.restoreSession();
102 function toggle( target, div ) {
104 $mode = $(target).find(".indicator").text();
105 if ( $mode == "collapse" ) {
106 $(target).find(".indicator").text( "expand" );
107 $(div).hide();
108 } else {
109 $(target).find(".indicator").text( "collapse" );
110 $(div).show();
115 $(document).ready(function(){
117 $("#dem_view").click( function() {
118 toggle( $(this), "#DEM" );
121 // fancy box
122 enable_modals();
124 tabbify();
126 // special size for
127 $(".large_modal").fancybox( {
128 'overlayOpacity' : 0.0,
129 'showCloseButton' : true,
130 'frameHeight' : 600,
131 'frameWidth' : 1000
134 // special size for
135 $(".medium_modal").fancybox( {
136 'overlayOpacity' : 0.0,
137 'showCloseButton' : true,
138 'frameHeight' : 260,
139 'frameWidth' : 510
144 $(document).ready(function(){
145 $("#cancel").click(function() {
146 parent.$.fn.fancybox.close();
149 var cp = new ColorPicker('window');
150 // Runs when a color is clicked
151 function pickColor(color) {
152 document.getElementById('ncolor').value = color;
154 var field;
155 function pick(anchorname,target) {
156 var cp = new ColorPicker('window');
157 field=target;
158 cp.show(anchorname);
160 function displayAlert()
162 if(document.getElementById('primary_business_entity').checked==false)
163 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.'));?>");
164 else if(document.getElementById('primary_business_entity').checked==true)
165 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.'));?>");
167 </script>
168 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
170 </head>
171 <body class="body_top">
172 <table>
173 <tr><td>
174 <span class="title"><?php xl('Add Facility','e'); ?></span>&nbsp;&nbsp;&nbsp;</td>
175 <td colspan=5 align=center style="padding-left:2px;">
176 <a onclick="submitform();" class="css_button large_button" name='form_save' id='form_save' href='#'>
177 <span class='css_button_span large_button_span'><?php xl('Save','e');?></span>
178 </a>
179 <a class="css_button large_button" id='cancel' href='#' >
180 <span class='css_button_span large_button_span'><?php xl('Cancel','e');?></span>
181 </a>
182 </td></tr>
183 </table>
185 <br>
187 <form name='facility-add' id='facility-add' method='post' action="facilities.php" target='_parent'>
188 <input type=hidden name=mode value="facility">
189 <table border=0 cellpadding=0 cellspacing=0>
190 <tr>
191 <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>
192 <td width=20>&nbsp;</td>
193 <td><span class="text"><?php xl('Phone','e'); ?>: </span></td><td><input type=entry name=phone size=20 value=""></td>
194 </tr>
195 <tr>
196 <td><span class="text"><?php xl('Address','e'); ?>: </span></td><td><input type=entry size=20 name=street value=""></td>
197 <td>&nbsp;</td>
198 <td><span class="text"><?php xl('Fax','e'); ?>: </span></td><td><input type=entry name=fax size=20 value=""></td>
199 </tr>
200 <tr>
201 <td><span class="text"><?php xl('City','e'); ?>: </span></td><td><input type=entry size=20 name=city value=""></td>
202 <td>&nbsp;</td>
203 <td><span class="text"><?php xl('Zip Code','e'); ?>: </span></td><td><input type=entry size=20 name=postal_code value=""></td>
204 </tr>
205 <tr>
206 <td><span class="text"><?php xl('State','e'); ?>: </span></td><td><input type=entry size=20 name=state value=""></td>
207 <td>&nbsp;</td>
208 <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>
209 </tr>
210 <tr>
211 <td height="22"><span class="text"><?php xl('Country','e'); ?>: </span></td><td><input type=entry size=20 name=country_code value=""></td>
212 <td>&nbsp;</td>
213 <td><span class="text"><?php ($GLOBALS['simplified_demographics'] ? xl('Facility Code','e') : xl('Facility NPI','e')); ?>:
214 </span></td><td><input type=entry size=20 name=facility_npi value=""></td>
215 </tr>
216 <tr>
217 <td><span class="text"><?php xl('Website','e'); ?>: </span></td><td><input type=entry size=20 name=website value=""></td>
218 <td>&nbsp;</td>
219 <td><span class="text"><?php xl('Email','e'); ?>: </span></td><td><input type=entry size=20 name=email value=""></td>
220 </tr>
222 <tr>
223 <td><span class='text'><?php xl('Billing Location','e'); ?>: </span></td><td><input type='checkbox' name='billing_location' value = '1'></td>
224 <td>&nbsp;</td>
225 <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>
226 </tr>
227 <tr>
228 <td><span class='text'><?php xl('Service Location','e'); ?>: </span></td> <td><input type='checkbox' name='service_location' value = '1'></td>
229 <td>&nbsp;</td>
230 <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=""><span>[<a href="javascript:void(0);" onClick="pick('pick','newcolor');return false;" NAME="pick" ID="pick"><?php echo htmlspecialchars(xl('Pick'),ENT_QUOTES); ?></a>]</span></td>
231 </tr>
232 <?php
233 $disabled='';
234 $resPBE=sqlStatement("select * from facility where primary_business_entity='1' and id!='".$my_fid."'");
235 if(sqlNumRows($resPBE)>0)
236 $disabled='disabled';
238 <tr>
239 <td><span class='text'><?php xl('Primary Business Entity','e'); ?>: </span></td>
240 <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>
241 <td>&nbsp;</td>
242 </tr>
243 <tr>
244 <td><span class=text><?php xl('POS Code','e'); ?>: </span></td>
245 <td colspan="6">
246 <select name="pos_code">
247 <?php
248 $pc = new POSRef();
250 foreach ($pc->get_pos_ref() as $pos) {
251 echo "<option value=\"" . $pos["code"] . "\" ";
252 echo ">" . $pos['code'] . ": ". text($pos['title']);
253 echo "</option>\n";
257 </select>
258 </td>
259 </tr>
260 <tr>
261 <td><span class="text"><?php xl('Billing Attn','e'); ?>:</span></td>
262 <td colspan="4"><input type="text" name="attn" size="45"></td>
263 </tr>
264 <tr>
265 <td><span class="text"><?php xl('CLIA Number','e'); ?>:</span></td>
266 <td colspan="4"><input type="text" name="domain_identifier" size="45"></td>
267 </tr>
268 <tr>
269 <td><span class="text"><?php xl('Facility ID','e'); ?>:</span></td>
270 <td colspan="4"><input type="text" name="facility_id" size="20"></td>
271 </tr>
272 <tr height="25" style="valign:bottom;">
273 <td><font class="mandatory">*</font><span class="text"> <?php echo xl('Required','e'); ?></span></td><td>&nbsp;</td><td>&nbsp;</td>
274 <td>&nbsp;</td><td>&nbsp;</td>
275 </tr>
276 </table>
277 </form>
279 <script language="JavaScript">
280 <?php
281 if ($alertmsg = trim($alertmsg)) {
282 echo "alert('$alertmsg');\n";
285 </script>
287 </body>
288 </html>