2 /** @package Openemr::Reporter */
6 * Copyright (C) 2016-2017 Jerry Padgett <sjpadgett@gmail.com>
8 * LICENSE: This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Affero General Public License as
10 * published by the Free Software Foundation, either version 3 of the
11 * License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
18 * You should have received a copy of the GNU Affero General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 * @author Jerry Padgett <sjpadgett@gmail.com>
23 * @link http://www.open-emr.org
26 /** import supporting libraries */
27 require_once("verysimple/Phreeze/Reporter.php");
30 * This is an example Reporter based on the User object. The reporter object
31 * allows you to run arbitrary queries that return data which may or may not fith within
32 * the data access API. This can include aggregate data or subsets of data.
34 * Note that Reporters are read-only and cannot be used for saving data.
36 * @package Openemr::Model::DAO
37 * @author ClassBuilder
40 class UserReporter
extends Reporter
43 // the properties in this class must match the columns returned by GetCustomQuery().
44 // 'CustomFieldExample' is an example that is not part of the `users` table
45 public $CustomFieldExample;
57 public $Federaldrugid;
91 public $SsiRelayhealth;
94 public $PwdExpirationDate;
97 public $DefaultWarehouse;
99 public $StateLicenseNumber;
100 public $NewcropUserRole;
102 public $PhysicianType;
105 * GetCustomQuery returns a fully formed SQL statement. The result columns
106 * must match with the properties of this reporter object.
108 * @see Reporter::GetCustomQuery
109 * @param Criteria $criteria
110 * @return string SQL statement
112 static function GetCustomQuery($criteria)
115 'custom value here...' as CustomFieldExample
117 ,`users`.`username` as Username
118 ,`users`.`password` as Password
119 ,`users`.`authorized` as Authorized
120 ,`users`.`info` as Info
121 ,`users`.`source` as Source
122 ,`users`.`fname` as Fname
123 ,`users`.`mname` as Mname
124 ,`users`.`lname` as Lname
125 ,`users`.`federaltaxid` as Federaltaxid
126 ,`users`.`federaldrugid` as Federaldrugid
127 ,`users`.`upin` as Upin
128 ,`users`.`facility` as Facility
129 ,`users`.`facility_id` as FacilityId
130 ,`users`.`see_auth` as SeeAuth
131 ,`users`.`active` as Active
132 ,`users`.`npi` as Npi
133 ,`users`.`title` as Title
134 ,`users`.`specialty` as Specialty
135 ,`users`.`billname` as Billname
136 ,`users`.`email` as Email
137 ,`users`.`email_direct` as EmailDirect
138 ,`users`.`url` as EserUrl
139 ,`users`.`assistant` as Assistant
140 ,`users`.`organization` as Organization
141 ,`users`.`valedictory` as Valedictory
142 ,`users`.`street` as Street
143 ,`users`.`streetb` as Streetb
144 ,`users`.`city` as City
145 ,`users`.`state` as State
146 ,`users`.`zip` as Zip
147 ,`users`.`street2` as Street2
148 ,`users`.`streetb2` as Streetb2
149 ,`users`.`city2` as City2
150 ,`users`.`state2` as State2
151 ,`users`.`zip2` as Zip2
152 ,`users`.`phone` as Phone
153 ,`users`.`fax` as Fax
154 ,`users`.`phonew1` as Phonew1
155 ,`users`.`phonew2` as Phonew2
156 ,`users`.`phonecell` as Phonecell
157 ,`users`.`notes` as Notes
158 ,`users`.`cal_ui` as CalUi
159 ,`users`.`taxonomy` as Taxonomy
160 ,`users`.`calendar` as Calendar
161 ,`users`.`abook_type` as AbookType
162 ,`users`.`pwd_expiration_date` as PwdExpirationDate
163 ,`users`.`pwd_history1` as PwdHistory1
164 ,`users`.`pwd_history2` as PwdHistory2
165 ,`users`.`default_warehouse` as DefaultWarehouse
166 ,`users`.`irnpool` as Irnpool
167 ,`users`.`state_license_number` as StateLicenseNumber
168 ,`users`.`newcrop_user_role` as NewcropUserRole
169 ,`users`.`cpoe` as Cpoe
170 ,`users`.`physician_type` as PhysicianType
173 // the criteria can be used or you can write your own custom logic.
174 // be sure to escape any user input with $criteria->Escape()
175 $sql .= $criteria->GetWhere();
176 $sql .= $criteria->GetOrder();
182 * GetCustomCountQuery returns a fully formed SQL statement that will count
183 * the results. This query must return the correct number of results that
184 * GetCustomQuery would, given the same criteria
186 * @see Reporter::GetCustomCountQuery
187 * @param Criteria $criteria
188 * @return string SQL statement
190 static function GetCustomCountQuery($criteria)
192 $sql = "select count(1) as counter from `users`";
194 // the criteria can be used or you can write your own custom logic.
195 // be sure to escape any user input with $criteria->Escape()
196 $sql .= $criteria->GetWhere();