From 9c4a08cc76809bf8b0b19ad73e0eaa1c0cb3ae1b Mon Sep 17 00:00:00 2001 From: Rod Roark Date: Fri, 2 Oct 2015 21:58:33 -0700 Subject: [PATCH] Support for optional logging of print actions. --- controllers/C_Prescription.class.php | 2 +- interface/billing/indigent_patients_report.php | 9 ++++- interface/billing/sl_receipts_report.php | 10 ++++- interface/drugs/dispense_drug.php | 3 +- interface/forms/CAMOS/notegen.php | 3 +- interface/forms/CAMOS/rx_print.php | 3 +- interface/forms/LBF/printable.php | 3 +- interface/forms/aftercare_plan/new.php | 15 +++++-- interface/forms/note/print.php | 4 +- interface/forms/transfer_summary/new.php | 13 +++++- interface/forms/treatment_plan/new.php | 18 ++++++--- interface/forms/vitals/growthchart/chart.php | 9 +++-- interface/logview/logview.php | 2 +- .../default/views/day_print/ajax_template.html | 3 +- .../views/day_print/outlook_ajax_template.html | 3 +- .../default/views/month_print/ajax_template.html | 3 +- .../views/month_print/outlook_ajax_template.html | 3 +- .../default/views/week_print/ajax_template.html | 3 +- .../views/week_print/outlook_ajax_template.html | 3 +- interface/main/finder/patient_select.php | 4 +- interface/main/main_screen.php | 1 + .../zend_modules/public/js/scripts/immunization.js | 4 +- interface/orders/pending_followup.php | 11 ++++- interface/orders/pending_orders.php | 13 +++++- interface/orders/procedure_stats.php | 3 +- interface/patient_file/front_payment.php | 16 +++++--- interface/patient_file/pos_checkout.php | 12 ++++-- interface/patient_file/printed_fee_sheet.php | 17 +++++--- .../patient_file/summary/create_portallogin.php | 2 +- .../patient_file/summary/demographics_print.php | 4 +- interface/patient_file/summary/pnotes_print.php | 2 +- .../patient_file/summary/print_amendments.php | 2 +- interface/patient_file/summary/shot_record.php | 2 +- interface/reports/amc_tracking.php | 7 +++- interface/reports/appointments_report.php | 7 +++- interface/reports/appt_encounter_report.php | 15 ++++++- interface/reports/chart_location_activity.php | 11 ++++- interface/reports/clinical_reports.php | 9 ++++- interface/reports/collections_report.php | 8 +++- interface/reports/cqm.php | 7 +++- interface/reports/custom_report_range.php | 10 ++++- interface/reports/destroyed_drugs_report.php | 9 ++++- interface/reports/encounters_report.php | 7 +++- interface/reports/front_receipts_report.php | 9 ++++- interface/reports/immunization_report.php | 8 +++- interface/reports/insurance_allocation_report.php | 8 +++- interface/reports/inventory_activity.php | 14 ++++++- interface/reports/inventory_list.php | 10 ++++- interface/reports/inventory_transactions.php | 12 +++++- interface/reports/ippf_cyp_report.php | 11 ++++- interface/reports/ippf_daily.php | 3 +- interface/reports/ippf_statistics.php | 5 ++- interface/reports/non_reported.php | 12 +++++- interface/reports/patient_flow_board_report.php | 7 +++- interface/reports/patient_list.php | 9 ++++- interface/reports/prescriptions_report.php | 9 ++++- interface/reports/receipts_by_method_report.php | 14 +++++-- interface/reports/referrals_report.php | 7 +++- interface/reports/sales_by_item.php | 15 +++++-- interface/reports/services_by_category.php | 11 ++++- interface/reports/svc_code_financial_report.php | 14 ++++++- interface/reports/unique_seen_patients_report.php | 11 ++++- library/ajax/log_print_action_ajax.php | 30 ++++++++++++++ library/globals.inc.php | 11 +++++ library/restoreSession.php | 47 ++++++++++++++++++++++ sites/default/referral_template.html | 3 +- 66 files changed, 465 insertions(+), 110 deletions(-) create mode 100644 library/ajax/log_print_action_ajax.php diff --git a/controllers/C_Prescription.class.php b/controllers/C_Prescription.class.php index 75612cb81..72f3b0f6c 100644 --- a/controllers/C_Prescription.class.php +++ b/controllers/C_Prescription.class.php @@ -485,7 +485,7 @@ class C_Prescription extends Controller { function multiprintcss_postfooter() { echo("\n"); echo("\n"); echo("\n"); diff --git a/interface/billing/indigent_patients_report.php b/interface/billing/indigent_patients_report.php index fc64eadeb..911463c7c 100644 --- a/interface/billing/indigent_patients_report.php +++ b/interface/billing/indigent_patients_report.php @@ -1,5 +1,5 @@ +// Copyright (C) 2005-2015 Rod Roark // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -63,6 +63,11 @@ if (!$INTEGRATED_AR) SLConnect(); @@ -122,7 +127,7 @@ if (!$INTEGRATED_AR) SLConnect(); - + diff --git a/interface/billing/sl_receipts_report.php b/interface/billing/sl_receipts_report.php index 83602a5cb..034990608 100644 --- a/interface/billing/sl_receipts_report.php +++ b/interface/billing/sl_receipts_report.php @@ -105,8 +105,15 @@ require_once($GLOBALS['fileroot'].'/custom/code_types.inc.php'); } + - diff --git a/interface/forms/CAMOS/notegen.php b/interface/forms/CAMOS/notegen.php index f4c312b58..fbbaafc90 100755 --- a/interface/forms/CAMOS/notegen.php +++ b/interface/forms/CAMOS/notegen.php @@ -228,7 +228,8 @@ if ($_POST['submit_pdf'] || $_POST['submit_html'] || ($_GET['pid'] && $_GET['enc } ?> diff --git a/interface/forms/CAMOS/rx_print.php b/interface/forms/CAMOS/rx_print.php index 015c80607..15c25ca1f 100755 --- a/interface/forms/CAMOS/rx_print.php +++ b/interface/forms/CAMOS/rx_print.php @@ -353,7 +353,8 @@ else { print ""; ?> diff --git a/interface/forms/LBF/printable.php b/interface/forms/LBF/printable.php index 03871eb37..4aac746e8 100644 --- a/interface/forms/LBF/printable.php +++ b/interface/forms/LBF/printable.php @@ -201,7 +201,8 @@ end_group(); diff --git a/interface/forms/aftercare_plan/new.php b/interface/forms/aftercare_plan/new.php index 1a954df98..306bbf49d 100644 --- a/interface/forms/aftercare_plan/new.php +++ b/interface/forms/aftercare_plan/new.php @@ -49,6 +49,15 @@ $obj = $formid ? formFetch("form_aftercare_plan", $formid) : array(); + + + +

@@ -176,9 +185,9 @@ echo "
- ' class="button-css">  -  - ' + ' class='button-css' />  + ' id='printbutton' class='button-css' />  + ' onclick="top.restoreSession();location=''" /> diff --git a/interface/forms/note/print.php b/interface/forms/note/print.php index d7a90cb2b..e953f23c8 100644 --- a/interface/forms/note/print.php +++ b/interface/forms/note/print.php @@ -63,8 +63,8 @@ if ($obj['date_of_signature'] != "") { // jQuery stuff to make the page a little easier to use $(document).ready(function(){ - window.print(); - window.close(); + var win = top.printLogPrint ? top : opener.top; + if (win.printLogPrint(window)) window.close(); }); diff --git a/interface/forms/transfer_summary/new.php b/interface/forms/transfer_summary/new.php index 20ca2ad61..6c326587e 100644 --- a/interface/forms/transfer_summary/new.php +++ b/interface/forms/transfer_summary/new.php @@ -47,6 +47,15 @@ $obj = $formid ? formFetch("form_transfer_summary", $formid) : array(); + + + + @@ -142,8 +151,8 @@ echo " ' class="button-css">  -   - ' + ' id='printbutton' />  + ' onclick="top.restoreSession();location=''" /> diff --git a/interface/forms/treatment_plan/new.php b/interface/forms/treatment_plan/new.php index 71c6bab4b..b73026408 100644 --- a/interface/forms/treatment_plan/new.php +++ b/interface/forms/treatment_plan/new.php @@ -34,7 +34,6 @@ $returnurl = $GLOBALS['concurrent_layout'] ? 'encounter_top.php' : 'patient_enco $formid = 0 + (isset($_GET['id']) ? $_GET['id'] : ''); $obj = $formid ? formFetch("form_treatment_plan", $formid) : array(); - // Get the providers list. $ures = sqlStatement("SELECT id, username, fname, lname FROM users WHERE " . "authorized != 0 AND active = 1 ORDER BY lname, fname"); @@ -50,6 +49,15 @@ $obj = $formid ? formFetch("form_treatment_plan", $formid) : array(); + + + +

@@ -86,10 +94,7 @@ echo " - - - - : + :
- + diff --git a/interface/reports/appointments_report.php b/interface/reports/appointments_report.php index 6a803076d..399e519c3 100644 --- a/interface/reports/appointments_report.php +++ b/interface/reports/appointments_report.php @@ -108,6 +108,11 @@ function fetch_reminders($pid, $appt_date) { var mypcc = ''; + $(document).ready(function() { + var win = top.printLogSetup ? top : opener.top; + win.printLogSetup(document.getElementById('printbutton')); + }); + function dosort(orderby) { var f = document.forms[0]; f.form_orderby.value = orderby; @@ -274,7 +279,7 @@ function fetch_reminders($pid, $appt_date) { - + diff --git a/interface/reports/appt_encounter_report.php b/interface/reports/appt_encounter_report.php index bff772b8e..730c4976d 100644 --- a/interface/reports/appt_encounter_report.php +++ b/interface/reports/appt_encounter_report.php @@ -172,6 +172,18 @@ function postError($msg) { <?php xl('Appointments and Encounters','e'); ?> + + + + + @@ -261,7 +273,7 @@ function postError($msg) { - + @@ -507,7 +519,6 @@ function postError($msg) { - + + @@ -127,7 +134,7 @@ if (!empty($ptrow)) { - + diff --git a/interface/reports/clinical_reports.php b/interface/reports/clinical_reports.php index 696e16121..71ed22423 100644 --- a/interface/reports/clinical_reports.php +++ b/interface/reports/clinical_reports.php @@ -75,6 +75,11 @@ $fake_register_globals=false; var mypcc = ''; + $(document).ready(function() { + var win = top.printLogSetup ? top : opener.top; + win.printLogSetup(document.getElementById('printbutton')); + }); + function toggle(id) { var tr = document.getElementById(id); if (tr==null) { return; } @@ -342,8 +347,8 @@ Search options include diagnosis, procedure, prescription, medical history, and - - + + diff --git a/interface/reports/collections_report.php b/interface/reports/collections_report.php index 90e78a70d..c1e31a5f5 100644 --- a/interface/reports/collections_report.php +++ b/interface/reports/collections_report.php @@ -299,8 +299,15 @@ else { + + - + + - @@ -65,7 +70,7 @@   >   - ' onclick='window.print()' /> + ' id='printbutton' /> diff --git a/interface/reports/encounters_report.php b/interface/reports/encounters_report.php index 92910ce3c..5ebf797d8 100644 --- a/interface/reports/encounters_report.php +++ b/interface/reports/encounters_report.php @@ -175,6 +175,11 @@ $res = sqlStatement($query); var mypcc = ''; + $(document).ready(function() { + var win = top.printLogSetup ? top : opener.top; + win.printLogSetup(document.getElementById('printbutton')); + }); + function dosort(orderby) { var f = document.forms[0]; f.form_orderby.value = orderby; @@ -303,7 +308,7 @@ $res = sqlStatement($query); - + diff --git a/interface/reports/front_receipts_report.php b/interface/reports/front_receipts_report.php index 72acd2d4e..a7ff1e7e2 100644 --- a/interface/reports/front_receipts_report.php +++ b/interface/reports/front_receipts_report.php @@ -1,5 +1,5 @@ + // Copyright (C) 2006-2015 Rod Roark // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -34,6 +34,11 @@ require_once("$srcdir/formatting.inc.php"); var mypcc = ''; + $(document).ready(function() { + var win = top.printLogSetup ? top : opener.top; + win.printLogSetup(document.getElementById('printbutton')); + }); + // The OnClick handler for receipt display. function show_receipt(pid,timestamp) { dlgopen('../patient_file/front_payment.php?receipt=1&patient=' + pid + @@ -131,7 +136,7 @@ require_once("$srcdir/formatting.inc.php"); - + diff --git a/interface/reports/immunization_report.php b/interface/reports/immunization_report.php index 91ae89235..f1813c8c5 100644 --- a/interface/reports/immunization_report.php +++ b/interface/reports/immunization_report.php @@ -250,6 +250,12 @@ if ($_POST['form_get_hl7']==='true') { @@ -369,7 +375,7 @@ onsubmit='return top.restoreSession()'> - + diff --git a/interface/reports/insurance_allocation_report.php b/interface/reports/insurance_allocation_report.php index 7a429f7fa..327b11a31 100644 --- a/interface/reports/insurance_allocation_report.php +++ b/interface/reports/insurance_allocation_report.php @@ -48,6 +48,12 @@ else { @@ -141,7 +147,7 @@ else { - + diff --git a/interface/reports/inventory_activity.php b/interface/reports/inventory_activity.php index 706a7f1ff..15569abd4 100644 --- a/interface/reports/inventory_activity.php +++ b/interface/reports/inventory_activity.php @@ -1,5 +1,5 @@ +// Copyright (C) 2015 Rod Roark // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -384,14 +384,24 @@ else { + + @@ -484,7 +494,7 @@ echo " \n"; - + diff --git a/interface/reports/inventory_list.php b/interface/reports/inventory_list.php index 22520bcde..695f0e4aa 100644 --- a/interface/reports/inventory_list.php +++ b/interface/reports/inventory_list.php @@ -75,14 +75,22 @@ a, a:visited, a:hover { color:#0000cc; } + @@ -119,7 +127,7 @@ a, a:visited, a:hover { color:#0000cc; } - + diff --git a/interface/reports/inventory_transactions.php b/interface/reports/inventory_transactions.php index 5d98c0de7..538359c1a 100644 --- a/interface/reports/inventory_transactions.php +++ b/interface/reports/inventory_transactions.php @@ -1,5 +1,5 @@ +// Copyright (C) 2010-2015 Rod Roark // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -194,14 +194,22 @@ else { + @@ -278,7 +286,7 @@ foreach (array( - + diff --git a/interface/reports/ippf_cyp_report.php b/interface/reports/ippf_cyp_report.php index b6394e003..35320ea5e 100644 --- a/interface/reports/ippf_cyp_report.php +++ b/interface/reports/ippf_cyp_report.php @@ -148,6 +148,15 @@ else { // not export <?php xl('CYP Report','e') ?> + + + + @@ -195,7 +204,7 @@ else { // not export     - ' onclick='window.print()' /> + ' id='printbutton' /> diff --git a/interface/reports/ippf_daily.php b/interface/reports/ippf_daily.php index be8557404..9111facab 100644 --- a/interface/reports/ippf_daily.php +++ b/interface/reports/ippf_daily.php @@ -338,7 +338,8 @@ if ($form_output != 3) { diff --git a/interface/reports/ippf_statistics.php b/interface/reports/ippf_statistics.php index 9b264e9d5..1af3ce482 100644 --- a/interface/reports/ippf_statistics.php +++ b/interface/reports/ippf_statistics.php @@ -1,5 +1,5 @@ +// Copyright (C) 2008-2015 Rod Roark // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -1589,7 +1589,8 @@ foreach (array(1 => 'Screen', 2 => 'Printer', 3 => 'Export File') as $key => $va Calendar.setup({inputField:"form_from_date", ifFormat:"%Y-%m-%d", button:"img_from_date"}); Calendar.setup({inputField:"form_to_date", ifFormat:"%Y-%m-%d", button:"img_to_date"}); - window.print(); + var win = top.printLogPrint ? top : opener.top; + win.printLogPrint(window); diff --git a/interface/reports/non_reported.php b/interface/reports/non_reported.php index 815b2b952..7bf712c9f 100644 --- a/interface/reports/non_reported.php +++ b/interface/reports/non_reported.php @@ -244,8 +244,16 @@ if ($_POST['form_get_hl7']==='true') { + @@ -369,9 +377,9 @@ onsubmit='return top.restoreSession()'> - + - + '; + $(document).ready(function() { + var win = top.printLogSetup ? top : opener.top; + win.printLogSetup(document.getElementById('printbutton')); + }); + function dosort(orderby) { var f = document.forms[0]; f.form_orderby.value = orderby; @@ -278,7 +283,7 @@ if ($form_patient == '' ) $form_pid = ''; - + diff --git a/interface/reports/patient_list.php b/interface/reports/patient_list.php index bad85d897..f1181e390 100644 --- a/interface/reports/patient_list.php +++ b/interface/reports/patient_list.php @@ -1,5 +1,5 @@ + // Copyright (C) 2006-2015 Rod Roark // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -51,6 +51,11 @@ else { + + <?xl('Receipts Summary','e')?> @@ -323,7 +332,7 @@ function sel_procedure() { - + @@ -673,7 +682,6 @@ if (!$INTEGRATED_AR) SLClose(); - + + + @@ -282,7 +292,7 @@ function thisLineItem($patient_id, $encounter_id, $rowcat, $description, $transd - + @@ -495,7 +505,6 @@ function thisLineItem($patient_id, $encounter_id, $rowcat, $description, $transd - + + @@ -113,7 +120,7 @@ if (empty($_REQUEST['include_uncat'])) - + diff --git a/interface/reports/svc_code_financial_report.php b/interface/reports/svc_code_financial_report.php index e8597524a..768d32450 100644 --- a/interface/reports/svc_code_financial_report.php +++ b/interface/reports/svc_code_financial_report.php @@ -8,7 +8,7 @@ * Administration->Service section by assigning code with * 'Service Reporting'. * - * Copyright (C) 2006-2010 Rod Roark + * Copyright (C) 2006-2015 Rod Roark * * LICENSE: This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -102,6 +102,16 @@ $grand_total_amt_balance = 0; <?php echo xlt('Financial Summary by Service Code') ?> + + + - @@ -179,7 +189,7 @@ $grand_total_amt_balance = 0;
- + diff --git a/interface/reports/unique_seen_patients_report.php b/interface/reports/unique_seen_patients_report.php index 3ea8eb7bc..b84f0861d 100644 --- a/interface/reports/unique_seen_patients_report.php +++ b/interface/reports/unique_seen_patients_report.php @@ -1,5 +1,5 @@ + // Copyright (C) 2006-2015 Rod Roark // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -61,7 +61,14 @@ require_once("$srcdir/formatting.inc.php"); @@ -152,7 +159,7 @@ require_once("$srcdir/formatting.inc.php"); - + diff --git a/library/ajax/log_print_action_ajax.php b/library/ajax/log_print_action_ajax.php new file mode 100644 index 000000000..45552152e --- /dev/null +++ b/library/ajax/log_print_action_ajax.php @@ -0,0 +1,30 @@ + + * + * LICENSE: This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * @package OpenEMR + * @author Rod Roark + * @link http://www.open-emr.org + */ + +// AJAX handler for logging a printing action. + +$fake_register_globals = false; +$sanitize_all_escapes = true; + +require_once("../../interface/globals.php"); +require_once("$srcdir/log.inc"); + +newEvent("print", $_SESSION['authUser'], $_SESSION['authProvider'], 1, strip_tags($_POST['comments'])); +?> diff --git a/library/globals.inc.php b/library/globals.inc.php index 4c4177a1d..0c33e0106 100644 --- a/library/globals.inc.php +++ b/library/globals.inc.php @@ -1489,6 +1489,17 @@ $GLOBALS_METADATA = array( xl('Billing log setting to append or overwrite the log file.') ), + 'gbl_print_log_option' => array( + xl('Printing Log Option'), + array( + '0' => xl('No logging'), + '1' => xl('Hide print feature where not implemented'), + '2' => xl('Log entire document where not implemented'), + ), + '0', // default + xl('How to handle printer logging.') + ), + ), // Miscellaneous Tab diff --git a/library/restoreSession.php b/library/restoreSession.php index 01d2f0c5c..3546586e3 100644 --- a/library/restoreSession.php +++ b/library/restoreSession.php @@ -23,3 +23,50 @@ function restoreSession() { return true; } + +// Pages that have a Print button or link should call this to initialize it for logging. +// This is done at page load time in case we want to hide or disable the element. +// +function printLogSetup(elem, logdata) { + if (elem == null) return; + var doc = elem.ownerDocument; + var win = doc.defaultView || doc.parentWindow; + if (typeof(logdata) == 'undefined') logdata = null; + + if (logdata == null) { + elem.style.display = 'none'; + return; + } + + win.printlogdata = logdata; + elem.onclick = function () { + // This is a function definition and variables here will be evaluated when the function executes. + top.printLogPrint(this); + } +} + +// Pages that would otherwise call window.print() at load time should call this instead +// to support print logging. In this case the passed argument is normally the window and +// data to log, if specified, should be in the caller's window.printlogdata. +// +function printLogPrint(elem) { + var win = elem; + if (elem.ownerDocument) { + var doc = elem.ownerDocument; + win = doc.defaultView || doc.parentWindow; + } + + // Returning false means we didn't print. + if (!win.printlogdata) return false; + + if (win.printlog_before_print) win.printlog_before_print(); + win.print(); + + comments = win.printlogdata || win.document.body.innerHTML; + top.restoreSession(); + $.post("/library/ajax/log_print_action_ajax.php", + { comments: comments } + ); + + return true; +} diff --git a/sites/default/referral_template.html b/sites/default/referral_template.html index 4ddebc4df..ceb6d9bc0 100644 --- a/sites/default/referral_template.html +++ b/sites/default/referral_template.html @@ -376,7 +376,8 @@ -- 2.11.4.GIT