minor changes to prior commit
[openemr.git] / interface / patient_file / label.php
blob56db0f9a5f40bf7c009147684d3d668e38150169
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
28 require_once("../globals.php");
30 //Get the data to place on labels
32 $patdata = sqlQuery("SELECT " .
33 "p.fname, p.mname, p.lname, p.pubpid, p.DOB, " .
34 "p.street, p.city, p.state, p.postal_code, p.pid " .
35 "FROM patient_data AS p " .
36 "WHERE p.pid = ? LIMIT 1", array($pid));
38 // re-order the dates
41 $today = oeFormatShortDate($date = 'today');
42 $dob = oeFormatShortDate($patdata['DOB']);
44 //get label type and number of labels on sheet
47 if ($GLOBALS['chart_label_type'] == '1') {
48 $pdf = new PDF_Label('5160');
49 $last = 30;
52 if ($GLOBALS['chart_label_type'] == '2') {
53 $pdf = new PDF_Label('5161');
54 $last = 20;
57 if ($GLOBALS['chart_label_type'] == '3') {
58 $pdf = new PDF_Label('5162');
59 $last = 14;
62 $pdf->AddPage();
64 // Added spaces to the sprintf for Fire Fox it was having a problem with alignment
65 $text = sprintf(" %s %s\n %s\n %s\n %s", $patdata['fname'], $patdata['lname'], $dob, $today, $patdata['pid']);
67 // For loop for printing the labels
70 for ($i=1; $i<=$last; $i++) {
71 $pdf->Add_Label($text);
74 $pdf->Output();