6 * @link http://www.open-emr.org
7 * @author Brady Miller <brady.g.miller@gmail.com>
8 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
9 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 require_once("../globals.php");
14 require_once("$srcdir/options.inc.php");
15 require_once("$srcdir/erx_javascript.inc.php");
17 use OpenEMR\Core\Header
;
18 use OpenEMR\Services\FacilityService
;
20 $facilityService = new FacilityService();
22 if (isset($_GET["fid"])) {
23 $my_fid = $_GET["fid"];
28 <?php Header
::setupHeader(['opener', 'jquery-ui']); ?
>
30 <script type
="text/javascript" src
="../main/calendar/modules/PostCalendar/pnincludes/AnchorPosition.js"></script
>
31 <script type
="text/javascript" src
="../main/calendar/modules/PostCalendar/pnincludes/PopupWindow.js"></script
>
32 <script type
="text/javascript" src
="../main/calendar/modules/PostCalendar/pnincludes/ColorPicker2.js"></script
>
34 <!-- validation library
-->
35 <!--//Not lbf forms use the new validation, please make sure you have the corresponding values in the list Page validation-->
36 <?php
$use_validate_js = 1;?
>
37 <?php
require_once($GLOBALS['srcdir'] . "/validation/validation_script.js.php"); ?
>
39 //Gets validation rules from Page Validation list.
40 //Note that for technical reasons, we are bypassing the standard validateUsingPageRules() call.
41 $collectthis = collectValidationPageRules("/interface/usergroup/facility_admin.php");
42 if (empty($collectthis)) {
43 $collectthis = "undefined";
45 $collectthis = json_sanitize($collectthis["facility-form"]["rules"]);
49 <script type
="text/javascript">
52 * validation on the form with new client side validation (using validate.js).
53 * this enable to add new rules for this form in the pageValidation list.
55 var collectvalidation
= <?php
echo $collectthis; ?
>;
57 function submitform() {
59 var valid
= submitme(1, undefined
, 'facility-form', collectvalidation
);
62 <?php
if ($GLOBALS['erx_enable']) { ?
>
64 f
= document
.forms
[0];
65 for (i
= 0; i
< f
.length
; i++
) {
66 if (f
[i
].type
== 'text' && f
[i
].value
) {
67 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') {
72 alertMsg +
= checkLength(f
[i
].name
, f
[i
].value
, 35);
73 alertMsg +
= checkAlphaNumeric(f
[i
].name
, f
[i
].value
);
75 else if (f
[i
].name
== 'phone' || f
[i
].name
== 'fax') {
76 alertMsg +
= checkPhone(f
[i
].name
, f
[i
].value
);
78 else if (f
[i
].name
== 'federal_ein') {
79 alertMsg +
= checkLength(f
[i
].name
, f
[i
].value
, 10);
80 alertMsg +
= checkFederalEin(f
[i
].name
, f
[i
].value
);
92 let post_url
= $
("#facility-form").attr("action");
93 let request_method
= $
("#facility-form").attr("method");
94 let form_data
= $
("#facility-form").serialize();
100 }).done(function (r
) { //
101 dlgclose('refreshme', false);
107 $
("#cancel").click(function() {
112 * add required/star sign to required form fields
114 for (var prop in collectvalidation
) {
115 //if (collectvalidation[prop].requiredSign)
116 if (collectvalidation
[prop
].presence
)
117 jQuery("input[name='" + prop +
"']").after('*');
120 var cp
= new ColorPicker('window');
121 // Runs when a color is clicked
122 function pickColor(color
) {
123 document
.getElementById('ncolor').value
= color
;
126 function pick(anchorname
,target
) {
127 var cp
= new ColorPicker('window');
131 function displayAlert()
133 if(document
.getElementById('primary_business_entity').checked
==false)
134 alert(<?php
echo xlj('Primary Business Entity tax id is used as the account id for NewCrop ePrescription.'); ?
>);
135 else if(document
.getElementById('primary_business_entity').checked
==true)
136 alert(<?php
echo xlj('Once the Primary Business Facility is set, changing the facility id will affect NewCrop ePrescription.'); ?
>);
141 <body
class="body_top" style
="width:600px;height:330px !important;">
146 <span
class="title"><?php
echo xlt('Edit Facility'); ?
></span
> 
; 
; 
;</td
><td
>
147 <a
class="css_button large_button" name
='form_save' id
='form_save' onclick
='submitform()' href
='#' >
148 <span
class='css_button_span large_button_span'><?php
echo xlt('Save');?
></span
>
150 <a
class="css_button large_button" id
='cancel' href
='#'>
151 <span
class='css_button_span large_button_span'><?php
echo xlt('Cancel');?
></span
>
157 <form name
='facility-form' id
="facility-form" method
='post' action
="facilities.php">
158 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(collectCsrfToken()); ?>" />
159 <input type
=hidden name
=mode value
="facility">
160 <input type
=hidden name
=newmode value
="admin_facility"> <!-- Diffrentiate Admin
and add post backs
-->
161 <input type
=hidden name
=fid value
="<?php echo attr($my_fid); ?>">
162 <?php
$facility = $facilityService->getById($my_fid); ?
>
164 <table border
=0 cellpadding
=0 cellspacing
=1 style
="width:630px;">
166 <td width
='150px'><span
class='text'><?php
echo xlt('Name'); ?
>: </span
></td
>
167 <td width
='220px'><input type
='entry' name
='facility' size
='20' value
='<?php echo attr($facility['name
']); ?>'></td
>
168 <td width
='200px'><span
class='text'><?php
echo xlt('Phone'); ?
> <?php
echo xlt('as'); ?
> (000) 000-0000:</span
></td
>
169 <td width
='220px'><input type
='entry' name
='phone' size
='20' value
='<?php echo attr($facility['phone
']); ?>'></td
>
172 <td
><span
class=text
><?php
echo xlt('Address'); ?
>: </span
></td
><td
><input type
=entry size
=20 name
="street" value
="<?php echo attr($facility["street
"]); ?>"></td
>
173 <td
><span
class='text'><?php
echo xlt('Fax'); ?
> <?php
echo xlt('as'); ?
> (000) 000-0000:</span
></td
>
174 <td
><input type
='entry' name
="fax" size
='20' value
='<?php echo attr($facility['fax
']); ?>'></td
>
178 <td
><span
class=text
><?php
echo xlt('City'); ?
>: </span
></td
>
179 <td
><input type
=entry size
=20 name
=city value
="<?php echo attr($facility["city
"]); ?>"></td
>
180 <td
><span
class=text
><?php
echo xlt('Zip Code'); ?
>: </span
></td
><td
><input type
=entry size
=20 name
=postal_code value
="<?php echo attr($facility["postal_code
"]); ?>"></td
>
185 if ($facility['tax_id_type']=='SY') {
192 <td
><span
class=text
><?php
echo xlt('State'); ?
>: </span
></td
><td
><input type
=entry size
=20 name
=state value
="<?php echo attr($facility["state
"]); ?>"></td
>
193 <td
><span
class=text
><?php
echo xlt('Tax ID'); ?
>: </span
></td
><td
><select name
=tax_id_type
><option value
="EI" <?php
echo $ein;?
>><?php
echo xlt('EIN'); ?
></option
><option value
="SY" <?php
echo $ssn;?
>><?php
echo xlt('SSN'); ?
></option
></select
><input type
=entry size
=11 name
=federal_ein value
="<?php echo attr($facility["federal_ein
"]); ?>"></td
>
196 <td
><span
class=text
><?php
echo xlt('Country'); ?
>: </span
></td
><td
><input type
=entry size
=20 name
=country_code value
="<?php echo attr($facility["country_code
"]); ?>"></td
>
197 <td width
="21"><span
class=text
><?php
echo ($GLOBALS['simplified_demographics'] ?
xlt('Facility Code') : xlt('Facility NPI')); ?
>:
198 </span
></td
><td
><input type
=entry size
=20 name
=facility_npi value
="<?php echo attr($facility["facility_npi
"]); ?>"></td
>
201 <td
> 
;</td
><td
> 
;</td
><td
><span
class=text
><?php
echo xlt('Facility Taxonomy'); ?
>:</span
></td
>
202 <td
><input type
=entry size
=20 name
=facility_taxonomy value
="<?php echo attr($facility["facility_taxonomy
"]); ?>"></td
>
207 <td
><span
class=text
><?php
echo xlt('Website'); ?
>: </span
></td
><td
><input type
=entry size
=20 name
=website value
="<?php echo attr($facility["website
"]); ?>"></td
>
208 <td
><span
class=text
><?php
echo xlt('Email'); ?
>: </span
></td
><td
><input type
=entry size
=20 name
=email value
="<?php echo attr($facility["email
"]); ?>"></td
>
212 <td
><span
class='text'><?php
echo xlt('Billing Location'); ?
>: </span
></td
>
213 <td
><input type
='checkbox' name
='billing_location' value
='1' <?php
echo ($facility['billing_location'] != 0) ?
'checked' : ''; ?
>></td
>
214 <td rowspan
='2'><span
class='text'><?php
echo xlt('Accepts Assignment'); ?
><br
>(<?php
echo xlt('only if billing location'); ?
>): </span
></td
>
215 <td
><input type
='checkbox' name
='accepts_assignment' value
='1' <?php
echo ($facility['accepts_assignment'] == 1) ?
'checked' : ''; ?
>></td
>
218 <td
><span
class='text'><?php
echo xlt('Service Location'); ?
>: </span
></td
>
219 <td
><input type
='checkbox' name
='service_location' value
='1' <?php
echo ($facility['service_location'] == 1) ?
'checked' : ''; ?
>></td
>
224 $resPBE = $facilityService->getPrimaryBusinessEntity(array("excludedId" => $my_fid));
226 $disabled='disabled';
230 <td
><span
class='text'><?php
echo xlt('Primary Business Entity'); ?
>: </span
></td
>
231 <td
><input type
='checkbox' name
='primary_business_entity' id
='primary_business_entity' value
='1' <?php
echo ($facility['primary_business_entity'] == 1) ?
'checked' : ''; ?
>
232 <?php
if ($GLOBALS['erx_enable']) { ?
>
233 onchange
='return displayAlert()'
234 <?php
} ?
> <?php
echo $disabled;?
>></td
>
238 <td
><span
class='text'><?php
echo xlt('Color'); ?
>: </span
></td
> <td
><input type
=entry name
=ncolor id
=ncolor size
=20 value
="<?php echo attr($facility["color
"]); ?>"></td
>
239 <td
>[<a href
="javascript:void(0);" onClick
="pick('pick','newcolor');return false;" NAME
="pick" ID
="pick"><?php
echo xlt('Pick'); ?
></a
>]</td
><td
> 
;</td
>
242 <td
><span
class=text
><?php
echo xlt('POS Code'); ?
>: </span
></td
>
244 <select name
="pos_code">
248 foreach ($pc->get_pos_ref() as $pos) {
249 echo "<option value=\"" . attr($pos["code"]) . "\" ";
250 if ($facility['pos_code'] == $pos['code']) {
254 echo ">" . text($pos['code']) . ": ". text($pos['title']);
263 <td
><span
class="text"><?php
echo xlt('Billing Attn'); ?
>:</span
></td
>
264 <td colspan
="4"><input type
="entry" name
="attn" size
="45" value
="<?php echo attr($facility['attn']); ?>"></td
>
267 <td
><span
class="text"><?php
echo xlt('CLIA Number'); ?
>:</span
></td
>
268 <td colspan
="4"><input type
="entry" name
="domain_identifier" size
="45" value
="<?php echo attr($facility['domain_identifier']); ?>"></td
>
271 <td
><span
class="text"><?php
echo xlt('Facility ID'); ?
>:</span
></td
>
272 <td colspan
="4"><input type
="entry" name
="facility_id" size
="45" value
="<?php echo attr($facility['facility_code']); ?>"></td
>
276 <span
class="text"><?php
echo xlt('OID'); ?
>: </span
>
279 <input type
="entry" size
="20" name
="oid" value
="<?php echo attr($facility["oid
"]) ?>">
289 <label
><?php
echo xlt('Mailing Address'); ?
>: </label
>
292 <input type
="entry" size
="20" name
="mail_street" value
="<?php echo attr($facility["mail_street
"]) ?>">
298 <label
><?php
echo xlt('Suite'); ?
>: </label
>
301 <input type
="entry" size
="20" name
="mail_street2" value
="<?php echo attr($facility["mail_street2
"]) ?>">
307 <label
><?php
echo xlt('City'); ?
>: </label
>
310 <input type
="entry" size
="20" name
="mail_city" value
="<?php echo attr($facility["mail_city
"]) ?>">
315 <label
><?php
echo xlt('State'); ?
>: </label
>
318 <input type
="entry" size
="20" name
="mail_state" value
="<?php echo attr($facility["mail_state
"]) ?>">
323 <label
><?php
echo xlt('Zip'); ?
>: </label
>
326 <input type
="entry" size
="20" name
="mail_zip" value
="<?php echo attr($facility["mail_zip
"]) ?>">
329 <tr height
="20" valign
="bottom">
330 <td colspan
=2><span
class="text"><font
class="mandatory">*</font
> <?php
echo xlt('Required'); ?
></span
></td
>