When Print or Export to PDF, facility name defaulted to most recent created one



OpenEMR Version Number: v5.0.1 (7)
OS: Linux Mint 19.1 and Openemr demo

I’ve created a billing facility in my system and also in demo at Another Alternate Demo

  • After creating a second facility (named as billing facility). I went to one of the previous encounter dated 2014-02-01 with both facility and billing facility named Great Clinic.

  • When go to print, the Billing Facility name came up instead of the Great Clinic

  • I then created another facility (named third facility) and tried to print, same thing happened, the third facility name came up instead of Great clinic.


I even set the original (Great Clinic) as primary business entity and it still does not show it.

How could I get the facility name to display correctly?
Thank you

(ViSolve) #2

Have you tried by setting the session variable for facility?
Tweak some lines in the file : interface/forms/newpatient/report.php
Include as shown below

while ($result = sqlFetchArray($res)) {
$_SESSION[‘pc_facility’]=$result[‘facility_id’]; //Include this line
print “” . xlt(‘Facility’) . ": " . text($result{“facility_name”}) . “



Hello. I’ve tried putting the code you provided but didn’t seem to be working.

At the moment. I edited the code of /interface/patient_file/report/custom_report.php
Line 214
echo ‘<page_footer style=“text-align:right;” class=“custom-tag”>’ . xlt(‘Generated on’) . ’ ’ . text(oeFormatShortDate()) . ’ - ’ . text($facility[‘name’]) . ’ ’ . text($facility[‘phone’]) . ‘</page_footer>’;

$facility changed to text(‘Facility name goes here’)

line 233

<?php echo $facility['name'] ?>

I changed it to <?php echo xl['Name of facility goes here'] ?>

I don’t know if its gonna mess up anything in the future because this is the only way I was able to get it to work