Moved recent v5.0.0 statement fix to current master.
[openemr.git] / interface / patient_file / addr_appt_label.php
blob9274903ef90b19e6a6e1914ead89620ab16ef212
1 <?php
2 /**
3 * interface/patient_file/addr_appt_label.php
4 * Displaying a PDF file of Appointment Labels for printing.
6 * Program for displaying Address Labels
7 * from the appointment report
9 * Copyright (C) 2016 Terry Hill <terry@lillysystems.com>
11 * LICENSE: This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 3
14 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
22 * @package OpenEMR
23 * @author Terry Hill <terry@lillysystems.com>
24 * @link http://www.open-emr.org
26 # I used the program example supplied with the Avery Label Print Class to produce this program
31 require_once("../globals.php");
33 # This is based on session array.
34 $pid_list = array();
35 $pid_list = $_SESSION['pidList'];
37 #get label type and number of labels on sheet
40 if ($GLOBALS['chart_label_type'] == '1') {
41 $pdf = new PDF_Label('5160');
42 $last = 30;
45 if ($GLOBALS['chart_label_type'] == '2') {
46 $pdf = new PDF_Label('5161');
47 $last = 20;
50 if ($GLOBALS['chart_label_type'] == '3') {
51 $pdf = new PDF_Label('5162');
52 $last = 14;
55 $pdf->AddPage();
57 #Get the data to place on labels
58 #and output each label
59 foreach ($pid_list as $pid) {
60 $patdata = sqlQuery("SELECT " .
61 "p.fname, p.mname, p.lname, p.pubpid, p.DOB, " .
62 "p.street, p.city, p.state, p.postal_code, p.pid " .
63 "FROM patient_data AS p " .
64 "WHERE p.pid = ? LIMIT 1", array($pid));
66 # sprintf to print data
67 $text = sprintf(" %s %s\n %s\n %s %s %s\n ", $patdata['fname'], $patdata['lname'], $patdata['street'], $patdata['city'], $patdata['state'], $patdata['postal_code']);
68 $pdf->Add_Label($text);
71 $pdf->Output();