3 * interface/patient_file/barcode_label.php Displaying a PDF file of Labels for printing.
5 * Program for displaying Barcode Label
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>;.
22 * @author Terry Hill <terry@lillysystems.com>
23 * @link http://www.open-emr.org
25 * this is from the barcode-coder and FPDF website I used the examples and code snippets listed on the sites
26 * to create this program
31 require_once("../globals.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));
43 $today = date('m/d/Y');
44 $dob = substr($patdata['DOB'], 5, 2) ."/". Substr($patdata['DOB'], 8, 2) ."/". Substr($patdata['DOB'], 0, 4);
48 // -------------------------------------------------- //
49 // BARCODE DATA AND TYPE
50 // -------------------------------------------------- //
52 $code = $patdata['pubpid']; // what is wanted as the barcode
53 $bartype = $GLOBALS['barcode_label_type'] ; // Get barcode type
94 // -------------------------------------------------- //
96 // -------------------------------------------------- //
98 $angle = 90; // rotation in degrees
99 $black = '000000'; // color in hexa
101 if ($GLOBALS['barcode_label_type'] == '12') { // datamatrix
102 $marge = 0; // between barcode and hri in pixel
103 $x = 35; // barcode center
104 $y = 120; // barcode center
105 $height = 40; // barcode height in 1D ; module size in 2D
106 $width = 4; // barcode height in 1D ; not use in 2D
108 $marge = 5; // between barcode and hri in pixel
109 $x = 30; // barcode center
110 $y = 120; // barcode center
111 $height = 40; // barcode height in 1D ; module size in 2D
112 $width = 1; // barcode height in 1D ; not use in 2D
115 // -------------------------------------------------- //
116 // ALLOCATE FPDF RESSOURCE
117 // -------------------------------------------------- //
119 $pdf = new eFPDF('P', 'mm', array(102,252)); // set the orentation, unit of measure and size of the page
122 // -------------------------------------------------- //
124 // -------------------------------------------------- //
126 $data = Barcode
::fpdf($pdf, $black, $x, $y, $angle, $type, array('code'=>$code), $width, $height);
127 $pdf->SetFont('Arial', 'B', $fontSize);
128 $pdf->SetTextColor(0, 0, 0);
129 $len = $pdf->GetStringWidth($data['hri']);
130 Barcode
::rotate(-$len / 2, ($data['height'] / 2) +
$fontSize +
$marge, $angle, $xt, $yt);
132 // -------------------------------------------------- //
134 // -------------------------------------------------- //
136 $pdf->TextWithRotation($x +
$xt, $y +
$yt, $data['hri'], $angle);