Adding module manager (#7500)
[openemr.git] / interface / batchcom / batch_reminders.php
blob809546798cfcb8f2a74d003b3a54040be676d9ec
1 <?php
3 /**
4 * To be run by cron hourly, sending phone reminders
6 * @package OpenEMR
7 * @link http://www.open-emr.org
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @author Jason 'Toolbox' Oettinger <jason@oettinger.email>
10 * @author Robert Down <robertdown@live.com>
11 * @copyright Copyright (c) 2012 Brady Miller <brady.g.miller@gmail.com>
12 * @copyright Copyright (c) 2017 Jason 'Toolbox' Oettinger <jason@oettinger.email>
13 * @copyright Copyright (c) 2017-2023 Robert Down <robertdown@live.com>
14 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
17 require_once(dirname(__FILE__) . "/../../interface/globals.php");
18 require_once($GLOBALS['srcdir'] . "/maviq_phone_api.php");
19 require_once($GLOBALS['srcdir'] . "/reminders.php");
20 require_once($GLOBALS['srcdir'] . "/report_database.inc.php");
22 use OpenEMR\Core\Header;
24 //Remove time limit, since script can take many minutes
25 set_time_limit(0);
27 // If report_id, then just going to show the report log
28 $report_id = ($_GET['report_id']) ? $_GET['report_id'] : "";
30 // Set the "nice" level of the process for this script when. When the "nice" level
31 // is increased, this cpu intensive script will have less affect on the performance
32 // of other server activities, albeit it may negatively impact the performance
33 // of this script (note this is only applicable for linux).
34 if (empty($report_id) && !empty($GLOBALS['pat_rem_clin_nice'])) {
35 proc_nice($GLOBALS['pat_rem_clin_nice']);
39 <html>
40 <head>
41 <?php Header::setupHeader(); ?>
42 <title><?php echo xlt('Patient Reminder Batch Job') ?></title>
43 </head>
44 <body class="body_top container">
45 <header class="row">
46 <?php require_once("batch_navigation.php");?>
47 <h1 class="col-md-12">
48 <a href="batchcom.php"><?php echo xlt('Batch Communication Tool'); ?></a>
49 <small><?php echo xlt('Patient Reminder Batch Job'); ?></small>
50 </h1>
51 </header>
52 <?php
53 // Collect the sender information
54 // TODO
55 // $sender_name
56 // $email_address
59 <main class="row mx-4">
60 <div class="col-md-12">
61 <table class="table table-striped table-bordered">
62 <tr>
63 <td class='text' align='left' colspan="3"><br />
65 <?php
66 if ($report_id) {
67 // collect log from a previous run to show
68 $results_log = collectReportDatabase($report_id);
69 $data_log = json_decode($results_log['data'], true);
70 $update_rem_log = $data_log[0];
71 if ($results_log['type'] == "process_send_reminders") {
72 $send_rem_log = $data_log[1];
75 echo "<span class='text'>" . xlt("Date of Report") . ": " . text($results_log['date_report']) . "</span><br /><br />";
76 } else {
77 $update_rem_log = update_reminders_batch_method();
78 $send_rem_log = send_reminders();
82 <span class="text"><?php echo xlt('The patient reminders have been updated') . ":"?></span><br />
83 <span class="text"><?php echo xlt('Total active actions') . ": " . text($update_rem_log['total_active_actions']); ?></span><br />
84 <span class="text"><?php echo xlt('Total active reminders before update') . ": " . text($update_rem_log['total_pre_active_reminders']); ?></span><br />
85 <span class="text"><?php echo xlt('Total unsent reminders before update') . ": " . text($update_rem_log['total_pre_unsent_reminders']); ?></span><br />
86 <span class="text"><?php echo xlt('Total active reminders after update') . ": " . text($update_rem_log['total_post_active_reminders']); ?></span><br />
87 <span class="text"><?php echo xlt('Total unsent reminders after update') . ": " . text($update_rem_log['total_post_unsent_reminders']); ?></span><br />
88 <span class="text"><?php echo xlt('Total new reminders') . ": " . text($update_rem_log['number_new_reminders']); ?></span><br />
89 <span class="text"><?php echo xlt('Total updated reminders') . ": " . text($update_rem_log['number_updated_reminders']); ?></span><br />
90 <span class="text"><?php echo xlt('Total inactivated reminders') . ": " . text($update_rem_log['number_inactivated_reminders']); ?></span><br />
91 <span class="text"><?php echo xlt('Total unchanged reminders') . ": " . text($update_rem_log['number_unchanged_reminders']); ?></span><br />
93 <?php if ($results_log['type'] != "process_reminders") { ?>
94 <br /><span class="text"><?php echo xlt('The patient reminders have been sent') . ":"?></span><br />
95 <span class="text"><?php echo xlt('Total unsent reminders before sending process') . ": " . text($send_rem_log['total_pre_unsent_reminders']); ?></span><br />
96 <span class="text"><?php echo xlt('Total unsent reminders after sending process') . ": " . text($send_rem_log['total_post_unsent_reminders']); ?></span><br />
97 <span class="text"><?php echo xlt('Total successful reminders sent via email') . ": " . text($send_rem_log['number_success_emails']); ?></span><br />
98 <span class="text"><?php echo xlt('Total failed reminders sent via email') . ": " . text($send_rem_log['number_failed_emails']); ?></span><br />
99 <span class="text"><?php echo xlt('Total successful reminders sent via phone') . ": " . text($send_rem_log['number_success_calls']); ?></span><br />
100 <span class="text"><?php echo xlt('Total failed reminders sent via phone') . ": " . text($send_rem_log['number_unchanged_reminders'] ?? ''); ?></span><br />
102 <br /><span class="text"><?php echo xlt('(Email delivery is immediate, while automated VOIP is sent to the service provider for further processing.)')?></span><br />
103 <?php } // end of ($results_log['type'] != "process_reminders") ?>
105 <?php if ($report_id) { ?>
106 <br /><input type="button" value="<?php echo xlt('Back'); ?>" onClick="top.restoreSession(); window.open('../reports/report_results.php','_self',false)"><br /><br /><br />
107 <?php } else { ?>
108 <input type="button" value="<?php echo xlt('Close'); ?>" onClick="window.close()">
109 <?php } ?>
110 </td>
111 </tr>
112 </table>
113 </div>
114 </main>
115 </body>
116 </html>