Highway to PSR2
[openemr.git] / library / classes / rulesets / Amc / reports / AMC_314g_1_2_14_STG2 / Numerator.php
blob5afe712b88bbe2da9c08219cbe7747bd16a0e50f
1 <?php
2 /**
4 * AMC 314g_1_2_14 STAGE2 Numerator
6 * Copyright (C) 2015 Ensoftek, Inc
8 * LICENSE: This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
19 * @package OpenEMR
20 * @author Ensoftek
21 * @link http://www.open-emr.org
24 class AMC_314g_1_2_14_STG2_Numerator implements AmcFilterIF
26 public function getTitle()
28 return "AMC_314g_1_2_14_STG2 Numerator";
31 public function test(AmcPatient $patient, $beginDate, $endDate)
33 // Need to meet following criteria:
34 // -Offsite patient portal is turned on.
35 // -Patient permits having access to the patient portal.
36 // -Patient has an account on the offsite patient portal.
38 if ($GLOBALS['portal_offsite_enable'] != 1) {
39 return false;
42 $portal_permission = sqlQuery("SELECT `allow_patient_portal` FROM `patient_data` WHERE pid = ?", array($patient->id));
43 if ($portal_permission['allow_patient_portal'] != "YES") {
44 return false;
47 $portalQry = "SELECT count(*) as cnt FROM `patient_access_offsite` WHERE pid=?";
48 $check = sqlQuery($portalQry, array($patient->id));
49 if ($check['cnt'] > 0) {
50 return true;
51 } else {
52 return false;