Interim autoloaded library/classes via composer classmap, take 4. (#422)
[openemr.git] / interface / usergroup / facilities_add.php
blob2d67e39f60ff9dc5ebc822e32eed1ffeb95692a0
1 <?php
2 require_once("../globals.php");
3 require_once("../../library/acl.inc");
4 require_once("$srcdir/options.inc.php");
5 require_once("$srcdir/erx_javascript.inc.php");
7 $alertmsg = '';
8 ?>
9 <html>
10 <head>
11 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
12 <link rel="stylesheet" type="text/css" href="<?php echo $GLOBALS['webroot'] ?>/library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
13 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js?v=<?php echo $v_js_includes; ?>"></script>
14 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative'] ?>/jquery-min-1-9-1/index.js"></script>
15 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/common.js"></script>
16 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
17 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery-ui.js"></script>
18 <script type="text/javascript" src="../main/calendar/modules/PostCalendar/pnincludes/AnchorPosition.js"></script>
19 <script type="text/javascript" src="../main/calendar/modules/PostCalendar/pnincludes/PopupWindow.js"></script>
20 <script type="text/javascript" src="../main/calendar/modules/PostCalendar/pnincludes/ColorPicker2.js"></script>
22 <!-- validation library -->
23 <!--//Not lbf forms use the new validation, please make sure you have the corresponding values in the list Page validation-->
24 <?php $use_validate_js = 1;?>
25 <?php require_once($GLOBALS['srcdir'] . "/validation/validation_script.js.php"); ?>
26 <?php
27 //Gets validation rules from Page Validation list.
28 //Note that for technical reasons, we are bypassing the standard validateUsingPageRules() call.
29 $collectthis = collectValidationPageRules("/interface/usergroup/facilities_add.php");
30 if (empty($collectthis)) {
31 $collectthis = "undefined";
33 else {
34 $collectthis = $collectthis["facility-add"]["rules"];
37 // Old Browser comp trigger on js
39 if (isset($_POST["mode"]) && $_POST["mode"] == "facility") {
40 echo '
41 <script type="text/javascript">
42 <!--
43 parent.$.fn.fancybox.close();
44 //-->
45 </script>
50 <script type="text/javascript">
51 /// todo, move this to a common library
53 var collectvalidation = <?php echo($collectthis); ?>;
55 function submitform() {
57 var valid = submitme(1, undefined, 'facility-add', collectvalidation);
58 if (!valid) return;
60 <?php if($GLOBALS['erx_enable']){ ?>
61 alertMsg='';
62 f=document.forms[0];
63 for(i=0;i<f.length;i++){
64 if(f[i].type=='text' && f[i].value)
66 if(f[i].name == 'facility' || f[i].name == 'Washington')
68 alertMsg += checkLength(f[i].name,f[i].value,35);
69 alertMsg += checkFacilityName(f[i].name,f[i].value);
71 else if(f[i].name == 'street')
73 alertMsg += checkLength(f[i].name,f[i].value,35);
74 alertMsg += checkAlphaNumeric(f[i].name,f[i].value);
76 else if(f[i].name == 'phone' || f[i].name == 'fax')
78 alertMsg += checkPhone(f[i].name,f[i].value);
80 else if(f[i].name == 'federal_ein')
82 alertMsg += checkLength(f[i].name,f[i].value,10);
83 alertMsg += checkFederalEin(f[i].name,f[i].value);
87 if(alertMsg)
89 alert(alertMsg);
90 return false;
92 <?php } ?>
94 top.restoreSession();
95 document.forms[0].submit();
98 function toggle( target, div ) {
100 $mode = $(target).find(".indicator").text();
101 if ( $mode == "collapse" ) {
102 $(target).find(".indicator").text( "expand" );
103 $(div).hide();
104 } else {
105 $(target).find(".indicator").text( "collapse" );
106 $(div).show();
111 $(document).ready(function(){
113 $("#dem_view").click( function() {
114 toggle( $(this), "#DEM" );
117 // fancy box
118 enable_modals();
120 tabbify();
122 // special size for
123 $(".large_modal").fancybox( {
124 'overlayOpacity' : 0.0,
125 'showCloseButton' : true,
126 'frameHeight' : 600,
127 'frameWidth' : 1000
130 // special size for
131 $(".medium_modal").fancybox( {
132 'overlayOpacity' : 0.0,
133 'showCloseButton' : true,
134 'frameHeight' : 260,
135 'frameWidth' : 510
140 $(document).ready(function(){
141 $("#cancel").click(function() {
142 parent.$.fn.fancybox.close();
146 * add required/star sign to required form fields
148 for (var prop in collectvalidation) {
149 //if (collectvalidation[prop].requiredSign)
150 if (collectvalidation[prop].presence)
151 jQuery("input[name='" + prop + "']").after('*');
154 var cp = new ColorPicker('window');
155 // Runs when a color is clicked
156 function pickColor(color) {
157 document.getElementById('ncolor').value = color;
159 var field;
160 function pick(anchorname,target) {
161 var cp = new ColorPicker('window');
162 field=target;
163 cp.show(anchorname);
165 function displayAlert()
167 if(document.getElementById('primary_business_entity').checked==false)
168 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.'));?>");
169 else if(document.getElementById('primary_business_entity').checked==true)
170 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.'));?>");
172 </script>
173 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
175 </head>
176 <body class="body_top">
177 <table>
178 <tr><td>
179 <span class="title"><?php xl('Add Facility','e'); ?></span>&nbsp;&nbsp;&nbsp;</td>
180 <td colspan=5 align=center style="padding-left:2px;">
181 <a onclick="submitform();" class="css_button large_button" name='form_save' id='form_save' href='#'>
182 <span class='css_button_span large_button_span'><?php xl('Save','e');?></span>
183 </a>
184 <a class="css_button large_button" id='cancel' href='#' >
185 <span class='css_button_span large_button_span'><?php xl('Cancel','e');?></span>
186 </a>
187 </td></tr>
188 </table>
190 <br>
192 <form name='facility-add' id='facility-add' method='post' action="facilities.php" target='_parent'>
193 <input type=hidden name=mode value="facility">
194 <table border=0 cellpadding=0 cellspacing=0>
195 <tr>
196 <td><span class="text"><?php xl('Name','e'); ?>: </span></td><td><input type=entry name=facility size=20 value=""></td>
197 <td width=20>&nbsp;</td>
198 <td><span class="text"><?php xl('Phone','e'); ?>: </span></td><td><input type=entry name=phone size=20 value=""></td>
199 </tr>
200 <tr>
201 <td><span class="text"><?php xl('Address','e'); ?>: </span></td><td><input type=entry size=20 name=street value=""></td>
202 <td>&nbsp;</td>
203 <td><span class="text"><?php xl('Fax','e'); ?>: </span></td><td><input type=entry name=fax size=20 value=""></td>
204 </tr>
205 <tr>
206 <td><span class="text"><?php xl('City','e'); ?>: </span></td><td><input type=entry size=20 name=city value=""></td>
207 <td>&nbsp;</td>
208 <td><span class="text"><?php xl('Zip Code','e'); ?>: </span></td><td><input type=entry size=20 name=postal_code value=""></td>
209 </tr>
210 <tr>
211 <td><span class="text"><?php xl('State','e'); ?>: </span></td><td><input type=entry size=20 name=state value=""></td>
212 <td>&nbsp;</td>
213 <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>
214 </tr>
215 <tr>
216 <td height="22"><span class="text"><?php xl('Country','e'); ?>: </span></td><td><input type=entry size=20 name=country_code value=""></td>
217 <td>&nbsp;</td>
218 <td><span class="text"><?php ($GLOBALS['simplified_demographics'] ? xl('Facility Code','e') : xl('Facility NPI','e')); ?>:
219 </span></td><td><input type=entry size=20 name=facility_npi value=""></td>
220 </tr>
221 <tr>
222 <td><span class="text"><?php xl('Website','e'); ?>: </span></td><td><input type=entry size=20 name=website value=""></td>
223 <td>&nbsp;</td>
224 <td><span class="text"><?php xl('Email','e'); ?>: </span></td><td><input type=entry size=20 name=email value=""></td>
225 </tr>
227 <tr>
228 <td><span class='text'><?php xl('Billing Location','e'); ?>: </span></td><td><input type='checkbox' name='billing_location' value = '1'></td>
229 <td>&nbsp;</td>
230 <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>
231 </tr>
232 <tr>
233 <td><span class='text'><?php xl('Service Location','e'); ?>: </span></td> <td><input type='checkbox' name='service_location' value = '1'></td>
234 <td>&nbsp;</td>
235 <td><span class='text'><?php echo htmlspecialchars(xl('Color'),ENT_QUOTES); ?>: </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>
236 </tr>
237 <?php
238 $disabled='';
239 $resPBE=sqlStatement("select * from facility where primary_business_entity='1' and id!='".$my_fid."'");
240 if(sqlNumRows($resPBE)>0)
241 $disabled='disabled';
243 <tr>
244 <td><span class='text'><?php xl('Primary Business Entity','e'); ?>: </span></td>
245 <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>
246 <td>&nbsp;</td>
247 </tr>
248 <tr>
249 <td><span class=text><?php xl('POS Code','e'); ?>: </span></td>
250 <td colspan="6">
251 <select name="pos_code">
252 <?php
253 $pc = new POSRef();
255 foreach ($pc->get_pos_ref() as $pos) {
256 echo "<option value=\"" . $pos["code"] . "\" ";
257 echo ">" . $pos['code'] . ": ". text($pos['title']);
258 echo "</option>\n";
262 </select>
263 </td>
264 </tr>
265 <tr>
266 <td><span class="text"><?php xl('Billing Attn','e'); ?>:</span></td>
267 <td colspan="4"><input type="text" name="attn" size="45"></td>
268 </tr>
269 <tr>
270 <td><span class="text"><?php xl('CLIA Number','e'); ?>:</span></td>
271 <td colspan="4"><input type="text" name="domain_identifier" size="45"></td>
272 </tr>
273 <tr>
274 <td><span class="text"><?php xl('Facility ID','e'); ?>:</span></td>
275 <td colspan="4"><input type="text" name="facility_id" size="20"></td>
276 </tr>
277 <tr height="25" style="valign:bottom;">
278 <td><font class="mandatory">*</font><span class="text"> <?php echo xl('Required','e'); ?></span></td><td>&nbsp;</td><td>&nbsp;</td>
279 <td>&nbsp;</td><td>&nbsp;</td>
280 </tr>
281 </table>
282 </form>
284 <script language="JavaScript">
285 <?php
286 if ($alertmsg = trim($alertmsg)) {
287 echo "alert('$alertmsg');\n";
290 </script>
292 </body>
293 </html>