Feature to create Chart labels, take 2.
[openemr.git] / interface / patient_file / label.php
blob39831d222ef1eb44e12b281b9415d563a741a6af
1 <?php
2 /**
3 * interface/patient_file/label.php Displaying a PDF file of Labels for printing.
4 *
5 * Program for displaying Chart Labels
6 * via the popups on the left nav screen
7 *
8 * Copyright (C) 2014 Terry Hill <terry@lillysystems.com>
9 *
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/classes/PDF_Label.php");
32 require_once("$srcdir/formatting.inc.php");
34 //Get the data to place on labels
36 $patdata = sqlQuery("SELECT " .
37 "p.fname, p.mname, p.lname, p.pubpid, p.DOB, " .
38 "p.street, p.city, p.state, p.postal_code, p.pid " .
39 "FROM patient_data AS p " .
40 "WHERE p.pid = ? LIMIT 1", array($pid));
44 // re-order the dates
47 $today = oeFormatShortDate($date='today');
48 $dob = oeFormatShortDate($patdata['DOB']);
50 //get label type and number of labels on sheet
53 if ($GLOBALS['chart_label_type'] == '1') {
54 $pdf = new PDF_Label('5160');
55 $last = 30;
58 if ($GLOBALS['chart_label_type'] == '2') {
59 $pdf = new PDF_Label('5161');
60 $last = 20;
63 if ($GLOBALS['chart_label_type'] == '3') {
64 $pdf = new PDF_Label('5162');
65 $last = 14;
68 $pdf->AddPage();
70 // For loop for printing the labels
71 //
73 for($i=1;$i<=$last;$i++) {
74 $text = sprintf("%s %s\n%s\n%s\n%s", $patdata['fname'], $patdata['lname'], $dob, $today, $patdata['pid']);
75 $pdf->Add_Label($text);
78 $pdf->Output();