Adding support for the 5010 billing standard update.
[openemr.git] / library / classes / X12Partner.class.php
blob78608d51524d332843db9f4786c518616cf0da73
1 <?php
2 require_once("ORDataObject.class.php");
4 /**
5 * class X12Partner
7 */
9 class X12Partner extends ORDataObject{
11 var $id;
12 var $name;
13 var $id_number;
14 var $x12_sender_id; // ISA06
15 var $x12_receiver_id; // ISA08
16 var $x12_isa05; // Sender Interchange ID Qualifier. ZZ = mutually defined, 01 = Duns, etc.
17 var $x12_isa07; // Receiver Interchange ID Qualifier.
18 var $x12_isa14; // Acknowledgment Requested. 0 = No, 1 = Yes.
19 var $x12_isa15; // Usage Indicator. T = testing, P = production.
20 var $x12_gs02; // Application Sender's Code. Default to ISA06.
21 var $x12_per06; // The submitter's EDI Access Number, if any.
22 var $x12_version;
23 var $processing_format;
24 var $processing_format_array;
26 /**
27 * Constructor sets all Insurance attributes to their default value
30 function X12Partner ($id = "", $prefix = "") {
31 parent::ORDataObject();
32 $this->id = $id;
33 $this->_table = "x12_partners";
34 $this->processing_format_array = $this->_load_enum("processing_format",false);
35 $this->processing_format = $this->processing_format_array[0];
36 //most recent x12 version mandated by HIPAA and CMS
37 // $this->x12_version = "004010X098A1";
38 $this->x12_version = "005010X222A1";
39 $this->x12_isa05 = "ZZ";
40 $this->x12_isa07 = "ZZ";
41 $this->x12_isa14 = "0";
42 if ($id != "") {
43 $this->populate();
47 function x12_partner_factory() {
48 $partners = array();
49 $x = new X12Partner();
50 $sql = "SELECT id FROM " . $x->_table . " order by name";
51 $result = $x->_db->Execute($sql);
52 while($result && !$result->EOF) {
53 $partners[] = new X12Partner($result->fields['id']);
54 $result->MoveNext();
56 return $partners;
59 function get_id() {
60 return $this->id;
63 function set_id($id) {
64 if (is_numeric($id)) {
65 $this->id = $id;
69 function get_name() {
70 return $this->name;
73 function set_name($string) {
74 $this->name = $string;
77 function get_id_number() {
78 return $this->id_number;
81 function set_id_number($string) {
82 $this->id_number = $string;
85 function get_x12_sender_id() {
86 return $this->x12_sender_id;
89 function set_x12_sender_id($string) {
90 $this->x12_sender_id = $string;
93 function get_x12_receiver_id() {
94 return $this->x12_receiver_id;
97 function set_x12_receiver_id($string) {
98 $this->x12_receiver_id = $string;
101 function get_x12_version() {
102 return $this->x12_version;
105 function set_x12_version($string) {
106 $this->x12_version = $string;
109 function get_x12_isa05() {
110 return $this->x12_isa05;
113 function set_x12_isa05($string) {
114 $this->x12_isa05 = $string;
117 function get_x12_isa07() {
118 return $this->x12_isa07;
121 function set_x12_isa07($string) {
122 $this->x12_isa07 = $string;
125 function get_x12_isa14() {
126 return $this->x12_isa14;
129 function set_x12_isa14($string) {
130 $this->x12_isa14 = $string;
133 function get_x12_isa15() {
134 return $this->x12_isa15;
137 function set_x12_isa15($string) {
138 $this->x12_isa15 = $string;
141 function get_x12_gs02() {
142 return $this->x12_gs02;
145 function set_x12_gs02($string) {
146 $this->x12_gs02 = $string;
149 function get_x12_per06() {
150 return $this->x12_per06;
153 function set_x12_per06($string) {
154 $this->x12_per06 = $string;
157 function get_processing_format() {
158 //this is enum so it can be string or int
159 if (!is_numeric($this->processing_format)) {
160 $ta = $this->processing_format_array;
161 return $ta[$this->processing_format];
163 return $this->processing_format;
166 function get_processing_format_array() {
167 //flip it because normally it is an id to name lookup, for templates it needs to be a name to id lookup
168 return array_flip($this->processing_format_array);
171 function set_processing_format($string) {
172 $this->processing_format = $string;
175 function get_x12_isa14_array() {
176 return array(
177 '0' => 'No',
178 '1' => 'Yes',
182 function get_x12_isa15_array() {
183 return array(
184 'T' => 'Testing',
185 'P' => 'Production',
189 function get_idqual_array() {
190 return array(
191 '01' => 'Duns (Dun & Bradstreet)',
192 '14' => 'Duns Plus Suffix',
193 '20' => 'Health Industry Number (HIN)',
194 '27' => 'Carrier ID from HCFA',
195 '28' => 'Fiscal Intermediary ID from HCFA',
196 '29' => 'Medicare ID from HCFA',
197 '30' => 'U.S. Federal Tax ID Number',
198 '33' => 'NAIC Company Code',
199 'ZZ' => 'Mutually Defined',
203 function get_x12_version_array() {
204 return array(
205 '005010X222A1' => '005010X222A1',
206 '004010X098A1' => '004010X098A1',