feat: show collection balance in billing widget (#7454)
[openemr.git] / library / classes / Provider.class.php
blobf648731260fe5821028638b2fb36bea08b014216
1 <?php
3 /************************************************************************
4 prescription.php - Copyright duhlman
6 /usr/share/apps/umbrello/headings/heading.php
8 This file was generated on %date% at %time%
9 The original location of this file is /home/duhlman/uml-generated-code/prescription.php
10 **************************************************************************/
12 /**
13 * class Provider
17 use OpenEMR\Common\ORDataObject\ORDataObject;
19 class Provider extends ORDataObject
21 var $id;
22 var $lname;
23 var $fname;
24 var $federal_drug_id;
25 var $insurance_numbers;
26 var $specialty;
27 var $npi;
28 var $state_license_number;
30 /**
31 * Constructor sets all Prescription attributes to their default value
33 function __construct($id = "", $prefix = "")
35 $this->id = $id;
36 $this->federal_drug_id = "";
37 $this->_table = "users";
38 $this-> npi = "";
39 $this->insurance_numbers = array();
40 $this->state_license_number = "";
41 if ($id != "") {
42 $this->populate();
46 function populate()
48 $res = sqlQuery("SELECT fname,lname,federaldrugid, specialty, npi, state_license_number FROM users where id ='" . add_escape_custom($this->id) . "'");
50 if (is_array($res)) {
51 $this->lname = $res['lname'];
52 $this->fname = $res['fname'];
53 $this->federal_drug_id = $res['federaldrugid'];
54 $this->specialty = $res['specialty'];
55 $this->npi = $res['npi'];
56 $this->state_license_number = $res['state_license_number'];
59 $ins = new InsuranceNumbers();
60 $this->insurance_numbers = $ins->insurance_numbers_factory($this->id);
63 function utility_provider_array()
65 $provider_array = array();
66 $res = sqlQ("Select id,fname,lname from users where authorized = 1");
67 while ($row = sqlFetchArray($res)) {
68 $provider_array[$row['id']] = $row['fname'] . " " . $row['lname'];
71 return $provider_array;
74 function providers_factory($sort = "ORDER BY lname,fname")
76 $psa = array();
77 $sql = "SELECT id FROM " . $this->_table . " where authorized = 1 " . $sort;
78 $results = sqlQ($sql);
80 while ($row = sqlFetchArray($results)) {
81 $psa[] = new Provider($row['id']);
84 return $psa;
87 function get_id()
89 return $this->id;
92 function get_name_display()
94 return $this->fname . " " . $this->lname;
97 function get_specialty()
99 return $this->specialty;
102 function get_provider_number_default()
104 if (!empty($this->insurance_numbers)) {
105 return $this->insurance_numbers[0]->get_provider_number();
109 function get_rendering_provider_number_default()
111 if (!empty($this->insurance_numbers)) {
112 return $this->insurance_numbers[0]->get_rendering_provider_number();
116 function get_insurance_numbers()
118 return $this->insurance_numbers;
121 function get_insurance_numbers_default()
123 return ($this->insurance_numbers[0] ?? null);
126 function get_group_number_default()
128 if (!empty($this->insurance_numbers)) {
129 return $this->insurance_numbers[0]->get_group_number();
133 function get_npi()
135 return $this->npi;
138 function get_state_license_number()
140 return $this->state_license_number;
142 } // end of Provider