Interim autoloaded library/classes via composer classmap, take 4. (#422)
[openemr.git] / interface / patient_file / label.php
blob1a53cd9e345d60e99323c674c541456bb22989b6
1 <?php
2 /**
3 * interface/patient_file/label.php Displaying a PDF file of Labels for printing.
5 * Program for displaying Chart Labels
6 * via the popups on the left nav screen
8 * Copyright (C) 2014 Terry Hill <terry@lillysystems.com>
10 * LICENSE: This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 3
13 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
21 * @package OpenEMR
22 * @author Terry Hill <terry@lillysystems.com>
23 * @link http://www.open-emr.org
25 // I used the program example supplied with the Avery Label Print Class to produce this program
27 $fake_register_globals=false;
28 $sanitize_all_escapes=true;
30 require_once("../globals.php");
31 require_once("$srcdir/formatting.inc.php");
33 //Get the data to place on labels
35 $patdata = sqlQuery("SELECT " .
36 "p.fname, p.mname, p.lname, p.pubpid, p.DOB, " .
37 "p.street, p.city, p.state, p.postal_code, p.pid " .
38 "FROM patient_data AS p " .
39 "WHERE p.pid = ? LIMIT 1", array($pid));
41 // re-order the dates
44 $today = oeFormatShortDate($date='today');
45 $dob = oeFormatShortDate($patdata['DOB']);
47 //get label type and number of labels on sheet
50 if ($GLOBALS['chart_label_type'] == '1') {
51 $pdf = new PDF_Label('5160');
52 $last = 30;
55 if ($GLOBALS['chart_label_type'] == '2') {
56 $pdf = new PDF_Label('5161');
57 $last = 20;
60 if ($GLOBALS['chart_label_type'] == '3') {
61 $pdf = new PDF_Label('5162');
62 $last = 14;
65 $pdf->AddPage();
67 // Added spaces to the sprintf for Fire Fox it was having a problem with alignment
68 $text = sprintf(" %s %s\n %s\n %s\n %s", $patdata['fname'], $patdata['lname'], $dob, $today, $patdata['pid']);
70 // For loop for printing the labels
73 for($i=1;$i<=$last;$i++) {
74 $pdf->Add_Label($text);
77 $pdf->Output();