Skip to content

Commit

Permalink
Rx improvements:
Browse files Browse the repository at this point in the history
 -Options to set DEA,NPI and state license #,
  margins, and paper size of rx.
 -Can be set from administration->globals->Rx
  • Loading branch information
Alfonso Perez authored and bradymiller committed Oct 8, 2011
1 parent a9cbfbb commit b412e36
Show file tree
Hide file tree
Showing 7 changed files with 208 additions and 57 deletions.
92 changes: 68 additions & 24 deletions controllers/C_Prescription.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,32 @@ function multiprint_header(& $pdf, $p) {
// necessary. If you need to change this back, then please make it a
// configurable option. Faxed prescriptions were not changed. -- Rod
// Now it is configureable. Change value in
// <openemr root>/includes/config.php - Tekknogenius
if ($this->is_faxing || $GLOBALS['oer_config']['prescriptions']['show_DEA'])
$pdf->ezText('<b>' . xl('DEA') . ':</b>' . $p->provider->federal_drug_id, 12);
else
$pdf->ezText('<b>' . xl('DEA') . ':</b> ________________________', 12);
// Administration->Globals->Rx
if ($GLOBALS['rx_enable_DEA']) {
if ($this->is_faxing || $GLOBALS['rx_show_DEA']) {
$pdf->ezText('<b>' . xl('DEA') . ':</b>' . $p->provider->federal_drug_id, 12);
}
else {
$pdf->ezText('<b>' . xl('DEA') . ':</b> ________________________', 12);
}
}

if ($GLOBALS['rx_enable_NPI']) {
if ($this->is_faxing || $GLOBALS['rx_show_NPI']) {
$pdf->ezText('<b>' . xl('NPI') . ':</b>' . $p->provider->npi, 12);
}
else {
$pdf->ezText('<b>' . xl('NPI') . ':</b> _________________________', 12);
}
}
if ($GLOBALS['rx_enable_SLN']) {
if ($this->is_faxing || $GLOBALS['rx_show_SLN']) {
$pdf->ezText('<b>' . xl('State Lic. #') . ':</b>' . $p->provider->state_license_number, 12);
}
else {
$pdf->ezText('<b>' . xl('State Lic. #') . ':</b> ___________________', 12);
}
}
$pdf->ezColumnsStop();
if ($my_y < $pdf->y){
$pdf->ezSetY($my_y);
Expand Down Expand Up @@ -297,8 +318,31 @@ function multiprintcss_header($p) {
echo ("</td>\n");
echo ("<td>\n");
echo ('<b><span class="large">' . $p->provider->get_name_display() . '</span></b>'. '<br>');
if ($GLOBALS['oer_config']['prescriptions']['show_DEA']) echo ('<span class="large"><b>' . xl('DEA') . ':</b>' . $p->provider->federal_drug_id . '</span>');
else echo ('<b><span class="large">' . xl('DEA') . ':</span></b> ________________________');

if ($GLOBALS['rx_enable_DEA']) {
if ($GLOBALS['rx_show_DEA']) {
echo ('<span class="large"><b>' . xl('DEA') . ':</b>' . $p->provider->federal_drug_id . '</span><br>');
}
else {
echo ('<b><span class="large">' . xl('DEA') . ':</span></b> ________________________<br>' );
}
}
if ($GLOBALS['rx_enable_NPI']) {
if ($GLOBALS['rx_show_NPI']) {
echo ('<span class="large"><b>' . xl('NPI') . ':</b>' . $p->provider->npi . '</span><br>');
}
else {
echo ('<b><span class="large">' . xl('NPI') . ':</span></b> ________________________<br>');
}
}
if ($GLOBALS['rx_enable_SLN']) {
if ($GLOBALS['rx_show_SLN']) {
echo ('<span class="large"><b>' . xl('State Lic. #') . ':</b>' . $p->provider->state_license_number . '</span><br>');
}
else {
echo ('<b><span class="large">' . xl('State Lic. #') . ':</span></b> ________________________<br>');
}
}
echo ("</td>\n");
echo ("</tr>\n");
echo ("<tr>\n");
Expand Down Expand Up @@ -480,8 +524,8 @@ function multiprint_body(& $pdf, $p){
}
$pdf->ezSetY($my_y);
$pdf->ezText($d,10);
$pdf->ez['leftMargin'] = $GLOBALS['oer_config']['prescriptions']['left'];
$pdf->ez['rightMargin'] = $GLOBALS['oer_config']['prescriptions']['right'];
$pdf->ez['leftMargin'] = $GLOBALS['rx_left_margin'];
$pdf->ez['rightMargin'] = $GLOBALS['rx_right_margin'];
$pdf->ezText('');
$pdf->line($pdf->ez['leftMargin'],$pdf->y,$pdf->ez['pageWidth']-$pdf->ez['rightMargin'],$pdf->y);
$pdf->ezText('');
Expand All @@ -506,11 +550,11 @@ function multiprint_action($id = "") {
$this->function_argument_error();
}
require_once ($GLOBALS['fileroot'] . "/library/classes/class.ezpdf.php");
$pdf =& new Cezpdf($GLOBALS['oer_config']['prescriptions']['paper_size']);
$pdf->ezSetMargins($GLOBALS['oer_config']['prescriptions']['top']
,$GLOBALS['oer_config']['prescriptions']['bottom']
,$GLOBALS['oer_config']['prescriptions']['left']
,$GLOBALS['oer_config']['prescriptions']['right']
$pdf =& new Cezpdf($GLOBALS['rx_paper_size']);
$pdf->ezSetMargins($GLOBALS['rx_top_margin']
,$GLOBALS['rx_bottom_margin']
,$GLOBALS['rx_left_margin']
,$GLOBALS['rx_right_margin']
);
$pdf->selectFont($GLOBALS['fileroot'] . "/library/fonts/Helvetica.afm");

Expand Down Expand Up @@ -641,11 +685,11 @@ function send_action_process($id) {

function _print_prescription($p, & $toFile) {
require_once ($GLOBALS['fileroot'] . "/library/classes/class.ezpdf.php");
$pdf =& new Cezpdf($GLOBALS['oer_config']['prescriptions']['paper_size']);
$pdf->ezSetMargins($GLOBALS['oer_config']['prescriptions']['top']
,$GLOBALS['oer_config']['prescriptions']['bottom']
,$GLOBALS['oer_config']['prescriptions']['left']
,$GLOBALS['oer_config']['prescriptions']['right']
$pdf =& new Cezpdf($GLOBALS['rx_paper_size']);
$pdf->ezSetMargins($GLOBALS['rx_top_margin']
,$GLOBALS['rx_bottom_margin']
,$GLOBALS['rx_left_margin']
,$GLOBALS['rx_right_margin']
);

$pdf->selectFont($GLOBALS['fileroot'] . "/library/fonts/Helvetica.afm");
Expand Down Expand Up @@ -679,11 +723,11 @@ function _print_prescription_css($p, & $toFile) {

function _print_prescription_old($p, & $toFile) {
require_once ($GLOBALS['fileroot'] . "/library/classes/class.ezpdf.php");
$pdf =& new Cezpdf($GLOBALS['oer_config']['prescriptions']['paper_size']);
$pdf->ezSetMargins($GLOBALS['oer_config']['prescriptions']['top']
,$GLOBALS['oer_config']['prescriptions']['bottom']
,$GLOBALS['oer_config']['prescriptions']['left']
,$GLOBALS['oer_config']['prescriptions']['right']
$pdf =& new Cezpdf($GLOBALS['rx_paper_size']);
$pdf->ezSetMargins($GLOBALS['rx_top_margin']
,$GLOBALS['rx_bottom_margin']
,$GLOBALS['rx_left_margin']
,$GLOBALS['rx_right_margin']
);
$pdf->selectFont($GLOBALS['fileroot'] . "/library/fonts/Helvetica.afm");
if(!empty($this->pconfig['logo'])) {
Expand Down
2 changes: 1 addition & 1 deletion interface/globals.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ function undoMagicQuotes($array, $topLevel=true) {
$GLOBALS['style']['HIGHLIGHTCOLOR'] = "#dddddd";
$GLOBALS['style']['BOTTOM_BG_LINE'] = $bottom_bg_line;
// The height in pixels of the Logo bar at the top of the login page:
$GLOBALS['logoBarHeight'] = 110;
$GLOBALS['logoBarHeight'] = 120;
// The height in pixels of the Navigation bar:
$GLOBALS['navBarHeight'] = 22;
// The height in pixels of the Title bar:
Expand Down
10 changes: 5 additions & 5 deletions interface/patient_file/letter.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@
if ($form_format == "pdf") {
// documentation for ezpdf is here --> http://www.ros.co.nz/pdf/
require_once ($GLOBALS['fileroot'] . "/library/classes/class.ezpdf.php");
$pdf =& new Cezpdf($GLOBALS['oer_config']['prescriptions']['paper_size']);
$pdf->ezSetMargins($GLOBALS['oer_config']['prescriptions']['top']
,$GLOBALS['oer_config']['prescriptions']['bottom']
,$GLOBALS['oer_config']['prescriptions']['left']
,$GLOBALS['oer_config']['prescriptions']['right']
$pdf =& new Cezpdf($GLOBALS['rx_paper_size']);
$pdf->ezSetMargins($GLOBALS['rx_top_margin']
,$GLOBALS['rx_bottom_margin']
,$GLOBALS['rx_left_margin']
,$GLOBALS['rx_right_margin']
);
if (file_exists("$template_dir/custom_pdf.php")) {
include("$template_dir/custom_pdf.php");
Expand Down
15 changes: 14 additions & 1 deletion library/classes/Provider.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class Provider extends ORDataObject{
var $federal_drug_id;
var $insurance_numbers;
var $specialty;
var $npi;
var $state_license_number;

/**
* Constructor sets all Prescription attributes to their default value
Expand All @@ -30,20 +32,24 @@ function Provider ($id = "", $prefix = "") {
$this->id = $id;
$this->federal_drug_id = "";
$this->_table = "users";
$this-> npi = "";
$this->insurance_numbers = array();
$this->state_license_number = "";
if ($id != "") {
$this->populate();
}
}

function populate() {
$res = sqlQuery("SELECT fname,lname,federaldrugid, specialty FROM users where id =". mysql_real_escape_string($this->id));
$res = sqlQuery("SELECT fname,lname,federaldrugid, specialty, npi, state_license_number FROM users where id =". mysql_real_escape_string($this->id));

if (is_array($res)) {
$this->lname = $res['lname'];
$this->fname = $res['fname'];
$this->federal_drug_id = $res['federaldrugid'];
$this->specialty = $res['specialty'];
$this->npi = $res['npi'];
$this->state_license_number = $res['state_license_number'];
}

$ins = new InsuranceNumbers();
Expand Down Expand Up @@ -106,6 +112,13 @@ function get_group_number_default() {
if (!empty($this->insurance_numbers)) {
return $this->insurance_numbers[0]->get_group_number();
}
function get_npi() {
return $this->npi;
}

function get_state_license_number() {
return $this->state_license_number;
}
}

} // end of Provider
Expand Down
119 changes: 119 additions & 0 deletions library/globals.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1333,5 +1333,124 @@
xl('Enable import status message for NewCrop erx')
),
),

'Rx' => array(
'rx_enable_DEA' => array(
xl('Rx Enable DEA #'),
'bool', // data type
'1',
xl('Rx Enable DEA #')
),
'rx_show_DEA' => array(
xl('Rx Show DEA #'),
'bool', // data type
'0',
xl('Rx Show DEA #')
),
'rx_enable_NPI' => array(
xl('Rx Enable NPI'),
'bool', // data type
'0',
xl('Rx Enable NPI')
),
'rx_show_NPI' => array(
xl('Rx Show NPI'),
'bool', // data type
'0',
xl('Rx Show NPI')
),
'rx_enable_SLN' => array(
xl('Rx Enable State Lic. #'),
'bool', // data type
'0',
xl('Rx Enable State Lic. #')
),
'rx_show_SLN' => array(
xl('Rx Show State Lic. #'),
'bool', // data type
'0',
xl('Rx Show State Lic. #')
),
'rx_paper_size' => array(
xl('Rx Paper Size'), // descriptive name
array(
'LETTER' => xl('Letter Paper Size'),
'LEGAL' => xl('Legal Paper Size'),
'FOLIO' => xl('Folio Paper Size'),
'EXECUTIVE' => xl('Executive Paper Size'),
'4A0' => ('4A0' . " " . xl('Paper Size')),
'2A0' => ('2A0' . " " . xl('Paper Size')),
'A0' => ('A0' . " " . xl('Paper Size')),
'A1' => ('A1' . " " . xl('Paper Size')),
'A2' => ('A2' . " " . xl('Paper Size')),
'A3' => ('A3' . " " . xl('Paper Size')),
'A4' => ('A4' . " " . xl('Paper Size')),
'A5' => ('A5' . " " . xl('Paper Size')),
'A6' => ('A6' . " " . xl('Paper Size')),
'A7' => ('A7' . " " . xl('Paper Size')),
'A8' => ('A8' . " " . xl('Paper Size')),
'A9' => ('A9' . " " . xl('Paper Size')),
'A10' => ('A10' . " " . xl('Paper Size')),
'B0' => ('B0' . " " . xl('Paper Size')),
'B1' => ('B1' . " " . xl('Paper Size')),
'B2' => ('B2' . " " . xl('Paper Size')),
'B3' => ('B3' . " " . xl('Paper Size')),
'B4' => ('B4' . " " . xl('Paper Size')),
'B5' => ('B5' . " " . xl('Paper Size')),
'B6' => ('B6' . " " . xl('Paper Size')),
'B7' => ('B7' . " " . xl('Paper Size')),
'B8' => ('B8' . " " . xl('Paper Size')),
'B9' => ('B9' . " " . xl('Paper Size')),
'B10' => ('B10' . " " . xl('Paper Size')),
'C0' => ('C0' . " " . xl('Paper Size')),
'C1' => ('C1' . " " . xl('Paper Size')),
'C2' => ('C2' . " " . xl('Paper Size')),
'C3' => ('C3' . " " . xl('Paper Size')),
'C4' => ('C4' . " " . xl('Paper Size')),
'C5' => ('C5' . " " . xl('Paper Size')),
'C6' => ('C6' . " " . xl('Paper Size')),
'C7' => ('C7' . " " . xl('Paper Size')),
'C8' => ('C8' . " " . xl('Paper Size')),
'C9' => ('C9' . " " . xl('Paper Size')),
'C10' => ('C10' . " " . xl('Paper Size')),
'RA0' => ('RA0' . " " . xl('Paper Size')),
'RA1' => ('RA1' . " " . xl('Paper Size')),
'RA2' => ('RA2' . " " . xl('Paper Size')),
'RA3' => ('RA3' . " " . xl('Paper Size')),
'RA4' => ('RA4' . " " . xl('Paper Size')),
'SRA0' => ('SRA0' . " " . xl('Paper Size')),
'SRA1' => ('SRA1' . " " . xl('Paper Size')),
'SRA2' => ('SRA2' . " " . xl('Paper Size')),
'SRA3' => ('SRA3' . " " . xl('Paper Size')),
'SRA4' => ('SRA4' . " " . xl('Paper Size')),
),
'LETTER', // default = tree menu
xl('Rx Paper Size')
),
'rx_left_margin' => array(
xl('Rx Left Margin (px)'),
'num',
'30',
xl('Rx Left Margin (px)')
),
'rx_right_margin' => array(
xl('Rx Right Margin (px)'),
'num',
'30',
xl('Rx Right Margin (px)')
),
'rx_top_margin' => array(
xl('Rx Top Margin (px)'),
'num',
'72',
xl('Rx Top Margin (px)')
),
'rx_bottom_margin' => array(
xl('Rx Bottom Margin (px)'),
'num',
'30',
xl('Rx Bottom Margin (px)')
),
),
);
?>
25 changes: 0 additions & 25 deletions sites/default/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
// ------------------------------------------------------------------------ //

// To use RelayHealth, Call 888-PHYAURA (749-2872) and press 1 to Sign-up
// for the service and receive your Client ID. Then you may uncomment
// and alter the following as appropriate.
//
// $GLOBALS['ssi']['rh']['ApplicationName'] = 'PhyauraSSI';
// $GLOBALS['ssi']['rh']['PartnerName'] = 'Phyaura';
// $GLOBALS['ssi']['rh']['location'] = 'https://api.integration.relayhealth.com/SSI/SingleSignIn.svc';
// $GLOBALS['ssi']['rh']['wsdl'] = 'https://api.integration.relayhealth.com/SSI/SingleSignIn.svc?wsdl';

$GLOBALS['oer_config']['freeb']['claim_file_dir'] = "/usr/share/freeb/public/";
//currently can be pdf or txt
$GLOBALS['oer_config']['freeb']['default_format'] = "pdf";
Expand All @@ -56,9 +47,6 @@
//use FL for FLORIDA compatible format, leave blank for default
$GLOBALS['oer_config']['prescriptions']['format'] = "";

// Set this to true if you want the drug DEA number printed on prescriptions by default
$GLOBALS['oer_config']['prescriptions']['show_DEA'] = false;

// Document storage repository document root. Must include a trailing slash.
$GLOBALS['oer_config']['documents']['repopath'] = $GLOBALS['OE_SITE_DIR'] . "/documents/";
$GLOBALS['oer_config']['documents']['file_command_path'] = "/usr/bin/file";
Expand Down Expand Up @@ -88,19 +76,6 @@
// i.e. 9, will dial 9 for external tone, and wait a second.
$GLOBALS['oer_config']['prescriptions']['prefix'] = '';

// select paper size for prescription printing
// see library/classes/class.ezpdf.php for complete list of paper sizes
// ex. "LETTER", "A4", "LEGAL" ...
$GLOBALS['oer_config']['prescriptions']['paper_size'] = "LETTER";

// change page margins for prescription printing
// note, values are in pixels (72 dots per inch)
// to convert from centimeters use the following: (centimeters / 2.54 ) * 72;
$GLOBALS['oer_config']['prescriptions']['left'] = 30;
$GLOBALS['oer_config']['prescriptions']['right'] = 30;
$GLOBALS['oer_config']['prescriptions']['top'] = 72;
$GLOBALS['oer_config']['prescriptions']['bottom'] = 30;

// Similarly for bottle labels if you are dispensing drugs. Note that paper
// size here or for prescriptions may be an array (0, 0, width, height).
// As above, these measurements are in points.
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
// is a database change in the course of development. It is used
// internally to determine when a database upgrade is needed.
//
$v_database = 47;
$v_database = 48;
?>

0 comments on commit b412e36

Please sign in to comment.